3️⃣Build Approval Transaction

If your allowance is not sufficient, this endpoint can help you initiate an ERC20 approval transaction.

Get Approve Tx

get
Query parameters
tokenAddressstringRequired

ERC20 token address.

spenderstringRequired

Spender of ERC20 token.

amountintegerRequired

Approve amount of ERC20 token.

Responses
200

Successful Response

application/json
Responseany of
or
get
/approveTx
GET /v1/approveTx?tokenAddress=text&spender=text&amount=1 HTTP/1.1
Host: aggregator-api.xy.finance
Accept: */*
200

Successful Response

{
  "success": true,
  "tokenAddress": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
  "spender": "0x7D26F09d4e2d032Efa0729fC31a4c2Db8a2394b1",
  "amount": "100000",
  "tx": {
    "to": "text",
    "data": "text",
    "value": "text"
  }
}

NOTE : The spender should be the contractAddress in the response of Get Quote. e.g. routes[{ROUTE_INDEX}]["contractAddress"]

Here you can find our full API reference

Last updated

Was this helpful?