'Filter any Event using ethers.js and local node (Ganache-cli)
anyone can help me? I am using ganache-cli with fork bsc mainnet. When I use queryFilter, javascript show me this error: "Number can only safely store up to 53 bits"
In bsc mainnet it works perfectly
How can I solve this?
this is the code :
const {JsonRpcProvider} = require("@ethersproject/providers")
const ethers = require('ethers')
var provider = new ethers.providers.JsonRpcProvider("http://localhost:xxxx")
var abi = [
"event Swap(address indexed sender,uint amount0In,uint amount1In,uint amount0Out,uint amount1Out,address indexed to)"
]
contract = new ethers.Contract("0xd99c7F6C65857AC913a8f880A4cb84032AB2FC5b", abi, provider)
provider.getBlockNumber().then(function(x) {
contract.queryFilter([contract.filters.Swap()], x-48, x).then(function(el) {
console.log(el)
})
})
Solution 1:[1]
Guess this workaround should do the trick:
https://github.com/ChainSafe/web3.js/pull/3948#issuecomment-821779691
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sirroger |
