Skip to content

Commit

Permalink
Merge pull request #574 from nervosnetwork/rc/v0.101.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY authored Feb 17, 2022
2 parents a4c7532 + d75d053 commit 6d56ed8
Show file tree
Hide file tree
Showing 19 changed files with 218 additions and 53 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ jobs:
- name: Compile
run: |
lerna run tsc
echo "module.exports = require('@nervosnetwork/ckb-sdk-core').default;" > ./packages/ckb-sdk-core/ckb.js
npx browserify ./packages/ckb-sdk-core/ckb.js -o ./ckb-sdk.js
npx terser --compress --mangle -o ckb-sdk.min.js -- ckb-sdk.js
npm run build:umd
- name: Upload Files
uses: actions/upload-artifact@v2
with:
name: ckb-sdk-js
path: ./ckb-sdk.min.js
path: packages/ckb-sdk-core/umd/ckb-sdk.min.js
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ package-lock.json

# coverage
coverage

*/**/umd
16 changes: 16 additions & 0 deletions 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.102.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.101.0...v0.102.1) (2022-02-17)

**Note:** Version bump only for package ckb-sdk-js





# [0.102.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.101.0...v0.102.0) (2022-02-16)

**Note:** Version bump only for package ckb-sdk-js





# [0.101.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.43.0...v0.101.0) (2021-10-25)


Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Nervos Foundation
Copyright (c) 2019 - 2022 Nervos Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

JavaScript SDK for Nervos [CKB](https://github.com/nervosnetwork/ckb).

The ckb-sdk-js is still under development and NOT production ready. You should get familiar with CKB transaction structure and RPC before using it.
The ckb-sdk-js is still under development and aim for providing low-level APIs of data construction. You should get familiar with CKB transaction structure and RPCs before using it and design your own DApp SDK based on this one.

<details>
<summary>ToC</summary>
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.101.0"
"version": "0.102.1"
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"tsc": "lerna run tsc",
"cm": "git-cz",
"build:lib": "lerna run tsc",
"build:umd": "./scripts/bundle-umd.sh",
"clean:lib": "rimraf **/packages/*/lib",
"docs": "typedoc --out docs --mode file --includes packages --name CKB-SDK.js --includeDeclarations --excludeExternals --ignoreCompilerErrors --theme default --readme README.md",
"docs": "typedoc --out docs --entryPointStrategy packages 'packages/*' --name CKB-SDK.js --excludeExternals --theme default --readme README.md",
"publish": "lerna run tsc && lerna publish --from-package",
"test": "jest --coverage"
},
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.102.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.101.0...v0.102.1) (2022-02-17)

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





# [0.102.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.101.0...v0.102.0) (2022-02-16)

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





# [0.101.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.43.0...v0.101.0) (2021-10-25)


Expand Down
12 changes: 7 additions & 5 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.101.0",
"version": "0.102.1",
"description": "JavaScript SDK for Nervos Network CKB Project",
"author": "Nervos <[email protected]>",
"homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme",
Expand All @@ -9,10 +9,12 @@
"typings": "lib/index.d.ts",
"directories": {
"lib": "lib",
"umd": "umd",
"test": "__tests__"
},
"files": [
"lib",
"umd",
"types"
],
"publishConfig": {
Expand All @@ -31,10 +33,10 @@
"url": "https://github.com/nervosnetwork/ckb-sdk-js/issues"
},
"dependencies": {
"@nervosnetwork/ckb-sdk-rpc": "0.101.0",
"@nervosnetwork/ckb-sdk-utils": "0.101.0",
"@nervosnetwork/ckb-types": "0.101.0",
"@nervosnetwork/ckb-sdk-rpc": "0.102.1",
"@nervosnetwork/ckb-sdk-utils": "0.102.1",
"@nervosnetwork/ckb-types": "0.102.1",
"tslib": "2.3.1"
},
"gitHead": "19434575f22752458bfcce58f68faae483daa23d"
"gitHead": "78ef8aea8ca68f25528c8eb3aed4506ea4a37241"
}
74 changes: 74 additions & 0 deletions packages/ckb-sdk-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,80 @@ class CKB {
}
}

