Bump deps, small cleanups (#15)

This commit is contained in:
Jaco Greeff
2018-12-10 07:53:58 +01:00
committed by GitHub
parent 48400b6d80
commit 4a89bc4204
5 changed files with 53 additions and 44 deletions
+2 -2
View File
@@ -10,9 +10,9 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.1.5",
"@polkadot/keyring": "^0.33.11",
"@polkadot/keyring": "^0.33.12",
"@polkadot/ui-settings": "^0.22.11",
"@polkadot/util-crypto": "^0.33.11",
"@polkadot/util-crypto": "^0.33.12",
"@types/color": "^3.0.0",
"@types/react-copy-to-clipboard": "^4.2.6",
"color": "^3.0.0",
+2 -2
View File
@@ -11,8 +11,8 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.1.5",
"@polkadot/keyring": "^0.33.11",
"@polkadot/types": "^0.33.7",
"@polkadot/keyring": "^0.33.12",
"@polkadot/types": "^0.33.8",
"store": "^2.0.12"
}
}
+11 -9
View File
@@ -112,6 +112,15 @@ class Keyring extends Base implements KeyringStruct {
.map((address) => this.getAddress(address));
}
private rewriteKey (json: KeyringJson, key: string, hexAddr: string, creator: (addr: string) => string) {
if (hexAddr.substr(0, 2) === '0x') {
return;
}
store.remove(key);
store.set(creator(hexAddr), json);
}
private loadAccount (json: KeyringJson, key: string) {
if (!json.meta.isTesting && (json as KeyringPair$Json).encoded) {
const pair = this.keyring.addFromJson(json as KeyringPair$Json);
@@ -121,10 +130,7 @@ class Keyring extends Base implements KeyringStruct {
const [, hexAddr] = key.split(':');
if (hexAddr.substr(0, 2) !== '0x') {
store.remove(key);
store.set(accountKey(hexAddr), json);
}
this.rewriteKey(json, key, hexAddr, accountKey);
}
private loadAddress (json: KeyringJson, key: string) {
@@ -136,11 +142,7 @@ class Keyring extends Base implements KeyringStruct {
const [, hexAddr] = key.split(':');
this.addresses.add(address, json);
if (hexAddr.substr(0, 2) !== '0x') {
store.remove(key);
store.set(addressKey(hexAddr), json);
}
this.rewriteKey(json, key, hexAddr, addressKey);
}
loadAll (): void {
+17 -10
View File
@@ -35,17 +35,13 @@ class KeyringOption implements KeyringOptionInstance {
this.addAccounts(keyring, options);
this.addAddresses(keyring, options);
options.address = ([] as KeyringSectionOptions).concat(
options.address.length ? [ this.createOptionHeader('Addresses') ] : [],
options.address,
options.recent.length ? [ this.createOptionHeader('Recent') ] : [],
options.recent
options.address = this.linkItems(
{ header: 'Addresses', options: options.address },
{ header: 'Recent', options: options.recent }
);
options.account = ([] as KeyringSectionOptions).concat(
options.account.length ? [ this.createOptionHeader('Accounts') ] : [],
options.account,
options.testing.length ? [ this.createOptionHeader('Development') ] : [],
options.testing
options.account = this.linkItems(
{ header: 'Accounts', options: options.account },
{ header: 'Development', options: options.testing }
);
options.all = ([] as KeyringSectionOptions).concat(
@@ -59,6 +55,17 @@ class KeyringOption implements KeyringOptionInstance {
hasCalledInitOptions = true;
}
private linkItems (...items: Array<{ header: string, options: KeyringSectionOptions }>) {
return items.reduce((result, { header, options }) => {
return result.concat(
options.length
? [this.createOptionHeader(header)]
: [],
options
);
}, [] as KeyringSectionOptions);
}
private addAccounts (keyring: KeyringStruct, options: KeyringOptions): void {
const available = keyring.accounts.subject.getValue();
+21 -21
View File
@@ -1430,14 +1430,14 @@
typedoc-plugin-no-inherit "^1.0.2"
typescript "^3.2.1"
"@polkadot/keyring@^0.33.11":
version "0.33.11"
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.33.11.tgz#79c6174e9b27147ff69a2375f39a2462b2d581c7"
integrity sha512-AP98VfGbcdXo9Bp650klh0l734kcmrYM1kzDs+mpGmpwMQtjRrEuitWwAvb84Sl6Snq6qMOadLXVAxU8PtOtgA==
"@polkadot/keyring@^0.33.12":
version "0.33.12"
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.33.12.tgz#7e5d8e5ad996981790b76c4741b89eea4ce8988d"
integrity sha512-qClQCGtP6zMZzi6WZbToyyaifbpX3D25UAgEl4wyGn+G1NM8anRVRcjtRFOBRSE+WFZU6SPyMtmyMWI+roQ42A==
dependencies:
"@babel/runtime" "^7.1.5"
"@polkadot/util" "^0.33.11"
"@polkadot/util-crypto" "^0.33.11"
"@polkadot/util" "^0.33.12"
"@polkadot/util-crypto" "^0.33.12"
"@types/bs58" "^3.0.30"
bs58 "^4.0.1"
@@ -1446,22 +1446,22 @@
resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.41.tgz#647b44b038f94a7acf76633b25cb72df897872fc"
integrity sha512-/vYpjqKU+QKHNAlFdLgFZAAr54wxQMgIuszZ5BxaayUoq7ukDlvCPhUGQ3fNoyBSEaL7uTCZ/5SVRc363IehoA==
"@polkadot/types@^0.33.7":
version "0.33.7"
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.33.7.tgz#60363d6272ee5d37eac10998b6930c06fc40d7e8"
integrity sha512-kkzIMIk+Ai6Elg/mYA5bDn75X68p2yns+dfA8uouuR20MysbxhCNtLkC/dTW0wHiRaNsCjDN+knbWiliLBygEg==
"@polkadot/types@^0.33.8":
version "0.33.8"
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.33.8.tgz#289e235612152b1f416f7ac0bb893dddfb2236c1"
integrity sha512-za2hDhLtdtWndNgoMLXlNg1Y4xVu+Fl9ruFzbmm9PLkSg8fR6uZpqSHm5PCDJvbJJG+13PhLGse0Bd5OcvGUww==
dependencies:
"@babel/runtime" "^7.1.5"
"@polkadot/keyring" "^0.33.11"
"@polkadot/util" "^0.33.11"
"@polkadot/keyring" "^0.33.12"
"@polkadot/util" "^0.33.12"
"@polkadot/util-crypto@^0.33.11":
version "0.33.11"
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.33.11.tgz#25b30e69a4da1f6a42d3680536130ca4f9480db6"
integrity sha512-jL1TzlqHGKRu9SN80e0K/0H1ZZ6fRTv96s2f6s27GrGt6+tcPEVcmaQK5vjEDMw2pT9+b5TPwcx2gLwh56GLVg==
"@polkadot/util-crypto@^0.33.12":
version "0.33.12"
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.33.12.tgz#1f5ab4f6cda328ca4460be3c6d083671e815ff1e"
integrity sha512-iIY4qminRjWOrYhbl9DuJ6CjQC0sivrkGI1yV5wVxSVPwC9GHYL/3MKmw4FX7vhtaLlrcs0hTz/g/MOt66fX/Q==
dependencies:
"@babel/runtime" "^7.1.5"
"@polkadot/util" "^0.33.11"
"@polkadot/util" "^0.33.12"
"@types/bip39" "^2.4.1"
bip39 "^2.5.0"
blakejs "^1.1.0"
@@ -1469,10 +1469,10 @@
tweetnacl "^1.0.0"
xxhashjs "^0.2.2"
"@polkadot/util@^0.33.11":
version "0.33.11"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.33.11.tgz#3e2433e556ee14c685ebc5920c229cb76e0b985b"
integrity sha512-Tn+WYU+RxOaJhrUsPjBOk77MDKb6bsqVkcs5ysSc1HUDIRqZwGABnX1rhP2/DipS91hj8DQ2HZE18S7mCBv1bQ==
"@polkadot/util@^0.33.12":
version "0.33.12"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.33.12.tgz#489fbe478887ec1bba0b7873b3cff39bf17899fb"
integrity sha512-8qAjFGR9IjS8CBEqvJyPUEFasJVCF/bB/vqZFKG/LPi3oL1y4kTIWnwp1GhLhXCVIjfoZOxaW5wpnRajbeHINQ==
dependencies:
"@babel/runtime" "^7.1.5"
"@types/bn.js" "^4.11.3"