Skip to content

Commit

Permalink
fix(@nftx/react): handle ACTION_REJECTED error
Browse files Browse the repository at this point in the history
in previous versions of ethers.js a rejected transaction would result in a 4001 error
at some point this was changed to a string code, meaning we weren't capturing and bailing
see this ethers.js commit:
ethers-io/ethers.js@d9897e0
  • Loading branch information
jackmellis committed Dec 21, 2022
1 parent 71eab7a commit 4a39673
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react/src/useTransaction/useWrapTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function useWrapTransaction<F extends Fn>(
// call the original fn and intercept the result
const [txErr, tx] = await t(fn(args));
if (txErr) {
if (txErr.code === 4001) {
if (txErr.code === 4001 || txErr.code === 'ACTION_REJECTED') {
throw new TransactionCancelledError(txErr, network);
}
// Exception - we couldn't even trigger the transaction
Expand Down

0 comments on commit 4a39673

Please sign in to comment.