From cd77257c86a171e00f52f80b60509462d37b20da Mon Sep 17 00:00:00 2001 From: Mark Nardi Date: Fri, 12 Apr 2024 16:56:18 +0200 Subject: [PATCH] chore: improve network id typechecks (#2305) * rename stardustnetworkId into SupportedStardustNetworkId * rename EvmNetworkId to SupportedEvmNetworkId * use evm and stardust network ID into correct places * move supported networks into constants * PR fixes * fix supported network id * improve network typings * fix circular dependency * chore: use const --------- Co-authored-by: Tuditi <45079109+Tuditi@users.noreply.github.com> Co-authored-by: Tuditi --- packages/desktop/components/NetworkCard.svelte | 4 ++-- .../popups/ImportErc20TokenFormPopup.svelte | 4 ++-- .../popups/ImportErc721TokenFormPopup.svelte | 4 ++-- .../components/popup/popups/SiwePopup.svelte | 4 ++-- .../popup/popups/SyncAccountsPopup.svelte | 9 +++++---- .../campaigns/views/CampaignDetailsView.svelte | 6 +++--- .../components/Erc721CollectibleDetails.svelte | 4 ++-- .../components/DashboardSidebar.svelte | 10 +++++----- .../views/components/AddIscpChainForm.svelte | 10 +++++----- .../send-flow/views/SelectTokenView.svelte | 2 +- .../StardustTransactionDetails.svelte | 2 +- .../portfolio/components/TokenListRow.svelte | 8 ++++---- .../views/FinishOnboardingView.svelte | 5 +++-- .../views/ConnectLedgerView.svelte | 7 ++++--- .../views/InstallLedgerView.svelte | 3 ++- .../components/LedgerAppOpen.svelte | 8 +++++--- .../views/ChooseNetworkView.svelte | 4 ++-- .../views/BalanceFinderView.svelte | 13 +++++++------ .../evm/info/EvmGenericInformation.svelte | 4 ++-- .../auxiliary/blockscout/api/blockscout.api.ts | 4 ++-- ...name-to-stardust-network-id-map.constant.ts | 14 +++++++------- ...tedProfileFromThirdPartyPersistedProfile.ts | 9 +++++++-- .../handlers/wallet_watchAsset.handler.ts | 4 ++-- .../wallet-connect/utils/getAllEvmAddresses.ts | 12 ------------ .../auxiliary/wallet-connect/utils/index.ts | 1 - .../utils/switchToRequiredAccount.ts | 6 +++--- ...calculateAndAddPersistedNftBalanceChange.ts | 4 ++-- ...lculateAndAddPersistedTokenBalanceChange.ts | 4 ++-- .../generateAndStoreActivitiesForAccount.ts | 4 ++-- .../actions/processAndAddToActivities.ts | 4 ++-- .../types/evm/base-evm-activity.type.ts | 2 ++ .../stardust/base-stardust-activity.type.ts | 3 ++- .../evm/generateEvmBalanceChangeActivity.ts | 4 ++-- .../evm/generateEvmNftBalanceChangeActivity.ts | 4 ++-- .../generateEvmTokenBalanceChangeActivity.ts | 4 ++-- .../generateActivitiesFromBalanceChanges.ts | 6 +++--- .../utils/helper/getSendingInformation.ts | 4 ++-- .../utils/outputs/getRecipientFromOutput.ts | 4 ++-- .../utils/outputs/getSenderFromOutput.ts | 4 ++-- .../generateActivitiesFromAliasOutputs.ts | 4 ++-- .../generateActivitiesFromBasicOutputs.ts | 4 ++-- .../generateActivitiesFromFoundryOutputs.ts | 4 ++-- .../generateActivitiesFromNftOutputs.ts | 4 ++-- ...erateActivitiesFromProcessedTransactions.ts | 4 ++-- .../generateActivitiesFromStardustNetwork.ts | 8 ++++---- .../utils/stardust/generateBaseActivity.ts | 4 ++-- .../stardust/generateSingleAliasActivity.ts | 4 ++-- .../stardust/generateSingleBasicActivity.ts | 4 ++-- .../generateSingleConsolidationActivity.ts | 4 ++-- .../stardust/generateSingleFoundryActivity.ts | 4 ++-- .../generateSingleGovernanceActivity.ts | 4 ++-- .../stardust/generateSingleNftActivity.ts | 4 ++-- .../utils/stardust/getSenderFromTransaction.ts | 4 ++-- .../isOutputSubjectFromActiveAccount.ts | 6 +++--- .../actions/canAccountMakeEvmTransaction.ts | 9 ++------- .../layer-2/actions/getGasPriceForNetwork.ts | 4 ++-- .../layer-2/actions/pollEvmChainGasPrices.ts | 14 +++++++------- .../layer-2/actions/updateEvmChainGasPrice.ts | 4 ++-- .../base-token-contract-address.constant.ts | 10 +++++----- .../layer-2/stores/layer2-balances.store.ts | 8 ++++---- .../ledger/actions/checkOrConnectLedger.ts | 2 +- .../lib/core/ledger/utils/handleLedgerError.ts | 2 +- .../getAndUpdateShimmerEvmTokensMetadata.ts | 4 ++-- .../shimmer-evm-address-to-coingecko-id-map.ts | 4 ++-- .../lib/core/network/actions/chain-polling.ts | 10 +++++----- .../core/network/actions/getActiveNetworkId.ts | 4 ++-- .../src/lib/core/network/actions/index.ts | 2 +- ...Statuses.ts => updateEvmNetworkStatuses.ts} | 13 ++++++++----- .../core/network/classes/iscp-chain.class.ts | 18 ++++++++++++------ .../network/classes/stardust-network.class.ts | 8 +++----- .../constants/default-base-token.constant.ts | 2 +- .../constants/default-bech32-hrp.constant.ts | 6 +++--- .../constants/default-coin-type.constant.ts | 2 +- ...ault-evm-network-configurations.constant.ts | 9 +++++---- .../default-explorer-urls.constant.ts | 4 ++-- .../default-network-metadata.constant.ts | 11 +++++++---- .../constants/default-node-urls.constant.ts | 6 +++--- .../constants/default-protocol.constant.ts | 7 ++++--- .../constants/explorer-endpoints.constant.ts | 5 +++-- .../network/constants/faucet-urls.constant.ts | 6 +++--- .../src/lib/core/network/constants/index.ts | 1 + .../constants/supported-network-id.constant.ts | 17 +++++++++++++++++ .../shared/src/lib/core/network/enums/index.ts | 1 - .../network/enums/supported-network-id.enum.ts | 17 ----------------- ... => evm-network-configuration.interface.ts} | 4 ++-- ...face.ts => evm-network-status.interface.ts} | 2 +- .../interfaces/evm-network.interface.ts | 7 ++++--- .../src/lib/core/network/interfaces/index.ts | 4 ++-- .../stardust-network-metadata.interface.ts | 4 ++-- .../network/stores/chain-statuses.store.ts | 6 ------ .../stores/evm-network-statuses.store.ts | 6 ++++++ .../src/lib/core/network/stores/index.ts | 2 +- .../src/lib/core/network/tests/network.test.ts | 16 ++++++---------- .../lib/core/network/types/network-id.type.ts | 7 ++++--- ...uildPersistedNetworkFromNodeInfoResponse.ts | 4 ++-- .../utils/canAccountMakeStardustTransaction.ts | 7 ------- .../network/utils/getDefaultClientOptions.ts | 4 ++-- .../lib/core/network/utils/getDefaultNodes.ts | 6 +++--- .../utils/getDefaultPersistedNetwork.ts | 4 ++-- .../network/utils/getExplorerApiNetworkName.ts | 8 ++++---- .../getNetworkIdFromOnboardingNetworkType.ts | 16 +++++++++------- .../getOnboardingNetworkTypeFromNetworkId.ts | 8 ++++---- .../src/lib/core/network/utils/isEvmNetwork.ts | 4 ++-- .../core/network/utils/isStardustNetwork.ts | 4 ++-- .../core/network/utils/isSupportedNetworkId.ts | 2 +- .../lib/core/nfts/actions/persistErc721Nft.ts | 4 ++-- .../actions/persistNftWithContractMetadata.ts | 4 ++-- .../lib/core/nfts/interfaces/nft.interface.ts | 3 ++- .../nfts/interfaces/persisted-nft.interface.ts | 5 +++-- .../core/nfts/utils/buildPersistedErc721Nft.ts | 4 ++-- .../handleTransactionProgressEvent.ts | 2 +- .../profile/actions/active-profile/login.ts | 4 ++-- .../profile/actions/active-profile/logout.ts | 4 ++-- .../actions/removeEvmBalanceChanges.ts | 6 +++--- .../actions/getAccountTokensForAccount.ts | 6 +++--- .../fetchAndPersistTransactionsForAccounts.ts | 10 +++++----- .../wallet/tests/getOutputParameters.test.ts | 3 +-- 117 files changed, 336 insertions(+), 332 deletions(-) delete mode 100644 packages/shared/src/lib/auxiliary/wallet-connect/utils/getAllEvmAddresses.ts rename packages/shared/src/lib/core/network/actions/{updateChainStatuses.ts => updateEvmNetworkStatuses.ts} (61%) create mode 100644 packages/shared/src/lib/core/network/constants/supported-network-id.constant.ts delete mode 100644 packages/shared/src/lib/core/network/enums/supported-network-id.enum.ts rename packages/shared/src/lib/core/network/interfaces/{chain-configuration.interface.ts => evm-network-configuration.interface.ts} (91%) rename packages/shared/src/lib/core/network/interfaces/{chain-status.interface.ts => evm-network-status.interface.ts} (65%) delete mode 100644 packages/shared/src/lib/core/network/stores/chain-statuses.store.ts create mode 100644 packages/shared/src/lib/core/network/stores/evm-network-statuses.store.ts diff --git a/packages/desktop/components/NetworkCard.svelte b/packages/desktop/components/NetworkCard.svelte index fbe7ee25a8..eebbc1fa2f 100644 --- a/packages/desktop/components/NetworkCard.svelte +++ b/packages/desktop/components/NetworkCard.svelte @@ -12,7 +12,7 @@ Network, NetworkHealth, NetworkNamespace, - chainStatuses, + evmNetworkStatuses, getDefaultExplorerUrl, networkStatus, setSelectedChain, @@ -31,7 +31,7 @@ let status: NetworkHealth const explorer = getDefaultExplorerUrl(network.id, ExplorerEndpoint.Address) - $: $networkStatus, $chainStatuses, $selectedAccount, setNetworkCardData() + $: $networkStatus, $evmNetworkStatuses, $selectedAccount, setNetworkCardData() function onExplorerClick(): void { if (!explorer || !address) { diff --git a/packages/desktop/components/popup/popups/ImportErc20TokenFormPopup.svelte b/packages/desktop/components/popup/popups/ImportErc20TokenFormPopup.svelte index e8f09a9ac9..f9f2d3bec2 100644 --- a/packages/desktop/components/popup/popups/ImportErc20TokenFormPopup.svelte +++ b/packages/desktop/components/popup/popups/ImportErc20TokenFormPopup.svelte @@ -3,7 +3,7 @@ import { NetworkInput } from '@ui' import { localize } from '@core/i18n' import { getEvmTokenMetadata } from '@core/layer-2/utils' - import { NetworkId } from '@core/network' + import { EvmNetworkId } from '@core/network' import { validateEthereumAddress } from '@core/utils' import PopupTemplate from '../PopupTemplate.svelte' import { closePopup } from '@desktop/auxiliary/popup' @@ -13,7 +13,7 @@ let busy = false - let networkId: NetworkId + let networkId: EvmNetworkId let tokenAddress: string let tokenAddressError = '' diff --git a/packages/desktop/components/popup/popups/ImportErc721TokenFormPopup.svelte b/packages/desktop/components/popup/popups/ImportErc721TokenFormPopup.svelte index 92b837c6d3..779421b851 100644 --- a/packages/desktop/components/popup/popups/ImportErc721TokenFormPopup.svelte +++ b/packages/desktop/components/popup/popups/ImportErc721TokenFormPopup.svelte @@ -2,7 +2,7 @@ import { TextInput } from '@bloomwalletio/ui' import { NetworkInput } from '@ui' import { localize } from '@core/i18n' - import { NetworkId } from '@core/network' + import { EvmNetworkId } from '@core/network' import { validateEthereumAddress } from '@core/utils' import PopupTemplate from '../PopupTemplate.svelte' import { closePopup } from '@desktop/auxiliary/popup' @@ -21,7 +21,7 @@ let busy = false - let networkId: NetworkId + let networkId: EvmNetworkId let tokenAddress: string diff --git a/packages/desktop/components/popup/popups/SiwePopup.svelte b/packages/desktop/components/popup/popups/SiwePopup.svelte index 6fb738c0cd..d05de7b753 100644 --- a/packages/desktop/components/popup/popups/SiwePopup.svelte +++ b/packages/desktop/components/popup/popups/SiwePopup.svelte @@ -7,7 +7,7 @@ import { signMessage } from '@core/wallet/actions' import { Table, Tabs, Text } from '@bloomwalletio/ui' import { IAccountState } from '@core/account' - import { IEvmNetwork, NetworkId, getNameFromNetworkId } from '@core/network' + import { IEvmNetwork, EvmNetworkId, getNameFromNetworkId } from '@core/network' import { AccountLabel, DappInfo, KeyValue, NetworkLabel } from '@ui' import { checkActiveProfileAuth } from '@core/profile/actions' import { LedgerAppName } from '@core/ledger' @@ -39,7 +39,7 @@ let selectedTab = TABS[0] let isBusy = false - const networkId = `eip155:${siweObject.chainId}` as NetworkId + const networkId: EvmNetworkId = `eip155:${siweObject.chainId}` async function onConfirmClick(): Promise { try { diff --git a/packages/desktop/components/popup/popups/SyncAccountsPopup.svelte b/packages/desktop/components/popup/popups/SyncAccountsPopup.svelte index 44d12d3fae..d4f579c75e 100644 --- a/packages/desktop/components/popup/popups/SyncAccountsPopup.svelte +++ b/packages/desktop/components/popup/popups/SyncAccountsPopup.svelte @@ -15,8 +15,9 @@ import { closePopup } from '@desktop/auxiliary/popup' import { onDestroy } from 'svelte' import PopupTemplate from '../PopupTemplate.svelte' - import { StardustNetworkId } from '@core/network/enums' + import { SupportedStardustNetworkId } from '@core/network/constants' import { ledgerRaceConditionProtectionWrapper } from '@core/ledger' + import { StardustNetworkId } from '@core/network/types' const { network, type } = $activeProfile @@ -38,9 +39,9 @@ $: totalBalance = sumBalanceForAccounts($visibleActiveAccounts) const networkSearchMethod: { [key in StardustNetworkId]?: () => Promise } = { - [StardustNetworkId.Iota]: multiAddressSearch, - [StardustNetworkId.Shimmer]: singleAddressSearch, - [StardustNetworkId.Testnet]: singleAddressSearch, + [SupportedStardustNetworkId.Iota]: multiAddressSearch, + [SupportedStardustNetworkId.Shimmer]: singleAddressSearch, + [SupportedStardustNetworkId.Testnet]: singleAddressSearch, } async function singleAddressSearch(): Promise { diff --git a/packages/desktop/views/dashboard/campaigns/views/CampaignDetailsView.svelte b/packages/desktop/views/dashboard/campaigns/views/CampaignDetailsView.svelte index 89560ff941..aa560d3f4c 100644 --- a/packages/desktop/views/dashboard/campaigns/views/CampaignDetailsView.svelte +++ b/packages/desktop/views/dashboard/campaigns/views/CampaignDetailsView.svelte @@ -9,7 +9,7 @@ import { IAccountState, getAddressFromAccountForNetwork } from '@core/account' import { selectedAccount } from '@core/account/stores' import { handleError } from '@core/error/handlers' - import { NetworkId, NetworkNamespace, getEvmNetwork } from '@core/network' + import { EvmNetworkId, NetworkNamespace, getEvmNetwork } from '@core/network' import { buildNftFromPersistedErc721Nft } from '@core/nfts' import { addNftsToDownloadQueue, updateAllAccountNftsForAccount } from '@core/nfts/actions' import { persistErc721Nft } from '@core/nfts/actions/persistErc721Nft' @@ -26,14 +26,14 @@ let userAddress: string let numberOfTasks: number | undefined - $: evmNetwork = getEvmNetwork(`${NetworkNamespace.Evm}:${$selectedCampaign.chainId}` as NetworkId) + $: evmNetwork = getEvmNetwork(`${NetworkNamespace.Evm}:${$selectedCampaign.chainId}` as EvmNetworkId) $: ({ board: leaderboard, userPosition } = $campaignLeaderboards[$selectedCampaign.projectId]?.[ $selectedCampaign.id ] ?? { board: undefined, userPosition: undefined }) $: fetchAndPersistTideData($selectedAccount, evmNetwork?.id) $: userNft = $ownedNfts.find((nft) => nft.id?.startsWith($selectedCampaign.address.toLowerCase())) - function fetchAndPersistTideData(account: IAccountState, networkId: NetworkId): void { + function fetchAndPersistTideData(account: IAccountState, networkId: EvmNetworkId): void { if (networkId) { userAddress = getAddressFromAccountForNetwork(account, networkId)?.toLowerCase() void fetchAndPersistUserPosition(userAddress) diff --git a/packages/desktop/views/dashboard/collectibles/components/Erc721CollectibleDetails.svelte b/packages/desktop/views/dashboard/collectibles/components/Erc721CollectibleDetails.svelte index 5ba7e2cd9b..9f7ed0b7f2 100644 --- a/packages/desktop/views/dashboard/collectibles/components/Erc721CollectibleDetails.svelte +++ b/packages/desktop/views/dashboard/collectibles/components/Erc721CollectibleDetails.svelte @@ -3,7 +3,7 @@ import { type IItem } from '@bloomwalletio/ui' import { localize } from '@core/i18n' import { IErc721Nft } from '@core/nfts' - import { ExplorerEndpoint, NetworkId, getDefaultExplorerUrl } from '@core/network' + import { ExplorerEndpoint, EvmNetworkId, getDefaultExplorerUrl } from '@core/network' import CollectibleDetails from './CollectibleDetails.svelte' import { buildUrl } from '@core/utils' @@ -13,7 +13,7 @@ const address = contractMetadata.address const explorerEndpoint = getExplorerEndpoint(networkId) - function getExplorerEndpoint(networkId: NetworkId): string | undefined { + function getExplorerEndpoint(networkId: EvmNetworkId): string | undefined { const { baseUrl, endpoint } = getDefaultExplorerUrl(networkId, ExplorerEndpoint.Token) const url = buildUrl({ origin: baseUrl, diff --git a/packages/desktop/views/dashboard/components/DashboardSidebar.svelte b/packages/desktop/views/dashboard/components/DashboardSidebar.svelte index 64aef537f1..cd82284b27 100644 --- a/packages/desktop/views/dashboard/components/DashboardSidebar.svelte +++ b/packages/desktop/views/dashboard/components/DashboardSidebar.svelte @@ -4,7 +4,7 @@ import { ProfileActionsMenu, SidebarTab } from '@components' import { APP_STAGE, AppStage } from '@core/app' import { localize } from '@core/i18n' - import { StardustNetworkId } from '@core/network' + import { SupportedStardustNetworkId } from '@core/network' import { activeProfile, isSoftwareProfile } from '@core/profile/stores' import { DashboardRoute, @@ -60,8 +60,8 @@ : []), ...(features?.campaigns?.enabled && profileFeatures?.campaigns && - ($activeProfile?.network?.id === StardustNetworkId.Shimmer || - $activeProfile?.network?.id === StardustNetworkId.Testnet) + ($activeProfile?.network?.id === SupportedStardustNetworkId.Shimmer || + $activeProfile?.network?.id === SupportedStardustNetworkId.Testnet) ? [ { icon: IconName.Trophy, @@ -78,9 +78,9 @@ label: localize('tabs.buySell'), route: DashboardRoute.BuySell, onClick: openBuySell, - disabled: $activeProfile?.network?.id !== StardustNetworkId.Iota, + disabled: $activeProfile?.network?.id !== SupportedStardustNetworkId.Iota, tooltip: - $activeProfile?.network?.id !== StardustNetworkId.Iota + $activeProfile?.network?.id !== SupportedStardustNetworkId.Iota ? localize('tabs.tooltips.buySell') : '', }, diff --git a/packages/desktop/views/dashboard/drawers/network-config/views/components/AddIscpChainForm.svelte b/packages/desktop/views/dashboard/drawers/network-config/views/components/AddIscpChainForm.svelte index ec728f7ce5..a31c8c81d1 100644 --- a/packages/desktop/views/dashboard/drawers/network-config/views/components/AddIscpChainForm.svelte +++ b/packages/desktop/views/dashboard/drawers/network-config/views/components/AddIscpChainForm.svelte @@ -4,11 +4,11 @@ import { MAX_NETWORK_NAME_LENGTH, EvmNetworkType, - IIscpChainConfiguration, + IIscpEvmNetworkConfiguration, ETHEREUM_COIN_TYPE, - NetworkId, EvmNetworkId, NetworkNamespace, + ChainId, } from '@core/network' import { activeProfile } from '@core/profile/stores' import { getNetworkHrp } from '@core/profile/actions' @@ -25,11 +25,11 @@ let explorerUrlError = '' $: submitDisabled = !evmNetwork.name || !evmNetwork.aliasAddress || !evmNetwork.rpcEndpoint - const evmNetwork: IIscpChainConfiguration = { + const evmNetwork: IIscpEvmNetworkConfiguration = { type: EvmNetworkType.Iscp, - id: '' as NetworkId, + id: '' as EvmNetworkId, namespace: NetworkNamespace.Evm, - chainId: '' as EvmNetworkId, + chainId: '' as ChainId, name: '', aliasAddress: '', rpcEndpoint: '', diff --git a/packages/desktop/views/dashboard/send-flow/views/SelectTokenView.svelte b/packages/desktop/views/dashboard/send-flow/views/SelectTokenView.svelte index 4d1498cee2..a6828e77cd 100644 --- a/packages/desktop/views/dashboard/send-flow/views/SelectTokenView.svelte +++ b/packages/desktop/views/dashboard/send-flow/views/SelectTokenView.svelte @@ -41,7 +41,7 @@ } else if ( selectedToken && isStardustNetwork(selectedToken.networkId) && - !canAccountMakeStardustTransaction($selectedAccountIndex, selectedToken.networkId, $sendFlowParameters?.type) + !canAccountMakeStardustTransaction($selectedAccountIndex, $sendFlowParameters?.type) ) { tokenError = localize('error.send.insufficientFundsTransaction') } else { diff --git a/packages/desktop/views/dashboard/send-flow/views/components/StardustTransactionDetails.svelte b/packages/desktop/views/dashboard/send-flow/views/components/StardustTransactionDetails.svelte index 0cdd1b696e..bfeae38592 100644 --- a/packages/desktop/views/dashboard/send-flow/views/components/StardustTransactionDetails.svelte +++ b/packages/desktop/views/dashboard/send-flow/views/components/StardustTransactionDetails.svelte @@ -9,7 +9,7 @@ import { DateTimePickerMenu } from '.' import StorageDepositButton from './StorageDepositButton.svelte' - export let destinationNetworkId: NetworkId = undefined + export let destinationNetworkId: NetworkId | undefined = undefined export let storageDeposit: bigint | undefined = undefined export let transactionFee: bigint | undefined = undefined export let giftStorageDeposit: boolean | undefined = undefined diff --git a/packages/desktop/views/dashboard/wallet/tab-section/portfolio/components/TokenListRow.svelte b/packages/desktop/views/dashboard/wallet/tab-section/portfolio/components/TokenListRow.svelte index 891ebe2f55..9198419fdb 100644 --- a/packages/desktop/views/dashboard/wallet/tab-section/portfolio/components/TokenListRow.svelte +++ b/packages/desktop/views/dashboard/wallet/tab-section/portfolio/components/TokenListRow.svelte @@ -1,7 +1,7 @@ diff --git a/packages/desktop/views/onboarding/views/network-setup/views/ChooseNetworkView.svelte b/packages/desktop/views/onboarding/views/network-setup/views/ChooseNetworkView.svelte index 475f764a3f..acaa72b9ec 100644 --- a/packages/desktop/views/onboarding/views/network-setup/views/ChooseNetworkView.svelte +++ b/packages/desktop/views/onboarding/views/network-setup/views/ChooseNetworkView.svelte @@ -8,8 +8,8 @@ } from '@contexts/onboarding' import { localize } from '@core/i18n' import { - NetworkId, NetworkNamespace, + StardustNetworkId, StardustNetworkName, getDefaultClientOptions, getDefaultPersistedNetwork, @@ -39,7 +39,7 @@ function onContinueClick(): void { if (selectedNetworkType !== OnboardingNetworkType.Custom) { const networkName = getNetworkNameFromOnboardingNetworkType(selectedNetworkType) - const networkId: NetworkId = `${NetworkNamespace.Stardust}:${networkName}` + const networkId: StardustNetworkId = `${NetworkNamespace.Stardust}:${networkName}` const network = getDefaultPersistedNetwork(networkId) const clientOptions = getDefaultClientOptions(networkId) updateOnboardingProfile({ network, clientOptions }) diff --git a/packages/desktop/views/onboarding/views/restore-profile/views/BalanceFinderView.svelte b/packages/desktop/views/onboarding/views/restore-profile/views/BalanceFinderView.svelte index cb95a5b913..a8bb9cef0b 100644 --- a/packages/desktop/views/onboarding/views/restore-profile/views/BalanceFinderView.svelte +++ b/packages/desktop/views/onboarding/views/restore-profile/views/BalanceFinderView.svelte @@ -5,7 +5,8 @@ import { DEFAULT_SYNC_OPTIONS } from '@core/account/constants' import { localize } from '@core/i18n' import { LedgerAppName, checkOrConnectLedger, ledgerRaceConditionProtectionWrapper } from '@core/ledger' - import { StardustNetworkId } from '@core/network' + import { SupportedStardustNetworkId } from '@core/network/constants' + import { NetworkId } from '@core/network/types' import { ProfileType } from '@core/profile' import { RecoverAccountsPayload, createAccount, recoverAccounts } from '@core/profile-manager' import { DEFAULT_ACCOUNT_RECOVERY_CONFIGURATION } from '@core/profile/constants' @@ -34,10 +35,10 @@ let accountsBalances: IAccountBalance[] = [] - const networkSearchMethod: { [key in StardustNetworkId]?: () => Promise } = { - [StardustNetworkId.Iota]: multiAddressSearch, - [StardustNetworkId.Shimmer]: singleAddressSearch, - [StardustNetworkId.Testnet]: singleAddressSearch, + const networkSearchMethod: { [key in NetworkId]?: () => Promise } = { + [SupportedStardustNetworkId.Iota]: multiAddressSearch, + [SupportedStardustNetworkId.Shimmer]: singleAddressSearch, + [SupportedStardustNetworkId.Testnet]: singleAddressSearch, } async function singleAddressSearch(): Promise { @@ -133,7 +134,7 @@ async function onFindBalancesClick(): Promise { if (type === ProfileType.Ledger) { await checkOrConnectLedger( - network?.id === StardustNetworkId.Iota ? LedgerAppName.Iota : LedgerAppName.Shimmer + network?.id === SupportedStardustNetworkId.Iota ? LedgerAppName.Iota : LedgerAppName.Shimmer ) } await findBalances() diff --git a/packages/shared/src/components/activities/evm/info/EvmGenericInformation.svelte b/packages/shared/src/components/activities/evm/info/EvmGenericInformation.svelte index c519d81249..ba2234fb44 100644 --- a/packages/shared/src/components/activities/evm/info/EvmGenericInformation.svelte +++ b/packages/shared/src/components/activities/evm/info/EvmGenericInformation.svelte @@ -1,13 +1,13 @@