mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-20 02:21:05 +00:00
Add contracts to ui-keyring (#137)
* add contracts to keyring * genesisHash * requested changes + allPlus option type * remove duplicate fn * add contracts to keyring * genesisHash * requested changes + allPlus option type * remove duplicate fn * changes * contract key * prefixes
This commit is contained in:
@@ -12,6 +12,7 @@ import { isBoolean, isString } from '@polkadot/util';
|
|||||||
|
|
||||||
import accounts from './observable/accounts';
|
import accounts from './observable/accounts';
|
||||||
import addresses from './observable/addresses';
|
import addresses from './observable/addresses';
|
||||||
|
import contracts from './observable/contracts';
|
||||||
import env from './observable/development';
|
import env from './observable/development';
|
||||||
import LocalStorageStore from './stores/LocalStorage';
|
import LocalStorageStore from './stores/LocalStorage';
|
||||||
import { MAX_PASS_LEN } from './defaults';
|
import { MAX_PASS_LEN } from './defaults';
|
||||||
@@ -19,13 +20,16 @@ import { MAX_PASS_LEN } from './defaults';
|
|||||||
export default class Base {
|
export default class Base {
|
||||||
private _accounts: AddressSubject;
|
private _accounts: AddressSubject;
|
||||||
private _addresses: AddressSubject;
|
private _addresses: AddressSubject;
|
||||||
|
private _contracts: AddressSubject;
|
||||||
private _keyring?: KeyringInstance;
|
private _keyring?: KeyringInstance;
|
||||||
private _prefix?: Prefix;
|
private _prefix?: Prefix;
|
||||||
|
protected _genesisHash?: string;
|
||||||
protected _store: KeyringStore;
|
protected _store: KeyringStore;
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
this._accounts = accounts;
|
this._accounts = accounts;
|
||||||
this._addresses = addresses;
|
this._addresses = addresses;
|
||||||
|
this._contracts = contracts;
|
||||||
this._keyring = undefined;
|
this._keyring = undefined;
|
||||||
this._store = null as any;
|
this._store = null as any;
|
||||||
}
|
}
|
||||||
@@ -38,6 +42,10 @@ export default class Base {
|
|||||||
return this._addresses;
|
return this._addresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get contracts () {
|
||||||
|
return this._contracts;
|
||||||
|
}
|
||||||
|
|
||||||
get keyring (): KeyringInstance {
|
get keyring (): KeyringInstance {
|
||||||
if (this._keyring) {
|
if (this._keyring) {
|
||||||
return this._keyring;
|
return this._keyring;
|
||||||
@@ -46,6 +54,10 @@ export default class Base {
|
|||||||
throw new Error(`Keyring should be initialised via 'loadAll' before use`);
|
throw new Error(`Keyring should be initialised via 'loadAll' before use`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get genesisHash () {
|
||||||
|
return this._genesisHash;
|
||||||
|
}
|
||||||
|
|
||||||
decodeAddress (key: string | Uint8Array, ignoreChecksum?: boolean): Uint8Array {
|
decodeAddress (key: string | Uint8Array, ignoreChecksum?: boolean): Uint8Array {
|
||||||
return this.keyring.decodeAddress(key, ignoreChecksum);
|
return this.keyring.decodeAddress(key, ignoreChecksum);
|
||||||
}
|
}
|
||||||
@@ -67,11 +79,12 @@ export default class Base {
|
|||||||
isAvailable (_address: Uint8Array | string): boolean {
|
isAvailable (_address: Uint8Array | string): boolean {
|
||||||
const accountsValue = this.accounts.subject.getValue();
|
const accountsValue = this.accounts.subject.getValue();
|
||||||
const addressesValue = this.addresses.subject.getValue();
|
const addressesValue = this.addresses.subject.getValue();
|
||||||
|
const contractsValue = this.contracts.subject.getValue();
|
||||||
const address = isString(_address)
|
const address = isString(_address)
|
||||||
? _address
|
? _address
|
||||||
: this.encodeAddress(_address);
|
: this.encodeAddress(_address);
|
||||||
|
|
||||||
return !accountsValue[address] && !addressesValue[address];
|
return !accountsValue[address] && !addressesValue[address] && !contractsValue[address];
|
||||||
}
|
}
|
||||||
|
|
||||||
isPassValid (password: string): boolean {
|
isPassValid (password: string): boolean {
|
||||||
@@ -94,6 +107,7 @@ export default class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._keyring = keyring;
|
this._keyring = keyring;
|
||||||
|
this._genesisHash = options.genesisHash && options.genesisHash.toHex();
|
||||||
this._store = options.store || new LocalStorageStore();
|
this._store = options.store || new LocalStorageStore();
|
||||||
|
|
||||||
this.addAccountPairs();
|
this.addAccountPairs();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { hexToU8a, isHex, isString, u8aToHex } from '@polkadot/util';
|
|||||||
|
|
||||||
import env from './observable/development';
|
import env from './observable/development';
|
||||||
import Base from './Base';
|
import Base from './Base';
|
||||||
import { accountKey, addressKey, accountRegex, addressRegex } from './defaults';
|
import { accountKey, addressKey, accountRegex, addressRegex, contractKey, contractRegex } from './defaults';
|
||||||
import keyringOption from './options';
|
import keyringOption from './options';
|
||||||
|
|
||||||
const RECENT_EXPIRY = 24 * 60 * 60;
|
const RECENT_EXPIRY = 24 * 60 * 60;
|
||||||
@@ -101,6 +101,10 @@ export class Keyring extends Base implements KeyringStruct {
|
|||||||
this.addresses.remove(this._store, address);
|
this.addresses.remove(this._store, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
forgetContract (address: string): void {
|
||||||
|
this.contracts.remove(this._store, address);
|
||||||
|
}
|
||||||
|
|
||||||
getAccount (address: string | Uint8Array): KeyringAddress {
|
getAccount (address: string | Uint8Array): KeyringAddress {
|
||||||
return this.getAddress(address, 'account');
|
return this.getAddress(address, 'account');
|
||||||
}
|
}
|
||||||
@@ -114,14 +118,21 @@ export class Keyring extends Base implements KeyringStruct {
|
|||||||
.filter((account) => env.isDevelopment() || account.getMeta().isTesting !== true);
|
.filter((account) => env.isDevelopment() || account.getMeta().isTesting !== true);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAddress (_address: string | Uint8Array, type: 'account' | 'address' = 'address'): KeyringAddress {
|
getAddress (_address: string | Uint8Array, type: 'account' | 'address' | 'contract' = 'address'): KeyringAddress {
|
||||||
const address = isString(_address)
|
const address = isString(_address)
|
||||||
? _address
|
? _address
|
||||||
: this.encodeAddress(_address);
|
: this.encodeAddress(_address);
|
||||||
const publicKey = this.decodeAddress(address);
|
const publicKey = this.decodeAddress(address);
|
||||||
const subject = type === 'account'
|
const subject = (() => {
|
||||||
? this.accounts.subject
|
switch (type) {
|
||||||
: this.addresses.subject;
|
case 'account':
|
||||||
|
return this.accounts.subject;
|
||||||
|
case 'address':
|
||||||
|
return this.addresses.subject;
|
||||||
|
case 'contract':
|
||||||
|
return this.contracts.subject;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
address: (): string =>
|
address: (): string =>
|
||||||
@@ -143,6 +154,22 @@ export class Keyring extends Base implements KeyringStruct {
|
|||||||
.map((address) => this.getAddress(address));
|
.map((address) => this.getAddress(address));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getContract (address: string | Uint8Array): KeyringAddress {
|
||||||
|
return this.getAddress(address, 'contract');
|
||||||
|
}
|
||||||
|
|
||||||
|
getContracts (): Array<KeyringAddress> {
|
||||||
|
const available = this.contracts.subject.getValue();
|
||||||
|
|
||||||
|
return Object
|
||||||
|
.entries(available)
|
||||||
|
.filter(([, data]) => {
|
||||||
|
const { json: { meta: { contract } } } = data;
|
||||||
|
return contract && contract.genesisHash === this.genesisHash;
|
||||||
|
})
|
||||||
|
.map(([address]) => this.getContract(address));
|
||||||
|
}
|
||||||
|
|
||||||
private rewriteKey (json: KeyringJson, key: string, hexAddr: string, creator: (addr: string) => string) {
|
private rewriteKey (json: KeyringJson, key: string, hexAddr: string, creator: (addr: string) => string) {
|
||||||
if (hexAddr.substr(0, 2) === '0x') {
|
if (hexAddr.substr(0, 2) === '0x') {
|
||||||
return;
|
return;
|
||||||
@@ -185,6 +212,16 @@ export class Keyring extends Base implements KeyringStruct {
|
|||||||
this.rewriteKey(json, key, hexAddr, addressKey);
|
this.rewriteKey(json, key, hexAddr, addressKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private loadContract (json: KeyringJson, key: string) {
|
||||||
|
const address = this.encodeAddress(
|
||||||
|
this.decodeAddress(json.address)
|
||||||
|
);
|
||||||
|
const [, hexAddr] = key.split(':');
|
||||||
|
|
||||||
|
this.contracts.add(this._store, address, json);
|
||||||
|
this.rewriteKey(json, key, hexAddr, contractKey);
|
||||||
|
}
|
||||||
|
|
||||||
private loadInjected (address: string, meta: KeyringJson$Meta) {
|
private loadInjected (address: string, meta: KeyringJson$Meta) {
|
||||||
const json = {
|
const json = {
|
||||||
address,
|
address,
|
||||||
@@ -202,10 +239,20 @@ export class Keyring extends Base implements KeyringStruct {
|
|||||||
super.initKeyring(options);
|
super.initKeyring(options);
|
||||||
|
|
||||||
this._store.all((key: string, json: KeyringJson) => {
|
this._store.all((key: string, json: KeyringJson) => {
|
||||||
if (accountRegex.test(key)) {
|
if (options.filter ? options.filter(json) : true) {
|
||||||
this.loadAccount(json, key);
|
if (accountRegex.test(key)) {
|
||||||
} else if (addressRegex.test(key)) {
|
this.loadAccount(json, key);
|
||||||
this.loadAddress(json, key);
|
} else if (addressRegex.test(key)) {
|
||||||
|
this.loadAddress(json, key);
|
||||||
|
} else if (contractRegex.test(key)) {
|
||||||
|
if (
|
||||||
|
json.meta && json.meta.contract &&
|
||||||
|
this.genesisHash &&
|
||||||
|
this.genesisHash === json.meta.contract.genesisHash
|
||||||
|
) {
|
||||||
|
this.loadContract(json, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -258,7 +305,7 @@ export class Keyring extends Base implements KeyringStruct {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAddress (address: string, meta: KeyringPair$Meta): KeyringPair$Json {
|
saveAddress (address: string, meta: KeyringPair$Meta, type: 'address' | 'contract' = 'address'): KeyringPair$Json {
|
||||||
const available = this.addresses.subject.getValue();
|
const available = this.addresses.subject.getValue();
|
||||||
|
|
||||||
const json = (available[address] && available[address].json) || {
|
const json = (available[address] && available[address].json) || {
|
||||||
@@ -275,11 +322,24 @@ export class Keyring extends Base implements KeyringStruct {
|
|||||||
|
|
||||||
delete json.meta.isRecent;
|
delete json.meta.isRecent;
|
||||||
|
|
||||||
this.addresses.add(this._store, address, json);
|
const key = (() => {
|
||||||
|
switch (type) {
|
||||||
|
case 'contract':
|
||||||
|
return 'contracts';
|
||||||
|
default:
|
||||||
|
return 'addresses';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
this[key].add(this._store, address, json);
|
||||||
|
|
||||||
return json as KeyringPair$Json;
|
return json as KeyringPair$Json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveContract (address: string, meta: KeyringPair$Meta): KeyringPair$Json {
|
||||||
|
return this.saveAddress(address, meta, 'contract');
|
||||||
|
}
|
||||||
|
|
||||||
saveRecent (address: string): SingleAddress {
|
saveRecent (address: string): SingleAddress {
|
||||||
const available = this.addresses.subject.getValue();
|
const available = this.addresses.subject.getValue();
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { decodeAddress } from '@polkadot/keyring';
|
|||||||
|
|
||||||
const ACCOUNT_PREFIX = 'account:';
|
const ACCOUNT_PREFIX = 'account:';
|
||||||
const ADDRESS_PREFIX = 'address:';
|
const ADDRESS_PREFIX = 'address:';
|
||||||
|
const CONTRACT_PREFIX = 'contract:';
|
||||||
const MAX_PASS_LEN = 32;
|
const MAX_PASS_LEN = 32;
|
||||||
|
|
||||||
function toHex (address: string): string {
|
function toHex (address: string): string {
|
||||||
@@ -22,14 +23,21 @@ const accountKey = (address: string): string =>
|
|||||||
const addressKey = (address: string): string =>
|
const addressKey = (address: string): string =>
|
||||||
`${ADDRESS_PREFIX}${toHex(address)}`;
|
`${ADDRESS_PREFIX}${toHex(address)}`;
|
||||||
|
|
||||||
const accountRegex = new RegExp(`^${ACCOUNT_PREFIX}`, '');
|
const contractKey = (address: string): string =>
|
||||||
|
`${CONTRACT_PREFIX}${toHex(address)}`;
|
||||||
|
|
||||||
const addressRegex = new RegExp(`^${ADDRESS_PREFIX}`, '');
|
const accountRegex = new RegExp(`^${ACCOUNT_PREFIX}0x[0-9a-f]*`, '');
|
||||||
|
|
||||||
|
const addressRegex = new RegExp(`^${ADDRESS_PREFIX}0x[0-9a-f]*`, '');
|
||||||
|
|
||||||
|
const contractRegex = new RegExp(`^${CONTRACT_PREFIX}0x[0-9a-f]*`, '');
|
||||||
|
|
||||||
export {
|
export {
|
||||||
accountKey,
|
accountKey,
|
||||||
accountRegex,
|
accountRegex,
|
||||||
addressKey,
|
addressKey,
|
||||||
addressRegex,
|
addressRegex,
|
||||||
|
contractKey,
|
||||||
|
contractRegex,
|
||||||
MAX_PASS_LEN
|
MAX_PASS_LEN
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// Copyright 2017-2019 @polkadot/ui-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 { contractKey } from '../defaults';
|
||||||
|
|
||||||
|
import genericSubject from './genericSubject';
|
||||||
|
|
||||||
|
export default genericSubject(contractKey);
|
||||||
@@ -7,13 +7,16 @@ import { map } from 'rxjs/operators';
|
|||||||
|
|
||||||
import accounts from './accounts';
|
import accounts from './accounts';
|
||||||
import addresses from './addresses';
|
import addresses from './addresses';
|
||||||
|
import contracts from './contracts';
|
||||||
|
|
||||||
export default combineLatest(
|
export default combineLatest(
|
||||||
accounts.subject,
|
accounts.subject,
|
||||||
addresses.subject
|
addresses.subject,
|
||||||
|
contracts.subject
|
||||||
).pipe(
|
).pipe(
|
||||||
map(([accounts, addresses]) => ({
|
map(([accounts, addresses, contracts]) => ({
|
||||||
accounts,
|
accounts,
|
||||||
addresses
|
addresses,
|
||||||
|
contracts
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class KeyringOption implements KeyringOptionInstance {
|
|||||||
|
|
||||||
this.addAccounts(keyring, options);
|
this.addAccounts(keyring, options);
|
||||||
this.addAddresses(keyring, options);
|
this.addAddresses(keyring, options);
|
||||||
|
this.addContracts(keyring, options);
|
||||||
|
|
||||||
options.address = this.linkItems({
|
options.address = this.linkItems({
|
||||||
'Addresses': options.address,
|
'Addresses': options.address,
|
||||||
@@ -65,12 +66,21 @@ class KeyringOption implements KeyringOptionInstance {
|
|||||||
'Accounts': options.account,
|
'Accounts': options.account,
|
||||||
'Development': options.testing
|
'Development': options.testing
|
||||||
});
|
});
|
||||||
|
options.contract = this.linkItems({
|
||||||
|
'Contracts': options.contract
|
||||||
|
});
|
||||||
|
|
||||||
options.all = ([] as KeyringSectionOptions).concat(
|
options.all = ([] as KeyringSectionOptions).concat(
|
||||||
options.account,
|
options.account,
|
||||||
options.address
|
options.address
|
||||||
);
|
);
|
||||||
|
|
||||||
|
options.allPlus = ([] as KeyringSectionOptions).concat(
|
||||||
|
options.account,
|
||||||
|
options.address,
|
||||||
|
options.contract
|
||||||
|
);
|
||||||
|
|
||||||
this.optionsSubject.next(options);
|
this.optionsSubject.next(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -129,11 +139,24 @@ class KeyringOption implements KeyringOptionInstance {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private addContracts (keyring: KeyringStruct, options: KeyringOptions): void {
|
||||||
|
const available = keyring.contracts.subject.getValue();
|
||||||
|
|
||||||
|
Object
|
||||||
|
.values(available)
|
||||||
|
.sort(sortByName)
|
||||||
|
.forEach(({ option }: SingleAddress) => {
|
||||||
|
options.contract.push(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private emptyOptions (): KeyringOptions {
|
private emptyOptions (): KeyringOptions {
|
||||||
return {
|
return {
|
||||||
account: [],
|
account: [],
|
||||||
address: [],
|
address: [],
|
||||||
|
contract: [],
|
||||||
all: [],
|
all: [],
|
||||||
|
allPlus: [],
|
||||||
recent: [],
|
recent: [],
|
||||||
testing: []
|
testing: []
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ export type KeyringOptions = {
|
|||||||
account: KeyringSectionOptions,
|
account: KeyringSectionOptions,
|
||||||
address: KeyringSectionOptions,
|
address: KeyringSectionOptions,
|
||||||
all: KeyringSectionOptions,
|
all: KeyringSectionOptions,
|
||||||
|
allPlus: KeyringSectionOptions,
|
||||||
|
contract: KeyringSectionOptions,
|
||||||
recent: KeyringSectionOptions,
|
recent: KeyringSectionOptions,
|
||||||
testing: KeyringSectionOptions
|
testing: KeyringSectionOptions
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,10 +2,16 @@
|
|||||||
// This software may be modified and distributed under the terms
|
// This software may be modified and distributed under the terms
|
||||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||||
|
|
||||||
|
import { Hash } from '@polkadot/types';
|
||||||
import { KeyringInstance as BaseKeyringInstance, KeyringPair, KeyringPair$Meta, KeyringPair$Json, KeyringOptions as KeyringOptionsBase } from '@polkadot/keyring/types';
|
import { KeyringInstance as BaseKeyringInstance, KeyringPair, KeyringPair$Meta, KeyringPair$Json, KeyringOptions as KeyringOptionsBase } from '@polkadot/keyring/types';
|
||||||
import { KeypairType } from '@polkadot/util-crypto/types';
|
import { KeypairType } from '@polkadot/util-crypto/types';
|
||||||
import { AddressSubject, SingleAddress } from './observable/types';
|
import { AddressSubject, SingleAddress } from './observable/types';
|
||||||
|
|
||||||
|
export type ContractMeta = {
|
||||||
|
abi: string,
|
||||||
|
genesisHash?: string
|
||||||
|
};
|
||||||
|
|
||||||
export interface KeyringStore {
|
export interface KeyringStore {
|
||||||
all: (cb: (key: string, value: any) => void) => void;
|
all: (cb: (key: string, value: any) => void) => void;
|
||||||
get: (key: string, cb: (value: any) => void) => void;
|
get: (key: string, cb: (value: any) => void) => void;
|
||||||
@@ -14,11 +20,14 @@ export interface KeyringStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type KeyringOptions = KeyringOptionsBase & {
|
export type KeyringOptions = KeyringOptionsBase & {
|
||||||
|
filter?: (json: KeyringJson) => boolean,
|
||||||
|
genesisHash?: Hash,
|
||||||
isDevelopment?: boolean,
|
isDevelopment?: boolean,
|
||||||
store?: KeyringStore
|
store?: KeyringStore
|
||||||
};
|
};
|
||||||
|
|
||||||
export type KeyringJson$Meta = {
|
export type KeyringJson$Meta = {
|
||||||
|
contract?: ContractMeta,
|
||||||
isInjected?: boolean,
|
isInjected?: boolean,
|
||||||
isRecent?: boolean,
|
isRecent?: boolean,
|
||||||
isTesting?: boolean,
|
isTesting?: boolean,
|
||||||
@@ -49,7 +58,9 @@ export type CreateResult = {
|
|||||||
export interface KeyringStruct {
|
export interface KeyringStruct {
|
||||||
readonly accounts: AddressSubject;
|
readonly accounts: AddressSubject;
|
||||||
readonly addresses: AddressSubject;
|
readonly addresses: AddressSubject;
|
||||||
|
readonly contracts: AddressSubject;
|
||||||
readonly keyring: BaseKeyringInstance | undefined;
|
readonly keyring: BaseKeyringInstance | undefined;
|
||||||
|
readonly genesisHash?: string;
|
||||||
|
|
||||||
addExternal: (publicKey: Uint8Array, meta?: KeyringPair$Meta) => CreateResult;
|
addExternal: (publicKey: Uint8Array, meta?: KeyringPair$Meta) => CreateResult;
|
||||||
addPair: (pair: KeyringPair, password: string) => CreateResult;
|
addPair: (pair: KeyringPair, password: string) => CreateResult;
|
||||||
@@ -64,10 +75,13 @@ export interface KeyringStruct {
|
|||||||
encryptAccount: (pair: KeyringPair, password: string) => void;
|
encryptAccount: (pair: KeyringPair, password: string) => void;
|
||||||
forgetAccount: (address: string) => void;
|
forgetAccount: (address: string) => void;
|
||||||
forgetAddress: (address: string) => void;
|
forgetAddress: (address: string) => void;
|
||||||
|
forgetContract: (address: string) => void;
|
||||||
getAccount: (address: string | Uint8Array) => KeyringAddress;
|
getAccount: (address: string | Uint8Array) => KeyringAddress;
|
||||||
getAccounts: () => Array<KeyringAddress>;
|
getAccounts: () => Array<KeyringAddress>;
|
||||||
getAddress: (address: string | Uint8Array) => KeyringAddress;
|
getAddress: (address: string | Uint8Array) => KeyringAddress;
|
||||||
getAddresses: () => Array<KeyringAddress>;
|
getAddresses: () => Array<KeyringAddress>;
|
||||||
|
getContract: (address: string | Uint8Array) => KeyringAddress;
|
||||||
|
getContracts: (genesisHash?: string) => Array<KeyringAddress>;
|
||||||
getPair: (address: string | Uint8Array) => KeyringPair;
|
getPair: (address: string | Uint8Array) => KeyringPair;
|
||||||
getPairs: () => Array<KeyringPair>;
|
getPairs: () => Array<KeyringPair>;
|
||||||
isAvailable: (address: string | Uint8Array) => boolean;
|
isAvailable: (address: string | Uint8Array) => boolean;
|
||||||
@@ -77,6 +91,7 @@ export interface KeyringStruct {
|
|||||||
saveAccount: (pair: KeyringPair, password?: string) => KeyringPair$Json;
|
saveAccount: (pair: KeyringPair, password?: string) => KeyringPair$Json;
|
||||||
saveAccountMeta: (pair: KeyringPair, meta: KeyringPair$Meta) => void;
|
saveAccountMeta: (pair: KeyringPair, meta: KeyringPair$Meta) => void;
|
||||||
saveAddress: (address: string, meta: KeyringPair$Meta) => KeyringPair$Json;
|
saveAddress: (address: string, meta: KeyringPair$Meta) => KeyringPair$Json;
|
||||||
|
saveContract: (address: string, meta: KeyringPair$Meta) => KeyringPair$Json;
|
||||||
saveRecent: (address: string) => SingleAddress;
|
saveRecent: (address: string) => SingleAddress;
|
||||||
setDevMode: (isDevelopment: boolean) => void;
|
setDevMode: (isDevelopment: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user