Skip to main content

query_fees_and_calldata

/query_fees_and_calldata

query the token path, how much do sell_token need for buy_amount of buy_token, estimate gas will use, how much native token this transaction will need, and the calldata for gateway contract.

for sell_token, gateway can accept any token that have liquidity on DEX, for buy_token, plz refer to this token list

Param

typenamedetail
str(address regex limiting)token_fromthe token address user going to pay
str(address regex limiting)token_tothe token address recipient want to receive
Networksnetwork_fromthe source network of the transaction
Networksnetwork_tothe destination network of the transaction
intbuy_amounthow many token_to going to buy
str(address regex limiting)senderthe address going to send the transaction
str(address regex limiting)recipientthe address going to receive token

Request

curl --location '127.0.0.1:8000/query_fees_and_calldata' \
--header 'Content-Type: application/json' \
--data '{
"token_from": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
"token_to": "0x07865c6E87B9F70255377e024ace6630C1Eaa37F",
"network_from": "Goerli",
"network_to": "Mumbai",
"buy_amount": 1000000000,
"sender": "0xC2f3FB1200cDe5723b502F307899b8eeC8231FE5",
"recipient": "0xC2f3FB1200cDe5723b502F307899b8eeC8231FE5"
}'

Response

{
"gas": 3000000,
"value": 5880062368050,
"gasPrice": 19,
"nonce": 302,
"chainId": 5,
"to": "0xd27D8BE950aCA62efCD0Ef83eB148305D39225EB",
"data": "0xbf47814a0000000000000000000000000000000000000000000000000000000000000...",
"sell_amount": 21705054,
"path": {
"Goerli": [
{
"name": null,
"address": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6"
},
{
"name": "usdc",
"address": "0xDf0360Ad8C5ccf25095Aa97ee5F2785c8d848620"
}
],
"Mumbai": [
{
"name": "usdc",
"address": "0x742DfA5Aa70a8212857966D491D67B09Ce7D6ec7"
},
{
"name": null,
"address": "0x07865c6E87B9F70255377e024ace6630C1Eaa37F"
}
]
}
}