Skip to content

Commit

Permalink
Merge pull request #301 from nervosnetwork/rc/v0.17.0
Browse files Browse the repository at this point in the history
[ᚬmaster] Rc/v0.17.0
  • Loading branch information
Keith-CY authored Jul 27, 2019
2 parents 2f014b8 + 385f6c2 commit 5cb02ad
Show file tree
Hide file tree
Showing 27 changed files with 1,218 additions and 759 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.17.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.16.0...v0.17.0) (2019-07-27)


### Features

* **types:** add a new field named 'hash_type' in types of script and cell output ([2692c0a](https://github.com/nervosnetwork/ckb-sdk-js/commit/2692c0a))
* **utils:** update the address format ([74a5ad8](https://github.com/nervosnetwork/ckb-sdk-js/commit/74a5ad8))


### BREAKING CHANGES

* **types:** types of script and cell output changed
* **utils:** update the address format





# [0.16.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.15.1...v0.16.0) (2019-07-13)

**Note:** Version bump only for package ckb-sdk-js
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "0.16.0"
"version": "0.17.0"
}
8 changes: 8 additions & 0 deletions packages/ckb-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.17.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.16.0...v0.17.0) (2019-07-27)

**Note:** Version bump only for package @nervosnetwork/ckb-cli





# [0.16.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.15.1...v0.16.0) (2019-07-13)

**Note:** Version bump only for package @nervosnetwork/ckb-cli
Expand Down
6 changes: 3 additions & 3 deletions packages/ckb-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nervosnetwork/ckb-cli",
"version": "0.16.0",
"version": "0.17.0",
"description": "Command line package based on @nervosnetwork/ckb-sdk-core",
"author": "Nervos <[email protected]>",
"homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme",
Expand Down Expand Up @@ -34,7 +34,7 @@
"url": "https://github.com/nervosnetwork/ckb-sdk-js/issues"
},
"dependencies": {
"@nervosnetwork/ckb-sdk-core": "0.16.0",
"@nervosnetwork/ckb-sdk-core": "0.17.0",
"blessed": "0.1.81",
"blessed-contrib": "4.8.16",
"commander": "2.20.0",
Expand All @@ -45,5 +45,5 @@
"@types/crypto-js": "3.1.43",
"@types/inquirer": "6.0.0"
},
"gitHead": "6651a70914f95c08a3e03af50fdeb084b35138be"
"gitHead": "0a3fee8d4c7187f5a73851c751a98fe9948482aa"
}
16 changes: 16 additions & 0 deletions packages/ckb-sdk-address/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.17.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.16.0...v0.17.0) (2019-07-27)


### Features

