Skip to content

Remove CLI and ledger support from tauri app#2097

Open
big14way wants to merge 1 commit intorainlanguage:mainfrom
big14way:remove-cli-ledger-support
Open

Remove CLI and ledger support from tauri app#2097
big14way wants to merge 1 commit intorainlanguage:mainfrom
big14way:remove-cli-ledger-support

Conversation

@big14way
Copy link
Copy Markdown

@big14way big14way commented Aug 24, 2025

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 #2028

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

  • Refactor
    • Removed Ledger wallet support across the app; flows now use WalletConnect only. Simplified connect/execute modals and removed Ledger UI components and settings.
  • New Features
    • Added clear network mismatch warning when connected wallet is on the wrong network.
  • Style
    • Updated signing prompt to “Please review and sign the transaction in your wallet.”
  • Chores
    • Removed the standalone CLI and related commands from the app and backend, including the Tauri wallet endpoint.
    • Cleaned up unused stores, services, and icons tied to Ledger functionality.

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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 24, 2025

Walkthrough

This 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

Cohort / File(s) Summary
• Workspace/CLI removal
Cargo.toml
Removed rain_orderbook_cli from workspace dependencies.
• CLI crate deleted
crates/cli/Cargo.toml, crates/cli/src/*
Deleted the CLI crate: entrypoint, trait, commands (order, trade, vault, subgraph, chart, quote, words), utilities (output, status, subgraph, transaction), and tests.
• Build scripts
flake.nix, packages/orderbook/package.json
Changed cargo build invocations to stop excluding the CLI; now only excludes integration tests.
• Tauri backend wallet command removal
tauri-app/src-tauri/src/commands/mod.rs, .../wallet.rs, .../main.rs
Removed the wallet module exposure and get_address_from_ledger Tauri command and handler wiring.
• UI components (Ledger removed, flows simplified)
packages/ui-components/src/lib/components/IconLedger.svelte, tauri-app/src/lib/components/InputLedgerWallet.svelte, tauri-app/src/lib/components/ModalConnect.svelte, tauri-app/src/lib/components/ModalExecute.svelte, tauri-app/src/lib/components/TransactionStatusNotice.svelte, tauri-app/src/lib/components/ModalVaultDeposit.svelte, tauri-app/src/lib/components/ModalVaultWithdraw.svelte, tauri-app/src/lib/components/modal/ModalOrderRemove.svelte
Removed Ledger components and paths; simplified connect/execute modals to WalletConnect-only; updated pending-sign message to be wallet-agnostic; adjusted deposit/withdraw/remove modals to single WalletConnect path.
• Services and stores
tauri-app/src/lib/services/wallet.ts, .../order.ts, .../vault.ts, tauri-app/src/lib/stores/wallets.ts, tauri-app/src/routes/+layout.svelte
Removed getAddressFromLedger; replaced derivation_index with null in tx args; removed Ledger stores; derived account solely from WalletConnect.
• Order add page
tauri-app/src/routes/orders/add/+page.svelte
Removed Ledger execution path and prop; kept WalletConnect flow.
• Tests removed/updated
tauri-app/src/lib/__tests__/executeLedgerOrder.test.ts, tauri-app/src/lib/components/ModalConnect.test.ts, tauri-app/src/lib/components/ModalExecute.test.ts
Deleted Ledger tests; updated modal tests to remove Ledger paths and props.
• Misc
tauri-app/src/lib/services/executeLedgerOrder.ts, tauri-app/tsconfig.json
Removed executeLedgerOrder service and its logic; added trailing newline to tsconfig.

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
Loading
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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Assessment against linked issues

Objective Addressed Explanation
Remove CLI from repository (#2028) CLI code is removed, but build scripts now include CLI in wasm builds, creating ambiguity.
Remove Ledger support from Tauri app backend (commands) (#2028)
Remove Ledger support from web UI (components/flows) (#2028)
Remove Ledger-dependent services/stores and update consumers (#2028)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Include CLI in wasm builds (flake.nix; packages/orderbook/package.json) Change enables building the CLI while the objective is to remove CLI; this diverges from the stated goal and may reintroduce the removed crate into builds.

Possibly related PRs

Suggested labels

rust, Tauri, webapp

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 undefined while others send null. Mixed semantics can be confusing and harder to test, even if serde maps both to None when using Option. Align this to null.

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 undefined

If chainId is undefined, $walletConnectNetwork !== chainId is always true, disabling the button even when any network is acceptable. Gate the mismatch check on chainId !== 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 label

Same issue as above: don’t render the mismatch when chainId is undefined. Also avoid getNetworkName(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 isNetworkMismatch store to DRY this logic.


64-67: Don’t auto-close on failure; only reset on successful execution

finally(() => reset()) closes the modal even when executeWalletconnect() 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 provider

Now that Ledger is removed, this screen shows a single “WalletConnect” choice. Consider defaulting selectedWalletconnect = true to jump straight into the connection UI, keeping the top-level back button for navigation.


70-75: Tests: add assertions for network mismatch and disabled state

Extend tauri-app/src/lib/components/ModalExecute.test.ts to cover:

  • mismatch banner appears only when chainId is defined and differs
  • execute button disabled on mismatch and when not connected
  • happy path: enabled when connected to the expected chainId

I can draft these tests if helpful.


1-11: Remove all remaining Ledger references across the codebase

A 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 variant LedgerError(#[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 of LedgerSigner

Ensure 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_tool change 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-artifacts is 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 in rainix-wasm-test intact.

-              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_common

Note: 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.

📥 Commits

Reviewing files that changed from the base of the PR and between f41a7be and 02f46d0.

⛔ Files ignored due to path filters (1)
  • package-lock.json is 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.json
  • flake.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.json
  • flake.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.json
  • flake.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.json
  • flake.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.svelte
  • tauri-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 prompt

Confirmed 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
The TransactionArgs struct in crates/common/src/transaction.rs defines derivation_index as Option<usize>, and Rust’s deserializer treats both JSON null and a missing field the same—mapping them to None. Your TS payloads use derivation_index: null, which correctly serializes to JSON null and yields None on the Rust side.

No changes are required to satisfy the Option-based expectation.
• Optional: for consistency, consider replacing the one derivation_index: undefined (order.ts line 50) with null to 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: null correctly maps to Rust None

  • In crates/common/src/transaction.rs, derivation_index is declared as Option<usize>, so Serde will deserialize a JSON null (or a missing field) into None.
  • In tauri-app/src/lib/services/vault.ts, both the deposit flow (lines 26–27) and the withdraw flow (lines 53–54) now set derivation_index: null, matching the removal of explicit Ledger paths and aligning with Rust’s None handling (which then defaults to index 0 via unwrap_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 good

The 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 casing

The Flowbite-Svelte Modal component expects the outsideClose prop (camelCase), and size="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/cli directory
  • The [workspace] members in Cargo.toml cover only crates/*, and none reference “cli”
  • No occurrences of rain_orderbook_cli remain in any Cargo.toml

Removing 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
The build-wasm command no longer needs to exclude any CLI crate—there are no remaining orderbook_cli entries in workspace members or Cargo.toml. Cargo will now successfully build all remaining crates without the --exclude flag.

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';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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>;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 executeWalletconnectexecuteWalletConnect 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' -C3

Length of output: 9720


Naming consistency (optional): rename executeWalletconnectexecuteWalletConnect

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] : []} />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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.

Suggested change
<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.

@findolor
Copy link
Copy Markdown
Collaborator

findolor commented Aug 29, 2025

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove CLI and ledger support from tauri app

2 participants