2️⃣Get Allowance

If source quoting asset is an ERC20 token, you should ensure that source token owner has approved sufficient token amount to spender before proceed swap operation. This endpoint provide convenient way to check ERC20 allowance amount.

Get Allowance

GEThttps://aggregator-api.xy.finance/v1/allowance
Query parameters
Response

Successful Response

Body
Response Get Allowance Allowance Get
Request
const response = await fetch('https://aggregator-api.xy.finance/v1/allowance?chainId=0&tokenAddress=text&owner=text&spender=text', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "success": true,
  "chainId": 56,
  "tokenAddress": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
  "owner": "0x314c71ff355F9f525334526f339D84a57E664A1f",
  "spender": "0x7D26F09d4e2d032Efa0729fC31a4c2Db8a2394b1",
  "allowance": "25993637666075620961"
}

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