0

I want to fetch multiple balances with viem getBalance function.

At this moment, i am doing multiple getBalance calls (one per address)

Is there a way to do it with a single call ?

Thanks

1 Answer 1

0

Yes, you can fetch balances for multiple addresses in a single call by modifying your contract's getBalance function to accept an array of addresses. Then, you can loop through the array of addresses and retrieve the balance for each address.

1
  • Hello, i have no smartcontract. I want to get the balances from my typescript webapp...
    – Bob5421
    Commented Feb 19 at 13:54

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.