Bump dev (w/ eslint config adj) (#1259)
This commit is contained in:
@@ -3,15 +3,16 @@
|
||||
|
||||
/// <reference types="@polkadot/dev-test/globals" />
|
||||
|
||||
/* global chrome */
|
||||
|
||||
import '@polkadot/extension-mocks/chrome';
|
||||
|
||||
import type { ResponseSigning } from '@polkadot/extension-base/background/types';
|
||||
import type { AuthUrls, ResponseSigning } from '@polkadot/extension-base/background/types';
|
||||
import type { MetadataDef } from '@polkadot/extension-inject/types';
|
||||
import type { KeyringPair } from '@polkadot/keyring/types';
|
||||
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
|
||||
import type { SignerPayloadJSON } from '@polkadot/types/types';
|
||||
import type { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import type { AuthUrls } from '../types.js';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
@@ -221,8 +222,10 @@ describe('Extension', () => {
|
||||
const signatureExpected = registry
|
||||
.createType('ExtrinsicPayload', payload, { version: payload.version }).sign(pair);
|
||||
|
||||
// eslint-disable-next-line jest/valid-expect-in-promise
|
||||
tabs.handle('1615191860871.5', 'pub(extrinsic.sign)', payload, 'http://localhost:3000', {} as chrome.runtime.Port)
|
||||
.then((result) => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((result as ResponseSigning)?.signature).toEqual(signatureExpected.signature);
|
||||
}).catch((err) => console.log(err));
|
||||
|
||||
@@ -269,8 +272,10 @@ describe('Extension', () => {
|
||||
const signatureExpected = registry
|
||||
.createType('ExtrinsicPayload', ethPayload, { version: ethPayload.version }).sign(ethPair);
|
||||
|
||||
// eslint-disable-next-line jest/valid-expect-in-promise
|
||||
tabs.handle('1615191860871.5', 'pub(extrinsic.sign)', ethPayload, 'http://localhost:3000', {} as chrome.runtime.Port)
|
||||
.then((result) => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((result as ResponseSigning)?.signature).toEqual(signatureExpected.signature);
|
||||
}).catch((err) => console.log(err));
|
||||
|
||||
@@ -333,8 +338,10 @@ describe('Extension', () => {
|
||||
const signatureExpected = registry
|
||||
.createType('ExtrinsicPayload', payload, { version: payload.version }).sign(pair);
|
||||
|
||||
// eslint-disable-next-line jest/valid-expect-in-promise
|
||||
tabs.handle('1615191860771.5', 'pub(extrinsic.sign)', payload, 'http://localhost:3000', {} as chrome.runtime.Port)
|
||||
.then((result) => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((result as ResponseSigning)?.signature).toEqual(signatureExpected.signature);
|
||||
}).catch((err) => console.log(err));
|
||||
|
||||
@@ -391,8 +398,10 @@ describe('Extension', () => {
|
||||
const signatureExpected = registry
|
||||
.createType('ExtrinsicPayload', payload, { version: payload.version }).sign(pair);
|
||||
|
||||
// eslint-disable-next-line jest/valid-expect-in-promise
|
||||
tabs.handle('1615191860771.5', 'pub(extrinsic.sign)', payload, 'http://localhost:3000', {} as chrome.runtime.Port)
|
||||
.then((result) => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((result as ResponseSigning)?.signature).toEqual(signatureExpected.signature);
|
||||
}).catch((err) => console.log(err));
|
||||
|
||||
@@ -460,8 +469,10 @@ describe('Extension', () => {
|
||||
const signatureExpected = registry
|
||||
.createType('ExtrinsicPayload', payload, { version: payload.version }).sign(pair);
|
||||
|
||||
// eslint-disable-next-line jest/valid-expect-in-promise
|
||||
tabs.handle('1615191860771.5', 'pub(extrinsic.sign)', payload, 'http://localhost:3000', {} as chrome.runtime.Port)
|
||||
.then((result) => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((result as ResponseSigning)?.signature).toEqual(signatureExpected.signature);
|
||||
}).catch((err) => console.log(err));
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-base authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global chrome */
|
||||
|
||||
import type { MetadataDef } from '@polkadot/extension-inject/types';
|
||||
import type { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '@polkadot/keyring/types';
|
||||
import type { Registry, SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types';
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-bg authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global chrome */
|
||||
|
||||
import type { MetadataDef, ProviderMeta } from '@polkadot/extension-inject/types';
|
||||
import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback } from '@polkadot/rpc-provider/types';
|
||||
import type { AccountJson, AuthorizeRequest, AuthUrlInfo, AuthUrls, MetadataRequest, RequestAuthorizeTab, RequestRpcSend, RequestRpcSubscribe, RequestRpcUnsubscribe, RequestSign, ResponseRpcListProviders, ResponseSigning, SigningRequest } from '../types.js';
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-base authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global chrome */
|
||||
|
||||
import type { Subscription } from 'rxjs';
|
||||
import type { InjectedAccount, InjectedMetadataKnown, MetadataDef, ProviderMeta } from '@polkadot/extension-inject/types';
|
||||
import type { KeyringPair } from '@polkadot/keyring/types';
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-base authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global chrome */
|
||||
|
||||
import type { MessageTypes, TransportRequestMessage } from '../types.js';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-base authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global chrome */
|
||||
|
||||
import type { MessageTypesWithSubscriptions, SubscriptionMessageTypes } from '../types.js';
|
||||
|
||||
type Subscriptions = Record<string, chrome.runtime.Port>;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-base authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable no-redeclare */
|
||||
|
||||
import type { MessageTypes, MessageTypesWithNoSubscriptions, MessageTypesWithNullRequest, MessageTypesWithSubscriptions, RequestTypes, ResponseTypes, SubscriptionMessageTypes, TransportRequestMessage, TransportResponseMessage } from '../background/types.js';
|
||||
|
||||
import { MESSAGE_ORIGIN_PAGE } from '../defaults.js';
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-base authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global chrome */
|
||||
|
||||
type StoreValue = Record<string, unknown>;
|
||||
|
||||
const lastError = (type: string): void => {
|
||||
|
||||
@@ -57,6 +57,7 @@ const typeDerivationPath = async (wrapper: ReactWrapper, value: string) => {
|
||||
};
|
||||
|
||||
// FIXME hanging
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
describe.skip('ImportSeed', () => {
|
||||
let wrapper: ReactWrapper;
|
||||
const onActionStub = jest.fn();
|
||||
|
||||
@@ -21,7 +21,7 @@ interface Props {
|
||||
signId: string;
|
||||
}
|
||||
|
||||
function SignArea ({ buttonText, className, error, isExternal, isFirst, setError, signId }: Props): JSX.Element {
|
||||
function SignArea ({ buttonText, className, error, isExternal, isFirst, setError, signId }: Props): React.ReactElement {
|
||||
const [savePass, setSavePass] = useState(false);
|
||||
const [isLocked, setIsLocked] = useState<boolean | null>(null);
|
||||
const [password, setPassword] = useState('');
|
||||
@@ -31,7 +31,7 @@ function SignArea ({ buttonText, className, error, isExternal, isFirst, setError
|
||||
|
||||
useEffect(() => {
|
||||
setIsLocked(null);
|
||||
let timeout: NodeJS.Timeout;
|
||||
let timeout: ReturnType<typeof setTimeout>;
|
||||
|
||||
!isExternal && isSignLocked(signId)
|
||||
.then(({ isLocked, remainingTime }) => {
|
||||
|
||||
@@ -100,7 +100,7 @@ function InputFile ({ accept, className = '', clearContent, convertHex, isDisabl
|
||||
onDrop={_onDrop}
|
||||
ref={dropRef}
|
||||
>
|
||||
{({ getInputProps, getRootProps }): JSX.Element => (
|
||||
{({ getInputProps, getRootProps }): React.ReactElement => (
|
||||
<div {...getRootProps({ className: classes('ui--InputFile', isError ? 'error' : '', className) })}>
|
||||
<input {...getInputProps()} />
|
||||
<em className='label'>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Validator } from '../util/validators.js';
|
||||
import type { ResultType, Validator } from '../util/validators.js';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
@@ -25,7 +25,7 @@ type Props<T extends BasicProps> = T & {
|
||||
|
||||
function ValidatedInput<T extends Record<string, unknown>> ({ className, component: Input, defaultValue, onValidatedChange, validator, ...props }: Props<T>): React.ReactElement<Props<T>> {
|
||||
const [value, setValue] = useState(defaultValue || '');
|
||||
const [validationResult, setValidationResult] = useState<Result<string>>(Result.ok(''));
|
||||
const [validationResult, setValidationResult] = useState<ResultType<string>>(Result.ok(''));
|
||||
const isMounted = useIsMounted();
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
/// <reference types="@polkadot/dev-test/globals" />
|
||||
|
||||
/* global chrome */
|
||||
|
||||
import '@polkadot/extension-mocks/chrome';
|
||||
|
||||
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global chrome */
|
||||
/* eslint-disable no-redeclare */
|
||||
|
||||
import type { AccountJson, AllowedPath, AuthorizeRequest, ConnectedTabsUrlResponse, MessageTypes, MessageTypesWithNoSubscriptions, MessageTypesWithNullRequest, MessageTypesWithSubscriptions, MetadataRequest, RequestTypes, ResponseAuthorizeList, ResponseDeriveValidate, ResponseJsonGetAccountInfo, ResponseSigningIsLocked, ResponseTypes, SeedLengths, SigningRequest, SubscriptionMessageTypes } from '@polkadot/extension-base/background/types';
|
||||
import type { Message } from '@polkadot/extension-base/types';
|
||||
import type { Chain } from '@polkadot/extension-chains/types';
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
/// <reference types="@polkadot/dev-test/globals" />
|
||||
|
||||
/* eslint-disable jest/expect-expect */
|
||||
|
||||
import type { AccountJson, AccountWithChildren } from '@polkadot/extension-base/background/types';
|
||||
|
||||
import { buildHierarchy } from './buildHierarchy.js';
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2023 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type React from 'react';
|
||||
|
||||
interface Option {
|
||||
info?: string;
|
||||
isDisabled?: boolean;
|
||||
|
||||
@@ -5,23 +5,23 @@ interface InputError {
|
||||
errorDescription: string;
|
||||
}
|
||||
|
||||
export type Result<T> = { error: InputError } | { ok: T };
|
||||
export type ResultType<T> = { error: InputError } | { ok: T };
|
||||
|
||||
export declare type Validator<T> = (value: T) => ResultType<T> | Promise<ResultType<T>>;
|
||||
|
||||
export const Result = {
|
||||
error: <T>(errorDescription: string): Result<T> => ({ error: { errorDescription } }),
|
||||
isError<T> (value: Result<T>): value is ({ error: InputError }) {
|
||||
error: <T>(errorDescription: string): ResultType<T> => ({ error: { errorDescription } }),
|
||||
isError<T> (value: ResultType<T>): value is ({ error: InputError }) {
|
||||
return Object.hasOwnProperty.call(value, 'error');
|
||||
},
|
||||
isOk<T> (value: Result<T>): value is ({ ok: T }) {
|
||||
isOk<T> (value: ResultType<T>): value is ({ ok: T }) {
|
||||
return Object.hasOwnProperty.call(value, 'ok');
|
||||
},
|
||||
ok: <T>(ok: T): Result<T> => ({ ok })
|
||||
ok: <T>(ok: T): ResultType<T> => ({ ok })
|
||||
};
|
||||
|
||||
export declare type Validator<T> = (value: T) => Result<T> | Promise<Result<T>>;
|
||||
|
||||
export function allOf <T> (...validators: Validator<T>[]): Validator<T> {
|
||||
return async (value: T): Promise<Result<T>> => {
|
||||
return async (value: T): Promise<ResultType<T>> => {
|
||||
for (const validator of validators) {
|
||||
const validationResult = await validator(value);
|
||||
|
||||
@@ -35,7 +35,7 @@ export function allOf <T> (...validators: Validator<T>[]): Validator<T> {
|
||||
}
|
||||
|
||||
export function isNotShorterThan (minLength: number, errorText: string): Validator<string> {
|
||||
return (value: string): Result<string> => {
|
||||
return (value: string): ResultType<string> => {
|
||||
return value.length < minLength
|
||||
? Result.error(errorText)
|
||||
: Result.ok(value);
|
||||
@@ -43,7 +43,7 @@ export function isNotShorterThan (minLength: number, errorText: string): Validat
|
||||
}
|
||||
|
||||
export function isSameAs <T> (expectedValue: T, errorText: string): Validator<T> {
|
||||
return (value: T): Result<T> => {
|
||||
return (value: T): ResultType<T> => {
|
||||
return value !== expectedValue
|
||||
? Result.error(errorText)
|
||||
: Result.ok(value);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"tslib": "^2.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/dev": "^0.74.1",
|
||||
"@polkadot/dev": "^0.75.4",
|
||||
"browser-resolve": "^2.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
// Runs in the extension background, handling all keyring access
|
||||
|
||||
/* global chrome */
|
||||
|
||||
import '@polkadot/extension-inject/crossenv';
|
||||
|
||||
import type { RequestSignatures, TransportRequestMessage } from '@polkadot/extension-base/background/types';
|
||||
|
||||
Reference in New Issue
Block a user