import { Connection, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";const publicKeyString = "Gjkud8j4qDLRyox4eMGC5QDWq9HoG5JTYpxRjLYepHyh";const mainnetBetaEndpoint = "https://api.mainnet-beta.solana.com";const connection = new Connection(mainnetBetaEndpoint);(async () => { try { const balance = await connection.getBalance(new PublicKey(publicKeyString)); console.log("SOL Balance:", balance / LAMPORTS_PER_SOL); } catch (error) { console.error("Error fetching balance:", error); }})();
this is how i can get the total sol balance of the wallet with public keynow lets say i dont know the public key but i want to get the first(latest) 100 public key where sol blance is > 100