Solana CookbookAccounts
How to Get Account Balance
Every Solana account is required to maintain a minimum balance of native SOL (lamports) to persist its data on the blockchain.
import { createSolanaClient, Address } from "gill";const { rpc } = createSolanaClient({urlOrMoniker: "mainnet"});const addresss = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address;const { value } = await rpc.getBalance(addresss).send();console.log(`Balance: ${Number(value) / 1_000_000_000} SOL`);
Console
Click to execute the code.
Is this page helpful?