Skip to content

Commit 414560e

Browse files
chore: code improvements low severity (#123)
* chore: mitigate 1 * chore: mitigate 2 * chore: mitigate 3 * chore: mitigate 4 * chore: mitigate 5 * chore: mitigate 6 * fix: remove true flag from migrateFunds and explorer variable name changes * fix: variable renaming --------- Co-authored-by: Branko Bosnic <[email protected]>
1 parent 09a3ac8 commit 414560e

File tree

8 files changed

+11
-28
lines changed

8 files changed

+11
-28
lines changed

packages/desktop/wallet.log

Whitespace-only changes.

packages/shared/lib/migration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const LEGACY_ADDRESS_WITHOUT_CHECKSUM_LENGTH = 81
3939
export const LOG_FILE_NAME = 'migration.log'
4040

4141
export const MIGRATION_NODES = ['https://nodes.iota.org', 'https://nodes.iota.cafe']
42-
export const PERMANODE = 'https://chronicle.iota.org/api'
4342

4443
export const ADDRESS_SECURITY_LEVEL = 2
4544

packages/shared/lib/network.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ import { activeProfile } from './profile'
1212
export const CHRYSALIS_MAINNET_ID = 'chrysalis-mainnet'
1313
export const CHRYSALIS_MAINNET_NAME = 'Chrysalis Mainnet'
1414
export const CHRYSALIS_MAINNET_BECH32_HRP = 'iota'
15-
export const CHRYSALIS_MAINNET_EXPLORER = 'https://explorer.iota.org/mainnet'
1615

1716
export const CHRYSALIS_DEVNET_ID = 'chrysalis-devnet'
1817
export const CHRYSALIS_DEVNET_NAME = 'Chrysalis Devnet'
1918
export const CHRYSALIS_DEVNET_BECH32_HRP = 'atoi'
20-
export const CHRYSALIS_DEVNET_EXPLORER = 'https://explorer.iota.org/devnet'
19+
20+
export const MAINNET_EXPLORER = 'https://explorer.iota.org/mainnet'
21+
export const DEVNET_EXPLORER = 'https://explorer.iota-alphanet.iotaledger.net/devnet'
2122

2223
/**
2324
* Given the type of IOTA network, construct the default official network
@@ -109,9 +110,9 @@ const getOfficialNode = (type: NetworkType, url: string): Node => ({
109110
export const getOfficialExplorer = (networkId: NetworkId): string => {
110111
switch (networkId) {
111112
case CHRYSALIS_MAINNET_ID:
112-
return CHRYSALIS_MAINNET_EXPLORER
113+
return MAINNET_EXPLORER
113114
case CHRYSALIS_DEVNET_ID:
114-
return CHRYSALIS_DEVNET_EXPLORER
115+
return DEVNET_EXPLORER
115116
default:
116117
return ''
117118
}

packages/shared/routes/setup/Balance.svelte

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@
5555
let error = getError(balance)
5656
let formattedBalance = formatUnitBestMatch(balance, true)
5757
58-
// TODO: add missing unsubscribe to onDestroy
5958
bundles.subscribe((updatedBundles) => {
6059
_bundles = updatedBundles
6160
error = getError(_data.balance)
6261
})
6362
64-
// TODO: add missing unsubscribe to onDestroy
6563
unselectedInputs.subscribe(() => {
6664
error = getError(_data.balance)
6765
})
@@ -130,7 +128,6 @@
130128
function checkAgain(): void {
131129
isCheckingForBalance = true
132130
if (legacyLedger) {
133-
// TODO: add ledger legacy popup when PR merged
134131
const _onConnected = () => {
135132
Platform.ledger
136133
.selectSeed($hardwareIndexes.accountIndex, $hardwareIndexes.pageIndex, ADDRESS_SECURITY_LEVEL)

packages/shared/routes/setup/Congratulations.svelte

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import { SetupType } from 'shared/lib/typings/setup'
2121
import { formatUnitBestMatch } from 'shared/lib/units'
2222
import { api, walletSetupType } from 'shared/lib/wallet'
23+
import { MAINNET_EXPLORER, DEVNET_EXPLORER } from 'shared/lib/network'
2324
import { onMount } from 'svelte'
2425
import { get } from 'svelte/store'
2526
@@ -109,13 +110,8 @@
109110
}
110111
111112
function consultExplorerClick() {
112-
let urlToOpen = ''
113-
if ($activeProfile.isDeveloperProfile) {
114-
urlToOpen = `https://explorer.iota-alphanet.iotaledger.net/devnet/addr/${$migrationAddress.bech32}`
115-
} else {
116-
urlToOpen = `https://explorer.iota.org/mainnet/addr/${$migrationAddress.bech32}`
117-
}
118-
Platform.openUrl(urlToOpen)
113+
const baseUrl = $activeProfile.isDeveloperProfile ? DEVNET_EXPLORER : MAINNET_EXPLORER
114+
Platform.openUrl(`${baseUrl}/addr/${$migrationAddress.bech32}`)
119115
}
120116
121117
function migrateAnotherProfile(): void {

packages/shared/routes/setup/Welcome.svelte

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
Text,
1212
} from 'shared/components'
1313
import { stage } from 'shared/lib/app'
14-
import { initAppSettings } from 'shared/lib/appSettings'
1514
import { initialiseMigrationListeners } from 'shared/lib/migration'
1615
import { showAppNotification } from 'shared/lib/notifications'
1716
import { Platform } from 'shared/lib/platform'
@@ -23,9 +22,6 @@
2322
2423
export let locale: Locale
2524
26-
let error = ''
27-
let busy = false
28-
2925
const TMP_PROFILE_NAME = 'MigrationProfile'
3026
let isDeveloperProfile = $newProfile?.isDeveloperProfile ?? get(stage) !== Stage.PROD
3127
@@ -38,7 +34,7 @@
3834
try {
3935
validateProfileName(trimmedProfileName)
4036
} catch (err) {
41-
return (error = err.message)
37+
return
4238
}
4339
cleanUpIfPreviouslyInitialized()
4440
await initialiseProfileAndContinue(trimmedProfileName)
@@ -53,7 +49,6 @@
5349
5450
async function initialiseProfileAndContinue(name: string): Promise<void> {
5551
try {
56-
busy = true
5752
if (hasDeveloperProfileChanged) {
5853
storeProfile(name, isDeveloperProfile)
5954
@@ -78,8 +73,6 @@
7873
type: 'error',
7974
message: locale(err.error ? err.error : 'error.global.generic'),
8075
})
81-
} finally {
82-
busy = false
8376
}
8477
}
8578
</script>

packages/shared/routes/setup/migrate/views/Migrate.svelte

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@
5656
5757
let timeout
5858
59-
let singleMigrationBundleHash
60-
6159
let hasError: boolean = false
6260
6361
const legacyLedger = $walletSetupType === SetupType.TrinityLedger
@@ -95,7 +93,6 @@
9593
})
9694
.then(({ trytes, bundleHash }) => {
9795
closePopup(true) // close transaction popup
98-
singleMigrationBundleHash = bundleHash
9996
const reverseTrytesLedger = trytes.reverse()
10097
updateMigrationLog(get(migrationLog).length - 1, {
10198
trytes: reverseTrytesLedger,

packages/shared/routes/setup/migrate/views/TransferFragmentedFunds.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
return item
159159
})
160160
161-
migrateFunds(true)
161+
migrateFunds()
162162
}
163163
164164
function persistProfile() {
@@ -201,7 +201,7 @@
201201
}
202202
}
203203
204-
function migrateFunds(isRerun?: boolean) {
204+
function migrateFunds() {
205205
migratingFundsMessage = locale('views.migrate.migrating')
206206
207207
transactions.reduce(

0 commit comments

Comments
 (0)