Bump de & api (w/ __Unused on enum) (#6326)
* Bump de & api (w/ __Unused on enum) * Linting fixes * tsc adjustments * Api bump
This commit is contained in:
parent
4f0225b701
commit
f512c1a539
13
package.json
13
package.json
@ -12,19 +12,20 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^6.3.2-17",
|
||||
"@polkadot/api-contract": "^6.3.2-17",
|
||||
"@polkadot/api": "^6.3.2-19",
|
||||
"@polkadot/api-contract": "^6.3.2-19",
|
||||
"@polkadot/hw-ledger": "^7.5.1",
|
||||
"@polkadot/keyring": "^7.5.1",
|
||||
"@polkadot/networks": "^7.5.1",
|
||||
"@polkadot/phishing": "^0.6.356",
|
||||
"@polkadot/types": "^6.3.2-17",
|
||||
"@polkadot/types-known": "^6.3.2-17",
|
||||
"@polkadot/types-support": "^6.3.2-17",
|
||||
"@polkadot/types": "^6.3.2-19",
|
||||
"@polkadot/types-known": "^6.3.2-19",
|
||||
"@polkadot/types-support": "^6.3.2-19",
|
||||
"@polkadot/util": "^7.5.1",
|
||||
"@polkadot/util-crypto": "^7.5.1",
|
||||
"@polkadot/wasm-crypto": "^4.2.1",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"eslint-plugin-react-hooks": "^4.2.1-alpha-930c9e7ee-20211015",
|
||||
"styled-components": "^5.3.1",
|
||||
"typescript": "^4.4.4"
|
||||
},
|
||||
@ -73,7 +74,7 @@
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@crustio/crust-pin": "^1.0.0",
|
||||
"@pinata/sdk": "^1.1.23",
|
||||
"@polkadot/dev": "^0.62.71",
|
||||
"@polkadot/dev": "^0.63.2",
|
||||
"@polkadot/ts": "^0.4.9",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"@types/chart.js": "^2.9.34",
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.15.8",
|
||||
"@babel/polyfill": "^7.12.1",
|
||||
"@polkadot/dev": "^0.62.71",
|
||||
"@polkadot/dev": "^0.63.2",
|
||||
"@polkadot/react-components": "^0.96.2-81",
|
||||
"electron-log": "^4.4.1",
|
||||
"electron-updater": "^4.6.1"
|
||||
|
||||
@ -7,7 +7,7 @@ import { IpcMainHandler } from './ipc-main-handler';
|
||||
|
||||
export const registerIpcHandler = (ipcHandler: IpcMainHandler): void => {
|
||||
for (const [channel, listener] of Object.entries(ipcHandler)) {
|
||||
ipcMain.handle(channel, (_, ...args) => {
|
||||
ipcMain.handle(channel, (_, ...args: unknown[]) => {
|
||||
return listener(...args);
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/apps authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { KeyringJson } from '@polkadot/ui-keyring/types';
|
||||
|
||||
import { RemoteElectronStore } from './remote-electron-store';
|
||||
|
||||
describe('Remote Electron Store', () => {
|
||||
@ -79,7 +81,7 @@ describe('Remote Electron Store', () => {
|
||||
accountStore.set.mockResolvedValue(null);
|
||||
const cb = jest.fn();
|
||||
|
||||
remoteStore.set('1', 'a' as any, cb);
|
||||
remoteStore.set('1', 'a' as unknown as KeyringJson, cb);
|
||||
await Promise.resolve();
|
||||
|
||||
expect(accountStore.set).toBeCalledWith('1', 'a');
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/apps-config": "^0.96.2-81",
|
||||
"@polkadot/apps-routing": "^0.96.2-81",
|
||||
"@polkadot/dev": "^0.62.71",
|
||||
"@polkadot/dev": "^0.63.2",
|
||||
"@polkadot/react-api": "^0.96.2-81",
|
||||
"@polkadot/react-components": "^0.96.2-81",
|
||||
"@polkadot/react-hooks": "^0.96.2-81",
|
||||
|
||||
@ -20,7 +20,7 @@ import WarmUp from './WarmUp';
|
||||
export const PORTAL_ID = 'portals';
|
||||
|
||||
function Apps ({ className = '' }: Props): React.ReactElement<Props> {
|
||||
const { theme } = useContext<ThemeDef>(ThemeContext);
|
||||
const { theme } = useContext(ThemeContext as React.Context<ThemeDef>);
|
||||
const { isDevelopment, specName, systemChain, systemName } = useApi();
|
||||
|
||||
const uiHighlight = useMemo(
|
||||
|
||||
@ -103,7 +103,7 @@ function extractUrlState (apiUrl: string, groups: Group[]): UrlState {
|
||||
|
||||
function loadAffinities (groups: Group[]): Record<string, string> {
|
||||
return Object
|
||||
.entries<string>(store.get(STORAGE_AFFINITIES) || {})
|
||||
.entries<string>(store.get(STORAGE_AFFINITIES) as Record<string, string> || {})
|
||||
.filter(([network, apiUrl]) =>
|
||||
groups.some(({ networks }) =>
|
||||
networks.some(({ name, providers }) =>
|
||||
|
||||
@ -102,7 +102,7 @@ const transformRecovery = {
|
||||
function Account ({ account: { address, meta }, className = '', delegation, filter, isFavorite, proxy, setBalance, toggleFavorite }: Props): React.ReactElement<Props> | null {
|
||||
const { t } = useTranslation();
|
||||
const [isExpanded, toggleIsExpanded] = useToggle(false);
|
||||
const { theme } = useContext<ThemeDef>(ThemeContext);
|
||||
const { theme } = useContext(ThemeContext as React.Context<ThemeDef>);
|
||||
const { queueExtrinsic } = useContext(StatusContext);
|
||||
const api = useApi();
|
||||
const { getLedger } = useLedger();
|
||||
|
||||
@ -69,7 +69,7 @@ function LedgerModal ({ className, onClose }: Props): React.ReactElement<Props>
|
||||
|
||||
queryLedger(api, getLedger, name, accIndex, addIndex)
|
||||
.then(() => onClose())
|
||||
.catch((error): void => {
|
||||
.catch((error: Error): void => {
|
||||
console.error(error);
|
||||
|
||||
setIsBusy(false);
|
||||
|
||||
@ -29,7 +29,7 @@ const isEditable = true;
|
||||
|
||||
function Address ({ address, className = '', filter, isFavorite, toggleFavorite }: Props): React.ReactElement<Props> | null {
|
||||
const { t } = useTranslation();
|
||||
const { theme } = useContext<ThemeDef>(ThemeContext);
|
||||
const { theme } = useContext(ThemeContext as React.Context<ThemeDef>);
|
||||
const api = useApi();
|
||||
const info = useCall<DeriveAccountInfo>(api.api.derive.accounts.info, [address]);
|
||||
const balancesAll = useBalancesAll(address);
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
// Copyright 2017-2021 @polkadot/app-bounties authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { SubmittableExtrinsicFunction } from '@polkadot/api/types';
|
||||
import type { AccountId, BountyIndex } from '@polkadot/types/interfaces';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import { SubmittableExtrinsic } from '@polkadot/api/types';
|
||||
import { getTreasuryProposalThreshold } from '@polkadot/apps-config';
|
||||
import { InputAddress, Modal, TxButton } from '@polkadot/react-components';
|
||||
import { useAccounts, useApi, useCollectiveInstance, useCollectiveMembers } from '@polkadot/react-hooks';
|
||||
@ -28,11 +28,11 @@ interface ActionProperties {
|
||||
filter: string[];
|
||||
header: string;
|
||||
helpMessage: string;
|
||||
params: any[] | (() => any[]) | undefined;
|
||||
params: unknown[] | (() => unknown[]) | undefined;
|
||||
proposingAccountTip: string;
|
||||
tip: string;
|
||||
title: string;
|
||||
tx: null | ((...args: any[]) => SubmittableExtrinsic<'promise'>);
|
||||
tx: null | SubmittableExtrinsicFunction<'promise'>;
|
||||
}
|
||||
|
||||
function SlashCurator ({ action, curatorId, description, index, toggleOpen }: Props): React.ReactElement<Props> | null {
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { SubmittableExtrinsic } from '@polkadot/api/types';
|
||||
import type { SubmittableExtrinsicFunction } from '@polkadot/api/types';
|
||||
|
||||
import { DeriveBounties } from '@polkadot/api-derive/types';
|
||||
import { useApi, useBestNumber, useCall } from '@polkadot/react-hooks';
|
||||
import { BalanceOf, BlockNumber, BountyIndex } from '@polkadot/types/interfaces';
|
||||
|
||||
export type BountyApi = {
|
||||
acceptCurator: ((...args: any[]) => SubmittableExtrinsic<'promise'>);
|
||||
approveBounty: ((...args: any[]) => SubmittableExtrinsic<'promise'>);
|
||||
awardBounty: ((...args: any[]) => SubmittableExtrinsic<'promise'>);
|
||||
acceptCurator: SubmittableExtrinsicFunction<'promise'>;
|
||||
approveBounty: SubmittableExtrinsicFunction<'promise'>;
|
||||
awardBounty: SubmittableExtrinsicFunction<'promise'>;
|
||||
bestNumber?: BlockNumber,
|
||||
bounties?: DeriveBounties,
|
||||
bountyCuratorDeposit: BN,
|
||||
@ -19,14 +19,14 @@ export type BountyApi = {
|
||||
bountyIndex?: BN,
|
||||
bountyUpdatePeriod?: BN,
|
||||
bountyValueMinimum: BN,
|
||||
claimBounty: ((...args: any[]) => SubmittableExtrinsic<'promise'>);
|
||||
closeBounty: ((...args: any[]) => SubmittableExtrinsic<'promise'>);
|
||||
claimBounty: SubmittableExtrinsicFunction<'promise'>;
|
||||
closeBounty: SubmittableExtrinsicFunction<'promise'>;
|
||||
dataDepositPerByte: BN,
|
||||
extendBountyExpiry: ((...args: any[]) => SubmittableExtrinsic<'promise'>);
|
||||
extendBountyExpiry: SubmittableExtrinsicFunction<'promise'>;
|
||||
maximumReasonLength: number,
|
||||
proposeBounty: ((...args: any[]) => SubmittableExtrinsic<'promise'>);
|
||||
proposeCurator: ((...args: any[]) => SubmittableExtrinsic<'promise'>);
|
||||
unassignCurator: ((...args: any[]) => SubmittableExtrinsic<'promise'>);
|
||||
proposeBounty: SubmittableExtrinsicFunction<'promise'>;
|
||||
proposeCurator: SubmittableExtrinsicFunction<'promise'>;
|
||||
unassignCurator: SubmittableExtrinsicFunction<'promise'>;
|
||||
};
|
||||
|
||||
export function useBounties (): BountyApi {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/app-bounties authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { SubmittableExtrinsicFunction } from '@polkadot/api/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { DeriveBounties } from '@polkadot/api-derive/types';
|
||||
@ -12,23 +14,23 @@ import { BountyApi } from '../../src/hooks';
|
||||
export const defaultBountyUpdatePeriod = new BN(100000);
|
||||
|
||||
export const defaultBountyApi: BountyApi = {
|
||||
acceptCurator: jest.fn(),
|
||||
approveBounty: jest.fn(),
|
||||
awardBounty: jest.fn().mockReturnValue('mockAwardExtrinsic'),
|
||||
acceptCurator: jest.fn() as unknown as SubmittableExtrinsicFunction<'promise'>,
|
||||
approveBounty: jest.fn() as unknown as SubmittableExtrinsicFunction<'promise'>,
|
||||
awardBounty: jest.fn().mockReturnValue('mockAwardExtrinsic') as unknown as SubmittableExtrinsicFunction<'promise'>,
|
||||
bestNumber: new BN(1) as BlockNumber,
|
||||
bounties: [] as DeriveBounties,
|
||||
bountyCuratorDeposit: balanceOf(500000),
|
||||
bountyDepositBase: new BN(1),
|
||||
bountyUpdatePeriod: defaultBountyUpdatePeriod,
|
||||
bountyValueMinimum: new BN(1),
|
||||
claimBounty: jest.fn(),
|
||||
closeBounty: jest.fn().mockReturnValue({ length: 4 }),
|
||||
claimBounty: jest.fn() as unknown as SubmittableExtrinsicFunction<'promise'>,
|
||||
closeBounty: jest.fn().mockReturnValue({ length: 4 }) as unknown as SubmittableExtrinsicFunction<'promise'>,
|
||||
dataDepositPerByte: new BN(1),
|
||||
extendBountyExpiry: jest.fn().mockReturnValue('mockExtendExtrinsic'),
|
||||
extendBountyExpiry: jest.fn().mockReturnValue('mockExtendExtrinsic') as unknown as SubmittableExtrinsicFunction<'promise'>,
|
||||
maximumReasonLength: 100,
|
||||
proposeBounty: jest.fn(),
|
||||
proposeCurator: jest.fn(),
|
||||
unassignCurator: jest.fn().mockReturnValue('mockUnassignExtrinsic')
|
||||
proposeBounty: jest.fn() as unknown as SubmittableExtrinsicFunction<'promise'>,
|
||||
proposeCurator: jest.fn() as unknown as SubmittableExtrinsicFunction<'promise'>,
|
||||
unassignCurator: jest.fn().mockReturnValue('mockUnassignExtrinsic') as unknown as SubmittableExtrinsicFunction<'promise'>
|
||||
};
|
||||
|
||||
const defaultBalance = balanceOf(1);
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
import { fireEvent } from '@testing-library/react';
|
||||
|
||||
export const clickButtonWithName = async (buttonName: string, findByRole: (...args: any[]) => Promise<HTMLElement>): Promise<void> => {
|
||||
export async function clickButtonWithName (buttonName: string, findByRole: (...args: any[]) => Promise<HTMLElement>): Promise<void> {
|
||||
const button = await findByRole('button', { name: buttonName });
|
||||
|
||||
fireEvent.click(button);
|
||||
};
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ function CalendarApp ({ basePath, className }: Props): React.ReactElement<Props>
|
||||
);
|
||||
|
||||
const _setAllEventsView = useCallback(
|
||||
(v) => setAllEventsView(v),
|
||||
(v: boolean) => setAllEventsView(v),
|
||||
[]
|
||||
);
|
||||
|
||||
|
||||
@ -31,8 +31,8 @@ interface Props {
|
||||
}
|
||||
|
||||
interface ConstructTx {
|
||||
params?: any[];
|
||||
tx?: (...args: any[]) => SubmittableExtrinsic<'promise'>;
|
||||
params?: unknown[];
|
||||
tx?: (...args: unknown[]) => SubmittableExtrinsic<'promise'>;
|
||||
}
|
||||
|
||||
// Depending on isOldClaimProcess, construct the correct tx.
|
||||
|
||||
@ -6,6 +6,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/api-contract": "^6.3.2-17"
|
||||
"@polkadot/api-contract": "^6.3.2-19"
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,8 +35,8 @@ function Code ({ className, code, onShowDeploy }: Props): React.ReactElement<Pro
|
||||
);
|
||||
|
||||
const _onDeployConstructor = useCallback(
|
||||
(constructorIndex = 0): void => {
|
||||
onShowDeploy && onShowDeploy(code.json.codeHash, constructorIndex);
|
||||
(constructorIndex?: number): void => {
|
||||
onShowDeploy && onShowDeploy(code.json.codeHash, constructorIndex || 0);
|
||||
},
|
||||
[code, onShowDeploy]
|
||||
);
|
||||
|
||||
@ -32,7 +32,7 @@ function Upload ({ onClose }: Props): React.ReactElement {
|
||||
const [[uploadTx, error], setUploadTx] = useState<[SubmittableExtrinsic<'promise'> | null, string | null]>([null, null]);
|
||||
const [constructorIndex, setConstructorIndex] = useState<number>(0);
|
||||
const [endowment, isEndowmentValid, setEndowment] = useNonZeroBn(ENDOWMENT);
|
||||
const [params, setParams] = useState<any[]>([]);
|
||||
const [params, setParams] = useState<unknown[]>([]);
|
||||
const [[wasm, isWasmValid], setWasm] = useState<[Uint8Array | null, boolean]>([null, false]);
|
||||
const [name, isNameValid, setName] = useNonEmptyString();
|
||||
const { abiName, contractAbi, errorText, isAbiError, isAbiSupplied, isAbiValid, onChangeAbi, onRemoveAbi } = useAbi();
|
||||
|
||||
@ -40,7 +40,7 @@ function Call ({ className = '', contract, messageIndex, onCallResult, onChangeM
|
||||
const [value, isValueValid, setEndowment] = useFormField<BN>(BN_ZERO);
|
||||
const [outcomes, setOutcomes] = useState<CallResult[]>([]);
|
||||
const [execTx, setExecTx] = useState<SubmittableExtrinsic<'promise'> | null>(null);
|
||||
const [params, setParams] = useState<any[]>([]);
|
||||
const [params, setParams] = useState<unknown[]>([]);
|
||||
const [isViaCall, toggleViaCall] = useToggle();
|
||||
const weight = useWeight();
|
||||
const dbValue = useDebounce(value);
|
||||
|
||||
@ -33,7 +33,7 @@ function Deploy ({ codeHash, constructorIndex = 0, onClose, setConstructorIndex
|
||||
const { api } = useApi();
|
||||
const weight = useWeight();
|
||||
const [initTx, setInitTx] = useState<SubmittableExtrinsic<'promise'> | null>(null);
|
||||
const [params, setParams] = useState<any[]>([]);
|
||||
const [params, setParams] = useState<unknown[]>([]);
|
||||
const [accountId, isAccountIdValid, setAccountId] = useFormField<string | null>(null);
|
||||
const [endowment, isEndowmentValid, setEndowment] = useNonZeroBn(ENDOWMENT);
|
||||
const [salt, setSalt] = useState<string>(() => randomAsHex());
|
||||
|
||||
@ -6,7 +6,7 @@ import type { AbiMessage, ContractCallOutcome } from '@polkadot/api-contract/typ
|
||||
export interface CallResult extends ContractCallOutcome {
|
||||
from: string;
|
||||
message: AbiMessage;
|
||||
params: any[];
|
||||
params: unknown[];
|
||||
when: Date;
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ export function getContractForAddress (api: ApiPromise, address: string | null):
|
||||
}
|
||||
}
|
||||
|
||||
export function getCallMessageOptions (callContract: Contract | null): any[] {
|
||||
export function getCallMessageOptions (callContract: Contract | null): unknown[] {
|
||||
return callContract
|
||||
? callContract.abi.messages.map((m, index): { key: string; text: React.ReactNode; value: number } => ({
|
||||
key: m.identifier,
|
||||
|
||||
@ -18,7 +18,7 @@ export interface Props {
|
||||
asConstructor?: boolean;
|
||||
className?: string;
|
||||
message: AbiMessage;
|
||||
params?: any[];
|
||||
params?: unknown[];
|
||||
withTooltip?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import UIParams from '@polkadot/react-params';
|
||||
interface Props {
|
||||
isDisabled?: boolean;
|
||||
params?: ParamDef[] | null | '';
|
||||
onChange: (values: any[]) => void;
|
||||
onChange: (values: unknown[]) => void;
|
||||
onEnter?: () => void;
|
||||
registry: Registry;
|
||||
}
|
||||
|
||||
@ -86,11 +86,11 @@ function formatVector (vector: Vec<Codec>): React.ReactNode {
|
||||
|
||||
function formatItem (item: DigestItem): React.ReactNode {
|
||||
if (item.value instanceof Struct) {
|
||||
return formatStruct(item.value);
|
||||
return formatStruct(item.value as Struct);
|
||||
} else if (item.value instanceof Tuple) {
|
||||
return formatTuple(item.value);
|
||||
} else if (item.value instanceof Vec) {
|
||||
return formatVector(item.value);
|
||||
return formatVector(item.value as Vec<Codec>);
|
||||
} else if (item.value instanceof Raw) {
|
||||
return formatU8a(item.value);
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ function Forks ({ className }: Props): React.ReactElement<Props> | null {
|
||||
if (!headersRef.current.has(hash)) {
|
||||
// if this is the first, add to the root entry
|
||||
if (firstNumRef.current === bn) {
|
||||
(childrenRef.current.get('root') as any[]).push(hash);
|
||||
(childrenRef.current.get('root') as unknown[]).push(hash);
|
||||
}
|
||||
|
||||
// add to the header map
|
||||
@ -323,7 +323,7 @@ function Forks ({ className }: Props): React.ReactElement<Props> | null {
|
||||
// check to see if the children already has a entry
|
||||
if (childrenRef.current.has(parent)) {
|
||||
isFork = true;
|
||||
(childrenRef.current.get(parent) as any[]).push(hash);
|
||||
(childrenRef.current.get(parent) as unknown[]).push(hash);
|
||||
} else {
|
||||
childrenRef.current.set(parent, [hash]);
|
||||
}
|
||||
|
||||
@ -27,8 +27,8 @@ import { useTranslation } from './translate';
|
||||
interface Injected {
|
||||
api: ApiPromise;
|
||||
console: {
|
||||
error: (...args: any[]) => void;
|
||||
log: (...args: any[]) => void;
|
||||
error: (...args: unknown[]) => void;
|
||||
log: (...args: unknown[]) => void;
|
||||
};
|
||||
hashing: typeof hashing;
|
||||
keyring: KeyringInstance | null;
|
||||
@ -44,7 +44,7 @@ const DEFAULT_NULL = { Atomics: null, Bluetooth: null, Clipboard: null, Document
|
||||
const snippets = JSON.parse(JSON.stringify(allSnippets)) as Snippet[];
|
||||
let hasSnippetWrappers = false;
|
||||
|
||||
function setupInjected ({ api, isDevelopment }: ApiProps, setIsRunning: (isRunning: boolean) => void, hookConsole: (type: LogType, args: any[]) => void): Injected {
|
||||
function setupInjected ({ api, isDevelopment }: ApiProps, setIsRunning: (isRunning: boolean) => void, hookConsole: (type: LogType, args: unknown[]) => void): Injected {
|
||||
return {
|
||||
...Object
|
||||
.keys(window)
|
||||
@ -56,8 +56,8 @@ function setupInjected ({ api, isDevelopment }: ApiProps, setIsRunning: (isRunni
|
||||
}, { ...DEFAULT_NULL }),
|
||||
api: api.clone(),
|
||||
console: {
|
||||
error: (...args: any[]) => hookConsole('error', args),
|
||||
log: (...args: any[]) => hookConsole('log', args)
|
||||
error: (...args: unknown[]) => hookConsole('error', args),
|
||||
log: (...args: unknown[]) => hookConsole('log', args)
|
||||
},
|
||||
hashing,
|
||||
keyring: isDevelopment
|
||||
@ -130,7 +130,7 @@ function Playground ({ basePath, className = '' }: Props): React.ReactElement<Pr
|
||||
);
|
||||
|
||||
const _hookConsole = useCallback(
|
||||
(type: LogType, args: any[]): void => {
|
||||
(type: LogType, args: unknown[]): void => {
|
||||
logs.push({ args, type });
|
||||
setLogs(logs.slice(0));
|
||||
},
|
||||
|
||||
@ -6,7 +6,7 @@ import type { LabelProps, SemanticShorthandItem } from 'semantic-ui-react';
|
||||
export type LogType = 'error' | 'log';
|
||||
|
||||
export interface Log {
|
||||
args: any[];
|
||||
args: unknown[];
|
||||
type: LogType;
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ function Results ({ queue = [] }: Props): React.ReactElement<Props> | null {
|
||||
value={
|
||||
error
|
||||
? error.message
|
||||
: <pre>{valueToText('', result, false)}</pre>
|
||||
: <pre>{valueToText('', result as null, false)}</pre>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
|
||||
@ -28,7 +28,7 @@ function Verify ({ className = '' }: Props): React.ReactElement {
|
||||
const [{ data, isHexData }, setData] = useState<{ data: string; isHexData: boolean }>({ data: '', isHexData: false });
|
||||
const [{ isValidPk, publicKey }, setPublicKey] = useState<{ isValidPk: boolean; publicKey: Uint8Array | null }>({ isValidPk: false, publicKey: null });
|
||||
const [{ isValidSignature, signature }, setSignature] = useState<{ isValidSignature: boolean; signature: string }>({ isValidSignature: false, signature: '' });
|
||||
const [cryptoOptions] = useState([{ text: t<string>('Crypto not detected'), value: 'unknown' }].concat(settings.availableCryptos as any[]));
|
||||
const [cryptoOptions] = useState([{ text: t<string>('Crypto not detected'), value: 'unknown' }].concat(settings.availableCryptos as { text: string; value: string }[]));
|
||||
|
||||
useEffect((): void => {
|
||||
let cryptoType: CryptoTypes = 'unknown';
|
||||
|
||||
@ -31,8 +31,7 @@ function SessionKey ({ className = '', controllerId, onChange, stashId, withFocu
|
||||
try {
|
||||
onChange({
|
||||
sessionTx: isHex(keys)
|
||||
// this is weird... :(
|
||||
? api.tx.session.setKeys(keys as any, EMPTY_PROOF)
|
||||
? api.tx.session.setKeys(keys, EMPTY_PROOF)
|
||||
: null
|
||||
});
|
||||
} catch {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/app-staking authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { QueryableStorageMultiArg } from '@polkadot/api/types';
|
||||
import type { DeriveSessionIndexes } from '@polkadot/api-derive/types';
|
||||
import type { Option } from '@polkadot/types';
|
||||
import type { EraIndex, Exposure, Nominations, SlashingSpans } from '@polkadot/types/interfaces';
|
||||
@ -93,7 +94,7 @@ export default function useInactives (stashId: string, nominees?: string[]): Ina
|
||||
if (mountedRef.current && nominees && nominees.length && indexes) {
|
||||
api
|
||||
.queryMulti(
|
||||
[[api.query.staking.nominators, stashId] as any]
|
||||
[[api.query.staking.nominators, stashId] as QueryableStorageMultiArg<'promise'>]
|
||||
.concat(
|
||||
api.query.staking.erasStakers
|
||||
? nominees.map((id) => [api.query.staking.erasStakers, [indexes.activeEra, id]])
|
||||
|
||||
@ -72,7 +72,7 @@ function createComponent (type: string, Component: React.ComponentType<any>, def
|
||||
// In order to modify the parameters which are used to render the default component, we can use this method
|
||||
refresh: (contentShorten: boolean): React.ComponentType<any> =>
|
||||
renderHelper(
|
||||
(value: any) => <pre>{valueToText(type, value, contentShorten)}</pre>,
|
||||
(value: unknown) => <pre>{valueToText(type, value as null, contentShorten)}</pre>,
|
||||
defaultProps
|
||||
),
|
||||
// In order to replace the default component during runtime we can provide a RenderFn to create a new 'plugged' component
|
||||
@ -128,7 +128,7 @@ function getCachedComponent (registry: Registry, query: QueryTypes): CacheInstan
|
||||
const defaultProps = { className: 'ui--output' };
|
||||
const Component = renderHelper(
|
||||
// By default we render a simple div node component with the query results in it
|
||||
(value: any) => <pre>{valueToText(type, value, true)}</pre>,
|
||||
(value: unknown) => <pre>{valueToText(type, value as null, true)}</pre>,
|
||||
defaultProps
|
||||
);
|
||||
|
||||
|
||||
@ -6,9 +6,9 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/api": "^6.3.2-17",
|
||||
"@polkadot/extension-compat-metamask": "^0.40.4-0",
|
||||
"@polkadot/extension-dapp": "^0.40.4-0",
|
||||
"@polkadot/api": "^6.3.2-19",
|
||||
"@polkadot/extension-compat-metamask": "^0.40.4-2",
|
||||
"@polkadot/extension-dapp": "^0.40.4-2",
|
||||
"@substrate/connect": "^0.4.5",
|
||||
"fflate": "^0.7.1",
|
||||
"rxjs": "^7.4.0"
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
import type { ApiProps, CallState as State, SubtractProps } from '../types';
|
||||
import type { ApiProps, CallState as State, OnChangeCb, SubtractProps } from '../types';
|
||||
import type { Options } from './types';
|
||||
|
||||
import React from 'react';
|
||||
@ -22,13 +22,13 @@ import withApi from './api';
|
||||
|
||||
// FIXME This is not correct, we need some junction of derive, query & consts
|
||||
interface Method {
|
||||
(...params: any[]): Promise<any>;
|
||||
at: (hash: Uint8Array | string, ...params: any[]) => Promise<any>;
|
||||
(...params: unknown[]): Promise<any>;
|
||||
at: (hash: Uint8Array | string, ...params: unknown[]) => Promise<any>;
|
||||
meta: any;
|
||||
multi: (params: any[], cb: (value?: any) => void) => Promise<any>;
|
||||
multi: (params: unknown[], cb: (value?: any) => void) => Promise<any>;
|
||||
}
|
||||
|
||||
type ApiMethodInfo = [Method, any[], string];
|
||||
type ApiMethodInfo = [Method, unknown[], string];
|
||||
|
||||
const NOOP = (): void => {
|
||||
// ignore
|
||||
@ -118,7 +118,7 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
}
|
||||
}
|
||||
|
||||
private getParams (props: any): [boolean, any[]] {
|
||||
private getParams (props: any): [boolean, unknown[]] {
|
||||
const paramValue = paramPick
|
||||
? paramPick(props)
|
||||
: paramName
|
||||
@ -162,20 +162,20 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
section,
|
||||
method
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
private getApiMethod (newParams: any[]): ApiMethodInfo {
|
||||
private getApiMethod (newParams: unknown[]): ApiMethodInfo {
|
||||
if (endpoint === 'subscribe') {
|
||||
const [fn, ...params] = newParams;
|
||||
|
||||
return [
|
||||
fn,
|
||||
fn as Method,
|
||||
params,
|
||||
'subscribe'
|
||||
];
|
||||
}
|
||||
|
||||
const endpoints: string[] = [endpoint].concat(fallbacks || []);
|
||||
const endpoints = [endpoint].concat(fallbacks || []);
|
||||
const expanded = endpoints.map(this.constructApiSection);
|
||||
const [apiSection, area, section, method] = expanded.find(([apiSection]): boolean =>
|
||||
!!apiSection
|
||||
@ -198,7 +198,7 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
];
|
||||
}
|
||||
|
||||
private async subscribe ([isValid, newParams]: [boolean, any[]]): Promise<void> {
|
||||
private async subscribe ([isValid, newParams]: [boolean, unknown[]]): Promise<void> {
|
||||
if (!isValid || skipIf(this.props)) {
|
||||
return;
|
||||
}
|
||||
@ -267,7 +267,7 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
return;
|
||||
}
|
||||
|
||||
triggerChange(callResult, callOnResult, props.callOnResult);
|
||||
triggerChange(callResult as OnChangeCb, callOnResult, props.callOnResult as OnChangeCb);
|
||||
|
||||
this.nextState({
|
||||
callResult,
|
||||
|
||||
@ -22,7 +22,7 @@ export default function withCallDiv<T> (endpoint: string, options: Options = {})
|
||||
{...defaultProps}
|
||||
className={[className || '', callUpdated ? 'rx--updated' : undefined].join(' ')}
|
||||
>
|
||||
{label}{render(callResult)}{children}
|
||||
{label}{render(callResult as T)}{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -18,8 +18,8 @@ export default function withCalls <P> (...calls: Call[]): (Component: React.Comp
|
||||
.reverse()
|
||||
.reduce((Component, call): React.ComponentType<any> => {
|
||||
return Array.isArray(call)
|
||||
? withCall(...call)(Component as any)
|
||||
: withCall(call)(Component as any);
|
||||
? withCall(...call)(Component as unknown as React.ComponentType<ApiProps>)
|
||||
: withCall(call)(Component as unknown as React.ComponentType<ApiProps>);
|
||||
}, Component);
|
||||
};
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
// TODO: Lots of duplicated code between this and withObservable, surely there is a better way of doing this?
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { Observable, OperatorFunction } from 'rxjs';
|
||||
import type { CallState } from '../types';
|
||||
import type { DefaultProps, HOC, Options, RenderFn } from './types';
|
||||
|
||||
@ -34,10 +34,10 @@ export default function withObservable<T, P> (observable: Observable<P>, { callO
|
||||
subscriptions: [
|
||||
observable
|
||||
.pipe(
|
||||
map(transform),
|
||||
map(transform) as OperatorFunction<P, any>,
|
||||
catchError(() => of(undefined))
|
||||
)
|
||||
.subscribe((value: any) => this.triggerUpdate(this.props, value)),
|
||||
.subscribe((value) => this.triggerUpdate(this.props, value as T)),
|
||||
intervalObservable(this)
|
||||
]
|
||||
});
|
||||
@ -66,7 +66,7 @@ export default function withObservable<T, P> (observable: Observable<P>, { callO
|
||||
} catch (error) {
|
||||
console.error(this.props, error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public override render (): React.ReactNode {
|
||||
const { children } = this.props;
|
||||
|
||||
@ -18,9 +18,9 @@ export interface Options {
|
||||
callOnResult?: OnChangeCb;
|
||||
fallbacks?: string[];
|
||||
isMulti?: boolean;
|
||||
params?: any[];
|
||||
params?: unknown[];
|
||||
paramName?: string;
|
||||
paramPick?: (props: any) => any;
|
||||
paramPick?: (props: any) => unknown;
|
||||
paramValid?: boolean;
|
||||
propName?: string;
|
||||
skipIf?: (props: any) => boolean;
|
||||
@ -30,9 +30,9 @@ export interface Options {
|
||||
|
||||
export type RenderFn = (value?: any) => React.ReactNode;
|
||||
|
||||
export type StorageTransform = (input: any, index: number) => any | null;
|
||||
export type StorageTransform = (input: any, index: number) => unknown | null;
|
||||
|
||||
export type HOC = (Component: React.ComponentType<any>, defaultProps?: DefaultProps, render?: RenderFn) => React.ComponentType<any>;
|
||||
export type HOC = (Component: React.ComponentType<unknown>, defaultProps?: DefaultProps, render?: RenderFn) => React.ComponentType<unknown>;
|
||||
|
||||
export interface ApiMethod {
|
||||
name: string;
|
||||
|
||||
@ -5,9 +5,9 @@ import type { Hash } from '@polkadot/types/interfaces';
|
||||
import type { Codec } from '@polkadot/types/types';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
type AtQuery <I extends any[]> = (hash: string | Uint8Array, ...params: I) => Promise<Codec>;
|
||||
type AtQuery <I extends unknown[]> = (hash: string | Uint8Array, ...params: I) => Promise<Codec>;
|
||||
|
||||
export default async function getHistoric <T extends Codec, I extends any[] = any[]> (atQuery: AtQuery<I>, params: I, hashes: Hash[]): Promise<[Hash, T][]> {
|
||||
export default async function getHistoric <T extends Codec, I extends unknown[] = unknown[]> (atQuery: AtQuery<I>, params: I, hashes: Hash[]): Promise<[Hash, T][]> {
|
||||
return Promise
|
||||
.all(hashes.map((hash): Promise<T> => atQuery(hash, ...params) as Promise<T>))
|
||||
.then((results): [Hash, T][] =>
|
||||
|
||||
@ -25,7 +25,7 @@ let badgeId = 0;
|
||||
|
||||
function Badge ({ className = '', color = 'normal', hover, hoverAction, icon, info, isSmall, onClick }: Props): React.ReactElement<Props> | null {
|
||||
const badgeTestId = `${icon ? `${icon}-` : ''}badge`;
|
||||
const { theme } = useContext<ThemeDef>(ThemeContext);
|
||||
const { theme } = useContext(ThemeContext as React.Context<ThemeDef>);
|
||||
|
||||
const [trigger] = useState(() => `${badgeTestId}-hover-${Date.now()}-${badgeId++}`);
|
||||
const extraProps = hover
|
||||
|
||||
@ -36,7 +36,7 @@ interface Props<Option> {
|
||||
searchInput?: { autoFocus: boolean };
|
||||
tabIndex?: number;
|
||||
transform?: (value: any) => any;
|
||||
value?: any;
|
||||
value?: unknown;
|
||||
withEllipsis?: boolean;
|
||||
withLabel?: boolean;
|
||||
}
|
||||
@ -69,7 +69,7 @@ function BaseDropdown<Option> ({ allowAdd = false, children, className = '', def
|
||||
);
|
||||
|
||||
useEffect((): void => {
|
||||
_setStored(isUndefined(value) ? defaultValue : value);
|
||||
_setStored((isUndefined(value) ? defaultValue : value) as string);
|
||||
}, [_setStored, defaultValue, value]);
|
||||
|
||||
const _onAdd = useCallback(
|
||||
|
||||
@ -63,7 +63,7 @@ function ExtrinsicDisplay ({ defaultValue, isDisabled, isError, isPrivate, label
|
||||
|
||||
if (isValid) {
|
||||
try {
|
||||
method = extrinsic.fn(...values.map(({ value }): any => value));
|
||||
method = extrinsic.fn(...values.map(({ value }) => value));
|
||||
} catch (error) {
|
||||
onError && onError(error as Error);
|
||||
}
|
||||
|
||||
@ -24,6 +24,6 @@ import b017 from './bg2/004-robotBG-01.png';
|
||||
import b018 from './bg2/005-robotBG-02.png';
|
||||
import b019 from './bg2/006-robotBG-07.png';
|
||||
|
||||
const backgrounds: any[] = [b000, b001, b002, b003, b004, b005, b006, b007, b008, b009, b010, b011, b012, b013, b014, b015, b016, b017, b018, b019];
|
||||
const backgrounds: unknown[] = [b000, b001, b002, b003, b004, b005, b006, b007, b008, b009, b010, b011, b012, b013, b014, b015, b016, b017, b018, b019];
|
||||
|
||||
export default backgrounds;
|
||||
|
||||
@ -1517,7 +1517,7 @@ import s013000015 from './set5/007-Accessories/Round-White.png';
|
||||
import s013000017 from './set5/007-Accessories/Sunglasses.png';
|
||||
import s013000018 from './set5/007-Accessories/Wayfarers.png';
|
||||
|
||||
const sets: any[][][] = [
|
||||
const sets: unknown[][][] = [
|
||||
[
|
||||
[s000000000, s000000001, s000000002, s000000003, s000000004, s000000005, s000000006, s000000007, s000000008, s000000009],
|
||||
[s000001000, s000001001, s000001002, s000001003, s000001004, s000001005, s000001006, s000001007, s000001008, s000001009],
|
||||
|
||||
@ -75,7 +75,7 @@ const KEYS = {
|
||||
ZERO: '0'
|
||||
};
|
||||
|
||||
const KEYS_PRE: any[] = [KEYS.ALT, KEYS.CMD, KEYS.CTRL];
|
||||
const KEYS_PRE: unknown[] = [KEYS.ALT, KEYS.CMD, KEYS.CTRL];
|
||||
|
||||
// reference: degrade key to keyCode for cross-browser compatibility https://www.w3schools.com/jsref/event_key_keycode.asp
|
||||
const isCopy = (key: string, isPreKeyDown: boolean): boolean =>
|
||||
|
||||
@ -209,7 +209,7 @@ class InputAddress extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
return getAddressName(value);
|
||||
}
|
||||
};
|
||||
|
||||
private getLastOptionValue (): KeyringSectionOption | undefined {
|
||||
const available = this.getFiltered();
|
||||
@ -241,7 +241,7 @@ class InputAddress extends React.PureComponent<Props, State> {
|
||||
? transformToAccountId(address)
|
||||
: null
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
private onChangeMulti = (addresses: string[]): void => {
|
||||
const { onChangeMulti } = this.props;
|
||||
@ -253,7 +253,7 @@ class InputAddress extends React.PureComponent<Props, State> {
|
||||
.filter((address) => address as string) as string[]
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private onSearch = (filteredOptions: KeyringSectionOptions, _query: string): KeyringSectionOptions => {
|
||||
const { isInput = true } = this.props;
|
||||
@ -285,7 +285,7 @@ class InputAddress extends React.PureComponent<Props, State> {
|
||||
|
||||
return !(isNull(item.value) || isUndefined(item.value)) || (!isLast && !!hasNext);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const ExportedComponent = withMulti(
|
||||
|
||||
@ -49,7 +49,7 @@ function InputStorage ({ className = '', defaultValue, help, label, onChange, wi
|
||||
const optionsMethod = keyOptions(api, section);
|
||||
|
||||
setOptionsMethod(optionsMethod);
|
||||
_onKeyChange(api.query[section][optionsMethod[0].value] as any);
|
||||
_onKeyChange(api.query[section][optionsMethod[0].value]);
|
||||
}
|
||||
},
|
||||
[_onKeyChange, api, value]
|
||||
|
||||
@ -57,7 +57,7 @@ function onAddTag (value: string): void {
|
||||
}
|
||||
|
||||
function InputTags ({ allowAdd = true, className = '', defaultValue, help, isDisabled, isError, label, onBlur, onChange, onClose, placeholder, searchInput, value, withLabel }: Props): React.ReactElement<Props> {
|
||||
const { theme } = useContext<ThemeDef>(ThemeContext);
|
||||
const { theme } = useContext(ThemeContext as React.Context<ThemeDef>);
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
|
||||
@ -13,7 +13,7 @@ import Header from './Header';
|
||||
const ESC_KEYCODE = 27;
|
||||
|
||||
function Base (props: ModalProps): React.ReactElement<ModalProps> {
|
||||
const { theme } = useContext<ThemeDef>(ThemeContext);
|
||||
const { theme } = useContext(ThemeContext as React.Context<ThemeDef>);
|
||||
const { children, className = '', header, onClose, size = 'medium', testId = 'modal' } = props;
|
||||
|
||||
const listenKeyboard = useCallback((event: KeyboardEvent) => {
|
||||
|
||||
@ -49,7 +49,7 @@ export interface QueueTx extends AccountInfo {
|
||||
txSuccessCb?: TxCallback;
|
||||
txStartCb?: () => void;
|
||||
txUpdateCb?: TxCallback;
|
||||
values?: any[];
|
||||
values?: unknown[];
|
||||
status: QueueTxStatus;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ export interface QueueTxExtrinsic extends AccountInfo {
|
||||
|
||||
export interface QueueTxRpc extends AccountInfo {
|
||||
rpc: DefinitionRpcExt;
|
||||
values: any[];
|
||||
values: unknown[];
|
||||
}
|
||||
|
||||
export interface PartialAccountInfo {
|
||||
@ -91,7 +91,7 @@ export interface PartialQueueTxExtrinsic extends PartialAccountInfo {
|
||||
|
||||
export interface PartialQueueTxRpc extends PartialAccountInfo {
|
||||
rpc: DefinitionRpcExt;
|
||||
values: any[];
|
||||
values: unknown[];
|
||||
}
|
||||
|
||||
export type QueueTxRpcAdd = (value: PartialQueueTxRpc) => void;
|
||||
|
||||
@ -19,7 +19,7 @@ interface Props {
|
||||
let tagId = 0;
|
||||
|
||||
function Tag ({ className = '', color = 'theme', hover, label, size = 'small' }: Props): React.ReactElement<Props> {
|
||||
const { theme } = useContext<ThemeDef>(ThemeContext);
|
||||
const { theme } = useContext(ThemeContext as React.Context<ThemeDef>);
|
||||
const [trigger] = useState(() => `tag-hover-${Date.now()}-${tagId++}`);
|
||||
const tooltipProps = hover
|
||||
? { 'data-for': trigger, 'data-tip': true }
|
||||
|
||||
@ -10,9 +10,9 @@ type LoadResult = [string | null, Record<string, string> | boolean];
|
||||
const loaders: Record<string, Promise<LoadResult>> = {};
|
||||
|
||||
export default class Backend {
|
||||
type = 'backend'
|
||||
type = 'backend';
|
||||
|
||||
static type: 'backend' = 'backend'
|
||||
static type: 'backend' = 'backend';
|
||||
|
||||
async read (lng: string, _namespace: string, responder: Callback): Promise<void> {
|
||||
if (languageCache[lng]) {
|
||||
|
||||
@ -9,6 +9,12 @@ import { LANGUAGE_DEFAULT, settings } from '@polkadot/ui-settings';
|
||||
|
||||
import Backend from './Backend';
|
||||
|
||||
interface Services {
|
||||
languageDetector: {
|
||||
detect: () => string;
|
||||
};
|
||||
}
|
||||
|
||||
const languageDetector = new LanguageDetector();
|
||||
|
||||
languageDetector.addDetector({
|
||||
@ -85,8 +91,7 @@ i18next
|
||||
settings.on('change', (settings): void => {
|
||||
i18next.changeLanguage(
|
||||
settings.i18nLang === LANGUAGE_DEFAULT
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||
? i18next.services.languageDetector.detect()
|
||||
? (i18next.services as Services).languageDetector.detect()
|
||||
: settings.i18nLang
|
||||
).catch(console.error);
|
||||
});
|
||||
|
||||
@ -44,7 +44,7 @@ export interface TxButtonProps {
|
||||
onStart?: () => void;
|
||||
onSuccess?: TxCallback;
|
||||
onUpdate?: TxCallback;
|
||||
params?: any[] | (() => any[]) | null;
|
||||
params?: unknown[] | (() => unknown[]) | null;
|
||||
tooltip?: string;
|
||||
tx?: ((...args: any[]) => SubmittableExtrinsic<'promise'>) | null;
|
||||
withoutLink?: boolean;
|
||||
|
||||
@ -20,7 +20,7 @@ export interface CallOptions <T> {
|
||||
withParamsTransform?: boolean;
|
||||
}
|
||||
|
||||
export type TxDef = [string, any[] | ((...params: any[]) => SubmittableExtrinsic<'promise'>)];
|
||||
export type TxDef = [string, unknown[] | ((...params: unknown[]) => SubmittableExtrinsic<'promise'>)];
|
||||
|
||||
export type TxDefs = SubmittableExtrinsic<'promise'> | IExtrinsic | Call | TxDef | null;
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ export function unsubscribe (tracker: TrackerRef): void {
|
||||
}
|
||||
|
||||
// subscribe, trying to play nice with the browser threads
|
||||
function subscribe <T> (mountedRef: MountedRef, tracker: TrackerRef, fn: TrackFn | undefined, params: CallParams, setValue: (value: T) => void, { transform = transformIdentity, withParams, withParamsTransform }: CallOptions<T> = {}): void {
|
||||
function subscribe <T> (mountedRef: MountedRef, tracker: TrackerRef, fn: TrackFn | undefined, params: CallParams, setValue: (value: any) => void, { transform = transformIdentity, withParams, withParamsTransform }: CallOptions<T> = {}): void {
|
||||
const validParams = params.filter((p) => !isUndefined(p));
|
||||
|
||||
unsubscribe(tracker);
|
||||
@ -99,7 +99,7 @@ function subscribe <T> (mountedRef: MountedRef, tracker: TrackerRef, fn: TrackFn
|
||||
if (mountedRef.current && tracker.current.isActive) {
|
||||
mountedRef.current && tracker.current.isActive && setValue(
|
||||
withParams
|
||||
? [params, transform(value)] as any
|
||||
? [params, transform(value)]
|
||||
: withParamsTransform
|
||||
? transform([params, value])
|
||||
: transform(value)
|
||||
|
||||
@ -20,7 +20,7 @@ export function useElementPosition (ref: React.MutableRefObject<HTMLElement | un
|
||||
|
||||
useEffect(() => {
|
||||
if (ref && ref.current) {
|
||||
const { height, width, x, y } = ref.current?.getBoundingClientRect();
|
||||
const { height, width, x, y } = ref.current.getBoundingClientRect();
|
||||
|
||||
setElementPosition({
|
||||
height,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/react-hooks authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { CombinatorFunction } from '@polkadot/api/promise/Combinator';
|
||||
import type { DeriveStakingAccount } from '@polkadot/api-derive/types';
|
||||
import type { AccountId, ValidatorPrefs } from '@polkadot/types/interfaces';
|
||||
import type { Codec, ITuple } from '@polkadot/types/types';
|
||||
@ -74,10 +75,10 @@ export function useOwnStashInfos (): StakerState[] | undefined {
|
||||
if (ownStashes) {
|
||||
if (ownStashes.length) {
|
||||
const stashIds = ownStashes.map(([stashId]) => stashId);
|
||||
const fns: any[] = [
|
||||
const fns = [
|
||||
[api.derive.staking.accounts, stashIds],
|
||||
[api.query.staking.validators.multi, stashIds]
|
||||
];
|
||||
] as unknown as CombinatorFunction[];
|
||||
|
||||
api.combineLatest<[DeriveStakingAccount[], ValidatorInfo[]]>(fns, ([accounts, validators]): void => {
|
||||
mountedRef.current && ownStashes.length === accounts.length && ownStashes.length === validators.length && setQueried(
|
||||
|
||||
@ -32,7 +32,7 @@ function EnumParam (props: Props): React.ReactElement<Props> {
|
||||
useEffect((): void => {
|
||||
const rawType = registry.createType(type.type as 'u32').toRawType();
|
||||
const typeDef = getTypeDef(rawType);
|
||||
const subTypes = typeDef.sub as TypeDef[];
|
||||
const subTypes = (typeDef.sub as TypeDef[]).filter(({ name }) => !!name && !name.startsWith('__Unused'));
|
||||
|
||||
setOptions({
|
||||
options: subTypes.map(({ name }): Option => ({
|
||||
|
||||
@ -133,7 +133,7 @@ class Params extends React.PureComponent<Props, State> {
|
||||
}),
|
||||
this.triggerUpdate
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
private triggerUpdate = (): void => {
|
||||
const { isDisabled, onChange } = this.props;
|
||||
@ -144,13 +144,13 @@ class Params extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
onChange && onChange(values);
|
||||
}
|
||||
};
|
||||
|
||||
private onRenderError = (): void => {
|
||||
const { onError } = this.props;
|
||||
|
||||
onError && onError();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default translate(Params);
|
||||
|
||||
@ -37,12 +37,12 @@ function SignFields ({ address, onChange, signedTx }: Props): React.ReactElement
|
||||
}, [blocks, nonce, onChange]);
|
||||
|
||||
const _setBlocks = useCallback(
|
||||
(blocks = BN_ZERO) => setBlocks(blocks),
|
||||
(blocks: BN = BN_ZERO) => setBlocks(blocks),
|
||||
[]
|
||||
);
|
||||
|
||||
const _setNonce = useCallback(
|
||||
(nonce = BN_ZERO) => setNonce(nonce),
|
||||
(nonce: BN = BN_ZERO) => setNonce(nonce),
|
||||
[]
|
||||
);
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ const NOOP = () => undefined;
|
||||
|
||||
const AVAIL_STATUS = ['queued', 'qr', 'signing'];
|
||||
|
||||
async function submitRpc (api: ApiPromise, { method, section }: DefinitionRpcExt, values: any[]): Promise<QueueTxResult> {
|
||||
async function submitRpc (api: ApiPromise, { method, section }: DefinitionRpcExt, values: unknown[]): Promise<QueueTxResult> {
|
||||
try {
|
||||
const rpc = api.rpc as Record<string, Record<string, (...params: unknown[]) => Promise<unknown>>>;
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
"testcontainers": "^7.21.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/types-support": "^6.3.2-17",
|
||||
"@polkadot/types-support": "^6.3.2-19",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"tsconfig-paths": "^3.11.0"
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ export class BountyFactory {
|
||||
};
|
||||
|
||||
public bountyWith = ({ status = 'Proposed', value = 1 } = {}): PalletBountiesBounty =>
|
||||
this.aBounty({ status: this.aBountyStatus(status), value: balanceOf(value) })
|
||||
this.aBounty({ status: this.aBountyStatus(status), value: balanceOf(value) });
|
||||
|
||||
public aBounty = ({ fee = balanceOf(10), status = this.aBountyStatus('Proposed'), value = balanceOf(500) }: Partial<PalletBountiesBounty> = {}): PalletBountiesBounty =>
|
||||
this.#registry.createType<PalletBountiesBounty>('Bounty', { fee, status, value });
|
||||
|
||||
@ -104,7 +104,7 @@ jest.mock('@polkadot/react-hooks/useRegistrars', () => ({
|
||||
}));
|
||||
|
||||
export abstract class Page {
|
||||
private renderResult?: RenderResult
|
||||
private renderResult?: RenderResult;
|
||||
protected readonly defaultAddresses = [alice, bob, charlie, ferdie];
|
||||
|
||||
protected constructor (private readonly overview: React.ReactElement, private readonly rowClassName: string) {
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
import { fireEvent, screen, within } from '@testing-library/react';
|
||||
|
||||
export class JudgementTag {
|
||||
public judgementTag: HTMLElement
|
||||
public judgementTag: HTMLElement;
|
||||
|
||||
constructor (judgementTag: HTMLElement) {
|
||||
this.judgementTag = judgementTag;
|
||||
|
||||
@ -6,7 +6,7 @@ import { fireEvent, screen, within } from '@testing-library/react';
|
||||
import { JudgementTag } from './JudgementTag';
|
||||
|
||||
export class Sidebar {
|
||||
public sidebar: HTMLElement
|
||||
public sidebar: HTMLElement;
|
||||
|
||||
constructor (sidebar: HTMLElement) {
|
||||
this.sidebar = sidebar;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user