0xGeel / loopgate

A Proof-of-Concept to token-gate content using Loopring L2 NFTs and PiΓ±ata IPFS πŸͺ…

Home Page:https://loopgate.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to compile - WalletConnectLegacy is not exported from package

SpaceCatOfficial opened this issue Β· comments

Describe the bug
On step 4.3 of the LoopGate GitBook, when attempting to compile for a local instance, the following error occurs:

"./node_modules/connectkit/build/index.es.js:5:0
Module not found: Package path ./connectors/walletConnectLegacy is not exported from package C:\Users\tnguy\Documents\SpaceCatWebsite\TokenGate-1\node_modules\wagmi (see exports field in C:\Users\tnguy\Documents\SpaceCatWebsite\TokenGate-1\node_modules\wagmi\package.json)

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./src/pages/_app.tsx"

Potentially this is an issue with the WalletConnectLegacy soon to no longer be supported? See wagmi link:
https://wagmi.sh/core/connectors/walletConnectLegacy

I've tried a few suggestions from stack exchange and looking at the wagmi.sh website for how to deal with their breaking updates but to no avail.

To Reproduce
Steps to reproduce the behavior:
I've followed the GitBook steps for creating my own instance without deviation (as far as I can tell). I am using VS Code on Win 11.

Expected behavior
Expected to compile properly and a local instance of my tokengate to be available.

Screenshots
If applicable, add screenshots to help explain your problem.
image
image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome
commented

Hi there! Thanks for getting in touch and reporting this.

You may be correct in your intuition on the legacy WalletConnect being phaced out.
High on my priority list is to migrate to the new WalletConnect version which would resolve this.

I will try my best to get back to you tomorrow on this!

commented

I see ConnectKit (the underlying dependency I have that depends on WalletConnect Legacy) have published an update last week which includes Wagmi V1.0. I hope they have updated to WalletConnect V2, that should make my life a lot easier :)

Reference: https://github.com/family/connectkit/tree/main/packages/connectkit-next-siwe

commented

Working on this issue in this PR:

#28

Excellent! Thank you, Geel. I'm learning more about your code and thank you for the information on the dependencies.

commented

... thank you for the information on the dependencies.

Sure, any time! Happy to share what I know so that you might also contribute cool things to the space :D

One issue I'm running into now is the fact that ConnectKit's implementation of the siweMessage.verify() function does not play nice with a WalletConnect generated signature from Smart Contract wallets like Loopring.

Error: invalid signature string (argument="signature", value="0x10f65980d081cdf9ff37961f6d692d6fc0ef3c00fd26da8c22f6be639148d91c5f1ea6dc8711b5a4167e3b744d155b0b310ab5ee06c7ab139a335c4653a245df1c02", code=INVALID_ARGUMENT, version=bytes/5.7.0)

Going through the SIWE code right now to understand how to solve this issue. "Regular" crypto wallets (like GameStop, MetaMask) are already working again with the update I have in that PR :)

Hey Geel, I was able to run the local version with the walletconnect-v2 PR updates. I do run in to an issue with my loopring wallet where the connection attempt is terminated before the wallet connects.

image

I'm wondering if this is normal when locally hosted?
To check if it was due to being locally hosted, I moved ahead to the netlify instructions and ran into a SIWE related error.

image

Relevant excerpt:

image

With the following complete Log:

