Created
October 28, 2024 07:06
-
-
Save 0xV4L3NT1N3/553340d1edfc6d23b58695cb6d75e728 to your computer and use it in GitHub Desktop.
Get L2 Balances
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function main() { | |
| // query ETH balances on Arbitrum, Base and Optimism | |
| const chains = [42161, 8453, 10] | |
| for (const chain of chains) { | |
| // add your key here | |
| const query = await fetch(`https://api.etherscan.io/v2/api | |
| ?chainid=${chain} | |
| &module=account | |
| &action=balance | |
| &address=0xb5d85cbf7cb3ee0d56b3bb207d5fc4b82f43f511 | |
| &tag=latest&apikey=YourApiKeyToken`) | |
| const response = await query.json() | |
| const balance = response.result | |
| console.log(balance) | |
| } | |
| } | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment