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
Here is a better alternative to rn-nodeify #753
Comments
Hi! This is great, however how can WalletConnect be used alongside ethers? |
I found a solution.
|
@cdiddy77 thank you for the alternative its absolutely necessary. However I ran into another issue, actually a recurring one, I keep getting this error
Any clues on how to solve this will be greatly appreciated |
I don't think that I saw this one. If you think it's related to your dependencies, I might check the versions of what you have in your package.json with what is in other deps. 'Yarn why' is your friend. |
Thank @cdiddy77 .. used |
Happy to take a look |
Thank you.. here is a codesandbox https://codesandbox.io/s/l2pnn5 |
Thank you @cdiddy77 .. this works now. Apparently it can only work in a project with native module capability. I tried it using the bare workflow from expo and it works great. Thanks once again |
THANK YOU! it works |
@cdiddy77 thanks! I love your approach! I tried your method and it seems to work - app is building, launching and I'm able to connect with my metamask wallet. However, I faced some other issues and I'm wondering if any of them sounds familiar:
+1 to add this process in documantation EDIT There is still this issue with disconnecting the wallet, but I faced it even before when using |
@gate3 What was the change that worked for you in the end regarding the |
hi @mrcgrhrdt in my case I had two issues:
Basically just make sure to spread the |
im facing that issue, i do this steps #753 (comment) and put the "require("node-libs-react-native/globals.js");" in App.js (im using Expo) and then the other instructions of quick start for Dapps (React Native). |
Apologies for misleading here, it works.. I will post a project once i bootstrap it. |
Thank you so much gate! the repo is private rn, but I will send it to you asap when it becomes public 😉 |
@emzet93 i got the same issue as you |
@walidsahli yeah exactly. I think this is caused by using |
It works for me
|
Just putting this here in case anybody needs it.. its bootstrapped and ready to go. Already has walletConnect and ethersjs installed. Bare Workflow https://github.com/weedle-app/weedle-expo-bare-workflow Managed Workflow https://github.com/weedle-app/weedle-expo-managed-workflow |
Initial setup for adding WalletConnect and its dependencies. Also adds a button to the Box app to initiate connecting to a wallet. Followed setup instruction outlined here: https://docs.walletconnect.com/quick-start/dapps/react-native One difference however, is instead of npx rn-nodeify --install --hack, I followed the setup outlined here: WalletConnect/walletconnect-monorepo#753 (comment) This commit also removes the Jest test temporarily until I can come back later and adjust configs to get things passing again.
Is the function "getBrowerCrypto" misspelled? |
Thank you @gate3 this is the best solution reference to follow :) |
I followed your steps and the app is building successfully on android device.
|
@cdiddy77 thank you for your feedback and contribution! Since we are putting in all of our efforts into v2, I'm going to close this issue since it's a documentation update request for v1. |
I followed all your steps in my react.js project however when I run it, the URL is incorrectly displaying as: https://localhost:3000/[object%20Object] Any ideas? |
Hi @cdiddy77 |
At the beginning of the quick start for Dapps (React Native) it proposes that folks use
npx rn-nodeify --install --hack
. This is problematic for a couple of reasons:rm -rf node_mdules
andpod install
s.rn-nodeify
did work, it has consequences and is fragile.Here is a better way:
Use the new metro bundler to do essentially what browserfy and webpack do. Here's how I got it to work:
In package.json:
The various react-native* deps are because even though new RN is good about having
pod install
take care of installing pods for native modules, it doesn't detect second- and greater order native deps. Note the specific versions. These are the versions that @WalletConnect transitively requires. Blindly doingnpm install -s react-native-svg
for example will result in 2 versions of the SVG package being brought in, which results in a crash at startup.The important one is the devDependency for node-libs-react-native
Next, create or edit
metro.config.js
:This is the magic: It says: hey, metro, if you see, oh, say
import * from "crypto";
and you can't find crypto, go asknode-libs-react-native
, which then hooks upreact-native-crypto
.There's one more little step, which is that Node.js modules often depend on certain globals. You hook these up by adding:
at the top of
index.js
It was just about that simple. I would strongly encourage to update the documentation for this amazing codebase and enable more folks to get it working faster. rn-nodeify is really an abominable hack, and whereas a better cleaner solution exists, now that the metro bundler has become sufficiently enhanced.
The text was updated successfully, but these errors were encountered: