-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Check existing issues
- I checked there isn't already an issue for the bug I encountered.
Viem Version
2.34.0
Current Behavior
The waitForTransactionReceipt function does not handle the scenario where a transaction is no longer found on the network (e.g., because it was replaced by a newer one with the same nonce and a higher gas price, or it was simply dropped from the mempool). Instead of rejecting the promise with a clear error
First Issue: The function cannot find transactions that have been replaced or dropped
Second Issue: Regardless of the configuration (e.g., timeout, retryCount), the function's promise never settles (neither resolves nor rejects) if it cannot locate the transaction hash on the blockchain
Expected Behavior
waitForTransactionReceipt should detect replaced transactions or throw an error
Steps To Reproduce
This app has two buttons:
- Send 1 wei to yourself — submits a self-transfer with intentionally tiny EIP-1559 fees so it stays pending.
- Speed Up — resubmits the same nonce with higher fees, replacing the first transaction.
How to reproduce
-
Click Send 1 wei to yourself.
- The tx uses
maxFeePerGas = 2
andmaxPriorityFeePerGas = 1
(wei), so it will not get mined on Sepolia. It remains pending indefinitely. waitForTransactionReceipt
for this tx never resolves with a receipt (by design), because the transaction won’t be included in a block.
- The tx uses
-
After a short wait, click Speed Up.
- The app sends a replacement tx with the same nonce and higher fees (roughly
2×
the currentestimateFeesPerGas
values). - This replacement supersedes the first tx. You’ll see a receipt in the console only for the second (speed-up) transaction.
- The original tx will never produce a receipt, because it was replaced before inclusion.
- The app sends a replacement tx with the same nonce and higher fees (roughly
-
If you don’t click Speed Up, nothing will happen: the first tx stays pending forever and no receipt is printed.
Screen.Recording.2025-08-20.at.20.37.57.mp4
Link to Minimal Reproducible Example
https://github.com/Pasha8914/waitForTransactionReceipt-bug
Anything else?
No response