Skip to content

Fix XRP DEX unsupported pair error - #518

Open
j0ntz wants to merge 1 commit into
masterfrom
jon/fix-xrp-dex-error-handling
Open

j0ntz wants to merge 1 commit into
masterfrom
jon/fix-xrp-dex-error-handling

Conversation

@j0ntz

@j0ntz j0ntz commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

Asana task

XRP DEX asked the source wallet for its spendable balance before checking whether it supports the pair. A non-XRP engine can fail that query with InsufficientFundsError, or PendingFundsError before it finishes syncing. Core ranks those above every other partner's SwapCurrencyError. An unsupported pair such as ARRR to ETH could therefore tell the user "Insufficient Funds" when the real answer is that no exchange supports the pair.

The change moves the three pair checks (XRP wallets only, same wallet, different assets) out of fetchSwapQuoteInner and ahead of getMaxSpendable in fetchSwapQuote. Quoting behavior for supported XRP pairs does not change, and a supported pair the wallet cannot afford still reports insufficient funds.

rankError in core stays as is: the ranking is right, and the error from this plugin was wrong.

Testing

  • test/xrpDex.test.ts is new. 5 of its 6 cases fail on the old code; all 6 pass now.
  • iOS simulator, ARRR wallet with a 0 balance to ETH, MAX, same native build with only the plugin chunk swapped. Old plugin: xrpdex gave swap error: InsufficientFundsError, card "Insufficient Funds". New plugin: SwapCurrencyError, card "No enabled exchanges support ARRR to ETH."
  • No regression: XRP to RLUSD with XRP DEX forced locally (1.6007 XRP to 1.985 RLUSD) executed to the success scene, txid 95566ca759fc5272060ce1da9fad31fad35aecc66c7ec42beeef7ceb64cd8cf3.

Test evidence

b55a6e4
Fix XRP DEX unsupported pair error
2026-11-01

2. before arrr max insufficient

1. after arrr max error

4. xrp dex swap success

fetchSwapQuote asked the source wallet for its spendable balance, using an
XRP dummy address, before checking that the pair is supported. For a non-XRP
source the engine fails that call: piratechain throws InsufficientFundsError
when nothing is spendable and other chains reject the address. Core ranks
InsufficientFundsError above every SwapCurrencyError, so a swap no provider
supports told the user their funds were short.

Move the pair gates ahead of the balance query. All three go together so
same-asset XRP swaps and two-wallet requests also fail on what is wrong with
them rather than on the balance.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-01T02:20:52.899538Z
We couldn’t complete this review. Comment @codex review to try again.
b55a6e4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

1 participant