Skip to content

Commit

Permalink
Merge pull request #544 from lidofinance/feature/si-1702-ledger-live-…
Browse files Browse the repository at this point in the history
…not-enough-gas

fix: update Ledger Live error handling
  • Loading branch information
itaven authored Nov 21, 2024
2 parents 305245e + 456cf1e commit c1e4723
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions utils/getErrorMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,12 @@ export const extractCodeFromError = (
normalizedMessage.includes('rejected the request') ||
normalizedMessage.includes('reject this request') ||
normalizedMessage.includes('rejected methods') ||
normalizedMessage.includes('transaction declined')
normalizedMessage.includes('transaction declined') ||
normalizedMessage.includes('signed declined')
)
return 'ACTION_REJECTED';
}

// Ledger live errors
if (
'data' in error &&
typeof error.data === 'object' &&
Array.isArray(error.data) &&
typeof error.data['0'] === 'object' &&
typeof error.data['0'].message === 'string' &&
error.data['0'].message.toLowerCase().includes('rejected')
) {
return 'ACTION_REJECTED';
}

if ('name' in error && typeof error.name == 'string') {
const error_name = error.name.toLowerCase();
if (error_name === 'EthAppPleaseEnableContractData'.toLowerCase())
Expand Down

0 comments on commit c1e4723

Please sign in to comment.