12:24:22 PM: build-image version: 4a78b4474c4e90e8752839579cf887906c3805af (focal) 12:24:22 PM: buildbot version: aa75ae20a7981a2d2511b45e6fe311699508e6ee 12:24:22 PM: Fetching cached dependencies 12:24:22 PM: Failed to fetch cache, continuing with build 12:24:22 PM: Starting to prepare the repo for build 12:24:23 PM: No cached dependencies found. Cloning fresh repo 12:24:23 PM: git clone --filter=blob:none https://github.com/SpaceCatOfficial/TokenGate 12:24:23 PM: Preparing Git Reference refs/heads/main 12:24:25 PM: Starting to install dependencies 12:24:25 PM: Python version set to 3.8 12:24:25 PM: Attempting Ruby version 2.7.2, read from environment 12:24:26 PM: Using Ruby version 2.7.2 12:24:27 PM: Started restoring cached go cache 12:24:27 PM: Finished restoring cached go cache 12:24:27 PM: go version go1.19.9 linux/amd64 12:24:27 PM: Using PHP version 8.0 12:24:28 PM: v18.16.0 is already installed. 12:24:29 PM: Now using node v18.16.0 (npm v9.5.1) 12:24:29 PM: Enabling Node.js Corepack 12:24:29 PM: Started restoring cached build plugins 12:24:29 PM: Finished restoring cached build plugins 12:24:29 PM: Started restoring cached corepack dependencies 12:24:29 PM: Finished restoring cached corepack dependencies 12:24:29 PM: No npm workspaces detected 12:24:29 PM: Started restoring cached node modules 12:24:29 PM: Finished restoring cached node modules 12:24:29 PM: Installing npm packages using npm version 9.5.1 12:24:30 PM: npm WARN old lockfile 12:24:30 PM: npm WARN old lockfile The package-lock.json file was created with an old version of npm, 12:24:30 PM: npm WARN old lockfile so supplemental metadata must be fetched from the registry. 12:24:30 PM: npm WARN old lockfile 12:24:30 PM: npm WARN old lockfile This is a one-time fix-up, please be patient... 12:24:30 PM: npm WARN old lockfile 12:24:41 PM: npm WARN deprecated multicodec@1.0.4: This module has been superseded by the multiformats module 12:24:41 PM: npm WARN deprecated multiaddr@7.5.0: This module is deprecated, please upgrade to @multiformats/multiaddr 12:24:41 PM: npm WARN deprecated multibase@0.6.1: This module has been superseded by the multiformats module 12:24:43 PM: npm WARN deprecated cids@0.7.5: This module has been superseded by the multiformats module 12:24:44 PM: npm WARN deprecated @json-rpc-tools/types@1.7.6: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. 12:24:44 PM: npm WARN deprecated @json-rpc-tools/provider@1.7.6: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. 12:24:44 PM: npm WARN deprecated @json-rpc-tools/utils@1.7.6: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. 12:24:44 PM: npm WARN deprecated multibase@1.0.1: This module has been superseded by the multiformats module 12:24:44 PM: npm WARN deprecated multibase@1.0.1: This module has been superseded by the multiformats module 12:24:45 PM: npm WARN deprecated multibase@0.7.0: This module has been superseded by the multiformats module 12:24:45 PM: npm WARN deprecated multibase@0.7.0: This module has been superseded by the multiformats module 12:24:45 PM: npm WARN deprecated cids@0.8.3: This module has been superseded by the multiformats module 12:24:52 PM: added 1138 packages, and audited 1139 packages in 22s 12:24:52 PM: 203 packages are looking for funding 12:24:52 PM: run npm fund for details 12:24:52 PM: found 0 vulnerabilities 12:24:52 PM: npm packages installed 12:24:52 PM: Install dependencies script success 12:24:52 PM: Starting build script 12:24:53 PM: Detected 1 framework(s) 12:24:53 PM: "next" at version "13.4.4" 12:24:53 PM: Section completed: initializing 12:24:54 PM: ​ 12:24:54 PM: Netlify Build 12:24:54 PM: ──────────────────────────────────────────────────────────────── 12:24:54 PM: ​ 12:24:54 PM: ❯ Version 12:24:54 PM: @netlify/build 29.12.1 12:24:54 PM: ​ 12:24:54 PM: ❯ Flags 12:24:54 PM: baseRelDir: true 12:24:54 PM: buildId: 648014857fbf0633d86518f3 12:24:54 PM: deployId: 648014857fbf0633d86518f5 12:24:54 PM: ​ 12:24:54 PM: ❯ Current directory 12:24:54 PM: /opt/build/repo 12:24:54 PM: ​ 12:24:54 PM: ❯ Config file 12:24:54 PM: No config file was defined: using default values. 12:24:54 PM: ​ 12:24:54 PM: ❯ Context 12:24:54 PM: production 12:24:54 PM: ​ 12:24:54 PM: ❯ Installing plugins 12:24:54 PM: - @netlify/plugin-nextjs@4.37.4 12:25:02 PM: ​ 12:25:02 PM: ❯ Using Next.js Runtime - v4.37.4 12:25:03 PM: ​ 12:25:03 PM: @netlify/plugin-nextjs (onPreBuild event) 12:25:03 PM: ──────────────────────────────────────────────────────────────── 12:25:03 PM: ​ 12:25:03 PM: No Next.js cache to restore. 12:25:03 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed. 12:25:03 PM: ​ 12:25:03 PM: (@netlify/plugin-nextjs onPreBuild completed in 14ms) 12:25:03 PM: ​ 12:25:03 PM: Build command from Netlify app 12:25:03 PM: ──────────────────────────────────────────────────────────────── 12:25:03 PM: ​ 12:25:03 PM: $ npm run build 12:25:03 PM: > loopgate@0.3.0 build 12:25:03 PM: > next build 12:25:04 PM: - warn No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache 12:25:04 PM: - info Linting and checking validity of types... 12:25:08 PM: Failed to compile. 12:25:08 PM: 12:25:08 PM: ./src/utils/siwe/siwe.ts:1:10 12:25:08 PM: Type error: Module '"./configureSIWE"' has no exported member 'configureSIWE'. 12:25:08 PM: > 1 | import { configureSIWE } from "./configureSIWE"; 12:25:08 PM: | ^ 12:25:08 PM: 2 | // import { configureSIWE } from "connectkit-next-siwe"; 12:25:08 PM: 3 | 12:25:08 PM: 4 | // Replaced with an edited version on 06-02-2023 to circumvent a 'connectkit-next-siwe' WalletConnect through a Smart Wallet issue (Loopring Wallet). 12:25:08 PM: ​ 12:25:08 PM: "build.command" failed 12:25:08 PM: ──────────────────────────────────────────────────────────────── 12:25:08 PM: ​ 12:25:08 PM: Error message 12:25:08 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1) 12:25:08 PM: ​ 12:25:08 PM: Error location 12:25:08 PM: In Build command from Netlify app: 12:25:08 PM: npm run build 12:25:08 PM: ​ 12:25:08 PM: Resolved config 12:25:08 PM: build: 12:25:08 PM: command: npm run build 12:25:08 PM: commandOrigin: ui 12:25:08 PM: environment: 12:25:08 PM: - NEXT_PRIVATE_TARGET 12:25:08 PM: publish: /opt/build/repo/.next 12:25:08 PM: publishOrigin: ui 12:25:08 PM: plugins: 12:25:08 PM: - inputs: {} 12:25:08 PM: origin: ui 12:25:08 PM: package: '@netlify/plugin-nextjs' 12:25:08 PM: Caching artifacts 12:25:08 PM: Started saving node modules 12:25:08 PM: Finished saving node modules 12:25:09 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2) 12:25:08 PM: Started saving build plugins 12:25:08 PM: Finished saving build plugins 12:25:08 PM: Started saving corepack cache 12:25:08 PM: Finished saving corepack cache 12:25:08 PM: Started saving pip cache 12:25:08 PM: Finished saving pip cache 12:25:08 PM: Started saving emacs cask dependencies 12:25:08 PM: Finished saving emacs cask dependencies 12:25:08 PM: Started saving maven dependencies 12:25:08 PM: Finished saving maven dependencies 12:25:08 PM: Started saving boot dependencies 12:25:08 PM: Finished saving boot dependencies 12:25:08 PM: Started saving rust rustup cache 12:25:08 PM: Finished saving rust rustup cache 12:25:08 PM: Started saving go dependencies 12:25:08 PM: Finished saving go dependencies 12:25:09 PM: Build failed due to a user error: Build script returned non-zero exit code: 2 12:25:09 PM: Failing build: Failed to build site 12:25:10 PM: Finished processing build request in 47.321s

commented

I'm not entirely sure where your error comes from β€” could it be that you have not updated all files from my PR's code (including the configureSIWE override)?


Anyways, I have the Loopring Wallet WalletConnect V2 working!
I just merged the 0.3.0-beta version. You can try to use that soon, I'd love to hear your experience.

What you need to do:

  • Update your fork to the 0.3.0 version
  • Create and include a WalletConnect Project ID. (Instructions below!)

Hey Geel!
This seems to have cleared just about all my hurdles. I have followed the instructions on the walletconnect installation link and added this to the .env file. I definitely believe my update with the PR had an issue due to me.

At the moment the wallet connection hangs on my phone in the loopring wallet after scanning the QR code. So I'm going to check my .env file for typing errors as the env-status page suggests. User error is likely at this point.

It appears everything is working just fine now.