Get a route
getRoute SDK method that retrieves the cost of token transfer and encoded calldata for the execution of the route
Once you've set your parameters, you can now call getRoute(). This will return a quote for a token transfer and the calldata you will need submit that transfer to Squid's contracts.
const { route } = await squid.getRoute(params)

Example: Returned route object

{
"routeData":{
"sourceAmount":"1165739",
"destinationAmount":"1165739",
"destinationAmountOutMin":"0", // unsupported in beta
"exchangeRate":"1.0",
"sourceTokenUsdPrice":0.99,
"destinationTokenUsdPrice":1
},
"transactionRequest":{
"routeType":"TRADE_SEND",
"gasReceiver":false,
"data":"0x6cd08767000000000000000000000000c778417e063141139fce010982780140aa0cd5ab000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000084d6f6f6e6265616d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b796f7572416464726573730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005615553444300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000526f0a95edc3df4cbdb7bb37d4f7ed451db8e3690000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000010438ed1739000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000005d2422453ef21a394ad87b57fb566d0f67c4b11300000000000000000000000000000000000000000000000000000182fc2abfd10000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c778417e063141139fce010982780140aa0cd5ab000000000000000000000000526f0a95edc3df4cbdb7bb37d4f7ed451db8e36900000000000000000000000000000000000000000000000000000000",
"destinationChainGas":3000000
},
"params":{
"sourceAmount":"100000000000000000",
"sourceTokenAddress":"0xc778417E063141139Fce010982780140Aa0cD5Ab",
"sourceChainId":"3",
"destinationTokenAddress":"0xd1633f7fb3d716643125d6415d4177bc36b7186b",
"slippage":"1",
"destinationChainId":"1287",
"recipientAddress":"yourAddress"
}
}
Copy link