From 7ac4d75a1896f300f146c2171c79d364037c7d4d Mon Sep 17 00:00:00 2001 From: kata Date: Wed, 30 Dec 2020 10:53:06 +0800 Subject: [PATCH 1/6] fix: avoid creating new http agents for every ckb sdk creation --- packages/neuron-wallet/src/services/sdk-core.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/neuron-wallet/src/services/sdk-core.ts b/packages/neuron-wallet/src/services/sdk-core.ts index 37758be25b..00a323977e 100644 --- a/packages/neuron-wallet/src/services/sdk-core.ts +++ b/packages/neuron-wallet/src/services/sdk-core.ts @@ -2,13 +2,14 @@ import CKB from '@nervosnetwork/ckb-sdk-core' import https from 'https' import http from 'http' +const httpsAgent = new https.Agent({ keepAlive: true }) +const httpAgent = new http.Agent({ keepAlive: true }) + export const generateCKB = (url: string): CKB => { const ckb = new CKB(url) if (url.startsWith('https')) { - const httpsAgent = new https.Agent({ keepAlive: true }) ckb.rpc.setNode({ url, httpsAgent }) } else { - const httpAgent = new http.Agent({ keepAlive: true }) ckb.rpc.setNode({ url, httpAgent }) } return ckb From a61e956f32ac4dbad80bfc870f7730b3c956b4ef Mon Sep 17 00:00:00 2001 From: kata Date: Wed, 30 Dec 2020 11:44:55 +0800 Subject: [PATCH 2/6] fix: use singleton for http(s) agents --- .../neuron-wallet/src/services/sdk-core.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/neuron-wallet/src/services/sdk-core.ts b/packages/neuron-wallet/src/services/sdk-core.ts index 00a323977e..915c8a6d70 100644 --- a/packages/neuron-wallet/src/services/sdk-core.ts +++ b/packages/neuron-wallet/src/services/sdk-core.ts @@ -2,15 +2,29 @@ import CKB from '@nervosnetwork/ckb-sdk-core' import https from 'https' import http from 'http' -const httpsAgent = new https.Agent({ keepAlive: true }) -const httpAgent = new http.Agent({ keepAlive: true }) +let httpsAgent: https.Agent +let httpAgent: http.Agent + +const getHttpsAgent = () => { + if (!httpsAgent) { + httpsAgent = new https.Agent({ keepAlive: true }) + } + return httpsAgent +} + +const getHttpAgent = () => { + if (!httpAgent) { + httpAgent = new http.Agent({ keepAlive: true }) + } + return httpAgent +} export const generateCKB = (url: string): CKB => { const ckb = new CKB(url) if (url.startsWith('https')) { - ckb.rpc.setNode({ url, httpsAgent }) + ckb.rpc.setNode({ url, httpsAgent: getHttpsAgent() }) } else { - ckb.rpc.setNode({ url, httpAgent }) + ckb.rpc.setNode({ url, httpAgent: getHttpAgent() }) } return ckb } From c7d3e3514bde53f73c070f74d9569dc122c88fae Mon Sep 17 00:00:00 2001 From: kata Date: Sat, 26 Dec 2020 11:44:17 +0800 Subject: [PATCH 3/6] fix: avoid installing newer version too soon after download progress approached 100% --- packages/neuron-wallet/src/controllers/update.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/neuron-wallet/src/controllers/update.ts b/packages/neuron-wallet/src/controllers/update.ts index 65f075b83a..5c323878e2 100644 --- a/packages/neuron-wallet/src/controllers/update.ts +++ b/packages/neuron-wallet/src/controllers/update.ts @@ -64,7 +64,10 @@ export default class UpdateController { }) autoUpdater.on('download-progress', progress => { - this.notify(progress.percent / 100) + const progressPercent = progress.percent / 100 + if (progressPercent !== 1) { + this.notify(progressPercent) + } }) autoUpdater.on('update-downloaded', () => { From 9d95ed6f19bf937d2162455ef948a434803c5f0c Mon Sep 17 00:00:00 2001 From: kata Date: Sun, 27 Dec 2020 16:08:07 +0800 Subject: [PATCH 4/6] chore: update ckb logo --- .../neuron-ui/src/widgets/Icons/Nervos.svg | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/neuron-ui/src/widgets/Icons/Nervos.svg b/packages/neuron-ui/src/widgets/Icons/Nervos.svg index 2ef2114b08..d333cfe6d0 100644 --- a/packages/neuron-ui/src/widgets/Icons/Nervos.svg +++ b/packages/neuron-ui/src/widgets/Icons/Nervos.svg @@ -1,15 +1,14 @@ + - - + logo/token/ckb + + - - - - - - - - + + + + + From d72c232e46f19f438177cee621144b7a373e52c6 Mon Sep 17 00:00:00 2001 From: kata Date: Mon, 28 Dec 2020 10:57:20 +0800 Subject: [PATCH 5/6] chore: rename name of bundled node from Mainnet to Default --- packages/neuron-wallet/src/services/networks.ts | 2 +- packages/neuron-wallet/tests/services/networks.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/neuron-wallet/src/services/networks.ts b/packages/neuron-wallet/src/services/networks.ts index 48698d4807..c07d055760 100644 --- a/packages/neuron-wallet/src/services/networks.ts +++ b/packages/neuron-wallet/src/services/networks.ts @@ -14,7 +14,7 @@ const presetNetworks: { selected: string, networks: Network[] } = { networks: [ { id: 'mainnet', - name: 'Mainnet', + name: 'Default', remote: 'http://localhost:8114', genesisHash: MAINNET_GENESIS_HASH, type: NetworkType.Default, diff --git a/packages/neuron-wallet/tests/services/networks.test.ts b/packages/neuron-wallet/tests/services/networks.test.ts index 0fb14ed6dd..23cc40a637 100644 --- a/packages/neuron-wallet/tests/services/networks.test.ts +++ b/packages/neuron-wallet/tests/services/networks.test.ts @@ -150,8 +150,8 @@ describe(`Unit tests of networks service`, () => { }) describe(`validation on network existence`, () => { - it(`create network with existing name of Mainnet`, () => { - expect(service.create('Mainnet', 'http://localhost:8114')).rejects.toThrowError(t(ERROR_MESSAGE.NAME_USED)) + it(`create network with existing name of Default`, () => { + expect(service.create('Default', 'http://localhost:8114')).rejects.toThrowError(t(ERROR_MESSAGE.NAME_USED)) }) it(`update network which is not existing`, () => { From 6bbb9a5605cc5ea232b666ae34f3d6a19deeba8e Mon Sep 17 00:00:00 2001 From: kellyshang Date: Thu, 31 Dec 2020 16:37:57 +0800 Subject: [PATCH 6/6] chore: bump version to v0.34.2, and update the CHANGELOG.md --- CHANGELOG.md | 12 ++++++++++++ lerna.json | 2 +- package.json | 2 +- packages/neuron-ui/package.json | 2 +- packages/neuron-wallet/package.json | 4 ++-- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6dc41a3b1..08ef1561fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# 0.34.2 (2020-12-31) + +[CKB v0.35.1](https://github.com/nervosnetwork/ckb/releases/tag/v0.35.1) was released on Sept. 14th, 2020. This version of CKB node is now bundled and preconfigured in Neuron. + +### Hotfix + +* Update the CKB logo. +* Rename the default network name to `Default`. +* Fix version updater error when clicking the install button too soon. +* Fix bug of `too many open files` error. + + # 0.34.1 (2020-12-19) [CKB v0.35.1](https://github.com/nervosnetwork/ckb/releases/tag/v0.35.1) was released on Sept. 14th, 2020. This version of CKB node is now bundled and preconfigured in Neuron. diff --git a/lerna.json b/lerna.json index 8ef6ae4c4a..4b7da27334 100644 --- a/lerna.json +++ b/lerna.json @@ -2,7 +2,7 @@ "packages": [ "packages/*" ], - "version": "0.34.1", + "version": "0.34.2", "npmClient": "yarn", "useWorkspaces": true } diff --git a/package.json b/package.json index 8ef61224c4..37622e73ab 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "neuron", "productName": "Neuron", "description": "CKB Neuron Wallet", - "version": "0.34.1", + "version": "0.34.2", "private": true, "author": { "name": "Nervos Core Dev", diff --git a/packages/neuron-ui/package.json b/packages/neuron-ui/package.json index 8289f183f3..9a0552eb20 100644 --- a/packages/neuron-ui/package.json +++ b/packages/neuron-ui/package.json @@ -1,6 +1,6 @@ { "name": "neuron-ui", - "version": "0.34.1", + "version": "0.34.2", "private": true, "author": { "name": "Nervos Core Dev", diff --git a/packages/neuron-wallet/package.json b/packages/neuron-wallet/package.json index ff8f1c1556..aa85a8b3d4 100644 --- a/packages/neuron-wallet/package.json +++ b/packages/neuron-wallet/package.json @@ -3,7 +3,7 @@ "productName": "Neuron", "description": "CKB Neuron Wallet", "homepage": "https://www.nervos.org/", - "version": "0.34.1", + "version": "0.34.2", "private": true, "author": { "name": "Nervos Core Dev", @@ -85,7 +85,7 @@ "electron-notarize": "0.2.1", "jest-when": "2.7.2", "lint-staged": "9.2.5", - "neuron-ui": "0.34.1", + "neuron-ui": "0.34.2", "rimraf": "3.0.0", "ttypescript": "1.5.10" }