question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WalletConnectProvider is not a constructor

See original GitHub issue

Hello guys,

I’m following example from npm page, but I get this error.

Am I missing something?

import Web3 from "web3";
import WalletConnectProvider from "@walletconnect/web3-provider";

//  Create WalletConnect Provider
const provider = new WalletConnectProvider({
  infuraId: "27e484dcd9e3efcfd25a83a78777cdf1", // Required
});

//  Enable session (triggers QR Code modal)
await provider.enable();

//  Create Web3
const web3 = new Web3(provider);
const provider = new WalletConnectProvider({
                 ^

TypeError: WalletConnectProvider is not a constructor
    at file:///home/luke/repos/dx/test/index.mjs:5:18
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

2reactions
LukeSamkharadzecommented, Dec 2, 2021

It seems WalletConnectProvider.default is the class itself. Why do I have to do this and why don’t you update examples?

//  Create WalletConnect Provider
const provider = new WalletConnectProvider.default({
  infuraId: "27e484dcd9e3efcfd25a83a78777cdf1", // Required
});
0reactions
kyokosdreamcommented, May 14, 2022

@lalitsharmaprofile-work

Will share when I have a chance but will note that I swapped back to V1 because V2 isn’t supported by most client wallets yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

e is not a constructor - WalletConnectProvider model not ...
i have fixed the problem, by adding const WalletConnectProvider = window.WalletConnectProvider.default; inside constructor().
Read more >
e is not a constructor - WalletConnectProvider model not ...
The problem is in this file (LaravelWeb3Scripts.php/walletconnect.ts) - this file is the one used for getting providers models. Vendor/Provider ...
Read more >
WalletConnect is not a constructor, react native - Moralis Forum
Today I cloned the project and installed it on my ios device. The app installed correctly but when I try to click on...
Read more >
TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >
Web3 Provider - WalletConnect Docs
This is documentation for WalletConnect Docs v1.0, which is no longer ... import WalletConnectProvider from "@walletconnect/web3-provider";
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found