feat(anvil): add --fund-accounts CLI flag#14392
feat(anvil): add --fund-accounts CLI flag#14392exp0nge wants to merge 1 commit intofoundry-rs:masterfrom
Conversation
mablr
left a comment
There was a problem hiding this comment.
Hi, thanks for you proposition.
Just wondering why anvil_setBalance/anvil_addBalance endpoints aren't enough ?
This would be a one-shot (startup) option. IIUC the anvil_* namespace would need to be part of the post startup bootstrapping? |
Yes simply call Is there a specific use-case where this is not suitable ? If so could please you elaborate more ? |
We are using this as a drop-in replacement for other dev/localnets which come with some pre-funded addresses. Similar to the genesis configurations where you can bake in your addresses. Post-boostrap would be extra setup, I can do that and close this PR if you don't think this is worth as a extra feature |
|
I see, it shouldn't hurt to have this. Could you please resolve the merge conflict? Once done, I’ll trigger CI. 👍 |
Allow funding specific accounts with custom ETH balances on startup via `--fund-accounts 0xAddr:amount` (amount in ETH). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5e0bceb to
67cfbeb
Compare
done |
Motivation
When testing with Anvil, it's common to need specific addresses funded with custom balances on startup (e.g. for impersonation testing or reproducing on-chain scenarios). Currently this requires sending transactions after startup or using a custom genesis file.
Solution
Add a
--fund-accountsCLI flag that acceptsADDRESS:AMOUNTpairs (amount in ETH):This funds the specified addresses during node initialization, after state loading but before the node is ready.
--fund-accountsarg toNodeArgswith space-delimited valuesfunded_accountsfield +with_funded_accounts()builder toNodeConfigset_balanceduring backend setupPR Checklist