* **utils:** update the address format ([74a5ad8](https://github.com/nervosnetwork/ckb-sdk-js/commit/74a5ad8))


### BREAKING CHANGES

* **utils:** update the address format





# [0.16.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.15.1...v0.16.0) (2019-07-13)

**Note:** Version bump only for package @nervosnetwork/ckb-sdk-address
Expand Down
14 changes: 7 additions & 7 deletions packages/ckb-sdk-address/__tests__/ckb-sdk-address.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('ckb-sdk-address', () => {
it('generate address with default configuration', () => {
const fixture = {
privateKey: 'e79f3207ea4980b7fed79956d5934249ceac4751a4fae01a0f7c4a96884bc4e3',
address: 'ckt1q9gry5zgxmpjnmtrp4kww5r39frh2sm89tdt2l6v234ygf',
address: 'ckt1qyqrdsefa43s6m882pcj53m4gdnj4k440axqswmu83',
}
const address = new Address(fixture.privateKey)
expect(address.value).toBe(fixture.address)
Expand All @@ -14,7 +14,7 @@ describe('ckb-sdk-address', () => {
const fixture = {
privateKey: 'e79f3207ea4980b7fed79956d5934249ceac4751a4fae01a0f7c4a96884bc4e3',
prefix: 'ckt',
address: 'ckt1q9gry5zgxmpjnmtrp4kww5r39frh2sm89tdt2l6v234ygf',
address: 'ckt1qyqrdsefa43s6m882pcj53m4gdnj4k440axqswmu83',
}
const address = new Address(fixture.privateKey, {
prefix: fixture.prefix,
Expand All @@ -26,24 +26,24 @@ describe('ckb-sdk-address', () => {
const fixture = {
privateKey: 'e79f3207ea4980b7fed79956d5934249ceac4751a4fae01a0f7c4a96884bc4e3',
type: '0x01',
address: 'ckt1q9gry5zgxmpjnmtrp4kww5r39frh2sm89tdt2l6v234ygf',
address: 'ckt1qyqrdsefa43s6m882pcj53m4gdnj4k440axqswmu83',
}
const address = new Address(fixture.privateKey, {
type: fixture.type,
})
expect(address.value).toBe(fixture.address)
})

it('generate address specified type 0x01 and binIdx of P2PH', () => {
it('generate address specified type 0x01 and code hash index of 0x00', () => {
const fixture = {
privateKey: 'e79f3207ea4980b7fed79956d5934249ceac4751a4fae01a0f7c4a96884bc4e3',
type: '0x01',
binIdx: 'P2PH',
address: 'ckt1q9gry5zgxmpjnmtrp4kww5r39frh2sm89tdt2l6v234ygf',
codeHashIndex: '0x00',
address: 'ckt1qyqrdsefa43s6m882pcj53m4gdnj4k440axqswmu83',
}
const address = new Address(fixture.privateKey, {
type: fixture.type,
binIdx: fixture.binIdx,
codeHashIndex: fixture.codeHashIndex,
})
expect(address.value).toBe(fixture.address)
})
Expand Down
8 changes: 4 additions & 4 deletions packages/ckb-sdk-address/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nervosnetwork/ckb-sdk-address",
"version": "0.16.0",
"version": "0.17.0",
"description": "Address module of @nervosnetwork/ckb-sdk-core",
"keywords": [
"CKB",
Expand Down Expand Up @@ -33,8 +33,8 @@
"url": "https://github.com/nervosnetwork/ckb-sdk-js/issues"
},
"dependencies": {
"@nervosnetwork/ckb-sdk-utils": "0.16.0",
"@nervosnetwork/ckb-types": "0.16.0"
"@nervosnetwork/ckb-sdk-utils": "0.17.0",
"@nervosnetwork/ckb-types": "0.17.0"
},
"gitHead": "6651a70914f95c08a3e03af50fdeb084b35138be"
"gitHead": "0a3fee8d4c7187f5a73851c751a98fe9948482aa"
}
12 changes: 6 additions & 6 deletions packages/ckb-sdk-address/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ECPair from '@nervosnetwork/ckb-sdk-utils/lib/ecpair'
import * as utils from '@nervosnetwork/ckb-sdk-utils'
import { AddressOptions } from '@nervosnetwork/ckb-sdk-utils/lib/address'

const { hexToBytes, pubkeyToAddress, blake160, AddressPrefix, AddressType, AddressBinIdx } = utils
const { hexToBytes, pubkeyToAddress, blake160, AddressPrefix, AddressType } = utils

class Address extends ECPair {
public value = ''
Expand All @@ -14,24 +14,24 @@ class Address extends ECPair {
{
addressAlgorithm = pubkeyToAddress,
prefix = AddressPrefix.Testnet,
type = AddressType.BinIdx,
binIdx = AddressBinIdx.P2PH,
type = AddressType.HashIdx,
codeHashIndex = '0x00',
}: Partial<
{
addressAlgorithm: Function
} & AddressOptions
> = {
addressAlgorithm: pubkeyToAddress,
prefix: AddressPrefix.Testnet,
type: AddressType.BinIdx,
binIdx: AddressBinIdx.P2PH,
type: AddressType.HashIdx,
codeHashIndex: '0x00',
}
) {
super(typeof sk === 'string' ? hexToBytes(sk) : sk)
this.value = addressAlgorithm(this.publicKey, {
prefix,
type,
binIdx,
codeHashIndex,
})
this.identifier = blake160(this.publicKey as string, 'hex')
}
Expand Down
16 changes: 16 additions & 0 deletions packages/ckb-sdk-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.17.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.16.0...v0.17.0) (2019-07-27)


### Features

* **utils:** update the address format ([74a5ad8](https://github.com/nervosnetwork/ckb-sdk-js/commit/74a5ad8))


### BREAKING CHANGES

* **utils:** update the address format





# [0.16.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.15.1...v0.16.0) (2019-07-13)

**Note:** Version bump only for package @nervosnetwork/ckb-sdk-core
Expand Down
12 changes: 6 additions & 6 deletions packages/ckb-sdk-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nervosnetwork/ckb-sdk-core",
"version": "0.16.0",
"version": "0.17.0",
"description": "JavaScript SDK for Nervos Network CKB Project",
"author": "Nervos <[email protected]>",
"homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme",
Expand Down Expand Up @@ -29,13 +29,13 @@
"url": "https://github.com/nervosnetwork/ckb-sdk-js/issues"
},
"dependencies": {
"@nervosnetwork/ckb-sdk-address": "0.16.0",
"@nervosnetwork/ckb-sdk-rpc": "0.16.0",
"@nervosnetwork/ckb-sdk-utils": "0.16.0",
"@nervosnetwork/ckb-types": "0.16.0"
"@nervosnetwork/ckb-sdk-address": "0.17.0",
"@nervosnetwork/ckb-sdk-rpc": "0.17.0",
"@nervosnetwork/ckb-sdk-utils": "0.17.0",
"@nervosnetwork/ckb-types": "0.17.0"
},
"devDependencies": {
"@types/crypto-js": "3.1.43"
},
"gitHead": "6651a70914f95c08a3e03af50fdeb084b35138be"
"gitHead": "0a3fee8d4c7187f5a73851c751a98fe9948482aa"
}
8 changes: 4 additions & 4 deletions packages/ckb-sdk-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ class Core {

public generateAddress = (
privateKey: string,
{ prefix = utils.AddressPrefix.Testnet, type = utils.AddressType.BinIdx, binIdx = utils.AddressBinIdx.P2PH } = {
{ prefix = utils.AddressPrefix.Testnet, type = utils.AddressType.HashIdx, codeHashIndex = '0x00' } = {
prefix: utils.AddressPrefix.Testnet,
type: utils.AddressType.BinIdx,
binIdx: utils.AddressBinIdx.P2PH,
type: utils.AddressType.HashIdx,
codeHashIndex: '0x00',
}
) =>
new Address(privateKey, {
prefix,
type,
binIdx,
codeHashIndex,
})

public loadSystemCell = async () => {
Expand Down
16 changes: 16 additions & 0 deletions packages/ckb-sdk-rpc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.17.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.16.0...v0.17.0) (2019-07-27)


### Features

* **types:** add a new field named 'hash_type' in types of script and cell output ([2692c0a](https://github.com/nervosnetwork/ckb-sdk-js/commit/2692c0a))


### BREAKING CHANGES

* **types:** types of script and cell output changed





# [0.16.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.15.1...v0.16.0) (2019-07-13)

**Note:** Version bump only for package @nervosnetwork/ckb-sdk-rpc
Expand Down
18 changes: 12 additions & 6 deletions packages/ckb-sdk-rpc/__tests__/formatters/params.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
{
"cell": {
"txHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"index": "4294967295"
"index": "4294967295",
"hashType": "Data"
},
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
Expand All @@ -99,7 +100,8 @@
"previousOutput": {
"cell": {
"txHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"index": "4294967295"
"index": "4294967295",
"hashType": "Data"
},
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
Expand All @@ -112,7 +114,8 @@
"data": "0x",
"lock": {
"args": [],
"codeHash": "0x0000000000000000000000000000000000000000000000000000000000000001"
"codeHash": "0x0000000000000000000000000000000000000000000000000000000000000001",
"hashType": "Data"
},
"type": null
}
Expand All @@ -124,7 +127,8 @@
{
"cell": {
"tx_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"index": "4294967295"
"index": "4294967295",
"hash_type": "Data"
},
"block_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
Expand All @@ -134,7 +138,8 @@
"previous_output": {
"cell": {
"tx_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"index": "4294967295"
"index": "4294967295",
"hash_type": "Data"
},
"block_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
Expand All @@ -147,7 +152,8 @@
"data": "0x",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001",
"hash_type": "Data"
},
"type": null
}
Expand Down
Loading

0 comments on commit 5cb02ad

Please sign in to comment.