bug: waitForTransactionReceipt throws `code.substring is not a function` in case transaction reverted
yulafezmesi opened this issue · comments
Describe the bug
while fetching transaction receipt by hash, the function returns internal error: code.substring is not a function
Link to Minimal Reproducible Example
https://stackblitz.com/edit/new-wagmi-rhd8t3?file=src%2FApp.tsx,vite.config.ts,src%2Fmain.tsx
Steps To Reproduce
- connect wallet
- click "get details" button
- you'll see code.substring is not a function error message on the screen.
Wagmi Version
2.5.20
Viem Version
2.9.25
TypeScript Version
5.2.2
Check existing issues
- I checked there isn't already an issue for the bug I encountered.
Anything else?
on this case, the code
variable coming as { data: undefined }
and the function tries to call .substring
function over object which cause error.
i think needs to be:
const reason = code?.data ? hexToString(`0x${code.data.substring(138)}`) : "unknown reason";
bug place
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.