Remove CLI and ledger support from tauri app#2097
Remove CLI and ledger support from tauri app#2097big14way wants to merge 1 commit intorainlanguage:mainfrom
Conversation
This commit removes unused CLI and ledger functionality to reduce maintenance overhead and attack surface: - Remove entire /crates/cli directory with order, vault, trade commands - Remove ledger wallet integration (InputLedgerWallet, executeLedgerOrder) - Update modals to only support WalletConnect - Clean up 57 files removing 5700+ lines of unused code - Update build configurations and workspace dependencies Resolves rainlanguage#2028
WalkthroughThis change removes the entire Rust CLI crate and all CLI commands, eliminates Ledger wallet support across the Tauri app and web UI, updates services/stores to remove Ledger dependencies, and adjusts UI flows to rely solely on WalletConnect. Build scripts were modified to no longer exclude the CLI from wasm builds. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI as ModalConnect
participant WC as WalletConnect
User->>UI: Open "Connect to Wallet"
alt Not connected
UI->>WC: Initiate connection
WC-->>UI: Account connected
else Connected
UI-->>User: Show connected state
end
sequenceDiagram
autonumber
actor User
participant UI as ModalExecute
participant WC as WalletConnect
participant Chain as RPC
User->>UI: Click "Proceed"
alt WalletConnect connected and network matches
UI->>WC: Build tx and request signature
WC-->>UI: Tx hash
UI->>Chain: Wait for 1 confirmation
Chain-->>UI: Receipt
UI-->>User: Success
else Not connected or wrong network
UI-->>User: Error / guidance
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
Suggested labels
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (11)
tauri-app/tsconfig.json (1)
18-18: Deduplicate include entry.The path "../packages/ui-components/src/tests/hex.test.ts" appears twice in the include list. Harmless, but it’s noise and may confuse tooling or future readers.
Apply this diff to deduplicate:
- "include": ["./vitest-setup.ts", "./src/**/*", "../packages/ui-components/src/__tests__/hex.test.ts", "../packages/ui-components/src/__tests__/hex.test.ts"], + "include": ["./vitest-setup.ts", "./src/**/*", "../packages/ui-components/src/__tests__/hex.test.ts"],tauri-app/src/lib/services/order.ts (1)
50-50: Standardize on null (not undefined) for derivation_index in orderAddCalldata.This function still sends
undefinedwhile others sendnull. Mixed semantics can be confusing and harder to test, even if serde maps both to None when usingOption. Align this tonull.Apply this diff:
- derivation_index: undefined, + derivation_index: null,tauri-app/src/lib/components/ModalExecute.svelte (6)
65-65: Disable condition wrongly blocks execution when chainId is undefinedIf
chainIdis undefined,$walletConnectNetwork !== chainIdis always true, disabling the button even when any network is acceptable. Gate the mismatch check onchainId !== undefined.- disabled={isSubmitting || !$walletconnectAccount || $walletConnectNetwork !== chainId} + disabled={isSubmitting || !$walletconnectAccount || (chainId !== undefined && $walletConnectNetwork !== chainId)}
70-75: Only show network-mismatch error when chainId is defined; fix fallback labelSame issue as above: don’t render the mismatch when
chainIdis undefined. Also avoidgetNetworkName(chainId ?? 0)which can mislabel. Prefer an explicit fallback.- {#if $walletconnectAccount && $walletConnectNetwork !== chainId} + {#if $walletconnectAccount && chainId !== undefined && $walletConnectNetwork !== chainId} <div class="text-red-500" data-testid="network-connection-error"> You are connected to {getNetworkName($walletConnectNetwork) || 'an unknown'} network. Please - connect your wallet to {overrideNetwork?.key || getNetworkName(chainId ?? 0) || 'unknown'} + connect your wallet to {overrideNetwork?.key || (chainId !== undefined ? getNetworkName(chainId) : 'unknown')} network. </div>If you want, I can push a small follow-up PR to implement a single derived
isNetworkMismatchstore to DRY this logic.
64-67: Don’t auto-close on failure; only reset on successful execution
finally(() => reset())closes the modal even whenexecuteWalletconnect()fails. Keep the modal open on errors so users can read the error and retry.- <ButtonLoading - on:click={() => executeWalletconnect().finally(() => reset())} + <ButtonLoading + on:click={async () => { + try { + await executeWalletconnect(); + reset(); + } catch { + // Keep modal open; error toast/handler should surface details. + } + }} disabled={isSubmitting || !$walletconnectAccount || (chainId !== undefined && $walletConnectNetwork !== chainId)} loading={isSubmitting} >
32-41: Optional UX: auto-open WalletConnect when it’s the only providerNow that Ledger is removed, this screen shows a single “WalletConnect” choice. Consider defaulting
selectedWalletconnect = trueto jump straight into the connection UI, keeping the top-level back button for navigation.
70-75: Tests: add assertions for network mismatch and disabled stateExtend
tauri-app/src/lib/components/ModalExecute.test.tsto cover:
- mismatch banner appears only when
chainIdis defined and differs- execute button disabled on mismatch and when not connected
- happy path: enabled when connected to the expected
chainIdI can draft these tests if helpful.
1-11: Remove all remaining Ledger references across the codebaseA repo-wide sweep still uncovered Ledger-related imports and code. Please remove or replace these before merging:
- tauri-app/src-tauri/src/error.rs
•use alloy::signers::ledger::LedgerError;
• Enum variantLedgerError(#[from] LedgerError)- tauri-app/src-tauri/src/commands/order.rs
• Comment:// NOTE: unimplemented due to order_add depending on Ledger- packages/ui-components/src/lib/index.ts
•export { default as IconLedger } from './components/IconLedger.svelte';- crates/common/src/transaction.rs
• Imports:signers::ledger::{HDPath, LedgerError, LedgerSigner}
• Error variants and usage ofLedgerSignerEnsure no leftover
@ledgerhq/*dependencies, “Ledger” strings, or CLI flags remain in CI/configs.flake.nix (3)
176-180: Remove macOS libusb bundling; Ledger support is being removed.These lines explicitly package libusb dylib, which is unnecessary (and increases attack surface) once Ledger is gone. Recommend deleting this block.
- cp ${pkgs.libusb1}/lib/libusb-1.0.0.dylib lib/libusb-1.0.0.dylib - chmod +w lib/libusb-1.0.0.dylib - install_name_tool -id @executable_path/../Frameworks/libusb-1.0.0.dylib lib/libusb-1.0.0.dylib - otool -L lib/libusb-1.0.0.dylib
192-195: Also drop libusb re-linking in the final bundle step.This
install_name_toolchange for libusb is no longer needed without Ledger. Removing it avoids shipping an unused dependency.- install_name_tool -change ${pkgs.libusb1}/lib/libusb-1.0.0.dylib @executable_path/../Frameworks/libusb-1.0.0.dylib src-tauri/target/release/Raindex
206-213: Optional: narrow the wasm build to only crates that emit JS-facing artifacts to speed up CI.If the intent of
rainix-wasm-artifactsis to build the JS bindings, consider targeting just the wasm-ready crates instead of the whole workspace. This can shave minutes off CI while keeping test coverage inrainix-wasm-testintact.- cargo build -r --target wasm32-unknown-unknown --lib --workspace --exclude rain_orderbook_integration_tests + cargo build -r --target wasm32-unknown-unknown --lib \ + -p rain_orderbook_quote \ + -p rain_orderbook_bindings \ + -p rain_orderbook_js_api \ + -p rain_orderbook_commonNote: This is optional. It must align with the repository’s prior decision to keep WASM dependencies available across non-WASM targets for testing. If other libraries must continue to build for WASM under this task, keep the current workspace build.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (56)
Cargo.toml(0 hunks)crates/cli/Cargo.toml(0 hunks)crates/cli/src/commands/chart.rs(0 hunks)crates/cli/src/commands/mod.rs(0 hunks)crates/cli/src/commands/order/add.rs(0 hunks)crates/cli/src/commands/order/calldata.rs(0 hunks)crates/cli/src/commands/order/compose.rs(0 hunks)crates/cli/src/commands/order/detail.rs(0 hunks)crates/cli/src/commands/order/list.rs(0 hunks)crates/cli/src/commands/order/listorderfrontmatterkeys.rs(0 hunks)crates/cli/src/commands/order/mod.rs(0 hunks)crates/cli/src/commands/order/orderbook_address.rs(0 hunks)crates/cli/src/commands/order/remove.rs(0 hunks)crates/cli/src/commands/quote/mod.rs(0 hunks)crates/cli/src/commands/subgraph/mod.rs(0 hunks)crates/cli/src/commands/trade/detail.rs(0 hunks)crates/cli/src/commands/trade/list.rs(0 hunks)crates/cli/src/commands/trade/mod.rs(0 hunks)crates/cli/src/commands/vault/deposit.rs(0 hunks)crates/cli/src/commands/vault/detail.rs(0 hunks)crates/cli/src/commands/vault/list.rs(0 hunks)crates/cli/src/commands/vault/list_balance_changes.rs(0 hunks)crates/cli/src/commands/vault/mod.rs(0 hunks)crates/cli/src/commands/vault/withdraw.rs(0 hunks)crates/cli/src/commands/words.rs(0 hunks)crates/cli/src/execute.rs(0 hunks)crates/cli/src/lib.rs(0 hunks)crates/cli/src/main.rs(0 hunks)crates/cli/src/output.rs(0 hunks)crates/cli/src/status.rs(0 hunks)crates/cli/src/subgraph.rs(0 hunks)crates/cli/src/transaction.rs(0 hunks)flake.nix(1 hunks)packages/orderbook/package.json(1 hunks)packages/ui-components/src/lib/components/IconLedger.svelte(0 hunks)tauri-app/src-tauri/src/commands/mod.rs(0 hunks)tauri-app/src-tauri/src/commands/wallet.rs(0 hunks)tauri-app/src-tauri/src/main.rs(0 hunks)tauri-app/src/lib/__tests__/executeLedgerOrder.test.ts(0 hunks)tauri-app/src/lib/components/InputLedgerWallet.svelte(0 hunks)tauri-app/src/lib/components/ModalConnect.svelte(2 hunks)tauri-app/src/lib/components/ModalConnect.test.ts(0 hunks)tauri-app/src/lib/components/ModalExecute.svelte(2 hunks)tauri-app/src/lib/components/ModalExecute.test.ts(0 hunks)tauri-app/src/lib/components/ModalVaultDeposit.svelte(0 hunks)tauri-app/src/lib/components/ModalVaultWithdraw.svelte(0 hunks)tauri-app/src/lib/components/TransactionStatusNotice.svelte(1 hunks)tauri-app/src/lib/components/modal/ModalOrderRemove.svelte(0 hunks)tauri-app/src/lib/services/executeLedgerOrder.ts(0 hunks)tauri-app/src/lib/services/order.ts(2 hunks)tauri-app/src/lib/services/vault.ts(2 hunks)tauri-app/src/lib/services/wallet.ts(0 hunks)tauri-app/src/lib/stores/wallets.ts(0 hunks)tauri-app/src/routes/+layout.svelte(1 hunks)tauri-app/src/routes/orders/add/+page.svelte(0 hunks)tauri-app/tsconfig.json(1 hunks)
💤 Files with no reviewable changes (47)
- tauri-app/src/lib/components/ModalExecute.test.ts
- Cargo.toml
- packages/ui-components/src/lib/components/IconLedger.svelte
- crates/cli/src/status.rs
- crates/cli/src/commands/trade/detail.rs
- tauri-app/src/lib/services/wallet.ts
- tauri-app/src-tauri/src/commands/mod.rs
- tauri-app/src/lib/stores/wallets.ts
- crates/cli/Cargo.toml
- crates/cli/src/execute.rs
- crates/cli/src/commands/order/mod.rs
- crates/cli/src/main.rs
- tauri-app/src/lib/components/ModalVaultDeposit.svelte
- tauri-app/src/lib/services/executeLedgerOrder.ts
- crates/cli/src/commands/trade/mod.rs
- crates/cli/src/commands/chart.rs
- crates/cli/src/commands/order/remove.rs
- crates/cli/src/commands/vault/mod.rs
- tauri-app/src/lib/tests/executeLedgerOrder.test.ts
- crates/cli/src/lib.rs
- crates/cli/src/commands/subgraph/mod.rs
- crates/cli/src/commands/vault/list_balance_changes.rs
- crates/cli/src/commands/vault/list.rs
- crates/cli/src/commands/vault/detail.rs
- tauri-app/src/lib/components/ModalConnect.test.ts
- crates/cli/src/commands/order/list.rs
- crates/cli/src/transaction.rs
- crates/cli/src/commands/order/orderbook_address.rs
- tauri-app/src/lib/components/modal/ModalOrderRemove.svelte
- crates/cli/src/output.rs
- tauri-app/src/lib/components/ModalVaultWithdraw.svelte
- crates/cli/src/commands/words.rs
- crates/cli/src/commands/vault/deposit.rs
- tauri-app/src-tauri/src/main.rs
- tauri-app/src-tauri/src/commands/wallet.rs
- crates/cli/src/subgraph.rs
- crates/cli/src/commands/quote/mod.rs
- crates/cli/src/commands/vault/withdraw.rs
- crates/cli/src/commands/order/calldata.rs
- crates/cli/src/commands/order/compose.rs
- crates/cli/src/commands/order/listorderfrontmatterkeys.rs
- crates/cli/src/commands/mod.rs
- tauri-app/src/routes/orders/add/+page.svelte
- crates/cli/src/commands/order/detail.rs
- tauri-app/src/lib/components/InputLedgerWallet.svelte
- crates/cli/src/commands/order/add.rs
- crates/cli/src/commands/trade/list.rs
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: brusherru
PR: rainlanguage/rain.orderbook#2044
File: tauri-app/src/routes/orders/[chainId]-[orderbook]-[orderHash]/+page.svelte:76-78
Timestamp: 2025-07-31T19:03:56.594Z
Learning: In the rainlanguage/rain.orderbook project, when the Tauri app has issues preventing proper testing, the team prefers to defer Tauri-specific implementations to separate PRs rather than including untested code, especially for financial operations like withdrawals.
Learnt from: rouzwelt
PR: rainlanguage/rain.orderbook#0
File: :0-0
Timestamp: 2025-05-21T21:26:31.566Z
Learning: For PR #1884 and future PRs in rainlanguage/rain.orderbook repository, provide PR size reports in a separate comment with ONLY the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number", without any additional text or explanation. Reports should exclude irrelevant files such as lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).
📚 Learning: 2025-05-20T12:03:18.032Z
Learnt from: hardingjam
PR: rainlanguage/rain.orderbook#1870
File: packages/webapp/src/lib/components/WithdrawModal.svelte:31-31
Timestamp: 2025-05-20T12:03:18.032Z
Learning: The VaultActionArgs type no longer contains an action property after refactoring the deposit/withdraw modals into separate components.
Applied to files:
tauri-app/src/lib/services/vault.ts
📚 Learning: 2025-05-14T05:13:59.713Z
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1744
File: crates/subgraph/src/orderbook_client.rs:44-46
Timestamp: 2025-05-14T05:13:59.713Z
Learning: In the rain.orderbook project, WASM dependencies are intentionally made available in non-WASM targets to facilitate testing of WASM-related functionality, so conditional compilation guards like `#[cfg(target_family = "wasm")]` should not be added to imports or implementations that may be needed for tests.
Applied to files:
packages/orderbook/package.jsonflake.nix
📚 Learning: 2025-05-14T04:49:14.621Z
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1710
File: crates/quote/Cargo.toml:30-30
Timestamp: 2025-05-14T04:49:14.621Z
Learning: In the rain.orderbook repository, wasm-bindgen-utils is intentionally used as an unconditional dependency because non-wasm targets (like tests) sometimes need to use it.
Applied to files:
packages/orderbook/package.jsonflake.nix
📚 Learning: 2025-06-06T16:38:04.182Z
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1913
File: Cargo.toml:55-55
Timestamp: 2025-06-06T16:38:04.182Z
Learning: In rain.orderbook repository, during PR chains involving dependency updates, wasm-bindgen-utils may temporarily point to git commits that don't contain the full required functionality, with the understanding that subsequent PRs in the chain will update it to the correct commit.
Applied to files:
packages/orderbook/package.json
📚 Learning: 2025-07-31T19:34:11.716Z
Learnt from: brusherru
PR: rainlanguage/rain.orderbook#2044
File: crates/common/src/raindex_client/vaults_list.rs:363-423
Timestamp: 2025-07-31T19:34:11.716Z
Learning: In the rainlanguage/rain.orderbook project, for WASM-exposed functionality like VaultsList, the team prefers to keep comprehensive tests in the non-WASM environment due to the complexity of recreating objects like RaindexVaults in WASM. WASM tests focus on basic functionality and error cases since the WASM code reuses the already-tested non-WASM implementation.
Applied to files:
packages/orderbook/package.jsonflake.nix
📚 Learning: 2025-04-30T09:28:36.960Z
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1715
File: crates/js_api/src/common/mod.rs:111-118
Timestamp: 2025-04-30T09:28:36.960Z
Learning: In the rain.orderbook repository, the WASM tests are already properly configured with conditional compilation using `#[cfg(target_family = "wasm")]` and `#[cfg(not(target_family = "wasm"))]`, and don't require additional `wasm_bindgen_test_configure!(run_in_browser)` directives.
Applied to files:
packages/orderbook/package.jsonflake.nix
📚 Learning: 2025-07-01T21:26:42.195Z
Learnt from: rouzwelt
PR: rainlanguage/rain.orderbook#1955
File: packages/orderbook/package.json:40-40
Timestamp: 2025-07-01T21:26:42.195Z
Learning: In the rain.orderbook project, the team does not require cross-platform compatibility improvements for the TypeScript check script in packages/orderbook/package.json. The current brace expansion syntax "./dist/**/*.{ts,js}" is sufficient for their development environment.
Applied to files:
packages/orderbook/package.json
📚 Learning: 2025-08-02T02:34:32.237Z
Learnt from: brusherru
PR: rainlanguage/rain.orderbook#2036
File: crates/js_api/src/filters/raindex_filter_store.rs:446-533
Timestamp: 2025-08-02T02:34:32.237Z
Learning: In the rainlanguage/rain.orderbook project's RaindexFilterStore WASM tests (crates/js_api/src/filters/raindex_filter_store.rs), brusherru decided to focus on testing only methods without side effects (that don't use web_sys) due to difficulties with mocking localStorage and window APIs in the WASM test environment. This pragmatic approach tests pure logic separately from browser integration.
Applied to files:
packages/orderbook/package.json
📚 Learning: 2025-05-14T05:51:50.277Z
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1715
File: crates/js_api/src/common/mod.rs:55-59
Timestamp: 2025-05-14T05:51:50.277Z
Learning: In the Rain Orderbook project, the error handling for WASM exported functions uses WasmEncodedError which includes both the original error message and a human-readable version, making direct modification of the JsValue conversion unnecessary.
Applied to files:
packages/orderbook/package.json
📚 Learning: 2025-08-14T14:16:34.044Z
Learnt from: brusherru
PR: rainlanguage/rain.orderbook#2083
File: packages/ui-components/src/lib/components/tables/VaultsListTable.svelte:205-205
Timestamp: 2025-08-14T14:16:34.044Z
Learning: In the VaultsListTable component, the `matchesAccount` function from the wallet provider may not properly update on wallet connect/disconnect events, making direct comparison with the reactive `$account` variable more reliable for UI visibility checks. The `matchesAccount` function needs future refactoring to handle wallet state changes properly.
Applied to files:
tauri-app/src/routes/+layout.sveltetauri-app/src/lib/components/ModalConnect.svelte
📚 Learning: 2025-06-04T10:21:01.388Z
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1907
File: packages/orderbook/test/common/test.test.ts:75-77
Timestamp: 2025-06-04T10:21:01.388Z
Learning: The DotrainOrder.create API in packages/orderbook/test/common/test.test.ts is internal and not used directly in consumer applications, so API changes here don't require external breaking change documentation.
Applied to files:
tauri-app/src/lib/services/order.ts
📚 Learning: 2025-05-20T12:05:48.570Z
Learnt from: hardingjam
PR: rainlanguage/rain.orderbook#1870
File: packages/webapp/src/__tests__/WithdrawModal.test.ts:291-303
Timestamp: 2025-05-20T12:05:48.570Z
Learning: The modal closing behavior in the WithdrawModal component is handled by Flowbite's native implementation rather than through component props, making it unnecessary to test the open state changes directly.
Applied to files:
tauri-app/src/lib/components/ModalConnect.svelte
📚 Learning: 2025-07-29T12:30:44.350Z
Learnt from: findolor
PR: rainlanguage/rain.orderbook#2045
File: packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte:52-59
Timestamp: 2025-07-29T12:30:44.350Z
Learning: In packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte, the bind:this approach doesn't work for auto-focusing the Flowbite Input component when the modal opens, requiring the use of document.querySelector('.token-search-input') instead as a working solution.
Applied to files:
tauri-app/src/lib/components/ModalConnect.svelte
📚 Learning: 2025-07-24T08:16:47.393Z
Learnt from: brusherru
PR: rainlanguage/rain.orderbook#2002
File: tauri-app/src/lib/components/ModalMultipleVaultsWithdraw.svelte:20-25
Timestamp: 2025-07-24T08:16:47.393Z
Learning: In the Rain OrderBook Tauri app, modal components directly mutate the `open` prop (setting `open = false`) as a consistent pattern across the codebase. This approach is maintained for consistency even though it violates typical Svelte one-way data flow, with plans to refactor all modals together in the future rather than making isolated changes.
Applied to files:
tauri-app/src/lib/components/ModalConnect.svelte
🔇 Additional comments (10)
tauri-app/tsconfig.json (1)
24-24: LGTM: trailing newline only; no functional impact.This is a harmless formatting change and aligns with common style guides that require a newline at EOF.
tauri-app/src/lib/components/TransactionStatusNotice.svelte (1)
26-26: Add trailing period to generic transaction promptConfirmed no occurrences of the old Ledger-specific string remain in the codebase. Apply the following diff to ensure consistent punctuation:
--- a/tauri-app/src/lib/components/TransactionStatusNotice.svelte +++ b/tauri-app/src/lib/components/TransactionStatusNotice.svelte @@ -26,1 +26,1 @@ - <div>Please review and sign the transaction in your wallet</div> + <div>Please review and sign the transaction in your wallet.</div>tauri-app/src/lib/services/order.ts (1)
17-19: derivation_index Option mapping verified
TheTransactionArgsstruct incrates/common/src/transaction.rsdefinesderivation_indexasOption<usize>, and Rust’s deserializer treats both JSONnulland a missing field the same—mapping them toNone. Your TS payloads usederivation_index: null, which correctly serializes to JSONnulland yieldsNoneon the Rust side.No changes are required to satisfy the Option-based expectation.
• Optional: for consistency, consider replacing the onederivation_index: undefined(order.ts line 50) withnullto keep all invocations uniform.tauri-app/src/routes/+layout.svelte (1)
31-33: Deriving account solely from WalletConnect is consistent with Ledger removal.The simplification is correct and aligns with the new single-wallet path. No action needed.
tauri-app/src/lib/services/vault.ts (1)
26-27: Verified:derivation_index: nullcorrectly maps to RustNone
- In
crates/common/src/transaction.rs,derivation_indexis declared asOption<usize>, so Serde will deserialize a JSONnull(or a missing field) intoNone.- In
tauri-app/src/lib/services/vault.ts, both the deposit flow (lines 26–27) and the withdraw flow (lines 53–54) now setderivation_index: null, matching the removal of explicit Ledger paths and aligning with Rust’sNonehandling (which then defaults to index 0 viaunwrap_or(0)).No further changes are required here.
tauri-app/src/lib/components/ModalConnect.svelte (1)
11-11: Label fallback reads well and matches single-wallet flow.Using "Connect to Wallet" when disconnected is clear and consistent.
tauri-app/src/lib/components/ModalExecute.svelte (2)
32-53: Provider-flow simplification after Ledger removal looks goodThe conditional rendering now cleanly gates on WalletConnect only. The back-button handling is preserved and the modal footprint is smaller. No functional concerns here.
31-31: Fix Flowbite-Svelte Modal prop casingThe Flowbite-Svelte Modal component expects the
outsideCloseprop (camelCase), andsize="sm"is a valid option.• Location to update
- tauri-app/src/lib/components/ModalExecute.svelte (line 31)
• Change required
-<Modal {title} bind:open outsideclose={!isSubmitting} size="sm" on:close={reset}> +<Modal {title} bind:open outsideClose={!isSubmitting} size="sm" on:close={reset}>[size="sm" is supported by Flowbite-Svelte]
flake.nix (1)
211-211: Verified removal of the CLI crate – changes approved
- There is no top-level
crates/clidirectory- The
[workspace]members inCargo.tomlcover onlycrates/*, and none reference “cli”- No occurrences of
rain_orderbook_cliremain in anyCargo.tomlRemoving the CLI exclusion is safe and cleans up confusion.
packages/orderbook/package.json (1)
35-35: Cleanup confirmed: CLI crate fully removed from the workspace
Thebuild-wasmcommand no longer needs to exclude any CLI crate—there are no remainingorderbook_clientries in workspace members or Cargo.toml. Cargo will now successfully build all remaining crates without the--excludeflag.
| import { ledgerWalletAddress } from '$lib/stores/wallets'; | ||
| import InputWalletConnect from '$lib/components/InputWalletConnect.svelte'; | ||
| import { IconLedger, IconWalletConnect } from '@rainlanguage/ui-components'; | ||
| import { IconWalletConnect } from '@rainlanguage/ui-components'; |
There was a problem hiding this comment.
Fix no-op WalletConnect button inside the modal (and drop unused icon import).
The "WalletConnect" button's on:click sets open = true while already inside an open modal—this is a no-op and can confuse users. Since InputWalletConnect is rendered unconditionally below, the button is redundant. Remove the button block and the now-unused IconWalletConnect import.
Apply this diff:
-import { IconWalletConnect } from '@rainlanguage/ui-components';
@@
- <div class="flex justify-center">
- <Button class="text-lg" on:click={() => (open = true)}>
- <div class="mr-3">
- <IconWalletConnect />
- </div>
- WalletConnect
- </Button>
- </div>
+ <!-- WalletConnect button removed; InputWalletConnect is shown directly -->If you prefer to keep a button, wire it to an actual action (e.g., calling a connect() method on InputWalletConnect via a ref) rather than toggling open.
Also applies to: 23-31
🤖 Prompt for AI Agents
In tauri-app/src/lib/components/ModalConnect.svelte around lines 4 and 23-31,
remove the unused IconWalletConnect import and delete the WalletConnect button
block whose on:click sets open = true (a no-op inside the already-open modal).
Either remove the button entirely and ensure InputWalletConnect remains
rendered, or if you want to keep a button, wire it to a real action by obtaining
a ref to InputWalletConnect and calling its connect() method (or dispatching a
connect event) instead of toggling open; also run a quick lint/TS check to
remove the now-unused import.
| export let title: string; | ||
| export let execButtonLabel: string; | ||
| export let executeLedger: () => Promise<void>; | ||
| export let executeWalletconnect: () => Promise<void>; |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Naming consistency: consider executeWalletConnect (camel-cased Connect)
Minor consistency nit. Throughout the codebase “WalletConnect” tends to be PascalCased/CamelCased as a single word. Consider renaming executeWalletconnect → executeWalletConnect to match imports like IconWalletConnect. This is a breaking prop rename; defer if out-of-scope for this PR.
Run to see call sites:
🏁 Script executed:
#!/bin/bash
rg -nP --type=ts --type=svelte -C2 '\bexecuteWalletconnect\b'Length of output: 94
🏁 Script executed:
#!/bin/bash
# Search for any references to the prop name across the repo
rg -n '\bexecuteWalletconnect\b' -C2
# Locate where ModalExecute.svelte is imported and used in .svelte files
rg -n 'ModalExecute' -g '*.svelte' -C3Length of output: 9720
Naming consistency (optional): rename executeWalletconnect → executeWalletConnect
This prop currently deviates from the “WalletConnect” Pascal/CamelCase convention and is used in multiple places. Renaming it will introduce breaking changes across these locations:
• src/lib/components/ModalExecute.svelte
– Export and all internal references (on:click={() => executeWalletconnect()…})
• src/lib/components/ModalExecute.test.ts (lines 54 & 78)
• src/routes/orders/add/+page.svelte (line 268)
• src/lib/components/ModalVaultWithdraw.svelte (lines 35 & 136)
• src/lib/components/ModalVaultDeposit.svelte (lines 37 & 172)
• src/lib/components/modal/ModalOrderRemove.svelte (lines 20 & 44)
Because this is a breaking prop rename, consider deferring to a dedicated PR if it’s out of scope for this change set.
🤖 Prompt for AI Agents
In tauri-app/src/lib/components/ModalExecute.svelte around line 15, the exported
prop executeWalletconnect should be renamed to executeWalletConnect for naming
consistency; update the export and every internal reference (e.g., on:click
handlers) in this file, and then update all call sites and tests to the new
name: src/lib/components/ModalExecute.test.ts (lines ~54 & 78),
src/routes/orders/add/+page.svelte (line ~268),
src/lib/components/ModalVaultWithdraw.svelte (lines ~35 & 136),
src/lib/components/ModalVaultDeposit.svelte (lines ~37 & 172), and
src/lib/components/modal/ModalOrderRemove.svelte (lines ~20 & 44); if you need
to avoid a breaking change in this PR, alternatively export the new name and
also re-export the old name as an alias until dependent code is updated.
| </div> | ||
| {:else if selectedWalletconnect || $walletconnectAccount} | ||
| {:else} | ||
| <InputWalletConnect priorityChainIds={chainId ? [chainId] : []} /> |
There was a problem hiding this comment.
Truthiness bug with chainId=0; prefer explicit undefined check
Using chainId ? [chainId] : [] misbehaves for falsy numeric IDs (e.g., 0). Use an explicit undefined check.
- <InputWalletConnect priorityChainIds={chainId ? [chainId] : []} />
+ <InputWalletConnect priorityChainIds={chainId !== undefined ? [chainId] : []} />📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <InputWalletConnect priorityChainIds={chainId ? [chainId] : []} /> | |
| <InputWalletConnect priorityChainIds={chainId !== undefined ? [chainId] : []} /> |
🤖 Prompt for AI Agents
In tauri-app/src/lib/components/ModalExecute.svelte around line 54, the prop
expression `chainId ? [chainId] : []` treats numeric 0 as falsy and drops valid
chain IDs; change the check to an explicit undefined/null test (for example use
`chainId !== undefined ? [chainId] : []` or `chainId != null ? [chainId] : []`)
so 0 is preserved while undefined/null still yields an empty array.
|
@big14way Thank you for the PR. Currently we are migrating to a new architecture for supporting local db on the browser and we use some of the cli commands while doing so. I think it's best to wait and revisit this PR once we have the cli commands on main. That way we only have those and we can remove the rest just like in here. This is the PR #2102 If we merge this now we have to re-implement the cli crate again which does not make sense. |
This commit removes unused CLI and ledger functionality to reduce maintenance overhead and attack surface:
Resolves #2028
Checks
By submitting this for review, I'm confirming I've done the following:
Summary by CodeRabbit