Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5f35ee3bf | ||
|
|
c776f0d815 | ||
|
|
c1a23937bd | ||
|
|
241febb707 | ||
|
|
357c7368d2 | ||
|
|
4e4ff5de4b | ||
|
|
8d80bf869b | ||
|
|
337c67ff30 | ||
|
|
66573f6234 | ||
|
|
408129d5ca | ||
|
|
efa6661817 | ||
|
|
c988d5011c | ||
|
|
f173bb3d2a | ||
|
|
1f0368061f | ||
|
|
45ef924862 | ||
|
|
dec88b6ab7 | ||
|
|
ed402341dc | ||
|
|
76a9f2787c | ||
|
|
5b1c9b8ccb | ||
|
|
af751c6c89 | ||
|
|
4ab8dd70bd | ||
|
|
a5f59ca926 | ||
|
|
71f26aac8d | ||
|
|
cc7d6a2e01 | ||
|
|
e29f0a3920 | ||
|
|
f38975d126 | ||
|
|
dc4b59bb0c | ||
|
|
2f5df085b6 | ||
|
|
225ca1de00 | ||
|
|
aeb500e804 | ||
|
|
e9dd6f1efc | ||
|
|
563dbbf7e4 | ||
|
|
5a5bc7da0b | ||
|
|
fb2c51a49b | ||
|
|
568e3b7840 | ||
|
|
87d69d7098 | ||
|
|
255cd93bf4 | ||
|
|
ef5780996e | ||
|
|
5155ae8d2b | ||
|
|
f1447ffcbc | ||
|
|
64e9ec5044 | ||
|
|
05986f6d64 | ||
|
|
caca69525a | ||
|
|
845398846c | ||
|
|
412ca6ccd7 | ||
|
|
9232fd5a91 | ||
|
|
49174d181e | ||
|
|
c5bc09fde7 | ||
|
|
1a436906f5 | ||
|
|
d7bb55c003 | ||
|
|
50f015a713 | ||
|
|
1c94508d61 | ||
|
|
ddb007de7b | ||
|
|
8bee7d5d6b | ||
|
|
253eea9249 | ||
|
|
502fdc1e32 | ||
|
|
f3aaaede25 | ||
|
|
309d691938 | ||
|
|
4d6438c3e7 |
+1
-1
@@ -1 +1 @@
|
||||
1
|
||||
2
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
working_directory: ~/polkadot-js
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: dependency-cache-{{ checksum "yarn.lock" }}
|
||||
- run:
|
||||
name: install-deps
|
||||
command: yarn install --frozen-lockfile
|
||||
- save_cache:
|
||||
key: dependency-cache-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- ./node_modules
|
||||
- ~/.cache/yarn
|
||||
- run:
|
||||
name: build
|
||||
command: yarn polkadot-dev-circleci-build
|
||||
+1
-1
@@ -5,7 +5,7 @@ module.exports = {
|
||||
parserOptions: {
|
||||
...base.parserOptions,
|
||||
project: [
|
||||
'./tsconfig.eslint.json'
|
||||
'./tsconfig.json'
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
name: PR
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Linting
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: lint
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn lint
|
||||
|
||||
test:
|
||||
name: Testing
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: test
|
||||
env:
|
||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn test
|
||||
|
||||
build_code:
|
||||
name: Build Code
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: build
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn build
|
||||
|
||||
build_docs:
|
||||
name: Build Docs
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: build
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn docs
|
||||
@@ -0,0 +1,67 @@
|
||||
name: Master
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build_code:
|
||||
name: Build Code
|
||||
if: "! contains(github.event.head_commit.message, '[CI Skip]')"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: build
|
||||
env:
|
||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
GH_TOKEN: ${{ secrets.GH_PAT }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn polkadot-dev-ghact-build
|
||||
|
||||
build_docs:
|
||||
name: Build Docs
|
||||
if: "! contains(github.event.head_commit.message, '[CI Skip]')"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: build
|
||||
env:
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
GH_TOKEN: ${{ secrets.GH_PAT }}
|
||||
GH_PAGES_SRC: build-docs
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn polkadot-dev-ghact-docs
|
||||
|
||||
dummy:
|
||||
name: Dummy
|
||||
if: "contains(github.event.head_commit.message, '[CI Skip]')"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- name: dummy
|
||||
run: |
|
||||
echo "Dummy skip step"
|
||||
@@ -20,3 +20,5 @@ yarn-debug.log*
|
||||
yarn-error.log*
|
||||
store.db
|
||||
store.db.compacted
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "10"
|
||||
env:
|
||||
global:
|
||||
- CC_TEST_REPORTER_ID=27a299582eb7fd9580e27897a6ecda1c82a1cd24bcfe2f2ebda1ca70238509b4
|
||||
- GH_PAGES_SRC="build-docs"
|
||||
cache:
|
||||
yarn: true
|
||||
directories:
|
||||
- node_modules
|
||||
before_install:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
||||
- chmod +x ./cc-test-reporter
|
||||
- export PATH=$HOME/.yarn/bin:$(yarn global bin):$PATH
|
||||
before_script:
|
||||
- ./cc-test-reporter before-build
|
||||
script:
|
||||
- yarn polkadot-dev-travis-build
|
||||
after_script:
|
||||
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
||||
deploy:
|
||||
skip_cleanup: true
|
||||
provider: script
|
||||
script: yarn polkadot-dev-travis-deploy
|
||||
on:
|
||||
branch: master
|
||||
@@ -1,3 +1,17 @@
|
||||
# 1.8.1
|
||||
|
||||
- Add cross-client encryption/decryption support (Thanks to https://github.com/hskang9)
|
||||
|
||||
# 1.7.1
|
||||
|
||||
- `formatBalance` signature now allows to force unit displays
|
||||
- Keypair now allows for derive on a pair, with `pair.derive(...)`
|
||||
- `assert` now acts like a real asserts, with no return - signature adapted for new TS 3.7
|
||||
|
||||
# 1.6.1
|
||||
|
||||
- `pair.sign(message)` now takes an optional second `options?: SignOptions` parameter, where `SignOptions` is currently defined as `{ withType: boolean }`. Here `withType` instructs the signing to prepend the type of signature (ed2551, sr25519 or ecdsa). This is used for the new Polkadot/Substrate MultiSignature format.
|
||||
|
||||
# 1.5.1
|
||||
|
||||
- Fix typings on the Keyring-exposed encode & decodeAddress
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "1.5.1"
|
||||
"version": "1.8.1"
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.5.1",
|
||||
"version": "1.8.1",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"yarn": "^1.10.1"
|
||||
@@ -9,11 +9,11 @@
|
||||
],
|
||||
"resolutions": {
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"typescript": "^3.6.3"
|
||||
"typescript": "^3.7.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "polkadot-dev-build-ts && polkadot-dev-build-docs",
|
||||
"check": "yarn lint",
|
||||
"build": "polkadot-dev-build-ts",
|
||||
"docs": "polkadot-dev-build-docs",
|
||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx . && tsc --noEmit --pretty",
|
||||
"clean": "polkadot-dev-clean-build",
|
||||
"postinstall": "polkadot-dev-yarn-only",
|
||||
@@ -21,9 +21,9 @@
|
||||
"test:one": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.6.2",
|
||||
"@polkadot/dev": "^0.31.1",
|
||||
"@polkadot/ts": "^0.1.73",
|
||||
"@babel/core": "^7.7.7",
|
||||
"@polkadot/dev": "^0.32.14",
|
||||
"@polkadot/ts": "^0.1.90",
|
||||
"gh-pages": "^2.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/chainspec",
|
||||
"version": "1.5.1",
|
||||
"version": "1.8.1",
|
||||
"description": "Contains chain specifications for known chains",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -25,7 +25,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/chainspec#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.2",
|
||||
"@polkadot/util": "^1.5.1"
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@polkadot/util": "^1.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/chainspec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/chainspec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/chainspec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/chainspec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/chainspec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/chainspec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/chainspec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/chainspec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/db",
|
||||
"version": "1.5.1",
|
||||
"version": "1.8.1",
|
||||
"description": "Implementation of a basic sync in-memory and on-disk databases with overlays",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -25,9 +25,9 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/db#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.2",
|
||||
"@polkadot/trie-hash": "^1.5.1",
|
||||
"@polkadot/util": "^1.5.1",
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@polkadot/trie-hash": "^1.8.1",
|
||||
"@polkadot/util": "^1.8.1",
|
||||
"lru_map": "^0.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -62,7 +62,7 @@ import TransactionDb from './engines/TransactionDb';
|
||||
* ```
|
||||
*/
|
||||
export default class Memory extends TransactionDb {
|
||||
public constructor () {
|
||||
constructor () {
|
||||
super(new MemoryDb());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class LruDb implements BaseDb {
|
||||
|
||||
private lru: LRUMap<string, CachedValue>;
|
||||
|
||||
public constructor (backing: BaseDb, itemCount: number = DEFAULT_ITEM_COUNT) {
|
||||
constructor (backing: BaseDb, itemCount: number = DEFAULT_ITEM_COUNT) {
|
||||
this.backing = backing;
|
||||
this.lru = new LRUMap(itemCount);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class TransactionDb implements TxDb {
|
||||
|
||||
private txStarted: boolean;
|
||||
|
||||
public constructor (backing: BaseDb) {
|
||||
constructor (backing: BaseDb) {
|
||||
this.backing = backing;
|
||||
this.txStarted = false;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/keyring",
|
||||
"version": "1.5.1",
|
||||
"version": "1.8.1",
|
||||
"description": "Keyring management",
|
||||
"main": "index.js",
|
||||
"publishConfig": {
|
||||
@@ -27,8 +27,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.2",
|
||||
"@polkadot/util": "^1.5.1",
|
||||
"@polkadot/util-crypto": "^1.5.1"
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@polkadot/util": "^1.8.1",
|
||||
"@polkadot/util-crypto": "^1.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -39,7 +39,7 @@ export default class Keyring implements KeyringInstance {
|
||||
|
||||
public setSS58Format = setSS58Format;
|
||||
|
||||
public constructor (options: KeyringOptions = {}) {
|
||||
constructor (options: KeyringOptions = {}) {
|
||||
options.type = options.type || 'ed25519';
|
||||
options.ss58Format = isNumber(options.ss58Format)
|
||||
? options.addressPrefix
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -14,10 +14,9 @@ type DecodeResult = PairInfo & {
|
||||
secretKey: Uint8Array;
|
||||
};
|
||||
|
||||
export default function decode (passphrase?: string, _encrypted?: Uint8Array | null): DecodeResult {
|
||||
assert(_encrypted, 'No encrypted data available to decode');
|
||||
export default function decode (passphrase?: string, encrypted?: Uint8Array | null): DecodeResult {
|
||||
assert(encrypted, 'No encrypted data available to decode');
|
||||
|
||||
const encrypted = (_encrypted as Uint8Array);
|
||||
const encoded = passphrase
|
||||
? (naclDecrypt(
|
||||
encrypted.subarray(NONCE_LENGTH),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function encode ({ publicKey, secretKey }: PairInfo, passphrase?:
|
||||
|
||||
const encoded = u8aConcat(
|
||||
PKCS8_HEADER,
|
||||
secretKey as Uint8Array,
|
||||
secretKey,
|
||||
PKCS8_DIVIDER,
|
||||
publicKey
|
||||
);
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { setSS58Format } from '@polkadot/util-crypto';
|
||||
import { cryptoWaitReady, setSS58Format } from '@polkadot/util-crypto';
|
||||
|
||||
import { PAIRS } from '../testing';
|
||||
import testingPairs from '../testingPairs';
|
||||
import createPair from '.';
|
||||
|
||||
const keyring = testingPairs({ type: 'ed25519' }, false);
|
||||
|
||||
describe('pair', (): void => {
|
||||
beforeEach(async (): Promise<void> => {
|
||||
await cryptoWaitReady();
|
||||
});
|
||||
|
||||
const SIGNATURE = new Uint8Array([80, 191, 198, 147, 225, 207, 75, 88, 126, 39, 129, 109, 191, 38, 72, 181, 75, 254, 81, 143, 244, 79, 237, 38, 236, 141, 28, 252, 134, 26, 169, 234, 79, 33, 153, 158, 151, 34, 175, 188, 235, 20, 35, 135, 83, 120, 139, 211, 233, 130, 1, 208, 201, 215, 73, 80, 56, 98, 185, 196, 11, 8, 193, 14]);
|
||||
|
||||
it('has a publicKey', (): void => {
|
||||
@@ -66,6 +71,8 @@ describe('pair', (): void => {
|
||||
expect(keyring.alice.address).toEqual(
|
||||
'7sGUeMak588SPY2YMmmuKUuLz7u2WQpf74F9dCFtSLB2td9d'
|
||||
);
|
||||
|
||||
setSS58Format(42);
|
||||
});
|
||||
|
||||
it('allows getting public key after decoding', (): void => {
|
||||
@@ -77,4 +84,13 @@ describe('pair', (): void => {
|
||||
|
||||
expect(pair.isLocked).toEqual(false);
|
||||
});
|
||||
|
||||
it('allows derivation on the pair', (): void => {
|
||||
const alice = createPair('sr25519', { publicKey: PAIRS[0].publicKey, secretKey: PAIRS[0].secretKey }, {});
|
||||
const stash = alice.derive('//stash');
|
||||
const soft = alice.derive('//funding/0');
|
||||
|
||||
expect(stash.publicKey).toEqual(PAIRS[1].publicKey);
|
||||
expect(soft.address).toEqual('5ECQNn7UueWHPFda5qUi4fTmTtyCnPvGnuoyVVSj5CboJh9J');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Keypair, KeypairType } from '@polkadot/util-crypto/types';
|
||||
import { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '../types';
|
||||
import { KeyringPair, KeyringPair$Json, KeyringPair$Meta, SignOptions } from '../types';
|
||||
import { PairInfo } from './types';
|
||||
|
||||
import { encodeAddress, naclKeypairFromSeed as naclFromSeed, naclSign, naclVerify, schnorrkelKeypairFromSeed as schnorrkelFromSeed, schnorrkelSign, schnorrkelVerify } from '@polkadot/util-crypto';
|
||||
import { u8aConcat, assert } from '@polkadot/util';
|
||||
import { encodeAddress, keyExtractPath, keyFromPath, naclKeypairFromSeed as naclFromSeed, naclSign, naclVerify, schnorrkelKeypairFromSeed as schnorrkelFromSeed, schnorrkelSign, schnorrkelVerify } from '@polkadot/util-crypto';
|
||||
|
||||
import decode from './decode';
|
||||
import encode from './encode';
|
||||
import toJson from './toJson';
|
||||
|
||||
const SIG_TYPE_NONE = new Uint8Array();
|
||||
const SIG_TYPE_ED25519 = new Uint8Array([0]);
|
||||
const SIG_TYPE_SR25519 = new Uint8Array([1]);
|
||||
// const SIG_TYPE_ECDSA = new Uint8Array([2]);
|
||||
|
||||
function isEmpty (u8a: Uint8Array): boolean {
|
||||
return u8a.reduce((count, u8): number => count + u8, 0) === 0;
|
||||
}
|
||||
@@ -24,10 +30,24 @@ const fromSeed = (type: KeypairType, seed: Uint8Array): Keypair =>
|
||||
? schnorrkelFromSeed(seed)
|
||||
: naclFromSeed(seed);
|
||||
|
||||
const sign = (type: KeypairType, message: Uint8Array, pair: Partial<Keypair>): Uint8Array =>
|
||||
isSr25519(type)
|
||||
? schnorrkelSign(message, pair)
|
||||
: naclSign(message, pair);
|
||||
const sign = (type: KeypairType, message: Uint8Array, pair: Partial<Keypair>, { withType = false }: SignOptions = {}): Uint8Array => {
|
||||
const typeSr25519 = isSr25519(type);
|
||||
|
||||
return u8aConcat(
|
||||
// for multi-signatures, i.e. with indicator, append the signature type as per
|
||||
// the MultiSignature enum
|
||||
withType
|
||||
? (
|
||||
typeSr25519
|
||||
? SIG_TYPE_SR25519
|
||||
: SIG_TYPE_ED25519
|
||||
)
|
||||
: SIG_TYPE_NONE,
|
||||
typeSr25519
|
||||
? schnorrkelSign(message, pair)
|
||||
: naclSign(message, pair)
|
||||
);
|
||||
};
|
||||
|
||||
const verify = (type: KeypairType, message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean =>
|
||||
isSr25519(type)
|
||||
@@ -67,10 +87,21 @@ const verify = (type: KeypairType, message: Uint8Array, signature: Uint8Array, p
|
||||
*/
|
||||
export default function createPair (type: KeypairType, { publicKey, secretKey }: PairInfo, meta: KeyringPair$Meta = {}, encoded: Uint8Array | null = null): KeyringPair {
|
||||
return {
|
||||
type,
|
||||
get address (): string {
|
||||
return encodeAddress(publicKey);
|
||||
},
|
||||
get meta (): KeyringPair$Meta {
|
||||
return meta;
|
||||
},
|
||||
get isLocked (): boolean {
|
||||
return !secretKey || secretKey.length === 0 || isEmpty(secretKey);
|
||||
},
|
||||
get publicKey (): Uint8Array {
|
||||
return publicKey;
|
||||
},
|
||||
get type (): KeypairType {
|
||||
return type;
|
||||
},
|
||||
decodePkcs8: (passphrase?: string, _encoded?: Uint8Array | null): void => {
|
||||
const decoded = decode(passphrase, _encoded || encoded);
|
||||
|
||||
@@ -84,25 +115,24 @@ export default function createPair (type: KeypairType, { publicKey, secretKey }:
|
||||
secretKey = pair.secretKey;
|
||||
}
|
||||
},
|
||||
derive: (suri: string, meta?: KeyringPair$Meta): KeyringPair => {
|
||||
assert(secretKey, 'Cannot derive on a locked keypair');
|
||||
|
||||
const { path } = keyExtractPath(suri);
|
||||
const derived = keyFromPath({ publicKey, secretKey: secretKey }, path, type);
|
||||
|
||||
return createPair(type, derived, meta, null);
|
||||
},
|
||||
encodePkcs8: (passphrase?: string): Uint8Array =>
|
||||
encode({ publicKey, secretKey }, passphrase),
|
||||
get meta (): KeyringPair$Meta {
|
||||
return meta;
|
||||
},
|
||||
get isLocked (): boolean {
|
||||
return !secretKey || secretKey.length === 0 || isEmpty(secretKey);
|
||||
},
|
||||
lock: (): void => {
|
||||
secretKey = new Uint8Array(0);
|
||||
},
|
||||
get publicKey (): Uint8Array {
|
||||
return publicKey;
|
||||
},
|
||||
setMeta: (additional: KeyringPair$Meta): void => {
|
||||
meta = { ...meta, ...additional };
|
||||
},
|
||||
sign: (message: Uint8Array): Uint8Array =>
|
||||
sign(type, message, { publicKey, secretKey }),
|
||||
sign: (message: Uint8Array, options?: SignOptions): Uint8Array =>
|
||||
sign(type, message, { publicKey, secretKey }, options),
|
||||
toJson: (passphrase?: string): KeyringPair$Json =>
|
||||
toJson(type, { meta, publicKey }, encode({ publicKey, secretKey }, passphrase), !!passphrase),
|
||||
verify: (message: Uint8Array, signature: Uint8Array): boolean =>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -24,13 +24,16 @@ const json: KeyringPair$Json = {
|
||||
};
|
||||
|
||||
export default function everybody (): KeyringPair {
|
||||
return {
|
||||
const pair: KeyringPair = {
|
||||
type: 'ed25519',
|
||||
address,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
decodePkcs8: (passphrase?: string, encoded?: Uint8Array): void =>
|
||||
undefined,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
derive: (suri: string, meta?: KeyringPair$Meta): KeyringPair =>
|
||||
pair,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
encodePkcs8: (passphrase?: string): Uint8Array =>
|
||||
new Uint8Array(0),
|
||||
meta,
|
||||
@@ -52,4 +55,6 @@ export default function everybody (): KeyringPair {
|
||||
verify: (message: Uint8Array, signature: Uint8Array): boolean =>
|
||||
false
|
||||
};
|
||||
|
||||
return pair;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -12,7 +12,7 @@ type KeyringPairMap = Record<string, KeyringPair>;
|
||||
export default class Pairs implements KeyringPairs {
|
||||
private _map: KeyringPairMap;
|
||||
|
||||
public constructor () {
|
||||
constructor () {
|
||||
this._map = {};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -21,7 +21,7 @@ interface PairDef {
|
||||
// keyring is for testing - what happens is that in most cases the keyring is initialises
|
||||
// before anything else. Since the sr25519 crypto is async, this creates problems with
|
||||
// adding the keys when only the keyring is used.
|
||||
const PAIRS: PairDef[] = [
|
||||
export const PAIRS: PairDef[] = [
|
||||
{
|
||||
seed: 'Alice',
|
||||
secretKey: hexToU8a('0x98319d4ff8a9508c4bb0cf0b5a78d760a0b2082c02775e6e82370816fedfff48925a225d97aa00682d6a59b95b18780c10d7032336e88f3442b42361f4a66011'),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/class-name-casing */
|
||||
// Copyright 2017-2019 @polkadot/keyring authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/keyring authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -33,18 +33,23 @@ export interface KeyringPair$Json {
|
||||
meta: KeyringPair$Meta;
|
||||
}
|
||||
|
||||
export interface SignOptions {
|
||||
withType?: boolean;
|
||||
}
|
||||
|
||||
export interface KeyringPair {
|
||||
readonly address: string;
|
||||
readonly meta: KeyringPair$Meta;
|
||||
readonly isLocked: boolean;
|
||||
readonly publicKey: Uint8Array;
|
||||
readonly type: KeypairType;
|
||||
|
||||
address: string;
|
||||
decodePkcs8: (passphrase?: string, encoded?: Uint8Array) => void;
|
||||
derive: (suri: string, meta?: KeyringPair$Meta) => KeyringPair;
|
||||
encodePkcs8: (passphrase?: string) => Uint8Array;
|
||||
meta: KeyringPair$Meta;
|
||||
isLocked: boolean;
|
||||
lock: () => void;
|
||||
publicKey: Uint8Array;
|
||||
setMeta: (meta: KeyringPair$Meta) => void;
|
||||
sign (message: Uint8Array): Uint8Array;
|
||||
sign (message: Uint8Array, options?: SignOptions): Uint8Array;
|
||||
toJson (passphrase?: string): KeyringPair$Json;
|
||||
verify (message: Uint8Array, signature: Uint8Array): boolean;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/trie-codec",
|
||||
"version": "1.5.1",
|
||||
"version": "1.8.1",
|
||||
"description": "This is an implementation of the codec for Substrate Trie",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -25,7 +25,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-codec#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.2",
|
||||
"@polkadot/util": "^1.5.1"
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@polkadot/util": "^1.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -21,7 +21,7 @@ export default class NodeHeader {
|
||||
|
||||
private _value: Null | BranchHeader | ExtensionHeader | LeafHeader;
|
||||
|
||||
public constructor (input?: null | Uint8Array | (null | Uint8Array)[]) {
|
||||
constructor (input?: null | Uint8Array | (null | Uint8Array)[]) {
|
||||
const [nodeType, value] = Array.isArray(input)
|
||||
? NodeHeader.decodeNodeHeaderArray(input)
|
||||
: NodeHeader.decodeNodeHeaderU8a(input);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-codec authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-codec authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/trie-db",
|
||||
"version": "1.5.1",
|
||||
"version": "1.8.1",
|
||||
"description": "This is an implementation of the modified merkle patricia tree as specified in Ethereum's yellow paper, adapted for Polkadot",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -25,16 +25,16 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-db#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.2",
|
||||
"@polkadot/db": "^1.5.1",
|
||||
"@polkadot/trie-codec": "^1.5.1",
|
||||
"@polkadot/trie-hash": "^1.5.1",
|
||||
"@polkadot/util": "^1.5.1",
|
||||
"@polkadot/util-crypto": "^1.5.1"
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@polkadot/db": "^1.8.1",
|
||||
"@polkadot/trie-codec": "^1.8.1",
|
||||
"@polkadot/trie-hash": "^1.8.1",
|
||||
"@polkadot/util": "^1.8.1",
|
||||
"@polkadot/util-crypto": "^1.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/chainspec": "^1.5.1",
|
||||
"@polkadot/util-rlp": "^1.5.1",
|
||||
"@polkadot/chainspec": "^1.8.1",
|
||||
"@polkadot/util-rlp": "^1.8.1",
|
||||
"ethereumjs-testing": "1.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -7,7 +7,7 @@ export default class Checkpoint {
|
||||
|
||||
protected rootHash: Uint8Array;
|
||||
|
||||
public constructor (rootHash: Uint8Array) {
|
||||
constructor (rootHash: Uint8Array) {
|
||||
this.rootHash = rootHash;
|
||||
this.txRoot = rootHash;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -42,7 +42,7 @@ export default class Impl extends Checkpoint {
|
||||
|
||||
protected constants: Constants;
|
||||
|
||||
public constructor (db: TxDb, rootHash?: Uint8Array, codec: Codec = substrateCodec) {
|
||||
constructor (db: TxDb, rootHash?: Uint8Array, codec: Codec = substrateCodec) {
|
||||
const _constants = constants(codec);
|
||||
|
||||
super(rootHash || _constants.EMPTY_HASH);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -25,7 +25,7 @@ const l = logger('trie/db');
|
||||
* @example See [Polkadot-JS Common Trie-DB Examples](https://polkadot.js.org/api/common/examples/trie-db/)
|
||||
*/
|
||||
export default class Trie extends Impl implements TrieDb {
|
||||
public constructor (db: TxDb = new MemoryDb(), rootHash?: Uint8Array, codec?: Codec) {
|
||||
constructor (db: TxDb = new MemoryDb(), rootHash?: Uint8Array, codec?: Codec) {
|
||||
super(db, rootHash, codec);
|
||||
|
||||
l.debug((): string => `Created with ${this.codec.type} codec, root ${u8aToHex(this.rootHash, 64)}`);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -36,7 +36,7 @@ describe('snapshots', (): void => {
|
||||
trie.put(toU8a('doge'), toU8a('coin'));
|
||||
trie.del(toU8a('doge'));
|
||||
|
||||
trie.snapshot(back, (): void => {});
|
||||
trie.snapshot(back, (): void => undefined);
|
||||
|
||||
expect(u8aToHex(back.getRoot())).toEqual(u8aToHex(root));
|
||||
expect(back.get(values[0].k)).toEqual(values[0].v);
|
||||
@@ -48,7 +48,7 @@ describe('snapshots', (): void => {
|
||||
values.forEach(({ k, v }): void => {
|
||||
trie.put(k, v);
|
||||
});
|
||||
trie.snapshot(back, (): void => {});
|
||||
trie.snapshot(back, (): void => undefined);
|
||||
|
||||
expect(u8aToHex(back.getRoot())).toEqual(u8aToHex(root));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-db authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-db authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/trie-hash",
|
||||
"version": "1.5.1",
|
||||
"version": "1.8.1",
|
||||
"description": "Generates trie roots from key-value pairs",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -25,10 +25,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-hash#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.2",
|
||||
"@polkadot/util": "^1.5.1"
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@polkadot/util": "^1.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/chainspec": "^1.5.1"
|
||||
"@polkadot/chainspec": "^1.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/trie-hash authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/trie-hash authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user