Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: --unlocked flag for Anvil which enables autoImpersonate on startup #5334

Closed
Sabnock01 opened this issue Jul 8, 2023 · 3 comments · Fixed by #5335
Closed

feat: --unlocked flag for Anvil which enables autoImpersonate on startup #5334

Sabnock01 opened this issue Jul 8, 2023 · 3 comments · Fixed by #5335
Labels
T-feature Type: feature

Comments

@Sabnock01
Copy link
Contributor

Sabnock01 commented Jul 8, 2023

Component

Anvil

Describe the feature you would like

Currently, in order to enable auto-impersonation of accounts in Anvil, you need to call the anvil_autoImpersonate RPC method on your local Anvil instance:

This can be done through curl like so:

curl -X POST \
  http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "anvil_autoImpersonateAccount",
  "params": [true]
}'

Or through cast rpc:

cast rpc anvil_autoImpersonateAccount true

It would be convenient to have an --unlocked flag when creating an Anvil instance to enable auto-impersonation on startup. Not dissimilar from the flag of the same name for cast send.

Additional context

Am happy to work on this myself if it's a feature we decide to add.

Indeed, I've already looked at the Anvil source yet have a few questions however.

@Sabnock01 Sabnock01 added the T-feature Type: feature label Jul 8, 2023
@gakonst gakonst added this to Foundry Jul 8, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Jul 8, 2023
@mattsse
Copy link
Member

mattsse commented Jul 8, 2023

reasonable,
supportive

we need

  1. a new config field + cli cmd field
  2. if provided call the corresponding ethapi or backend function

@mattsse
Copy link
Member

mattsse commented Jul 8, 2023

cast rpc anvil_autoImpersonateAccount true

this should work?

@Sabnock01
Copy link
Contributor Author

cast rpc anvil_autoImpersonateAccount true

this should work?

You're correct. It does. Modified the issue. (Was sending the request incorrectly)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants