Replies: 1 comment
-
I think you mean a different solidity file, so if it is inherited in main contract, then it should be in the ABI of the contract. But oh, there is an edge case in Solidity right now, if you are declaring events in a library (and emitting these events in some function in the library or directly in contract), yet the ABI does not include such events. So in that case, we have to manually add that abi into the contract. const libraryAbi = ['event EscrowCreated(address,address,uint256,string)']
const contractAbi = [...]
const contract = new Contract(address, [...contractAbi, ...libraryAbi], provider);
contract.queryFilter(contract.filters.EscrowCreated()); I just read that you mentioned you are getting an empty array, probably the address is incorrect in your filter. Can you check in logs of a transaction which contract is emitting the EscrowCreated (maybe some other contract might be emitting it). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using the following code to get the particular event but getting an empty array:
tx link - https://mumbai.polygonscan.com/tx/0xd8fa9a8e81bdbeb9348ed9ac5dd26c5f24bdac983f0df417bc110b78a4726b14#eventlog
`const Address = "0xb09870211807281DF9D1620e808C99AB3589c49f"
const filter = {
address: Address,
topics: [ethers.utils.id('EscrowCreated(address,address,uint256,string)')]
};
console.log(ethers.utils.id('EscrowCreated(address,address,uint256,string)'))
console.log("logs : ",await contract.provider.getLogs(filter)) `
How can I filter specific events, if the events are in a different file which is not in the abi of the contract.
Check here for the code- https://mumbai.polygonscan.com/address/0xb09870211807281df9d1620e808c99ab3589c49f#code
Beta Was this translation helpful? Give feedback.
All reactions