4⃣
Build Swap Transaction
Returns the swap data for bridging tokens
This API returns the details about the quote and the transaction that will trigger a single-chain or cross-chain swap request according to the quotation.
get
endpoint
/swap
Get the swap transaction from the quote
$ curl https://open-api.xy.finance/v1/swap?srcChainId=1&fromTokenAddress=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&amount=500000000000000000&destChainId=56&toTokenAddress=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&slippage=1&referrer=0x8c6bDCb8c66fe5BFAa82510413665833FCFa08Ee&receiveAddress=0xbeefbeefbeefbeefbeefbeefbeefbeefbeefbeef
This request is for a quote of 0.5 ETH on Ethereum to BNB on BNB Chain, with a 1% slippage and a referrer of 0x8c6bDCb8c66fe5BFAa82510413665833FCFa08Ee. The asset on the target chain will be eventually sent to 0xbeefbeefbeefbeefbeefbeefbeefbeefbeefbeef.
IMPORTANT :
Note that the amount parameter should be padded with zeroes. For example, pass
100000000
instead of
100
if the decimal digits of the token are 6.
Last modified 21d ago