Search
K

Start

v2/route/start

How this endpoint is to be used :
  • This endpoint can be used in both Single Transaction Bridging flow and Multi Transaction Bridging Flow.
  • However do note, using /route endpoints for Single Transaction Bridging will involve multiple API calls.
  • Once a route is chosen from the routes array retrieved from v2/quote, A POST request needs to /v2/route/start & the route object needs to be passed in the body.
  • In case of a Refuel+Bridge transaction, the refuel object from the quote also needs to be passed in the body. Read more in the Refuel Guide
API-KEY needs to be passed in the headers while making the POST request
post
https://api.socket.tech/v2
/route/start
Generates unique route ID and returns transaction data
includeFirstTxDetails can be set to true to return the transaction data of the first tx in the response of route/start itself. If it is set to false, then route/build-next-tx needs to be called with activeRouteId to fetch the tx data for the first tx.

Description of response parameters :

IMPORTANT : If the transaction type is returned eth_signMessage, the message just needs to be signed.
Parameter
Description
success
Indicates successful response from endpoint, as intended.
userTxType
Action of transaction user performs. Values in Types page
txType
Type of transaction. Values in Types page
txData
Transaction data for given transaction
txTarget
to address for transactions
chainId
ID of chain the transaction is to be performed on
totalUserTx
Total user transactions involved in route
userTxIndex
Index of transaction from totalUserTx
activeRouteId
ID of route
value
Amount of native token to send in transaction
approvalData.minimumApprovalAmount
Minimum amount to give approval
approvalData.approvalTokenAddress
Contract address of token to give approval
approvalData.allowanceTarget
Address of token spender
approvalData.owner
Address of token owner
approvalData object is returned null for native tokens and returned for ERC-20 tokens. Allowance needs to be checked each time before making a tx when approvalData is returned. If contracts don't have sufficient allowance, user needs make an approval tx

Example :

Bridging 100 USDC from Polygon to DAI on BNB Chain, filtered by cheapest routes first. This transaction also involves a bridging gas along with tokens (Refuel+Bridge). After fetching the quote, the selected route object and refuel object needs to be passed in the body as shown below :

BODY PARAMS

Param
Value
fromChainId
137
toChainId
56
fromAssetAddress
0x2791bca1f2de4661ed88a30c99a7a9449aa84174
toAssetAddress
0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3
includeFirstTxDetails
true
route
Route Object Selected from Quote
refuel
Refuel Object Selected from Quote [only to be added if Refuel feature is request]

BODY

{
"fromChainId": "137",
"toChainId": "56",
"fromAssetAddress": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
"toAssetAddress": "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3",
"includeFirstTxDetails": true,
"route": {
"routeId":"685ad58c-ad05-4628-87da-6cbfb78c3f25",
"fromAmount":"100000000",
"toAmount":"99085089737690749609",
"usedBridgeNames":[
"anyswap-router-v4"
],
"minimumGasBalances":{
"56":"2800000000000000",
"137":"60000000000000000"
},
"chainGasBalances":{
"56":{
"minGasBalance":"2800000000000000",
"hasGasBalance":false
},
"137":{
"minGasBalance":"60000000000000000",
"hasGasBalance":false
}
},
"totalUserTx":1,
"sender":"0x3e8cB4bd04d81498aB4b94a392c334F5328b237b",
"recipient":"0x3e8cB4bd04d81498aB4b94a392c334F5328b237b",
"totalGasFeesInUsd":0.0111646295875,
"userTxs":[
{
"userTxType":"fund-movr",
"txType":"eth_sendTransaction",
"chainId":137,
"toAmount":"99085089737690749609",
"toAsset":{
"chainId":56,
"address":"0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3",
"symbol":"DAI",
"name":"Dai Token",
"decimals":18,
"icon":"https://maticnetwork.github.io/polygon-token-assets/assets/dai.svg",
"logoURI":"https://maticnetwork.github.io/polygon-token-assets/assets/dai.svg",
"chainAgnosticId":"DAI"
},
"stepCount":2,
"routePath":"15-2",
"sender":"0x3e8cB4bd04d81498aB4b94a392c334F5328b237b",
"approvalData":{
"minimumApprovalAmount":"100000000",
"approvalTokenAddress":"0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
"allowanceTarget":"0x4C9faD010D8be90Aba505c85eacc483dFf9b8Fa9",
"owner":"0x3e8cB4bd04d81498aB4b94a392c334F5328b237b"
},
"steps":[
// .. Removed some content
]
},
"serviceTime":600,
"recipient":"0x3e8cB4bd04d81498aB4b94a392c334F5328b237b",
"userTxIndex":0
}
],
"serviceTime":600
},
"refuel":{
"fromAmount":"7200000000000000000",
"toAmount":"13182416510400000",
"gasFees":{
"gasAmount":"1450000000000000",
"gasLimit":29000,
"asset":{
// .. Removed some content to fit the request
},
"feesInUsd":0.00059033125
},
"recipient":"0x3e8cB4bd04d81498aB4b94a392c334F5328b237b",
"serviceTime":600000,
"fromAsset":{
// .. Removed some content to fit the request
},
"toAsset":{
// .. Removed some content to fit the request
},
"fromChainId":137,
"toChainId":56
}
}

