From 85130a426f7737969065e169695bdcdd80af025a Mon Sep 17 00:00:00 2001 From: Mark Nardi Date: Thu, 2 May 2024 17:44:55 +0200 Subject: [PATCH] fix: use correct base token --- .../row-sections/ActivityFeeSection.svelte | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityFeeSection.svelte b/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityFeeSection.svelte index 3c378daa6d..5a1aa3a40f 100644 --- a/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityFeeSection.svelte +++ b/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityFeeSection.svelte @@ -2,24 +2,24 @@ import { Activity } from '@core/activity' import { formatCurrency } from '@core/i18n' import { getFiatValueFromTokenAmount } from '@core/market/actions' - import { formatTokenAmountBestMatch } from '@core/token' + import { ITokenWithBalance, formatTokenAmountBestMatch } from '@core/token' import { Text } from '@bloomwalletio/ui' import { selectedAccountTokens } from '@core/token/stores' - import { getBaseToken } from '@core/profile/actions' export let activity: Activity - function getFormattedFee(_activity: Activity): string { - if (_activity.transactionFee) { - const amount = formatTokenAmountBestMatch(_activity.transactionFee, getBaseToken(), { decimals: 3 }) + $: baseCoin = $selectedAccountTokens?.[activity.sourceNetworkId]?.baseCoin + + function getFormattedFee(_activity: Activity, baseCoin: ITokenWithBalance | undefined): string { + if (_activity.transactionFee && baseCoin) { + const amount = formatTokenAmountBestMatch(_activity.transactionFee, baseCoin.metadata, { decimals: 3 }) return '- ' + amount } else { return '-' } } - function getFormattedMarketPrice(_activity: Activity): string | undefined { - const baseCoin = $selectedAccountTokens?.[activity.sourceNetworkId]?.baseCoin + function getFormattedMarketPrice(_activity: Activity, baseCoin: ITokenWithBalance | undefined): string | undefined { if (_activity.transactionFee && baseCoin) { const marketPrice = getFiatValueFromTokenAmount(_activity.transactionFee, baseCoin) return marketPrice ? formatCurrency(marketPrice) : '-' @@ -30,8 +30,8 @@
- {getFormattedFee(activity)} + {getFormattedFee(activity, baseCoin)} {#if activity.transactionFee} - {getFormattedMarketPrice(activity)} + {getFormattedMarketPrice(activity, baseCoin)} {/if}