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

init
This commit is contained in:
lynn 2023-02-17 16:03:26 -05:00 committed by GitHub
parent f15dd1e61e
commit 719fd524ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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,
// so we need to parse the reason for these special cases:
if (
// ethers v5.7.0 wrapped error
error?.code === 'ACTION_REJECTED' ||
// For Rainbow :
(reason?.match(/request/i) && reason?.match(/reject/i)) ||
// For Frame:
@ -32,7 +34,9 @@ export function swapErrorToUserReadableMessage(error: any): string {
// For SafePal:
reason?.match(/cancelled by user/i) ||
// For Coinbase:
reason?.match(/user denied/i)
reason?.match(/user denied/i) ||
// For Fireblocks
reason?.match(/user rejected/i)
) {
return t`Transaction rejected`
}