REQUEST

RESPONSE

Response body
Response Headers
{
"success": true,
"result": {
"userTxType": "fund-movr",
"txType": "eth_sendTransaction",
"txData": "0xa44bbb1500000000000000000000000000000000000000000000000000000000000000200000000000000000000000003e8cb4bd04d81498ab4b94a392c334f5328b237b00000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000005f5e10000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000001020000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000063eb89da4ed000000000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417400000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000ee000000000000000000000000000000000000000000000000000000000000000380000000000000000000000003e8cb4bd04d81498ab4b94a392c334f5328b237b00000000000000000000000000000000000000000000000063eb89da4ed0000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000e287c025200000000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc3000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001800000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063000000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc3000000000000000000000000c30141b657f4216252dc59af2e7cdb9d8792e1b00000000000000000000000000000000000000000000000000000000005f5e1000000000000000000000000000000000000000000000000053b1e2a93c56b36640000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000a2080000000000000000000000004537f43f6add7b1b60cab199c7a910024ee0594000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000104128acb08000000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc30000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000001000276a400000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000400000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f61900000000000000000000000000000000000000000000000000000000800000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000022414284aab000000000000000000000000000000000000000000000000000000000000008080000000000000000000000000000000000000000000000000000000000000440000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f61900000000000000000000000000000032000000000000000000000000000000328000000000000000000000006bad0f9a89ca403bb91d253d385cec1a2b6eca97000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000104128acb08000000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc30000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000276a400000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000400000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0630000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000004a4ad0e7b1a000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000004400000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000001c2000000000000000000000000000001c2000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000140800000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064eb5625d90000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000800000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c452bbbe2900000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000062b440700d34e5dd4d8f043557145598e4e2dc286b35fd4f00000000000000000000006800000000000000000000000000000000000000000000000000000000000000000000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000044800000000000000000000000000000000000000000000000000000000000016400000000000000000000000000000000000000000000000000000000000000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018414284aab000000000000000000000000000000000000000000000000000000000000008080000000000000000000000000000000000000000000000000000000000000440000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0630000000000000000000000000000000100000000000000000000000000000001000000000000000000000000521709b3cd7f07e29722be0ba28a8ce0e806dbc3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064d1660f990000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0630000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000733d4004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000200000000000000000000000009b17baadf0f21f03e35249e0e59723f34994f806",
"txTarget": "0xc30141B657f4216252dc59Af2e7CdB9D8792e1B0",
"chainId": 137,
"totalUserTx": 1,
"userTxIndex": 0,
"activeRouteId": 136732,
"value": "0x63eb89da4ed00000",
"approvalData": {
"minimumApprovalAmount": "100000000",
"approvalTokenAddress": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
"allowanceTarget": "0x4C9faD010D8be90Aba505c85eacc483dFf9b8Fa9",
"owner": "0x3e8cB4bd04d81498aB4b94a392c334F5328b237b"
}
}
}
access-control-allow-origin: *
content-length: 4896
content-type: application/json; charset=utf-8
date: Tue,29 Mar 2022 10:39:40 GMT
etag: W/"1320-J074dJGcjUx8ACWMAbCnrzqt9is"
x-powered-by: Express

NOTES :

  • activeRouteId,userTxIndex from response is needed for subsequent API requests & requires to be stored in browser's local storage or server's DB, depending on integration.
TEST QUERY :
Last modified 1yr ago