Skip to content

Commit c2df08c

Browse files
committed
format
1 parent 8a9548c commit c2df08c

File tree

88 files changed

+272
-219
lines changed

Some content is hidden

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

88 files changed

+272
-219
lines changed

packages/desktop/components/modals/WalletActionsMenu.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
export let modal: Modal = undefined
1818
1919
const showDeleteAccount = true // TODO(2.0) Is there anything preventing us from deleting any account ?
20-
// $selectedWallet?.id === $activeWallets?.length - 1 && $visibleActiveWallets?.length > 1
20+
// $selectedWallet?.id === $activeWallets?.length - 1 && $visibleActiveWallets?.length > 1
2121
2222
function onCustomiseAccountClick(): void {
2323
openPopup({ id: PopupId.ManageWallet })
@@ -44,7 +44,7 @@
4444
options: {
4545
internal: false,
4646
ledgerNanoPrompt: true,
47-
}
47+
},
4848
})
4949
showAppNotification({
5050
type: 'info',

packages/desktop/components/popups/AliasConfirmationPopup.svelte

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
import { Button, KeyValueBox, Text, FontWeight, TextType } from 'shared/components'
33
import { localize } from '@core/i18n'
44
import { checkActiveProfileAuth, getBaseToken } from '@core/profile'
5-
import { formatTokenAmountPrecise, EMPTY_HEX_ID, processAndAddToActivities, selectedWallet, updateSelectedWallet } from '@core/wallet'
5+
import {
6+
formatTokenAmountPrecise,
7+
EMPTY_HEX_ID,
8+
processAndAddToActivities,
9+
selectedWallet,
10+
updateSelectedWallet,
11+
} from '@core/wallet'
612
import { UnlockConditionType, PreparedTransaction, AccountOutput } from '@iota/sdk/out/types'
713
import { closePopup } from '@auxiliary/popup'
814
import { onMount } from 'svelte'

packages/desktop/components/popups/WalletSwitcherPopup.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</Text>
2727
<div class="flex flex-col space-y-4">
2828
<Text fontSize="15" color="gray-700" classes="text-left">{localize('popups.deeplinkAccountSwitch.body')}</Text>
29-
<WalletSelector bind:wallet={wallet} />
29+
<WalletSelector bind:wallet />
3030
</div>
3131
<popup-buttons class="flex flex-row flex-nowrap w-full space-x-4">
3232
<Button classes="w-full" outline onClick={onCancelClick}>{localize('actions.cancel')}</Button>

packages/desktop/electron/preload.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ try {
113113
bindMethodsAcrossContextBridge(IotaSdk.SecretManager.prototype, manager)
114114
return manager
115115
},
116-
async getClientFromWallet(id){
117-
const wallet = wallets[id];
116+
async getClientFromWallet(id) {
117+
const wallet = wallets[id]
118118
// Why is this here?:
119-
// We cannot create classes from exposed functions
119+
// We cannot create classes from exposed functions
120120
// https://www.electronjs.org/docs/latest/api/context-bridge
121-
const client = await wallet.getClient();
121+
const client = await wallet.getClient()
122122
bindMethodsAcrossContextBridge(IotaSdk.Client.prototype, client)
123123
return client
124124
},
@@ -161,7 +161,7 @@ try {
161161
return accounts
162162
},
163163
async clearWalletsFromMemory() {
164-
for(const [id, wallet] of Object.entries(wallets)){
164+
for (const [id, wallet] of Object.entries(wallets)) {
165165
await wallet.stopBackgroundSync()
166166
await wallet.destroy()
167167
delete wallets[id]

packages/desktop/views/onboarding/views/create-profile/views/ChooseCreateProfileFlowView.svelte

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<script lang="ts">
22
import { OnboardingLayout } from '@components'
3-
import {
4-
CreateProfileType,
5-
onboardingProfile,
6-
updateOnboardingProfile,
7-
} from '@contexts/onboarding'
3+
import { CreateProfileType, onboardingProfile, updateOnboardingProfile } from '@contexts/onboarding'
84
import { localize } from '@core/i18n'
9-
import { ProfileType, clearProfileFromMemory, getSecretManagerFromProfileType, getStorageDirectoryOfProfile, removeProfileFolder } from '@core/profile'
5+
import {
6+
ProfileType,
7+
clearProfileFromMemory,
8+
getSecretManagerFromProfileType,
9+
getStorageDirectoryOfProfile,
10+
removeProfileFolder,
11+
} from '@core/profile'
1012
import features from '@features/features'
1113
import { Animation, OnboardingButton, Text } from '@ui'
1214
import { onMount } from 'svelte'

packages/desktop/views/onboarding/views/shared/EncryptMnemonicView.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
busy = true
4747
await setStrongholdPassword(strongholdPassword)
4848
updateOnboardingProfile({ strongholdPassword, hasStoredMnemonic: true })
49-
await buildOnboardingSecretManager();
49+
await buildOnboardingSecretManager()
5050
await verifyAndStoreMnemonic()
5151
router.next()
5252
} catch (err) {

packages/desktop/views/update-stronghold/views/ChangePasswordView.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
storagePath,
109109
coinType,
110110
clientOptions,
111-
secretManager,
111+
secretManager
112112
)
113113
profileManager.set(manager)
114114
}

packages/shared/components/inputs/WalletSelector.svelte

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
1010
let modal: Modal | undefined
1111
12-
$: wallets = $visibleActiveWallets?.filter(
13-
(wallet) => wallet.id !== $selectedWallet?.id || !hideSelectedWallet
14-
)
12+
$: wallets = $visibleActiveWallets?.filter((wallet) => wallet.id !== $selectedWallet?.id || !hideSelectedWallet)
1513
1614
function getSuffixForWallet(wallet: IWalletState): string {
1715
return formatTokenAmountBestMatch(Number(wallet.balances.baseCoin.available), getBaseToken())

packages/shared/lib/contexts/governance/actions/getVotingEvent.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import type { ParticipationEventId, ParticipationEventWithNodes } from '@iota/sd
22
import { getSelectedWallet } from 'shared/lib/core/wallet'
33

44
export function getVotingEvent(eventId: ParticipationEventId): Promise<ParticipationEventWithNodes> {
5-
const wallet = getSelectedWallet();
5+
const wallet = getSelectedWallet()
66
return wallet.getParticipationEvent(eventId)
77
}

packages/shared/lib/contexts/governance/actions/getWalletsParticipationEventStatusForEvent.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { ParticipationEventId, ParticipationEventStatus } from '@iota/sdk/o
22
import { IWallet } from 'shared/lib/core/profile'
33
import { getSelectedWallet } from 'shared/lib/core/wallet/stores/selected-wallet.store'
44

5-
65
export function getWalletsParticipationEventStatusForEvent(
76
eventId: ParticipationEventId,
87
wallet: IWallet = getSelectedWallet()

packages/shared/lib/contexts/governance/actions/initializeRegisteredProposals.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { activeWallets } from 'shared/lib/core/profile'
22
import { getSelectedWallet, IWalletState } from 'shared/lib/core/wallet'
33
import { get } from 'svelte/store'
44

5-
65
import { IRegisteredProposals } from '../interfaces'
76
import { registeredProposals } from '../stores'
87
import { createProposalFromError, createProposalFromEvent } from '../utils'
@@ -12,7 +11,7 @@ export async function initializeRegisteredProposals(): Promise<void> {
1211
const allProposals: { [walletId: string]: IRegisteredProposals } = {}
1312

1413
// Get selected wallet first to speed up showing proposals for the user
15-
const _selectedWallet = getSelectedWallet();
14+
const _selectedWallet = getSelectedWallet()
1615
allProposals[_selectedWallet.id] = await getParticipationEventsAndCreateProposalsForWallet(_selectedWallet)
1716
registeredProposals.set(allProposals)
1817

@@ -28,9 +27,7 @@ export async function initializeRegisteredProposals(): Promise<void> {
2827
registeredProposals.set(allProposals)
2928
}
3029

31-
async function getParticipationEventsAndCreateProposalsForWallet(
32-
wallet: IWalletState
33-
): Promise<IRegisteredProposals> {
30+
async function getParticipationEventsAndCreateProposalsForWallet(wallet: IWalletState): Promise<IRegisteredProposals> {
3431
const proposals: IRegisteredProposals = {}
3532
const events = await wallet.getParticipationEvents()
3633
for (const event of Object.values(events)) {

packages/shared/lib/contexts/governance/actions/registerParticipationEvents.ts

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { getSelectedWallet, IWalletState } from 'shared/lib/core/wallet'
33

44
import { get } from 'svelte/store'
55

6-
76
import { addProposalsFromParticipationEventMap } from './addProposalsFromParticipationEventMap'
87

98
export async function registerParticipationEvents(

packages/shared/lib/contexts/governance/actions/setVotingPower.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { closePopup } from '@auxiliary/popup'
66
import { getSelectedWallet, updateSelectedWallet } from 'shared/lib/core/wallet'
77

88
export async function setVotingPower(rawAmount: string): Promise<void> {
9-
const wallet = getSelectedWallet();
9+
const wallet = getSelectedWallet()
1010
try {
1111
if (!wallet) return
1212

packages/shared/lib/contexts/governance/actions/stopVotingForProposal.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { processAndAddToActivities } from '@core/wallet/utils'
77
import { getSelectedWallet, updateSelectedWallet } from 'shared/lib/core/wallet'
88

99
export async function stopVotingForProposal(eventId: string): Promise<Transaction | undefined> {
10-
const wallet = getSelectedWallet();
10+
const wallet = getSelectedWallet()
1111
try {
1212
updateSelectedWallet({ hasVotingTransactionInProgress: true })
1313
const prepareStopParticipatingTransaction = await wallet?.prepareStopParticipating(eventId)

packages/shared/lib/contexts/governance/actions/vote.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { handleError } from '@core/error/handlers'
77
import { getSelectedWallet, processAndAddToActivities, updateSelectedWallet } from '@core/wallet'
88

99
export async function vote(eventId?: string, answers?: number[]): Promise<void> {
10-
const wallet = getSelectedWallet();
10+
const wallet = getSelectedWallet()
1111
try {
1212
updateSelectedWallet({ hasVotingTransactionInProgress: true })
1313
const prepareVoteTransaction = await wallet?.prepareVote(eventId, answers)

packages/shared/lib/contexts/onboarding/actions/completeOnboardingProcess.ts

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1-
import { activeProfile, activeWallets, addWalletPersistedDataToActiveProfile, addWalletToActiveWallets, createWallet, login } from '@core/profile'
1+
import {
2+
activeProfile,
3+
activeWallets,
4+
addWalletPersistedDataToActiveProfile,
5+
addWalletToActiveWallets,
6+
createWallet,
7+
login,
8+
} from '@core/profile'
29
import { get } from 'svelte/store'
310
import { OnboardingType } from '../enums'
411
import { addWalletPersistedDataToOnboardingProfile, onboardingProfile } from '../stores'
512
import { createNewProfileFromOnboardingProfile } from './createNewProfileFromOnboardingProfile'
613
import { showBalanceOverviewPopup } from '@contexts/dashboard/stores'
7-
import { addEmptyWalletActivitiesToAllWalletActivities, buildWalletStateAndPersistedData, createNewWallet, IWalletState } from '@core/wallet'
14+
import {
15+
addEmptyWalletActivitiesToAllWalletActivities,
16+
buildWalletStateAndPersistedData,
17+
createNewWallet,
18+
IWalletState,
19+
} from '@core/wallet'
820
import { localize } from '@core/i18n'
921

1022
export async function completeOnboardingProcess(): Promise<void> {
@@ -27,7 +39,7 @@ export async function completeOnboardingProcess(): Promise<void> {
2739

2840
export async function createOnboardingWallet(name?: string, color?: string): Promise<IWalletState> {
2941
// 1. Get the wallet name
30-
const walletName = name || `${localize('general.wallet')} ${(get(activeWallets)?.length ?? 0) + 1}`;
42+
const walletName = name || `${localize('general.wallet')} ${(get(activeWallets)?.length ?? 0) + 1}`
3143

3244
// 2. Create the wallet instance
3345
const wallet = await createWallet() // TODO(2.0) Not sure about this, I think this should be createWallet instead

packages/shared/lib/contexts/onboarding/actions/createShimmerClaimingProfileManager.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import { RestoreProfileType } from '../enums'
77
import { getTemporaryProfileManagerStorageDirectory } from '../helpers'
88
import { onboardingProfile, shimmerClaimingProfileManager } from '../stores'
99

10-
11-
// TODO(2.0): Fix all shimmer claiming and rename this
10+
// TODO(2.0): Fix all shimmer claiming and rename this
1211
export async function createShimmerClaimingProfileManager(): Promise<void> {
1312
const $onboardingProfile = get(onboardingProfile)
1413
if (!$onboardingProfile) {
@@ -25,7 +24,7 @@ export async function createShimmerClaimingProfileManager(): Promise<void> {
2524
storagePath,
2625
coinType,
2726
clientOptions,
28-
secretManager,
27+
secretManager
2928
)
3029

3130
if ($onboardingProfile?.restoreProfileType !== RestoreProfileType.Ledger) {

packages/shared/lib/contexts/onboarding/actions/findShimmerRewards.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { showAppNotification } from '@auxiliary/notification'
22
import { localize } from '@core/i18n'
33
import { updateLedgerNanoStatus } from '@core/ledger'
4-
import { AccountRecoveryProfileConfiguration, ProfileType, RecoverAccountsPayload, UnableToFindProfileTypeError } from '@core/profile'
4+
import {
5+
AccountRecoveryProfileConfiguration,
6+
ProfileType,
7+
RecoverAccountsPayload,
8+
UnableToFindProfileTypeError,
9+
} from '@core/profile'
510
import { zip } from '@core/utils'
611
import { formatTokenAmountBestMatch } from '@core/wallet/utils'
712
import { get } from 'svelte/store'

packages/shared/lib/contexts/onboarding/actions/initialiseProfileManagerFromOnboardingProfile.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import { getSecretManagerFromProfileType, getStorageDirectoryOfProfile, removePr
66
import { onboardingProfile, updateOnboardingProfile } from '../stores'
77

88
// TODO(2.0) Fix this, profile manager is gone
9-
export async function initialiseOnboardingProfileWithSecretManager(checkForExistingSecretManager?: boolean): Promise<void> {
9+
export async function initialiseOnboardingProfileWithSecretManager(
10+
checkForExistingSecretManager?: boolean
11+
): Promise<void> {
1012
const secretManager = get(onboardingProfileSecretManager)
1113
const activeOnboardingProfile = get(onboardingProfile)
1214

packages/shared/lib/contexts/onboarding/helpers/validateStrongholdCoinType.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import { CannotRestoreWithMismatchedCoinTypeError } from '../errors'
66
import { onboardingProfile } from '../stores'
77

88
// Todo(2.0) Fix this
9-
export async function validateStrongholdCoinType(
10-
networkId: NetworkId
11-
): Promise<void> {
9+
export async function validateStrongholdCoinType(networkId: NetworkId): Promise<void> {
1210
const wallets = await getWallets() // TODO (2.0) Should we be passing like a profile ID or something here?
1311

1412
// TODO(2.0) Fix this

packages/shared/lib/contexts/onboarding/stores/onboarding-profile.store.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { IPersistedNetwork } from '@core/network'
88

99
export const onboardingProfile = writable<IOnboardingProfile | null | undefined>(null)
1010

11-
export const isOnboardingLedgerProfile: Readable<boolean> = derived(onboardingProfile, ($onboardingProfile) =>{
12-
return isLedgerProfile($onboardingProfile?.type)
11+
export const isOnboardingLedgerProfile: Readable<boolean> = derived(onboardingProfile, ($onboardingProfile) => {
12+
return isLedgerProfile($onboardingProfile?.type)
1313
})
1414

1515
export const onboardingProfileNetwork: Readable<IPersistedNetwork | undefined> = derived(
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import { onboardingProfile } from '@contexts/onboarding/stores';
2-
import { api } from '@core/api';
3-
import { SecretManager, SecretManagerType } from '@iota/sdk';
4-
import { USE_LEDGER_SIMULATOR } from 'shared/lib/core/ledger';
5-
import { getStorageDirectoryOfProfile, ProfileType } from 'shared/lib/core/profile';
6-
import { get, writable, Writable } from 'svelte/store';
1+
import { onboardingProfile } from '@contexts/onboarding/stores'
2+
import { api } from '@core/api'
3+
import { SecretManager, SecretManagerType } from '@iota/sdk'
4+
import { USE_LEDGER_SIMULATOR } from 'shared/lib/core/ledger'
5+
import { getStorageDirectoryOfProfile, ProfileType } from 'shared/lib/core/profile'
6+
import { get, writable, Writable } from 'svelte/store'
77

8-
export const onboardingProfileSecretManager: Writable<SecretManager | null> = writable(null);
8+
export const onboardingProfileSecretManager: Writable<SecretManager | null> = writable(null)
99

10-
export async function buildOnboardingSecretManager(){
11-
const profile = get(onboardingProfile);
12-
if(profile){
13-
const { id, type, strongholdPassword } = profile;
10+
export async function buildOnboardingSecretManager() {
11+
const profile = get(onboardingProfile)
12+
if (profile) {
13+
const { id, type, strongholdPassword } = profile
1414

1515
const storagePath = await getStorageDirectoryOfProfile(id)
1616
const secretManagerOptions = getSecretManagerFromProfileType(type, {
17-
storagePath,
18-
strongholdPassword
17+
storagePath,
18+
strongholdPassword,
1919
})
20-
21-
const secretManager = await api.createSecretManager(secretManagerOptions);
20+
21+
const secretManager = await api.createSecretManager(secretManagerOptions)
2222

2323
onboardingProfileSecretManager.set(secretManager)
2424
} else {
@@ -30,9 +30,16 @@ export function isOnboardingSecretManagerInitialized(): boolean {
3030
return !!get(onboardingProfileSecretManager)
3131
}
3232

33-
export function getSecretManagerFromProfileType(type?: ProfileType, { storagePath, strongholdPassword }: {
34-
storagePath?: string, strongholdPassword?: string
35-
} = {}): SecretManagerType {
33+
export function getSecretManagerFromProfileType(
34+
type?: ProfileType,
35+
{
36+
storagePath,
37+
strongholdPassword,
38+
}: {
39+
storagePath?: string
40+
strongholdPassword?: string
41+
} = {}
42+
): SecretManagerType {
3643
const strongholdSecretManager = {
3744
stronghold: { snapshotPath: `${storagePath}/wallet.stronghold`, password: strongholdPassword },
3845
}
@@ -47,4 +54,4 @@ export function getSecretManagerFromProfileType(type?: ProfileType, { storagePat
4754
default:
4855
return strongholdSecretManager
4956
}
50-
}
57+
}

packages/shared/lib/core/ledger/actions/getAndUpdateLedgerNanoStatus.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import { resetLedgerNanoStatus, updateLedgerNanoStatus } from '../stores'
32

43
// TODO(2.0) Fix this, profile manager is gone

packages/shared/lib/core/ledger/utils/isLedgerDeviceMatchingActiveProfile.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ export async function isLedgerDeviceMatchingActiveProfile(): Promise<boolean | u
1212
}
1313

1414
const cachedAddress = wallet?.depositAddress
15-
const secretManager = getSecretManager();
15+
const secretManager = getSecretManager()
1616
const generatedAddresses = await secretManager.generateEd25519Addresses({
1717
accountIndex: 0,
1818
options: {
1919
internal: false,
2020
ledgerNanoPrompt: false,
21-
}
21+
},
2222
})
2323
const generatedAddress = generatedAddresses[0]
2424

packages/shared/lib/core/network/stores/node-info.store.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ export function setNodeInfo(newNodeInfo: INodeInfo | undefined): void {
77
return nodeInfo.set(newNodeInfo)
88
}
99

10-
export const nodeInfoNetworkName = derived(nodeInfo, ($nodeInfo) => $nodeInfo?.protocolParameters[0]?.parameters?.networkName)
10+
export const nodeInfoNetworkName = derived(
11+
nodeInfo,
12+
($nodeInfo) => $nodeInfo?.protocolParameters[0]?.parameters?.networkName
13+
)

0 commit comments

Comments
 (0)