From 7c1ca3a5c97afda98d52dbf4f0f9afd35fc7145d Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Sat, 22 Feb 2020 14:45:31 +0100 Subject: [PATCH] Use # instead of private _ (#545) * Use # insead of private _ * Update key extraction paths --- CHANGELOG.md | 1 + package.json | 2 +- packages/keyring/src/keyring.ts | 30 +-- packages/keyring/src/pairs.ts | 14 +- .../util-crypto/src/key/DeriveJunction.ts | 18 +- .../util-crypto/src/key/extractPath.spec.ts | 45 ++--- .../util-crypto/src/key/extractSuri.spec.ts | 171 ++++++++---------- yarn.lock | 18 +- 8 files changed, 145 insertions(+), 154 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53613b0c9..1282c49a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Add `isBigInt(value)` to allow `BigInt` checks. Also add support in `bnToBn`, and anything that uses this conversion for numbers - Add `isChildClass(Parent, Child?)` to check if a class extends the parent +- (internal) Use `#` insead of `private _` for private class variables # 2.4.1 Feb 18, 2020 diff --git a/package.json b/package.json index 6ca8b4142..fef0e7d12 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "devDependencies": { "@babel/core": "^7.8.4", - "@polkadot/dev": "^0.40.22", + "@polkadot/dev": "^0.41.1", "@polkadot/ts": "^0.2.3" } } diff --git a/packages/keyring/src/keyring.ts b/packages/keyring/src/keyring.ts index bdf909720..d853645eb 100644 --- a/packages/keyring/src/keyring.ts +++ b/packages/keyring/src/keyring.ts @@ -29,11 +29,11 @@ import Pairs from './pairs'; * an account may be obtained using `toJson` accompanied by the account passphrase. */ export default class Keyring implements KeyringInstance { - private _pairs: Pairs; + readonly #pairs: Pairs; - private _ss58?: number; + readonly #type: KeypairType; - private _type: KeypairType; + #ss58?: number; public decodeAddress = decodeAddress; @@ -42,9 +42,9 @@ export default class Keyring implements KeyringInstance { 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._ss58 = options.ss58Format; - this._type = options.type; + this.#pairs = new Pairs(); + this.#ss58 = options.ss58Format; + this.#type = options.type; } /** @@ -65,7 +65,7 @@ export default class Keyring implements KeyringInstance { * @description Returns the type of the keyring, either ed25519 of sr25519 */ public get type (): KeypairType { - return this._type; + return this.#type; } /** @@ -73,7 +73,7 @@ export default class Keyring implements KeyringInstance { * @summary Stores an account, given a keyring pair, as a Key/Value (public key, pair) in Keyring Pair Dictionary */ public addPair (pair: KeyringPair): KeyringPair { - return this._pairs.add(pair); + return this.#pairs.add(pair); } /** @@ -188,7 +188,7 @@ export default class Keyring implements KeyringInstance { * @description Encodes the input into an ss58 representation */ public encodeAddress = (key: Uint8Array | string, ss58Format?: number): string => { - return encodeAddress(key, ss58Format || this._ss58); + return encodeAddress(key, ss58Format || this.#ss58); } /** @@ -198,7 +198,7 @@ export default class Keyring implements KeyringInstance { * a key lookup using the provided account address or public key (after decoding it). */ public getPair (address: string | Uint8Array): KeyringPair { - return this._pairs.get(address); + return this.#pairs.get(address); } /** @@ -207,7 +207,7 @@ export default class Keyring implements KeyringInstance { * @description Returns an array list of all the keyring pair values that are stored in the keyring pair dictionary. */ public getPairs (): KeyringPair[] { - return this._pairs.all(); + return this.#pairs.all(); } /** @@ -216,7 +216,7 @@ export default class Keyring implements KeyringInstance { * @description Returns an array list of all the public keys associated with each of the keyring pair values that are stored in the keyring pair dictionary. */ public getPublicKeys (): Uint8Array[] { - return this._pairs + return this.#pairs .all() .map(({ publicKey }): Uint8Array => publicKey @@ -228,7 +228,7 @@ export default class Keyring implements KeyringInstance { * @description Deletes the provided input address or public key from the stored Keyring Pair Dictionary. */ public removePair (address: string | Uint8Array): void { - this._pairs.remove(address); + this.#pairs.remove(address); } /** @@ -236,7 +236,7 @@ export default class Keyring implements KeyringInstance { * @description Sets the ss58 format for the keyring */ public setSS58Format (ss58: number): void { - this._ss58 = ss58; + this.#ss58 = ss58; } /** @@ -248,6 +248,6 @@ export default class Keyring implements KeyringInstance { * may backup their account to a JSON file that contains this information. */ public toJson (address: string | Uint8Array, passphrase?: string): KeyringPair$Json { - return this._pairs.get(address).toJson(passphrase); + return this.#pairs.get(address).toJson(passphrase); } } diff --git a/packages/keyring/src/pairs.ts b/packages/keyring/src/pairs.ts index a87c4255a..916e3d78d 100644 --- a/packages/keyring/src/pairs.ts +++ b/packages/keyring/src/pairs.ts @@ -10,24 +10,20 @@ import { decodeAddress } from '@polkadot/util-crypto'; type KeyringPairMap = Record; export default class Pairs implements KeyringPairs { - private _map: KeyringPairMap; - - constructor () { - this._map = {}; - } + readonly #map: KeyringPairMap = {}; public add (pair: KeyringPair): KeyringPair { - this._map[pair.publicKey.toString()] = pair; + this.#map[pair.publicKey.toString()] = pair; return pair; } public all (): KeyringPair[] { - return Object.values(this._map); + return Object.values(this.#map); } public get (address: string | Uint8Array): KeyringPair { - const pair = this._map[decodeAddress(address).toString()]; + const pair = this.#map[decodeAddress(address).toString()]; assert(pair, (): string => { const formatted: string = isU8a(address) || isHex(address) @@ -41,6 +37,6 @@ export default class Pairs implements KeyringPairs { } public remove (address: string | Uint8Array): void { - delete this._map[decodeAddress(address).toString()]; + delete this.#map[decodeAddress(address).toString()]; } } diff --git a/packages/util-crypto/src/key/DeriveJunction.ts b/packages/util-crypto/src/key/DeriveJunction.ts index b80843640..90e788739 100644 --- a/packages/util-crypto/src/key/DeriveJunction.ts +++ b/packages/util-crypto/src/key/DeriveJunction.ts @@ -16,9 +16,9 @@ const BN_OPTIONS = { }; export default class DeriveJunction { - private _chainCode: Uint8Array = new Uint8Array(32); + readonly #chainCode: Uint8Array = new Uint8Array(32); - private _isHard = false; + #isHard = false; public static from (value: string): DeriveJunction { const [code, isHard] = value.startsWith('/') @@ -38,15 +38,15 @@ export default class DeriveJunction { } public get chainCode (): Uint8Array { - return this._chainCode; + return this.#chainCode; } public get isHard (): boolean { - return this._isHard; + return this.#isHard; } public get isSoft (): boolean { - return !this._isHard; + return !this.#isHard; } public hard (value: number | BN | string | Uint8Array): DeriveJunction { @@ -54,7 +54,7 @@ export default class DeriveJunction { } public harden (): DeriveJunction { - this._isHard = true; + this.#isHard = true; return this; } @@ -72,14 +72,14 @@ export default class DeriveJunction { return this.soft(blake2AsU8a(value)); } - this._chainCode.fill(0); - this._chainCode.set(value, 0); + this.#chainCode.fill(0); + this.#chainCode.set(value, 0); return this; } public soften (): DeriveJunction { - this._isHard = false; + this.#isHard = false; return this; } diff --git a/packages/util-crypto/src/key/extractPath.spec.ts b/packages/util-crypto/src/key/extractPath.spec.ts index 4c7ccfa2e..c4cc6b6e2 100644 --- a/packages/util-crypto/src/key/extractPath.spec.ts +++ b/packages/util-crypto/src/key/extractPath.spec.ts @@ -6,37 +6,32 @@ import keyExtractPath, { ExtractResult } from './extractPath'; describe('keyExtractPath', (): void => { it('extracts properly from soft', (): void => { - expect( - keyExtractPath('/1') - ).toEqual({ - parts: ['/1'], - path: [ - { _isHard: false, _chainCode: Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ] - }); + const test = keyExtractPath('/1'); + + expect(test.parts).toEqual(['/1']); + expect(test.path.length).toEqual(1); + expect(test.path[0].isHard).toEqual(false); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('extracts properly from hard', (): void => { - expect( - keyExtractPath('//1') - ).toEqual({ - parts: ['//1'], - path: [ - { _isHard: true, _chainCode: Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ] - }); + const test = keyExtractPath('//1'); + + expect(test.parts).toEqual(['//1']); + expect(test.path.length).toEqual(1); + expect(test.path[0].isHard).toEqual(true); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('extracts properly from hard/soft', (): void => { - expect( - keyExtractPath('//1/2') - ).toEqual({ - parts: ['//1', '/2'], - path: [ - { _isHard: true, _chainCode: Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) }, - { _isHard: false, _chainCode: Uint8Array.from([2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ] - }); + const test = keyExtractPath('//1/2'); + + expect(test.parts).toEqual(['//1', '/2']); + expect(test.path.length).toEqual(2); + expect(test.path[0].isHard).toEqual(true); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); + expect(test.path[1].isHard).toEqual(false); + expect(test.path[1].chainCode).toEqual(Uint8Array.from([2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('does not extract from invalid paths', (): void => { diff --git a/packages/util-crypto/src/key/extractSuri.spec.ts b/packages/util-crypto/src/key/extractSuri.spec.ts index dba425403..2e979b3c8 100644 --- a/packages/util-crypto/src/key/extractSuri.spec.ts +++ b/packages/util-crypto/src/key/extractSuri.spec.ts @@ -12,126 +12,115 @@ describe('keyExtractSuri', (): void => { }); it('derives on "hello world"', (): void => { - expect( - keyExtractSuri('hello world') - ).toEqual({ - path: [], - phrase: 'hello world' - }); + const test = keyExtractSuri('hello world'); + + expect(test.phrase).toEqual('hello world'); + expect(test.path.length).toEqual(0); }); it('derives on "hello world/1', (): void => { - expect( - keyExtractSuri('hello world/1') - ).toEqual({ - path: [ - { _isHard: false, _chainCode: Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ], - phrase: 'hello world' - }); + const test = keyExtractSuri('hello world/1'); + + expect(test.password).not.toBeDefined(); + expect(test.phrase).toEqual('hello world'); + expect(test.path.length).toEqual(1); + expect(test.path[0].isHard).toEqual(false); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('derives on "hello world/DOT', (): void => { - expect( - keyExtractSuri('hello world/DOT') - ).toEqual({ - path: [ - { _isHard: false, _chainCode: Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ], - phrase: 'hello world' - }); + const test = keyExtractSuri('hello world/DOT'); + + expect(test.password).not.toBeDefined(); + expect(test.phrase).toEqual('hello world'); + expect(test.path.length).toEqual(1); + expect(test.path[0].isHard).toEqual(false); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('derives on "hello world//1', (): void => { - expect( - keyExtractSuri('hello world//1') - ).toEqual({ - path: [ - { _isHard: true, _chainCode: Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ], - phrase: 'hello world' - }); + const test = keyExtractSuri('hello world//1'); + + expect(test.password).not.toBeDefined(); + expect(test.phrase).toEqual('hello world'); + expect(test.path.length).toEqual(1); + expect(test.path[0].isHard).toEqual(true); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('derives on "hello world//DOT', (): void => { - expect( - keyExtractSuri('hello world//DOT') - ).toEqual({ - path: [ - { _isHard: true, _chainCode: Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ], - phrase: 'hello world' - }); + const test = keyExtractSuri('hello world//DOT'); + + expect(test.password).not.toBeDefined(); + expect(test.phrase).toEqual('hello world'); + expect(test.path.length).toEqual(1); + expect(test.path[0].isHard).toEqual(true); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('derives on "hello world//1/DOT', (): void => { - expect( - keyExtractSuri('hello world//1/DOT') - ).toEqual({ - path: [ - { _isHard: true, _chainCode: Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) }, - { _isHard: false, _chainCode: Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ], - phrase: 'hello world' - }); + const test = keyExtractSuri('hello world//1/DOT'); + + expect(test.password).not.toBeDefined(); + expect(test.phrase).toEqual('hello world'); + expect(test.path.length).toEqual(2); + expect(test.path[0].isHard).toEqual(true); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); + expect(test.path[1].isHard).toEqual(false); + expect(test.path[1].chainCode).toEqual(Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('derives on "hello world//DOT/1', (): void => { - expect( - keyExtractSuri('hello world//DOT/1') - ).toEqual({ - path: [ - { _isHard: true, _chainCode: Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) }, - { _isHard: false, _chainCode: Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ], - phrase: 'hello world' - }); + const test = keyExtractSuri('hello world//DOT/1'); + + expect(test.password).not.toBeDefined(); + expect(test.phrase).toEqual('hello world'); + expect(test.path.length).toEqual(2); + expect(test.path[0].isHard).toEqual(true); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); + expect(test.path[1].isHard).toEqual(false); + expect(test.path[1].chainCode).toEqual(Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('derives on "hello world///password"', (): void => { - expect( - keyExtractSuri('hello world///password') - ).toEqual({ - password: 'password', - path: [], - phrase: 'hello world' - }); + const test = keyExtractSuri('hello world///password'); + + expect(test.password).toEqual('password'); + expect(test.phrase).toEqual('hello world'); + expect(test.path.length).toEqual(0); }); it('derives on "hello world//1/DOT///password"', (): void => { - expect( - keyExtractSuri('hello world//1/DOT///password') - ).toEqual({ - path: [ - { _isHard: true, _chainCode: Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) }, - { _isHard: false, _chainCode: Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ], - password: 'password', - phrase: 'hello world' - }); + const test = keyExtractSuri('hello world//1/DOT///password'); + + expect(test.password).toEqual('password'); + expect(test.phrase).toEqual('hello world'); + expect(test.path.length).toEqual(2); + expect(test.path[0].isHard).toEqual(true); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); + expect(test.path[1].isHard).toEqual(false); + expect(test.path[1].chainCode).toEqual(Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('derives on "hello world/1//DOT///password"', (): void => { - expect( - keyExtractSuri('hello world/1//DOT///password') - ).toEqual({ - path: [ - { _isHard: false, _chainCode: Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) }, - { _isHard: true, _chainCode: Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ], - password: 'password', - phrase: 'hello world' - }); + const test = keyExtractSuri('hello world/1//DOT///password'); + + expect(test.password).toEqual('password'); + expect(test.phrase).toEqual('hello world'); + expect(test.path.length).toEqual(2); + expect(test.path[0].isHard).toEqual(false); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); + expect(test.path[1].isHard).toEqual(true); + expect(test.path[1].chainCode).toEqual(Uint8Array.from([12, 68, 79, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); it('derives on actual Alice', (): void => { - expect( - keyExtractSuri('bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice') - ).toEqual({ - path: [ - { _isHard: true, _chainCode: Uint8Array.from([20, 65, 108, 105, 99, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) } - ], - phrase: 'bottom drive obey lake curtain smoke basket hold race lonely fit walk' - }); + const test = keyExtractSuri('bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice'); + + expect(test.password).not.toBeDefined(); + expect(test.phrase).toEqual('bottom drive obey lake curtain smoke basket hold race lonely fit walk'); + expect(test.path.length).toEqual(1); + expect(test.path[0].isHard).toEqual(true); + expect(test.path[0].chainCode).toEqual(Uint8Array.from([20, 65, 108, 105, 99, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])); }); }); diff --git a/yarn.lock b/yarn.lock index 2467d1dc7..6dd319d74 100644 --- a/yarn.lock +++ b/yarn.lock @@ -416,6 +416,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" +"@babel/plugin-syntax-import-meta@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.8.3.tgz#230afff79d3ccc215b5944b438e4e266daf3d84d" + integrity sha512-vYiGd4wQ9gx0Lngb7+bPCwQXGK/PR6FeTIJ+TIOlq+OfOKG/kCAOO2+IBac3oMM9qV7/fU76hfcqxUaLKZf1hQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-json-strings@^7.8.0": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" @@ -1967,15 +1974,16 @@ dependencies: "@types/node" ">= 8" -"@polkadot/dev@^0.40.22": - version "0.40.22" - resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.40.22.tgz#6306f3d0400180f57bdfa63ce63ee2e9da96d3f8" - integrity sha512-c1m1rk4FFXq/Jy67CzJkZLNtB7agjrB4Tbbwum7WItcdb6GrjnWB32ZmHEBPd982CTyiBRi5Y2OoUZMp6uR13A== +"@polkadot/dev@^0.41.1": + version "0.41.1" + resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.41.1.tgz#00585db9d4a78b143c7a9572636fb404dbe9de27" + integrity sha512-DWmXD1WDDX/xUfLoF1r/dP9E2158iPHSOEURfnyZrvBgMNYh5FqFZ7dO4sMPebZlHeg5jaK/GzhR0kKr78s8SA== dependencies: "@babel/cli" "^7.8.4" "@babel/core" "^7.8.4" "@babel/plugin-proposal-class-properties" "^7.8.3" "@babel/plugin-proposal-decorators" "^7.8.3" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.8.3" "@babel/plugin-proposal-numeric-separator" "^7.8.3" "@babel/plugin-proposal-object-rest-spread" "^7.8.3" "@babel/plugin-proposal-optional-chaining" "^7.8.3" @@ -1983,6 +1991,8 @@ "@babel/plugin-proposal-private-methods" "^7.8.3" "@babel/plugin-syntax-bigint" "^7.8.3" "@babel/plugin-syntax-dynamic-import" "^7.8.3" + "@babel/plugin-syntax-import-meta" "^7.8.3" + "@babel/plugin-syntax-top-level-await" "^7.8.3" "@babel/plugin-transform-runtime" "^7.8.3" "@babel/preset-env" "^7.8.4" "@babel/preset-react" "^7.8.3"