WalletConnect / web3modal-react-native

Web3Modal React-Native SDK
https://web3modal.com
Apache License 2.0
43 stars 14 forks source link

[bug]: Error using Web3Modal using React Native CLI using @web3modal/ethers-react-native package #171

Closed DinethP closed 4 days ago

DinethP commented 4 weeks ago

Description

I am trying to migrate from a previous version of walletconnect to current version. My React Native app is built using React Native CLI and I am using the @web3modal/ethers-react-native that uses ethers

I get the errors:

Please use proxy object

Cannot convert undefined value to object

Having looked into the node_modules, the error seems to originate from the valtio npm package.

Web3Modal SDK version

@web3modal/ethers-react-native 1.4.1

Output of npx react-native info

info Fetching system and libraries information... System: OS: macOS 14.4.1 CPU: (8) arm64 Apple M1 Pro Memory: 90.23 MB / 32.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.12.1 path: /usr/local/bin/node Yarn: version: 3.6.4 path: /usr/local/bin/yarn npm: version: 8.19.2 path: /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: version: 1.12.1 path: /usr/local/bin/pod SDKs: iOS SDK: Not Found Android SDK: API Levels:

info React Native v0.74.2 is now available (your project is running on v0.74.1). info Changelog: https://github.com/facebook/react-native/releases/tag/v0.74.2 info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.74.1 info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Expo Version (if applies)

React Native CLI

Steps to reproduce

Follow this documentation to create a new react-native cli project (I have created a test repo): https://reactnative.dev/docs/getting-started-without-a-framework

Follow wallet connect web3 modal documentation for react native cli with ethers (not ethers v5). https://docs.walletconnect.com/web3modal/react-native/about?platform=ethers

Update App.tsx with the code provided in the documentation. When I add the Web3Modal component to the JSX, I get the error.

Snack, code example, screenshot, or link to a repository

  1. Clone the following repo: https://github.com/DinethP/RN-WalletConnect-ethers-test-app
  2. Run npm start
  3. Press a to load on Android emulator

Error:

Screenshot 2024-06-07 at 23 48 35
DinethP commented 1 week ago

I have tried to implement this in an expo project, using both the @web3modal/ethers5-react-native and @web3modal/ethers-react-native modules.

I am getting the same exact error

DinethP commented 6 days ago

Bump

ignaciosantise commented 4 days ago

hey @DinethP 👋 sorry for the delay. Some months ago we noticed valtio had some issues with Hermes compilation, and that's why we still use the v1.10.5

Checking your test repo, i see that your yarn.lock file has two versions of valtio, so probably yarn is resolving to the wrong one. Can you try adding this to your package.json?

resolutions: {
    "valtio": "1.10.5"
}

and run yarn install again?

DinethP commented 4 days ago

Hey @ignaciosantise. This fix worked!

Appreciate your input on this.