Skip to content

Commit 7ab27c3

Browse files
feat: remove tanglebay node from all IOTA Mainnet profiles (#8720)
Co-authored-by: Begoña Álvarez de la Cruz <balvarez@boxfish.studio>
1 parent eae141b commit 7ab27c3

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

packages/shared/lib/core/network/constants/official-node-urls.constant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NetworkId } from '../enums'
22

33
export const OFFICIAL_NODE_URLS: Readonly<{ [key in NetworkId]?: string[] }> = {
4-
[NetworkId.Iota]: ['https://api.stardust-mainnet.iotaledger.net', 'https://iota-node.tanglebay.com'],
4+
[NetworkId.Iota]: ['https://api.stardust-mainnet.iotaledger.net'],
55
[NetworkId.IotaTestnet]: ['https://api.testnet.iotaledger.net'],
66
[NetworkId.IotaAlphanet]: ['https://api.iota-alphanet.iotaledger.net'],
77
[NetworkId.Shimmer]: ['https://api.shimmer.network'],

packages/shared/lib/core/network/tests/network.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('File: network.ts', () => {
2121
}
2222

2323
const EXPECTED_NODE_URLS: Readonly<{ [key in NetworkId]?: string[] }> = {
24-
[NetworkId.Iota]: ['https://api.stardust-mainnet.iotaledger.net', 'https://iota-node.tanglebay.com'],
24+
[NetworkId.Iota]: ['https://api.stardust-mainnet.iotaledger.net'],
2525
[NetworkId.IotaTestnet]: ['https://api.testnet.iotaledger.net'],
2626
[NetworkId.IotaAlphanet]: ['https://api.iota-alphanet.iotaledger.net'],
2727
[NetworkId.Shimmer]: ['https://api.shimmer.network'],

packages/shared/lib/core/profile/actions/profiles/checkAndMigrateProfiles.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const persistedProfileMigrationsMap: Record<number, (existingProfile: unknown) =
7777
17: persistedProfileMigrationToV18,
7878
18: persistedProfileMigrationToV19,
7979
19: persistedProfileMigrationToV20,
80+
20: persistedProfileMigrationToV21,
8081
}
8182

8283
function persistedProfileMigrationToV4(existingProfile: unknown): void {
@@ -374,3 +375,23 @@ function persistedProfileMigrationToV20(existingProfile: IPersistedProfile): voi
374375
}
375376
saveProfile(existingProfile)
376377
}
378+
379+
/*
380+
* Migration 21
381+
* Remove Tanglebay IOTA node from the list of nodes.
382+
*/
383+
function persistedProfileMigrationToV21(existingProfile: IPersistedProfile): void {
384+
const DEPRECATED_NODE_URL = 'https://iota-node.tanglebay.com'
385+
const OFFICIAL_NODES = getOfficialNodes(existingProfile.network.id)
386+
387+
const nodes = existingProfile.clientOptions.nodes ?? []
388+
existingProfile.clientOptions.nodes = nodes.filter((node) => node.url !== DEPRECATED_NODE_URL)
389+
if (!existingProfile.clientOptions.nodes?.length) {
390+
existingProfile.clientOptions.nodes = OFFICIAL_NODES
391+
}
392+
const primaryNode = existingProfile.clientOptions.primaryNode
393+
if (primaryNode?.url === DEPRECATED_NODE_URL) {
394+
existingProfile.clientOptions.primaryNode = undefined
395+
}
396+
saveProfile(existingProfile)
397+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const PROFILE_VERSION = 20
1+
export const PROFILE_VERSION = 21

0 commit comments

Comments
 (0)