Use cases

  1. API — provides a list of supported blockchains as well as a list of tokens for a destination network upon request GET v1/tokens/allForSwapAndBridge

  2. API — provides a list of tokens for a “departure” network upon request POST v2/tokens/list.

  3. API (optional) — provides calculated gas price values in GWEI (nAVAX for Avalanche) for fast, medium, low transaction time GET v1/{chainID}/gasprices (in the example GET v1/1/gasprices - chainID=fromChainID)

  4. GUI — the user selects the networks and tokens the exchange is made between. For example, for an Ethereum -> Polygon swap, the parameters will be:

    1. fromChainID = 1; toChainID = 137

    2. fromTokenAddress = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 (USDC)

    3. toTokenAddress = 0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063 (DAI)

  5. GUI — the user enters a sale amount.

  6. GUI (optional) — the user selects the gas price value from #3.

  7. GUI — the user sets the slippage tolerance value as a percentage. The recommended value is 1%.

  8. API — endpoint GET v1/price provides the number of tokens that the user will receive for the purchase.

  9. GUI — the user connects the wallet.

  10. API — endpoint GET v1/{chainID}/transaction/allowance (GET v1/1/transaction/allowance) returns the amount of tokens that the exchange smart contract has access to (not required for native coins, chainID = fromChainID).

  11. GUI — if the value of the sale is greater than the value from #10, the user is prompted to provide access for the tokens exchange (otherwise the exchange transaction will not be processed).

  12. API — endpoint GET v1/{chainID}/transaction/approve returns the input parameters (calldata) for a transaction to provide access to tokens, and the address of the contract where the transaction should be sent to.

  13. GUI — generates an unsigned transaction based on the data from #12 and sends it to the user's connected wallet.

  14. WALLET — the user confirms the operation in the wallet, and the wallet then signs the transaction and sends it to the blockchain.

  15. GUI — after successful confirmation of the transaction from #14, the user is offered a button to exchange the selected tokens.

  16. API — by endpoint GET v1/quote provides the number of the tokens purchased, transaction input parameters.

  17. GUI — generates an unsigned transaction based on the data from #16 and sends it to the user's connected wallet.

  18. WALLET — the user confirms the operation in the wallet, and the wallet then signs the transaction and sends it to the blockchain.

The endpoints v1/price and v1/quote can also be used for swaps within the same blockchain network. Just specify the same blockchain identifier for parameters fromChainID and toChainID.

Last updated