From 4fe3f9edfc0ad6b15cb90e7fe8eed754381fdb18 Mon Sep 17 00:00:00 2001 From: vetalcore Date: Wed, 18 Dec 2024 21:56:50 +0200 Subject: [PATCH] feat(nami): [lw-1200] show tx related error after ui related ones in asset input (#1606) --- .../components/Form/CoinInput/useSelectedCoins.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/browser-extension-wallet/src/views/browser-view/features/send-transaction/components/Form/CoinInput/useSelectedCoins.tsx b/apps/browser-extension-wallet/src/views/browser-view/features/send-transaction/components/Form/CoinInput/useSelectedCoins.tsx index 61f1e48a7..839f30176 100644 --- a/apps/browser-extension-wallet/src/views/browser-view/features/send-transaction/components/Form/CoinInput/useSelectedCoins.tsx +++ b/apps/browser-extension-wallet/src/views/browser-view/features/send-transaction/components/Form/CoinInput/useSelectedCoins.tsx @@ -86,9 +86,6 @@ export const useSelectedCoins = ({ */ const getError = useCallback( (inputId: string, assetInput: AssetInfo): string | undefined => { - // If there is an error with the transaction, then display it over any other potential error - if (builtTxError) return builtTxError; - // If the asset has an input value but there is no sufficient balance, then display an insufficient balance error. if (assetInput?.value && assetInput.value !== '0' && !!insufficientBalanceInputs?.includes(inputId)) { return COIN_SELECTION_ERRORS.BALANCE_INSUFFICIENT_ERROR; @@ -101,6 +98,8 @@ export const useSelectedCoins = ({ if (address && isValidAddress(address) && assetInputList.every((item) => !(item.value && Number(item.value)))) { return COIN_SELECTION_ERRORS.BUNDLE_AMOUNT_IS_EMPTY; } + // Display an error with the tx itself + if (builtTxError) return builtTxError; // eslint-disable-next-line consistent-return return undefined; },