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: walletconnect v2 support #1003

Closed
wants to merge 9 commits into from
Closed

Conversation

DanielSinclair
Copy link
Collaborator

@DanielSinclair DanielSinclair commented Feb 3, 2023

  • Added version and providerId to WalletConnector connector API
  • Defaulting connectors to v1
  • Bumped WalletConnect branded connector to v2
  • Added WALLETCONNECT_PROVIDER_ID and NEXT_PUBLIC_WALLETCONNECT_PROVIDER_ID envs

@vercel
Copy link

vercel bot commented Feb 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
rainbowkit-example ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 3, 2023 at 10:07PM (UTC)
rainbowkit-site ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 3, 2023 at 10:07PM (UTC)

@socket-security
Copy link

Socket Security Pull Request Report

Dependency issues detected. If you merge this pull request, you will not be alerted to the instances of these issues again.

📜 Install scripts

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

Package Script field Source
protobufjs@7.2.1 (upgraded) postinstall site/package.json via contentlayer@0.2.2, next-contentlayer@0.2.2
Pull request report summary
Issue Status
Install scripts ⚠️ 1 issue
Native code ✅ 0 issues
Bin script confusion ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues
Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore foo@1.0.0 bar@2.4.2

  • @SocketSecurity ignore protobufjs@7.2.1

Powered by socket.dev

}) {
const options: WalletConnectConnectorOptions = {
chains,
options: {
projectId:
projectId ||
(process.env.WALLETCONNECT_PROJECT_ID as string) ||
Copy link
Contributor

@jxom jxom Feb 6, 2023

Choose a reason for hiding this comment

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

FYI, this might break in environments that don't inject process.env vars (e.g. Vite).

@xzilja
Copy link

xzilja commented Feb 6, 2023

You'll likely need to also update which events you listen to for display_uri and connect, within web3modal we set these up as follows: https://github.com/WalletConnect/web3modal/blob/V2/chains/ethereum/src/client.ts#L57-L75

Listening on provider itself is suggested, as you can utilise .once

@fodisi
Copy link

fodisi commented Feb 8, 2023

Hey, first of all, thanks for all the work w/ rainbowkit and in this PR.

I just wanted to check if rainbowkit depends on this PR to start supporting WalletConnect v2, or if it's already supported and this is just some sort of improvement/update to a newer version.

Just wondering about the impact of WalletConnect sunsetting v1 to rainbowkit and if the current 0.8.1 already has support for WC v2.

Thanks

@DanielSinclair
Copy link
Collaborator Author

@fodisi WalletConnect v2 is not currently supported. There are bugs and differences in the underlying UniversalConnector that we are working through with WalletConnect

@fodisi
Copy link

fodisi commented Feb 8, 2023

@fodisi WalletConnect v2 is not currently supported. There are bugs and differences in the underlying UniversalConnector that we are working through with WalletConnect

thanks a lot for the quick reply, @DanielSinclair !

@DanielSinclair DanielSinclair mentioned this pull request Feb 13, 2023
1 task
@adrianotadao
Copy link

@fodisi @DanielSinclair hey folks, sorry if this is a very silly question but there is something that is not that clear to me.

Just wondering about the impact of WalletConnect sunsetting v1 to rainbowkit and if the current 0.8.1 already has support for WC v2.

Will it affect, for example, Metamask wallet? I'm asking because I've seen some internal code that uses walletconnect for mobile etc etc.

@DanielSinclair
Copy link
Collaborator Author

DanielSinclair commented Feb 13, 2023

@adrianotadao Yes, each wallet will be affected and will need to migrate to WalletConnect v2. For RainbowKit, we will migrate each of these wallet connectors to v2 as the support becomes available. MetaMask currently hasn't released support, and other wallets are facing migration issues which we hope will soon be resolved. We will also leave a version prop that allows custom connectors to continue to use v1 where necessary (like with custom bridge servers). dApps will not need to do anything except bump to the latest RainbowKit and Wagmi versions when support is finalized. We will release patch releases as each wallet connector rolls over to v2.

@adrianotadao
Copy link

Hey @DanielSinclair, thank you for answering my question! I still have more questions =D

MetaMask currently hasn't released support, and other wallets are facing migration issues which we hope will soon be resolved.

Does it mean that my app that relies on Metamask connection will break and I won't have any authentication system at all? 😱

@DanielSinclair
Copy link
Collaborator Author

@adrianotadao Correct. But, those teams are also working with WalletConnect, so I would assume WalletConnect won't deprecate v1 until they have migrated.

@vibern0
Copy link

vibern0 commented Mar 3, 2023

Thanks for the great work 🙌

Would it be possible to have a beta version of this? Would love to test.

Also, on the example, the WalletConnect option on wallet, does not generate any QR

@DanielSinclair
Copy link
Collaborator Author

@obernardovieira The WalletConnect team is still working on getting fixes into Wagmi, but we'll update this PR when those changes are settled.

@dawsbot
Copy link

dawsbot commented Mar 20, 2023

Hi folks, any tips on which version to use instead while this is in progress?

The rainbowkit homepage says npm install @rainbow-me/rainbowkit@^0.12.0 wagmi@^0.12.0 yet it appears this causes a critical render error in next.js because of missing fs in walletConnectLegacy

image


EDIT: Looks like 0.11.0 works for both packages to fix this error

@fodisi
Copy link

fodisi commented May 10, 2023

Hi @DanielSinclair
My latest understanding is that in order to have support for wallet connect v2, dApps need to upgrade wagmi to version 1.0.x (along w/ wagmi and other dependencies, + addressing potential breaking changes). Is this correct or are there other blockers/actions needed? Thanks a lot

@DanielSinclair
Copy link
Collaborator Author

DanielSinclair commented May 10, 2023

@fodisi We will start to migrate a set of wallets to WalletConnect v2 in a patch release very soon, and will complete migrating all RainbowKit connectors by June 14th. dApps will need to update RainbowKit on this timeframe. The RainbowKit 0.12.x API is already WalletConnect v2 compatible, but the wallet connectors have not yet been migrated (as some have unstable support for v2, and we want them to hit a better UX bar). It is recommended that you begin to migrate your dApp to RainbowKit v1 and Wagmi v1, but we will also cherry-pick full WalletConnect v2 support as RainbowKit 0.12.15 on June 14th to make it easier to adopt for dApps that have not yet migrated. The only breaking change specific to WalletConnect v2 that you will need to consider is that dApps must not create a projectId with the WalletConnect Cloud Registry and supply it to RainbowKit like this.

const projectId = 'YOUR_PROJECT_ID';
const { wallets } = getDefaultWallets({
  appName: 'My RainbowKit App',
  projectId,
  chains,
});
const connectors = connectorsForWallets([
  ...wallets,
  {
    groupName: 'Other',
    wallets: [
      argentWallet({ projectId, chains }),
      trustWallet({ projectId, chains }),
      ledgerWallet({ projectId, chains }),
    ],
  },
]);

@fodisi
Copy link

fodisi commented May 11, 2023

@DanielSinclair Thanks a lot for all the info about the migration plan, schedule and references 🙏

@DanielSinclair DanielSinclair deleted the @daniel/walletconnect-v2 branch May 19, 2023 16:37
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.

7 participants