Build-Next-Tx
Returns the transaction data for the next transaction
v2/route/build-next-tx
How this endpoint is used :
This method returns the transaction data for the next transaction
If the transaction requires prior token approval, details of the token to be approved are also sent via the approvalData field. If
approvalData
is null, an approval tx is not needed.
Returns the to address and data for the next transaction
GET
https://api.socket.tech/v2/route/build-next-tx
Query Parameters
Name | Type | Description |
---|---|---|
activeRouteId* | string | ID of active route |
newRecipient | string | Overrides default recipient of the transaction |
bridgeSlippage | string | Bridge slippage value b/w 0% - 100%. Learn more here |
swapSlippage | string | Swap slippage value b/w 0% - 100%. |
API-KEY needs to be passed in the headers while making the GET
request
Description of response parameters :
Parameter | Description |
---|---|
| Action of transaction user performs. Values in Types page |
| Type of transaction. Values in Types page |
|
|
|
|
| ID of chain to perform transaction on |
| Total number of transactions to be performed by user in route |
| ID of active route |
|
|
| Index of transaction user last performed |
| Object with meta data if token approval is needed |
| Minimum amount to give approval |
| Contract address of token to give approval |
| Address of token spender |
| Address of token owner |
| If route is complete, routeStatus is returned and marked "COMPLETED". Find all values here |
approvalData
object is returned null for native tokens and returned for ERC-20 tokens. Allowance needs to be checked before making a tx when approvalData is returned. If contracts don't have sufficient allowance, user needs make an approval tx
Example :
Fetching the transaction data for next transaction of user with an active bridging session with activeRouteId = 6419
QUERY PARAMETERS
Param | Value |
---|---|
| 6419 |
REQUEST
GET
https://api.socket.tech/v2/route/build-next-tx?activeRouteId=6419
RESPONSE
NEXT STEP :
The data from the response is to be used to send a transaction as illustrated in example below :
Once the transaction is sent, the
/route/prepare
endpoint needs to be called with the transaction hash, userTxIndex and activeRouteId.
This example is elaborated in the Multi Transaction Bridging example
pageMulti Tx ExampleTEST QUERY :
https://api.socket.tech/v2/swagger/#/Routes/ActiveRoutesController_nextTx
Last updated