React Native and WalletConnect (Uncaught Error: null is not an object (evaluating 'RNRandomBytes.seed'))

664 views Asked by At

I want to use WalletConnect on my ReactNative app. As the WalletConnect docs say, I'm using npx rn-nodeify --install --hack (for introducing support for Web3) in an existing project.

Of course, I'm following these docs (which are indicated on the page of WalletConnect) but every time I run this app, I received

Uncaught Error: null is not an object (evaluating 'RNRandomBytes.seed')

on screen. Is there anyway to solve this?

I´m using expo on android.

1

There are 1 answers

1
Vineeta On

Instead of nodeify command use this approach to integrate wallet connect library with bare CLI project.

Reference: https://github.com/WalletConnect/walletconnect-monorepo/issues/753

In package.json add following dependencies

  "dependencies": {
    . . . 
    "@react-native-async-storage/async-storage": "^1.15.17",
    "@walletconnect/react-native-dapp": "^1.7.1",
    "react-native-qrcode-svg": "6.0.6",
    "react-native-randombytes": "^3.6.1",
    "react-native-svg": "9.6.4"
  },
  "devDependencies": {
    . . . 
    "node-libs-react-native": "^1.2.1",
  },

Update metro-config.js

module.exports = {
  resolver: {
    extraNodeModules: require("node-libs-react-native")
  },
  . . . 
};

Add following statement in index.js

require("node-libs-react-native/globals.js");