diff --git a/packages/desktop/components/popup/popups/AliasConfirmationPopup.svelte b/packages/desktop/components/popup/popups/AliasConfirmationPopup.svelte index 3f6127eaae..0e223cfc98 100644 --- a/packages/desktop/components/popup/popups/AliasConfirmationPopup.svelte +++ b/packages/desktop/components/popup/popups/AliasConfirmationPopup.svelte @@ -4,7 +4,7 @@ import { processAndAddToActivities } from '@core/activity/actions' import { handleError } from '@core/error/handlers/handleError' import { localize } from '@core/i18n' - import { checkActiveProfileAuth, getBaseToken } from '@core/profile/actions' + import { checkActiveProfileAuth } from '@core/profile/actions' import { EMPTY_HEX_ID, sendPreparedTransaction } from '@core/wallet' import { AliasOutputBuilderParams, @@ -14,12 +14,13 @@ } from '@iota/sdk/out/types' import { closePopup } from '@desktop/auxiliary/popup' import { api, getClient } from '@core/profile-manager' - import { formatTokenAmountPrecise } from '@core/token' - import { getActiveNetworkId } from '@core/network' + import { formatTokenAmount } from '@core/token' + import { getL1Network } from '@core/network' import PopupTemplate from '../PopupTemplate.svelte' let storageDeposit: string = '0' + const network = getL1Network() const address = new Ed25519Address(api.bech32ToHex($selectedAccount.depositAddress)) const aliasOutputParams: AliasOutputBuilderParams = { @@ -38,7 +39,7 @@ try { const client = await getClient() const resp = await client.buildAliasOutput(params) - storageDeposit = formatTokenAmountPrecise(Number(resp.amount), getBaseToken()) + storageDeposit = formatTokenAmount(BigInt(resp.amount), network.baseToken) } catch (err) { handleError(err) } @@ -52,12 +53,10 @@ } try { - const networkId = getActiveNetworkId() - updateSelectedAccount({ isTransferring: true }) const preparedTransaction = await $selectedAccount.prepareCreateAliasOutput() const transaction = await sendPreparedTransaction(preparedTransaction) - await processAndAddToActivities(transaction, $selectedAccount, networkId) + await processAndAddToActivities(transaction, $selectedAccount, network.id) closePopup() } catch (err) { handleError(err) diff --git a/packages/desktop/components/popup/popups/BurnNativeTokensConfirmationPopup.svelte b/packages/desktop/components/popup/popups/BurnNativeTokensConfirmationPopup.svelte index a9020d41a7..e9ce6762c4 100644 --- a/packages/desktop/components/popup/popups/BurnNativeTokensConfirmationPopup.svelte +++ b/packages/desktop/components/popup/popups/BurnNativeTokensConfirmationPopup.svelte @@ -3,7 +3,7 @@ import { selectedAccount } from '@core/account/stores' import { localize } from '@core/i18n' import { checkActiveProfileAuth } from '@core/profile/actions' - import { ITokenWithBalance, formatTokenAmountBestMatch } from '@core/token' + import { ITokenWithBalance, formatTokenAmount } from '@core/token' import { burnToken } from '@core/wallet' import { PopupId, closePopup, openPopup } from '@desktop/auxiliary/popup' import PopupTemplate from '../PopupTemplate.svelte' @@ -11,7 +11,7 @@ export let token: ITokenWithBalance export let rawAmount: bigint - $: formattedAmount = formatTokenAmountBestMatch(rawAmount, token?.metadata) + $: formattedAmount = formatTokenAmount(rawAmount, token?.metadata) function onBackClick(): void { openPopup({ diff --git a/packages/desktop/components/popup/popups/MintNativeTokenConfirmationPopup.svelte b/packages/desktop/components/popup/popups/MintNativeTokenConfirmationPopup.svelte index 1aa2c0984e..c57ec59f8e 100644 --- a/packages/desktop/components/popup/popups/MintNativeTokenConfirmationPopup.svelte +++ b/packages/desktop/components/popup/popups/MintNativeTokenConfirmationPopup.svelte @@ -4,12 +4,15 @@ import { selectedAccount } from '@core/account/stores' import { handleError } from '@core/error/handlers/handleError' import { localize } from '@core/i18n' - import { getBaseToken, checkActiveProfileAuth } from '@core/profile/actions' + import { checkActiveProfileAuth } from '@core/profile/actions' import { mintNativeToken, mintTokenDetails, buildFoundryOutputBuilderParams, IMintTokenDetails } from '@core/wallet' import { closePopup, openPopup, PopupId } from '@desktop/auxiliary/popup' - import { IIrc30Metadata, TokenStandard, formatTokenAmountPrecise } from '@core/token' + import { IIrc30Metadata, TokenStandard, formatTokenAmount } from '@core/token' import { getClient } from '@core/profile-manager' import PopupTemplate from '../PopupTemplate.svelte' + import { getL1Network } from '@core/network' + + const network = getL1Network() let storageDeposit = '0' @@ -28,7 +31,7 @@ ) const client = await getClient() const preparedOutput = await client.buildFoundryOutput(foundryOutputParams) - storageDeposit = formatTokenAmountPrecise(Number(preparedOutput.amount) ?? 0, getBaseToken()) + storageDeposit = formatTokenAmount(BigInt(preparedOutput.amount ?? 0), network.baseToken) } } diff --git a/packages/desktop/components/popup/popups/MintNftCollectionConfirmationPopup.svelte b/packages/desktop/components/popup/popups/MintNftCollectionConfirmationPopup.svelte index b020a204b9..9b2c65695a 100644 --- a/packages/desktop/components/popup/popups/MintNftCollectionConfirmationPopup.svelte +++ b/packages/desktop/components/popup/popups/MintNftCollectionConfirmationPopup.svelte @@ -5,15 +5,17 @@ import { localize } from '@core/i18n' import { CURRENT_IRC27_VERSION, IIrc27Metadata } from '@core/nfts' import { getClient } from '@core/profile-manager' - import { checkActiveProfileAuth, getBaseToken } from '@core/profile/actions' - import { formatTokenAmountPrecise } from '@core/token' + import { checkActiveProfileAuth } from '@core/profile/actions' + import { formatTokenAmount } from '@core/token' import { buildNftOutputBuilderParams, mintNftCollection, mintNftCollectionDetails } from '@core/wallet' import { PopupId, closePopup, openPopup } from '@desktop/auxiliary/popup' import { MediaIcon, PopupTab, getTabItems } from '@ui' import { onMount } from 'svelte' import PopupTemplate from '../PopupTemplate.svelte' + import { getL1Network } from '@core/network' const TABS = getTabItems([PopupTab.Transaction, PopupTab.Nft, PopupTab.NftMetadata]) + const network = getL1Network() let selectedTab = TABS[0] @@ -103,7 +105,7 @@ items={[ { key: localize('general.storageDeposit'), - value: formatTokenAmountPrecise(storageDeposit, getBaseToken()), + value: formatTokenAmount(BigInt(storageDeposit), network.baseToken), }, { key: localize('general.immutableIssuer'), diff --git a/packages/desktop/components/popup/popups/MintNftConfirmationPopup.svelte b/packages/desktop/components/popup/popups/MintNftConfirmationPopup.svelte index c1385fe69e..f7e4e61da3 100644 --- a/packages/desktop/components/popup/popups/MintNftConfirmationPopup.svelte +++ b/packages/desktop/components/popup/popups/MintNftConfirmationPopup.svelte @@ -5,16 +5,19 @@ import { localize } from '@core/i18n' import { CURRENT_IRC27_VERSION, IIrc27Metadata } from '@core/nfts' import { getClient } from '@core/profile-manager' - import { checkActiveProfileAuth, getBaseToken } from '@core/profile/actions' - import { formatTokenAmountPrecise } from '@core/token' + import { checkActiveProfileAuth } from '@core/profile/actions' + import { formatTokenAmount } from '@core/token' import { buildNftOutputBuilderParams, mintNft, mintNftDetails } from '@core/wallet' import { PopupId, closePopup, openPopup } from '@desktop/auxiliary/popup' import { MediaIcon, PopupTab, getTabItems } from '@ui' import { onMount } from 'svelte' import PopupTemplate from '../PopupTemplate.svelte' + import { getL1Network } from '@core/network' const TABS = getTabItems([PopupTab.Transaction, PopupTab.Nft, PopupTab.NftMetadata]) + const network = getL1Network() + let selectedTab = TABS[0] let storageDeposit: number = 0 @@ -124,22 +127,19 @@ }, { key: localize('general.storageDepositPerNft'), - value: - quantity > 1 ? formatTokenAmountPrecise(storageDeposit, getBaseToken()) : undefined, + value: quantity > 1 ? formatTokenAmount(storageDeposit, network.baseToken) : undefined, }, { key: localize('general.totalStorageDeposit'), value: quantity > 1 - ? formatTokenAmountPrecise(totalStorageDeposit, getBaseToken()) + ? formatTokenAmount(totalStorageDeposit, network.baseToken) : undefined, }, { key: localize('general.storageDeposit'), value: - quantity === 1 - ? formatTokenAmountPrecise(storageDeposit, getBaseToken()) - : undefined, + quantity === 1 ? formatTokenAmount(storageDeposit, network.baseToken) : undefined, }, { key: localize('general.immutableIssuer'), diff --git a/packages/desktop/components/popup/popups/SyncAccountsPopup.svelte b/packages/desktop/components/popup/popups/SyncAccountsPopup.svelte index 420d642f63..919acfa92b 100644 --- a/packages/desktop/components/popup/popups/SyncAccountsPopup.svelte +++ b/packages/desktop/components/popup/popups/SyncAccountsPopup.svelte @@ -10,7 +10,7 @@ import { RecoverAccountsPayload, recoverAccounts } from '@core/profile-manager' import { checkActiveProfileAuth, getBaseToken, loadAccounts } from '@core/profile/actions' import { activeAccounts, activeProfile, getActiveProfileId, visibleActiveAccounts } from '@core/profile/stores' - import { formatTokenAmountBestMatch } from '@core/token' + import { formatTokenAmount } from '@core/token' import { loadTokensForAllAccountBalances } from '@core/token/actions' import { closePopup } from '@desktop/auxiliary/popup' import { onDestroy } from 'svelte' @@ -167,7 +167,7 @@ }, { key: localize('popups.walletFinder.totalWalletBalance'), - value: formatTokenAmountBestMatch(totalBalance, getBaseToken()), + value: formatTokenAmount(totalBalance, getBaseToken()), }, ]} /> diff --git a/packages/desktop/components/popup/popups/VoteForProposalPopup.svelte b/packages/desktop/components/popup/popups/VoteForProposalPopup.svelte index b91d9c7188..dfee78fc75 100644 --- a/packages/desktop/components/popup/popups/VoteForProposalPopup.svelte +++ b/packages/desktop/components/popup/popups/VoteForProposalPopup.svelte @@ -6,13 +6,13 @@ import { selectedAccount } from '@core/account/stores' import { localize } from '@core/i18n' import { checkActiveProfileAuth, getBaseToken } from '@core/profile/actions' - import { formatTokenAmountBestMatch } from '@core/token' + import { formatTokenAmount } from '@core/token' import { PopupId, closePopup, openPopup } from '@desktop/auxiliary/popup' import PopupTemplate from '../PopupTemplate.svelte' export let selectedAnswerValues: number[] - $: formattedVotingPower = formatTokenAmountBestMatch($selectedAccount?.votingPower, getBaseToken()) + $: formattedVotingPower = formatTokenAmount($selectedAccount?.votingPower, getBaseToken()) $: hasVotingPower = $selectedAccount?.votingPower > 0 $: hasGovernanceTransactionInProgress = diff --git a/packages/desktop/views/dashboard/collectibles/components/Irc27CollectibleDetails.svelte b/packages/desktop/views/dashboard/collectibles/components/Irc27CollectibleDetails.svelte index d03358c5cb..1dae18420f 100644 --- a/packages/desktop/views/dashboard/collectibles/components/Irc27CollectibleDetails.svelte +++ b/packages/desktop/views/dashboard/collectibles/components/Irc27CollectibleDetails.svelte @@ -1,10 +1,9 @@