From 0fce9e8196319cb6702110b42f3538dd34fde83a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2019 21:30:27 +0000 Subject: [PATCH 01/11] chore(deps-dev): bump eslint-plugin-jest from 22.9.0 to 22.14.0 Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 22.9.0 to 22.14.0. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v22.9.0...v22.14.0) Signed-off-by: dependabot-preview[bot] --- yarn.lock | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 191e56cb..306510da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1280,7 +1280,7 @@ regexpp "^2.0.1" tsutils "^3.7.0" -"@typescript-eslint/experimental-utils@1.13.0": +"@typescript-eslint/experimental-utils@1.13.0", "@typescript-eslint/experimental-utils@^1.13.0": version "1.13.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz#b08c60d780c0067de2fb44b04b432f540138301e" integrity sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg== @@ -2667,9 +2667,11 @@ eslint-plugin-import@^2.14.0: resolve "^1.11.0" eslint-plugin-jest@^22.1.2: - version "22.9.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.9.0.tgz#2573dbcb4f1066b96a6e6d3b9aa439c80b28975a" - integrity sha512-V89BUiwf76FHlhj1mlNhNyvpzTy8VbWCh2RZpKYz/XDSl/pcuwFiE/LMt7r3q1sRKygzEMjbYeDob8MMuvakXg== + version "22.14.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.14.0.tgz#f9b09837f665cfe360b55c08866904255294cc16" + integrity sha512-Xtc9ZTtxdYFC7vu0PHxDeQ9lOMQ8gjwMmSQq/ni83TdflgL3eVh/qg3t99I7gcDxpeXfcp+lHu9C0vN3QAhATw== + dependencies: + "@typescript-eslint/experimental-utils" "^1.13.0" eslint-plugin-prettier@^3.0.0: version "3.1.0" From ed55a28f057dcca2b4a3c76c51461f7312aa4762 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2019 21:30:38 +0000 Subject: [PATCH 02/11] chore(deps-dev): bump @types/node from 12.6.4 to 12.6.8 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.6.4 to 12.6.8. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 191e56cb..ea4d7078 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1242,9 +1242,9 @@ integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== "@types/node@*", "@types/node@^12.0.0": - version "12.6.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.4.tgz#e0b5ac3ccbf183cd3c230967c323632d6cf927ae" - integrity sha512-ZKrDzI6KhrqtLpccI1YxMh4d+qzNnftNtp6iL9c4mLTNgzguFu7VR7pXH/C/MfzikMeoXjvISL9mlIGNGGDXDg== + version "12.6.8" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.8.tgz#e469b4bf9d1c9832aee4907ba8a051494357c12c" + integrity sha512-aX+gFgA5GHcDi89KG5keey2zf0WfZk/HAQotEamsK2kbey+8yGKcson0hbK8E+v0NArlCJQCqMP161YhV6ZXLg== "@types/normalize-package-data@^2.4.0": version "2.4.0" From 323b8ac0cce69dcd61d4beac740d7004e85f0b6f Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 29 Jul 2019 21:06:46 +0800 Subject: [PATCH 03/11] feat(rpc): add rpc of get banned addresses --- .../__tests__/formatters/result.json | 74 ++++++++++++++----- packages/ckb-sdk-rpc/src/defaultRPC.ts | 8 ++ packages/ckb-sdk-rpc/src/resultFormatter.ts | 14 ++++ packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts | 8 ++ packages/ckb-types/index.d.ts | 9 +++ 5 files changed, 95 insertions(+), 18 deletions(-) diff --git a/packages/ckb-sdk-rpc/__tests__/formatters/result.json b/packages/ckb-sdk-rpc/__tests__/formatters/result.json index 31119b84..79e61b76 100644 --- a/packages/ckb-sdk-rpc/__tests__/formatters/result.json +++ b/packages/ckb-sdk-rpc/__tests__/formatters/result.json @@ -779,40 +779,42 @@ "toHeader": [ { "source": { - "difficulty": "0x100", - "hash": "0xe5f2d07b747f38718293987a9175764d4c03229a8a69d0bd48f7bea6c18930b1", - "number": "2", + "dao": "0x01000000000000000000c16ff286230000203d88792d0000000961f400000000", + "difficulty": "0x3e8", "epoch": "0", - "parent_hash": "0xa1dba96cdebaa25f2be69316c943269e23c23fcc6e90eedd94ecd88b43f77170", + "hash": "0xba0d878d2c3711d38b5ddc2bc917312ca3898cad98457cc7960e28ec31f26e7f", + "number": "1024", + "parent_hash": "0x3533d5f0882a60d3b25b7dd57002a5d9eb591e89a98231e8abc5bf48f7ee0592", "proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "seal": { - "nonce": "9828930232171500901", - "proof": "0x7408000066230000942c00004735000028420000f046000059550000d56200005f640000f96a000043730000d3750000" + "nonce": "0", + "proof": "0x" }, - "timestamp": "1556199760706", - "transactions_root": "0x8027376875e45318ed469bed6314408e8f1986de246cbd03a786b69073c948b8", + "timestamp": "1557311767", + "transactions_root": "0x81389ffabda2d1658c75a81e390a82b335d4cb849b2269d134b042fea9cb9513", "uncles_count": "0", "uncles_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "version": "0", - "witnesses_root": "0x0000000000000000000000000000000000000000000000000000000000000000" + "witnesses_root": "0xb36423f72fd5cdbf6297c189b9d74e970bf0b971a537f41b8334088afe27900a" }, "target": { - "difficulty": "0x100", - "hash": "0xe5f2d07b747f38718293987a9175764d4c03229a8a69d0bd48f7bea6c18930b1", - "number": "2", + "dao": "0x01000000000000000000c16ff286230000203d88792d0000000961f400000000", + "difficulty": "0x3e8", "epoch": "0", - "parentHash": "0xa1dba96cdebaa25f2be69316c943269e23c23fcc6e90eedd94ecd88b43f77170", + "hash": "0xba0d878d2c3711d38b5ddc2bc917312ca3898cad98457cc7960e28ec31f26e7f", + "number": "1024", + "parentHash": "0x3533d5f0882a60d3b25b7dd57002a5d9eb591e89a98231e8abc5bf48f7ee0592", "proposalsHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "seal": { - "nonce": "9828930232171500901", - "proof": "0x7408000066230000942c00004735000028420000f046000059550000d56200005f640000f96a000043730000d3750000" + "nonce": "0", + "proof": "0x" }, - "timestamp": "1556199760706", - "transactionsRoot": "0x8027376875e45318ed469bed6314408e8f1986de246cbd03a786b69073c948b8", + "timestamp": "1557311767", + "transactionsRoot": "0x81389ffabda2d1658c75a81e390a82b335d4cb849b2269d134b042fea9cb9513", "unclesCount": "0", "unclesHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "version": "0", - "witnessesRoot": "0x0000000000000000000000000000000000000000000000000000000000000000" + "witnessesRoot": "0xb36423f72fd5cdbf6297c189b9d74e970bf0b971a537f41b8334088afe27900a" } } ], @@ -1067,6 +1069,42 @@ } ] } + ], + "toBannedAddress": [ + { + "source": { + "address": "192.168.0.2/32", + "ban_reason": "", + "ban_until": "1840546800000", + "created_at": "1562803123000" + }, + "target": { + "address": "192.168.0.2/32", + "banReason": "", + "banUntil": "1840546800000", + "createdAt": "1562803123000" + } + } + ], + "toBannedAddresses": [ + { + "source": [ + { + "address": "192.168.0.2/32", + "ban_reason": "", + "ban_until": "1840546800000", + "created_at": "1562803123000" + } + ], + "target": [ + { + "address": "192.168.0.2/32", + "banReason": "", + "banUntil": "1840546800000", + "createdAt": "1562803123000" + } + ] + } ] }, "failure": {} diff --git a/packages/ckb-sdk-rpc/src/defaultRPC.ts b/packages/ckb-sdk-rpc/src/defaultRPC.ts index e3d31d7a..5ca8f87b 100644 --- a/packages/ckb-sdk-rpc/src/defaultRPC.ts +++ b/packages/ckb-sdk-rpc/src/defaultRPC.ts @@ -131,6 +131,12 @@ const defaultRPC: CKBComponents.Method[] = [ paramsFormatters: [paramsFmts.toHash], resultFormatters: resultFmts.toLockHashIndexState, }, + { + name: 'getBannedAddresses', + method: 'get_banned_addresses', + paramsFormatters: [], + resultFormatters: resultFmts.toBannedAddresses, + }, ] export class DefaultRPC { @@ -364,6 +370,8 @@ export class DefaultRPC { lockHash: CKBComponents.Hash, indexFrom?: CKBComponents.BlockNumber ) => Promise + + public getBannedAddresses!: () => Promise } export default DefaultRPC diff --git a/packages/ckb-sdk-rpc/src/resultFormatter.ts b/packages/ckb-sdk-rpc/src/resultFormatter.ts index 240f4f69..6214f851 100644 --- a/packages/ckb-sdk-rpc/src/resultFormatter.ts +++ b/packages/ckb-sdk-rpc/src/resultFormatter.ts @@ -237,6 +237,20 @@ const formatter = { if (!states) return states return states.map(formatter.toLockHashIndexState) }, + toBannedAddress: (bannedAddress: CKB_RPC.BannedAddress): CKBComponents.BannedAddress => { + if (!bannedAddress) return bannedAddress + const { ban_reason: banReason, ban_until: banUntil, created_at: createdAt, ...rest } = bannedAddress + return { + banReason, + banUntil, + createdAt, + ...rest, + } + }, + toBannedAddresses: (bannedAddresses: CKB_RPC.BannedAddresses): CKBComponents.BannedAddresses => { + if (!bannedAddresses) return bannedAddresses + return bannedAddresses.map(banAddr => formatter.toBannedAddress(banAddr)) + }, } export default formatter diff --git a/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts b/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts index 92f65081..123002a5 100644 --- a/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts +++ b/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts @@ -185,5 +185,13 @@ declare module CKB_RPC { } export type LockHashIndexStates = LockHashIndexState[] + + export interface BannedAddress { + address: string + ban_reason: string + ban_until: Timestamp + created_at: Timestamp + } + export type BannedAddresses = BannedAddress[] } /* eslint-enable camelcase */ diff --git a/packages/ckb-types/index.d.ts b/packages/ckb-types/index.d.ts index 75228411..ac22dbd1 100644 --- a/packages/ckb-types/index.d.ts +++ b/packages/ckb-types/index.d.ts @@ -328,4 +328,13 @@ declare namespace CKBComponents { } export type LockHashIndexStates = LockHashIndexState[] + + export interface BannedAddress { + address: string + banReason: string + banUntil: Timestamp + createdAt: Timestamp + } + + export type BannedAddresses = BannedAddress[] } From 416e7fd087b2e1e9674804c82dc5ee09cf9f5431 Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 29 Jul 2019 21:19:31 +0800 Subject: [PATCH 04/11] feat(rpc): add new rpc of set ban --- .../ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js | 4 +-- .../ckb-sdk-rpc/__tests__/ckb-rpc.test.js | 15 +++++++++++ packages/ckb-sdk-rpc/src/defaultRPC.ts | 26 +++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js b/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js index ff763d47..b540635e 100644 --- a/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js +++ b/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js @@ -40,8 +40,8 @@ describe('ckb-rpc settings and helpers', () => { expect(rpc.node).toEqual(node) }) - it('has 22 default rpc', () => { - expect(rpc.methods.length).toBe(22) + it('has 24 default rpc', () => { + expect(rpc.methods.length).toBe(24) }) it('set node url to http://test.localhost:8114', () => { diff --git a/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js b/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js index 552f9860..e58fe5e6 100644 --- a/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js +++ b/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js @@ -95,6 +95,21 @@ describe('ckb-rpc success', () => { it('get transactions by lock hash', async () => {}) it('index lock hash', async () => {}) + + it('get banned addresses', async () => { + const addresses = await rpc.getBannedAddresses() + expect(Array.isArray(addresses)).toBe(true) + }) + + it('set address to be banned', async () => { + expect.assertions(1) + await expect(rpc.setBan('192.168.0.2', 'insert', null)).resolves.toEqual(null) + }) + + it('get banned address', async () => { + const addresses = await rpc.getBannedAddresses() + expect(Array.isArray(addresses)).toBe(true) + }) }) describe('send transaction', () => { diff --git a/packages/ckb-sdk-rpc/src/defaultRPC.ts b/packages/ckb-sdk-rpc/src/defaultRPC.ts index 5ca8f87b..ae59000e 100644 --- a/packages/ckb-sdk-rpc/src/defaultRPC.ts +++ b/packages/ckb-sdk-rpc/src/defaultRPC.ts @@ -137,6 +137,11 @@ const defaultRPC: CKBComponents.Method[] = [ paramsFormatters: [], resultFormatters: resultFmts.toBannedAddresses, }, + { + name: 'setBan', + method: 'set_ban', + paramsFormatters: [], + }, ] export class DefaultRPC { @@ -372,6 +377,27 @@ export class DefaultRPC { ) => Promise public getBannedAddresses!: () => Promise + /** + * @method setBan + * @memberof DefaultRPC + * @description insert or delete an IP/Subnet from the banned list + * @param {string} address, The IP/Subnet with an optional netmask (default is /32 = single IP) + * @param {insert|delete} command, `insert` to insert an IP/Subnet to the list, `delete` to delete an IP/Subnet + * from the list + * @param {string|null} ban_time, Time in milliseconds how long (or until when if [absolute] is set) the IP is banned, + * optional parameter, null means using the default time of 24h + * @param {[boolean]} absolute, If set, the `ban_time` must be an absolute timestamp in milliseconds since epoch, + * optional parameter + * @param {[string]} reason, Ban reason, optional parameter + */ + + public setBan!: ( + address: string, + command: 'insert' | 'delete', + banTime: string | null, + absolute?: boolean, + reason?: string + ) => Promise } export default DefaultRPC From d2a6bbbcc4329207cb72553d30fb87ec6f186575 Mon Sep 17 00:00:00 2001 From: Keith Date: Tue, 30 Jul 2019 21:07:50 +0800 Subject: [PATCH 05/11] feat(rpc): add get_header rpc --- .../ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js | 4 +- .../ckb-sdk-rpc/__tests__/ckb-rpc.test.js | 8 ++ .../__tests__/formatters/result.json | 114 +++++++++--------- packages/ckb-sdk-rpc/src/defaultRPC.ts | 8 ++ packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts | 19 +-- packages/ckb-types/index.d.ts | 38 +++--- 6 files changed, 109 insertions(+), 82 deletions(-) diff --git a/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js b/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js index b540635e..f58bd582 100644 --- a/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js +++ b/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js @@ -40,8 +40,8 @@ describe('ckb-rpc settings and helpers', () => { expect(rpc.node).toEqual(node) }) - it('has 24 default rpc', () => { - expect(rpc.methods.length).toBe(24) + it('has 25 default rpc', () => { + expect(rpc.methods.length).toBe(25) }) it('set node url to http://test.localhost:8114', () => { diff --git a/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js b/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js index e58fe5e6..a2e80236 100644 --- a/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js +++ b/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js @@ -110,6 +110,14 @@ describe('ckb-rpc success', () => { const addresses = await rpc.getBannedAddresses() expect(Array.isArray(addresses)).toBe(true) }) + + it('get header', async () => { + const zeroBlock = await rpc.getBlockByNumber('0') + const zeroBlockHeader = zeroBlock.header + const zeroBlockHash = zeroBlockHeader.hash + const header = await rpc.getHeader(zeroBlockHash) + expect(header).toEqual(zeroBlockHeader) + }) }) describe('send transaction', () => { diff --git a/packages/ckb-sdk-rpc/__tests__/formatters/result.json b/packages/ckb-sdk-rpc/__tests__/formatters/result.json index 79e61b76..56dd0859 100644 --- a/packages/ckb-sdk-rpc/__tests__/formatters/result.json +++ b/packages/ckb-sdk-rpc/__tests__/formatters/result.json @@ -248,43 +248,45 @@ { "source": { "header": { - "difficulty": "0x100", - "hash": "0xe5f2d07b747f38718293987a9175764d4c03229a8a69d0bd48f7bea6c18930b1", - "number": "2", + "dao": "0x010000000000000063ae2493990ab00000f0c890408900000061eb7ada030000", + "difficulty": "0x3e8", "epoch": "0", - "parent_hash": "0xa1dba96cdebaa25f2be69316c943269e23c23fcc6e90eedd94ecd88b43f77170", + "hash": "0x0a663a245ae0b3545a24e4ec06066b9e9f0bd32e5fdbb9038ec15af59ef2593d", + "number": "1024", + "parent_hash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87", "proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "seal": { - "nonce": "9828930232171500901", - "proof": "0x7408000066230000942c00004735000028420000f046000059550000d56200005f640000f96a000043730000d3750000" + "nonce": "0", + "proof": "0x" }, - "timestamp": "1556199760706", - "transactions_root": "0x8027376875e45318ed469bed6314408e8f1986de246cbd03a786b69073c948b8", + "timestamp": "1557311767", + "transactions_root": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b", "uncles_count": "0", "uncles_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "version": "0", - "witnesses_root": "0x0000000000000000000000000000000000000000000000000000000000000000" + "witnesses_root": "0x688c1ff7df5b9b454bd76a031d40e13b4e462aeee5f8497d0f9f6f1dbd5d8111" }, "proposals": [] }, "target": { "header": { - "difficulty": "0x100", - "hash": "0xe5f2d07b747f38718293987a9175764d4c03229a8a69d0bd48f7bea6c18930b1", - "number": "2", + "dao": "0x010000000000000063ae2493990ab00000f0c890408900000061eb7ada030000", + "difficulty": "0x3e8", "epoch": "0", - "parentHash": "0xa1dba96cdebaa25f2be69316c943269e23c23fcc6e90eedd94ecd88b43f77170", + "hash": "0x0a663a245ae0b3545a24e4ec06066b9e9f0bd32e5fdbb9038ec15af59ef2593d", + "number": "1024", + "parentHash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87", "proposalsHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "seal": { - "nonce": "9828930232171500901", - "proof": "0x7408000066230000942c00004735000028420000f046000059550000d56200005f640000f96a000043730000d3750000" + "nonce": "0", + "proof": "0x" }, - "timestamp": "1556199760706", - "transactionsRoot": "0x8027376875e45318ed469bed6314408e8f1986de246cbd03a786b69073c948b8", + "timestamp": "1557311767", + "transactionsRoot": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b", "unclesCount": "0", "unclesHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "version": "0", - "witnessesRoot": "0x0000000000000000000000000000000000000000000000000000000000000000" + "witnessesRoot": "0x688c1ff7df5b9b454bd76a031d40e13b4e462aeee5f8497d0f9f6f1dbd5d8111" }, "proposals": [] } @@ -294,22 +296,23 @@ { "source": { "header": { - "difficulty": "0x100", - "hash": "0xe5f2d07b747f38718293987a9175764d4c03229a8a69d0bd48f7bea6c18930b1", - "number": "2", + "dao": "0x010000000000000063ae2493990ab00000f0c890408900000061eb7ada030000", + "difficulty": "0x3e8", "epoch": "0", - "parent_hash": "0xa1dba96cdebaa25f2be69316c943269e23c23fcc6e90eedd94ecd88b43f77170", + "hash": "0x0a663a245ae0b3545a24e4ec06066b9e9f0bd32e5fdbb9038ec15af59ef2593d", + "number": "1024", + "parent_hash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87", "proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "seal": { - "nonce": "9828930232171500901", - "proof": "0x7408000066230000942c00004735000028420000f046000059550000d56200005f640000f96a000043730000d3750000" + "nonce": "0", + "proof": "0x" }, - "timestamp": "1556199760706", - "transactions_root": "0x8027376875e45318ed469bed6314408e8f1986de246cbd03a786b69073c948b8", + "timestamp": "1557311767", + "transactions_root": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b", "uncles_count": "0", "uncles_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "version": "0", - "witnesses_root": "0x0000000000000000000000000000000000000000000000000000000000000000" + "witnesses_root": "0x688c1ff7df5b9b454bd76a031d40e13b4e462aeee5f8497d0f9f6f1dbd5d8111" }, "proposals": [], "transactions": [ @@ -348,22 +351,23 @@ }, "target": { "header": { - "difficulty": "0x100", - "hash": "0xe5f2d07b747f38718293987a9175764d4c03229a8a69d0bd48f7bea6c18930b1", - "number": "2", + "dao": "0x010000000000000063ae2493990ab00000f0c890408900000061eb7ada030000", + "difficulty": "0x3e8", "epoch": "0", - "parentHash": "0xa1dba96cdebaa25f2be69316c943269e23c23fcc6e90eedd94ecd88b43f77170", + "hash": "0x0a663a245ae0b3545a24e4ec06066b9e9f0bd32e5fdbb9038ec15af59ef2593d", + "number": "1024", + "parentHash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87", "proposalsHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "seal": { - "nonce": "9828930232171500901", - "proof": "0x7408000066230000942c00004735000028420000f046000059550000d56200005f640000f96a000043730000d3750000" + "nonce": "0", + "proof": "0x" }, - "timestamp": "1556199760706", - "transactionsRoot": "0x8027376875e45318ed469bed6314408e8f1986de246cbd03a786b69073c948b8", + "timestamp": "1557311767", + "transactionsRoot": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b", "unclesCount": "0", "unclesHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "version": "0", - "witnessesRoot": "0x0000000000000000000000000000000000000000000000000000000000000000" + "witnessesRoot": "0x688c1ff7df5b9b454bd76a031d40e13b4e462aeee5f8497d0f9f6f1dbd5d8111" }, "proposals": [], "transactions": [ @@ -404,43 +408,45 @@ { "source": { "header": { - "difficulty": "0x100", - "hash": "0xe5f2d07b747f38718293987a9175764d4c03229a8a69d0bd48f7bea6c18930b1", - "number": "2", + "dao": "0x010000000000000063ae2493990ab00000f0c890408900000061eb7ada030000", + "difficulty": "0x3e8", "epoch": "0", - "parent_hash": "0xa1dba96cdebaa25f2be69316c943269e23c23fcc6e90eedd94ecd88b43f77170", + "hash": "0x0a663a245ae0b3545a24e4ec06066b9e9f0bd32e5fdbb9038ec15af59ef2593d", + "number": "1024", + "parent_hash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87", "proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "seal": { - "nonce": "9828930232171500901", - "proof": "0x7408000066230000942c00004735000028420000f046000059550000d56200005f640000f96a000043730000d3750000" + "nonce": "0", + "proof": "0x" }, - "timestamp": "1556199760706", - "transactions_root": "0x8027376875e45318ed469bed6314408e8f1986de246cbd03a786b69073c948b8", + "timestamp": "1557311767", + "transactions_root": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b", "uncles_count": "0", "uncles_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "version": "0", - "witnesses_root": "0x0000000000000000000000000000000000000000000000000000000000000000" + "witnesses_root": "0x688c1ff7df5b9b454bd76a031d40e13b4e462aeee5f8497d0f9f6f1dbd5d8111" }, "proposals": [] }, "target": { "header": { - "difficulty": "0x100", - "hash": "0xe5f2d07b747f38718293987a9175764d4c03229a8a69d0bd48f7bea6c18930b1", - "number": "2", + "dao": "0x010000000000000063ae2493990ab00000f0c890408900000061eb7ada030000", + "difficulty": "0x3e8", "epoch": "0", - "parentHash": "0xa1dba96cdebaa25f2be69316c943269e23c23fcc6e90eedd94ecd88b43f77170", + "hash": "0x0a663a245ae0b3545a24e4ec06066b9e9f0bd32e5fdbb9038ec15af59ef2593d", + "number": "1024", + "parentHash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87", "proposalsHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "seal": { - "nonce": "9828930232171500901", - "proof": "0x7408000066230000942c00004735000028420000f046000059550000d56200005f640000f96a000043730000d3750000" + "nonce": "0", + "proof": "0x" }, - "timestamp": "1556199760706", - "transactionsRoot": "0x8027376875e45318ed469bed6314408e8f1986de246cbd03a786b69073c948b8", + "timestamp": "1557311767", + "transactionsRoot": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b", "unclesCount": "0", "unclesHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "version": "0", - "witnessesRoot": "0x0000000000000000000000000000000000000000000000000000000000000000" + "witnessesRoot": "0x688c1ff7df5b9b454bd76a031d40e13b4e462aeee5f8497d0f9f6f1dbd5d8111" }, "proposals": [], "transactions": [], diff --git a/packages/ckb-sdk-rpc/src/defaultRPC.ts b/packages/ckb-sdk-rpc/src/defaultRPC.ts index ae59000e..b6fac55d 100644 --- a/packages/ckb-sdk-rpc/src/defaultRPC.ts +++ b/packages/ckb-sdk-rpc/src/defaultRPC.ts @@ -142,6 +142,12 @@ const defaultRPC: CKBComponents.Method[] = [ method: 'set_ban', paramsFormatters: [], }, + { + name: 'getHeader', + method: 'get_header', + paramsFormatters: [paramsFmts.toHash], + resultFormatters: resultFmts.toHeader, + }, ] export class DefaultRPC { @@ -398,6 +404,8 @@ export class DefaultRPC { absolute?: boolean, reason?: string ) => Promise + + public getHeader!: (hash: CKBComponents.Hash) => Promise } export default DefaultRPC diff --git a/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts b/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts index 123002a5..b2538d94 100644 --- a/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts +++ b/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts @@ -105,19 +105,20 @@ declare module CKB_RPC { export type Seal = CKBComponents.Seal export interface Header { - version: Version + dao: DAO + difficulty: Difficulty + epoch: EpochInHeader + hash: Hash256 + number: BlockNumber parent_hash: Hash256 + proposals_hash: Hash256 + seal: Seal timestamp: Timestamp - number: BlockNumber - epoch: EpochInHeader transactions_root: Hash256 - proposals_hash: Hash256 - witnesses_root: Hash256 - difficulty: Difficulty - uncles_hash: Hash256 uncles_count: Count - seal: Seal - hash: Hash256 + uncles_hash: Hash256 + witnesses_root: Hash256 + version: Version } export interface UncleBlock { diff --git a/packages/ckb-types/index.d.ts b/packages/ckb-types/index.d.ts index ac22dbd1..13d67769 100644 --- a/packages/ckb-types/index.d.ts +++ b/packages/ckb-types/index.d.ts @@ -3,6 +3,7 @@ */ declare namespace CKBComponents { + export type DAO = string export type Hash = string export type Hash256 = string export type UInt32 = number @@ -178,33 +179,36 @@ declare namespace CKBComponents { /** * @typedef BlockHeader, header of a block - * @property version + * @property dao + * @property difficulty + * @property epoch + * @property hash + * @property number * @property parentHash + * @property proposalsHash + * @property seal * @property timestamp - * @property number - * @property epoch * @property transactionsRoot - * @property proposalsHash - * @property difficulty - * @property unclesHash * @property unclesCount - * @property seal - * @property hash + * @property unclesHash + * @property witnessesRoot + * @property version */ export interface BlockHeader { - version: Version + dao: DAO + difficulty: Difficulty + epoch: EpochInHeader + hash: Hash256 + number: BlockNumber parentHash: Hash256 + proposalsHash: Hash256 + seal: Seal timestamp: Timestamp - number: BlockNumber - epoch: EpochInHeader transactionsRoot: Hash256 - proposalsHash: Hash256 - witnessesRoot: Hash256 - difficulty: Difficulty - unclesHash: Hash256 unclesCount: Count - seal: Seal - hash: Hash256 + unclesHash: Hash256 + witnessesRoot: Hash256 + version: Version } /** From 54f9d191fb4a458e16ef444297ec490f2298cd0f Mon Sep 17 00:00:00 2001 From: Keith Date: Tue, 30 Jul 2019 21:21:50 +0800 Subject: [PATCH 06/11] feat(rpc): add get_header_by_number rpc --- packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js | 4 ++-- packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js | 7 +++++++ packages/ckb-sdk-rpc/src/defaultRPC.ts | 8 ++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js b/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js index f58bd582..745551cd 100644 --- a/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js +++ b/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js @@ -40,8 +40,8 @@ describe('ckb-rpc settings and helpers', () => { expect(rpc.node).toEqual(node) }) - it('has 25 default rpc', () => { - expect(rpc.methods.length).toBe(25) + it('has 26 default rpc', () => { + expect(rpc.methods.length).toBe(26) }) it('set node url to http://test.localhost:8114', () => { diff --git a/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js b/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js index a2e80236..63bc2d35 100644 --- a/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js +++ b/packages/ckb-sdk-rpc/__tests__/ckb-rpc.test.js @@ -118,6 +118,13 @@ describe('ckb-rpc success', () => { const header = await rpc.getHeader(zeroBlockHash) expect(header).toEqual(zeroBlockHeader) }) + + it('get header by number', async () => { + const zeroBlock = await rpc.getBlockByNumber('0') + const zeroBlockHeader = zeroBlock.header + const header = await rpc.getHeaderByNumber('0') + expect(header).toEqual(zeroBlockHeader) + }) }) describe('send transaction', () => { diff --git a/packages/ckb-sdk-rpc/src/defaultRPC.ts b/packages/ckb-sdk-rpc/src/defaultRPC.ts index b6fac55d..de015df6 100644 --- a/packages/ckb-sdk-rpc/src/defaultRPC.ts +++ b/packages/ckb-sdk-rpc/src/defaultRPC.ts @@ -148,6 +148,12 @@ const defaultRPC: CKBComponents.Method[] = [ paramsFormatters: [paramsFmts.toHash], resultFormatters: resultFmts.toHeader, }, + { + name: 'getHeaderByNumber', + method: 'get_header_by_number', + paramsFormatters: [paramsFmts.toNumber], + resultFormatters: resultFmts.toHeader, + }, ] export class DefaultRPC { @@ -406,6 +412,8 @@ export class DefaultRPC { ) => Promise public getHeader!: (hash: CKBComponents.Hash) => Promise + + public getHeaderByNumber!: (blockNumber: CKBComponents.BlockNumber) => Promise } export default DefaultRPC From fa3aea349481128b330098dc5e90dd1bc0ffa66a Mon Sep 17 00:00:00 2001 From: Keith Date: Tue, 30 Jul 2019 23:10:47 +0800 Subject: [PATCH 07/11] feat(rpc): add get_cellbase_output_capacity_details rpc --- .../ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js | 4 +-- .../__tests__/formatters/result.json | 18 ++++++++++ packages/ckb-sdk-rpc/src/defaultRPC.ts | 36 ++++++++++++++++++- packages/ckb-sdk-rpc/src/resultFormatter.ts | 11 ++++++ packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts | 8 +++++ packages/ckb-types/index.d.ts | 8 +++++ 6 files changed, 82 insertions(+), 3 deletions(-) diff --git a/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js b/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js index 745551cd..9281f820 100644 --- a/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js +++ b/packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js @@ -40,8 +40,8 @@ describe('ckb-rpc settings and helpers', () => { expect(rpc.node).toEqual(node) }) - it('has 26 default rpc', () => { - expect(rpc.methods.length).toBe(26) + it('has 27 default rpc', () => { + expect(rpc.methods.length).toBe(27) }) it('set node url to http://test.localhost:8114', () => { diff --git a/packages/ckb-sdk-rpc/__tests__/formatters/result.json b/packages/ckb-sdk-rpc/__tests__/formatters/result.json index 56dd0859..0d6fc552 100644 --- a/packages/ckb-sdk-rpc/__tests__/formatters/result.json +++ b/packages/ckb-sdk-rpc/__tests__/formatters/result.json @@ -1111,6 +1111,24 @@ } ] } + ], + "toCellbaseOutputCapacityDetails": [ + { + "source": { + "primary": "100000000000", + "proposal_reward": "0", + "secondary": "1346505683", + "total": "101346505683", + "tx_fee": "0" + }, + "target": { + "primary": "100000000000", + "proposalReward": "0", + "secondary": "1346505683", + "total": "101346505683", + "txFee": "0" + } + } ] }, "failure": {} diff --git a/packages/ckb-sdk-rpc/src/defaultRPC.ts b/packages/ckb-sdk-rpc/src/defaultRPC.ts index de015df6..e2fc207d 100644 --- a/packages/ckb-sdk-rpc/src/defaultRPC.ts +++ b/packages/ckb-sdk-rpc/src/defaultRPC.ts @@ -154,6 +154,12 @@ const defaultRPC: CKBComponents.Method[] = [ paramsFormatters: [paramsFmts.toNumber], resultFormatters: resultFmts.toHeader, }, + { + name: 'getCellbaseOutputCapacityDetails', + method: 'get_cellbase_output_capacity_details', + paramsFormatters: [paramsFmts.toHash], + resultFormatters: resultFmts.toCellbaseOutputCapacityDetails, + }, ] export class DefaultRPC { @@ -388,6 +394,11 @@ export class DefaultRPC { indexFrom?: CKBComponents.BlockNumber ) => Promise + /** + * @method getBannedAddresses + * @memberof DefaultRPC + * @description Returns all banned IPs/Subnets + */ public getBannedAddresses!: () => Promise /** * @method setBan @@ -411,9 +422,32 @@ export class DefaultRPC { reason?: string ) => Promise - public getHeader!: (hash: CKBComponents.Hash) => Promise + /** + * @method getHeader + * @memberof DefaultRPC + * @description Returns the information about a block header by hash. + * @params {string} block hash + */ + public getHeader!: (blockHash: CKBComponents.Hash) => Promise + /** + * @method getHeaderByNumber + * @memberof DefaultRPC + * @description Returns the information about a block header by block number + * @params {string} block number + */ public getHeaderByNumber!: (blockNumber: CKBComponents.BlockNumber) => Promise + + /** + * @method getCellbaseOutputCapacityDetails + * @memberof DefaultRPC + * @description Returns each component of the created CKB in this block's cellbase, which is issued to + * a block N - 1 - ProposalWindow.farthest, where this block's height is N. + * @param {string} blockHash + */ + public getCellbaseOutputCapacityDetails!: ( + blockHash: CKBComponents.Hash + ) => Promise } export default DefaultRPC diff --git a/packages/ckb-sdk-rpc/src/resultFormatter.ts b/packages/ckb-sdk-rpc/src/resultFormatter.ts index 6214f851..4ff4a8fb 100644 --- a/packages/ckb-sdk-rpc/src/resultFormatter.ts +++ b/packages/ckb-sdk-rpc/src/resultFormatter.ts @@ -251,6 +251,17 @@ const formatter = { if (!bannedAddresses) return bannedAddresses return bannedAddresses.map(banAddr => formatter.toBannedAddress(banAddr)) }, + toCellbaseOutputCapacityDetails: ( + details: CKB_RPC.CellbaseOutputCapacityDetails + ): CKBComponents.CellbaseOutputCapacityDetails => { + if (!details) return details + const { proposal_reward: proposalReward, tx_fee: txFee, ...rest } = details + return { + proposalReward, + txFee, + ...rest, + } + }, } export default formatter diff --git a/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts b/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts index b2538d94..b097ba81 100644 --- a/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts +++ b/packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts @@ -194,5 +194,13 @@ declare module CKB_RPC { created_at: Timestamp } export type BannedAddresses = BannedAddress[] + + export interface CellbaseOutputCapacityDetails { + primary: string + proposal_reward: string + secondary: string + total: string + tx_fee: string + } } /* eslint-enable camelcase */ diff --git a/packages/ckb-types/index.d.ts b/packages/ckb-types/index.d.ts index 13d67769..698e298f 100644 --- a/packages/ckb-types/index.d.ts +++ b/packages/ckb-types/index.d.ts @@ -341,4 +341,12 @@ declare namespace CKBComponents { } export type BannedAddresses = BannedAddress[] + + export interface CellbaseOutputCapacityDetails { + primary: string + proposalReward: string + secondary: string + total: string + txFee: string + } } From 03dd5965640471bc93ea0467be0d461432f9b406 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2019 21:31:50 +0000 Subject: [PATCH 08/11] chore(deps-dev): bump @types/node from 12.6.8 to 12.6.9 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.6.8 to 12.6.9. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0012dee3..6d6927fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1242,9 +1242,9 @@ integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== "@types/node@*", "@types/node@^12.0.0": - version "12.6.8" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.8.tgz#e469b4bf9d1c9832aee4907ba8a051494357c12c" - integrity sha512-aX+gFgA5GHcDi89KG5keey2zf0WfZk/HAQotEamsK2kbey+8yGKcson0hbK8E+v0NArlCJQCqMP161YhV6ZXLg== + version "12.6.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.9.tgz#ffeee23afdc19ab16e979338e7b536fdebbbaeaf" + integrity sha512-+YB9FtyxXGyD54p8rXwWaN1EWEyar5L58GlGWgtH2I9rGmLGBQcw63+0jw+ujqVavNuO47S1ByAjm9zdHMnskw== "@types/normalize-package-data@^2.4.0": version "2.4.0" From 8032c17c4a5b5fddd48e1235e00b0f8ceeefddfe Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2019 21:31:54 +0000 Subject: [PATCH 09/11] chore(deps-dev): bump eslint-plugin-jest from 22.14.0 to 22.14.1 Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 22.14.0 to 22.14.1. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v22.14.0...v22.14.1) Signed-off-by: dependabot-preview[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0012dee3..cacc9488 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2667,9 +2667,9 @@ eslint-plugin-import@^2.14.0: resolve "^1.11.0" eslint-plugin-jest@^22.1.2: - version "22.14.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.14.0.tgz#f9b09837f665cfe360b55c08866904255294cc16" - integrity sha512-Xtc9ZTtxdYFC7vu0PHxDeQ9lOMQ8gjwMmSQq/ni83TdflgL3eVh/qg3t99I7gcDxpeXfcp+lHu9C0vN3QAhATw== + version "22.14.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.14.1.tgz#32287dade9bc0a1920c61e25a71cf11363d78015" + integrity sha512-mpLjhADl+HjagrlaGNx95HIji089S18DhnU/Ee8P8VP+dhEnuEzb43BXEaRmDgQ7BiSUPcSCvt1ydtgPkjOF/Q== dependencies: "@typescript-eslint/experimental-utils" "^1.13.0" From 6665c3cecb0a2b242722a58d83c8ac420ba0107b Mon Sep 17 00:00:00 2001 From: Keith Date: Sat, 10 Aug 2019 10:57:08 +0800 Subject: [PATCH 10/11] chore: update package versions and changelogs --- CHANGELOG.md | 15 +++++++++++++++ lerna.json | 2 +- packages/ckb-cli/CHANGELOG.md | 8 ++++++++ packages/ckb-cli/package.json | 4 ++-- packages/ckb-sdk-address/CHANGELOG.md | 8 ++++++++ packages/ckb-sdk-address/package.json | 6 +++--- packages/ckb-sdk-core/CHANGELOG.md | 8 ++++++++ packages/ckb-sdk-core/package.json | 10 +++++----- packages/ckb-sdk-rpc/CHANGELOG.md | 15 +++++++++++++++ packages/ckb-sdk-rpc/package.json | 6 +++--- packages/ckb-sdk-utils/CHANGELOG.md | 8 ++++++++ packages/ckb-sdk-utils/package.json | 4 ++-- packages/ckb-types/CHANGELOG.md | 13 +++++++++++++ packages/ckb-types/package.json | 2 +- 14 files changed, 92 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fe45a33..6f7ca97d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,21 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.18.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.1...v0.18.0) (2019-08-10) + + +### Features + +* **rpc:** add get_cellbase_output_capacity_details rpc ([fa3aea3](https://github.com/nervosnetwork/ckb-sdk-js/commit/fa3aea3)) +* **rpc:** add get_header rpc ([d2a6bbb](https://github.com/nervosnetwork/ckb-sdk-js/commit/d2a6bbb)) +* **rpc:** add get_header_by_number rpc ([54f9d19](https://github.com/nervosnetwork/ckb-sdk-js/commit/54f9d19)) +* **rpc:** add new rpc of set ban ([416e7fd](https://github.com/nervosnetwork/ckb-sdk-js/commit/416e7fd)) +* **rpc:** add rpc of get banned addresses ([323b8ac](https://github.com/nervosnetwork/ckb-sdk-js/commit/323b8ac)) + + + + + ## [0.17.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.0...v0.17.1) (2019-07-29) diff --git a/lerna.json b/lerna.json index 047239b1..4f476be6 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "packages": [ "packages/*" ], - "version": "0.17.1" + "version": "0.18.0" } diff --git a/packages/ckb-cli/CHANGELOG.md b/packages/ckb-cli/CHANGELOG.md index 0e2ef051..832556b7 100644 --- a/packages/ckb-cli/CHANGELOG.md +++ b/packages/ckb-cli/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.18.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.1...v0.18.0) (2019-08-10) + +**Note:** Version bump only for package @nervosnetwork/ckb-cli + + + + + ## [0.17.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.0...v0.17.1) (2019-07-29) **Note:** Version bump only for package @nervosnetwork/ckb-cli diff --git a/packages/ckb-cli/package.json b/packages/ckb-cli/package.json index a288cade..efc59450 100644 --- a/packages/ckb-cli/package.json +++ b/packages/ckb-cli/package.json @@ -1,6 +1,6 @@ { "name": "@nervosnetwork/ckb-cli", - "version": "0.17.1", + "version": "0.18.0", "description": "Command line package based on @nervosnetwork/ckb-sdk-core", "author": "Nervos ", "homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme", @@ -34,7 +34,7 @@ "url": "https://github.com/nervosnetwork/ckb-sdk-js/issues" }, "dependencies": { - "@nervosnetwork/ckb-sdk-core": "0.17.1", + "@nervosnetwork/ckb-sdk-core": "0.18.0", "blessed": "0.1.81", "blessed-contrib": "4.8.16", "commander": "2.20.0", diff --git a/packages/ckb-sdk-address/CHANGELOG.md b/packages/ckb-sdk-address/CHANGELOG.md index 8077a72b..819a63f6 100644 --- a/packages/ckb-sdk-address/CHANGELOG.md +++ b/packages/ckb-sdk-address/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.18.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.1...v0.18.0) (2019-08-10) + +**Note:** Version bump only for package @nervosnetwork/ckb-sdk-address + + + + + ## [0.17.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.0...v0.17.1) (2019-07-29) **Note:** Version bump only for package @nervosnetwork/ckb-sdk-address diff --git a/packages/ckb-sdk-address/package.json b/packages/ckb-sdk-address/package.json index 62ec65a3..c58f21d2 100644 --- a/packages/ckb-sdk-address/package.json +++ b/packages/ckb-sdk-address/package.json @@ -1,6 +1,6 @@ { "name": "@nervosnetwork/ckb-sdk-address", - "version": "0.17.1", + "version": "0.18.0", "description": "Address module of @nervosnetwork/ckb-sdk-core", "keywords": [ "CKB", @@ -33,8 +33,8 @@ "url": "https://github.com/nervosnetwork/ckb-sdk-js/issues" }, "dependencies": { - "@nervosnetwork/ckb-sdk-utils": "0.17.1", - "@nervosnetwork/ckb-types": "0.17.1" + "@nervosnetwork/ckb-sdk-utils": "0.18.0", + "@nervosnetwork/ckb-types": "0.18.0" }, "gitHead": "9862d5b3582be18a4af9e2d4ab34f069f5e15efb" } diff --git a/packages/ckb-sdk-core/CHANGELOG.md b/packages/ckb-sdk-core/CHANGELOG.md index 17cf3120..92509e05 100644 --- a/packages/ckb-sdk-core/CHANGELOG.md +++ b/packages/ckb-sdk-core/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.18.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.1...v0.18.0) (2019-08-10) + +**Note:** Version bump only for package @nervosnetwork/ckb-sdk-core + + + + + ## [0.17.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.0...v0.17.1) (2019-07-29) diff --git a/packages/ckb-sdk-core/package.json b/packages/ckb-sdk-core/package.json index 266bab0a..b1dc36c2 100644 --- a/packages/ckb-sdk-core/package.json +++ b/packages/ckb-sdk-core/package.json @@ -1,6 +1,6 @@ { "name": "@nervosnetwork/ckb-sdk-core", - "version": "0.17.1", + "version": "0.18.0", "description": "JavaScript SDK for Nervos Network CKB Project", "author": "Nervos ", "homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme", @@ -29,10 +29,10 @@ "url": "https://github.com/nervosnetwork/ckb-sdk-js/issues" }, "dependencies": { - "@nervosnetwork/ckb-sdk-address": "0.17.1", - "@nervosnetwork/ckb-sdk-rpc": "0.17.1", - "@nervosnetwork/ckb-sdk-utils": "0.17.1", - "@nervosnetwork/ckb-types": "0.17.1" + "@nervosnetwork/ckb-sdk-address": "0.18.0", + "@nervosnetwork/ckb-sdk-rpc": "0.18.0", + "@nervosnetwork/ckb-sdk-utils": "0.18.0", + "@nervosnetwork/ckb-types": "0.18.0" }, "devDependencies": { "@types/crypto-js": "3.1.43" diff --git a/packages/ckb-sdk-rpc/CHANGELOG.md b/packages/ckb-sdk-rpc/CHANGELOG.md index 131c6c62..a751d538 100644 --- a/packages/ckb-sdk-rpc/CHANGELOG.md +++ b/packages/ckb-sdk-rpc/CHANGELOG.md @@ -3,6 +3,21 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.18.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.1...v0.18.0) (2019-08-10) + + +### Features + +* **rpc:** add get_cellbase_output_capacity_details rpc ([fa3aea3](https://github.com/nervosnetwork/ckb-sdk-js/commit/fa3aea3)) +* **rpc:** add get_header rpc ([d2a6bbb](https://github.com/nervosnetwork/ckb-sdk-js/commit/d2a6bbb)) +* **rpc:** add get_header_by_number rpc ([54f9d19](https://github.com/nervosnetwork/ckb-sdk-js/commit/54f9d19)) +* **rpc:** add new rpc of set ban ([416e7fd](https://github.com/nervosnetwork/ckb-sdk-js/commit/416e7fd)) +* **rpc:** add rpc of get banned addresses ([323b8ac](https://github.com/nervosnetwork/ckb-sdk-js/commit/323b8ac)) + + + + + ## [0.17.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.0...v0.17.1) (2019-07-29) diff --git a/packages/ckb-sdk-rpc/package.json b/packages/ckb-sdk-rpc/package.json index df337483..fa340868 100644 --- a/packages/ckb-sdk-rpc/package.json +++ b/packages/ckb-sdk-rpc/package.json @@ -1,6 +1,6 @@ { "name": "@nervosnetwork/ckb-sdk-rpc", - "version": "0.17.1", + "version": "0.18.0", "description": "RPC module of @nervosnetwork/ckb-sdk-core", "author": "Nervos ", "homepage": "https://github.com/nervosnetwork/ckb-sdk-js/packages/ckb-rpc#readme", @@ -32,11 +32,11 @@ "url": "https://github.com/nervosnetwork/ckb-sdk-js/issues" }, "dependencies": { - "@nervosnetwork/ckb-sdk-utils": "0.17.1", + "@nervosnetwork/ckb-sdk-utils": "0.18.0", "axios": "0.19.0" }, "devDependencies": { - "@nervosnetwork/ckb-types": "0.17.1", + "@nervosnetwork/ckb-types": "0.18.0", "@types/crypto-js": "3.1.43" }, "gitHead": "9862d5b3582be18a4af9e2d4ab34f069f5e15efb" diff --git a/packages/ckb-sdk-utils/CHANGELOG.md b/packages/ckb-sdk-utils/CHANGELOG.md index 3aebdc33..71f94229 100644 --- a/packages/ckb-sdk-utils/CHANGELOG.md +++ b/packages/ckb-sdk-utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.18.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.1...v0.18.0) (2019-08-10) + +**Note:** Version bump only for package @nervosnetwork/ckb-sdk-utils + + + + + ## [0.17.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.0...v0.17.1) (2019-07-29) **Note:** Version bump only for package @nervosnetwork/ckb-sdk-utils diff --git a/packages/ckb-sdk-utils/package.json b/packages/ckb-sdk-utils/package.json index be6b9673..844094a8 100644 --- a/packages/ckb-sdk-utils/package.json +++ b/packages/ckb-sdk-utils/package.json @@ -1,6 +1,6 @@ { "name": "@nervosnetwork/ckb-sdk-utils", - "version": "0.17.1", + "version": "0.18.0", "description": "Utils module of @nervosnetwork/ckb-sdk-core", "author": "Nervos ", "homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme", @@ -30,7 +30,7 @@ "url": "https://github.com/nervosnetwork/ckb-sdk-js/issues" }, "dependencies": { - "@nervosnetwork/ckb-types": "0.17.1", + "@nervosnetwork/ckb-types": "0.18.0", "blake2b-wasm": "1.1.7", "elliptic": "6.4.1" }, diff --git a/packages/ckb-types/CHANGELOG.md b/packages/ckb-types/CHANGELOG.md index f8e647aa..ea30b9e6 100644 --- a/packages/ckb-types/CHANGELOG.md +++ b/packages/ckb-types/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.18.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.1...v0.18.0) (2019-08-10) + + +### Features + +* **rpc:** add get_cellbase_output_capacity_details rpc ([fa3aea3](https://github.com/nervosnetwork/ckb-sdk-js/commit/fa3aea3)) +* **rpc:** add get_header rpc ([d2a6bbb](https://github.com/nervosnetwork/ckb-sdk-js/commit/d2a6bbb)) +* **rpc:** add rpc of get banned addresses ([323b8ac](https://github.com/nervosnetwork/ckb-sdk-js/commit/323b8ac)) + + + + + ## [0.17.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.17.0...v0.17.1) (2019-07-29) diff --git a/packages/ckb-types/package.json b/packages/ckb-types/package.json index a417e607..805bdaf1 100644 --- a/packages/ckb-types/package.json +++ b/packages/ckb-types/package.json @@ -1,6 +1,6 @@ { "name": "@nervosnetwork/ckb-types", - "version": "0.17.1", + "version": "0.18.0", "description": "Type module of @nervosnetwork/ckb-sdk-core", "author": "Nervos ", "homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme", From ca4a98bddb1612b758794e6f1b1c38c222313a8e Mon Sep 17 00:00:00 2001 From: Keith Date: Sat, 10 Aug 2019 13:14:19 +0800 Subject: [PATCH 11/11] chore: update lerna hashes[skip ci] --- packages/ckb-cli/package.json | 2 +- packages/ckb-sdk-address/package.json | 2 +- packages/ckb-sdk-core/package.json | 2 +- packages/ckb-sdk-rpc/package.json | 2 +- packages/ckb-sdk-utils/package.json | 2 +- packages/ckb-types/package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/ckb-cli/package.json b/packages/ckb-cli/package.json index efc59450..1cee076c 100644 --- a/packages/ckb-cli/package.json +++ b/packages/ckb-cli/package.json @@ -45,5 +45,5 @@ "@types/crypto-js": "3.1.43", "@types/inquirer": "6.0.0" }, - "gitHead": "9862d5b3582be18a4af9e2d4ab34f069f5e15efb" + "gitHead": "6665c3cecb0a2b242722a58d83c8ac420ba0107b" } diff --git a/packages/ckb-sdk-address/package.json b/packages/ckb-sdk-address/package.json index c58f21d2..8056f893 100644 --- a/packages/ckb-sdk-address/package.json +++ b/packages/ckb-sdk-address/package.json @@ -36,5 +36,5 @@ "@nervosnetwork/ckb-sdk-utils": "0.18.0", "@nervosnetwork/ckb-types": "0.18.0" }, - "gitHead": "9862d5b3582be18a4af9e2d4ab34f069f5e15efb" + "gitHead": "6665c3cecb0a2b242722a58d83c8ac420ba0107b" } diff --git a/packages/ckb-sdk-core/package.json b/packages/ckb-sdk-core/package.json index b1dc36c2..d5d53a7e 100644 --- a/packages/ckb-sdk-core/package.json +++ b/packages/ckb-sdk-core/package.json @@ -37,5 +37,5 @@ "devDependencies": { "@types/crypto-js": "3.1.43" }, - "gitHead": "9862d5b3582be18a4af9e2d4ab34f069f5e15efb" + "gitHead": "6665c3cecb0a2b242722a58d83c8ac420ba0107b" } diff --git a/packages/ckb-sdk-rpc/package.json b/packages/ckb-sdk-rpc/package.json index fa340868..d8836ce3 100644 --- a/packages/ckb-sdk-rpc/package.json +++ b/packages/ckb-sdk-rpc/package.json @@ -39,5 +39,5 @@ "@nervosnetwork/ckb-types": "0.18.0", "@types/crypto-js": "3.1.43" }, - "gitHead": "9862d5b3582be18a4af9e2d4ab34f069f5e15efb" + "gitHead": "6665c3cecb0a2b242722a58d83c8ac420ba0107b" } diff --git a/packages/ckb-sdk-utils/package.json b/packages/ckb-sdk-utils/package.json index 844094a8..367e7e16 100644 --- a/packages/ckb-sdk-utils/package.json +++ b/packages/ckb-sdk-utils/package.json @@ -39,5 +39,5 @@ "@types/elliptic": "6.4.8", "@types/utf8": "2.1.6" }, - "gitHead": "9862d5b3582be18a4af9e2d4ab34f069f5e15efb" + "gitHead": "6665c3cecb0a2b242722a58d83c8ac420ba0107b" } diff --git a/packages/ckb-types/package.json b/packages/ckb-types/package.json index 805bdaf1..10a1792c 100644 --- a/packages/ckb-types/package.json +++ b/packages/ckb-types/package.json @@ -26,5 +26,5 @@ "devDependencies": { "@types/crypto-js": "3.1.43" }, - "gitHead": "9862d5b3582be18a4af9e2d4ab34f069f5e15efb" + "gitHead": "6665c3cecb0a2b242722a58d83c8ac420ba0107b" }