Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Smart Contract Integration with Ether.js

I’ve been trying to link a smart contract with ethers.js in my project.

const Provider= new ethers.providers.JsonRpcProvider(
  `https://goerli.infura.io/v3/`
const TokenContract = new ethers.Contract( TokenAddress, abiSource.token.abi, Provider );
);

I tried to run this but couldn’t get the balance of the token contract. Extracted RPC link from the Metamask. Who can help me with this problem? Thanks in advance.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Please insert Infura Georli API key in your Provider.

const Provider= new ethers.providers.JsonRpcProvider(
  `https://goerli.infura.io/v3/YOUR_API_KEY_HERE`
);

https://docs.infura.io/networks/ethereum/how-to/secure-a-project/project-id

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading