Compare commits

..
109 Commits
Author SHA1 Message Date
Github Actions f5f35ee3bf [CI Skip] 1.8.1
skip-checks: true
2020-01-09 10:08:27 +00:00
Jaco Greeff c776f0d815 1.8 (#499) 2020-01-09 11:05:30 +01:00
Github Actions c1a23937bd [CI Skip] 1.8.0-beta.3
skip-checks: true
2020-01-06 12:46:24 +00:00
Jaco Greeff 241febb707 Bump deps (#497) 2020-01-06 13:43:49 +01:00
Github Actions 357c7368d2 [CI Skip] 1.8.0-beta.2
skip-checks: true
2019-12-17 10:14:45 +00:00
Hyungsuk Kang 4e4ff5de4b Add cross client Encryption/Decryption (#496)
* chore: add a test

* Add KDF case for double ratchet

* chore: add .idea in .gitignore

* chore: add .vscode to .gitignore

* Remove comma-dangle
2019-12-17 11:12:06 +01:00
Github Actions 8d80bf869b [CI Skip] 1.8.0-beta.1
skip-checks: true
2019-12-07 13:01:32 +00:00
Jaco Greeff 337c67ff30 Bump deps (#495) 2019-12-07 13:58:41 +01:00
Github Actions 66573f6234 [CI Skip] 1.8.0-beta.0
skip-checks: true
2019-12-05 09:31:19 +00:00
Jaco Greeff 408129d5ca Bump deps (#494)
* Bump deps

* Linting
2019-12-05 10:28:40 +01:00
Github Actions efa6661817 [CI Skip] 1.7.1
skip-checks: true
2019-11-27 18:51:43 +00:00
Jaco Greeff c988d5011c 1.7 (#493) 2019-11-27 19:49:06 +01:00
Github Actions f173bb3d2a [CI Skip] 1.7.0-beta.8
skip-checks: true
2019-11-26 10:54:25 +00:00
Jaco Greeff 1f0368061f Bump deps (#492)
* Bump deps

* Add dummy skip step
2019-11-26 11:51:36 +01:00
Github Actions 45ef924862 [CI Skip] 1.7.0-beta.7
skip-checks: true
2019-11-13 09:20:15 +00:00
Jaco Greeff dec88b6ab7 Bump deps (#490) 2019-11-13 10:17:40 +01:00
Github Actions ed402341dc [CI Skip] 1.7.0-beta.6 2019-11-11 08:46:16 +00:00
Jaco Greeff 76a9f2787c assert does asserts conditions (TS 3.7) (#489)
* assert does asserts conditions (TS 3.7)

* Throw in condition

* Fix cleanup
2019-11-11 09:43:05 +01:00
Github Actions 5b1c9b8ccb [CI Skip] 1.7.0-beta.5 2019-11-06 21:21:52 +00:00
Jaco Greeff af751c6c89 Bump deps (#488) 2019-11-06 22:18:57 +01:00
Github Actions 4ab8dd70bd [CI Skip] 1.7.0-beta.4 2019-11-06 14:25:04 +00:00
Jaco Greeff a5f59ca926 Derive operation on keypair (#487)
* Derive operation on keypair

* nobody -> derive

* Derivation tests
2019-11-06 15:22:12 +01:00
Github Actions 71f26aac8d [CI Skip] 1.7.0-beta.3 2019-11-05 13:23:00 +00:00
Github Actions cc7d6a2e01 [CI Skip] 1.7.0-beta.2 2019-11-05 13:18:06 +00:00
Jaco Greeff e29f0a3920 Update .123trigger 2019-11-05 14:14:44 +01:00
Jaco Greeff f38975d126 Allow forcing of units in formatBalance (#486) 2019-11-05 13:53:49 +01:00
Github Actions dc4b59bb0c [CI Skip] 1.7.0-beta.1 2019-10-31 17:22:55 +00:00
Keith Ingram 2f5df085b6 move SiDef type (#485) 2019-10-31 19:19:56 +02:00
Github Actions 225ca1de00 [CI Skip] 1.7.0-beta.0 2019-10-28 16:19:21 +00:00
Jaco Greeff aeb500e804 Use GH_PAT is checkout action 2019-10-28 17:15:38 +01:00
Github Actions e9dd6f1efc [CI Skip] 1.6.1 2019-10-24 11:44:24 +00:00
Jaco Greeff 563dbbf7e4 1.6 (#484) 2019-10-24 13:41:06 +02:00
Github Actions 5a5bc7da0b [CI Skip] 1.6.0-beta.13 2019-10-24 10:13:28 +00:00
Jaco Greeff fb2c51a49b Extend sign(message, options?) with withType (#483) 2019-10-24 12:10:11 +02:00
Github Actions 568e3b7840 [CI Skip] 1.6.0-beta.12 2019-10-22 13:13:03 +00:00
Jaco Greeff 87d69d7098 Excl. tsconfig build (#482) 2019-10-22 15:09:33 +02:00
Github Actions 255cd93bf4 [CI Skip] 1.6.0-beta.11 2019-10-22 09:19:34 +00:00
Jaco Greeff ef5780996e Bump deps (#481) 2019-10-22 11:15:59 +02:00
Github Actions 5155ae8d2b [CI Skip] 1.6.0-beta.10 2019-10-12 13:09:06 +00:00
Jaco Greeff f1447ffcbc Update build (#479) 2019-10-12 15:06:11 +02:00
Jaco Greeff 64e9ec5044 [CI Skip] 1.6.0-beta.9 2019-10-09 12:53:09 +00:00
Jaco Greeff 05986f6d64 Bumps, fix GH pages deploy 2019-10-09 14:48:31 +02:00
Jaco Greeff caca69525a [CI Skip] 1.6.0-beta.8 2019-10-09 12:32:18 +00:00
Jaco Greeff 845398846c Alias GH_TOKEN 2019-10-09 14:27:56 +02:00
Jaco Greeff 412ca6ccd7 [CI Skip] 1.6.0-beta.7 2019-10-09 12:22:40 +00:00
Jaco Greeff 9232fd5a91 [CI Skip] 1.6.0-beta.6 2019-10-09 12:18:00 +00:00
Jaco Greeff 49174d181e [CI Skip] 1.6.0-beta.5 2019-10-09 12:13:41 +00:00
Jaco Greeff c5bc09fde7 Swap CI to GH actions (#477) 2019-10-09 14:08:27 +02:00
Travis CI 1a436906f5 [CI Skip] 1.6.0-beta.4 2019-10-08 12:32:21 +00:00
Jaco Greeff d7bb55c003 Bump deps (#476)
* Bump deps

* Rewrite yarn.lock
2019-10-08 14:15:52 +02:00
Jaco Greeff 50f015a713 Rename push.yml to pr.yml 2019-10-07 16:16:01 +02:00
Travis CI 1c94508d61 [CI Skip] 1.6.0-beta.3 2019-10-07 13:34:01 +00:00
Jaco Greeff ddb007de7b Action only on PR 2019-10-07 15:23:12 +02:00
Travis CI 8bee7d5d6b [CI Skip] 1.6.0-beta.2 2019-10-07 11:34:46 +00:00
Jaco Greeff 253eea9249 Run action on PR 2019-10-07 13:07:33 +02:00
Travis CI 502fdc1e32 [CI Skip] 1.6.0-beta.1 2019-10-04 09:37:00 +00:00
Jaco Greeff f3aaaede25 Split GH actions build (docs & code) (#475)
* Split GH actions build (docs & code)

* Rename action
2019-10-04 11:25:25 +02:00
Travis CI 309d691938 [CI Skip] 1.6.0-beta.0 2019-10-04 07:41:28 +00:00
Jaco Greeff 4d6438c3e7 Add GH actions (#474) 2019-10-04 09:21:03 +02:00
Travis CI 19817b213b [CI Skip] 1.5.1 2019-09-25 10:53:30 +00:00
Jaco Greeff 20d4457483 1.5.0 2019-09-25 12:46:43 +02:00
Travis CI a2d0f2b1a3 [CI Skip] 1.5.0-beta.1 2019-09-25 10:44:39 +00:00
Jaco Greeff a512766bfb 1.5 (#473) 2019-09-25 12:37:59 +02:00
Travis CI b11b42e2b6 [CI Skip] 1.5.0-beta.0 2019-09-19 09:15:51 +00:00
Jaco Greeff c13c2022ca Proper ss58Format check (allows 0) (#472) 2019-09-19 11:09:17 +02:00
Travis CI bf1c187969 [CI Skip] 1.4.1 2019-09-12 12:05:38 +00:00
Jaco Greeff 16d077c87d ss58Format option for Keyring (#471)
* ss58Format option  for Keyring

* Expose setSS58Format everywhere

* Remove setAddressPrefix

* 1.4.0
2019-09-12 13:59:03 +02:00
Jaco Greeff 00374effc5 string <-> hex conversion utilities (#470)
* string <-> hex conversion utilities

* Add tests
2019-09-12 13:48:06 +02:00
Travis CI 891a855fb8 [CI Skip] 1.4.0-beta.0 2019-09-11 10:33:22 +00:00
Jaco Greeff 854cb56621 Bump deps (#469) 2019-09-11 12:25:47 +02:00
Travis CI 1018a11548 [CI Skip] 1.3.1 2019-09-10 17:14:48 +00:00
Jaco Greeff dc55f2170f 1.3.1 (#467)
* 1.3.1

* CHANGELOG bump
2019-09-10 19:08:12 +02:00
Travis CI 36cd5cd504 [CI Skip] 1.3.0-beta.1 2019-09-10 15:51:48 +00:00
Jaco Greeff a5d23696e6 Remove ExtError 2019-09-10 17:44:47 +02:00
Travis CI 5adc753f81 [CI Skip] 1.3.0-beta.0 2019-09-10 15:16:34 +00:00
Jaco Greeff 5e494b7163 Fix ExtError construction 2019-09-10 17:03:21 +02:00
Travis CI 3b6d383ace [CI Skip] 1.2.1 2019-09-09 12:14:50 +00:00
Jaco Greeff e2ec7d0108 1.2 (#466) 2019-09-09 14:08:18 +02:00
Travis CI 33afae891f [CI Skip] 1.2.0-beta.7 2019-09-05 09:32:43 +00:00
Jaco Greeff a1c2f03469 Bump deps (#465) 2019-09-05 11:26:08 +02:00
Travis CI 14d07988c3 [CI Skip] 1.2.0-beta.6 2019-09-01 18:02:57 +00:00
Jaco Greeff 9a4938bfc5 Add copy-to-apps script 2019-09-01 19:56:10 +02:00
Jaco Greeff 4323343973 Update eslint config (#464)
* Update eslint config

* isEmpty test
2019-09-01 19:46:40 +02:00
Travis CI 402048a414 [CI Skip] 1.2.0-beta.5 2019-08-31 12:33:04 +00:00
Jaco Greeff 22e76c17ca Allow addFromAddress to be encodable (#463) 2019-08-31 14:26:47 +02:00
Travis CI b2ed63b66a [CI Skip] 1.2.0-beta.4 2019-08-30 10:30:38 +00:00
Jaco Greeff 25fc033728 typescript-eslint 2 (#462)
* typescript-eslint 2

* startsWith fixes

* padStart/padEnd
2019-08-30 12:24:16 +02:00
Travis CI 67513ed7a4 [CI Skip] 1.2.0-beta.3 2019-08-29 13:56:04 +00:00
Jaco Greeff ef385913c4 Bump deps (#461)
* Bump deps

* Window & globalThis
2019-08-29 15:50:21 +02:00
Travis CI 9abf16e9e6 [CI Skip] 1.2.0-beta.2 2019-08-27 10:17:20 +00:00
Jaco Greeff a8b28a2172 Bump dev (#460)
* Bump dev

* Linting cleanups (stricter rules)
2019-08-27 12:11:26 +02:00
Travis CI 2d18f9d190 [CI Skip] 1.2.0-beta.1 2019-08-13 08:29:01 +00:00
Jaco Greeff 4308722ef6 Try bumping gh-pages (#458) 2019-08-13 10:22:53 +02:00
Jaco Greeff 1e67f589b9 Maintainability indicator 2019-08-12 09:09:45 +02:00
Jaco Greeff 1fa08117bb Cleanup README 2019-08-11 08:08:28 +02:00
Jaco Greeff 0d9f30006c Update README.md 2019-08-10 15:21:04 +02:00
Jaco Greeff b48420f299 Update README.md 2019-08-10 14:50:32 +02:00
Jaco Greeff ac4e0904e9 Update README.md 2019-08-10 14:24:46 +02:00
Jaco Greeff 70cca25cb1 README badges 2019-08-10 14:23:37 +02:00
Travis CI 0afcb24885 [CI Skip] 1.2.0-beta.0 2019-08-09 13:34:11 +00:00
Jaco Greeff 808b6330a4 Bump deps (#457)
* Bump deps

* Rewrite lock

* jest --runInBand

* Rewrite lockfile
2019-08-09 15:28:25 +02:00
Travis CI 7505e6c1f6 [CI Skip] 1.1.1 2019-08-09 10:05:42 +00:00
Jaco Greeff 1d0a4e727c 1.1 (#456) 2019-08-09 11:59:51 +02:00
Travis CI bc941b3fc2 [CI Skip] 1.1.0-beta.2 2019-08-09 08:19:54 +00:00
Jaco Greeff 09e0b80dc6 assertSingleton warns, not throws (#455) 2019-08-09 10:13:43 +02:00
Travis CI 16340c59d8 [CI Skip] 1.1.0-beta.1 2019-08-03 20:39:48 +00:00
Jaco Greeff f0aebfc1bf .123trigger 2019-08-03 22:33:22 +02:00
Travis CI 775ee9999f [CI Skip] 1.1.0-beta.0 2019-08-03 18:14:40 +00:00
Jaco Greeff 395569c588 unbump gh-pages dep (#453) 2019-08-03 20:06:15 +02:00
396 changed files with 5610 additions and 4576 deletions
+1
View File
@@ -0,0 +1 @@
2
+11 -1
View File
@@ -1 +1,11 @@
module.exports = require('@polkadot/dev/config/eslint');
const base = require('@polkadot/dev/config/eslint');
module.exports = {
...base,
parserOptions: {
...base.parserOptions,
project: [
'./tsconfig.json'
]
}
};
+73
View File
@@ -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
+67
View File
@@ -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"
+2
View File
@@ -20,3 +20,5 @@ yarn-debug.log*
yarn-error.log*
store.db
store.db.compacted
.idea
.vscode
-28
View File
@@ -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
View File
@@ -1 +0,0 @@
1
+42 -1
View File
@@ -1,4 +1,45 @@
# 1.0.0
# 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
- Allow ss58Format = 0 as a valid value
- Loosen type definitions for allowed ss58format values (still checked against allowed array)
# 1.4.1
- **Breaking change** To set the `ss58Format`, you should now use `setSS58Format` as opposed to the old `setAddressPrefix`
- Renamed `keyring.setAddressPrefix` to `keyring.setSS58Format`
- Deprecated `addressPrefix` on the keyring options, added the `ss58Format` as a replacement (aligning with chain properties - the old version is still accepted)
- Added `stringToHex` and `hexToString` conversion utilities to `@polkadot/util`
- Swap to [Babel 7.6.0](https://babeljs.io/) for all compilation, for latest improvements in code generation
# 1.3.1
- Remove the `ExtError` class, always prefer the standard JS `Error` object for errors. This would bre a breaking change for any applications using `ExtError`
# 1.2.1
- Keyring `addFromAddress` can now be used to store external accounts, for example those provided by external signers
- Maintainability updates
# 1.1.1
- `assertSingletonPackage` now warns via console.warn, but does not throw. This does allow the info to come accross while still allowing the app developers using multiple libraries time to fix.
# 1.0.1
- `formatBalance` now allows for `Compact` inputs
- `formaBalance` now allows correct formatting of very large decimals
+6 -8
View File
@@ -1,11 +1,9 @@
[![polkadotjs](https://img.shields.io/badge/polkadot-js-orange.svg?style=flat-square)](https://polkadot.js.org)
![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)
[![style](https://img.shields.io/badge/code%20style-semistandard-lightgrey.svg?style=flat-square)](https://github.com/Flet/semistandard)
[![npm](https://img.shields.io/npm/v/@polkadot/util.svg?style=flat-square)](https://www.npmjs.com/package/@polkadot/util)
[![travis](https://img.shields.io/travis/polkadot-js/common.svg?style=flat-square)](https://travis-ci.com/polkadot-js/common)
[![maintainability](https://img.shields.io/codeclimate/maintainability/polkadot-js/common.svg?style=flat-square)](https://codeclimate.com/github/polkadot-js/common)
[![coverage](https://img.shields.io/codeclimate/coverage/polkadot-js/common.svg?style=flat-square)](https://codeclimate.com/github/polkadot-js/common)
[![greenkeeper](https://img.shields.io/badge/greenkeeper-enabled-brightgreen.svg?style=flat-square)](https://greenkeeper.io/)
[![polkadotjs](https://img.shields.io/badge/polkadot-js-orange?logo=&style=flat-square)](https://polkadot.js.org)
![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)
[![npm](https://img.shields.io/npm/v/@polkadot/util?logo=npm&style=flat-square)](https://www.npmjs.com/package/@polkadot/util)
[![beta](https://img.shields.io/npm/v/@polkadot/util/beta?label=beta&logo=npm&style=flat-square)](https://www.npmjs.com/package/@polkadot/util)
[![maintainability](https://img.shields.io/codeclimate/maintainability-percentage/polkadot-js/common?logo=code-climate&style=flat-square)](https://codeclimate.com/github/polkadot-js/common)
[![coverage](https://img.shields.io/codeclimate/coverage/polkadot-js/common?logo=code-climate&style=flat-square)](https://codeclimate.com/github/polkadot-js/common)
# @polkadot/common
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
function copy_folder () {
SRC="packages/$1/build"
DST="../apps/node_modules/@polkadot/$1"
echo "** Copying $SRC to $DST"
rm -rf $DST
cp -r $SRC $DST
}
yarn polkadot-dev-build-ts
copy_folder "keyring"
copy_folder "util"
copy_folder "util-crypto"
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable @typescript-eslint/no-var-requires */
// Import Keyring class and utility function
const Keyring = require('@polkadot/keyring').default;
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable @typescript-eslint/no-var-requires */
// Import Keyring class and utility function
const Keyring = require('@polkadot/keyring').default;
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable @typescript-eslint/no-var-requires */
const { naclEncrypt, naclDecrypt } = require('@polkadot/util-crypto');
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable @typescript-eslint/no-var-requires */
const { stringToU8a, u8aToHex } = require('@polkadot/util');
const { naclEncrypt, naclKeypairFromSeed, naclSign, naclVerify, randomAsU8a } = require('@polkadot/util-crypto');
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/no-var-requires,@typescript-eslint/no-unused-vars */
const { mnemonicGenerate, mnemonicToSeed, mnemonicValidate, naclKeypairFromSeed } = require('@polkadot/util-crypto');
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.0.1"
"version": "1.8.1"
}
+9 -9
View File
@@ -1,5 +1,5 @@
{
"version": "1.0.1",
"version": "1.8.1",
"private": true,
"engines": {
"yarn": "^1.10.1"
@@ -9,21 +9,21 @@
],
"resolutions": {
"babel-core": "^7.0.0-bridge.0",
"typescript": "^3.5.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",
"test": "jest --coverage",
"test": "jest --coverage --runInBand",
"test:one": "jest"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@polkadot/dev": "^0.30.0-beta.24",
"@polkadot/ts": "^0.1.62",
"gh-pages": "^2.1.0"
"@babel/core": "^7.7.7",
"@polkadot/dev": "^0.32.14",
"@polkadot/ts": "^0.1.90",
"gh-pages": "^2.1.1"
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/chainspec",
"version": "1.0.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.5.5",
"@polkadot/util": "^1.0.1"
"@babel/runtime": "^7.7.7",
"@polkadot/util": "^1.8.1"
}
}
+1 -2
View File
@@ -1,10 +1,9 @@
// 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.
import { Chainspec } from './types';
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
export default {
name: 'Alexander',
id: 'alexander',
+1 -2
View File
@@ -1,10 +1,9 @@
// 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.
import { Chainspec } from './types';
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
export default {
name: 'Dried Danta',
id: 'dried-danta',
+1 -1
View File
@@ -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 -1
View File
@@ -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.
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/db",
"version": "1.0.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.5.5",
"@polkadot/trie-hash": "^1.0.1",
"@polkadot/util": "^1.0.1",
"@babel/runtime": "^7.7.7",
"@polkadot/trie-hash": "^1.8.1",
"@polkadot/util": "^1.8.1",
"lru_map": "^0.3.3"
}
}
+2 -2
View File
@@ -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 -1
View File
@@ -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.
+2 -2
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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.
+2 -2
View File
@@ -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 -1
View File
@@ -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.
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/keyring",
"version": "1.0.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.5.5",
"@polkadot/util": "^1.0.1",
"@polkadot/util-crypto": "^1.0.1"
"@babel/runtime": "^7.7.7",
"@polkadot/util": "^1.8.1",
"@polkadot/util-crypto": "^1.8.1"
}
}
+1 -1
View File
@@ -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.
+13 -5
View File
@@ -1,9 +1,9 @@
// 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 { hexToU8a, stringToU8a } from '@polkadot/util';
import { cryptoWaitReady, setAddressPrefix } from '@polkadot/util-crypto';
import { cryptoWaitReady, setSS58Format } from '@polkadot/util-crypto';
import Keyring from '.';
@@ -19,12 +19,16 @@ describe('keypair', (): void => {
const seedTwo = hexToU8a('0x9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60');
let keypair: Keyring;
beforeEach(async (): Promise<void> => {
beforeEach((): void => {
keypair = new Keyring({ type: 'ed25519' });
keypair.addFromSeed(seedOne, {});
});
afterEach((): void => {
setSS58Format(42);
});
it('adds the pair', (): void => {
expect(
keypair.addFromSeed(seedTwo, {}).publicKey
@@ -40,7 +44,7 @@ describe('keypair', (): void => {
});
it('adds from a mnemonic', (): void => {
setAddressPrefix(68);
setSS58Format(68);
expect(
keypair.addFromMnemonic('moral movie very draw assault whisper awful rebuild speed purity repeat card', {}).address
@@ -93,6 +97,10 @@ describe('keypair', (): void => {
keypair.addFromSeed(seedOne, {});
});
afterEach((): void => {
setSS58Format(42);
});
it('creates with dev phrase when only path specified', (): void => {
expect(
keypair.createFromUri('//Alice').address
@@ -106,7 +114,7 @@ describe('keypair', (): void => {
});
it('adds from a mnemonic', (): void => {
setAddressPrefix(68);
setSS58Format(68);
expect(
keypair.addFromMnemonic('moral movie very draw assault whisper awful rebuild speed purity repeat card', {}).address
+3 -3
View File
@@ -1,9 +1,9 @@
// 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 { assertSingletonPackage } from '@polkadot/util';
import { decodeAddress, encodeAddress, setAddressPrefix } from '@polkadot/util-crypto';
import { decodeAddress, encodeAddress, setSS58Format } from '@polkadot/util-crypto';
import Keyring from './keyring';
@@ -15,5 +15,5 @@ export {
Keyring,
decodeAddress,
encodeAddress,
setAddressPrefix
setSS58Format
};
+12 -7
View File
@@ -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.
@@ -6,7 +6,7 @@ import { KeypairType } from '@polkadot/util-crypto/types';
import { KeyringInstance, KeyringPair, KeyringPair$Json, KeyringPair$Meta, KeyringOptions } from './types';
import { assert, hexToU8a, isNumber, isHex, stringToU8a } from '@polkadot/util';
import { decodeAddress, encodeAddress, keyExtractSuri, keyFromPath, naclKeypairFromSeed as naclFromSeed, schnorrkelKeypairFromSeed as schnorrkelFromSeed, mnemonicToMiniSecret, setAddressPrefix } from '@polkadot/util-crypto';
import { decodeAddress, encodeAddress, keyExtractSuri, keyFromPath, naclKeypairFromSeed as naclFromSeed, schnorrkelKeypairFromSeed as schnorrkelFromSeed, mnemonicToMiniSecret, setSS58Format } from '@polkadot/util-crypto';
import { DEV_PHRASE } from './defaults';
import createPair from './pair';
@@ -37,17 +37,22 @@ export default class Keyring implements KeyringInstance {
public encodeAddress = encodeAddress;
public setAddressPrefix = setAddressPrefix;
public setSS58Format = setSS58Format;
public constructor (options: KeyringOptions = {}) {
constructor (options: KeyringOptions = {}) {
options.type = options.type || 'ed25519';
options.ss58Format = isNumber(options.ss58Format)
? options.addressPrefix
: options.ss58Format;
assert(options && ['ed25519', 'sr25519'].includes(options.type || 'undefined'), `Expected a keyring type of either 'ed25519' or 'sr25519', found '${options.type}`);
this._pairs = new Pairs();
this._type = options.type;
setAddressPrefix(isNumber(options.addressPrefix) ? options.addressPrefix : 42);
if (isNumber(options.ss58Format)) {
setSS58Format(options.ss58Format);
}
}
/**
@@ -90,7 +95,7 @@ export default class Keyring implements KeyringInstance {
public addFromAddress (address: string | Uint8Array, meta: KeyringPair$Meta = {}, encoded: Uint8Array | null = null, type: KeypairType = this.type, ignoreChecksum?: boolean): KeyringPair {
const publicKey = this.decodeAddress(address, ignoreChecksum);
return this.addPair(createPair(type, { publicKey }, meta, encoded));
return this.addPair(createPair(type, { publicKey, secretKey: new Uint8Array(64) }, meta, encoded));
}
/**
@@ -153,7 +158,7 @@ export default class Keyring implements KeyringInstance {
*/
public createFromUri (_suri: string, meta: KeyringPair$Meta = {}, type: KeypairType = this.type): KeyringPair {
// here we only aut-add the dev phrase if we have a hard-derived path
const suri = _suri.indexOf('//') === 0
const suri = _suri.startsWith('//')
? `${DEV_PHRASE}${_suri}`
: _suri;
const { password, phrase, path } = keyExtractSuri(suri);
+1 -1
View File
@@ -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.
+4 -5
View File
@@ -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),
@@ -26,7 +25,7 @@ export default function decode (passphrase?: string, _encrypted?: Uint8Array | n
) as Uint8Array)
: encrypted;
assert(encoded, `Unable to unencrypt using the supplied passphrase`);
assert(encoded, 'Unable to unencrypt using the supplied passphrase');
const header = encoded.subarray(0, PKCS8_HEADER.length);
+1 -1
View File
@@ -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 -1
View File
@@ -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.
+2 -2
View File
@@ -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
);
+19 -3
View File
@@ -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 { setAddressPrefix } 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 => {
@@ -61,11 +66,13 @@ describe('pair', (): void => {
'5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaQua'
);
setAddressPrefix(68);
setSS58Format(68);
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');
});
});
+53 -19
View File
@@ -1,17 +1,27 @@
// 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;
}
const isSr25519 = (type: KeypairType): boolean =>
type === 'sr25519';
@@ -20,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)
@@ -63,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);
@@ -80,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;
},
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 =>
+7 -2
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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.
+6 -12
View File
@@ -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.
@@ -7,21 +7,17 @@ import { KeyringPairs, KeyringPair } from './types';
import { assert, isHex, isU8a, u8aToHex, u8aToU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
interface KeyringPairMap {
// @ts-ignore we use coercion :(
[index: Uint8Array]: KeyringPair;
}
type KeyringPairMap = Record<string, KeyringPair>;
export default class Pairs implements KeyringPairs {
private _map: KeyringPairMap;
public constructor () {
constructor () {
this._map = {};
}
public add (pair: KeyringPair): KeyringPair {
// @ts-ignore we use coercion :(
this._map[pair.publicKey] = pair;
this._map[pair.publicKey.toString()] = pair;
return pair;
}
@@ -31,8 +27,7 @@ export default class Pairs implements KeyringPairs {
}
public get (address: string | Uint8Array): KeyringPair {
// @ts-ignore we use coercion :(
const pair = this._map[decodeAddress(address)];
const pair = this._map[decodeAddress(address).toString()];
assert(pair, (): string => {
const formatted: string = isU8a(address) || isHex(address)
@@ -46,7 +41,6 @@ export default class Pairs implements KeyringPairs {
}
public remove (address: string | Uint8Array): void {
// @ts-ignore we use coercion :(
delete this._map[decodeAddress(address)];
delete this._map[decodeAddress(address).toString()];
}
}
+1 -1
View File
@@ -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.
+3 -3
View File
@@ -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'),
@@ -77,7 +77,7 @@ const PAIRS: PairDef[] = [
* @description The test accounts (i.e. alice, bob, dave, eve, ferdie)
* are available on the dev chain and each test account is initialised with DOT funds.
*/
export default function testKeyring (options: KeyringOptions = {}, isDerived: boolean = true): KeyringInstance {
export default function testKeyring (options: KeyringOptions = {}, isDerived = true): KeyringInstance {
const keyring = new Keyring(options);
PAIRS.forEach(({ name, publicKey, secretKey, seed, type }): void => {
+1 -1
View File
@@ -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.
+2 -2
View File
@@ -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.
@@ -11,7 +11,7 @@ export interface TestKeyringMap {
[index: string]: KeyringPair;
}
export default function testKeyringPairs (options?: KeyringOptions, isDerived: boolean = true): TestKeyringMap {
export default function testKeyringPairs (options?: KeyringOptions, isDerived = true): TestKeyringMap {
const keyring = createKeyring(options, isDerived);
const pairs = keyring.getPairs();
const map: TestKeyringMap = { nobody: nobody() };
+16 -9
View File
@@ -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.
@@ -7,7 +7,9 @@ import { Prefix } from '@polkadot/util-crypto/address/types';
import { KeypairType } from '@polkadot/util-crypto/types';
export interface KeyringOptions {
// @deprecated
addressPrefix?: Prefix;
ss58Format?: Prefix;
type?: KeypairType;
}
@@ -31,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;
}
@@ -59,9 +66,9 @@ export interface KeyringInstance {
readonly publicKeys: Uint8Array[];
readonly type: KeypairType;
decodeAddress (encoded: string | Uint8Array, ignoreChecksum?: boolean): Uint8Array;
encodeAddress (key: Uint8Array | string): string;
setAddressPrefix (prefix: Prefix): void;
decodeAddress (encoded: string | Uint8Array, ignoreChecksum?: boolean, ss58Format?: Prefix): Uint8Array;
encodeAddress (key: Uint8Array | string, ss58Format?: Prefix): string;
setSS58Format (ss58Format: Prefix): void;
addPair (pair: KeyringPair): KeyringPair;
addFromAddress (address: string | Uint8Array, meta?: KeyringPair$Meta, encoded?: Uint8Array | null, type?: KeypairType, ignoreChecksum?: boolean): KeyringPair;
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/trie-codec",
"version": "1.0.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.5.5",
"@polkadot/util": "^1.0.1"
"@babel/runtime": "^7.7.7",
"@polkadot/util": "^1.8.1"
}
}
+2 -2
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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.
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/trie-db",
"version": "1.0.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.5.5",
"@polkadot/db": "^1.0.1",
"@polkadot/trie-codec": "^1.0.1",
"@polkadot/trie-hash": "^1.0.1",
"@polkadot/util": "^1.0.1",
"@polkadot/util-crypto": "^1.0.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.0.1",
"@polkadot/util-rlp": "^1.0.1",
"@polkadot/chainspec": "^1.8.1",
"@polkadot/util-rlp": "^1.8.1",
"ethereumjs-testing": "1.0.4"
}
}
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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 -1
View File
@@ -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.
+2 -3
View File
@@ -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.
@@ -43,9 +43,8 @@ describe.skip('official tests', (): void => {
it(name, (): void => {
keys.forEach((key: string): void => {
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-explicit-any
trie.put(toU8a(key), toU8a(input[key as any]));
trie.put(toU8a(key), toU8a(input[key as any] as string));
});
expect(
+1 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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.
+2 -2
View File
@@ -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)}`);
+3 -3
View File
@@ -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, (): undefined => void 0);
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, (): undefined => void 0);
trie.snapshot(back, (): void => undefined);
expect(u8aToHex(back.getRoot())).toEqual(u8aToHex(root));
+1 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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.
+2 -2
View File
@@ -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.
@@ -24,7 +24,7 @@ export function getNodeType (node: Node): NodeType {
return NodeType.BRANCH;
}
throw new Error(`Unable to determine node type`);
throw new Error('Unable to determine node type');
}
export function decodeNode (codec: Codec, encoded: Uint8Array | Node): Node {
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/trie-hash",
"version": "1.0.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.5.5",
"@polkadot/util": "^1.0.1"
"@babel/runtime": "^7.7.7",
"@polkadot/util": "^1.8.1"
},
"devDependencies": {
"@polkadot/chainspec": "^1.0.1"
"@polkadot/chainspec": "^1.8.1"
}
}
+2 -2
View File
@@ -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.
@@ -78,7 +78,7 @@ function _buildTrie (input: [Uint8Array, Uint8Array][], cursor: number, codec: C
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export default function buildTrie (input: [Uint8Array, Uint8Array][], cursor: number = 0, codec: Codec = DEFAULT_CODEC, stream: any = DEFAULT_STREAM): Uint8Array {
export default function buildTrie (input: [Uint8Array, Uint8Array][], cursor = 0, codec: Codec = DEFAULT_CODEC, stream: any = DEFAULT_STREAM): Uint8Array {
const trie = _buildTrie(input, cursor, codec, stream);
return trie;
+1 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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