Skip to content

Conversation

@findolor
Copy link
Collaborator

Chained PRs

Motivation

See issues:

Phase 5 of the vaultless orders implementation. Updates the webapp order detail page to properly display vaultless tokens which use vault_id = 0 to indicate direct wallet-based trading rather than vault-based.

Solution

Core Changes

  • Added vaultless field to RaindexVault to distinguish wallet-based from vault-based tokens
  • Unified RaindexAmount type across rust and js_api for consistent balance/allowance representation
  • Created VaultlessTokenDisplay component for rendering vaultless tokens with wallet balance and allowance info

Order Detail Updates

  • OrderDetail.svelte now detects vaultless tokens and renders them differently
  • VaultCard.svelte updated to handle vaultless tokens - hides deposit/withdraw buttons and shows wallet info
  • Vaultless tokens don't link to vault detail page (vault doesn't exist as entity)

Modal Updates

  • DepositModal.svelte and WithdrawModal.svelte updated to work with RaindexAmount type
  • Tauri modals similarly updated for consistency

Testing

  • Added VaultlessTokenDisplay.test.ts with comprehensive test coverage
  • Updated VaultCard.test.ts for vaultless behavior
  • Added TokenIOInput.test.ts tests

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)

fix #2407

@findolor findolor self-assigned this Jan 21, 2026
- Add InvalidVaultIdZero error variant to DepositError
- Add validate_vault_id() method to DepositArgs
- Guard execute_approve() and execute_deposit() with validation
- Add tests for vault_id=0 rejection
- Add WithdrawError enum with InvalidVaultIdZero variant
- Add validate_vault_id() method to WithdrawArgs
- Guard execute() and get_withdraw_calldata() with validation
- Make get_withdraw_calldata() synchronous (no async needed)
- Add tests for vault_id=0 rejection
- Add WithdrawArgsError variant to RaindexError enum
- Update get_withdraw_calldata() to be synchronous in vaults.rs
- Update get_withdraw_calldata() to be synchronous in vaults_list.rs
- Update tests to remove unnecessary async/await
- Make vault_withdraw_calldata() synchronous to match WithdrawArgs change
Add From<WithdrawError> impl to CommandError and remove erroneous
.await call on sync vault_withdraw_calldata function in test.
- DepositArgs TryFrom now validates vault_id and returns DepositError
- WithdrawArgs changed from From to TryFrom with validation
- Updated execute() and get_withdraw_calldata() to use try_into()
- Added tests for TryFrom rejecting vault_id=0
- generateApprovalCalldatas() generates approvals for vaultless outputs
- accepts optional vaultlessApprovalAmounts param for custom amounts
- defaults to U256::MAX (infinite approval) for vaultless tokens
- generateDepositCalldatas() skips vaultless outputs
- add InvalidU256 error variant for invalid approval amounts
- add vaultless test fixtures to mod.rs
Tests now generate state dynamically instead of comparing against
a hardcoded SERIALIZED_STATE constant, making them more robust
to changes in the serialization format.
- test infinite approval for vaultless outputs
- test custom approval amounts via vaultlessApprovalAmounts param
- test skipping approval when already at max
- test skipping deposits for vaultless outputs
- test getVaultIds returns undefined for vaultless tokens
- add vaultless mode to "How It Works" section
- document optional vaultlessApprovalAmounts parameter
- use < instead of != for allowance check to avoid unnecessary approvals
- fix vaultlessApprovals -> vaultlessApprovalAmounts in README example
- add example for getDeploymentTransactionArgs optional parameter
Compare U256 values directly instead of converting allowance to Float.
This fixes LossyConversionToFloat error when allowance is U256::MAX or
any value too large for Float's 224-bit coefficient. Also changes logic
to only approve when allowance < deposit amount (not when unequal).
- add update_vaultless() to OrderCfg for enabling/disabling vaultless per token
- add parse_vaultless_flags() for reading vaultless state from YAML
- add setVaultless() and getVaultlessStatus() wasm methods
- include vaultless_flags in GUI state serialization for persistence
- add vaultless toggle switch per token in TokenIOInput
- show approval amount input for vaultless outputs (defaults to unlimited)
- track vaultlessApprovalAmounts in DeploymentSteps and pass to deploy handler
- auto-show advanced options when any token has vaultless mode enabled
- add SDK tests for getVaultlessStatus, setVaultless, state persistence
- add TokenIOInput tests for vaultless toggle and approval amount input
- add handleAddOrder tests for vaultlessApprovalAmounts parameter
- add unit test for parse_vaultless_flags covering true, false, and absent cases
- fix toggle state revert when setVaultless fails in TokenIOInput
@findolor findolor force-pushed the 2026-01-21-vaultless-phase-4-webapp-order-creation-ui branch from c63f528 to 2520c89 Compare January 22, 2026 13:03
- Add vaultless: bool field derived from vault_id == 0
- Replace AccountBalance and RaindexVaultAllowance with unified RaindexAmount
- RaindexAmount has amount (Float) and formattedAmount (String)
- getAllowance returns "Unlimited" for max allowance values
- Add tests for vaultless field behavior
- Create VaultlessTokenDisplay for order detail vaultless tokens
- Fetches wallet balance and allowance via TanStack Query
- Shows blue badge, wallet balance, and approved amount
- Update VaultCard to show vaultless badge without balance/link
- Add tests for vaultless vault rendering
- Conditionally render VaultlessTokenDisplay for vaultless vaults
- Hide deposit/withdraw buttons for vaultless tokens
- Replace AccountBalance with RaindexAmount type
- Update field references: balance -> amount, formattedBalance -> formattedAmount
@findolor findolor force-pushed the 2026-01-21-vaultless-phase-5-webapp-order-detail branch from efe9473 to c875f1e Compare January 22, 2026 13:03
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@findolor findolor force-pushed the 2026-01-21-vaultless-phase-4-webapp-order-creation-ui branch from 2520c89 to 36e34fa Compare January 22, 2026 14:05
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.

2 participants