Repository navigation
fix(wallet): decode vault contract errors from simulation - #1362
Merged
Merged
Conversation
Deposit simulation failures were reported as a network failure. Simulate explicitly, classify contract rejections as CONTRACT_REJECTED before any signature request, and decode the vault error code into a specific message. Transport and timeout errors keep their existing messages. Closes CalloraOrg#1314 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # src/api/catalogApi.ts # src/data/mockApis.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1314
Problem
When the vault rejects a deposit during simulation (paused, below minimum, or wallet not on the allowlist), the user was told Stellar RPC could not be reached. Every
prepareTransactionerror went throughmapRpcError.Change
server.simulateTransaction, then branch onrpc.Api.isSimulationError. Contract rejections becomeCONTRACT_REJECTEDwithcontractErrorCode, and are thrown before any signature request.decodeVaultError(src/services/vaultErrors.ts) reads theError(Contract, #n)code from the simulation error or diagnostic events, and maps known codes to specific messages. Raw host errors and XDR are never shown or logged.CONTRACT_REJECTED, not as transport errors.requiresReconciliation.docs/Deposit-Flow.mdhas the error mapping table.Validation
npx tsc -p tsconfig.json --noEmit: passed.npm run build: passed.npx vitest run src/services/walletService.test.ts src/services/vaultErrors.test.ts src/App.deposit.test.tsx: 3 files, 105 tests passed.npx vitest run(full suite): 153 files, 2305 tests passed.Limits
Not run against a live testnet RPC; Soroban simulation is mocked in tests.
🤖 Generated with Claude Code