Bridging
Bridging allows you to transfer assets seamlessly across blockchain networks. This section provides a step-by-step guide to using the Refuel API for bridging assets effectively.
Fetch Quote
Fetch the quote to get details about the fees, estimated gas, and time for the transaction. Use the /quote
endpoint with the required parameters:
curl -X GET "curl -X GET https://api.refuel.exchange/quote?srcChainId=1&destChainId=56&amount=1000000000000000"
Example Response:
{
"amountOut": "4533160666743836",
"feesInUsd": 0.069112,
"srcToken": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18,
"address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"chainId": 1,
"logoURI": "https://refuel.sfo3.cdn.digitaloceanspaces.com/tokens/ETH.png",
"chainLogoURI": "https://refuel.sfo3.cdn.digitaloceanspaces.com/chains/Ethereum.png"
},
"destToken": {
"name": "BNB",
"symbol": "BNB",
"decimals": 18,
"address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"chainId": 56,
"logoURI": "https://refuel.sfo3.cdn.digitaloceanspaces.com/tokens/BNB.png",
"chainLogoURI": "https://refuel.sfo3.cdn.digitaloceanspaces.com/chains/BSC.png"
},
"amountInUsd": 3.20207,
"amountOutUsd": 3.132958,
"route": "refuel"
}
Fetch Transaction Data
Generate the data required to execute the cross-chain transfer. Use the /get-tx-data
endpoint with the required parameters:
curl -X GET "https://api.refuel.exchange/get-tx-data?srcChainId=137&destChainId=1868&amount=1953476036815543522&recipientAddress=0x585265e02c5bE4E141cba3194bB9E6cAe7DA0174&minAmountOut=268179126466682&self=true"
Example Response:
{
"success": true,
"result": {
"chainId": 137,
"tx": {
"to": "0xb3583F926668cb693D616BA0d6268105d88cED03",
"value": "1953476036815543522",
"data": "0x000b"
}
}
}
Monitor Refuel Status
Use the /recharge-task
endpoint to check the transaction status and ensure it was completed successfully:
curl -X GET "https://api.refuel.exchange/recharge-task?txHash=0x20de3c6296b5f023983ebf95dc72d0c74e1389f37f5420d3e00dd45f675516cb&chainId=1868"
Example Response:
{
"_id": "678783cb0b44e89c767765c9",
"srcChainId": 57073,
"destChainId": 897796746,
"amountIn": "200000000000000",
"amountOut": "131702537",
"sender": "0xdc23c25ba783423e4c9f7728e8c579895dd0d720",
"recipient": "0x39306ba9788ddac344a2c633b07756c5c53242972ca41d8cd1d1ad9a3240c016",
"status": "Completed",
"srcChainTx": {
"chainId": 57073,
"txHash": "0x273261ae04a605c5a80ac5ff990dfe71df958f7cf485e42fcd06ed91f7315f07",
"blockNumber": 3435936,
"blockHash": "0xe192daadf89813045c57f1370518f67b1cf5127feac1c8488c52c479d7ebe20e",
"timestamp": 1736934347,
"logIndex": 0
},
"destChainTx": {
"chainId": 897796746,
"txHash": "EVFYGKxtFXvPTfsCPZGnqcUbMfLcRuKBKLXtdxiA149E",
"blockNumber": 101752884,
"blockHash": "",
"timestamp": 1736934348,
"logIndex": 0
},
"relayId": "678783cc3ace56e314d5bb53",
"route": "refuel",
"amountInUsd": 0.643256,
"amountOutUsd": 0.59397844,
"__v": 0,
"srcToken": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18,
"address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"chainId": 57073,
"logoURI": "https://refuel.sfo3.cdn.digitaloceanspaces.com/tokens/ETH.png",
"chainLogoURI": "https://refuel.sfo3.cdn.digitaloceanspaces.com/chains/Ink.png"
},
"destToken": {
"name": "Sui",
"symbol": "SUI",
"decimals": 9,
"address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"chainId": 897796746,
"logoURI": "https://refuel.sfo3.cdn.digitaloceanspaces.com/tokens/SUI.png",
"chainLogoURI": "https://refuel.sfo3.cdn.digitaloceanspaces.com/chains/Sui.png"
}
}