-
Notifications
You must be signed in to change notification settings - Fork 13
Vaultless Phase 5: Webapp Order Detail Display #2415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2026-01-21-vaultless-phase-4-webapp-order-creation-ui
Are you sure you want to change the base?
Vaultless Phase 5: Webapp Order Detail Display #2415
Conversation
- 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
c63f528 to
2520c89
Compare
- 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
efe9473 to
c875f1e
Compare
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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. Comment |
2520c89 to
36e34fa
Compare
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
vaultlessfield toRaindexVaultto distinguish wallet-based from vault-based tokensRaindexAmounttype across rust and js_api for consistent balance/allowance representationVaultlessTokenDisplaycomponent for rendering vaultless tokens with wallet balance and allowance infoOrder Detail Updates
OrderDetail.sveltenow detects vaultless tokens and renders them differentlyVaultCard.svelteupdated to handle vaultless tokens - hides deposit/withdraw buttons and shows wallet infoModal Updates
DepositModal.svelteandWithdrawModal.svelteupdated to work withRaindexAmounttypeTesting
VaultlessTokenDisplay.test.tswith comprehensive test coverageVaultCard.test.tsfor vaultless behaviorTokenIOInput.test.tstestsChecks
By submitting this for review, I'm confirming I've done the following:
fix #2407