0

I have a typescript project using ethersjs to connect and interact with a smart contract, on a fork made with ganache. This specific code is throwing an error:

  const eventFilter: ethers.EventFilter = await governor.filters.ProposalCreated as ethers.EventFilter;

  const proposalsEvents = await governor.queryFilter(eventFilter);//FAILS

Returning:

TypeError: Cannot read properties of undefined (reading 'map')
    at /projectdir/node_modules/ganache-core/lib/forking/forked_blockchain.js:850:37
    at /projectdir/node_modules/ganache-core/lib/forking/forked_blockchain.js:136:11
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Does anybody knows why would that be?

1 Answer 1

0

The problem was the fork. Since I didn't specify a block number for the queryFilter it tried to gather info from the genesis block but it has only the last 128 block available to query from.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.