Skip to content

Commit

Permalink
Merge pull request #337 from nervosnetwork/rc/v0.19.1
Browse files Browse the repository at this point in the history
[ᚬmaster] Rc/v0.19.1
  • Loading branch information
Keith-CY authored Aug 28, 2019
2 parents f9fa66c + b87e7dd commit bd8e6c9
Show file tree
Hide file tree
Showing 19 changed files with 151 additions and 40 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.19.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.19.0...v0.19.1) (2019-08-28)


### Features

* **rpc:** enable custom http agent and https agent ([34fca52](https://github.com/nervosnetwork/ckb-sdk-js/commit/34fca52))





# [0.19.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.18.0...v0.19.0) (2019-08-27)


Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,28 @@ After that you can use the `core` object to generate addresses, send requests, e

# RPC

## Default RPC

Please see [Default RPC](https://github.com/nervosnetwork/ckb-sdk-js/blob/develop/packages/ckb-sdk-rpc/src/defaultRPC.ts#L165)

## Persistent Connection

Please add `httpAgent` or `httpsAgent` to enable the persistent connection.

If the SDK is running in Node.js, the following steps make the persistent connection available.

```javascript
// HTTP Agent
const http = require('http')
const httpAgent = new http.Agent({ keepAlive: true })
core.rpc.setNode({ httpAgent })

// HTTPS Agent
const https = require('https')
const httpsAgent = new https.Agent({ keepAlive: true })
core.rpc.setNode({ httpsAgent })
```

# Errors

1. RPC Errors
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.19.0"
"version": "0.19.1"
}
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.19.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.19.0...v0.19.1) (2019-08-28)

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





# [0.19.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.18.0...v0.19.0) (2019-08-27)


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.19.0",
"version": "0.19.1",
"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.19.0",
"@nervosnetwork/ckb-sdk-core": "0.19.1",
"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": "1f9603b54fe5cf20077bc0aa3542706566866209"
"gitHead": "94daf197d31ea697adcdcdf0b2d6875ce8946066"
}
8 changes: 8 additions & 0 deletions packages/ckb-sdk-address/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.19.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.19.0...v0.19.1) (2019-08-28)

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





# [0.19.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.18.0...v0.19.0) (2019-08-27)

**Note:** Version bump only for package @nervosnetwork/ckb-sdk-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.19.0",
"version": "0.19.1",
"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.19.0",
"@nervosnetwork/ckb-types": "0.19.0"
"@nervosnetwork/ckb-sdk-utils": "0.19.1",
"@nervosnetwork/ckb-types": "0.19.1"
},
"gitHead": "1f9603b54fe5cf20077bc0aa3542706566866209"
"gitHead": "94daf197d31ea697adcdcdf0b2d6875ce8946066"
}
8 changes: 8 additions & 0 deletions packages/ckb-sdk-core/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.19.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.19.0...v0.19.1) (2019-08-28)

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





# [0.19.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.18.0...v0.19.0) (2019-08-27)


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.19.0",
"version": "0.19.1",
"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.19.0",
"@nervosnetwork/ckb-sdk-rpc": "0.19.0",
"@nervosnetwork/ckb-sdk-utils": "0.19.0",
"@nervosnetwork/ckb-types": "0.19.0"
"@nervosnetwork/ckb-sdk-address": "0.19.1",
"@nervosnetwork/ckb-sdk-rpc": "0.19.1",
"@nervosnetwork/ckb-sdk-utils": "0.19.1",
"@nervosnetwork/ckb-types": "0.19.1"
},
"devDependencies": {
"@types/crypto-js": "3.1.43"
},
"gitHead": "1f9603b54fe5cf20077bc0aa3542706566866209"
"gitHead": "94daf197d31ea697adcdcdf0b2d6875ce8946066"
}
11 changes: 11 additions & 0 deletions packages/ckb-sdk-rpc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.19.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.19.0...v0.19.1) (2019-08-28)


### Features

