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: switch chain to mainnet on wallet re/connect #2085

Merged
merged 8 commits into from
Jul 5, 2022

Conversation

gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Jun 28, 2022

Description

This switches the wallet's active chain to Ethereum Mainnet if set to any other chain, on wallet connect from splash screen / wallet reconnect when reloading the app.

Notice

  • Have you followed the guidelines in our Contributing guide?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Pull Request Type

  • 🐛 Bug fix (Non-breaking Change: Fixes an issue)
  • 🛠️ Chore (Non-breaking Change: Doc updates, pkg upgrades, typos, etc..)
  • 💅 New Feature (Breaking/Non-breaking Change)

Issue (if applicable)

Risk

None - this is isolated to MetaMask, XDEFI and TallyHo. If the wallet is set to Mainnet, the flow will continue as before.

Testing

Wallet Connect from splash screen

  • Before opening the app, switch your MetaMask/XDEFI wallet to any chain other than mainnet
  • Click connect MM/XDEFI
  • XDEFI should silently switch to mainnet and continue the flow / MM should bring a network switch request, which will continue with the flow after accepting the request

App reload

  • Go to the app with MM/XDEFI set to mainnet and connect your wallet
  • Switch your MetaMask/XDEFI wallet to any chain other than mainnet
  • Reload the page
  • XDEFI should silently switch to mainnet and continue the flow / MM should bring a network switch request, which will continue with the flow after accepting the request

Screenshots (if applicable)

image

@gomesalexandre gomesalexandre requested review from a team and 0xApotheosis as code owners June 28, 2022 17:54
@gomesalexandre gomesalexandre marked this pull request as draft June 28, 2022 17:57
@gomesalexandre gomesalexandre changed the title feat: switch chain on wallet re/connect feat: switch chain to mainnet on wallet re/connect Jun 28, 2022
@gomesalexandre gomesalexandre marked this pull request as ready for review June 28, 2022 18:10
@gomesalexandre
Copy link
Contributor Author

Moving to draft until new hdwallet version is published.

@gomesalexandre gomesalexandre marked this pull request as draft June 28, 2022 18:14
@gomesalexandre gomesalexandre marked this pull request as ready for review June 29, 2022 16:10
0xApotheosis
0xApotheosis previously approved these changes Jun 30, 2022
Copy link
Contributor

@0xApotheosis 0xApotheosis left a comment

Choose a reason for hiding this comment

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

Tested with Metamask and works well 👍

Screen Shot 2022-06-30 at 12 50 29 pm

src/context/WalletProvider/TallyHo/components/Connect.tsx Outdated Show resolved Hide resolved
src/context/WalletProvider/WalletProvider.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@0xdef1cafe 0xdef1cafe left a comment

Choose a reason for hiding this comment

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

🤌

Copy link
Contributor

@0xApotheosis 0xApotheosis left a comment

Choose a reason for hiding this comment

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

🧂

@0xApotheosis 0xApotheosis merged commit f304b4f into develop Jul 5, 2022
@0xApotheosis 0xApotheosis deleted the switch_chain_wallet_re/connect branch July 5, 2022 19:31
gomesalexandre added a commit that referenced this pull request Jul 14, 2022
@gomesalexandre gomesalexandre mentioned this pull request Jul 14, 2022
5 tasks
0xdef1cafe added a commit that referenced this pull request Jul 18, 2022
* wip

* wip

* wip

* Revert "fix: make web great again (#2145)"

This reverts commit 64d0631.

* wip

* wip

* feat: match design

* Revert "feat: switch chain to mainnet on wallet re/connect (#2085)"

This reverts commit f304b4f.

* feat: style improvements, add current chain icon

* chore: PR cleanup

* chore: add comment about optimistic switch

* feat: improve chain-adapters-getting logic

* chore: trigger CI

* chore: update yarn.lock

* feat: tackle self-review comments

* chore: remove MM and XDEFI wrong network translations

* chore: naming nitpicks

* feat: semantic improvements, make supportedEvmChainIds a memoized expression

* chore: chainId: string -> chainId: ChainId

* fix: don't show chain switch menu if there's only one change

* feat: bump @shapeshiftoss/chain-adapters to latest to automagically switch EVM chains on buildSendTransaction()

* chore: don't optional chain nativeAsset.icon

* chore: as any -> as ETHWallet

Co-authored-by: 0xdef1cafe <88504456+0xdef1cafe@users.noreply.github.com>
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.

Able to connect to a non-supported chain on metamask on a reconnect to app.shapeshift.com.
3 participants