In this example, we will get the balance for each connect wallet.
rpcProvider
getBalance
import { useUserWallets } from '@dynamic-labs/sdk-react-core'; const App = () => { const userWallets = useUserWallets(); useEffect(() => { userWallets.forEach(async (wallet) => { if (!wallet) return; // Get the configured rpc provider const provider = rpcProviders.evmDefaultProvider?.provider; if (!provider) return; // Fetch the wallet balance const balance = await provider.getBalance(wallet.address); console.log('balance', balance.toString()); }); }, [userWallets]); ... }
Was this page helpful?