I like to build products using Next.js, Python, and Solidity
I'm building EphemeralDAO🔗.
I use the JamStack to quickly create websites and bring them online
The issue may be because of this line:
const provider = new ethers.providers.JsonRpcProvider()
I read the ethers docs, and they recommend JsonRpcProvider() for local nodes, for others they recommend getDefaultProvider() or Web3Provider(web3.currentProvider).
The other pages use Web3Provider, it's only index.js that uses the bad one.
So the fix for me was to make this change to index.js:
const provider = new ethers.providers.Web3Provider(web3.currentProvider)
And now I'm connected to and playing with the network!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm stuck on this error
Unhandled Runtime Error
Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.3.1)
Source
.next\static\chunks\pages\index.js (173:0) @ Logger.makeError
171 | }
172 | // @todo: Any??
You need to define networkId to the provider - ethers.getDefaultProvider('ropsten')
The issue may be because of this line:
const provider = new ethers.providers.JsonRpcProvider()
I read the ethers docs, and they recommend JsonRpcProvider() for local nodes, for others they recommend getDefaultProvider() or Web3Provider(web3.currentProvider).
The other pages use Web3Provider, it's only index.js that uses the bad one.
So the fix for me was to make this change to index.js:
const provider = new ethers.providers.Web3Provider(web3.currentProvider)
And now I'm connected to and playing with the network!