-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TransactionResponse type is wrong for wait
#971
Comments
You are probably right that I am not adding it in that case. Surprised TypeScript didn’t complain. I will add a |
Yesterday I was seeing a similar problem here: providerETH.on(filter, async (log: ethers.Event) => {
const tx = await event.getTransaction(); // this throws getTransaction is not a function
});
(await plasmaManagerInstanceETH.queryFilter(
filter,
6889863,
'latest'
)).forEach(event => {
const tx = await event.getTransaction(); // this works
}); |
I have "wait is not a function", i'm using it as per v5 migration examples. I really would like to use ethers instead of web3 because of the much cleaner architecture, but the need to get informed about the confirmed blocks is fundamental. const txResponse = await contract.Donation(donorName, { value: wei, });
const txReceipt = await txResponse.wait(24); // this throws wait is not a function |
@zemse I think you meant providerETH.on(filter, async (log: ethers.Event) => {
// v----- here
const tx = await event.getTransaction(); // this throws getTransaction is not a function
}); |
@kimxilxyong Can you add a |
I think I made an error while copy pasting that time. Redoing it right now in browser and adding some screenshots
After that I made a transaction that emits the above event. Then got this console log. With queryfilter The query filter one is definitely filled up with methods. Maybe my mistake is that the typing in Maybe we can do some typescript overloading if possible, so that whatever type is there (in case of |
@zemse console.log at runtime does not check anything typescript related. If you trick typescript to believe the object is an Event, then that only affects the compiler. If you would do |
This has been fixed in 5.4.2. Try it out and let me know if you still have any problems. |
Closing now, but let me know if you continue to have issues. Thanks! :) |
The type of TransationResponse is
I think it needs to be
Or there need to be two types, one for getBlockWithTransactions and one for send
FYI, the use case is an indexer, so I need for each block the tx + receipt, the wait function with 1 or 0 as confirmations seemed like an elegant solution which would allow me not to pass around the provider.
The text was updated successfully, but these errors were encountered: