How to Get Account Balance

Every Solana account is required to maintain a minimum balance of native SOL (measured in lamports) to persist its data on the blockchain.

import { createSolanaClient, LAMPORTS_PER_SOL, address } from "gill";
const { rpc } = createSolanaClient({
urlOrMoniker: "devnet", // or `mainnet`, `localnet`, etc
});
const wallet = address("nicktrLHhYzLmoVbuZQzHUTicd2sfP571orwo9jfc8c");
const { value: balance } = await rpc.getBalance(wallet).send();
console.log(`Balance: ${Number(balance) / LAMPORTS_PER_SOL} SOL`);

Is this page helpful?