3

Can be any API or method to get the balance of a Sol account (more than one account in one time ) not use loop like getBalance() not that function,

1 Answer 1

3

Wallets are just Accounts too, you can use getMultiple to fetch multiple accounts and read the lamports if you just want the SOL balance:

connection.getMultipleAccountsInfo(publicKeys).then(accountsInfo => {
  const balances = accountsInfo.map(accountInfo => {
    if (accountInfo === null) { return null };
    return accountInfo.lamports / LAMPORTS_PER_SOL; 
  });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.