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(cast): switch chain before sending tx if current chain is different #5077

Merged
merged 2 commits into from
Jun 1, 2023

Conversation

0xdapper
Copy link
Contributor

@0xdapper 0xdapper commented May 30, 2023

If user specifies a chain ID, with this change it will check if the current chain id returned by the RPC is the same as user provided chain id. If not will attempt to switch it with wallet_switchEthereumChain.

Motivation

This change particularly allows me to use https://frame.sh/ to sign transactions using the unlocked signers on local node method. Ex: https://gist.github.com/0xdapper/7461f2b0f0100b6508938cfff4db2dad

Solution

Switch the chain if necessary.

@Evalir Evalir requested review from Evalir and mattsse and removed request for Evalir May 30, 2023 13:15
Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanna test ideally test this out before we merge, but it looks OK to me from the surface, ty!

I think maybe a warning that foundry is doing this for you would be good though

We'll also need nightly lint & clippy to make CI happy

Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@mattsse mattsse merged commit 7f416aa into foundry-rs:master Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants