Skip to content

Commit

Permalink
fix: use data property of return code (#3858)
Browse files Browse the repository at this point in the history
* fix: use `data` property of return code

* chore: add changeset

* Update fresh-carrots-switch.md

---------

Co-authored-by: jxom <jakemoxey@gmail.com>
  • Loading branch information
yulafezmesi and jxom committed Apr 28, 2024
1 parent f92bf44 commit 0d141f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/fresh-carrots-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wagmi/core": patch
"wagmi": patch
---

Fixed accessing reverted reason property inside `waitForTransactionReceipt`.
6 changes: 3 additions & 3 deletions packages/core/src/actions/waitForTransactionReceipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export async function waitForTransactionReceipt<
maxFeePerGas: txn.type === 'eip1559' ? txn.maxFeePerGas : undefined,
maxPriorityFeePerGas:
txn.type === 'eip1559' ? txn.maxPriorityFeePerGas : undefined,
})) as unknown as string
const reason = code
? hexToString(`0x${code.substring(138)}`)
}))
const reason = code?.data
? hexToString(`0x${code.data.substring(138)}`)
: 'unknown reason'
throw new Error(reason)
}
Expand Down

0 comments on commit 0d141f1

Please sign in to comment.