-
-
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
Feature: Add timeout to waitForTransaction #477
Comments
You re absolutely correct, that parameter is misnamed (in v3 it was timeout, but I changed to a confirmation count in v4) and in the code there is an That is something I will put back into v5 (public beta coming soon). In the meantime, removing the event listeners will cancel the wait, but there should certainly be an easier way to do that. |
Hi @ricmoo - what is the current recommended way in v4 to set and manage timeouts when waiting for transactions to be mined? I would like to wait 3 minutes for my transaction to be mined, and if it times out, I would like to resubmit the same tx using the same nonce with a much higher gas price.
|
@gitpusha Yes, that is probably the best way to handle it in v4, using a separate timer. This is however, not ideal, since the internal polling loop will continue. I'll add this to v5 right now, but I probably won't make any changes to the API in v4... |
I've added support in v5, if anyone would like to try it out. :) |
This has been added to v5. If you have any problems, please feel free to re-open this ticket. Thanks! :) |
@ricmoo cool will try it out ! |
Suppose gas prices spike or something and now your transaction is stuck "in the ether" (~>30 minutes confirmations). Is it possible to have a third parameter in the
waitForTransaction(hash, confirmations, timeout)
? Currently just wrappingwaitForTransaction
in a promise that rejects after n seconds.Also I think the parameters names might be a little off? Could be wrong. For instance in abstract provider, the signature is
transactionHash, timeout?
, but in BaseProvider it istransactionHash, confirmations?
The text was updated successfully, but these errors were encountered: