Compare commits

...
27 Commits
Author SHA1 Message Date
Github Actions dca36e41fd [CI Skip] 2.3.1
skip-checks: true
2020-02-15 11:00:43 +00:00
Jaco Greeff a602b0409c 2.3 (#535) 2020-02-15 11:59:04 +01:00
Github Actions 04d79da155 [CI Skip] 2.3.0-beta.9
skip-checks: true
2020-02-15 10:26:00 +00:00
Jaco Greeff 81a31519db Move date formatter to format (#534)
* Move date formatter to format

* Cleanup padding
2020-02-15 11:24:16 +01:00
Github Actions 78e39dcf34 [CI Skip] 2.3.0-beta.8
skip-checks: true
2020-02-15 10:09:19 +00:00
Jaco Greeff 6194660b3b Bump @polkadot/wasm to 1.0 (#533) 2020-02-15 11:07:33 +01:00
AndreasGassmannandJaco Greeff 2e08018718 feat(dependencies): remove moment.js (#530)
* feat(dependencies): remove moment.js

* fix(dependencies): remove yarn from yarn.lock

* feat(log-date-formatting): rename function

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-02-15 11:06:45 +01:00
Github Actions b0d6ccdbd4 [CI Skip] 2.3.0-beta.7
skip-checks: true
2020-02-15 09:27:10 +00:00
Jaco Greeff 48b753b8ac CHANGELOG update (#532) 2020-02-15 10:25:23 +01:00
Github Actions 506bc59f86 [CI Skip] 2.3.0-beta.6
skip-checks: true
2020-02-14 11:33:24 +00:00
AndreasGassmann f86fcc6044 feat(dependencies): move types to dev dependencies (#531) 2020-02-14 12:31:29 +01:00
Github Actions e8d2a439d5 [CI Skip] 2.3.0-beta.5
skip-checks: true
2020-02-14 08:43:15 +00:00
Jaco Greeff 9fa6b5bffa Bump dev, CI scripts (#529) 2020-02-14 09:41:29 +01:00
Github Actions 932ef41aae [CI Skip] 2.3.0-beta.4
skip-checks: true
2020-02-14 07:41:39 +00:00
Jaco Greeff 3910853ba1 Bump dev (#528) 2020-02-14 08:39:58 +01:00
Github Actions 6956e88708 [CI Skip] 2.3.0-beta.3
skip-checks: true
2020-02-14 07:11:09 +00:00
Jaco Greeff 3769b99cd2 Bump dev (#527)
* Bump dev

* Bumps
2020-02-14 08:09:29 +01:00
Github Actions ee17054b38 [CI Skip] 2.3.0-beta.2
skip-checks: true
2020-02-13 21:50:26 +00:00
Jaco Greeff 72cfbddd4a Bump dev (#526)
* Bump dev

* Bumps

* Bump

* Bump
2020-02-13 22:48:36 +01:00
Github Actions cffb23728d [CI Skip] 2.3.0-beta.1
skip-checks: true
2020-02-13 13:57:56 +00:00
Jaco Greeff a69dc01c78 Bump dev (#525) 2020-02-13 14:56:10 +01:00
Github Actions d889c71056 [CI Skip] 2.3.0-beta.0
skip-checks: true
2020-02-12 15:20:17 +00:00
Jaco Greeff 8eef3f9989 Cleanup explicit deps & bump deps (#523) 2020-02-12 16:18:21 +01:00
Github Actions 3112e43715 [CI Skip] 2.2.1
skip-checks: true
2020-02-06 14:46:00 +00:00
Jaco Greeff fc9a5ac25f 2.2 (#520) 2020-02-06 15:44:11 +01:00
Github Actions 242b107752 [CI Skip] 2.2.0-beta.0
skip-checks: true
2020-02-06 13:51:56 +00:00
Jaco Greeff bf5ba0f405 Add resolver for jest (#519) 2020-02-06 14:49:55 +01:00
17 changed files with 1181 additions and 462 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn install --frozen-lockfile
yarn polkadot-dev-ghact-build
yarn polkadot-ci-ghact-build
build_docs:
name: Build Docs
@@ -52,7 +52,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn install --frozen-lockfile
yarn polkadot-dev-ghact-docs
yarn polkadot-ci-ghact-docs
dummy:
name: Dummy
+4
View File
@@ -12,6 +12,10 @@ tmp/
.env.test.local
.env.production.local
.npmrc
.pnp.*
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
cc-test-reporter
lerna-debug.log*
npm-debug.log*
+102 -27
View File
@@ -1,8 +1,19 @@
# 2.1.1
# 2.3.1 Feb 15, 2020
- Remove dependency on moment.js with `formatDate` function (Thanks to https://github.com/AndreasGassmann)
- Move TypeScript `@types/*` to dev deps (Thanks to https://github.com/AndreasGassmann)
- Update to `@polkadot/wasm-crypto` 1.0
- Cleanup dependencies to pave the way for using yarnpkg 2 (Explicit instead of implicit)
# 2.2.1 Feb 06, 2020
- Add resolver for jest requires (tests from src)
# 2.1.1 Feb 04, 2020
- Update `detectPackage(<package.json>, __dirname?)` with calling folder
# 2.0.1
# 2.0.1 Jan 30, 2020
- Update w3f/schnorrkel to 0.8.5 (Full Substrate 2.x support, no 1.x support)
- Remove Alice session (ed2551) account from testing keyring (not applicable to Substrate 2.x)
@@ -10,27 +21,27 @@
- Renamed `assertSingletonPackage` to `detectPackage` with inclusion of version listing
- Swap to elliptic library for secp2561 recovery (No node bindings)
# 1.8.1
# 1.8.1 Jan 09, 2020
- Add cross-client encryption/decryption support (Thanks to https://github.com/hskang9)
# 1.7.1
# 1.7.1 Nov 27, 2019
- `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
# 1.6.1 Oct 24, 2019
- `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
# 1.5.1 Sep 25, 2019
- 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
# 1.4.1 Sep 12, 2019
- **Breaking change** To set the `ss58Format`, you should now use `setSS58Format` as opposed to the old `setAddressPrefix`
- Renamed `keyring.setAddressPrefix` to `keyring.setSS58Format`
@@ -38,25 +49,25 @@
- 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
# 1.3.1 Sep 10, 2019
- 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
# 1.2.1 Sep 09, 2019
- Keyring `addFromAddress` can now be used to store external accounts, for example those provided by external signers
- Maintainability updates
# 1.1.1
# 1.1.1 Aug 09, 2019
- `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
# 1.0.1 Aug 02, 2019
- `formatBalance` now allows for `Compact` inputs
- `formaBalance` now allows correct formatting of very large decimals
# 0.94.1
# 0.94.1 Jul 20, 2019
- Add `checkAddress(address, prefix)` to `@polkadot/util-crypto` that validates an ss-58 address
- Add support for the Kusama network (as a valid checked prefix)
@@ -64,7 +75,7 @@
- The ed25519 key for Alice (representing the session), now appears in the test keyrings
- Fix missing dependencies for keyring (after address moves in 0.93.1)
# 0.93.1
# 0.93.1 Jun 14, 2019
- Breaking: External pair interface for keyring has been changed. Instead of
- `getMeta` use the `meta` getter, i.e. `console.log(pair.meta.name)`
@@ -72,69 +83,133 @@
- `publicKey` use the `publicKey` getter, i.e. `console.log(pair.publicKey)`
- `Move decodeAddress`, `encodeAddress` & `setAddressPrefix` functions into `@polkadot/util-crypto` from `@polkadot/keyring`. External interfaces should not be affected at this point since it is also (still) exported and exposed on keyring
# 0.92.1
# 0.92.1 Jun 04, 2019
- Only allow integer input values into `formatBalance`
- Allow `formatBalance`, `formatDecimal` & `formatNumber` to cater for negative numbers
- Add 'Bob//stash' to testing keyring, joining the existing 'Alice//stash'
# 0.91.1
# 0.91.1 May 22, 2019
- ed25519/sr25519 sign & verify functions can now take the message input as Uint8Array/string/hex and verify allows for the signature/publicKey to be specified as Uint8Array/hex
- Update `@polkadot/wasm` to include a maintenance bump for the `w3f/schnorrkel` libraries
# 0.90.1
# 0.90.1 May 08, 2019
- Moving towards 1.0
- Added bnMin & bnMax functions
# 0.76.1
# 0.76.1 Apr 03, 2019
- Fix `addFromMnemonic` to generate using new-style derivation.
- Pull in `formatBalance`, `formatDecimal`, `formatElapsed`, `formatNumber`, `calcSi`, `findSi` & `isTestChain` utility functions from the originals in `@polkadot/ui-util`
- Swap out `wasm-schnorrkel` & `wasm-ed25519` for combined version with `wasm-crypto`
- Swap DB interfaces to optional LRU, removing `transactionAsync` (client-only changes)
# 0.75.1
# 0.75.1 Mar 29, 2019
- Start journey to 1.0
# 0.42.1
# 0.42.1 Mar 28, 2019
- Add `assertSingletonPackage` to util
- Ensure that only a single keyring instance is loaded (uses above)
# 0.41.1
# 0.41.1 Mar 25, 2019
- Extensions to the client-specific database interfaces (non-breaking for API and util users)
# 0.40.1
# 0.40.1 Mar 23, 2019
- Add additional derivation path extraction mechanisms to util-crypto
- Add createFromUri function to keypair (creates keypair, does not add it)
- Allow all crypto hashing & ed25519 to use WASM (as available, JS fallbacks)
# 0.39.1
# 0.39.1 Mar 20, 2019
- Pull in bip39 generation functions from `@poladkot/wasm-crypto` with a fallback to the pure JS versions
# 0.38.1
# 0.38.1 Mar 18, 2019
- Align with current substrate master for sr25519 keys and hard/soft derivation
- Swap default dev keys to derived (sr25519)
# 0.37.1
# 0.37.1 Mar 14, 2019
- Swap to publishing -beta.x on merge (non-breaking testing)
# 0.36.1
# 0.36.1 Mar 13, 2019
- Add `fromUri` to keyring along with hard & soft key derivation.
# 0.35.1
# 0.35.1 Mar 04, 2019
- Remove NodeJs-only `syncify` function, not exported by the package (with binary dependency for Node)
# 0.34.1
# 0.34.1 Feb 13, 2019
- Keyring now allows for ed25519 and sr25519 instances. Upon creation, you need to pass the `ed25519`or `sr25519` string to denote the type, i.e. `new Keyring({ type: 'sr25519' })`
# 0.33.1 Nov 22, 2018
# 0.32.1 Oct 18, 2018
# 0.31.1 Oct 12, 2018
# 0.30.1 Sep 11, 2018
# 0.29.1 Sep 01, 2018
# 0.28.1 Aug 11, 2018
# 0.27.1 Aug 06, 2018
# 0.26.1 Jun 27, 2018
# 0.25.1 Jun 26, 2018
# 0.24.1 Jun 22, 2018
# 0.23.1 Jun 21, 2018
# 0.22.1 May 24, 2018
# 0.21.1 May 17, 2018
# 0.20.1 May 16, 2018
# 0.19.1 Apr 19, 2018
# 0.18.1 Mar 20, 2018
# 0.17.1 Mar0 8, 2018
# 0.16.1 Feb 23, 2018
# 0.15.1 Feb 15, 2018
# 0.14.1 Feb 07, 2018
# 0.13.1 Jan 25, 2018
# 0.12.1 Jan 11, 2018
# 0.11.1 Dec 30, 2017
# 0.10.1 Dec 17, 2017
# 0.9.1 Dec 14, 2017
# 0.8.1 Dec 12, 2017
# 0.7.1 Dec 11, 2017
# 0.6.1 Nov 30, 2017
# 0.5.1 Nov 20, 2017
# 0.4.1 Nov 19, 2017
# 0.3.1 Nov 19, 2017
# 0.2.1 Nov 18, 2017
+1 -3
View File
@@ -1,3 +1 @@
module.exports = {
extends: '@polkadot/dev/config/babel'
};
module.exports = require('@polkadot/dev/config/babel');
+3 -8
View File
@@ -8,14 +8,9 @@ module.exports = Object.assign({}, config, {
'@polkadot/util(.*)$': '<rootDir>/packages/util/src/$1'
},
modulePathIgnorePatterns: [
'<rootDir>/packages/db/build',
'<rootDir>/packages/chainspec/build',
'<rootDir>/packages/keyring/build',
'<rootDir>/packages/trie-codec/build',
'<rootDir>/packages/trie-db/build',
'<rootDir>/packages/trie-hash/build',
'<rootDir>/packages/util/build',
'<rootDir>/packages/util-crypto/build',
'<rootDir>/packages/util-rlp/build'
]
'<rootDir>/packages/util-crypto/build'
],
resolver: './jest.resolver.js'
});
+12
View File
@@ -0,0 +1,12 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
module.exports = function resolver (file, config) {
return file.includes('package.json')
? path.join(config.basedir.replace('/src', '/'), file)
: config.defaultResolver(file, config);
};
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "2.1.1"
"version": "2.3.1"
}
+7 -8
View File
@@ -1,5 +1,5 @@
{
"version": "2.1.1",
"version": "2.3.1",
"private": true,
"engines": {
"yarn": "^1.10.1"
@@ -8,21 +8,20 @@
"packages/*"
],
"resolutions": {
"babel-core": "^7.0.0-bridge.0",
"typescript": "^3.7.5"
},
"scripts": {
"build": "polkadot-dev-build-ts",
"docs": "polkadot-dev-build-docs",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx . && tsc --noEmit --pretty",
"lint": "polkadot-dev-run-lint",
"clean": "polkadot-dev-clean-build",
"postinstall": "polkadot-dev-yarn-only",
"test": "jest --coverage --runInBand",
"test:one": "jest"
"test": "polkadot-dev-run-test --coverage --runInBand",
"test:one": "polkadot-dev-run-test"
},
"devDependencies": {
"@babel/core": "^7.8.3",
"@polkadot/dev": "^0.33.3",
"@polkadot/ts": "^0.2.1"
"@babel/core": "^7.8.4",
"@polkadot/dev": "^0.40.16",
"@polkadot/ts": "^0.2.3"
}
}
+4 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/keyring",
"version": "2.1.1",
"version": "2.3.1",
"description": "Keyring management",
"main": "index.js",
"publishConfig": {
@@ -26,12 +26,9 @@
"url": "https://github.com/polkadot-js/common/issues"
},
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme",
"browser": {
"../package.json": "./package.json"
},
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/util": "^2.1.1",
"@polkadot/util-crypto": "^2.1.1"
"@babel/runtime": "^7.8.4",
"@polkadot/util": "^2.3.1",
"@polkadot/util-crypto": "^2.3.1"
}
}
+4 -13
View File
@@ -7,23 +7,14 @@ import { decodeAddress, encodeAddress, setSS58Format } from '@polkadot/util-cryp
import Keyring from './keyring';
let dirname;
let pkgJson;
// eslint-disable-next-line no-useless-catch
try {
dirname = __dirname;
// eslint-disable-next-line @typescript-eslint/no-var-requires
detectPackage(require('./package.json'), __dirname);
} catch (error) {
// ignore
throw error;
}
try {
pkgJson = require('./package.json');
} catch (error) {
pkgJson = require('../package.json');
}
detectPackage(pkgJson, dirname);
export default Keyring;
export {
+13 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/util-crypto",
"version": "2.1.1",
"version": "2.3.1",
"description": "A collection of useful crypto utilities for @polkadot",
"main": "index.js",
"keywords": [
@@ -25,20 +25,24 @@
},
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-crypto#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/util": "^2.1.1",
"@polkadot/wasm-crypto": "^0.20.1",
"@types/bs58": "^4.0.0",
"@types/elliptic": "^6.4.12",
"@types/pbkdf2": "^3.0.0",
"@types/xxhashjs": "^0.2.1",
"@babel/runtime": "^7.8.4",
"@polkadot/util": "^2.3.1",
"@polkadot/wasm-crypto": "^1.0.1",
"base-x": "^3.0.7",
"bip39": "^3.0.2",
"blakejs": "^1.1.0",
"bn.js": "^5.1.1",
"bs58": "^4.0.1",
"elliptic": "^6.5.2",
"js-sha3": "^0.8.0",
"tweetnacl": "^1.0.2",
"pbkdf2": "^3.0.9",
"tweetnacl": "^1.0.3",
"xxhashjs": "^0.2.2"
},
"devDependencies": {
"@types/bs58": "^4.0.0",
"@types/elliptic": "^6.4.12",
"@types/pbkdf2": "^3.0.0",
"@types/xxhashjs": "^0.2.1"
}
}
+6 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/util",
"version": "2.1.1",
"version": "2.3.1",
"description": "A collection of useful utilities for @polkadot",
"main": "index.js",
"keywords": [
@@ -25,12 +25,13 @@
},
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@types/bn.js": "^4.11.6",
"@babel/runtime": "^7.8.4",
"bn.js": "^5.1.1",
"camelcase": "^5.3.1",
"chalk": "^3.0.0",
"ip-regex": "^4.1.0",
"moment": "^2.24.0"
"ip-regex": "^4.1.0"
},
"devDependencies": {
"@types/bn.js": "^4.11.6"
}
}
@@ -0,0 +1,16 @@
// Copyright 2017-2020 @polkadot/util 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 formatDate from './formatDate';
describe('formatDate', (): void => {
it('formats a known date into the correct format', (): void => {
const date = new Date(Date.UTC(2020, 1, 15, 11, 14, 34));
// make this test-locale agnostic
date.setTime(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
expect(formatDate(date)).toEqual('2020-02-15 11:14:34');
});
});
+19
View File
@@ -0,0 +1,19 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
/** @internal */
function zeroPad (value: number): string {
return value.toString().padStart(2, '0');
}
export default function formatDate (date: Date): string {
const year = date.getFullYear().toString();
const month = zeroPad((date.getMonth() + 1));
const day = zeroPad(date.getDate());
const hour = zeroPad(date.getHours());
const minute = zeroPad(date.getMinutes());
const second = zeroPad(date.getSeconds());
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
}
+1
View File
@@ -3,6 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
export { default as formatBalance } from './formatBalance';
export { default as formatDate } from './formatDate';
export { default as formatDecimal } from './formatDecimal';
export { default as formatElapsed } from './formatElapsed';
export { default as formatNumber } from './formatNumber';
+2 -2
View File
@@ -5,8 +5,8 @@
import { Logger, Logger$Data } from './types';
import chalk from 'chalk';
import moment from 'moment';
import formatDate from './format/formatDate';
import isBn from './is/bn';
import isBuffer from './is/buffer';
import isFunction from './is/function';
@@ -81,7 +81,7 @@ function apply (log: LogType, type: string, values: Logger$Data): void {
chalked[log](value);
console[logTo[log] as 'log'](
chalk(moment().format('YYYY-MM-DD HH:mm:ss')),
chalk(formatDate(new Date())),
chalk(type),
...values.map(format)
);
+984 -377
View File
File diff suppressed because it is too large Load Diff