This commit is contained in:
Jaco Greeff
2020-11-10 18:19:24 +01:00
parent f1576f280d
commit d81e91af7b
19 changed files with 140 additions and 166 deletions
+5 -7
View File
@@ -2,27 +2,25 @@
"name": "@polkadot/ui-keyring",
"version": "0.62.2-5",
"main": "index.js",
"module": "index.mjs",
"module": "esm/index.js",
"sideEffects": false,
"repository": "https://github.com/polkadot-js/apps.git",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/keyring": "^4.0.2-8",
"@polkadot/keyring": "^4.0.2-11",
"@polkadot/ledger": "^0.62.2-5",
"@polkadot/ui-settings": "0.62.2-5",
"@polkadot/util": "^4.0.2-8",
"@polkadot/util": "^4.0.2-11",
"mkdirp": "^1.0.4",
"rxjs": "^6.6.3",
"store": "^2.0.12"
},
"devDependencies": {
"@polkadot/types": "^2.6.2-4",
"@polkadot/types": "^2.6.2-5",
"@types/mkdirp": "^1.0.1",
"@types/store": "^2.0.2"
},
+4 -6
View File
@@ -15,7 +15,7 @@ import { base64Decode, createKeyMulti } from '@polkadot/util-crypto';
import env from './observable/development';
import Base from './Base';
import { accountKey, addressKey, accountRegex, addressRegex, contractKey, contractRegex } from './defaults';
import keyringOption from './options';
import { KeyringOption } from './options';
const RECENT_EXPIRY = 24 * 60 * 60;
@@ -23,6 +23,8 @@ const RECENT_EXPIRY = 24 * 60 * 60;
// Chain determination occurs outside of Keyring. Loading `keyring.loadAll({ type: 'ed25519' | 'sr25519' })` is triggered
// from the API after the chain is received
export class Keyring extends Base implements KeyringStruct {
#keyringOption = new KeyringOption();
#stores = {
account: (): AddressSubject => this.accounts,
address: (): AddressSubject => this.addresses,
@@ -277,7 +279,7 @@ export class Keyring extends Base implements KeyringStruct {
}
});
keyringOption.init(this);
this.#keyringOption.init(this);
}
public restoreAccount (json: KeyringPair$Json, password: string): KeyringPair {
@@ -364,7 +366,3 @@ export class Keyring extends Base implements KeyringStruct {
return this.addresses.subject.getValue()[address];
}
}
const keyringInstance = new Keyring();
export default keyringInstance;
+3 -1
View File
@@ -3,10 +3,12 @@
import './detectPackage';
import keyring, { Keyring } from './Keyring';
import { Keyring } from './Keyring';
export { default as Ledger } from '@polkadot/ledger';
const keyring = new Keyring();
export default keyring;
export { Keyring };
@@ -2,7 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import { KeyringStruct } from '../types';
import keyringOptionInstance from '.';
import { KeyringOption } from '.';
const keyringOptionInstance = new KeyringOption();
describe('KeyringOption', (): void => {
it('should not allow initOptions to be called more than once', (): void => {
+1 -5
View File
@@ -34,7 +34,7 @@ const sortByCreated = (a: SingleAddress, b: SingleAddress): number => {
return 0;
};
class KeyringOption implements KeyringOptionInstance {
export class KeyringOption implements KeyringOptionInstance {
public readonly optionsSubject: BehaviorSubject<KeyringOptions> = new BehaviorSubject(this.emptyOptions());
public createOptionHeader (name: string): KeyringSectionOption {
@@ -138,7 +138,3 @@ class KeyringOption implements KeyringOptionInstance {
};
}
}
const keyringOptionInstance = new KeyringOption();
export default keyringOptionInstance;