Get Chains and Tokens

All supported chains & tokens

We are continuously expanding our ecosystem by incorporating new blockchain networks and tokens to allow for a greater number of cross-chain token transfers and swaps.

To get a list of all chains and all tokens that are currently supported, the /chains and /tokens endpoint can be queried.

const chainsResponse = await fetch('https://platform.swing.xyz/api/v1/chains');
const chains = await chainsResponse.json();
 
const tokensResponse = await fetch('https://platform.swing.xyz/api/v1/tokens');
const tokens = await tokensResponse.json();

Enabled chains & tokens for a project

To get a list of all chains and all tokens that are currently supported, the /projects/{projectId}/chains and /projects/{projectId}/tokens endpoint can be queried.

const PROJECT_ID = 'your-project-id';
 
const projectChainsResponse = await fetch(
  `https://platform.swing.xyz/api/v1/projects/${PROJECT_ID}/chains`,
);
const chains = await projectChainsResponse.json();
 
const projectTokensResponse = await fetch(
  `https://platform.swing.xyz/api/v1/projects/${PROJECT_ID}/tokens`,
);
const tokens = await projectTokensResponse.json();

Adding a custom token

By default, we pull tokens into our token list from those listed by our integrated liquidity sources. This means that if your project's token has already been aggregated by any of our integrated liquidity sources, we will pull that token into Swing.

In cases where your token is not listed on Swing, Swing gives you the option to add that token to your project's tokens list.

Before adding a custom token, please ensure that the token being added has sufficient liquidity from at-least one of our integrated liquidity sources. To see a list of our integrated liquidy sources, please check out our Chain, Bridges and Liqudity page

Making a Request

GET: https://platform.swing.xyz/api/v1/projects/:projectId/tokens

Route Parameters:

KeyExampleDescription
symbolreplugYour project's ID

Body Parameters:

KeyExampleDescription
address0x000000000000000000Token's contract address
chainethereumChain slug on which the target token is deployed to
symbolMINEToken's symbol
logohttps://raw.githubusercontent.com/swing-xyz/../coin/logo.pngToken's logo url
decimals18Token's decimal precision points

The reference guide for adding a custom token can be found here.

Sample Request

const PROJECT_ID = 'your-project-id';
 
const payload = {
  address: '0x000000000000000000',
  chain: 'ethereum',
  symbol: 'MINE',
  logo: 'https://raw.githubusercontent.com/swing-xyz/../coin/logo.png',
  decimals: 18,
};
 
const result = await fetch(
  `https://platform.swing.xyz/api/v1/projects/${PROJECT_ID}/tokens`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(payload),
  },
);