Skip to content

Commit

Permalink
Merge branch 'develop' into l10n_develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nicole-obrien authored May 2, 2024
2 parents c0dc5b0 + dc47edb commit b7c3254
Show file tree
Hide file tree
Showing 71 changed files with 332 additions and 350 deletions.
20 changes: 11 additions & 9 deletions packages/desktop/components/NetworkCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
import { localize } from '@core/i18n'
import { generateAndStoreEvmAddressForAccounts, pollEvmBalancesForAccount } from '@core/layer-2/actions'
import { LedgerAppName } from '@core/ledger'
import { ExplorerEndpoint, Network, NetworkNamespace, getDefaultExplorerUrl, setSelectedChain } from '@core/network'
import {
ExplorerEndpoint,
Network,
NetworkNamespace,
getDefaultExplorerUrl,
setSelectedNetworkForNetworkDrawer,
} from '@core/network'
import { ProfileType } from '@core/profile'
import { checkActiveProfileAuth } from '@core/profile/actions'
import { activeProfile } from '@core/profile/stores'
Expand All @@ -32,19 +38,15 @@
}
function onCardClick(): void {
if (network.namespace === NetworkNamespace.Stardust) {
$networkConfigRouter.goTo(NetworkConfigRoute.NetworkSettings)
} else {
setSelectedChain(network)
$networkConfigRouter.goTo(NetworkConfigRoute.ChainInformation)
}
setSelectedNetworkForNetworkDrawer(network)
$networkConfigRouter.goTo(NetworkConfigRoute.ChainInformation)
}
function onQrCodeIconClick(): void {
if (network.namespace === NetworkNamespace.Stardust) {
$networkConfigRouter.goTo(NetworkConfigRoute.ChainDepositAddress)
} else {
setSelectedChain(network)
setSelectedNetworkForNetworkDrawer(network)
$networkConfigRouter.goTo(NetworkConfigRoute.ChainDepositAddress)
}
}
Expand All @@ -61,7 +63,7 @@
}
try {
setSelectedChain(network)
setSelectedNetworkForNetworkDrawer(network)
await generateAndStoreEvmAddressForAccounts(
$activeProfile.type,
network.coinType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import { localize } from '@core/i18n'
import { isEvmNetwork } from '@core/network'
import { IIrc27Nft, Nft, getPrimaryNftUrl, isNftLocked, isValidNftUri } from '@core/nfts'
import { addNftsToDownloadQueue, updateNftInAllAccountNfts } from '@core/nfts/actions'
import { updatePersistedNft } from '@core/nfts/stores'
import { addNftsToDownloadQueue } from '@core/nfts/actions'
import { updateNftForAllAccounts, updatePersistedNft } from '@core/nfts/stores'
import { activeProfile, updateActiveProfile } from '@core/profile/stores'
import { Platform } from '@core/app'
Expand Down Expand Up @@ -36,14 +36,14 @@
}
updatePersistedNft(nft.id, { downloadMetadata: {} })
updateNftInAllAccountNfts(nft.id, { downloadMetadata: {}, isLoaded: false })
updateNftForAllAccounts({ id: nft.id, downloadMetadata: {}, isLoaded: false })
addNftsToDownloadQueue([nft])
menu?.close()
}
function onHideClick(): void {
updatePersistedNft(nft.id, { hidden: !nft.hidden })
updateNftInAllAccountNfts(nft.id, { hidden: !nft.hidden })
updateNftForAllAccounts({ id: nft.id, hidden: !nft.hidden })
menu?.close()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
import { ExplorerEndpoint } from '@core/network'
import { getDefaultExplorerUrl } from '@core/network/utils'
import { NftStandard } from '@core/nfts'
import { getNftByIdFromAllAccountNfts } from '@core/nfts/actions'
import { Nft } from '@core/nfts/interfaces'
import { ownedNfts, selectedNftId } from '@core/nfts/stores'
import { ownedNfts, selectedNftId, getNftByIdForAccount } from '@core/nfts/stores'
import { CollectiblesRoute, DashboardRoute, collectiblesRouter, dashboardRouter } from '@core/router'
import { getTokenFromSelectedAccountTokens } from '@core/token/stores'
import { buildUrl, setClipboard, truncateString } from '@core/utils'
Expand Down Expand Up @@ -45,7 +44,7 @@
_activity.tokenTransfer.standard === NftStandard.Erc721 ||
_activity.tokenTransfer.standard === NftStandard.Irc27
) {
return getNftByIdFromAllAccountNfts($selectedAccountIndex, _activity.tokenTransfer.tokenId) as Nft
return getNftByIdForAccount($selectedAccountIndex, _activity.tokenTransfer.tokenId)
}
}
}
Expand All @@ -62,7 +61,7 @@
const { tokenId, rawAmount, standard } = _activity.tokenTransfer
if (standard === NftStandard.Erc721 || standard === NftStandard.Irc27) {
return {
nft: getNftByIdFromAllAccountNfts($selectedAccountIndex, _activity.tokenTransfer.tokenId) as Nft,
nft: getNftByIdForAccount($selectedAccountIndex, _activity.tokenTransfer.tokenId) as Nft,
}
} else {
const token = getTokenFromSelectedAccountTokens(tokenId, _activity.sourceNetworkId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import { getTransferInfoFromTransactionData } from '@core/layer-2/utils/getTransferInfoFromTransactionData'
import { TokenTransferData } from '@core/wallet'
import { Nft } from '@core/nfts'
import { getNftByIdFromAllAccountNfts } from '@core/nfts/actions'
import { Alert, Link, Table, Text } from '@bloomwalletio/ui'
import { PopupId, closePopup, modifyPopupState, openPopup } from '@desktop/auxiliary/popup'
import { buildUrl, truncateString } from '@core/utils'
Expand All @@ -33,6 +32,7 @@
import { LegacyTransaction } from '@ethereumjs/tx'
import { getActiveProfileId } from '@core/profile/stores'
import { IAccountState } from '@core/account'
import { getNftByIdForAccount } from '@core/nfts/stores'
export let preparedTransaction: EvmTransactionData
export let evmNetwork: IEvmNetwork
Expand Down Expand Up @@ -77,7 +77,7 @@
break
}
case StardustActivityType.Nft: {
nft = getNftByIdFromAllAccountNfts($selectedAccount.index, transferInfo.nftId)
nft = getNftByIdForAccount($selectedAccount.index, transferInfo.nftId)
break
}
case StardustActivityType.SmartContract: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@
import PopupTemplate from '../PopupTemplate.svelte'
import { closePopup } from '@desktop/auxiliary/popup'
import { showNotification } from '@auxiliary/notification'
import {
addNftsToDownloadQueue,
addNewTrackedNftToActiveProfile,
persistErc721Nft,
updateAllAccountNftsForAccount,
} from '@core/nfts/actions'
import { addNftsToDownloadQueue, addNewTrackedNftToActiveProfile, persistErc721Nft } from '@core/nfts/actions'
import { buildNftFromPersistedErc721Nft } from '@core/nfts/utils'
import { activeAccounts } from '@core/profile/stores'
import { getAddressFromAccountForNetwork } from '@core/account'
import { TokenTrackingStatus } from '@core/token'
import { selectedAccount } from '@core/account/stores'
import { addOrUpdateNftForAccount } from '@core/nfts/stores'
let busy = false
Expand Down Expand Up @@ -46,7 +42,7 @@
for (const account of $activeAccounts) {
const l2Address = getAddressFromAccountForNetwork(account, networkId)
const nft = buildNftFromPersistedErc721Nft(persistedNft, l2Address)
updateAllAccountNftsForAccount(account.index, nft)
addOrUpdateNftForAccount(account.index, nft)
void addNftsToDownloadQueue([nft])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import { localize } from '@core/i18n'
import { ExplorerEndpoint } from '@core/network'
import { getDefaultExplorerUrl } from '@core/network/utils'
import { getNftByIdFromAllAccountNfts } from '@core/nfts/actions'
import { ownedNfts, selectedNftId } from '@core/nfts/stores'
import { getNftByIdForAccount, ownedNfts, selectedNftId } from '@core/nfts/stores'
import { CollectiblesRoute, DashboardRoute, collectiblesRouter, dashboardRouter } from '@core/router'
import { buildUrl, setClipboard, truncateString } from '@core/utils'
import { claimActivity, rejectActivity } from '@core/wallet'
Expand All @@ -34,7 +33,7 @@
$: transactionAssets = getTransactionAssets(activity, $selectedAccountIndex)
$: nft =
activity.type === StardustActivityType.Nft
? getNftByIdFromAllAccountNfts($selectedAccountIndex, activity.nftId)
? getNftByIdForAccount($selectedAccountIndex, activity.nftId)
: undefined
$: nftIsOwned = nft ? $ownedNfts.some((_nft) => _nft.id === nft?.id) : false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import { handleError } from '@core/error/handlers'
import { EvmNetworkId, NetworkNamespace, getEvmNetwork } from '@core/network'
import { buildNftFromPersistedErc721Nft } from '@core/nfts'
import { addNftsToDownloadQueue, updateAllAccountNftsForAccount } from '@core/nfts/actions'
import { addNftsToDownloadQueue } from '@core/nfts/actions'
import { persistErc721Nft } from '@core/nfts/actions/persistErc721Nft'
import { ownedNfts } from '@core/nfts/stores'
import { addOrUpdateNftForAccount, ownedNfts } from '@core/nfts/stores'
import { TideApi } from '@core/tide/apis'
import { onDestroy, onMount } from 'svelte'
import Leaderboard from '../components/Leaderboard.svelte'
Expand Down Expand Up @@ -79,7 +79,7 @@
if (persistedNft) {
const nft = buildNftFromPersistedErc721Nft(persistedNft, accountAddress)
void addNftsToDownloadQueue([nft])
updateAllAccountNftsForAccount(index, nft)
addOrUpdateNftForAccount(index, nft)
}
} catch (_) {
// Switching account too swiftly results in an error from persistErc721Nft.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import { DownloadErrorType, DownloadWarningType, IDownloadMetadata, Nft, NftDownloadOptions } from '@core/nfts'
import { Alert, Link, Text } from '@bloomwalletio/ui'
import { localize } from '@core/i18n'
import { addNftsToDownloadQueue, updateNftInAllAccountNfts } from '@core/nfts/actions'
import { addNftsToDownloadQueue } from '@core/nfts/actions'
import { getFormattedFileSize } from '@core/utils'
import { updateNftForAllAccounts } from '@core/nfts/stores'
export let type: DownloadErrorType | DownloadWarningType | undefined
export let message: string | undefined
Expand Down Expand Up @@ -54,7 +55,8 @@
break
}
updateNftInAllAccountNfts(nft.id, {
updateNftForAllAccounts({
id: nft.id,
isLoaded: false,
downloadMetadata: { ...nft.downloadMetadata, warning: undefined, error: undefined },
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<script lang="ts">
import { Pane } from '@ui'
import { Collection, Nft } from '@core/nfts/interfaces'
import { getNftByIdFromAllAccountNfts } from '@core/nfts/actions'
import { NftStandard } from '@core/nfts/enums'
import { allAccountNfts, selectedAccountCollections, selectedCollectionId, selectedNftId } from '@core/nfts/stores'
import {
activeProfileNftsPerAccount,
getNftByIdForAccount,
selectedAccountCollections,
selectedCollectionId,
selectedNftId,
} from '@core/nfts/stores'
import { selectedAccountIndex } from '@core/account/stores'
import { CollectionDetails, Erc721CollectibleDetails, Irc27CollectibleDetails } from '../components'
import { time } from '@core/app/stores'
Expand All @@ -12,10 +17,10 @@
let nft: Nft | undefined
let collection: Collection | undefined
$: $allAccountNfts, (nft = getNftByIdFromAllAccountNfts($selectedAccountIndex, $selectedNftId))
$: $activeProfileNftsPerAccount, (nft = getNftByIdForAccount($selectedAccountIndex, $selectedNftId))
$: collection = $selectedCollectionId ? $selectedAccountCollections[$selectedCollectionId] : undefined
$: returnIfNftWasSent($allAccountNfts[$selectedAccountIndex], $time)
$: returnIfNftWasSent($activeProfileNftsPerAccount[$selectedAccountIndex], $time)
function returnIfNftWasSent(ownedNfts: Nft[], currentTime: Date): void {
if (!nft) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
ConfirmLedgerEvmAddressDrawer,
ConnectedNetworksDrawer,
EditNetworkDrawer,
NetworkSettingsDrawer,
RemoveNetworkDrawer,
} from './views'
import { clearSelectedChain } from '@core/network'
import { clearSelectedNetworkForNetworkDrawer } from '@core/network'
import features from '@features/features'
import { Platform } from '@core/app'
Expand All @@ -31,16 +30,14 @@
onDestroy(() => {
$networkConfigRouter = null
clearSelectedChain()
clearSelectedNetworkForNetworkDrawer()
})
</script>

{#if $networkConfigRoute === NetworkConfigRoute.ConnectedChains}
<ConnectedNetworksDrawer {drawerRouter} />
{:else if $networkConfigRoute === NetworkConfigRoute.ChainInformation}
<NetworkInformationDrawer {drawerRouter} />
{:else if $networkConfigRoute === NetworkConfigRoute.NetworkSettings}
<NetworkSettingsDrawer {drawerRouter} />
{:else if $networkConfigRoute === NetworkConfigRoute.EditChain}
<EditNetworkDrawer {drawerRouter} />
{:else if $networkConfigRoute === NetworkConfigRoute.RemoveChain}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export enum NetworkConfigRoute {
AddChain = 'addChain',
ChainDepositAddress = 'chainDepositAddress',
ChainInformation = 'chainInformation',
NetworkSettings = 'networkSettings',
ConfirmLedgerEvmAddress = 'confirmLedgerEvmAddress',
ConnectedChains = 'connectedChains',
EditChain = 'editChain',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import { DrawerTemplate } from '@components'
import { selectedAccount } from '@core/account/stores'
import { localize } from '@core/i18n'
import { getEvmNetworks, selectedChain } from '@core/network/stores'
import { getEvmNetworks, selectedNetworkForNetworkDrawer } from '@core/network/stores'
import { Router } from '@core/router'
import { NetworkConfigRoute, networkConfigRouter } from '../'
export let drawerRouter: Router<NetworkConfigRoute>
$: evmNetwork = $selectedChain ?? getEvmNetworks()[0]
$: evmNetwork = $selectedNetworkForNetworkDrawer ?? getEvmNetworks()[0]
$: address = evmNetwork ? $selectedAccount?.evmAddresses?.[evmNetwork.coinType] : undefined
function onContinueClick(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { DrawerTemplate, NetworkCard } from '@components'
import { localize } from '@core/i18n'
import { clearSelectedChain, networks } from '@core/network'
import { clearSelectedNetworkForNetworkDrawer, networks } from '@core/network'
import { Router } from '@core/router'
import features from '@features/features'
import { Button, IconName } from '@bloomwalletio/ui'
Expand All @@ -15,7 +15,7 @@
}
onMount(() => {
clearSelectedChain()
clearSelectedNetworkForNetworkDrawer()
})
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,23 @@
import { DrawerTemplate } from '@components'
import { selectedAccount } from '@core/account/stores'
import { localize } from '@core/i18n'
import { selectedChain } from '@core/network'
import { NetworkId, selectedNetworkForNetworkDrawer } from '@core/network'
import { Router } from '@core/router'
import { AddressBox } from '@ui'
import { NetworkConfigRoute } from '../'
import { IAccountState, getAddressFromAccountForNetwork } from '@core/account'
export let drawerRouter: Router<NetworkConfigRoute>
let depositAddress = ''
$: {
if ($selectedChain) {
const coinType = $selectedChain.coinType
depositAddress = $selectedAccount.evmAddresses[coinType]
} else {
depositAddress = $selectedAccount.depositAddress
}
}
$: depositAddress = getAddressFromAccountForNetwork(
$selectedAccount as IAccountState,
$selectedNetworkForNetworkDrawer?.id as NetworkId
)
</script>

<DrawerTemplate
title={localize(
`views.dashboard.drawers.networkConfig.chainDepositAddress.${$selectedChain ? 'title' : 'networkTitle'}`
`views.dashboard.drawers.networkConfig.chainDepositAddress.${$selectedNetworkForNetworkDrawer ? 'title' : 'networkTitle'}`
)}
{drawerRouter}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
<script lang="ts">
import { DrawerTemplate } from '@components'
import { NetworkType, IscChain, selectedChain } from '@core/network'
import { selectedNetworkForNetworkDrawer, NetworkNamespace } from '@core/network'
import { Router } from '@core/router'
import { NetworkConfigRoute } from '../'
import { EvmChainInformation, IscChainInformation } from './components'
import { EvmChainInformationDrawer, StardustInformationDrawer } from './components'
export let drawerRouter: Router<NetworkConfigRoute>
$: evmNetwork = $selectedChain as IscChain
</script>

<DrawerTemplate title={evmNetwork?.name} {drawerRouter}>
<div class="w-full h-full px-6">
{#if evmNetwork?.type === NetworkType.Isc}
<IscChainInformation {evmNetwork} />
{:else if evmNetwork?.type === NetworkType.Evm}
<EvmChainInformation />
{/if}
</div>
</DrawerTemplate>
{#if $selectedNetworkForNetworkDrawer && $selectedNetworkForNetworkDrawer.namespace === NetworkNamespace.Evm}
<EvmChainInformationDrawer network={$selectedNetworkForNetworkDrawer} {drawerRouter} />
{:else if $selectedNetworkForNetworkDrawer && $selectedNetworkForNetworkDrawer.namespace === NetworkNamespace.Stardust}
<StardustInformationDrawer network={$selectedNetworkForNetworkDrawer} {drawerRouter} />
{/if}

This file was deleted.

Loading

0 comments on commit b7c3254

Please sign in to comment.