diff --git a/CHANGELOG.md b/CHANGELOG.md index 51269855..924ccb4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.24.2](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.24.1...v0.24.2) (2019-11-08) + + +### Bug Fixes + +* **core:** serialize the witnesses after it's signed ([6d4bcdc](https://github.com/nervosnetwork/ckb-sdk-js/commit/6d4bcdca2f5076449ea4f75611ec4f3bcd467662)) + + + + + +## [0.24.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.24.0...v0.24.1) (2019-11-07) + + +### Bug Fixes + +* **utils:** fix the precision-lost in toHexInLittleEndian ([9658a76](https://github.com/nervosnetwork/ckb-sdk-js/commit/9658a769e34344617c64d832322d8c85b72daea7)) + + + + + # [0.24.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.23.1...v0.24.0) (2019-11-02) diff --git a/lerna.json b/lerna.json index 5f451fc3..d1b43667 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "packages": [ "packages/*" ], - "version": "0.24.0" + "version": "0.24.2" } diff --git a/packages/ckb-sdk-core/CHANGELOG.md b/packages/ckb-sdk-core/CHANGELOG.md index 6547e869..e504d1b6 100644 --- a/packages/ckb-sdk-core/CHANGELOG.md +++ b/packages/ckb-sdk-core/CHANGELOG.md @@ -3,6 +3,25 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.24.2](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.24.1...v0.24.2) (2019-11-08) + + +### Bug Fixes + +* **core:** serialize the witnesses after it's signed ([6d4bcdc](https://github.com/nervosnetwork/ckb-sdk-js/commit/6d4bcdca2f5076449ea4f75611ec4f3bcd467662)) + + + + + +## [0.24.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.24.0...v0.24.1) (2019-11-07) + +**Note:** Version bump only for package @nervosnetwork/ckb-sdk-core + + + + + # [0.24.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.23.1...v0.24.0) (2019-11-02) diff --git a/packages/ckb-sdk-core/__tests__/fixtures.json b/packages/ckb-sdk-core/__tests__/fixtures.json index 9fe43e08..cecdb5d8 100644 --- a/packages/ckb-sdk-core/__tests__/fixtures.json +++ b/packages/ckb-sdk-core/__tests__/fixtures.json @@ -11,33 +11,60 @@ }, "signTransaction": { "basic transaction": { - "privateKey": "0xe79f3207ea4980b7fed79956d5934249ceac4751a4fae01a0f7c4a96884bc4e3", + "privateKey": "0xdcec27d0d975b0378471183a03f7071dea8532aaf968be796719ecd20af6988f", "transaction": { - "cellDeps": [], + "cellDeps": [ + { + "outPoint": { + "txHash": "0xbd864a269201d7052d4eb3f753f49f7c68b8edc386afc8bb6ef3e15a05facca2", + "index": "0x0" + }, + "depType": "depGroup" + } + ], "headerDeps": [], "inputs": [ { + "since": "0x0", "previousOutput": { - "txHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "index": "0xffffffff" - }, - "since": "0x0" + "txHash": "0x001748c1b5749af9636b940ae7d8d56d12a3de83f9020e765a5e108ca87873fa", + "index": "0x0" + } + }, + { + "since": "0x0", + "previousOutput": { + "txHash": "0x00317da41f64a75f7cb0bd0238857e1dc75d50fae3f8bbab1e20e18840df024c", + "index": "0x0" + } } ], "outputs": [ { - "capacity": "0x48c27395000", + "capacity": "0x189640200", "lock": { - "args": "0x", - "codeHash": "0x0000000000000000000000000000000000000000000000000000000000000001", - "hashType": "data" - }, - "type": null + "args": "0x3cb5366451256c3c9f8d4e2fc2e2aa8fa5774756", + "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", + "hashType": "type" + } + }, + { + "capacity": "0x31eb37587", + "lock": { + "args": "0xc11d75be4531c9c0cca7531bab077f9a1710c87c", + "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", + "hashType": "type" + } } ], - "outputsData": ["0x"], + "outputsData": ["0x", "0x"], "version": "0x0", "witnesses": [ + { + "lock": "", + "inputType": "", + "outputType": "" + }, { "lock": "", "inputType": "", @@ -46,32 +73,55 @@ ] }, "expected": { - "cellDeps": [], + "cellDeps": [ + { + "outPoint": { + "txHash": "0xbd864a269201d7052d4eb3f753f49f7c68b8edc386afc8bb6ef3e15a05facca2", + "index": "0x0" + }, + "depType": "depGroup" + } + ], "headerDeps": [], "inputs": [ { + "since": "0x0", "previousOutput": { - "txHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "index": "0xffffffff" - }, - "since": "0x0" + "txHash": "0x001748c1b5749af9636b940ae7d8d56d12a3de83f9020e765a5e108ca87873fa", + "index": "0x0" + } + }, + { + "since": "0x0", + "previousOutput": { + "txHash": "0x00317da41f64a75f7cb0bd0238857e1dc75d50fae3f8bbab1e20e18840df024c", + "index": "0x0" + } } ], "outputs": [ { - "capacity": "0x48c27395000", + "capacity": "0x189640200", "lock": { - "args": "0x", - "codeHash": "0x0000000000000000000000000000000000000000000000000000000000000001", - "hashType": "data" - }, - "type": null + "args": "0x3cb5366451256c3c9f8d4e2fc2e2aa8fa5774756", + "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", + "hashType": "type" + } + }, + { + "capacity": "0x31eb37587", + "lock": { + "args": "0xc11d75be4531c9c0cca7531bab077f9a1710c87c", + "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", + "hashType": "type" + } } ], - "outputsData": ["0x"], + "outputsData": ["0x", "0x"], "version": "0x0", "witnesses": [ - "0x5500000010000000550000005500000041000000e601e96d81b868b0f7feed9b23f48f0ff3d0206b055f77880d8408fd469d61b24c251969f69aa28fb17e2729457d7ff27e4e262fabc669240a7a6bff60f2ab0e01" + "0x55000000100000005500000055000000410000005bc073bf55db333d5680ddf36e4814b9ce2118cfe4504f95c7d3e9a7548e16886cf1a1481fd80ce70d5e19108a43fd17fa32aad0d46c30c3410001ed2934ad2f00", + "0x10000000100000001000000010000000" ] } }, diff --git a/packages/ckb-sdk-core/package.json b/packages/ckb-sdk-core/package.json index 37e313ea..b836c70b 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.24.0", + "version": "0.24.2", "description": "JavaScript SDK for Nervos Network CKB Project", "author": "Nervos ", "homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme", @@ -30,9 +30,9 @@ "url": "https://github.com/nervosnetwork/ckb-sdk-js/issues" }, "dependencies": { - "@nervosnetwork/ckb-sdk-rpc": "0.24.0", - "@nervosnetwork/ckb-sdk-utils": "0.24.0", - "@nervosnetwork/ckb-types": "0.24.0" + "@nervosnetwork/ckb-sdk-rpc": "0.24.2", + "@nervosnetwork/ckb-sdk-utils": "0.24.2", + "@nervosnetwork/ckb-types": "0.24.2" }, - "gitHead": "4e76ada0c7315887acbf4eee27d264722a8d36e6" + "gitHead": "942872f4bfcf795bf516593a7d96126f058378db" } diff --git a/packages/ckb-sdk-core/src/index.ts b/packages/ckb-sdk-core/src/index.ts index a097b319..2f4fee78 100644 --- a/packages/ckb-sdk-core/src/index.ts +++ b/packages/ckb-sdk-core/src/index.ts @@ -168,7 +168,11 @@ class Core { }) return { ...transaction, - witnesses: signedWitnesses, + witnesses: signedWitnesses.map( + witness => ( + typeof witness === 'string' ? witness : this.utils.serializeWitnessArgs(witness) + ) + ), } } diff --git a/packages/ckb-sdk-core/src/signWitnessGroup.ts b/packages/ckb-sdk-core/src/signWitnessGroup.ts index c1f229a5..70f050d6 100644 --- a/packages/ckb-sdk-core/src/signWitnessGroup.ts +++ b/packages/ckb-sdk-core/src/signWitnessGroup.ts @@ -27,7 +27,7 @@ const signWitnessGroup = ( s.update(serializedEmptyWitnessBytes) witnessGroup.slice(1).forEach(w => { - const bytes = typeof w === 'string' ? hexToBytes(w) : serializeWitnessArgs(w) + const bytes = hexToBytes(typeof w === 'string' ? w : serializeWitnessArgs(w)) s.update(hexToBytes(toHexInLittleEndian(bytes.length, 8))) s.update(bytes) }) diff --git a/packages/ckb-sdk-rpc/CHANGELOG.md b/packages/ckb-sdk-rpc/CHANGELOG.md index 5a89cf25..e56b88aa 100644 --- a/packages/ckb-sdk-rpc/CHANGELOG.md +++ b/packages/ckb-sdk-rpc/CHANGELOG.md @@ -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.24.2](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.24.1...v0.24.2) (2019-11-08) + +**Note:** Version bump only for package @nervosnetwork/ckb-sdk-rpc + + + + + +## [0.24.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.24.0...v0.24.1) (2019-11-07) + +**Note:** Version bump only for package @nervosnetwork/ckb-sdk-rpc + + + + + # [0.24.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.23.1...v0.24.0) (2019-11-02) diff --git a/packages/ckb-sdk-rpc/package.json b/packages/ckb-sdk-rpc/package.json index 01346239..16115ac2 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.24.0", + "version": "0.24.2", "description": "RPC module of @nervosnetwork/ckb-sdk-core", "author": "Nervos ", "homepage": "https://github.com/nervosnetwork/ckb-sdk-js/packages/ckb-rpc#readme", @@ -32,12 +32,12 @@ "url": "https://github.com/nervosnetwork/ckb-sdk-js/issues" }, "dependencies": { - "@nervosnetwork/ckb-sdk-utils": "0.24.0", + "@nervosnetwork/ckb-sdk-utils": "0.24.2", "axios": "0.19.0" }, "devDependencies": { - "@nervosnetwork/ckb-types": "0.24.0", + "@nervosnetwork/ckb-types": "0.24.2", "dotenv": "8.1.0" }, - "gitHead": "4e76ada0c7315887acbf4eee27d264722a8d36e6" + "gitHead": "942872f4bfcf795bf516593a7d96126f058378db" } diff --git a/packages/ckb-sdk-utils/CHANGELOG.md b/packages/ckb-sdk-utils/CHANGELOG.md index a70ef129..d165ca1f 100644 --- a/packages/ckb-sdk-utils/CHANGELOG.md +++ b/packages/ckb-sdk-utils/CHANGELOG.md @@ -3,6 +3,25 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.24.2](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.24.1...v0.24.2) (2019-11-08) + +**Note:** Version bump only for package @nervosnetwork/ckb-sdk-utils + + + + + +## [0.24.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.24.0...v0.24.1) (2019-11-07) + + +### Bug Fixes + +* **utils:** fix the precision-lost in toHexInLittleEndian ([9658a76](https://github.com/nervosnetwork/ckb-sdk-js/commit/9658a769e34344617c64d832322d8c85b72daea7)) + + + + + # [0.24.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.23.1...v0.24.0) (2019-11-02) **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 cc2cbd74..687dff6b 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.24.0", + "version": "0.24.2", "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.24.0", + "@nervosnetwork/ckb-types": "0.24.2", "blake2b-wasm": "1.1.7", "elliptic": "6.5.1" }, @@ -39,5 +39,5 @@ "@types/elliptic": "6.4.8", "@types/utf8": "2.1.6" }, - "gitHead": "4e76ada0c7315887acbf4eee27d264722a8d36e6" + "gitHead": "942872f4bfcf795bf516593a7d96126f058378db" } diff --git a/packages/ckb-types/CHANGELOG.md b/packages/ckb-types/CHANGELOG.md index 651d50f1..abedb25f 100644 --- a/packages/ckb-types/CHANGELOG.md +++ b/packages/ckb-types/CHANGELOG.md @@ -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.24.2](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.24.1...v0.24.2) (2019-11-08) + +**Note:** Version bump only for package @nervosnetwork/ckb-types + + + + + +## [0.24.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.24.0...v0.24.1) (2019-11-07) + +**Note:** Version bump only for package @nervosnetwork/ckb-types + + + + + # [0.24.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.23.1...v0.24.0) (2019-11-02) diff --git a/packages/ckb-types/package.json b/packages/ckb-types/package.json index 10eacfd3..d790e49f 100644 --- a/packages/ckb-types/package.json +++ b/packages/ckb-types/package.json @@ -1,6 +1,6 @@ { "name": "@nervosnetwork/ckb-types", - "version": "0.24.0", + "version": "0.24.2", "description": "Type module of @nervosnetwork/ckb-sdk-core", "author": "Nervos ", "homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme", @@ -23,5 +23,5 @@ "scripts": { "doc": "../../node_modules/.bin/typedoc --out docs ./index.d.ts --mode modules --includeDeclarations --excludeExternals --ignoreCompilerErrors --theme default --readme README.md" }, - "gitHead": "4e76ada0c7315887acbf4eee27d264722a8d36e6" + "gitHead": "942872f4bfcf795bf516593a7d96126f058378db" }