* **rpc:** enable custom http agent and https agent ([34fca52](https://github.com/nervosnetwork/ckb-sdk-js/commit/34fca52))





# [0.19.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.18.0...v0.19.0) (2019-08-27)


Expand Down
22 changes: 21 additions & 1 deletion packages/ckb-sdk-rpc/__tests__/ckb-rpc-helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const path = require('path')
const http = require('http')
const https = require('https')

const env = path.join(__dirname, '../.env')

Expand Down Expand Up @@ -32,14 +34,32 @@ describe('ckb-rpc settings and helpers', () => {
rpc.setDebugLevel(DebugLevel.Off)
})

it('set node', () => {
it('set node url', () => {
const node = {
url: 'http://localhost:8114',
}
rpc.setNode(node)
expect(rpc.node).toEqual(node)
})

it('set http agent', () => {
const httpAgent = new http.Agent()
const node = {
httpAgent,
}
rpc.setNode(node)
expect(rpc.node.httpAgent).toBeDefined()
})

it('set https agent', () => {
const httpsAgent = new https.Agent()
const node = {
httpsAgent,
}
rpc.setNode(node)
expect(rpc.node.httpsAgent).toBeDefined()
})

it('has 27 default rpc', () => {
expect(rpc.methods.length).toBe(27)
})
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.19.0",
"version": "0.19.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 @@ -32,12 +32,12 @@
"url": "https://github.com/nervosnetwork/ckb-sdk-js/issues"
},
"dependencies": {
"@nervosnetwork/ckb-sdk-utils": "0.19.0",
"@nervosnetwork/ckb-sdk-utils": "0.19.1",
"axios": "0.19.0"
},
"devDependencies": {
"@nervosnetwork/ckb-types": "0.19.0",
"@nervosnetwork/ckb-types": "0.19.1",
"@types/crypto-js": "3.1.43"
},
"gitHead": "1f9603b54fe5cf20077bc0aa3542706566866209"
"gitHead": "94daf197d31ea697adcdcdf0b2d6875ce8946066"
}
2 changes: 2 additions & 0 deletions packages/ckb-sdk-rpc/src/method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class Method {
},
data: payload,
url: this.node.url,
httpAgent: this.node.httpAgent,
httpsAgent: this.node.httpsAgent,
}).then(res => {
if (res.data.id !== id) {
throw new Error('JSONRPC id not match')
Expand Down
8 changes: 8 additions & 0 deletions packages/ckb-sdk-utils/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.19.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.19.0...v0.19.1) (2019-08-28)

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





# [0.19.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.18.0...v0.19.0) (2019-08-27)


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.19.0",
"version": "0.19.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 @@ -30,7 +30,7 @@
"url": "https://github.com/nervosnetwork/ckb-sdk-js/issues"
},
"dependencies": {
"@nervosnetwork/ckb-types": "0.19.0",
"@nervosnetwork/ckb-types": "0.19.1",
"blake2b-wasm": "1.1.7",
"elliptic": "6.4.1"
},
Expand All @@ -39,5 +39,5 @@
"@types/elliptic": "6.4.8",
"@types/utf8": "2.1.6"
},
"gitHead": "1f9603b54fe5cf20077bc0aa3542706566866209"
"gitHead": "94daf197d31ea697adcdcdf0b2d6875ce8946066"
}
11 changes: 11 additions & 0 deletions packages/ckb-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.19.1](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.19.0...v0.19.1) (2019-08-28)


### Features

* **rpc:** enable custom http agent and https agent ([34fca52](https://github.com/nervosnetwork/ckb-sdk-js/commit/34fca52))





# [0.19.0](https://github.com/nervosnetwork/ckb-sdk-js/compare/v0.18.0...v0.19.0) (2019-08-27)


Expand Down
2 changes: 2 additions & 0 deletions packages/ckb-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ declare namespace CKBComponents {
export type Since = string
export interface Node {
url: string
httpAgent?: any
httpsAgent?: any
}
export interface Method {
name: string
Expand Down
4 changes: 2 additions & 2 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.19.0",
"version": "0.19.1",
"description": "Type module of @nervosnetwork/ckb-sdk-core",
"author": "Nervos <[email protected]>",
"homepage": "https://github.com/nervosnetwork/ckb-sdk-js#readme",
Expand All @@ -26,5 +26,5 @@
"devDependencies": {
"@types/crypto-js": "3.1.43"
},
"gitHead": "1f9603b54fe5cf20077bc0aa3542706566866209"
"gitHead": "94daf197d31ea697adcdcdf0b2d6875ce8946066"
}
Loading

0 comments on commit bd8e6c9

Please sign in to comment.