Skip to main content

Allowance transaction

Generate data for calling the contract in order to allow the swap router to spend funds:

baseUrl/{chainId}/approve/transaction

Parameters

NameDescription
tokenAddress * string (query)Token address you want to exchange
amount string (query)The number of tokens that the swap router is allowed to spend.If not specified, it will be allowed to spend an infinite amount of tokens. Example : 100000000000

example:

http://router-api.openliq.com/137/approve/transaction?tokenAddress=0x2791bca1f2de4661ed88a30c99a7a9449aa84174&amount=1000000000

{
"errno":0,
"message": "success",
"data": {
"data": "0x095ea7b300000000000000000000000047be4c04c91d4897f8f27d32c7d79357b0939a91000000000000000000000000000000000000000000000000000000003b9aca00",
"gasPrice": "15000000000",
"to": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
"value": "0"
}
}