{ const provider = new ethers.providers.JsonRpcProvider(p" /> { const provider = new ethers.providers.JsonRpcProvider(p" /> { const provider = new ethers.providers.JsonRpcProvider(p"/>

Could Not Detect Network while connecting to infura rpc url

37 Views Asked by At

Code :

`require('dotenv').config()
 const ethers = require("ethers")

 const main = async () => {
 const provider = new ethers.providers.JsonRpcProvider(process.env.INFURA_URL)

 const filter = {
  address: process.env.ADDRESS_MY,
  type :"Transfer",
  fromBlock: 0,
  toBlock: "latest",
   };
 const logs = await provider.getLogs(filter);
 console.log(logs);
 }

 main()
.then(() => process.exit(0))
.catch((error) => {
    console.error(error);
    process.exit(1);
});`

Error:

reason: 'could not detect network', code: 'NETWORK_ERROR', event: 'noNetwork'

Query :

I am not able to connect the the network using infura rpc url as i want to use the filter method of the ethers to get the logs of the transaction on a specific address.

I want to fetch all the transactions of a specific addres using ethers method FILTER but i am not able to connect the network.

0

There are 0 best solutions below