Adjust object index typings (#1265)
* Adjust object index typings * CHANGELOG * Bump common * Bumpo ui * 0.46.5 * Bump util
This commit is contained in:
parent
50b61b2b22
commit
727f14f2c3
11
CHANGELOG.md
11
CHANGELOG.md
@ -1,5 +1,16 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 0.46.5 Jun 12, 2023
|
||||
|
||||
- **Important** Not published to the stores, aligns with latest released packages.
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjust object index access for stricter tsconfig settings
|
||||
- Upgrade to `@polkadot/api` 10.9.1
|
||||
- Bump to `@polkadot/util` 12.3.2
|
||||
|
||||
|
||||
## 0.46.4 Jun 5, 2023
|
||||
|
||||
- **Important** Not published to the stores, aligns with latest released packages.
|
||||
|
||||
18
package.json
18
package.json
@ -14,7 +14,7 @@
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"version": "0.46.4",
|
||||
"version": "0.46.5",
|
||||
"versions": {
|
||||
"git": "0.46.4",
|
||||
"npm": "0.46.4"
|
||||
@ -40,19 +40,19 @@
|
||||
"watch": "cd packages/extension && yarn polkadot-exec-webpack --config webpack.watch.cjs --mode development --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/dev": "^0.75.16",
|
||||
"@polkadot/dev": "^0.75.19",
|
||||
"@types/node": "^20.2.5",
|
||||
"i18next-scanner": "^4.2.0",
|
||||
"sinon-chrome": "^3.0.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^10.8.1",
|
||||
"@polkadot/keyring": "^12.2.2",
|
||||
"@polkadot/networks": "^12.2.2",
|
||||
"@polkadot/types": "^10.8.1",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/x-fetch": "^12.2.2",
|
||||
"@polkadot/api": "^10.9.1",
|
||||
"@polkadot/keyring": "^12.3.2",
|
||||
"@polkadot/networks": "^12.3.2",
|
||||
"@polkadot/types": "^10.9.1",
|
||||
"@polkadot/util": "^12.3.2",
|
||||
"@polkadot/util-crypto": "^12.3.2",
|
||||
"@polkadot/x-fetch": "^12.3.2",
|
||||
"safe-buffer": "^5.2.1",
|
||||
"typescript": "^5.0.3"
|
||||
}
|
||||
|
||||
@ -18,27 +18,27 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "0.46.4",
|
||||
"version": "0.46.5",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^10.8.1",
|
||||
"@polkadot/extension-chains": "0.46.4",
|
||||
"@polkadot/extension-dapp": "0.46.4",
|
||||
"@polkadot/extension-inject": "0.46.4",
|
||||
"@polkadot/keyring": "^12.2.2",
|
||||
"@polkadot/networks": "^12.2.2",
|
||||
"@polkadot/phishing": "^0.21.4",
|
||||
"@polkadot/rpc-provider": "^10.8.1",
|
||||
"@polkadot/types": "^10.8.1",
|
||||
"@polkadot/ui-keyring": "^3.4.2",
|
||||
"@polkadot/ui-settings": "^3.4.2",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/api": "^10.9.1",
|
||||
"@polkadot/extension-chains": "0.46.5",
|
||||
"@polkadot/extension-dapp": "0.46.5",
|
||||
"@polkadot/extension-inject": "0.46.5",
|
||||
"@polkadot/keyring": "^12.3.2",
|
||||
"@polkadot/networks": "^12.3.2",
|
||||
"@polkadot/phishing": "^0.21.5",
|
||||
"@polkadot/rpc-provider": "^10.9.1",
|
||||
"@polkadot/types": "^10.9.1",
|
||||
"@polkadot/ui-keyring": "^3.5.1",
|
||||
"@polkadot/ui-settings": "^3.5.1",
|
||||
"@polkadot/util": "^12.3.2",
|
||||
"@polkadot/util-crypto": "^12.3.2",
|
||||
"eventemitter3": "^5.0.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"tslib": "^2.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/extension-mocks": "0.46.4"
|
||||
"@polkadot/extension-mocks": "0.46.5"
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,16 +41,6 @@ export type SeedLengths = 12 | 24;
|
||||
|
||||
export interface AccountJson extends KeyringPair$Meta {
|
||||
address: string;
|
||||
genesisHash?: string | null;
|
||||
isExternal?: boolean;
|
||||
isHardware?: boolean;
|
||||
isHidden?: boolean;
|
||||
isDefaultAuthSelected?: boolean
|
||||
name?: string;
|
||||
parentAddress?: string;
|
||||
suri?: string;
|
||||
type?: KeypairType;
|
||||
whenCreated?: number;
|
||||
}
|
||||
|
||||
export type AccountWithChildren = AccountJson & {
|
||||
@ -194,13 +184,13 @@ export type RequestMetadataSubscribe = null;
|
||||
|
||||
export interface RequestAccountCreateExternal {
|
||||
address: string;
|
||||
genesisHash?: string | null;
|
||||
genesisHash?: HexString | null;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface RequestAccountCreateSuri {
|
||||
name: string;
|
||||
genesisHash?: string | null;
|
||||
genesisHash?: HexString | null;
|
||||
password: string;
|
||||
suri: string;
|
||||
type?: KeypairType;
|
||||
@ -210,7 +200,7 @@ export interface RequestAccountCreateHardware {
|
||||
accountIndex: number;
|
||||
address: string;
|
||||
addressOffset: number;
|
||||
genesisHash: string;
|
||||
genesisHash: HexString;
|
||||
hardwareType: string;
|
||||
name: string;
|
||||
}
|
||||
@ -223,7 +213,7 @@ export interface RequestAccountChangePassword {
|
||||
|
||||
export interface RequestAccountEdit {
|
||||
address: string;
|
||||
genesisHash?: string | null;
|
||||
genesisHash?: HexString | null;
|
||||
name: string;
|
||||
}
|
||||
|
||||
@ -238,7 +228,7 @@ export interface RequestAccountShow {
|
||||
|
||||
export interface RequestAccountTie {
|
||||
address: string;
|
||||
genesisHash: string | null;
|
||||
genesisHash: HexString | null;
|
||||
}
|
||||
|
||||
export interface RequestAccountValidate {
|
||||
@ -248,7 +238,7 @@ export interface RequestAccountValidate {
|
||||
|
||||
export interface RequestDeriveCreate {
|
||||
name: string;
|
||||
genesisHash?: string | null;
|
||||
genesisHash?: HexString | null;
|
||||
suri: string;
|
||||
parentAddress: string;
|
||||
parentPassword: string;
|
||||
@ -429,7 +419,7 @@ export type AllowedPath = typeof ALLOWED_PATH[number];
|
||||
export interface ResponseJsonGetAccountInfo {
|
||||
address: string;
|
||||
name: string;
|
||||
genesisHash: string;
|
||||
genesisHash: HexString;
|
||||
type: KeypairType;
|
||||
}
|
||||
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// this _must_ be changed for each extension
|
||||
export const EXTENSION_PREFIX = process.env.EXTENSION_PREFIX || '';
|
||||
export const EXTENSION_PREFIX = process.env['EXTENSION_PREFIX'] || '';
|
||||
|
||||
if (!EXTENSION_PREFIX && !process.env.PORT_PREFIX) {
|
||||
if (!EXTENSION_PREFIX && !process.env['PORT_PREFIX']) {
|
||||
throw new Error('CRITICAL: The extension does not define an own EXTENSION_PREFIX environment variable as part of the build, this is required to ensure that messages are not shared between extensions. Failure to do so will yield messages sent to multiple extensions.');
|
||||
}
|
||||
|
||||
const PORT_PREFIX = `${EXTENSION_PREFIX || 'unknown'}-${process.env.PORT_PREFIX || 'unknown'}`;
|
||||
const PORT_PREFIX = `${EXTENSION_PREFIX || 'unknown'}-${process.env['PORT_PREFIX'] || 'unknown'}`;
|
||||
|
||||
export const PORT_CONTENT = `${PORT_PREFIX}-content`;
|
||||
export const PORT_EXTENSION = `${PORT_PREFIX}-extension`;
|
||||
|
||||
@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/extension-base', path: 'auto', type: 'auto', version: '0.46.4' };
|
||||
export const packageInfo = { name: '@polkadot/extension-base', path: 'auto', type: 'auto', version: '0.46.5' };
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "0.46.4",
|
||||
"version": "0.46.5",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/extension-inject": "0.46.4",
|
||||
"@polkadot/networks": "^12.2.2",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/extension-inject": "0.46.5",
|
||||
"@polkadot/networks": "^12.3.2",
|
||||
"@polkadot/util": "^12.3.2",
|
||||
"@polkadot/util-crypto": "^12.3.2",
|
||||
"tslib": "^2.5.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/extension-chains', path: 'auto', type: 'auto', version: '0.46.4' };
|
||||
export const packageInfo = { name: '@polkadot/extension-chains', path: 'auto', type: 'auto', version: '0.46.5' };
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "0.46.4",
|
||||
"version": "0.46.5",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@metamask/detect-provider": "^2.0.0",
|
||||
"@polkadot/extension-inject": "0.46.4",
|
||||
"@polkadot/types": "^10.8.1",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/extension-inject": "0.46.5",
|
||||
"@polkadot/types": "^10.9.1",
|
||||
"@polkadot/util": "^12.3.2",
|
||||
"tslib": "^2.5.3",
|
||||
"web3": "^1.10.0"
|
||||
},
|
||||
|
||||
@ -50,7 +50,7 @@ function transformAccounts (accounts: string[]): InjectedAccount[] {
|
||||
// add a compat interface of metaMaskSource to window.injectedWeb3
|
||||
function injectMetaMaskWeb3 (win: Web3Window): void {
|
||||
// decorate the compat interface
|
||||
win.injectedWeb3.Web3Source = {
|
||||
win.injectedWeb3['Web3Source'] = {
|
||||
enable: async (): Promise<Injected> => {
|
||||
const providerRaw = await detectEthereumProvider({ mustBeMetaMask: true });
|
||||
const provider = isMetaMaskProvider(providerRaw);
|
||||
|
||||
@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/extension-compat-metamask', path: 'auto', type: 'auto', version: '0.46.4' };
|
||||
export const packageInfo = { name: '@polkadot/extension-compat-metamask', path: 'auto', type: 'auto', version: '0.46.5' };
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "0.46.4",
|
||||
"version": "0.46.5",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/extension-inject": "0.46.4",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/extension-inject": "0.46.5",
|
||||
"@polkadot/util": "^12.3.2",
|
||||
"@polkadot/util-crypto": "^12.3.2",
|
||||
"tslib": "^2.5.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/extension-dapp', path: 'auto', type: 'auto', version: '0.46.4' };
|
||||
export const packageInfo = { name: '@polkadot/extension-dapp', path: 'auto', type: 'auto', version: '0.46.5' };
|
||||
|
||||
@ -15,15 +15,15 @@
|
||||
},
|
||||
"sideEffects": true,
|
||||
"type": "module",
|
||||
"version": "0.46.4",
|
||||
"version": "0.46.5",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^10.8.1",
|
||||
"@polkadot/rpc-provider": "^10.8.1",
|
||||
"@polkadot/types": "^10.8.1",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/x-global": "^12.2.2",
|
||||
"@polkadot/api": "^10.9.1",
|
||||
"@polkadot/rpc-provider": "^10.9.1",
|
||||
"@polkadot/types": "^10.9.1",
|
||||
"@polkadot/util": "^12.3.2",
|
||||
"@polkadot/util-crypto": "^12.3.2",
|
||||
"@polkadot/x-global": "^12.3.2",
|
||||
"tslib": "^2.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/extension-inject', path: 'auto', type: 'auto', version: '0.46.4' };
|
||||
export const packageInfo = { name: '@polkadot/extension-inject', path: 'auto', type: 'auto', version: '0.46.5' };
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
import type { Signer as InjectedSigner } from '@polkadot/api/types';
|
||||
import type { ProviderInterface } from '@polkadot/rpc-provider/types';
|
||||
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { KeypairType } from '@polkadot/util-crypto/types';
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
@ -52,7 +53,7 @@ export interface ProviderMeta {
|
||||
|
||||
export interface MetadataDefBase {
|
||||
chain: string;
|
||||
genesisHash: string;
|
||||
genesisHash: HexString;
|
||||
icon: string;
|
||||
ss58Format: number;
|
||||
chainType?: 'substrate' | 'ethereum'
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"version": "0.46.4",
|
||||
"version": "0.46.5",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"sinon-chrome": "^3.0.1",
|
||||
|
||||
@ -15,31 +15,31 @@
|
||||
},
|
||||
"sideEffects": true,
|
||||
"type": "module",
|
||||
"version": "0.46.4",
|
||||
"version": "0.46.5",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.4.0",
|
||||
"@fortawesome/free-regular-svg-icons": "^6.4.0",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@polkadot/api": "^10.8.1",
|
||||
"@polkadot/extension-base": "0.46.4",
|
||||
"@polkadot/extension-chains": "0.46.4",
|
||||
"@polkadot/extension-dapp": "0.46.4",
|
||||
"@polkadot/extension-inject": "0.46.4",
|
||||
"@polkadot/hw-ledger": "^12.2.2",
|
||||
"@polkadot/keyring": "^12.2.2",
|
||||
"@polkadot/networks": "^12.2.2",
|
||||
"@polkadot/react-identicon": "^3.4.2",
|
||||
"@polkadot/react-qr": "^3.4.2",
|
||||
"@polkadot/types": "^10.8.1",
|
||||
"@polkadot/types-augment": "^10.8.1",
|
||||
"@polkadot/ui-keyring": "^3.4.2",
|
||||
"@polkadot/ui-settings": "^3.4.2",
|
||||
"@polkadot/util": "^12.2.2",
|
||||
"@polkadot/util-crypto": "^12.2.2",
|
||||
"@polkadot/api": "^10.9.1",
|
||||
"@polkadot/extension-base": "0.46.5",
|
||||
"@polkadot/extension-chains": "0.46.5",
|
||||
"@polkadot/extension-dapp": "0.46.5",
|
||||
"@polkadot/extension-inject": "0.46.5",
|
||||
"@polkadot/hw-ledger": "^12.3.2",
|
||||
"@polkadot/keyring": "^12.3.2",
|
||||
"@polkadot/networks": "^12.3.2",
|
||||
"@polkadot/react-identicon": "^3.5.1",
|
||||
"@polkadot/react-qr": "^3.5.1",
|
||||
"@polkadot/types": "^10.9.1",
|
||||
"@polkadot/types-augment": "^10.9.1",
|
||||
"@polkadot/ui-keyring": "^3.5.1",
|
||||
"@polkadot/ui-settings": "^3.5.1",
|
||||
"@polkadot/util": "^12.3.2",
|
||||
"@polkadot/util-crypto": "^12.3.2",
|
||||
"file-saver": "^2.0.5",
|
||||
"i18next": "^22.5.0",
|
||||
"i18next": "^22.5.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-dropzone": "^11.7.1",
|
||||
@ -51,7 +51,7 @@
|
||||
"tslib": "^2.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/extension-mocks": "0.46.4",
|
||||
"@polkadot/extension-mocks": "0.46.5",
|
||||
"@types/enzyme": "^3.10.13",
|
||||
"@types/enzyme-adapter-react-16": "^1.0.6",
|
||||
"@types/file-saver": "^2.0.5",
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AccountJson } from '@polkadot/extension-base/background/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { ThemeProps } from '../../types.js';
|
||||
|
||||
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
@ -50,7 +51,7 @@ function Account ({ address, className, genesisHash, isExternal, isHardware, isH
|
||||
}, [address, selectedAccounts, setSelectedAccounts]);
|
||||
|
||||
const _onChangeGenesis = useCallback(
|
||||
(genesisHash?: string | null): void => {
|
||||
(genesisHash?: HexString | null): void => {
|
||||
tieAccount(address, genesisHash || null)
|
||||
.catch(console.error);
|
||||
},
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
||||
|
||||
import AccountNamePasswordCreation from '../../components/AccountNamePasswordCreation.js';
|
||||
@ -28,7 +30,7 @@ function CreateAccount ({ className }: Props): React.ReactElement {
|
||||
const [type, setType] = useState(DEFAULT_TYPE);
|
||||
const [name, setName] = useState('');
|
||||
const options = useGenesisHashOptions();
|
||||
const [genesisHash, setGenesis] = useState('');
|
||||
const [genesisHash, setGenesis] = useState<HexString | null>(null);
|
||||
const chain = useMetadata(genesisHash, true);
|
||||
|
||||
useEffect((): void => {
|
||||
@ -82,7 +84,7 @@ function CreateAccount ({ className }: Props): React.ReactElement {
|
||||
);
|
||||
|
||||
const _onChangeNetwork = useCallback(
|
||||
(newGenesisHash: string) => setGenesis(newGenesisHash),
|
||||
(newGenesisHash: HexString) => setGenesis(newGenesisHash),
|
||||
[]
|
||||
);
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { ThemeProps } from '../types.js';
|
||||
|
||||
import { faSync } from '@fortawesome/free-solid-svg-icons';
|
||||
@ -39,7 +40,7 @@ function ImportLedger ({ className }: Props): React.ReactElement {
|
||||
const [addressOffset, setAddressOffset] = useState<number>(0);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [isBusy, setIsBusy] = useState(false);
|
||||
const [genesis, setGenesis] = useState<string | null>(null);
|
||||
const [genesis, setGenesis] = useState<HexString | null>(null);
|
||||
const onAction = useContext(ActionContext);
|
||||
const [name, setName] = useState<string | null>(null);
|
||||
const { address, error: ledgerError, isLoading: ledgerLoading, isLocked: ledgerLocked, refresh, warning: ledgerWarning } = useLedger(genesis, accountIndex, addressOffset);
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import React, { useCallback, useContext, useState } from 'react';
|
||||
|
||||
import { QrScanAddress } from '@polkadot/react-qr';
|
||||
@ -13,7 +15,7 @@ import { Header, Name } from '../partials/index.js';
|
||||
|
||||
interface QrAccount {
|
||||
content: string;
|
||||
genesisHash: string;
|
||||
genesisHash: HexString | null;
|
||||
isAddress: boolean;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
||||
|
||||
import AccountNamePasswordCreation from '../../components/AccountNamePasswordCreation.js';
|
||||
@ -14,7 +16,7 @@ import SeedAndPath from './SeedAndPath.js';
|
||||
|
||||
export interface AccountInfo {
|
||||
address: string;
|
||||
genesis?: string;
|
||||
genesis?: HexString;
|
||||
suri: string;
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import '@polkadot/extension-mocks/chrome';
|
||||
import type { ReactWrapper } from 'enzyme';
|
||||
import type { AccountJson } from '@polkadot/extension-base/background/types';
|
||||
import type { IconTheme } from '@polkadot/react-identicon/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Props as AddressComponentProps } from './Address.js';
|
||||
|
||||
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
||||
@ -48,7 +49,7 @@ interface AccountTestJson extends AccountJson {
|
||||
interface AccountTestGenesisJson extends AccountTestJson {
|
||||
expectedEncodedAddress: string;
|
||||
expectedNetworkLabel: string;
|
||||
genesisHash: string;
|
||||
genesisHash: HexString;
|
||||
}
|
||||
|
||||
const externalAccount = { address: '5EeaoDj4VDk8V6yQngKBaCD5MpJUCHrhYjVhBjgMHXoYon1s', expectedIconTheme: 'polkadot', isExternal: true, name: 'External Account', type: 'sr25519' } as AccountJson;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import { getAllMetadata } from '../messaging.js';
|
||||
@ -9,7 +11,7 @@ import useTranslation from './useTranslation.js';
|
||||
|
||||
interface Option {
|
||||
text: string;
|
||||
value: string;
|
||||
value: HexString;
|
||||
}
|
||||
|
||||
const RELAY_CHAIN = 'Relay Chain';
|
||||
@ -29,7 +31,7 @@ export default function (): Option[] {
|
||||
const hashes = useMemo(() => [
|
||||
{
|
||||
text: t<string>('Allow use on any chain'),
|
||||
value: ''
|
||||
value: '' as HexString
|
||||
},
|
||||
// put the relay chains at the top
|
||||
...chains.filter(({ chain }) => chain.includes(RELAY_CHAIN))
|
||||
@ -45,12 +47,12 @@ export default function (): Option[] {
|
||||
.filter(({ text }) => !text.includes(RELAY_CHAIN))
|
||||
.concat(
|
||||
// get any chain present in the metadata and not already part of chains
|
||||
...metadataChains.filter(
|
||||
({ value }) => {
|
||||
return !chains.find(
|
||||
({ genesisHash }) => genesisHash === value);
|
||||
}
|
||||
))
|
||||
...metadataChains.filter(({ value }) =>
|
||||
!chains.find(({ genesisHash }) =>
|
||||
genesisHash === value
|
||||
)
|
||||
)
|
||||
)
|
||||
.sort((a, b) => a.text.localeCompare(b.text))
|
||||
], [metadataChains, t]);
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ export async function showAccount (address: string, isShowing: boolean): Promise
|
||||
return sendMessage('pri(accounts.show)', { address, isShowing });
|
||||
}
|
||||
|
||||
export async function tieAccount (address: string, genesisHash: string | null): Promise<boolean> {
|
||||
export async function tieAccount (address: string, genesisHash: HexString | null): Promise<boolean> {
|
||||
return sendMessage('pri(accounts.tie)', { address, genesisHash });
|
||||
}
|
||||
|
||||
@ -122,15 +122,15 @@ export async function approveSignSignature (id: string, signature: HexString): P
|
||||
return sendMessage('pri(signing.approve.signature)', { id, signature });
|
||||
}
|
||||
|
||||
export async function createAccountExternal (name: string, address: string, genesisHash: string): Promise<boolean> {
|
||||
export async function createAccountExternal (name: string, address: string, genesisHash: HexString | null): Promise<boolean> {
|
||||
return sendMessage('pri(accounts.create.external)', { address, genesisHash, name });
|
||||
}
|
||||
|
||||
export async function createAccountHardware (address: string, hardwareType: string, accountIndex: number, addressOffset: number, name: string, genesisHash: string): Promise<boolean> {
|
||||
export async function createAccountHardware (address: string, hardwareType: string, accountIndex: number, addressOffset: number, name: string, genesisHash: HexString): Promise<boolean> {
|
||||
return sendMessage('pri(accounts.create.hardware)', { accountIndex, address, addressOffset, genesisHash, hardwareType, name });
|
||||
}
|
||||
|
||||
export async function createAccountSuri (name: string, password: string, suri: string, type?: KeypairType, genesisHash?: string): Promise<boolean> {
|
||||
export async function createAccountSuri (name: string, password: string, suri: string, type?: KeypairType, genesisHash?: HexString | null): Promise<boolean> {
|
||||
return sendMessage('pri(accounts.create.suri)', { genesisHash, name, password, suri, type });
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ export async function validateDerivationPath (parentAddress: string, suri: strin
|
||||
return sendMessage('pri(derivation.validate)', { parentAddress, parentPassword, suri });
|
||||
}
|
||||
|
||||
export async function deriveAccount (parentAddress: string, suri: string, parentPassword: string, name: string, password: string, genesisHash: string | null): Promise<boolean> {
|
||||
export async function deriveAccount (parentAddress: string, suri: string, parentPassword: string, name: string, password: string, genesisHash: HexString | null): Promise<boolean> {
|
||||
return sendMessage('pri(derivation.create)', { genesisHash, name, parentAddress, parentPassword, password, suri });
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import { buildHierarchy } from './buildHierarchy.js';
|
||||
const genesisExample = {
|
||||
KUSAMA: '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe',
|
||||
POLKADOT: '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3'
|
||||
};
|
||||
} as const;
|
||||
|
||||
const testHierarchy = (accounts: AccountJson[], expected: AccountWithChildren[]): void => {
|
||||
expect(buildHierarchy(accounts)).toEqual(expected);
|
||||
|
||||
@ -15,16 +15,16 @@
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"version": "0.46.4",
|
||||
"version": "0.46.5",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^10.8.1",
|
||||
"@polkadot/extension-base": "0.46.4",
|
||||
"@polkadot/extension-inject": "0.46.4",
|
||||
"@polkadot/extension-ui": "0.46.4",
|
||||
"@polkadot/api": "^10.9.1",
|
||||
"@polkadot/extension-base": "0.46.5",
|
||||
"@polkadot/extension-inject": "0.46.5",
|
||||
"@polkadot/extension-ui": "0.46.5",
|
||||
"tslib": "^2.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/dev": "^0.75.16",
|
||||
"@polkadot/dev": "^0.75.19",
|
||||
"browser-resolve": "^2.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
|
||||
@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/extension', path: 'auto', type: 'auto', version: '0.46.4' };
|
||||
export const packageInfo = { name: '@polkadot/extension', path: 'auto', type: 'auto', version: '0.46.5' };
|
||||
|
||||
Loading…
Reference in New Issue
Block a user