walletconnect-monorepo
walletconnect-monorepo copied to clipboard
`SignClient.init` throws a `SignClient.init is not a function` error.
Describe the bug
Follow up of #1129. SignClient.init
throws a SignClient.init is not a function
error.
Versions
- "@walletconnect/qrcode-modal": "^1.7.8",
- "@walletconnect/sign-client": "^2.0.0-beta.101",
To Reproduce
- Follow this guide and copy&paste the code in a js file
- create a node module and install the dependencies
- run the code
Expected behavior The QR pops up and it is possible to connect.
Screenshots
Additional context
One solution is replacing SignClient.init
with (SignClient.SignClient).init
, but I had two different instances where 1. the QR pops up but it gives an error when scanning and 2. the QR doesn't pop up and I get a (node:2960) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 register_error listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
error.
Same here, any update on this bug?
Could you try on latest rc please https://www.npmjs.com/package/@walletconnect/sign-client
Could you try on latest rc please https://www.npmjs.com/package/@walletconnect/sign-client
yes, I am using this version(2.0.0-rc.2), but error still appears
I have the same issue here. Does anyone have a solution ?
Hi everyone,
This one is a bit of a mystery to me and there's not really enough context here yet unfortunately. Please share how exactly you're importing the client or (even better) please provide a minimal reproduction of the issue.
Both the following default import and named import syntax work without issues when I try either:
// named import syntax
import { SignClient } from "@walletconnect/sign-client";
// default import syntax, `Client` here simply maps back to the `SignClient` class shown above
import Client from '@walletconnect/sign-client'
See also our wallet and dapp examples for reference:
- Relevant wallet import: https://github.com/WalletConnect/web-examples/blob/main/wallets/react-wallet-v2/src/utils/WalletConnectUtil.ts#L1
- Relevant dapp import: https://github.com/WalletConnect/web-examples/blob/main/dapps/react-dapp-v2/src/contexts/ClientContext.tsx#L1
Regarding the MaxListenersExceededWarning
raised by OP: this was a default EventEmitter warning that was sometimes triggered temporarily during client init. It's been fixed in the meantime.