DEV Community

Discussion on: Building a Full Stack NFT Marketplace on Ethereum with Polygon

Collapse
bleedingeffigy profile image
Alex Hernandez

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!