Created
May 17, 2025 18:10
-
-
Save Aviksaikat/98b40510ed20ddecbb8da7221d8d7e2c to your computer and use it in GitHub Desktop.
Set accounts with native gas tokens in anvil fork on any Chain
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
def wallet_with_native_token(web3_fork: Web3, test_address: HexAddress) -> None: | |
# Directly set test_address’s balance to 100 ETH | |
amount_wei = 100 * 10**18 | |
web3_fork.provider.make_request( | |
"anvil_setBalance", | |
[test_address, hex(amount_wei)] | |
) | |
assert web3_fork.eth.get_balance(test_address) == amount_wei |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment