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

fix: Evm wallet chain not reacting to prefix change #11027

Closed
wants to merge 6 commits into from

Conversation

hassnian
Copy link
Contributor

PR Type

  • Bugfix
  • Feature
  • Refactoring

Context

Screenshot 📸

  • My fix has changed something on UI;

CleanShot 2024-09-21 at 17 34 12

Copy link

netlify bot commented Sep 21, 2024

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit 5dedf24
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/67033ed421041000088ebc9c
😎 Deploy Preview https://deploy-preview-11027--koda-canary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@hassnian hassnian marked this pull request as ready for review September 23, 2024 06:14
@hassnian hassnian requested a review from a team as a code owner September 23, 2024 06:14
@hassnian hassnian requested review from vikiival, Jarsen136 and a team and removed request for a team and vikiival September 23, 2024 06:14
@vikiival
Copy link
Member

@kodadot/internal-dev pls check

Generated by copilot
This pull request includes significant updates to the plugins/wagmi.client.ts file to enhance chain switching functionality and improve the plugin configuration process. The most important changes include importing additional functions from @wagmi/vue, defining a new changeChain function, and adding watchers to handle chain switching based on URL prefix and account connection status.

Enhancements to chain switching functionality:

  • plugins/wagmi.client.ts: Imported useSwitchChain, useChainId, and useAccount from @wagmi/vue to support chain switching operations.
  • plugins/wagmi.client.ts: Defined a new changeChain function that switches chains based on the URL prefix and the current chain ID.
  • plugins/wagmi.client.ts: Added a watcher on urlPrefix to call changeChain whenever the prefix changes.
  • plugins/wagmi.client.ts: Added a watcher on the account connection status to call changeChain immediately when a connection is detected.

Improvements to plugin configuration:

  • plugins/wagmi.client.ts: Simplified the plugin configuration by creating a config variable and using it in the nuxtApp.vueApp.use call and the provide object.

@Jarsen136
Copy link
Contributor

I'm not sure if it's worth doing this. I tested with Metamask and every time I switched the prefix, the popup from Metamask would show up. It asks me if I want to switch to another chain.

I would only make the switch chain request to Metamask when I want to make a transaction. WDYT?

Copy link

sonarcloud bot commented Oct 7, 2024

@hassnian
Copy link
Contributor Author

hassnian commented Oct 7, 2024

I'm not sure if it's worth doing this. I tested with Metamask and every time I switched the prefix, the popup from Metamask would show up. It asks me if I want to switch to another chain.

nice catch!

I would only make the switch chain request to Metamask when I want to make a transaction. WDYT?

yeah let's do that

continuing #11086

@hassnian hassnian closed this Oct 7, 2024
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.

Evm wallet chain not reacting to prefix change
3 participants