Summary

Used to fetch multichain token balances across wallets linked to the user.
You must be on SDK version 4.25.3 or higher

Restrictions

  • There is a rate limit of 20 requests per IP per hour as this queries more data
  • You can only have a maximum of 5 addresses per request you can retrieve
  • You can only make requests for linked wallet addresses
  • You can only make requests for enabled chains and networks
  • There currently needs to be at least 10,000 USD in liquidity for the token to be returned. This applies to total token liquidity.
  • Chain support includes 66 EVM networks, Solana Mainnet and testnet, Eclipse Mainnet and Bitcoin Ruins. You can checkout the full list here

Usage

import { useMultichainTokenBalances } from "@dynamic-labs/sdk-react-core";

const { multichainTokenBalances, isLoading, isError, error } = useMultichainTokenBalances(
    filterSpamTokens: false, // this is true by default and removes suspected spam tokens from the response. Setting to false removes this filtering
    requests: [
        {
            "chain": ChainEnum.Evm,
            "address": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0",
            "networkIds": [1] // network IDs for enabled EVM networks,
            "whitelistedContracts": [0x...] // contract addresses that should not be filtered out due to our spam criteria defined above
        },
        {
            "chain": ChainEnum.Sol, // use this for SVM networks (including eclipse)
            "address": "CKEAuq1E7hUcrjDcu1xP6nax3YBvEhhq7qaCzDUkPNer",
            "networkIds": [101]
        },
        {
            "chain": ChainEnum.Btc,
            "address": "bc1pynfpvf0lghwu9l3u07fwhsu5093jwyjrlqax0r53z8mqe8ed4q5qfcs9t7",
            "networkIds": [1] // we only support balances on BTC mainnet so please use 1 for the network ID
        }
    ]
);
Response structure:

[
    {
        "chain": "EVM",
        "networks": [
            {
                "networkId": 1,
                "balances": [
                    {
                        "address": "0x9de16c805a3227b9b92e39a446f9d56cf59fe640",
                        "balance": 7877386.999999999,
                        "decimals": 18,
                        "id": null,
                        "isNative": false,
                        "liquidityPoolSizeUsd": 35339.2792275625,
                        "logoURI": "https://api.dune.com/api/echo/beta/token/logo/8453/0x9de16c805a3227b9b92e39a446f9d56cf59fe640",
                        "marketValue": 0.053820792951712056,
                        "name": "Bento",
                        "networkId": 8453,
                        "price": 6.832315455837331e-9,
                        "rawBalance": 7.877387e+24,
                        "symbol": "BENTO"
                    },
                    ...
                ]
            }
        ],
        "walletAddress": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0"
    }
]