mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-14 09:01:03 +00:00
Adjust object index typings (#765)
* Adjust object index typings * CHANGELOG * Bump common
This commit is contained in:
@@ -21,11 +21,11 @@
|
||||
"version": "3.4.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/keyring": "^12.2.2",
|
||||
"@polkadot/keyring": "^12.3.1",
|
||||
"@polkadot/ui-settings": "3.4.2",
|
||||
"@polkadot/ui-shared": "3.4.2",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/util": "^12.3.1",
|
||||
"@polkadot/util-crypto": "^12.3.1",
|
||||
"ethereum-blockies-base64": "^1.0.2",
|
||||
"jdenticon": "3.2.0",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/ui-settings": "3.4.2",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/util": "^12.3.1",
|
||||
"@polkadot/util-crypto": "^12.3.1",
|
||||
"qrcode-generator": "^1.4.4",
|
||||
"react-qr-reader": "^2.2.1",
|
||||
"styled-components": "^5.3.11",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2023 @polkadot/react-qr authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import React, { useCallback } from 'react';
|
||||
|
||||
import { decodeAddress } from '@polkadot/util-crypto';
|
||||
@@ -11,7 +13,7 @@ import { QrScan } from './Scan.js';
|
||||
interface ScanType {
|
||||
isAddress: boolean;
|
||||
content: string;
|
||||
genesisHash: string;
|
||||
genesisHash: HexString | null;
|
||||
name?: string | undefined;
|
||||
}
|
||||
|
||||
@@ -29,13 +31,16 @@ function ScanAddress ({ className, isEthereum, onError, onScan, size, style }: P
|
||||
(data: string | null): void => {
|
||||
if (data) {
|
||||
try {
|
||||
let prefix: string, content: string, genesisHash: string, name: string[];
|
||||
let prefix: string;
|
||||
let content: string;
|
||||
let genesisHash: string | null;
|
||||
let name: string[];
|
||||
|
||||
if (!isEthereum) {
|
||||
[prefix, content, genesisHash, ...name] = data.split(':');
|
||||
} else {
|
||||
[prefix, content, ...name] = data.split(':');
|
||||
genesisHash = '';
|
||||
genesisHash = null;
|
||||
content = content.substring(0, 42);
|
||||
}
|
||||
|
||||
@@ -52,7 +57,7 @@ function ScanAddress ({ className, isEthereum, onError, onScan, size, style }: P
|
||||
decodeAddress(content);
|
||||
}
|
||||
|
||||
onScan({ content, genesisHash, isAddress, name: name?.length ? name.join(':') : undefined });
|
||||
onScan({ content, genesisHash: genesisHash as HexString, isAddress, name: name?.length ? name.join(':') : undefined });
|
||||
} catch (error) {
|
||||
onError && onError(error as Error);
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/ui-shared": "3.4.2",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/util": "^12.3.1",
|
||||
"@polkadot/util-crypto": "^12.3.1",
|
||||
"react-native-svg": "^12.5.1",
|
||||
"tslib": "^2.5.3"
|
||||
},
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
"version": "3.4.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/keyring": "^12.2.2",
|
||||
"@polkadot/keyring": "^12.3.1",
|
||||
"@polkadot/ui-settings": "3.4.2",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/util": "^12.3.1",
|
||||
"@polkadot/util-crypto": "^12.3.1",
|
||||
"mkdirp": "^3.0.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"store": "^2.0.12",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { KeyringInstance, KeyringPair } from '@polkadot/keyring/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
import type { AddressSubject } from './observable/types.js';
|
||||
import type { KeyringOptions, KeyringStore } from './types.js';
|
||||
@@ -28,9 +29,9 @@ export class Base {
|
||||
|
||||
protected _store: KeyringStore;
|
||||
|
||||
protected _genesisHash?: string | undefined;
|
||||
protected _genesisHash?: HexString | undefined;
|
||||
|
||||
protected _genesisHashAdd: string[] = [];
|
||||
protected _genesisHashAdd: HexString[] = [];
|
||||
|
||||
constructor () {
|
||||
this.#accounts = accounts;
|
||||
@@ -64,11 +65,11 @@ export class Base {
|
||||
throw new Error('Keyring should be initialised via \'loadAll\' before use');
|
||||
}
|
||||
|
||||
public get genesisHash (): string | undefined {
|
||||
public get genesisHash (): HexString | undefined {
|
||||
return this._genesisHash;
|
||||
}
|
||||
|
||||
public get genesisHashes (): string[] {
|
||||
public get genesisHashes (): HexString[] {
|
||||
return this._genesisHash
|
||||
? [this._genesisHash, ...this._genesisHashAdd]
|
||||
: [...this._genesisHashAdd];
|
||||
@@ -130,7 +131,7 @@ export class Base {
|
||||
this.#keyring = keyring;
|
||||
this._genesisHash = options.genesisHash && (
|
||||
isString(options.genesisHash)
|
||||
? options.genesisHash.toString()
|
||||
? options.genesisHash.toString() as HexString
|
||||
: options.genesisHash.toHex()
|
||||
);
|
||||
this._genesisHashAdd = options.genesisHashAdd || [];
|
||||
|
||||
@@ -2,29 +2,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { KeyringInstance as BaseKeyringInstance, KeyringOptions as KeyringOptionsBase, KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '@polkadot/keyring/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { EncryptedJson } from '@polkadot/util-crypto/json/types';
|
||||
import type { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import type { AddressSubject, SingleAddress } from './observable/types.js';
|
||||
|
||||
export interface ContractMeta {
|
||||
abi: string;
|
||||
genesisHash?: string | null;
|
||||
}
|
||||
export type ContractMeta = NonNullable<KeyringPair$Meta['contract']>;
|
||||
|
||||
export interface KeyringJson$Meta {
|
||||
contract?: ContractMeta;
|
||||
genesisHash?: string | null | undefined;
|
||||
hardwareType?: 'ledger';
|
||||
isHardware?: boolean;
|
||||
isInjected?: boolean;
|
||||
isRecent?: boolean;
|
||||
isTesting?: boolean;
|
||||
name?: string;
|
||||
whenCreated?: number;
|
||||
whenEdited?: number;
|
||||
whenUsed?: number;
|
||||
[index: string]: unknown;
|
||||
}
|
||||
export type KeyringJson$Meta = KeyringPair$Meta;
|
||||
|
||||
export interface KeyringJson {
|
||||
address: string;
|
||||
@@ -44,8 +29,8 @@ export interface KeyringStore {
|
||||
|
||||
export interface KeyringOptions extends KeyringOptionsBase {
|
||||
filter?: (json: KeyringJson) => boolean;
|
||||
genesisHash?: string | { toHex: () => string };
|
||||
genesisHashAdd?: string[];
|
||||
genesisHash?: HexString | { toHex: () => HexString };
|
||||
genesisHashAdd?: HexString[];
|
||||
isDevelopment?: boolean;
|
||||
store?: KeyringStore;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
"version": "3.4.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/networks": "^12.2.2",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/networks": "^12.3.1",
|
||||
"@polkadot/util": "^12.3.1",
|
||||
"eventemitter3": "^5.0.1",
|
||||
"store": "^2.0.12",
|
||||
"tslib": "^2.5.3"
|
||||
|
||||
@@ -57,7 +57,7 @@ export class Settings implements SettingsStruct {
|
||||
this.#emitter = new EventEmitter();
|
||||
|
||||
// will become deprecated for supporting substrate connect light clients. apiType structure should be used instead
|
||||
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || (hasProcess && process.env && process.env.WS_URL) || (ENDPOINT_DEFAULT.value as string);
|
||||
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || (hasProcess && process.env && process.env['WS_URL']) || (ENDPOINT_DEFAULT.value as string);
|
||||
this.#apiType = { param: this.#apiUrl, type: 'json-rpc' as EndpointType };
|
||||
this.#camera = withDefault(CAMERA, settings.camera, CAMERA_DEFAULT);
|
||||
this.#ledgerConn = withDefault(LEDGER_CONN, settings.ledgerConn, LEDGER_CONN_DEFAULT);
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
"tslib": "^2.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/util": "^12.3.1",
|
||||
"@polkadot/util-crypto": "^12.3.1",
|
||||
"@types/xmlserializer": "^0.6.3",
|
||||
"xmlserializer": "^0.6.1"
|
||||
},
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/ui-shared": "3.4.2",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/util": "^12.3.1",
|
||||
"@polkadot/util-crypto": "^12.3.1",
|
||||
"jdenticon": "3.2.0",
|
||||
"tslib": "^2.5.3"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user