XRPL-Labs/Xaman-Issue-Tracker

[Amm] "Swap" (exchange) from TL: different behaviour on AMM present

Closed this issue · 1 comments

Right now, if you tap Exchange on a TrustLine, we display slippage, check for books, slippage, etc.

If there's an AMM present for the given pair, when staying under the AMM depth, this is irrelevant: the AMM will be consumed.

So if on a network with AMM activated, when loading the slippage and books, we should check the entered From amount and check if there's an AMM for that pair, and respect that.

  1. Check if there's an AMM for the pair: https://xrpl.org/amm_info.html
  2. Gather the values in the response https://rqqjncs.dlvr.cloud/pasted_1.png
  3. Take the user entered amount, up to the AMM present amounts, ignore all book and slippage checks and warnings - show "Obtaining liquidity from AMM pool"
  4. If the user enters an amount ABOVE the AMM present amounts, enable book and slippage checks, but only for the amount that EXCEEDS the AMM present amount, show: "Obtaining liquidity up to XXXXX from AMM pool, using DEX: {existing slippage, etc. panel}"

Superseded by #493