Request Tokens

List available tokens for protocol logic

GEThttps://api.protocolink.com/v1/protocols/{chainId}/{protocolId}/{logicId}/tokens
Path parameters
chainId*integer

Example: 42161

Example: 42161
protocolId*string

Example: uniswap-v3

Example: "uniswap-v3"
logicId*string

Example: swap-token

Example: "swap-token"
Response

OK

Body
tokensarray of TokenUSDC (object)
Request
const response = await fetch('https://api.protocolink.com/v1/protocols/{chainId}/{protocolId}/{logicId}/tokens', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "tokens": [
    {
      "chainId": 42161,
      "address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
      "decimals": 6,
      "symbol": "USDC",
      "name": "USDCoin"
    }
  ]
}

Provides a list of tokens supported by a Logic, depending on the chain and protocol. See Networks & Protocols.

const client = axios.create({ baseURL: 'https://api.protocolink.com' });
const getTokens = async (chainId, protocol, logicId) => {
    const result = await client.get(`/v1/protocols/${chainId}/${protocol}/${logicId}/tokens`);
    return result.data;
}

const chainId = 1;
const protocol = "uniswap-v3";
const logicId = "swap-token";

const tokens = await getTokens(chainId, protocol, logicId);

The result contains a list of chains that looks the following:

{
   "tokens":[
      {
         "chainId":1,
         "address":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
         "decimals":6,
         "symbol":"USDC",
         "name":"USD Coin"
      },
      ... // other tokens will be present in the list
   ]
}

Presented according to different protocols or the token has been paired:

:{
   "tokens":[
      [
         {
            "chainId":1,
            "address":"0x0000000000000000000000000000000000000000",
            "decimals":18,
            "symbol":"ETH",
            "name":"Ethereum"
         },
         {
            "chainId":1,
            "address":"0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
            "decimals":18,
            "symbol":"aEthWETH",
            "name":"Aave Ethereum WETH"
         }
      ],
      ... // other token pair will be present in the list
   ]
}j

Last updated