mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-15 09:31:02 +00:00
Bump deps (#769)
This commit is contained in:
@@ -152,8 +152,14 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
|
||||
return Object
|
||||
.keys(available)
|
||||
.map((address): KeyringAddress => this.getAddress(address, 'account') as KeyringAddress)
|
||||
.filter((account) => env.isDevelopment() || account.meta.isTesting !== true);
|
||||
.map((address) => this.getAddress(address, 'account'))
|
||||
.filter((account): account is KeyringAddress =>
|
||||
!!account &&
|
||||
(
|
||||
env.isDevelopment() ||
|
||||
account.meta.isTesting !== true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public getAddress (_address: string | Uint8Array, type: KeyringItemType | null = null): KeyringAddress | undefined {
|
||||
@@ -180,7 +186,8 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
|
||||
return Object
|
||||
.keys(available)
|
||||
.map((address): KeyringAddress => this.getAddress(address) as KeyringAddress);
|
||||
.map((address) => this.getAddress(address))
|
||||
.filter((account): account is KeyringAddress => !!account);
|
||||
}
|
||||
|
||||
public getContract (address: string | Uint8Array): KeyringAddress | undefined {
|
||||
@@ -195,11 +202,12 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
.filter(([, { json: { meta: { contract } } }]): boolean =>
|
||||
!!contract && contract.genesisHash === this.genesisHash
|
||||
)
|
||||
.map(([address]) => this.getContract(address) as KeyringAddress);
|
||||
.map(([address]) => this.getContract(address))
|
||||
.filter((account): account is KeyringAddress => !!account);
|
||||
}
|
||||
|
||||
private rewriteKey (json: KeyringJson, key: string, hexAddr: string, creator: (addr: string) => string): void {
|
||||
if (hexAddr.substring(0, 2) === '0x') {
|
||||
if (hexAddr.startsWith('0x')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -252,7 +260,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
const [, hexAddr] = key.split(':');
|
||||
|
||||
// move genesisHash to top-level (TODO Remove from contracts section?)
|
||||
json.meta.genesisHash = json.meta.genesisHash || (json.meta.contract && json.meta.contract.genesisHash);
|
||||
json.meta.genesisHash = json.meta.genesisHash || (json.meta.contract?.genesisHash);
|
||||
|
||||
this.contracts.add(this._store, address, json);
|
||||
this.rewriteKey(json, key, hexAddr, contractKey);
|
||||
@@ -269,7 +277,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
}
|
||||
|
||||
private allowGenesis (json?: KeyringJson | { meta: KeyringJson$Meta } | null): boolean {
|
||||
if (json && json.meta && this.genesisHash) {
|
||||
if (json?.meta && this.genesisHash) {
|
||||
const hashes: (string | null | undefined)[] = Object.values(chains).find((hashes): boolean =>
|
||||
hashes.includes(this.genesisHash || '')
|
||||
) || [this.genesisHash];
|
||||
@@ -370,7 +378,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
public saveAddress (address: string, meta: KeyringPair$Meta, type: KeyringAddressType = 'address'): KeyringPair$Json {
|
||||
const available = this.addresses.subject.getValue();
|
||||
|
||||
const json = (available[address] && available[address].json) || {
|
||||
const json = available[address]?.json || {
|
||||
address,
|
||||
meta: {
|
||||
isRecent: undefined,
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2023 @polkadot/util authors & contributors
|
||||
// Copyright 2017-2023 @polkadot/ui-keyring authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Be able to import json in TS
|
||||
|
||||
@@ -12,9 +12,7 @@ export interface SingleAddress {
|
||||
type?: KeypairType | undefined;
|
||||
}
|
||||
|
||||
export interface SubjectInfo {
|
||||
[index: string]: SingleAddress;
|
||||
}
|
||||
export type SubjectInfo = Record<string, SingleAddress>;
|
||||
|
||||
export interface AddressSubject {
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson, type?: KeypairType) => SingleAddress;
|
||||
|
||||
@@ -37,7 +37,7 @@ const sortByCreated = (a: SingleAddress, b: SingleAddress): number => {
|
||||
export class KeyringOption implements KeyringOptionInstance {
|
||||
#allSub: Subscription | null = null;
|
||||
|
||||
public readonly optionsSubject: BehaviorSubject<KeyringOptions> = new BehaviorSubject(this.emptyOptions());
|
||||
public readonly optionsSubject = new BehaviorSubject<KeyringOptions>(this.emptyOptions());
|
||||
|
||||
public createOptionHeader (name: string): KeyringSectionOption {
|
||||
return {
|
||||
@@ -77,7 +77,7 @@ export class KeyringOption implements KeyringOptionInstance {
|
||||
}
|
||||
}
|
||||
|
||||
private linkItems (items: { [index: string]: KeyringSectionOptions }): KeyringSectionOptions {
|
||||
private linkItems (items: Record<string, KeyringSectionOptions>): KeyringSectionOptions {
|
||||
return Object.keys(items).reduce((result, header): KeyringSectionOptions => {
|
||||
const options = items[header];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user