diff --git a/packages/suite/src/components/wallet/Fees/Fees.tsx b/packages/suite/src/components/wallet/Fees/Fees.tsx index e4eff06ec4c..d78aaf59861 100644 --- a/packages/suite/src/components/wallet/Fees/Fees.tsx +++ b/packages/suite/src/components/wallet/Fees/Fees.tsx @@ -24,6 +24,7 @@ import { import { CustomFee } from './CustomFee'; import { FeeDetails } from './FeeDetails'; import { AnimatePresence, motion } from 'framer-motion'; +import { TranslationKey } from '@suite-common/intl-types'; const Container = styled.div` overflow: hidden; /* prevent scrollbar when custom fee is opened */ @@ -83,7 +84,7 @@ const HelperTextWrapper = styled(Paragraph)` font-size: ${variables.FONT_SIZE.SMALL}; `; -const FEE_LEVELS_TRANSLATIONS = { +const FEE_LEVELS_TRANSLATIONS: Record = { custom: 'FEE_LEVEL_CUSTOM', high: 'FEE_LEVEL_HIGH', normal: 'FEE_LEVEL_NORMAL', @@ -92,12 +93,10 @@ const FEE_LEVELS_TRANSLATIONS = { } as const; const buildFeeOptions = (levels: FeeLevel[]) => - levels - .filter(level => level.label !== 'low') // hack to hide "low" fee option - .map(({ label }) => ({ - label: , - value: label, - })); + levels.map(({ label }) => ({ + label: , + value: label, + })); export interface FeesProps { account: Account; diff --git a/packages/suite/src/hooks/wallet/useCoinmarketSellForm.ts b/packages/suite/src/hooks/wallet/useCoinmarketSellForm.ts index cc0706883f3..74c4cf731ac 100644 --- a/packages/suite/src/hooks/wallet/useCoinmarketSellForm.ts +++ b/packages/suite/src/hooks/wallet/useCoinmarketSellForm.ts @@ -104,7 +104,7 @@ export const useCoinmarketSellForm = ({ const { shouldSendInSats } = useBitcoinAmountUnit(symbol); const coinFees = fees[symbol]; - const levels = getFeeLevels(networkType, coinFees).filter(level => level.label !== 'low'); + const levels = getFeeLevels(networkType, coinFees); const feeInfo = { ...coinFees, levels }; const symbolForFiat = mapTestnetSymbol(symbol); const localCurrencyOption = { value: localCurrency, label: localCurrency.toUpperCase() }; diff --git a/suite-common/wallet-core/src/blockchain/blockchainThunks.ts b/suite-common/wallet-core/src/blockchain/blockchainThunks.ts index 291dc51d18b..d226628a27c 100644 --- a/suite-common/wallet-core/src/blockchain/blockchainThunks.ts +++ b/suite-common/wallet-core/src/blockchain/blockchainThunks.ts @@ -62,14 +62,20 @@ export const preloadFeeInfoThunk = createThunk( const partial: Partial = {}; networks.forEach((network, index) => { const result = levels[index]; + if (result.success) { const { payload } = result; partial[network.symbol] = { blockHeight: 0, ...payload, - levels: sortLevels(payload.levels).map(l => ({ - ...l, - label: l.label || 'normal', + levels: sortLevels( + payload.levels + // hack to hide "low" fee option + // (we do not want to change the connect API as it is a potentially breaking change) + .filter(level => level.label !== 'low'), + ).map(level => ({ + ...level, + label: level.label || 'normal', })), }; } @@ -130,7 +136,12 @@ export const updateFeeInfoThunk = createThunk( if (result.success) { newFeeInfo = { ...result.payload, - levels: sortLevels(result.payload.levels), + levels: sortLevels( + result.payload.levels + // hack to hide "low" fee option + // (we do not want to change the connect API as it is a potentially breaking change) + .filter(level => level.label !== 'low'), + ), }; } }