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

Add manual wallet chain switch #6532

Merged
merged 4 commits into from
Feb 7, 2024
Merged

Conversation

ianrowan
Copy link
Contributor

Link to Issue

Closes: #6530

Description of Changes

  • adds switchNetwork() method to metamask and coin base web wallets.
  • method can be called to check if on network, automatically switch if not, and add if not in metamask(see below)

Other Considerations

  • I noticed that in out normal enable() flow if a network is not in the users wallet, we add it with our own node/rpc. This is sub-optimal b/c the user will essentially carry our rpc around forever and make their transactions through it vs using a public node like wallets usually do
    • I added code to the new method to use public chainlist rpcs for this and we should consider the same for enable() but wanted more input here: CC @jnaviask

@ianrowan
Copy link
Contributor Author

@masvelio You can use the new wallet method here to switch chains in metamask before first community stake transactions, etc

@masvelio
Copy link
Contributor

masvelio commented Feb 2, 2024

@ianrowan I am not 100% where should I use it and if this is necessary to do before the launch of community stake?

@mhagel
Copy link
Contributor

mhagel commented Feb 6, 2024

I noticed that in out normal enable() flow if a network is not in the users wallet, we add it with our own node/rpc. This is sub-optimal b/c the user will essentially carry our rpc around forever and make their transactions through it vs using a public node like wallets usually do

Good call-out.

Copy link
Contributor

@mhagel mhagel left a comment

Choose a reason for hiding this comment

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

LGTM

@ianrowan ianrowan merged commit 9349439 into master Feb 7, 2024
6 of 7 checks passed
@ianrowan ianrowan deleted the 6530-add-wallet-switching-mechanism branch February 7, 2024 16:52
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.

Add wallet switching mechanism for CS/ETC
3 participants