From 58b67a8b7eb349bc0de68550bd9843aa1e0d3fff Mon Sep 17 00:00:00 2001 From: HeesungB Date: Wed, 21 Dec 2022 01:38:26 +0900 Subject: [PATCH] Add ledger error --- constants/error-message.ts | 8 ++++++++ pages/verification/index.tsx | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/constants/error-message.ts b/constants/error-message.ts index b50f388..aacdbf4 100644 --- a/constants/error-message.ts +++ b/constants/error-message.ts @@ -23,3 +23,11 @@ export const VERIFICATION_THRESHOLD_MESSAGE = export const INVALID_REFERRAL_ERROR = "Invalid referral:"; export const INVALID_REFERRAL_MESSAGE = "Make sure that the referrer ICNS name has been registered."; + +export const TOO_MANY_CHAINS_IN_LEDGER_ERROR = "Output buffer too small"; +export const TOO_MANY_CHAINS_IN_LEDGER_MESSAGE = + "Maximum 20 chains can be linked at a time on Ledger hardware wallet. Unselect some chains and try again."; + +export const EVM_CHAIN_IN_LEDGER_ERROR = "Ledger is unsupported for this chain"; +export const EVM_CHAIN_IN_LEDGER_MESSAGE = + "Ledger is unsupported for this chain. Remove EVM-based Cosmos SDK chains and try again."; diff --git a/pages/verification/index.tsx b/pages/verification/index.tsx index 8f9bda7..89cd448 100644 --- a/pages/verification/index.tsx +++ b/pages/verification/index.tsx @@ -54,11 +54,15 @@ import { import { ACCOUNT_NOT_EXIST_ERROR, ACCOUNT_NOT_EXIST_MESSAGE, + EVM_CHAIN_IN_LEDGER_ERROR, + EVM_CHAIN_IN_LEDGER_MESSAGE, INSUFFICIENT_GAS_ERROR, INSUFFICIENT_GAS_MESSAGE, INVALID_REFERRAL_ERROR, INVALID_REFERRAL_MESSAGE, KEPLR_NOT_FOUND_ERROR, + TOO_MANY_CHAINS_IN_LEDGER_ERROR, + TOO_MANY_CHAINS_IN_LEDGER_MESSAGE, TWITTER_LOGIN_ERROR, VERIFICATION_THRESHOLD_ERROR, VERIFICATION_THRESHOLD_MESSAGE, @@ -491,6 +495,18 @@ export default function VerificationPage() { console.log(error.message); captureException(error); + if (error.message.includes(TOO_MANY_CHAINS_IN_LEDGER_ERROR)) { + setErrorMessage({ message: TOO_MANY_CHAINS_IN_LEDGER_MESSAGE }); + setErrorModalOpen(true); + return; + } + + if (error.message.includes(EVM_CHAIN_IN_LEDGER_ERROR)) { + setErrorMessage({ message: EVM_CHAIN_IN_LEDGER_MESSAGE }); + setErrorModalOpen(true); + return; + } + setErrorMessage({ message: error.message }); setErrorModalOpen(true); }