INNER CODE UNIT · TypeScript

AvalancheChain

0xinevitable/bento · adapters/avalanche/index.ts:14

export class AvalancheChain implements Chain {
  currency = {
    symbol: 'AVAX',
    name: 'Avalanche',
    logo: '/assets/icons/avalanche.png',
    decimals: 18,
    coinGeckoId: 'avalanche-2',
    ind: ZERO_ADDRESS,
  };
  chainId = 43114;
  _provider = new JsonRpcProvider(Config.RPC_URL.AVALANCHE_C_MAINNET);
  getCurrencyPrice = (currency: Currency = 'usd') =>
    priceFromCoinGecko(this.currency.coinGeckoId, currency);
  getBalance = async (account: string) => {
    const rawBalance = await this._provider.getBalance(account);
    const balance = Number(rawBalance) / 10 ** this.currency.decimals;
    return { ...this.currency, balance };
  };

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…