我想使用ethers来监听一些合同事件,并指定起始块,根据文档填写fromBlock,但它不起作用
const { ethers } = require("ethers");
async function main(){
const provider = new ethers.providers.WebSocketProvider("wss:xxxxx")
filter = {
fromBlock: 12989984,
// address: "0x123",
topics: [
ethers.utils.id("Transfer(address,address,uint256)")
]
}
provider.on(filter, (log, event) => {
console.log(log)
})
}
main()
代码看起来是这样的,我想听听来自块12989984的传输事件,但它实际上是从最新的块开始的
正如这里所说:https://github.com/ethers-io/ethers.js/issues/498,提供程序事件筛选器对象不再支持fromBlock
。