/**
* @description Generate a raw transaction object to sign
* @param {object} txObject, 1-1 tx or m-n tx
* @returns rawTxToSign
* @example 1-1 tx
*```
* {
* fromAddress: Address, specify the address of inputs
* toAddress: Address, specify the address included in outputs
* capacity: Capacity, specify the value to transfer in this tx
*
* cells?: Array<RawTransactionParams.Cell>, provide
* live cells to generate input cells in this tx
*
* fee?: Fee, specify the fee or fee reconciler
* along with this tx, fee reconciler allows
* fee calculation on the fly
*
* safeMode: boolean, specify whether to skip cell
* containing data or type script or not,
* default to be true
*
* deps: DepCellInfo | Array<DepCellInfo>
* specify deps included in this tx, filling
* in the `cellDeps` field of a raw tx
*
* capacityThreshold?: Capacity, specify the minimal capacity of
* each outputs, default to be 6_100_000_000
* shannon(61 CKB) for a bare cell
*
* changeThreshold?: Capacity, specify the minimal capacity of
* the change cell, default to be 6_100_000_000
* shannon(61 CKB) for a bare cell, useful on
* sending a tx without change by setting it 0
*
* changeLockScript?: CKBComponents.Script, specify the change
* receiver of this tx, default to be the owner
* of the first input
*
* witnesses?: Array<CKBComponents.WitnessArgs | CKBComponents.Witness>
* specify the witness list of this tx
*
* outputsData?: Array<string>, specify the output data list
* of this tx
* }
* ```
* @example m-n tx
* ```
* {
* fromAddresses: Address[], specify the address of inputs
*
* receivePairs: Array<{
* address: Address;
* capacity: Capacity;
* type?: CKBComponents.Script | null
* }>
* specify address, capacity and type lock
* of outputs
*
* cells: Map<LockHash, RawTransactionParams.Cell[]>
* provide live cells to generate input cells
* in this tx
*
* fee?: same as that in 1-1 tx
* safeMode: same as that in 1-1 tx
* deps: same as that in 1-1 tx
* capacityThreshold?: same as that in 1-1 tx
* changeThreshold?: same as that in 1-1 tx
* changeLockScript?: same as that in 1-1 tx
* witnesses?: same as that in 1-1 tx
* outputsData?: same as that in 1-1 tx
* }
* ```
*/
public generateRawTransaction = ({
fee,
safeMode = true,
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.102.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.101.0...v0.102.1) (2022-02-17)

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





# [0.102.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.101.0...v0.102.0) (2022-02-16)

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





# [0.101.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.43.0...v0.101.0) (2021-10-25)


Expand Down
8 changes: 4 additions & 4 deletions packages/ckb-sdk-rpc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nervosnetwork/ckb-sdk-rpc",
"version": "0.101.0",
"version": "0.102.1",
"description": "RPC module of @nervosnetwork/ckb-sdk-core",
"author": "Nervos <[email protected]>",
"homepage": "https://github.com/nervosnetwork/ckb-sdk-js/packages/ckb-rpc#readme",
Expand Down Expand Up @@ -33,12 +33,12 @@
"url": "https://github.com/nervosnetwork/ckb-sdk-js/issues"
},
"dependencies": {
"@nervosnetwork/ckb-sdk-utils": "0.101.0",
"@nervosnetwork/ckb-sdk-utils": "0.102.1",
"axios": "0.21.4",
"tslib": "2.3.1"
},
"devDependencies": {
"@nervosnetwork/ckb-types": "0.101.0"
"@nervosnetwork/ckb-types": "0.102.1"
},
"gitHead": "19434575f22752458bfcce58f68faae483daa23d"
"gitHead": "78ef8aea8ca68f25528c8eb3aed4506ea4a37241"
}
16 changes: 16 additions & 0 deletions packages/ckb-sdk-utils/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.102.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.101.0...v0.102.1) (2022-02-17)

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





# [0.102.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.101.0...v0.102.0) (2022-02-16)

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





# [0.101.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.43.0...v0.101.0) (2021-10-25)


Expand Down
6 changes: 3 additions & 3 deletions packages/ckb-sdk-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nervosnetwork/ckb-sdk-utils",
"version": "0.101.0",
"version": "0.102.1",
"description": "Utils module of @nervosnetwork/ckb-sdk-core",
"author": "Nervos <[email protected]>",
"homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme",
Expand Down Expand Up @@ -31,7 +31,7 @@
"url": "https://github.com/nervosnetwork/ckb-sdk-js/issues"
},
"dependencies": {
"@nervosnetwork/ckb-types": "0.101.0",
"@nervosnetwork/ckb-types": "0.102.1",
"bech32": "2.0.0",
"elliptic": "6.5.4",
"jsbi": "3.1.3",
Expand All @@ -41,5 +41,5 @@
"@types/bitcoinjs-lib": "5.0.0",
"@types/elliptic": "6.4.12"
},
"gitHead": "19434575f22752458bfcce58f68faae483daa23d"
"gitHead": "78ef8aea8ca68f25528c8eb3aed4506ea4a37241"
}
16 changes: 16 additions & 0 deletions packages/ckb-types/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.102.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.101.0...v0.102.1) (2022-02-17)

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





# [0.102.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.101.0...v0.102.0) (2022-02-16)

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





# [0.101.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.43.0...v0.101.0) (2021-10-25)


Expand Down
7 changes: 2 additions & 5 deletions packages/ckb-types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nervosnetwork/ckb-types",
"version": "0.101.0",
"version": "0.102.1",
"description": "Type module of @nervosnetwork/ckb-sdk-core",
"author": "Nervos <[email protected]>",
"homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme",
Expand All @@ -20,8 +20,5 @@
"bugs": {
"url": "https://github.com/nervosnetwork/ckb-sdk-js/issues"
},
"scripts": {
"doc": "../../node_modules/.bin/typedoc --out docs ./index.d.ts --mode modules --includeDeclarations --excludeExternals --ignoreCompilerErrors --theme default --readme README.md"
},
"gitHead": "19434575f22752458bfcce58f68faae483daa23d"
"gitHead": "78ef8aea8ca68f25528c8eb3aed4506ea4a37241"
}
2 changes: 1 addition & 1 deletion packages/ckb-types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"outDir": "./lib"
},
"include": ["./src"]
"files": ["index.d.ts"]
}
12 changes: 12 additions & 0 deletions scripts/bundle-umd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

BASE_DIR="packages/ckb-sdk-core/umd/"

npx rimraf $BASE_DIR
mkdir $BASE_DIR
echo "module.exports = require('@nervosnetwork/ckb-sdk-core').default;" > "${BASE_DIR}entry.js"
npx browserify "${BASE_DIR}entry.js" -o "${BASE_DIR}ckb-sdk.js" -s CKBCore
npx terser --compress --mangle -o "${BASE_DIR}ckb-sdk.umd.js" -- "${BASE_DIR}ckb-sdk.js"
npx rimraf "${BASE_DIR}/entry.js"
npx rimraf "${BASE_DIR}/ckb-sdk.js"

Loading

0 comments on commit 6d56ed8

Please sign in to comment.