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 the swap transaction from the quote
GET
endpoint/swap
Parameters
Query Parameters
Parameter/Response Details
Use
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
as the address for the native token in your parameter.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.
Before submitting a transaction, please make sure that the chain you are on and the selected srcChainId are the same, to avoid sending the transaction to an unknown contract address
The destChainId must be one of the chains supported by yBridge. If your destChainId is not supported by yBridge, the funds may be temporarily locked in the system. you could use Supported Blockchains to get latest list
Example Request
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.
Last updated