Skip to content
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

waitForTransaction throws incorrect error (t.substring is not a function) on reverted transactions #3725

Closed
1 task done
salil-naik opened this issue Mar 19, 2024 · 1 comment

Comments

@salil-naik
Copy link
Contributor

salil-naik commented Mar 19, 2024

Describe the bug

useWaitForTransaction hook throws an unhelpful error (t.substring is not a function) when a transaction is reverted. This could be because t(code) is likely undefined in the error handling core around here.

It would be significantly more helpful if waitForTransaction could return the exact reason for the transaction failure. This would allow developers to identify and address the specific issue causing the reversion.

For reference, here is an example from Tenderly of a transaction on Bungee Exchange that failed due to gas limit issues. However, wagmi threw t.substring() error, making it difficult to find the root cause.

Failed Transaction on Etherescan: https://optimistic.etherscan.io/tx/0xe7e981763d8cbbe0f6ca8ed3b0ffcb87b8fc823fe736f9652ab56eabda60b02e

Link to Minimal Reproducible Example

No response

Steps To Reproduce

To reproduce, you could go to Bungee Exchange and make a swap or bridge transaction with lower gas limit. (fails for 100000 gas limit)

Wagmi Version

^1.4.12

Viem Version

1.1.8

TypeScript Version

4.8.4

Check existing issues

Anything else?

No response

@salil-naik salil-naik changed the title waitForTransaction throws incorrect error (t.substring is not a function) on reverted transactions waitForTransaction throws incorrect error (t.substring is not a function) on reverted transactions Mar 19, 2024
@jxom jxom closed this as completed in b4f0906 Apr 3, 2024
Copy link
Contributor

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest wagmi version. If you have any other comments you can create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant