Token info

To get token info you just have to call a chainDetailsMap method. It returns a map with keys as a chain symbol, and values as ChainDetailsWithTokens. It has a field named "tokens" that is a map of TokenWithChainDetails. You should use this object to identify a token.

import { AllbridgeCoreSdk, nodeRpcUrlsDefault } from "@allbridge/bridge-core-sdk";

const sdk = new AllbridgeCoreSdk(nodeRpcUrlsDefault);

const chains = await sdk.chainDetailsMap();
console.log("Chain details map =", JSON.stringify(chains, null, 2));

const tokens = await sdk.tokens();
console.log("Tokens =", JSON.stringify(tokens, null, 2));

// selecting tokens
const sourceChain = chains[ChainSymbol.SOL];
const sourceTokenInfo = sourceChain.tokens.find((tokenInfo) => tokenInfo.symbol === "USDC");

const destinationChain = chains[ChainSymbol.POL];
const destinationTokenInfo = destinationChain.tokens.find((tokenInfo) => tokenInfo.symbol === "USDC");

Last updated