Skip to content

Commit

Permalink
add default values to firefly import
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNerdi committed May 14, 2024
1 parent 050851a commit c34be4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -87,6 +89,7 @@ function buildStardustNetworkFromThirdPartyPersistedNetwork(
protocol: network.protocol,
baseToken: network.baseToken,
chainConfigurations: defaultChainConfigurations ? [defaultChainConfigurations] : [],
explorerUrl,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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,
Expand All @@ -30,5 +32,6 @@ export function buildPersistedNetworkFromNodeInfoResponse(
protocol: nodeInfoResponse?.nodeInfo?.protocol,
baseToken: { standard: TokenStandard.BaseToken, ...nodeInfoResponse?.nodeInfo?.baseToken },
chainConfigurations,
explorerUrl,
}
}

0 comments on commit c34be4b

Please sign in to comment.