Skip to content

Commit 312a8a8

Browse files
refactor: Remove Account debris (#7909)
* refactor(2.0): Dynamic password * refactor(2.0): Remove Profile Manager (wip) * clean up and fix * clean up * clean up more code * clean up * adapt and remove for profile-manager related code * clean up more code * fmt * more cleanup * more cleanup * small tweaks * more cleanup * format * update * clean up * https://api.testnet.shimmer.network * revert Wallet.svelte * clean up * remove account debris * clean up * fix --------- Co-authored-by: Begoña Álvarez de la Cruz <[email protected]>
1 parent 6808007 commit 312a8a8

File tree

61 files changed

+204
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+204
-217
lines changed

packages/desktop/components/AccountSummary.svelte renamed to packages/desktop/components/WalletSummary.svelte

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { AccountActionsButton } from '@components'
2+
import { WalletActionsButton } from '@components'
33
import { Text, TogglableAssetBalanceLabel } from '@ui'
44
import { TextType } from '@ui/enums'
55
@@ -16,14 +16,14 @@
1616
$: ({ baseCoin } = $selectedWalletAssets[$activeProfile?.network.id])
1717
</script>
1818

19-
<account-summary class="block relative space-y-4">
19+
<wallet-summary class="block relative space-y-4">
2020
<div class="flex flex-row items-center justify-between">
2121
<Text type={TextType.h5} classes="text-left">
2222
{localize('general.balanceWithNetwork', { values: { network: fomattedNetworkName } })}
2323
</Text>
24-
<AccountActionsButton />
24+
<WalletActionsButton />
2525
</div>
2626
<div class="flex flex-col flex-wrap items-start space-y-1">
2727
<TogglableAssetBalanceLabel asset={baseCoin} />
2828
</div>
29-
</account-summary>
29+
</wallet-summary>

packages/desktop/components/buttons/menu-buttons/AccountActionsButton.svelte renamed to packages/desktop/components/buttons/menu-buttons/WalletActionsButton.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
let modal: Modal
66
</script>
77

8-
<account-actions-button class="block relative">
8+
<wallet-actions-button class="block relative">
99
<MeatballMenuButton onClick={modal?.toggle} />
1010
<WalletActionsMenu bind:modal position={{ right: '0' }} classes="mt-1.5" />
11-
</account-actions-button>
11+
</wallet-actions-button>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { default as AccountActionsButton } from './AccountActionsButton.svelte'
1+
export { default as WalletActionsButton } from './WalletActionsButton.svelte'

packages/desktop/components/buttons/popup-buttons/RefreshTokenMetadataButton.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
import { OnboardingButton } from '@ui'
33
44
import { localize } from '@core/i18n'
5-
import { refreshAccountAssetsForActiveProfile } from '@core/wallet'
5+
import { refreshWalletAssetsForActiveProfile } from '@core/wallet'
66
77
import { showAppNotification } from '@auxiliary/notification'
88
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
99
import { TextHintVariant } from 'shared/components/enums'
1010
1111
function refreshTokenMetadata(): void {
12-
refreshAccountAssetsForActiveProfile(true)
12+
refreshWalletAssetsForActiveProfile(true)
1313
showAppNotification({
1414
type: 'success',
1515
message: localize('notifications.refreshTokenMetadata.success'),

packages/desktop/components/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export * from './modals'
55
export * from './panes'
66
export * from './popups'
77

8-
export { default as AccountActivity } from './AccountActivity.svelte'
9-
export { default as AccountSummary } from './AccountSummary.svelte'
8+
export { default as WalletActivity } from './WalletActivity.svelte'
9+
export { default as WalletSummary } from './WalletSummary.svelte'
1010
export { default as WalletSwitcher } from './WalletSwitcher.svelte'
1111
export { default as OnboardingLayout } from './OnboardingLayout.svelte'
1212
export { default as Proposals } from './Proposals.svelte'

packages/desktop/components/modals/VestingModal.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
</script>
1515

1616
<Modal bind:this={modal} {...$$restProps}>
17-
<account-actions-menu class="flex flex-col">
17+
<vesting-modal class="flex flex-col">
1818
<MenuItem
1919
icon={Icon.Search}
2020
title={localize('actions.viewVestingRewardsFinder')}
2121
onClick={onVestingFinderClick}
2222
/>
23-
</account-actions-menu>
23+
</vesting-modal>
2424
</Modal>

packages/desktop/components/modals/WalletActionsMenu.svelte

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { MenuItem, MenuItemVariant, Modal, ToggleHiddenAccountMenuItem } from '@ui'
2+
import { MenuItem, MenuItemVariant, Modal, ToggleHiddenWalletMenuItem } from '@ui'
33
44
import { localize } from '@core/i18n'
55
import { activeProfile, isActiveLedgerProfile } from '@core/profile/stores'
@@ -16,10 +16,10 @@
1616
1717
export let modal: Modal = undefined
1818
19-
const showDeleteAccount = false // TODO(2.0) It doesn't make sense to allow removing
19+
const showDeleteWallet = false // TODO(2.0) It doesn't make sense to allow removing
2020
// the wallet as there is only one for each profile at the moment
2121
22-
function onCustomiseAccountClick(): void {
22+
function onCustomiseWalletClick(): void {
2323
openPopup({ id: PopupId.ManageWallet })
2424
modal?.close()
2525
}
@@ -60,11 +60,11 @@
6060
})
6161
}
6262
63-
function onDeleteAccountClick(): void {
63+
function onDeleteWalletClick(): void {
6464
openPopup({
65-
id: PopupId.DeleteAccount,
65+
id: PopupId.DeleteWallet,
6666
props: {
67-
account: selectedWallet,
67+
wallet: selectedWallet,
6868
deleteWallet,
6969
},
7070
})
@@ -73,7 +73,7 @@
7373
</script>
7474

7575
<Modal bind:this={modal} {...$$restProps}>
76-
<account-actions-menu class="flex flex-col">
76+
<wallet-actions-menu class="flex flex-col">
7777
<MenuItem icon={Icon.Doc} title={localize('actions.viewBalanceBreakdown')} onClick={onViewBalanceClick} />
7878
{#if $activeProfile?.network?.id === NetworkId.Iota || $activeProfile?.network?.id === NetworkId.IotaAlphanet}
7979
<MenuItem
@@ -82,23 +82,23 @@
8282
onClick={onViewAddressHistoryClick}
8383
/>
8484
{/if}
85-
<MenuItem icon={Icon.Customize} title={localize('actions.customizeAcount')} onClick={onCustomiseAccountClick} />
85+
<MenuItem icon={Icon.Customize} title={localize('actions.customizeAcount')} onClick={onCustomiseWalletClick} />
8686
{#if $isActiveLedgerProfile}
8787
<MenuItem
8888
icon={Icon.Ledger}
8989
title={localize('actions.verifyDepositAddress')}
9090
onClick={onVerifyAddressClick}
9191
/>
9292
{/if}
93-
<ToggleHiddenAccountMenuItem onClick={modal?.close} />
93+
<ToggleHiddenWalletMenuItem onClick={modal?.close} />
9494
<hr />
95-
{#if showDeleteAccount}
95+
{#if showDeleteWallet}
9696
<MenuItem
9797
icon={Icon.Delete}
98-
title={localize('actions.deleteAccount')}
99-
onClick={onDeleteAccountClick}
98+
title={localize('actions.showDeleteWallet')}
99+
onClick={onDeleteWalletClick}
100100
variant={MenuItemVariant.Error}
101101
/>
102102
{/if}
103-
</account-actions-menu>
103+
</wallet-actions-menu>
104104
</Modal>

packages/desktop/components/modals/WalletSwitcherModal.svelte

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
async function scrollToSelectedWallet(): Promise<void> {
1919
await tick()
20-
const element = document.getElementById(`account-${$selectedWallet.id}`)
20+
const element = document.getElementById(`wallet-${$selectedWallet.id}`)
2121
element?.scrollIntoView({ behavior: 'auto' })
2222
}
2323
@@ -34,13 +34,13 @@
3434
size="large"
3535
position={{ top: '30px', left: '50%' }}
3636
>
37-
<account-list-container class="block p-4">
38-
<account-list class="flex flex-col space-y-1 max-h-96 scrollable-y">
37+
<wallet-list-container class="block p-4">
38+
<wallet-list class="flex flex-col space-y-1 max-h-96 scrollable-y">
3939
{#each $visibleActiveWallets as wallet}
40-
<WalletSwitcherMenuItem id="account-{wallet.id}" {wallet} onClick={modal?.close} />
40+
<WalletSwitcherMenuItem id="wallet-{wallet.id}" {wallet} onClick={modal?.close} />
4141
{/each}
42-
</account-list>
43-
</account-list-container>
42+
</wallet-list>
43+
</wallet-list-container>
4444
<hr />
4545
<button
4646
type="button"

packages/desktop/components/popups/AddProposalPopup.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
label={localize('views.governance.details.proposalInformation.eventId')}
140140
/>
141141
{#if !isEditMode}
142-
<Checkbox label={localize('popups.addProposal.addToAllAccounts')} bind:checked={isAddingForAllWallets} />
142+
<Checkbox label={localize('popups.addProposal.addToAllWallets')} bind:checked={isAddingForAllWallets} />
143143
{/if}
144144
</div>
145145
<div class="flex w-full space-x-4 mt-6">

packages/desktop/components/popups/BalanceBreakdownPopup.svelte

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
Timelock = 'timelock',
2323
}
2424
25-
$: accountBalance = $selectedWallet?.balances
26-
$: accountBalance, void setBreakdown()
25+
$: walletBalance = $selectedWallet?.balances
26+
$: walletBalance, void setBreakdown()
2727
2828
let breakdown: { [key: string]: BalanceBreakdown } = {}
2929
@@ -44,14 +44,14 @@
4444
}
4545
4646
function getAvailableBreakdown(): BalanceBreakdown {
47-
return { amount: Number(accountBalance?.baseCoin?.available ?? 0) }
47+
return { amount: Number(walletBalance?.baseCoin?.available ?? 0) }
4848
}
4949
5050
async function getPendingBreakdown(): Promise<BalanceBreakdown> {
5151
let pendingOutputsStorageDeposit = 0
5252
5353
const subBreakdown = {}
54-
for (const [outputId, unlocked] of Object.entries(accountBalance?.potentiallyLockedOutputs ?? {})) {
54+
for (const [outputId, unlocked] of Object.entries(walletBalance?.potentiallyLockedOutputs ?? {})) {
5555
if (!unlocked) {
5656
const output = (await $selectedWallet.getOutput(outputId)).output
5757
@@ -100,9 +100,9 @@
100100
}
101101
102102
function getStorageDepositBreakdown(): BalanceBreakdown {
103-
const storageDeposits = accountBalance?.requiredStorageDeposit
103+
const storageDeposits = walletBalance?.requiredStorageDeposit
104104
const totalStorageDeposit = storageDeposits
105-
? Object.values(accountBalance.requiredStorageDeposit).reduce(
105+
? Object.values(walletBalance.requiredStorageDeposit).reduce(
106106
(total: number, value: string): number => total + Number(value ?? 0),
107107
0
108108
)
@@ -161,7 +161,7 @@
161161
subBreakdown={breakdown[breakdownKey].subBreakdown}
162162
/>
163163
{/each}
164-
<BalanceSummarySection titleKey="totalBalance" amount={Number(accountBalance?.baseCoin?.total ?? 0)} bold />
164+
<BalanceSummarySection titleKey="totalBalance" amount={Number(walletBalance?.baseCoin?.total ?? 0)} bold />
165165
</div>
166166
<Button onClick={onConsolidationClick}>
167167
{localize('popups.balanceBreakdown.minimizeStorageDepositButton')}

packages/desktop/components/popups/BalanceFinderPopup.svelte

+12-12
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
} from '@core/profile'
1919
import {
2020
formatTokenAmountBestMatch,
21-
generateAndStoreActivitiesForAllAccounts,
22-
refreshAccountAssetsForActiveProfile,
21+
generateAndStoreActivitiesForAllWallets,
22+
refreshWalletAssetsForActiveProfile,
2323
} from '@core/wallet'
2424
import {
2525
Button,
@@ -41,7 +41,7 @@
4141
export let searchForBalancesOnLoad = false
4242
export let hasUsedBalanceFinder = false
4343
export let showConsolidation = false
44-
export let consolidateAccountsOnLoad = false
44+
export let consolidateWalletsOnLoad = false
4545
export let title: string
4646
export let body: string
4747
export let searchInCurrentWallet: boolean = false
@@ -59,7 +59,7 @@
5959
? $visibleActiveWallets?.filter((_wallet) => _wallet.id === $selectedWalletId)
6060
: $visibleActiveWallets
6161
$: searchForBalancesOnLoad && !$isStrongholdLocked && onFindBalancesClick()
62-
$: consolidateAccountsOnLoad && !$isStrongholdLocked && onConsolidateAccountsClick()
62+
$: consolidateWalletsOnLoad && !$isStrongholdLocked && onConsolidateWalletsClick()
6363
$: totalBalance = sumBalanceForWallets($visibleActiveWallets)
6464
$: searchInCurrentWallet, (shouldInitSearch = true)
6565
$: searchAlgorithm = searchInCurrentWallet
@@ -79,11 +79,11 @@
7979
}
8080
}
8181
82-
async function onConsolidateAccountsClick(): Promise<void> {
82+
async function onConsolidateWalletsClick(): Promise<void> {
8383
if ($isSoftwareProfile && $isStrongholdLocked) {
8484
openUnlockStrongholdPopup(false, true)
8585
} else {
86-
await handleAction(consolidateProfileAccounts)
86+
await handleAction(consolidateProfileWallets)
8787
}
8888
}
8989
@@ -99,7 +99,7 @@
9999
shouldInitSearch = false
100100
}
101101
102-
async function consolidateProfileAccounts(): Promise<void> {
102+
async function consolidateProfileWallets(): Promise<void> {
103103
const consolidationPromises: Promise<void>[] = []
104104
105105
for (const wallet of get(visibleActiveWallets)) {
@@ -134,7 +134,7 @@
134134
}
135135
}
136136
137-
function openUnlockStrongholdPopup(searchForBalancesOnLoad: boolean, consolidateAccountsOnLoad: boolean) {
137+
function openUnlockStrongholdPopup(searchForBalancesOnLoad: boolean, consolidateWalletsOnLoad: boolean) {
138138
openPopup({
139139
id: PopupId.UnlockStronghold,
140140
props: {
@@ -143,7 +143,7 @@
143143
id: PopupId.BalanceFinder,
144144
props: {
145145
searchForBalancesOnLoad,
146-
consolidateAccountsOnLoad,
146+
consolidateWalletsOnLoad,
147147
showConsolidation,
148148
hasUsedBalanceFinder,
149149
title,
@@ -172,8 +172,8 @@
172172
173173
onDestroy(async () => {
174174
if (hasUsedBalanceFinder) {
175-
await refreshAccountAssetsForActiveProfile()
176-
await generateAndStoreActivitiesForAllAccounts()
175+
await refreshWalletAssetsForActiveProfile()
176+
await generateAndStoreActivitiesForAllWallets()
177177
loadNftsForActiveProfile()
178178
}
179179
})
@@ -252,7 +252,7 @@
252252
/>
253253
<Button
254254
classes="w-full"
255-
onClick={onConsolidateAccountsClick}
255+
onClick={onConsolidateWalletsClick}
256256
disabled={isBusy || isTransferring}
257257
isBusy={isTransferring}
258258
busyMessage={localize('popups.minimizeStorageDeposit.title')}

0 commit comments

Comments
 (0)