-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
use web3 with react native, Invalid JSON RPC response: "Failed to connect to mainnet.infura.io #2054
Comments
I found in react-native ,use the buildt-in function
is there any other solution,if there are some other,please contact me! thank you. |
@jiangbo0216 This solution works, but can it break anything related to cookies? |
@nivida maybe it obvious question. I just installed web3 'npm i web3@1.0.0-beta.37'. Then I looked at 'node_modules\web3-providers-http\src\index.js' and checked the same module on master branch |
Hay @6pm, v0.20.x - develop/master branch This will be improved on the 1.0 stable release. |
@6pm My situation does not involve cookies, so I am not sure.if you have some |
I have a similar problem. My problem is that I am trying to connect to a private node that needs me to enter a URL in the format of https://username:password@nodeURL. Doing this in node.js works.
but doing the same in React-Native give me an error:
I have attempted to do this to split the node URL, username and password to 3 different parameters but it doesn't work in Node nor React-Native.
|
Closed because of the ongoing clean up of the issue list. Feel free to ask this in our gitter channel or on stackoverflow. |
I create a simple react native project following this:
1 init Project
2 npm intall
yarn add node-libs-browser
3 create
rn-cli.config.js
4 create
global.js
5
app.js
importglobal
import './global';
6 npm install
babel-preset-es2015
yarn add --dev babel-cli babel-preset-es2015
install
react-native-crypto react-native-randombytes
yarn add react-native-crypto react-native-randombytes
install
tradle/rn-nodeify
yarn add --dev tradle/rn-nodeify
link
react-native link
run command in cmd
./node_modules/.bin/rn-nodeify --hack --install
import in App.js
7 instal lweb3
yarn add web3
8 call web3 method
9 log
react-native log-android
10 run in android
react-native run-android
if error occur
run this command
react-native link
re-install
rn-nodefiy
yarn add --dev tradle/rn-nodeify
run again
./node_modules/.bin/rn-nodeify --hack --install
in project root directory,
shim.js
will appear.I build this in window10,and my package.json is like this:
and I build apk successfully,and there is no obvious bug,
but I got this
undefined Error: Invalid JSON RPC response: "Failed to connect to rinkeby.infura.io
and this
the code run well in node , got the response
so is anyone met problem like this?
The text was updated successfully, but these errors were encountered: