From e167623863c7adc999d63d43879b7f9b50223c6a Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Tue, 14 Nov 2023 10:24:57 +0800 Subject: [PATCH 1/4] fix: Fix migrate settings and network. --- packages/neuron-wallet/src/services/networks.ts | 3 ++- packages/neuron-wallet/src/services/settings.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/neuron-wallet/src/services/networks.ts b/packages/neuron-wallet/src/services/networks.ts index dae5a9eb2f..7ef1866be9 100644 --- a/packages/neuron-wallet/src/services/networks.ts +++ b/packages/neuron-wallet/src/services/networks.ts @@ -66,6 +66,7 @@ enum NetworksKey { } const oldDefaultNames = ['Default', 'default node', presetNetworks.networks[0].name] +const oldDefaultRemotes = ['http://localhost:8114', BUNDLED_CKB_URL] export default class NetworksService extends Store { private static instance: NetworksService @@ -263,7 +264,7 @@ export default class NetworksService extends Store { if ( // make sure that user has not change the network name oldDefaultNames.includes(oldMainnetNetwork.name) && - oldMainnetNetwork.remote === defaultMainnetNetwork.remote && + oldDefaultRemotes.includes(oldMainnetNetwork.remote) && oldMainnetNetwork.type === defaultMainnetNetwork.type ) { this.updateAll([ diff --git a/packages/neuron-wallet/src/services/settings.ts b/packages/neuron-wallet/src/services/settings.ts index 39190a46e1..26a4d71f4f 100644 --- a/packages/neuron-wallet/src/services/settings.ts +++ b/packages/neuron-wallet/src/services/settings.ts @@ -93,8 +93,8 @@ export default class SettingsService extends Store { migrateDataPath() { const networkChain = NetworksService.getInstance().getCurrent()?.chain const currentCkbDataPath = this.readSync(settingKeys.ckbDataPath) - this.writeSync(`${settingKeys.nodeDataPath}_${networkChain}`, currentCkbDataPath) const defaultMainNetworkDir = path.resolve(app.getPath('userData'), 'chains/mainnet') + this.writeSync(`${settingKeys.nodeDataPath}_${networkChain}`, currentCkbDataPath || defaultMainNetworkDir) if (networkChain !== 'ckb') { // if user has changed the ckb data path and running with testnet this.writeSync(`${settingKeys.nodeDataPath}_ckb`, defaultMainNetworkDir) From ea8712510405f098d42763bf65b46a6b29f2c3e3 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Tue, 14 Nov 2023 12:04:25 +0800 Subject: [PATCH 2/4] fix: Run migrate ckb node data is undefined. --- packages/neuron-wallet/src/services/settings.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/neuron-wallet/src/services/settings.ts b/packages/neuron-wallet/src/services/settings.ts index 26a4d71f4f..02629f021e 100644 --- a/packages/neuron-wallet/src/services/settings.ts +++ b/packages/neuron-wallet/src/services/settings.ts @@ -80,7 +80,7 @@ export default class SettingsService extends Store { ckbDataPath: path.resolve(app.getPath('userData'), 'chains/mainnet'), }) ) - if (!this.getNodeDataPath(LIGHT_CLIENT_MAINNET)) { + if (!this.getNodeDataPath(LIGHT_CLIENT_MAINNET) || !this.getNodeDataPath('ckb')) { this.migrateDataPath() } } From 10c65b025fc09181ee77febfed4a412a7c5abc57 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Tue, 14 Nov 2023 13:56:00 +0800 Subject: [PATCH 3/4] fix: Add comment for http://localhost:8114 --- packages/neuron-wallet/src/services/networks.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/neuron-wallet/src/services/networks.ts b/packages/neuron-wallet/src/services/networks.ts index 7ef1866be9..20cf013a0d 100644 --- a/packages/neuron-wallet/src/services/networks.ts +++ b/packages/neuron-wallet/src/services/networks.ts @@ -66,6 +66,7 @@ enum NetworksKey { } const oldDefaultNames = ['Default', 'default node', presetNetworks.networks[0].name] +// Before 0.106.0 version the default remote's value is http://localhost:8114. const oldDefaultRemotes = ['http://localhost:8114', BUNDLED_CKB_URL] export default class NetworksService extends Store { From aaea80d7223c91b58b3cf1668295e8f37aa1c0d9 Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Tue, 14 Nov 2023 14:02:27 +0800 Subject: [PATCH 4/4] fix: Add deprecated reason. --- packages/neuron-wallet/src/services/networks.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/neuron-wallet/src/services/networks.ts b/packages/neuron-wallet/src/services/networks.ts index 20cf013a0d..8dfbb39fa0 100644 --- a/packages/neuron-wallet/src/services/networks.ts +++ b/packages/neuron-wallet/src/services/networks.ts @@ -66,7 +66,8 @@ enum NetworksKey { } const oldDefaultNames = ['Default', 'default node', presetNetworks.networks[0].name] -// Before 0.106.0 version the default remote's value is http://localhost:8114. +// Before 0.106.0 version the default remote's value is http://localhost:8114 +// "localhost" was deprecated because of https://github.com/Magickbase/neuron-public-issues/issues/122 const oldDefaultRemotes = ['http://localhost:8114', BUNDLED_CKB_URL] export default class NetworksService extends Store {