└── file co /file co: -------------------------------------------------------------------------------- 1 | const { 2 | Connection, 3 | PublicKey, 4 | clusterApiUrl 5 | } = require("@solana/web3.js"); 6 | 7 | async function getSolanaBalance(walletAddress) { 8 | const connection = new Connection(clusterApiUrl("mainnet-beta"), "confirmed"); 9 | const publicKey = new PublicKey(walletAddress); 10 | const balance = await connection.getBalance(publicKey); 11 | console.log(`Wallet Balance: ${balance / 1e9} SOL`); 12 | } 13 | 14 | const walletAddress = "EnterYourWalletAddressHere"; // Replace with a valid Solana wallet address 15 | getSolanaBalance(walletAddress); 16 | --------------------------------------------------------------------------------