wormhole-foundation / wormhole-connect

Wormhole Connect brings all the functionality and utility of Wormhole right into your application and removes all of the complexity.
https://connect-in-style.wormhole.com/
Other
78 stars 56 forks source link

Make token decimals easier to configure #1814

Open artursapek opened 5 months ago

artursapek commented 5 months ago

Right now, this config is inadequate because it's lacking tokensConfig.ZOOMER.decimals.Solana being defined as 8. This causes Solana balance to display incorrectly.

That shouldn't be required. Having it defined under foreignAssets should be adequate.

{
    networks: ["ethereum", "solana"],
    env: "mainnet",
    tokens: ["ZOOMER"],
    tokensConfig: {
      ZOOMER: {
        key: "ZOOMER",
        symbol: "ZOOMER",
        nativeChain: "ethereum",
        tokenId: {
          chain: "ethereum",
          address: "0x0D505C03d30e65f6e9b4Ef88855a47a89e4b7676",
        },
        coinGeckoId: "zoomer",
        icon: "https://assets.coingecko.com/coins/images/30894/large/zoooooooooomer.jpg?1696529740",
        color: "#FEFC52",
        decimals: {
          default: 18,
        },
        foreignAssets: {
          solana: {
            address: "nBZEcHSG771mRbi4y2sSgKjfDUH8jsM2Eo5fNcASLeU",
            decimals: 8,
          },
        },
      },
    },
    rpcs: {
      solana: "https://rpc.ankr.com/solana",
    },
  }
fengliu222 commented 5 months ago

I resolved this problem by change decimals config, ex:

{
      decimals: {
        default: 18,
        Solana: 8,
      },
}