Create Transaction
Create the transaction for current step
Create Transaction API
When a user starts swapping or when a step of swap succeeds, to get the transaction for the next step, this method should be called.
In multi-step routes, you should loop over the routeResponse.route array and call this method (createTransaction) per each step.
const transaction = await rango.createTransaction({
requestId: "1978d8fa-335d-4915-a039-77f1a17315f5", // bestRoute.requestId
step: 1,
userSettings: {
slippage: 3,
infiniteApprove: false
},
validations: {
balance: true,
fee: true,
approve: true
},
})const response = await axios.post(
'https://api.rango.exchange/tx/create',
{
'requestId': '1978d8fa-335d-4915-a039-77f1a17315f5',
'step': 1,
'userSettings': {
'slippage': 3,
'infiniteApprove': false
},
'validations': {
'balance': true,
'fee': true,
'approve': true
}
},
{
params: {
'apiKey': 'c6381a79-2817-4602-83bf-6a641a409e32'
},
headers: {
'content-type': 'application/json'
}
}
);Create Transaction Request
requestId* StringDescription: The unique ID which is generated in the best route endpoint.
step* NumberDescription: The current step number in a multi-step route, starting from 1.
Example:
1
userSettings*Description: User settings for the swap, including slippage and infinite approval.
validations*Description: The validation checks we are interested to check by Rango before starting the swap.
Create Transaction Response
okDescription: If true, Rango has created a non-null transaction, and the error message is null.
transactionDescription: Transaction's raw data. It is one of the transaction possible interfaces:
EvmTransaction,CosmosTransaction,TransferTransaction(for UTXO),SolanaTransaction,StarknetTransaction,TronTransactionornull.
errorDescription: Error message about the incident if ok == false.
errorCodeDescription: Error code shows the type of error.
traceIdDescription: Trace Id helps Rango support team to trace an issue.
Last updated
Was this helpful?