From c33be9422b4d3e6969c494043fee532d97fed35a Mon Sep 17 00:00:00 2001 From: woody <125113430+woodenfurniture@users.noreply.github.com> Date: Thu, 14 Dec 2023 08:32:02 +1100 Subject: [PATCH] fix: broken error message for savers withdrawls (#5855) --- .../Withdraw/components/Withdraw.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Withdraw/components/Withdraw.tsx b/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Withdraw/components/Withdraw.tsx index 7e0517004a8..c674e2c58f3 100644 --- a/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Withdraw/components/Withdraw.tsx +++ b/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Withdraw/components/Withdraw.tsx @@ -3,7 +3,7 @@ import { AddressZero } from '@ethersproject/constants' import type { AccountId } from '@shapeshiftoss/caip' import { fromAccountId, fromAssetId, toAssetId } from '@shapeshiftoss/caip' import type { GetFeeDataInput, UtxoChainId } from '@shapeshiftoss/chain-adapters' -import type { Asset } from '@shapeshiftoss/types' +import type { Asset, KnownChainIds } from '@shapeshiftoss/types' import { Err, Ok, type Result } from '@sniptt/monads' import { useQueryClient } from '@tanstack/react-query' import { getOrCreateContractByType } from 'contracts/contractManager' @@ -21,6 +21,7 @@ import { useTranslate } from 'react-polyglot' import { encodeFunctionData, getAddress } from 'viem' import { Amount } from 'components/Amount/Amount' import type { StepComponentProps } from 'components/DeFi/components/Steps' +import { getChainShortName } from 'components/MultiHopTrade/components/MultiHopTradeConfirm/utils/getChainShortName' import { Row } from 'components/Row/Row' import { Text } from 'components/Text' import type { TextPropTypes } from 'components/Text/Text' @@ -325,7 +326,12 @@ export const Withdraw: React.FC = ({ accountId, fromAddress, onNe } catch (error) { console.error(error) // Assume insufficient amount for gas if we've thrown on the try block above - return Err(translate('common.insufficientAmountForGas', { assetSymbol: feeAsset.symbol })) + return Err( + translate('common.insufficientAmountForGas', { + assetSymbol: feeAsset.symbol, + chainSymbol: getChainShortName(feeAsset.chainId as KnownChainIds), + }), + ) } }, [ @@ -341,8 +347,7 @@ export const Withdraw: React.FC = ({ accountId, fromAddress, onNe chainId, supportedEvmChainIds, saversRouterContractAddress, - feeAsset.assetId, - feeAsset.symbol, + feeAsset, translate, ], )