Swapping
Integrations
Javascript SDK
Get Assets

Get Assets

getAssets

Fetches the list of available assets for the given chain.

function getAssets(chain?: Chain): Promise<AssetData[]>
 
type AssetData = {
  chainflipId: string;
  asset: Asset;
  chain: Chain
  contractAddress: string | undefined;
  decimals: number;
  name: string;
  symbol: string;
  isMainnet: boolean;
  minimumSwapAmount: string;
  maximumSwapAmount: string | null;
  minimumEgressAmount: string;
}
ParamDescriptionData type
chain(optional)The ID of the chainChain

Example

import { Chains } from "@chainflip/sdk/swap";
 
console.log(await swapSDK.getAssets(Chains.Ethereum));
// console output:
[
  {
    chainflipId: 'Eth',
    asset: 'ETH',
    chain: 'Ethereum',
    contractAddress: undefined,
    decimals: 18,
    name: 'Ether',
    symbol: 'ETH',
    isMainnet: true,
    minimumSwapAmount: '10000000000000000',
    maximumSwapAmount: null,
    minimumEgressAmount: '1'
  },
  ...,
  {
    chainflipId: 'Usdc',
    asset: 'USDC',
    chain: 'Ethereum',
    contractAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
    decimals: 6,
    name: 'USDC',
    symbol: 'USDC',
    isMainnet: true,
    minimumSwapAmount: '20000000',
    maximumSwapAmount: null,
    minimumEgressAmount: '1'
  },
]