Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
begonaalvarezd committed Apr 18, 2024
2 parents 8a1b6ba + c3089e7 commit 5a59f48
Show file tree
Hide file tree
Showing 32 changed files with 238 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
onClick={onViewAddressHistoryClick}
/>
{/if}
{#if $activeProfile?.network?.id === NetworkId.Shimmer || $activeProfile?.network?.id === NetworkId.Testnet}
{#if $activeProfile?.network?.id === NetworkId.Shimmer || $activeProfile?.network?.id === NetworkId.ShimmerTestnet || $activeProfile?.network?.id === NetworkId.IotaTestnet}
<MenuItem icon={Icon.Transfer} title={localize('actions.withdrawFromL2')} onClick={onWithdrawFromL2Click} />
{/if}
<MenuItem icon={Icon.Customize} title={localize('actions.customizeAcount')} onClick={onCustomiseAccountClick} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
$: searchInCurrentWallet, (shouldInitSearch = true)
$: searchAlgorithm = searchInCurrentWallet
? SearchAlgorithmType.DFS
: network.id === NetworkId.Iota || NetworkId.IotaAlphanet
: network.id === NetworkId.Iota || network.id === NetworkId.IotaAlphanet || network.id === NetworkId.IotaTestnet
? SearchAlgorithmType.IDS
: SearchAlgorithmType.BFS
Expand Down
44 changes: 42 additions & 2 deletions packages/desktop/features/onboarding.features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,45 @@ const onboardingFeaturesForIota: IOnboardingFeaturesForNetwork = {
},
}

const onboardingFeaturesForIotaTestnet: IOnboardingFeaturesForNetwork = {
enabled: false,
hidden: true,
newProfile: {
enabled: true,
softwareProfile: {
enabled: true,
},
ledgerProfile: {
enabled: true,
},
},
restoreProfile: {
enabled: true,
recoveryPhrase: {
enabled: true,
},
strongholdBackup: {
enabled: true,
},
ledgerBackup: {
enabled: true,
},
},
claimRewards: {
enabled: false,
hidden: true,
recoveryPhrase: {
enabled: false,
},
strongholdBackup: {
enabled: false,
},
ledgerBackup: {
enabled: false,
},
},
}

const IS_ALPHANET_ENABLED = process.env.STAGE !== 'prod'
const onboardingFeaturesForIotaAlphanet: IOnboardingFeaturesForNetwork = {
enabled: IS_ALPHANET_ENABLED,
Expand Down Expand Up @@ -122,7 +161,7 @@ const onboardingFeaturesForShimmer: IOnboardingFeaturesForNetwork = {
},
}

const onboardingFeaturesForTestnet: IOnboardingFeaturesForNetwork = {
const onboardingFeaturesForShimmerTestnet: IOnboardingFeaturesForNetwork = {
enabled: false,
hidden: true,
newProfile: {
Expand Down Expand Up @@ -205,9 +244,10 @@ const onboardingFeatures: OnboardingFeatures = {
enabled: true,
},
iota: onboardingFeaturesForIota,
iotaTestnet: onboardingFeaturesForIotaTestnet,
iotaAlphanet: onboardingFeaturesForIotaAlphanet,
shimmer: onboardingFeaturesForShimmer,
testnet: onboardingFeaturesForTestnet,
shimmerTestnet: onboardingFeaturesForShimmerTestnet,
custom: onboardingFeaturesForCustom,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
const NETWORK_ICON: Record<NetworkId, Icon> = {
[NetworkId.Iota]: Icon.Iota,
[NetworkId.Testnet]: Icon.Settings,
[NetworkId.Shimmer]: Icon.Shimmer,
[NetworkId.IotaTestnet]: Icon.Settings,
[NetworkId.IotaAlphanet]: Icon.Settings,
[NetworkId.ShimmerTestnet]: Icon.Settings,
[NetworkId.Shimmer]: Icon.Shimmer,
[NetworkId.Custom]: Icon.Settings,
}
Expand All @@ -30,7 +31,8 @@
return 'iota-highlight'
case NetworkId.Shimmer:
return 'shimmer-highlight'
case NetworkId.Testnet:
case NetworkId.ShimmerTestnet:
case NetworkId.IotaTestnet:
case NetworkId.Custom:
case NetworkId.IotaAlphanet:
return 'blue-500'
Expand Down
66 changes: 46 additions & 20 deletions packages/shared/components/AssetIcon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import { AnimationRenderer } from '@auxiliary/animation'
import { Icon as IconEnum, NETWORK_ICON_SVG } from '@auxiliary/icon'
import { getIconColorFromString } from '@core/account'
import { COIN_TYPE, NetworkId } from '@core/network'
import { COIN_TYPE, DEFAULT_BASE_TOKEN, NetworkId } from '@core/network'
import { isBright } from '@core/utils'
import { ANIMATED_TOKEN_IDS, getAssetInitials, IPersistedAsset, TokenStandard } from '@core/wallet'
import { ANIMATED_TOKEN_IDS, IPersistedAsset, TokenStandard, getAssetInitials } from '@core/wallet'
import { Animation, AssetIconSize, Icon, VerificationBadge } from 'shared/components'
export let asset: IPersistedAsset
Expand All @@ -22,25 +22,51 @@
$: assetIconColor = isBright(assetIconBackgroundColor) ? 'text-gray-800' : 'text-white'
function updateAssetIcon(): void {
switch (asset.id) {
case String(COIN_TYPE[NetworkId.Iota]):
case String(COIN_TYPE[NetworkId.IotaAlphanet]):
assetIconBackgroundColor = '#6E82A4'
icon = NETWORK_ICON_SVG[NetworkId.Iota]
break
case String(COIN_TYPE[NetworkId.Shimmer]):
case String(COIN_TYPE[NetworkId.Testnet]):
const assetName = asset?.metadata?.name?.toLowerCase() ?? ''
const assetId = asset?.id
if (
[
String(COIN_TYPE[NetworkId.Iota]),
String(COIN_TYPE[NetworkId.IotaTestnet]),
String(COIN_TYPE[NetworkId.IotaAlphanet]),
String(COIN_TYPE[NetworkId.Shimmer]),
String(COIN_TYPE[NetworkId.ShimmerTestnet]),
].includes(assetId)
) {
// if not a production network, use gray icon
if (
[
String(COIN_TYPE[NetworkId.IotaTestnet]),
String(COIN_TYPE[NetworkId.IotaAlphanet]),
String(COIN_TYPE[NetworkId.ShimmerTestnet]),
].includes(assetId)
) {
assetIconBackgroundColor = '#C4D1E8'
} else if (String(DEFAULT_BASE_TOKEN[NetworkId.Iota]?.name?.toLowerCase()) === assetName) {
assetIconBackgroundColor = '#000000'
} else if (String(DEFAULT_BASE_TOKEN[NetworkId.Shimmer]?.name?.toLowerCase()) === assetName) {
assetIconBackgroundColor = '#25DFCA'
}
if (
[
String(DEFAULT_BASE_TOKEN[NetworkId.Iota]?.name?.toLowerCase()),
String(DEFAULT_BASE_TOKEN[NetworkId.IotaTestnet]?.name?.toLowerCase()),
String(DEFAULT_BASE_TOKEN[NetworkId.IotaAlphanet]?.name?.toLowerCase()),
].includes(assetName)
) {
icon = NETWORK_ICON_SVG[NetworkId.Iota]
} else {
icon = NETWORK_ICON_SVG[NetworkId.Shimmer]
break
default:
assetInitials = getAssetInitials(asset)
assetIconBackgroundColor = getIconColorFromString(asset.metadata?.name, {
shades: ['500', '600', '700', '800'],
colorsToExclude: ['gray'],
})
assetLogoUrl = asset.metadata?.standard === TokenStandard.Irc30 ? asset.metadata?.logoUrl ?? '' : ''
icon = null
}
} else {
assetInitials = getAssetInitials(asset)
assetIconBackgroundColor = getIconColorFromString(asset.metadata?.name, {
shades: ['500', '600', '700', '800'],
colorsToExclude: ['gray'],
})
assetLogoUrl = asset.metadata?.standard === TokenStandard.Irc30 ? asset.metadata?.logoUrl ?? '' : ''
icon = null
}
}
Expand Down Expand Up @@ -70,7 +96,7 @@
renderer={AnimationRenderer.Canvas}
/>
{:else if icon}
<Icon {icon} width="80%" height="80%" classes="{assetIconColor} text-center" />
<Icon {icon} width="90%" height="90%" classes="{assetIconColor} text-center" />
{:else if assetLogoUrl}
<img src={assetLogoUrl} on:error={handleOnError} alt={assetLogoUrl} class="w-full h-full" />
{:else}
Expand Down
12 changes: 8 additions & 4 deletions packages/shared/components/NetworkIcon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@
backgroundColor: 'bg-black',
iconColor: 'text-white',
},
[NetworkId.Shimmer]: {
backgroundColor: 'bg-shimmer-highlight',
[NetworkId.IotaTestnet]: {
backgroundColor: 'bg-gray-400',
iconColor: 'text-black',
},
[NetworkId.Testnet]: {
[NetworkId.IotaAlphanet]: {
backgroundColor: 'bg-gray-400',
iconColor: 'text-black',
},
[NetworkId.IotaAlphanet]: {
[NetworkId.Shimmer]: {
backgroundColor: 'bg-shimmer-highlight',
iconColor: 'text-black',
},
[NetworkId.ShimmerTestnet]: {
backgroundColor: 'bg-gray-400',
iconColor: 'text-black',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { Icon } from '../enums'

export const NETWORK_ICON_SVG: { [key in string]: Icon } = {
[NetworkId.Iota]: Icon.Iota,
[NetworkId.IotaTestnet]: Icon.Iota,
[NetworkId.IotaAlphanet]: Icon.Iota,
[NetworkId.Shimmer]: Icon.Shimmer,
[NetworkId.Testnet]: Icon.Shimmer,
[NetworkId.ShimmerTestnet]: Icon.Shimmer,
[ChainId.ShimmerEVM]: Icon.ShimmerEvm,
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum DestinationNetwork {
IotaEvmTestnet = 'IOTA EVM Testnet',
Shimmer = 'Shimmer',
ShimmerEvm = 'ShimmerEVM',
ShimmerEvmTestnet = 'ShimmerEVM Testnet',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export const ledgerAppName: Readable<LedgerAppName> = derived(
[profileNetwork, onboardingProfileNetwork],
([$profileNetwork, $onboardingProfileNetwork]) => {
const networkId = $profileNetwork?.id || $onboardingProfileNetwork?.id || NetworkId.Iota
return networkId === NetworkId.Iota || networkId === NetworkId.IotaAlphanet
return networkId === NetworkId.Iota ||
networkId === NetworkId.IotaAlphanet ||
networkId === NetworkId.IotaTestnet
? LedgerAppName.Iota
: LedgerAppName.Shimmer
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { MarketCoinId } from '../enums'
export function getMarketCoinIdByNetworkId(networkId: NetworkId): MarketCoinId | undefined {
switch (networkId) {
case NetworkId.Iota:
case NetworkId.IotaTestnet:
case NetworkId.IotaAlphanet:
return MarketCoinId.Iota
case NetworkId.Shimmer:
case NetworkId.Testnet:
case NetworkId.ShimmerTestnet:
return MarketCoinId.Shimmer
default:
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { NetworkId } from '../enums'

export const CHRONICLE_URLS: Readonly<{ [key in NetworkId]?: string[] }> = {
[NetworkId.Iota]: ['https://chronicle.stardust-mainnet.iotaledger.net/'],
[NetworkId.IotaTestnet]: ['https://chronicle.testnet.iotaledger.net/'],
[NetworkId.IotaAlphanet]: ['https://chronicle.alphanet.iotaledger.net/'],
[NetworkId.Shimmer]: ['https://chronicle.shimmer.network/'],
[NetworkId.Testnet]: ['https://chronicle.testnet.shimmer.network/'],
[NetworkId.ShimmerTestnet]: ['https://chronicle.testnet.shimmer.network/'],
}

export const CHRONICLE_ADDRESS_HISTORY_ROUTE = 'api/explorer/v2/ledger/updates/by-address/'
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { NetworkId } from '../enums'

export const COIN_TYPE: Readonly<{ [key in NetworkId]: number }> = {
[NetworkId.Iota]: 4218,
[NetworkId.IotaTestnet]: 1,
[NetworkId.IotaAlphanet]: 1,
[NetworkId.Shimmer]: 4219,
[NetworkId.Testnet]: 1,
[NetworkId.ShimmerTestnet]: 1,
[NetworkId.Custom]: 1,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ const DEFAULT_IOTA_ALPHANET_BASE_TOKEN: IBaseToken = {
useMetricPrefix: false,
}

const DEFAULT_IOTA_TESTNET_BASE_TOKEN: IBaseToken = {
standard: TokenStandard.BaseToken,
name: 'TST',
tickerSymbol: 'TST',
unit: 'TST',
decimals: 6,
subunit: 'testies',
useMetricPrefix: false,
}

const DEFAULT_SHIMMER_BASE_TOKEN: IBaseToken = {
standard: TokenStandard.BaseToken,
name: 'Shimmer',
Expand All @@ -32,7 +42,7 @@ const DEFAULT_SHIMMER_BASE_TOKEN: IBaseToken = {
useMetricPrefix: false,
}

const DEFAULT_TESTNET_BASE_TOKEN: IBaseToken = {
const DEFAULT_SHIMMER_TESTNET_BASE_TOKEN: IBaseToken = {
standard: TokenStandard.BaseToken,
name: 'Shimmer',
tickerSymbol: 'SMR',
Expand All @@ -44,7 +54,8 @@ const DEFAULT_TESTNET_BASE_TOKEN: IBaseToken = {

export const DEFAULT_BASE_TOKEN: Readonly<{ [key in NetworkId]?: IBaseToken }> = {
[NetworkId.Iota]: DEFAULT_IOTA_BASE_TOKEN,
[NetworkId.IotaTestnet]: DEFAULT_IOTA_TESTNET_BASE_TOKEN,
[NetworkId.IotaAlphanet]: DEFAULT_IOTA_ALPHANET_BASE_TOKEN,
[NetworkId.Shimmer]: DEFAULT_SHIMMER_BASE_TOKEN,
[NetworkId.Testnet]: DEFAULT_TESTNET_BASE_TOKEN,
[NetworkId.ShimmerTestnet]: DEFAULT_SHIMMER_TESTNET_BASE_TOKEN,
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const DEFAULT_CHAIN_CONFIGURATIONS: Readonly<{ [id in NetworkId]?: ChainM
'https://api.evm.shimmer.network/v1/chains/smr1prxvwqvwf7nru5q5xvh5thwg54zsm2y4wfnk6yk56hj3exxkg92mx20wl3s',
archiveEndpoint: 'https://archive.evm.shimmer.network',
},
[NetworkId.Testnet]: {
[NetworkId.ShimmerTestnet]: {
type: ChainType.Iscp,
name: DestinationNetwork.ShimmerEvmTestnet,
chainId: ChainId.ShimmerEVMTestnet,
Expand All @@ -22,4 +22,13 @@ export const DEFAULT_CHAIN_CONFIGURATIONS: Readonly<{ [id in NetworkId]?: ChainM
'https://api.evm.testnet.shimmer.network/v1/chains/rms1ppp00k5mmd2m8my8ukkp58nd3rskw6rx8l09aj35984k74uuc5u2cywn3ex',
archiveEndpoint: 'https://archive.evm.testnet.shimmer.network',
},
[NetworkId.IotaTestnet]: {
type: ChainType.Iscp,
name: DestinationNetwork.IotaEvmTestnet,
chainId: ChainId.IotaEVMTestnet,
aliasAddress: 'tst1pzxsrr7apqkdzz633dyntmvxwtyvk029p39te5j0m33q6946h7akzv663zu',
iscpEndpoint:
'https://api.evm.testnet.iotaledger.net/v1/chains/tst1pzxsrr7apqkdzz633dyntmvxwtyvk029p39te5j0m33q6946h7akzv663zu',
archiveEndpoint: 'https://archive.evm.testnet.iotaledger.net',
},
}
Loading

0 comments on commit 5a59f48

Please sign in to comment.