From c34be4b2b3a09176852ef4260969d55479b19e79 Mon Sep 17 00:00:00 2001 From: Mark Nardi Date: Tue, 14 May 2024 10:51:23 +0200 Subject: [PATCH] add default values to firefly import --- .../buildPersistedProfileFromThirdPartyPersistedProfile.ts | 3 +++ .../utils/buildPersistedNetworkFromNodeInfoResponse.ts | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/shared/src/lib/auxiliary/third-party/utils/buildPersistedProfileFromThirdPartyPersistedProfile.ts b/packages/shared/src/lib/auxiliary/third-party/utils/buildPersistedProfileFromThirdPartyPersistedProfile.ts index 6be5908b6b..ace1a247bf 100644 --- a/packages/shared/src/lib/auxiliary/third-party/utils/buildPersistedProfileFromThirdPartyPersistedProfile.ts +++ b/packages/shared/src/lib/auxiliary/third-party/utils/buildPersistedProfileFromThirdPartyPersistedProfile.ts @@ -2,6 +2,7 @@ import { IPersistedAccountData } from '@core/account' import { APP_STAGE } from '@core/app' import { MarketCurrency } from '@core/market' import { + DEFAULT_EXPLORER_URLS, DEFAULT_ISC_CHAINS_CONFIGURATIONS, IStardustNetworkMetadata, NetworkNamespace, @@ -78,6 +79,7 @@ function buildStardustNetworkFromThirdPartyPersistedNetwork( NETWORK_NAME_TO_STARDUST_NETWORK_ID_MAP[network.protocol.networkName] ?? `${NetworkNamespace.Stardust}:${network.protocol.networkName}` const defaultChainConfigurations = structuredClone(DEFAULT_ISC_CHAINS_CONFIGURATIONS?.[networkId]) + const explorerUrl = DEFAULT_EXPLORER_URLS[networkId] return { id: networkId, @@ -87,6 +89,7 @@ function buildStardustNetworkFromThirdPartyPersistedNetwork( protocol: network.protocol, baseToken: network.baseToken, chainConfigurations: defaultChainConfigurations ? [defaultChainConfigurations] : [], + explorerUrl, } } diff --git a/packages/shared/src/lib/core/network/utils/buildPersistedNetworkFromNodeInfoResponse.ts b/packages/shared/src/lib/core/network/utils/buildPersistedNetworkFromNodeInfoResponse.ts index 3df66fe98b..2c18279ce5 100644 --- a/packages/shared/src/lib/core/network/utils/buildPersistedNetworkFromNodeInfoResponse.ts +++ b/packages/shared/src/lib/core/network/utils/buildPersistedNetworkFromNodeInfoResponse.ts @@ -4,6 +4,7 @@ import { DEFAULT_COIN_TYPE, DEFAULT_NETWORK_METADATA, TEST_COIN_TYPE, + DEFAULT_EXPLORER_URLS, } from '../constants' import { TokenStandard } from '@core/token/enums' import { INodeInfoResponse, IStardustNetworkMetadata } from '../interfaces' @@ -21,7 +22,8 @@ export function buildPersistedNetworkFromNodeInfoResponse( const _coinType = coinType ?? DEFAULT_COIN_TYPE[id] ?? TEST_COIN_TYPE const configuration = DEFAULT_ISC_CHAINS_CONFIGURATIONS?.[id] - const chainConfigurations = configuration ? [configuration] : [] + const chainConfigurations = configuration ? [structuredClone(configuration)] : [] + const explorerUrl = DEFAULT_EXPLORER_URLS[id] return { id, name, @@ -30,5 +32,6 @@ export function buildPersistedNetworkFromNodeInfoResponse( protocol: nodeInfoResponse?.nodeInfo?.protocol, baseToken: { standard: TokenStandard.BaseToken, ...nodeInfoResponse?.nodeInfo?.baseToken }, chainConfigurations, + explorerUrl, } }