Commit 719fd524 authored by lynn's avatar lynn Committed by GitHub

fix: update user rejected txn errors to stay up to date with widget (#5996)

init
parent f15dd1e6
...@@ -25,6 +25,8 @@ export function swapErrorToUserReadableMessage(error: any): string { ...@@ -25,6 +25,8 @@ export function swapErrorToUserReadableMessage(error: any): string {
// The 4001 error code doesn't capture the case where users reject a transaction for all wallets, // The 4001 error code doesn't capture the case where users reject a transaction for all wallets,
// so we need to parse the reason for these special cases: // so we need to parse the reason for these special cases:
if ( if (
// ethers v5.7.0 wrapped error
error?.code === 'ACTION_REJECTED' ||
// For Rainbow : // For Rainbow :
(reason?.match(/request/i) && reason?.match(/reject/i)) || (reason?.match(/request/i) && reason?.match(/reject/i)) ||
// For Frame: // For Frame:
...@@ -32,7 +34,9 @@ export function swapErrorToUserReadableMessage(error: any): string { ...@@ -32,7 +34,9 @@ export function swapErrorToUserReadableMessage(error: any): string {
// For SafePal: // For SafePal:
reason?.match(/cancelled by user/i) || reason?.match(/cancelled by user/i) ||
// For Coinbase: // For Coinbase:
reason?.match(/user denied/i) reason?.match(/user denied/i) ||
// For Fireblocks
reason?.match(/user rejected/i)
) { ) {
return t`Transaction rejected` return t`Transaction rejected`
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment