Swapping
Integrations
Javascript SDK
Get Chains

Get Chains

getChains

Returns the list of available chains or destination chains for the provided sourceChain.

function getChains(sourceChain?: Chain): Promise<ChainData[]>
 
type ChainData = {
  chain: Chain;
  name: string;
  evmChainId: number | undefined;
  isMainnet: boolean;
  requiredBlockConfirmations: number | undefined;
  maxRetryDurationBlocks: number | undefined;
}
ParamDescriptionData type
sourceChain(optional)Chain ID that allows to filter the returned array to contain only destination chains for the given chain.Chain

Example

If a sourceChain is provided, it returns the supported swap destination chains for that specific source chain.

import { Chains } from "@chainflip/sdk/swap";
 
console.log(await swapSDK.getChains(Chains.Polkadot));
// console output:
[
  {
    chain: 'Ethereum',
    name: 'Ethereum',
    evmChainId: 1,
    isMainnet: true,
    requiredBlockConfirmations: 7,
    maxRetryDurationBlocks: 0
  },
  {
    chain: 'Bitcoin',
    name: 'Bitcoin',
    evmChainId: undefined,
    isMainnet: true,
    requiredBlockConfirmations: 3,
    maxRetryDurationBlocks: 0
  },
]