GetSwapPrice
This method can be used to get the currentSwapPrice for a given buyCurrency and buyAmount using a given sellCurrency.
OnSwapPriceReturn and OnSwapPriceError events in order to handle the response elsewhere.
You can optionally provide a maximum allowable slippagePercentage.
GetSwapPrices
This method is similar toGetSwapPrice, it can be used to get the current SwapPrice for a given buyCurrency and buyAmount. Except, instead of providing a sellCurrency, you instead provide the user’s wallet address.
This method will detect the eligible currencies (ERC20s or native tokens) that can be swapped for buyAmount of the buyCurrency and will return a SwapPrice[].
OnSwapPricesReturn and OnSwapPricesError events in order to handle the response elsewhere.
You can optionally provide a maximum allowable slippagePercentage.
GetSwapQuote
This method is used to get an executableSwapQuote for a given userWallet address to buy buyAmount of buyCurrency using sellCurrency.
SwapQuote, you can transform it into a Transaction[] that can be submitted via your EmbeddedWallet to execute the swap.
includeApprove = true the SwapQuote response will also include the information required to create the required spend approval transaction(s). These will also be added to the Transaction[] created above via SwapQuote.AsTransactionArray(). As usual, with our embedded smart contract wallets, all of these transactions can be submitted at once in a bundle; significantly improving the UX for your players who would usually need to make separate transactions to approve and swap.