Bump dev (w/ eslint 8) (#4070)
* Bump dev (w/ eslint 8) * Additional linting * Additional * More lint fixes * Last batch * Additional * Cleanups
This commit is contained in:
+1
-1
@@ -29,7 +29,7 @@
|
||||
"@babel/core": "^7.15.8",
|
||||
"@babel/register": "^7.15.3",
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/dev": "^0.62.71",
|
||||
"@polkadot/dev": "^0.63.2",
|
||||
"@polkadot/ts": "^0.4.9",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^27.0.2",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { AnyJson, Registry } from '@polkadot/types/types';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
@@ -51,7 +51,7 @@ describe('Abi', (): void => {
|
||||
it(`initializes from a contract ABI (${abiName})`, (): void => {
|
||||
try {
|
||||
const messageIds = (abi.V1 ? abi.V1 : abi).spec.messages.map(({ name }) => Array.isArray(name) ? name[0] : name);
|
||||
const inkAbi = new Abi(abis[abiName]);
|
||||
const inkAbi = new Abi(abis[abiName] as AnyJson);
|
||||
|
||||
expect(inkAbi.messages.map(({ identifier }) => identifier)).toEqual(messageIds);
|
||||
} catch (error) {
|
||||
@@ -66,7 +66,7 @@ describe('Abi', (): void => {
|
||||
describe('TypeDef', (): void => {
|
||||
Object.keys(abis).forEach((abiName) => {
|
||||
it(`initializes from a contract ABI (${abiName})`, (): void => {
|
||||
const abi = new Abi(abis[abiName]);
|
||||
const abi = new Abi(abis[abiName] as AnyJson);
|
||||
const json = stringifyJson(abi.registry);
|
||||
const cmpPath = path.join(__dirname, `../../test/compare/${abiName}.test.json`);
|
||||
|
||||
@@ -88,7 +88,7 @@ describe('Abi', (): void => {
|
||||
|
||||
it('has the correct hash for the source', (): void => {
|
||||
const bundle = abis.ink_v0_flipperBundle as JSONAbi;
|
||||
const abi = new Abi(bundle as any);
|
||||
const abi = new Abi(bundle as unknown as AnyJson);
|
||||
|
||||
// manual
|
||||
expect(bundle.source.hash).toEqual(blake2AsHex(bundle.source.wasm));
|
||||
|
||||
@@ -173,7 +173,7 @@ export class Abi {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
#createEvent = (spec: ContractEventSpec, index: number): AbiEvent => {
|
||||
const args = this.#createArgs(spec.args, spec);
|
||||
@@ -189,7 +189,7 @@ export class Abi {
|
||||
};
|
||||
|
||||
return event;
|
||||
}
|
||||
};
|
||||
|
||||
#createMessage = (spec: ContractMessageSpec | ContractConstructorSpec, index: number, add: Partial<AbiMessage> = {}): AbiMessage => {
|
||||
const args = this.#createArgs(spec.args, spec);
|
||||
@@ -211,7 +211,7 @@ export class Abi {
|
||||
};
|
||||
|
||||
return message;
|
||||
}
|
||||
};
|
||||
|
||||
#decodeArgs = (args: AbiParam[], data: Uint8Array): Codec[] => {
|
||||
// for decoding we expect the input to be just the arg data, no selectors
|
||||
@@ -225,7 +225,7 @@ export class Abi {
|
||||
|
||||
return value;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
#decodeMessage = (type: 'constructor' | 'message', list: AbiMessage[], data: Uint8Array): DecodedMessage => {
|
||||
const [, trimmed] = compactStripLength(data);
|
||||
@@ -235,7 +235,7 @@ export class Abi {
|
||||
assert(message, `Unable to find ${type} with selector ${u8aToHex(selector)}`);
|
||||
|
||||
return message.fromU8a(trimmed.subarray(4));
|
||||
}
|
||||
};
|
||||
|
||||
#encodeArgs = ({ name, selector }: ContractMessageSpec | ContractConstructorSpec, args: AbiParam[], data: unknown[]): Uint8Array => {
|
||||
assert(data.length === args.length, () => `Expected ${args.length} arguments to contract message '${name.toString()}', found ${data.length}`);
|
||||
@@ -248,5 +248,5 @@ export class Abi {
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -66,5 +66,5 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
new Contract<ApiType>(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod)
|
||||
))
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AnyJson } from '@polkadot/types/types';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
@@ -17,19 +19,19 @@ const v0wasmFlipper = fs.readFileSync(path.join(__dirname, '../../test/contracts
|
||||
describe('Code', (): void => {
|
||||
it('can construct with an individual ABI/WASM combo', (): void => {
|
||||
expect(
|
||||
() => new Code(mockApi, v0abiFlipper, v0wasmFlipper, decorateMethodPromise)
|
||||
() => new Code(mockApi, v0abiFlipper as AnyJson, v0wasmFlipper, decorateMethodPromise)
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it('can construct with an .contract ABI (v0)', (): void => {
|
||||
expect(
|
||||
() => new Code(mockApi, v0contractFlipper, null, decorateMethodPromise)
|
||||
() => new Code(mockApi, v0contractFlipper as AnyJson, null, decorateMethodPromise)
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it.only('can construct with an .contract ABI (v1)', (): void => {
|
||||
expect(
|
||||
() => new Code(mockApi, v1contractFlipper, null, decorateMethodPromise)
|
||||
() => new Code(mockApi, v1contractFlipper as AnyJson, null, decorateMethodPromise)
|
||||
).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -76,5 +76,5 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
[])
|
||||
) || []))
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
: this.api.consts.system.maximumBlockWeight as Weight
|
||||
).muln(64).div(BN_HUNDRED)
|
||||
: gasLimit;
|
||||
}
|
||||
};
|
||||
|
||||
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: unknown[]): SubmittableExtrinsic<ApiType> => {
|
||||
return this.api.tx.contracts
|
||||
@@ -126,7 +126,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
.filter((decoded): decoded is DecodedEvent => !!decoded)
|
||||
))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: unknown[]): ContractCallSend<ApiType> => {
|
||||
assert(this.hasRpcContractsCall, ERROR_NO_CALL);
|
||||
@@ -159,5 +159,5 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
)
|
||||
)
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
// Simple non-runnable checks to test type definitions in the editor itself
|
||||
|
||||
import type { AnyJson } from '@polkadot/types/types';
|
||||
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { createTestPairs, TestKeyringMap } from '@polkadot/keyring/testingPairs';
|
||||
|
||||
@@ -10,7 +12,7 @@ import abiIncrementer from '../test/contracts/ink/incrementer.json';
|
||||
import { BlueprintPromise, ContractPromise } from '.';
|
||||
|
||||
async function checkBlueprint (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
|
||||
const blueprint = new BlueprintPromise(api, abiIncrementer, '0x1234');
|
||||
const blueprint = new BlueprintPromise(api, abiIncrementer as AnyJson, '0x1234');
|
||||
|
||||
// new style
|
||||
await blueprint.tx.new({ gasLimit: 456, salt: '0x1234', value: 123 }, 42).signAndSend(pairs.bob);
|
||||
@@ -21,7 +23,7 @@ async function checkBlueprint (api: ApiPromise, pairs: TestKeyringMap): Promise<
|
||||
}
|
||||
|
||||
async function checkContract (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
|
||||
const contract = new ContractPromise(api, abiIncrementer, '0x1234');
|
||||
const contract = new ContractPromise(api, abiIncrementer as AnyJson, '0x1234');
|
||||
|
||||
// queries
|
||||
await contract.query.get(pairs.alice.address, {});
|
||||
|
||||
@@ -48,7 +48,7 @@ export function stakerExposures (instanceId: string, api: ApiInterfaceRx): (acco
|
||||
|
||||
export function stakerExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerExposure[]> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerExposure[]> =>
|
||||
api.derive.staking.stakerExposures([accountId, withActive]).pipe(
|
||||
api.derive.staking.stakerExposures([accountId], withActive).pipe(
|
||||
map(([first]) => first)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -18,7 +18,7 @@ function wrapCache (keyStart: string, cache: DeriveCache): DeriveCache {
|
||||
return {
|
||||
del: (partial: string): void => cache.del(`${keyStart}${partial}`),
|
||||
forEach: cache.forEach,
|
||||
get: <T = any> (partial: string): T | undefined => {
|
||||
get: <T> (partial: string): T | undefined => {
|
||||
const key = `${keyStart}${partial}`;
|
||||
const cached = cache.get<CacheValue<T>>(key);
|
||||
|
||||
@@ -40,7 +40,7 @@ function wrapCache (keyStart: string, cache: DeriveCache): DeriveCache {
|
||||
function clearCache (cache: DeriveCache): void {
|
||||
// clear all expired values
|
||||
const now = Date.now();
|
||||
const all: any[] = [];
|
||||
const all: string[] = [];
|
||||
|
||||
cache.forEach((key: string, { x }: CacheValue<any>): void => {
|
||||
((now - x) > CHACHE_EXPIRY) && all.push(key);
|
||||
|
||||
@@ -21,5 +21,5 @@ export class ProposalFactory {
|
||||
|
||||
public proposalIndex = (index: number): ProposalIndex => {
|
||||
return this.#registry.createType('ProposalIndex', index);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
method.is(other);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return this._decorateFunctionMeta(method as any, decorated as any) as unknown as SubmittableExtrinsicFunction<ApiType>;
|
||||
return this._decorateFunctionMeta(method as unknown as MetaDecoration, decorated as unknown as MetaDecoration) as unknown as SubmittableExtrinsicFunction<ApiType>;
|
||||
}
|
||||
|
||||
protected _decorateStorage<ApiType extends ApiTypes> ({ query }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>): QueryableStorage<ApiType> {
|
||||
@@ -479,7 +479,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
// Disable this where it occurs for each field we are decorating
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
const decorated = this._decorateStorageCall(creator, decorateMethod);
|
||||
const decorated: AugmentedQuery<'rxjs', GenericStorageEntryFunction, AnyTuple> & MetaDecoration = this._decorateStorageCall(creator, decorateMethod);
|
||||
|
||||
decorated.creator = creator;
|
||||
|
||||
@@ -551,7 +551,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
/* eslint-enable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
return this._decorateFunctionMeta(creator as any, decorated) as unknown as QueryableStorageEntry<ApiType>;
|
||||
return this._decorateFunctionMeta(creator as unknown as MetaDecoration, decorated) as unknown as QueryableStorageEntry<ApiType>;
|
||||
}
|
||||
|
||||
private _decorateStorageEntryAt<ApiType extends ApiTypes> (registry: Registry, creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>, blockHash: Uint8Array): QueryableStorageEntryAt<ApiType> {
|
||||
@@ -560,7 +560,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
// Disable this where it occurs for each field we are decorating
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
const decorated = decorateMethod((...args: unknown[]): Observable<Codec> =>
|
||||
const decorated: AugmentedQuery<'rxjs', GenericStorageEntryFunction, AnyTuple> & MetaDecoration = decorateMethod((...args: unknown[]): Observable<Codec> =>
|
||||
this._rpcCore.state.getStorage(getArgs(args), blockHash));
|
||||
|
||||
decorated.creator = creator;
|
||||
@@ -598,7 +598,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
/* eslint-enable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
return this._decorateFunctionMeta(creator as any, decorated) as unknown as QueryableStorageEntry<ApiType>;
|
||||
return this._decorateFunctionMeta(creator as unknown as MetaDecoration, decorated) as unknown as QueryableStorageEntry<ApiType>;
|
||||
}
|
||||
|
||||
// Decorate the base storage call. In the case or rxjs or promise-without-callback (await)
|
||||
@@ -735,5 +735,5 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
*/
|
||||
protected _rxDecorateMethod = <Method extends AnyFunction>(method: Method): Method => {
|
||||
return method;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import EventEmitter from 'eventemitter3';
|
||||
export class Events {
|
||||
#eventemitter = new EventEmitter();
|
||||
|
||||
protected emit (type: ApiInterfaceEvents, ...args: any[]): boolean {
|
||||
protected emit (type: ApiInterfaceEvents, ...args: unknown[]): boolean {
|
||||
return this.#eventemitter.emit(type, ...args);
|
||||
}
|
||||
|
||||
|
||||
@@ -405,7 +405,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
|
||||
this.emit('error', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#onProviderDisconnect = (): void => {
|
||||
this._isConnected.next(false);
|
||||
|
||||
@@ -6,13 +6,13 @@ import type { UnsubscribePromise } from '../types';
|
||||
|
||||
import { isFunction } from '@polkadot/util';
|
||||
|
||||
export type CombinatorCallback <T extends any[]> = Callback<T>;
|
||||
export type CombinatorCallback <T extends unknown[]> = Callback<T>;
|
||||
|
||||
export interface CombinatorFunction {
|
||||
(cb: Callback<any>): UnsubscribePromise;
|
||||
}
|
||||
|
||||
export class Combinator<T extends any[] = any[]> {
|
||||
export class Combinator<T extends unknown[] = unknown[]> {
|
||||
#allHasFired = false;
|
||||
|
||||
#callback: CombinatorCallback<T>;
|
||||
@@ -23,11 +23,11 @@ export class Combinator<T extends any[] = any[]> {
|
||||
|
||||
#isActive = true;
|
||||
|
||||
#results: any[] = [];
|
||||
#results: unknown[] = [];
|
||||
|
||||
#subscriptions: UnsubscribePromise[] = [];
|
||||
|
||||
constructor (fns: (CombinatorFunction | [CombinatorFunction, ...any[]])[], callback: CombinatorCallback<T>) {
|
||||
constructor (fns: (CombinatorFunction | [CombinatorFunction, ...unknown[]])[], callback: CombinatorCallback<T>) {
|
||||
this.#callback = callback;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
@@ -66,7 +66,7 @@ function decorateCall<Method extends DecorateFn<ObsInnerType<ReturnType<Method>>
|
||||
|
||||
// encoding errors reject immediately, any result unsubscribes and resolves
|
||||
const subscription: Subscription = method(...actualArgs).pipe(
|
||||
catchError((error) => tracker.reject(error))
|
||||
catchError((error: Error) => tracker.reject(error))
|
||||
).subscribe((result): void => {
|
||||
tracker.resolve(result);
|
||||
setTimeout(() => subscription.unsubscribe(), 0);
|
||||
@@ -82,7 +82,7 @@ function decorateSubscribe<Method extends DecorateFn<ObsInnerType<ReturnType<Met
|
||||
|
||||
// errors reject immediately, the first result resolves with an unsubscribe promise, all results via callback
|
||||
const subscription: Subscription = method(...actualArgs).pipe(
|
||||
catchError((error) => tracker.reject(error)),
|
||||
catchError((error: Error) => tracker.reject(error)),
|
||||
tap(() => tracker.resolve(() => subscription.unsubscribe()))
|
||||
).subscribe((result): void => {
|
||||
// queue result (back of queue to clear current)
|
||||
@@ -255,7 +255,7 @@ export class ApiPromise extends ApiBase<'promise'> {
|
||||
const tracker = promiseTracker(resolve, reject);
|
||||
|
||||
super.once('ready', () => tracker.resolve(this));
|
||||
super.once('error', (e) => tracker.reject(e));
|
||||
super.once('error', (error: Error) => tracker.reject(error));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
/* eslint-disable no-dupe-class-members */
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { Observable, OperatorFunction } from 'rxjs';
|
||||
import type { Address, ApplyExtrinsicResult, Call, Extrinsic, ExtrinsicEra, ExtrinsicStatus, Hash, Header, Index, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
|
||||
import type { Callback, Codec, Constructor, IKeyringPair, ISubmittableResult, Registry, SignatureOptions } from '@polkadot/types/types';
|
||||
import type { ApiInterfaceRx, ApiTypes, SignerResult } from '../types';
|
||||
@@ -123,7 +123,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call
|
||||
return decorateMethod(
|
||||
(): Observable<this> =>
|
||||
this.#observeSign(account, optionsOrNonce).pipe(mapTo(this))
|
||||
this.#observeSign(account, optionsOrNonce).pipe(mapTo(this) as OperatorFunction<number | undefined, this>)
|
||||
)();
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
}),
|
||||
nonce
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
#makeSignOptions = (options: Partial<SignerOptions>, extras: { blockHash?: Hash; era?: ExtrinsicEra; nonce?: Index }): SignatureOptions => {
|
||||
return {
|
||||
@@ -193,7 +193,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
signedExtensions: api.registry.signedExtensions,
|
||||
version: api.extrinsicType
|
||||
} as SignatureOptions;
|
||||
}
|
||||
};
|
||||
|
||||
#makeSignAndSendOptions = (optionsOrStatus?: Partial<SignerOptions> | Callback<ISubmittableResult>, statusCb?: Callback<ISubmittableResult>): [Partial<SignerOptions>, Callback<ISubmittableResult>?] => {
|
||||
let options: Partial<SignerOptions> = {};
|
||||
@@ -205,7 +205,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
}
|
||||
|
||||
return [options, statusCb];
|
||||
}
|
||||
};
|
||||
|
||||
#observeSign = (account: AddressOrPair, optionsOrNonce?: Partial<SignerOptions>): Observable<number | undefined> => {
|
||||
const address = isKeyringPair(account) ? account.address : account.toString();
|
||||
@@ -223,9 +223,9 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
updateId = await this.#signViaSigner(address, eraOptions, signingInfo.header);
|
||||
}
|
||||
}),
|
||||
mapTo(updateId)
|
||||
mapTo(updateId) as OperatorFunction<void, number | undefined>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#observeStatus = (hash: Hash, status: ExtrinsicStatus): Observable<ISubmittableResult> => {
|
||||
if (!status.isFinalized && !status.isInBlock) {
|
||||
@@ -247,7 +247,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
of(this.#transformResult(new SubmittableResult({ internalError, status })))
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#observeSend = (updateId = -1): Observable<Hash> => {
|
||||
return api.rpc.author.submitExtrinsic(this).pipe(
|
||||
@@ -255,7 +255,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
this.#updateSigner(updateId, hash);
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#observeSubscribe = (updateId = -1): Observable<ISubmittableResult> => {
|
||||
const hash = this.hash;
|
||||
@@ -268,7 +268,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
this.#updateSigner(updateId, status);
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// NOTE here we actually override nonce if it was specified (backwards compat for
|
||||
// the previous signature - don't let user space break, but allow then time to upgrade)
|
||||
@@ -276,7 +276,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
return isBn(optionsOrNonce) || isNumber(optionsOrNonce)
|
||||
? { nonce: optionsOrNonce }
|
||||
: optionsOrNonce;
|
||||
}
|
||||
};
|
||||
|
||||
#signViaSigner = async (address: Address | string | Uint8Array, options: SignatureOptions, header: Header | null): Promise<number> => {
|
||||
const signer = options.signer || api.signer;
|
||||
@@ -305,13 +305,13 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
super.addSignature(address, result.signature, payload.toPayload());
|
||||
|
||||
return result.id;
|
||||
}
|
||||
};
|
||||
|
||||
#updateSigner = (updateId: number, status: Hash | ISubmittableResult): void => {
|
||||
if ((updateId !== -1) && api.signer && api.signer.update) {
|
||||
api.signer.update(updateId, status);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return Submittable;
|
||||
|
||||
@@ -45,9 +45,7 @@ type RawResult = [
|
||||
AccountInfo
|
||||
];
|
||||
|
||||
type EQDeriveBalancesQuery = (
|
||||
address: AccountIndex | AccountId | Address | string
|
||||
) => Observable<EQDeriveBalancesAll>;
|
||||
type EQDeriveBalancesQuery = (address: AccountIndex | AccountId | Address | string) => Observable<EQDeriveBalancesAll>;
|
||||
|
||||
const typesBundle = {
|
||||
spec: {
|
||||
|
||||
@@ -225,7 +225,7 @@ export class RpcCore {
|
||||
observer.next(value);
|
||||
observer.complete();
|
||||
})
|
||||
.catch((error): void => {
|
||||
.catch((error: Error): void => {
|
||||
logErrorMessage(method, def, error);
|
||||
|
||||
observer.error(error);
|
||||
@@ -255,7 +255,7 @@ export class RpcCore {
|
||||
this.provider
|
||||
.subscribe(subType, subName, paramsJson, update)
|
||||
.then(resolve)
|
||||
.catch((error): void => {
|
||||
.catch((error: Error): void => {
|
||||
errorHandler(error);
|
||||
reject(error);
|
||||
});
|
||||
@@ -283,7 +283,7 @@ export class RpcCore {
|
||||
|
||||
try {
|
||||
const params = this._formatInputs(registry, null, def, values);
|
||||
const paramsJson = params.map((param): AnyJson => param.toJSON());
|
||||
const paramsJson = params.map((param) => param.toJSON());
|
||||
|
||||
const update = (error?: Error | null, result?: T): void => {
|
||||
if (error) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ProviderInterface } from '@polkadot/rpc-provider/types';
|
||||
|
||||
import { MockProvider } from '@polkadot/rpc-provider/mock';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import { isFunction } from '@polkadot/util';
|
||||
@@ -12,7 +14,7 @@ describe('Api', (): void => {
|
||||
|
||||
it('requires a provider with a send method', (): void => {
|
||||
expect(
|
||||
() => new RpcCore('234', registry, {} as any)
|
||||
() => new RpcCore('234', registry, {} as unknown as ProviderInterface)
|
||||
).toThrow(/Expected Provider/);
|
||||
});
|
||||
|
||||
@@ -28,8 +30,7 @@ describe('Api', (): void => {
|
||||
}
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
expect(isFunction((rpc as any).testing.foo)).toBe(true);
|
||||
expect(isFunction((rpc as unknown as Record<string, Record<string, boolean>>).testing.foo)).toBe(true);
|
||||
expect(rpc.sections.includes('testing')).toBe(true);
|
||||
expect(rpc.mapping.get('testing_foo')).toEqual({
|
||||
description: 'foo',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ProviderInterface } from '@polkadot/rpc-provider/types';
|
||||
import type { DefinitionRpc } from '@polkadot/types/types';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
@@ -11,7 +12,7 @@ describe('methodSend', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
let rpc: RpcCore;
|
||||
let methods: Record<string, DefinitionRpc>;
|
||||
let provider: any;
|
||||
let provider: ProviderInterface;
|
||||
|
||||
beforeEach((): void => {
|
||||
methods = {
|
||||
@@ -30,10 +31,10 @@ describe('methodSend', (): void => {
|
||||
};
|
||||
|
||||
provider = {
|
||||
send: jest.fn((method, params: any[]): Promise<any> => {
|
||||
return Promise.resolve(params[0]);
|
||||
})
|
||||
};
|
||||
send: jest.fn((method: string, params: unknown[]): Promise<unknown> =>
|
||||
Promise.resolve(params[0])
|
||||
)
|
||||
} as unknown as ProviderInterface;
|
||||
|
||||
rpc = new RpcCore('987', registry, provider);
|
||||
});
|
||||
|
||||
@@ -10,18 +10,19 @@ import { memoize } from '@polkadot/util';
|
||||
|
||||
import { drr } from './drr';
|
||||
|
||||
type ObsFn <T> = (...params: any[]) => Observable<T>;
|
||||
type ObsFn <T> = (...params: unknown[]) => Observable<T>;
|
||||
|
||||
// Wraps a derive, doing 2 things to optimize calls -
|
||||
// 1. creates a memo of the inner fn -> Observable, removing when unsubscribed
|
||||
// 2. wraps the observable in a drr() (which includes an unsub delay)
|
||||
/** @internal */
|
||||
export function memo <T> (instanceId: string, inner: ObsFn<T>): Memoized<ObsFn<T>> {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function memo <T> (instanceId: string, inner: Function): Memoized<ObsFn<T>> {
|
||||
const options = { getInstanceId: () => instanceId };
|
||||
const cached = memoize(
|
||||
(...params: any[]): Observable<T> =>
|
||||
(...params: unknown[]): Observable<T> =>
|
||||
new Observable((observer: Observer<T>): TeardownLogic => {
|
||||
const subscription = inner(...params).subscribe(observer);
|
||||
const subscription = (inner as ObsFn<T>)(...params).subscribe(observer);
|
||||
|
||||
return (): void => {
|
||||
cached.unmemoize(...params);
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('encodeJson', (): void => {
|
||||
|
||||
it('encodes a valid JsonRPC JSON string', (): void => {
|
||||
expect(
|
||||
coder.encodeJson('method', 'params')
|
||||
).toEqual('{"id":1,"jsonrpc":"2.0","method":"method","params":"params"}');
|
||||
coder.encodeJson('method', ['params'])
|
||||
).toEqual('{"id":1,"jsonrpc":"2.0","method":"method","params":["params"]}');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ export class RpcCoder {
|
||||
return response.result;
|
||||
}
|
||||
|
||||
public encodeJson (method: string, params: any | any[]): string {
|
||||
public encodeJson (method: string, params: unknown[]): string {
|
||||
return stringify(
|
||||
this.encodeObject(method, params)
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/rpc-provider authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '../types';
|
||||
import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '../types';
|
||||
|
||||
import { assert, logger } from '@polkadot/util';
|
||||
import { fetch } from '@polkadot/x-fetch';
|
||||
@@ -103,7 +103,7 @@ export class HttpProvider implements ProviderInterface {
|
||||
/**
|
||||
* @summary Send HTTP POST Request with Body to configured HTTP Endpoint.
|
||||
*/
|
||||
public async send <T = any> (method: string, params: unknown[]): Promise<T> {
|
||||
public async send <T> (method: string, params: unknown[]): Promise<T> {
|
||||
const body = this.#coder.encodeJson(method, params);
|
||||
const response = await fetch(this.#endpoint, {
|
||||
body,
|
||||
@@ -118,8 +118,7 @@ export class HttpProvider implements ProviderInterface {
|
||||
|
||||
assert(response.ok, () => `[${response.status}]: ${response.statusText}`);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const result = await response.json();
|
||||
const result = (await response.json()) as JsonRpcResponse;
|
||||
|
||||
return this.#coder.decodeResponse(result) as T;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/rpc-provider authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Request } from '../../test/mockWs';
|
||||
|
||||
import { mockWs } from '../../test/mockWs';
|
||||
import { Mock } from './../mock/types';
|
||||
import { WsProvider } from './';
|
||||
@@ -10,7 +12,7 @@ const TEST_WS_URL = 'ws://localhost-index.spec.ts:9977';
|
||||
let provider: WsProvider | null;
|
||||
let mock: Mock;
|
||||
|
||||
function createWs (requests: any[], autoConnect = 1000, headers?: Record<string, string>): WsProvider {
|
||||
function createWs (requests: Request[], autoConnect = 1000, headers?: Record<string, string>): WsProvider {
|
||||
mock = mockWs(requests, TEST_WS_URL);
|
||||
provider = new WsProvider(TEST_WS_URL, autoConnect, headers);
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ export class WsProvider implements ProviderInterface {
|
||||
|
||||
#emit = (type: ProviderInterfaceEmitted, ...args: unknown[]): void => {
|
||||
this.#eventemitter.emit(type, ...args);
|
||||
}
|
||||
};
|
||||
|
||||
#onSocketClose = (event: CloseEvent): void => {
|
||||
const error = new Error(`disconnected from ${this.#endpoints[this.#endpointIndex]}: ${event.code}:: ${event.reason || getWSErrorString(event.code)}`);
|
||||
@@ -369,12 +369,12 @@ export class WsProvider implements ProviderInterface {
|
||||
});
|
||||
}, this.#autoConnectMs);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#onSocketError = (error: Event): void => {
|
||||
l.debug(() => ['socket error', error]);
|
||||
this.#emit('error', error);
|
||||
}
|
||||
};
|
||||
|
||||
#onSocketMessage = (message: MessageEvent<string>): void => {
|
||||
l.debug(() => ['received', message.data]);
|
||||
@@ -384,7 +384,7 @@ export class WsProvider implements ProviderInterface {
|
||||
return isUndefined(response.method)
|
||||
? this.#onSocketMessageResult(response)
|
||||
: this.#onSocketMessageSubscribe(response);
|
||||
}
|
||||
};
|
||||
|
||||
#onSocketMessageResult = (response: JsonRpcResponse): void => {
|
||||
const handler = this.#handlers[response.id];
|
||||
@@ -422,7 +422,7 @@ export class WsProvider implements ProviderInterface {
|
||||
}
|
||||
|
||||
delete this.#handlers[response.id];
|
||||
}
|
||||
};
|
||||
|
||||
#onSocketMessageSubscribe = (response: JsonRpcResponse): void => {
|
||||
const method = ALIASES[response.method as string] || response.method || 'invalid';
|
||||
@@ -448,7 +448,7 @@ export class WsProvider implements ProviderInterface {
|
||||
} catch (error) {
|
||||
handler.callback(error as Error, undefined);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#onSocketOpen = (): boolean => {
|
||||
assert(!isNull(this.#websocket), 'WebSocket cannot be null in onOpen');
|
||||
@@ -461,7 +461,7 @@ export class WsProvider implements ProviderInterface {
|
||||
this.#resubscribe();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#resubscribe = (): void => {
|
||||
const subscriptions = this.#subscriptions;
|
||||
@@ -484,5 +484,5 @@ export class WsProvider implements ProviderInterface {
|
||||
l.error(error);
|
||||
}
|
||||
})).catch(l.error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Constructor } from '@polkadot/types/types';
|
||||
import type { Request } from '../../test/mockWs';
|
||||
|
||||
import { mockWs } from '../../test/mockWs';
|
||||
import { Global, Mock } from './../mock/types';
|
||||
@@ -14,7 +15,7 @@ const TEST_WS_URL = 'ws://localhost-send.spec.ts:9965';
|
||||
let provider: WsProvider | null;
|
||||
let mock: Mock;
|
||||
|
||||
function createMock (requests: any[]): void {
|
||||
function createMock (requests: Request[]): void {
|
||||
mock = mockWs(requests, TEST_WS_URL);
|
||||
}
|
||||
|
||||
@@ -89,7 +90,8 @@ describe('send', (): void => {
|
||||
code: 666,
|
||||
message: 'error'
|
||||
},
|
||||
id: 1
|
||||
id: 1,
|
||||
method: 'something'
|
||||
}]);
|
||||
|
||||
return createWs().then((ws) =>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Constructor } from '@polkadot/types/types';
|
||||
import type { Request } from '../../test/mockWs';
|
||||
|
||||
import { mockWs } from '../../test/mockWs';
|
||||
import { Global, Mock } from './../mock/types';
|
||||
@@ -14,7 +15,7 @@ const TEST_WS_URL = 'ws://localhost-subscribe.test.ts:9933';
|
||||
let provider: WsProvider | null;
|
||||
let mock: Mock;
|
||||
|
||||
function createMock (requests: any[]): void {
|
||||
function createMock (requests: Request[]): void {
|
||||
mock = mockWs(requests, TEST_WS_URL);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Constructor } from '@polkadot/types/types';
|
||||
import type { Request } from '../../test/mockWs';
|
||||
|
||||
import { mockWs } from '../../test/mockWs';
|
||||
import { Global, Mock } from './../mock/types';
|
||||
@@ -14,7 +15,7 @@ const TEST_WS_URL = 'ws://localhost-unsubscribe.test.ts:9933';
|
||||
let provider: WsProvider | null;
|
||||
let mock: Mock;
|
||||
|
||||
function createMock (requests: any): void {
|
||||
function createMock (requests: Request[]): void {
|
||||
mock = mockWs(requests, TEST_WS_URL);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Server, WebSocket } from 'mock-socket';
|
||||
import { stringify } from '@polkadot/util';
|
||||
|
||||
interface Scope {
|
||||
body: { [index: string]: Record<string, any> };
|
||||
body: { [index: string]: Record<string, unknown> };
|
||||
requests: number;
|
||||
server: Server;
|
||||
done: any;
|
||||
@@ -27,12 +27,22 @@ interface ReplyDef {
|
||||
};
|
||||
}
|
||||
|
||||
interface RpcBase {
|
||||
id: number;
|
||||
jsonrpc: '2.0';
|
||||
}
|
||||
|
||||
type RpcError = RpcBase & ErrorDef;
|
||||
type RpcReply = RpcBase & { result: unknown };
|
||||
|
||||
export type Request = { method: string } & (ErrorDef | ReplyDef);
|
||||
|
||||
global.WebSocket = WebSocket as typeof global.WebSocket;
|
||||
|
||||
export const TEST_WS_URL = 'ws://localhost:9955';
|
||||
|
||||
// should be JSONRPC def return
|
||||
function createError ({ error: { code, message }, id }: ErrorDef): any {
|
||||
function createError ({ error: { code, message }, id }: ErrorDef): RpcError {
|
||||
return {
|
||||
error: {
|
||||
code,
|
||||
@@ -44,7 +54,7 @@ function createError ({ error: { code, message }, id }: ErrorDef): any {
|
||||
}
|
||||
|
||||
// should be JSONRPC def return
|
||||
function createReply ({ id, reply: { result } }: ReplyDef): any {
|
||||
function createReply ({ id, reply: { result } }: ReplyDef): RpcReply {
|
||||
return {
|
||||
id,
|
||||
jsonrpc: '2.0',
|
||||
@@ -53,7 +63,7 @@ function createReply ({ id, reply: { result } }: ReplyDef): any {
|
||||
}
|
||||
|
||||
// scope definition returned
|
||||
export function mockWs (requests: ({ method: string } & ErrorDef)[], wsUrl: string = TEST_WS_URL): Scope {
|
||||
export function mockWs (requests: Request[], wsUrl: string = TEST_WS_URL): Scope {
|
||||
const server = new Server(wsUrl);
|
||||
|
||||
let requestCount = 0;
|
||||
@@ -69,16 +79,13 @@ export function mockWs (requests: ({ method: string } & ErrorDef)[], wsUrl: stri
|
||||
};
|
||||
|
||||
server.on('connection', (socket): void => {
|
||||
// FIXME This whole any mess is a mess
|
||||
socket.on('message', (body: any): void => {
|
||||
const request: any = requests[requestCount];
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
||||
const response: any = request.error
|
||||
? createError(request)
|
||||
: createReply(request);
|
||||
socket.on('message', (body): void => {
|
||||
const request = requests[requestCount];
|
||||
const response = (request as ErrorDef).error
|
||||
? createError(request as ErrorDef)
|
||||
: createReply(request as ReplyDef);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
||||
scope.body[request.method] = body;
|
||||
scope.body[request.method] = body as unknown as Record<string, unknown>;
|
||||
requestCount++;
|
||||
|
||||
socket.send(stringify(response));
|
||||
|
||||
@@ -71,7 +71,7 @@ export function main (): void {
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
websocket.onerror = (event: any): void => {
|
||||
websocket.onerror = (event: unknown): void => {
|
||||
console.error(event);
|
||||
process.exit(1);
|
||||
};
|
||||
@@ -81,15 +81,14 @@ export function main (): void {
|
||||
websocket.send('{"id":"1","jsonrpc":"2.0","method":"state_getMetadata","params":[]}');
|
||||
};
|
||||
|
||||
websocket.onmessage = (message: any): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
generate(JSON.parse(message.data).result, pkg, output, isStrict);
|
||||
websocket.onmessage = (message: unknown): void => {
|
||||
generate((JSON.parse((message as Record<string, string>).data) as Record<string, string>).result, pkg, output, isStrict);
|
||||
};
|
||||
} catch (error) {
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-member-access
|
||||
generate(require(path.join(process.cwd(), endpoint)).result, pkg, output, isStrict);
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
generate((require(path.join(process.cwd(), endpoint)) as Record<string, string>).result, pkg, output, isStrict);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ const mockEnumSetObj = [
|
||||
|
||||
describe('BTreeSet', (): void => {
|
||||
describe('decoding', (): void => {
|
||||
const testDecode = (type: string, input: any, output: string): void =>
|
||||
const testDecode = (type: string, input: unknown, output: string): void =>
|
||||
it(`can decode from ${type}`, (): void => {
|
||||
const s = new BTreeSet(registry, U32, input);
|
||||
const s = new BTreeSet(registry, U32, input as string);
|
||||
|
||||
expect(s.toString()).toBe(output);
|
||||
});
|
||||
|
||||
@@ -31,9 +31,9 @@ const mockU32U32MapUint8Array = Uint8Array.from([16, 4, 49, 2, 0, 0, 0, 8, 50, 5
|
||||
|
||||
describe('CodecMap', (): void => {
|
||||
describe('decoding', (): void => {
|
||||
const testDecode = (type: string, input: any, output: string): void =>
|
||||
const testDecode = (type: string, input: unknown, output: string): void =>
|
||||
it(`can decode from ${type}`, (): void => {
|
||||
const s = new CodecMap(registry, Text, U32, input);
|
||||
const s = new CodecMap(registry, Text, U32, input as string);
|
||||
|
||||
expect(s.toString()).toBe(output);
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ function decodeMapFromU8a<K extends Codec, V extends Codec> (registry: Registry,
|
||||
function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, value: Map<any, any>): Map<K, V> {
|
||||
const output = new Map<K, V>();
|
||||
|
||||
value.forEach((val: any, key: any) => {
|
||||
value.forEach((val: unknown, key: unknown) => {
|
||||
const isComplex = KeyClass.prototype instanceof AbstractArray ||
|
||||
KeyClass.prototype instanceof Struct ||
|
||||
KeyClass.prototype instanceof Enum;
|
||||
@@ -45,7 +45,7 @@ function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry,
|
||||
output.set(
|
||||
key instanceof KeyClass
|
||||
? key
|
||||
: new KeyClass(registry, isComplex ? JSON.parse(key) : key),
|
||||
: new KeyClass(registry, isComplex ? JSON.parse(key as string) : key),
|
||||
val instanceof ValClass
|
||||
? val
|
||||
: new ValClass(registry, val)
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { CodecTo } from '../types';
|
||||
import type { AnyU8a, CodecTo } from '../types';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Raw } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
const testDecode = (type: string, input: any, expected: string): void =>
|
||||
const testDecode = (type: string, input: AnyU8a, expected: string): void =>
|
||||
it(`can decode from ${type}`, (): void => {
|
||||
const e = new Raw(registry, input);
|
||||
|
||||
expect(e.toString()).toBe(expected);
|
||||
});
|
||||
|
||||
const testEncode = (to: CodecTo, expected: any): void =>
|
||||
const testEncode = (to: CodecTo, expected: AnyU8a): void =>
|
||||
it(`can encode ${to}`, (): void => {
|
||||
const e = new Raw(registry, [1, 2, 3, 4, 5]);
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
!this.some((value, index) => value !== other[index]);
|
||||
}
|
||||
|
||||
return this.eq(u8aToU8a(other as any));
|
||||
return this.eq(u8aToU8a(other as string));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -156,7 +156,7 @@ export class CodecSet extends Set<string> implements ISet<string> {
|
||||
super.add(key);
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Compares the value of the input to see if there is a match
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import type { VoteThreshold } from '../interfaces/elections';
|
||||
import type { BlockNumber } from '../interfaces/runtime';
|
||||
import type { CodecTo } from '../types';
|
||||
import type { AnyTupleValue } from './Tuple';
|
||||
|
||||
import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
|
||||
|
||||
@@ -25,7 +26,7 @@ describe('Tuple', (): void => {
|
||||
});
|
||||
|
||||
describe('decoding', (): void => {
|
||||
const testDecode = (type: string, input: any): void =>
|
||||
const testDecode = (type: string, input: AnyTupleValue): void =>
|
||||
it(`can decode from ${type}`, (): void => {
|
||||
const t = new Tuple(registry, [
|
||||
Text,
|
||||
|
||||
@@ -8,7 +8,7 @@ import { isFunction, isHex, isString, isU8a, stringify, u8aConcat, u8aToU8a } fr
|
||||
import { AbstractArray } from './AbstractArray';
|
||||
import { decodeU8a, mapToTypeMap, typeToConstructor } from './utils';
|
||||
|
||||
type AnyTuple = AnyU8a | string | (Codec | AnyU8a | AnyNumber | AnyString | undefined | null)[];
|
||||
export type AnyTupleValue = AnyU8a | (Codec | AnyU8a | AnyNumber | AnyString | undefined | null)[];
|
||||
|
||||
type TupleConstructors = Constructor[] | {
|
||||
[index: string]: Constructor;
|
||||
@@ -21,7 +21,7 @@ type TupleTypes = TupleType[] | {
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: AnyTuple): Codec[] {
|
||||
function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: AnyTupleValue): Codec[] {
|
||||
if (isU8a(value) || isHex(value)) {
|
||||
return decodeU8a(registry, u8aToU8a(value), _Types);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: Any
|
||||
export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
||||
private _Types: TupleConstructors;
|
||||
|
||||
constructor (registry: Registry, Types: TupleTypes | TupleType, value?: AnyTuple) {
|
||||
constructor (registry: Registry, Types: TupleTypes | TupleType, value?: AnyTupleValue) {
|
||||
const Clazzes = Array.isArray(Types)
|
||||
? Types.map((t) => typeToConstructor(registry, t))
|
||||
: isFunction(Types) || isString(Types)
|
||||
@@ -68,7 +68,7 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
||||
|
||||
public static with (Types: TupleTypes | TupleType): Constructor<Tuple> {
|
||||
return class extends Tuple {
|
||||
constructor (registry: Registry, value?: AnyTuple) {
|
||||
constructor (registry: Registry, value?: AnyTupleValue) {
|
||||
super(registry, Types, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,22 +13,23 @@ function hasMismatch (a?: unknown, b?: unknown): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
function notEntry (value: any): boolean {
|
||||
function notEntry (value: unknown): boolean {
|
||||
return !Array.isArray(value) || value.length !== 2;
|
||||
}
|
||||
|
||||
function compareMapArray (a: Map<any, any>, b: [any, any][]): boolean {
|
||||
function compareMapArray (a: Map<unknown, unknown>, b: [unknown, unknown][]): boolean {
|
||||
// equal number of entries and each entry in the array should match
|
||||
return (a.size === b.length) && !b.some((entry): boolean =>
|
||||
notEntry(entry) || hasMismatch(a.get(entry[0]), entry[1])
|
||||
return (a.size === b.length) && !b.some((entry) =>
|
||||
notEntry(entry) ||
|
||||
hasMismatch(a.get(entry[0]), entry[1])
|
||||
);
|
||||
}
|
||||
|
||||
// NOTE These are used internally and when comparing objects, expects that
|
||||
// when the second is an Map<string, Codec> that the first has to be as well
|
||||
export function compareMap (a: Map<any, any>, b?: unknown): boolean {
|
||||
export function compareMap (a: Map<unknown, unknown>, b?: unknown): boolean {
|
||||
if (Array.isArray(b)) {
|
||||
return compareMapArray(a, b);
|
||||
return compareMapArray(a, b as [unknown, unknown][]);
|
||||
} else if (b instanceof Map) {
|
||||
return compareMapArray(a, [...b.entries()]);
|
||||
} else if (isObject(b)) {
|
||||
|
||||
@@ -88,14 +88,13 @@ function _decodeSet (value: TypeDef, details: Record<string, number>): TypeDef {
|
||||
// decode a struct, set or enum
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function _decodeStruct (value: TypeDef, type: string, _: string, count: number): TypeDef {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const parsed: Record<string, any> = JSON.parse(type);
|
||||
const parsed = JSON.parse(type) as Record<string, unknown> & { _alias: string };
|
||||
const keys = Object.keys(parsed);
|
||||
|
||||
if (keys.length === 1 && keys[0] === '_enum') {
|
||||
return _decodeEnum(value, parsed[keys[0]], count);
|
||||
return _decodeEnum(value, parsed[keys[0]] as string[], count);
|
||||
} else if (keys.length === 1 && keys[0] === '_set') {
|
||||
return _decodeSet(value, parsed[keys[0]]);
|
||||
return _decodeSet(value, parsed[keys[0]] as Record<string, number>);
|
||||
}
|
||||
|
||||
value.alias = parsed._alias
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
/* eslint-disable sort-keys */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
|
||||
import type { BlockValue } from './Block';
|
||||
|
||||
import block00300 from '@polkadot/types-support/json/SignedBlock.003.00.json';
|
||||
import metadataStatic from '@polkadot/types-support/metadata/static-substrate';
|
||||
|
||||
@@ -11,6 +13,12 @@ import { TypeRegistry } from '../create';
|
||||
import { Metadata } from '../metadata';
|
||||
import { GenericBlock as Block } from './Block';
|
||||
|
||||
interface BlockJson {
|
||||
result: {
|
||||
block: BlockValue;
|
||||
};
|
||||
}
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
const metadata = new Metadata(registry, metadataStatic);
|
||||
|
||||
@@ -30,9 +38,9 @@ describe('Block', (): void => {
|
||||
});
|
||||
|
||||
it('re-encodes digest items correctly', (): void => {
|
||||
const digest = new Block(registry, block00300.result.block).header.digest;
|
||||
const digest = new Block(registry, (block00300 as BlockJson).result.block).header.digest;
|
||||
|
||||
expect(digest.logs[0].toHex()).toEqual(block00300.result.block.header.digest.logs[0]);
|
||||
expect(digest.logs[1].toHex()).toEqual(block00300.result.block.header.digest.logs[1]);
|
||||
expect(digest.logs[0].toHex()).toEqual((block00300 as BlockJson).result.block.header?.digest?.logs[0]);
|
||||
expect(digest.logs[1].toHex()).toEqual((block00300 as BlockJson).result.block.header?.digest?.logs[1]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ export class MetadataVersioned extends Struct {
|
||||
*/
|
||||
#metadata = (): MetadataAll => {
|
||||
return this.get('metadata') as MetadataAll;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Returns the wrapped metadata as a limited calls-only (latest) version
|
||||
|
||||
@@ -76,7 +76,7 @@ export type __ToTuple<O extends Codec[]> =
|
||||
: O[0]
|
||||
: Null;
|
||||
|
||||
export type __CodecFirst<K extends unknown> =
|
||||
export type __CodecFirst<K> =
|
||||
K extends keyof InterfaceTypes
|
||||
? InterfaceTypes[K]
|
||||
: K extends unknown[]
|
||||
@@ -85,7 +85,7 @@ export type __CodecFirst<K extends unknown> =
|
||||
? __ToStruct<K>
|
||||
: Codec;
|
||||
|
||||
export type __CodecsNext<K extends unknown, C extends Codec[]> =
|
||||
export type __CodecsNext<K, C extends Codec[]> =
|
||||
K extends __WrapOne
|
||||
? C extends [Codec, ...infer X]
|
||||
? [__MapWrapOne<C[0]>[K], ...X]
|
||||
|
||||
@@ -32,15 +32,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@babel/code-frame@npm:7.12.11":
|
||||
version: 7.12.11
|
||||
resolution: "@babel/code-frame@npm:7.12.11"
|
||||
dependencies:
|
||||
"@babel/highlight": ^7.10.4
|
||||
checksum: 3963eff3ebfb0e091c7e6f99596ef4b258683e4ba8a134e4e95f77afe85be5c931e184fff6435fb4885d12eba04a5e25532f7fbc292ca13b48e7da943474e2f3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.14.5, @babel/code-frame@npm:^7.15.8":
|
||||
version: 7.15.8
|
||||
resolution: "@babel/code-frame@npm:7.15.8"
|
||||
@@ -345,7 +336,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@babel/highlight@npm:^7.10.4, @babel/highlight@npm:^7.14.5":
|
||||
"@babel/highlight@npm:^7.14.5":
|
||||
version: 7.14.5
|
||||
resolution: "@babel/highlight@npm:7.14.5"
|
||||
dependencies:
|
||||
@@ -1414,31 +1405,31 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@eslint/eslintrc@npm:^0.4.3":
|
||||
version: 0.4.3
|
||||
resolution: "@eslint/eslintrc@npm:0.4.3"
|
||||
"@eslint/eslintrc@npm:^1.0.3":
|
||||
version: 1.0.3
|
||||
resolution: "@eslint/eslintrc@npm:1.0.3"
|
||||
dependencies:
|
||||
ajv: ^6.12.4
|
||||
debug: ^4.1.1
|
||||
espree: ^7.3.0
|
||||
debug: ^4.3.2
|
||||
espree: ^9.0.0
|
||||
globals: ^13.9.0
|
||||
ignore: ^4.0.6
|
||||
import-fresh: ^3.2.1
|
||||
js-yaml: ^3.13.1
|
||||
minimatch: ^3.0.4
|
||||
strip-json-comments: ^3.1.1
|
||||
checksum: 03a7704150b868c318aab6a94d87a33d30dc2ec579d27374575014f06237ba1370ae11178db772f985ef680d469dc237e7b16a1c5d8edaaeb8c3733e7a95a6d3
|
||||
checksum: a39f74d764b1b8ba8b05e942ab8dc3684648468180ce453e0ce5669af3d95b9dc18577ff55cc3b58cfed5a5f1bf6182191a740da07572606268eeb2b6fd0402d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@humanwhocodes/config-array@npm:^0.5.0":
|
||||
version: 0.5.0
|
||||
resolution: "@humanwhocodes/config-array@npm:0.5.0"
|
||||
"@humanwhocodes/config-array@npm:^0.6.0":
|
||||
version: 0.6.0
|
||||
resolution: "@humanwhocodes/config-array@npm:0.6.0"
|
||||
dependencies:
|
||||
"@humanwhocodes/object-schema": ^1.2.0
|
||||
debug: ^4.1.1
|
||||
minimatch: ^3.0.4
|
||||
checksum: 44ee6a9f05d93dd9d5935a006b17572328ba9caff8002442f601736cbda79c580cc0f5a49ce9eb88fbacc5c3a6b62098357c2e95326cd17bb9f1a6c61d6e95e7
|
||||
checksum: 1025b07514b7bfd10a05e8b6cb5e6520878e9c8836b3dd0569fc07df29a09e428c2df1e0760b1d461da8ed6f81ca83ecb02e24198f80b0a177a2acbf532e267c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1883,9 +1874,9 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@polkadot/dev@npm:^0.62.71":
|
||||
version: 0.62.71
|
||||
resolution: "@polkadot/dev@npm:0.62.71"
|
||||
"@polkadot/dev@npm:^0.63.2":
|
||||
version: 0.63.2
|
||||
resolution: "@polkadot/dev@npm:0.63.2"
|
||||
dependencies:
|
||||
"@babel/cli": ^7.15.7
|
||||
"@babel/core": ^7.15.8
|
||||
@@ -1912,8 +1903,8 @@ __metadata:
|
||||
"@rollup/plugin-json": ^4.1.0
|
||||
"@rollup/plugin-node-resolve": ^13.0.5
|
||||
"@rushstack/eslint-patch": ^1.0.8
|
||||
"@typescript-eslint/eslint-plugin": 4.33.0
|
||||
"@typescript-eslint/parser": 4.33.0
|
||||
"@typescript-eslint/eslint-plugin": 5.0.0
|
||||
"@typescript-eslint/parser": 5.0.0
|
||||
"@vue/component-compiler-utils": ^3.2.2
|
||||
babel-jest: ^27.2.5
|
||||
babel-plugin-module-extension-resolver: ^1.0.0-rc.2
|
||||
@@ -1922,7 +1913,7 @@ __metadata:
|
||||
browserslist: ^4.17.4
|
||||
chalk: ^4.1.2
|
||||
coveralls: ^3.1.1
|
||||
eslint: ^7.32.0
|
||||
eslint: ^8.0.1
|
||||
eslint-config-standard: ^16.0.3
|
||||
eslint-import-resolver-node: ^0.3.6
|
||||
eslint-plugin-header: ^3.1.1
|
||||
@@ -1973,7 +1964,7 @@ __metadata:
|
||||
polkadot-exec-rollup: scripts/polkadot-exec-rollup.cjs
|
||||
polkadot-exec-tsc: scripts/polkadot-exec-tsc.cjs
|
||||
polkadot-exec-webpack: scripts/polkadot-exec-webpack.cjs
|
||||
checksum: b0d2035d1170a6e001f70bc6d84eefec60a7d9e5c557ad1f2372424018f0de525500c6fd1b6c2a27890aba9548bd1fc35f00f7a0ed447c6f196679c45783f554
|
||||
checksum: 1edae8c8e44724a3627532055f3e356f89a8a81611f656828fa6257250c2ab6df4091a92a822788eb9d0c98ffbc9e3a4a225d135a4ee0c6efe0fa8a8aa85304d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -2614,12 +2605,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/eslint-plugin@npm:4.33.0":
|
||||
version: 4.33.0
|
||||
resolution: "@typescript-eslint/eslint-plugin@npm:4.33.0"
|
||||
"@typescript-eslint/eslint-plugin@npm:5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "@typescript-eslint/eslint-plugin@npm:5.0.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/experimental-utils": 4.33.0
|
||||
"@typescript-eslint/scope-manager": 4.33.0
|
||||
"@typescript-eslint/experimental-utils": 5.0.0
|
||||
"@typescript-eslint/scope-manager": 5.0.0
|
||||
debug: ^4.3.1
|
||||
functional-red-black-tree: ^1.0.1
|
||||
ignore: ^5.1.8
|
||||
@@ -2627,55 +2618,55 @@ __metadata:
|
||||
semver: ^7.3.5
|
||||
tsutils: ^3.21.0
|
||||
peerDependencies:
|
||||
"@typescript-eslint/parser": ^4.0.0
|
||||
eslint: ^5.0.0 || ^6.0.0 || ^7.0.0
|
||||
"@typescript-eslint/parser": ^5.0.0
|
||||
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
checksum: d74855d0a5ffe0b2f362ec02fcd9301d39a53fb4155b9bd0cb15a0a31d065143129ebf98df9d86af4b6f74de1d423a4c0d8c0095520844068117453afda5bc4f
|
||||
checksum: 0b1230b9fc5f74ea7e24fb14ede8e7907710eb1b467dd02cb52ed233f034190ff0aa4fefe8b549f425bdf2301cb9c072cf5e2a970742c664053880a198c9e697
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/experimental-utils@npm:4.33.0":
|
||||
version: 4.33.0
|
||||
resolution: "@typescript-eslint/experimental-utils@npm:4.33.0"
|
||||
"@typescript-eslint/experimental-utils@npm:5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "@typescript-eslint/experimental-utils@npm:5.0.0"
|
||||
dependencies:
|
||||
"@types/json-schema": ^7.0.7
|
||||
"@typescript-eslint/scope-manager": 4.33.0
|
||||
"@typescript-eslint/types": 4.33.0
|
||||
"@typescript-eslint/typescript-estree": 4.33.0
|
||||
"@typescript-eslint/scope-manager": 5.0.0
|
||||
"@typescript-eslint/types": 5.0.0
|
||||
"@typescript-eslint/typescript-estree": 5.0.0
|
||||
eslint-scope: ^5.1.1
|
||||
eslint-utils: ^3.0.0
|
||||
peerDependencies:
|
||||
eslint: "*"
|
||||
checksum: f859800ada0884f92db6856f24efcb1d073ac9883ddc2b1aa9339f392215487895bed8447ebce3741e8141bb32e545244abef62b73193ba9a8a0527c523aabae
|
||||
checksum: 0c545cf353b225460d37d9ff99b798db9ed83a5446457f54a79309938e5068799fd9a565c1f964d734e45a91b4bdd52db77ae5063e2d669ef5f7603f14fbb43c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/parser@npm:4.33.0":
|
||||
version: 4.33.0
|
||||
resolution: "@typescript-eslint/parser@npm:4.33.0"
|
||||
"@typescript-eslint/parser@npm:5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "@typescript-eslint/parser@npm:5.0.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/scope-manager": 4.33.0
|
||||
"@typescript-eslint/types": 4.33.0
|
||||
"@typescript-eslint/typescript-estree": 4.33.0
|
||||
"@typescript-eslint/scope-manager": 5.0.0
|
||||
"@typescript-eslint/types": 5.0.0
|
||||
"@typescript-eslint/typescript-estree": 5.0.0
|
||||
debug: ^4.3.1
|
||||
peerDependencies:
|
||||
eslint: ^5.0.0 || ^6.0.0 || ^7.0.0
|
||||
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
checksum: 102457eae1acd516211098fea081c8a2ed728522bbda7f5a557b6ef23d88970514f9a0f6285d53fca134d3d4d7d17822b5d5e12438d5918df4d1f89cc9e67d57
|
||||
checksum: 9c97a60d583e80774e2593b79a9e8baa3b1867dcb2afab250ce8a950fccb44ccc5ecb270dcb071c592652a0eac6f28826ae02e8cbb386788f76eb134972e9c52
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/scope-manager@npm:4.33.0":
|
||||
version: 4.33.0
|
||||
resolution: "@typescript-eslint/scope-manager@npm:4.33.0"
|
||||
"@typescript-eslint/scope-manager@npm:5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "@typescript-eslint/scope-manager@npm:5.0.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 4.33.0
|
||||
"@typescript-eslint/visitor-keys": 4.33.0
|
||||
checksum: 9a25fb7ba7c725ea7227a24d315b0f6aacbad002e2549a049edf723c1d3615c22f5c301f0d7d615b377f2cdf2f3519d97e79af0c459de6ef8d2aaf0906dff13e
|
||||
"@typescript-eslint/types": 5.0.0
|
||||
"@typescript-eslint/visitor-keys": 5.0.0
|
||||
checksum: 920fc3553830c738d2d709676d95e50f7b0fe945afad0457527753e94e3ac115b6c88f1974eecc9bcb6d9580373250fa36765484fee45b4513bd4f63eceaa6a3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -2686,7 +2677,32 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/typescript-estree@npm:4.33.0, @typescript-eslint/typescript-estree@npm:^4.8.2":
|
||||
"@typescript-eslint/types@npm:5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "@typescript-eslint/types@npm:5.0.0"
|
||||
checksum: 424966c124cd02b8d8bebe3ae4fb264e23708018e6e63787a070ced1bb24c43c4e3b49adb895eaf9a8200bed5c97aa7a57a1605925b6fb56a091703648e29b40
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/typescript-estree@npm:5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "@typescript-eslint/typescript-estree@npm:5.0.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 5.0.0
|
||||
"@typescript-eslint/visitor-keys": 5.0.0
|
||||
debug: ^4.3.1
|
||||
globby: ^11.0.3
|
||||
is-glob: ^4.0.1
|
||||
semver: ^7.3.5
|
||||
tsutils: ^3.21.0
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
checksum: 950e72b75706fa75dd795f3bbd29222a9da5c611f0acc023bf82f3254476fbdb3bfe0a07aa75105f2c2bfe566191f9125351cdf003be4a1fe6a5ee8bd1cd2dc7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/typescript-estree@npm:^4.8.2":
|
||||
version: 4.33.0
|
||||
resolution: "@typescript-eslint/typescript-estree@npm:4.33.0"
|
||||
dependencies:
|
||||
@@ -2714,6 +2730,16 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/visitor-keys@npm:5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "@typescript-eslint/visitor-keys@npm:5.0.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 5.0.0
|
||||
eslint-visitor-keys: ^3.0.0
|
||||
checksum: 6a5a3cdd64d9b131c72aa52f44904b5bb0fbb28ca624342afdfafa9dd0038f2de9a02ed661595ddb2c8133ab0854b320fb0d1c9d9823c7c064663d506f8c1d4a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@vue/component-compiler-utils@npm:^3.2.2":
|
||||
version: 3.2.2
|
||||
resolution: "@vue/component-compiler-utils@npm:3.2.2"
|
||||
@@ -2774,7 +2800,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"acorn@npm:^7.1.1, acorn@npm:^7.4.0":
|
||||
"acorn@npm:^7.1.1":
|
||||
version: 7.4.1
|
||||
resolution: "acorn@npm:7.4.1"
|
||||
bin:
|
||||
@@ -2783,12 +2809,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"acorn@npm:^8.2.4":
|
||||
version: 8.2.4
|
||||
resolution: "acorn@npm:8.2.4"
|
||||
"acorn@npm:^8.2.4, acorn@npm:^8.5.0":
|
||||
version: 8.5.0
|
||||
resolution: "acorn@npm:8.5.0"
|
||||
bin:
|
||||
acorn: bin/acorn
|
||||
checksum: cb4ffa2746bebd8ea808e98e139e2e497eaa254de45877abea6a2bad4e65a824fc37e23f6d163562b1e4ee12fcc8fa03948986c0a353b314bff78a0327168cb2
|
||||
checksum: 2e4c1dbed3da327684863debf31d341bf8882c6893c506653872c00977eee45675feb9129255d6c74c88424d2b20d889ca6de5b39776e5e3cccfc756b3ca1da8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -2813,18 +2839,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ajv@npm:^8.0.1":
|
||||
version: 8.5.0
|
||||
resolution: "ajv@npm:8.5.0"
|
||||
dependencies:
|
||||
fast-deep-equal: ^3.1.1
|
||||
json-schema-traverse: ^1.0.0
|
||||
require-from-string: ^2.0.2
|
||||
uri-js: ^4.2.2
|
||||
checksum: 0115531d0fd8314867d21b4748f3a91f82b464ca92855ac0702bbe9fc6fb6202b032af7f2849da92fd8e23a7ea2ba91cbae3dde64f05a804dd1bd32809ba0f73
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ansi-align@npm:^3.0.0":
|
||||
version: 3.0.0
|
||||
resolution: "ansi-align@npm:3.0.0"
|
||||
@@ -2971,6 +2985,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"argparse@npm:^2.0.1":
|
||||
version: 2.0.1
|
||||
resolution: "argparse@npm:2.0.1"
|
||||
checksum: 83644b56493e89a254bae05702abf3a1101b4fa4d0ca31df1c9985275a5a5bd47b3c27b7fa0b71098d41114d8ca000e6ed90cad764b306f8a503665e4d517ced
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"array-includes@npm:^3.1.2, array-includes@npm:^3.1.3, array-includes@npm:^3.1.4":
|
||||
version: 3.1.4
|
||||
resolution: "array-includes@npm:3.1.4"
|
||||
@@ -3053,13 +3074,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"astral-regex@npm:^2.0.0":
|
||||
version: 2.0.0
|
||||
resolution: "astral-regex@npm:2.0.0"
|
||||
checksum: 876231688c66400473ba505731df37ea436e574dd524520294cc3bbc54ea40334865e01fa0d074d74d036ee874ee7e62f486ea38bc421ee8e6a871c06f011766
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"async@npm:^2.6.1":
|
||||
version: 2.6.3
|
||||
resolution: "async@npm:2.6.3"
|
||||
@@ -3989,7 +4003,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1":
|
||||
"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2":
|
||||
version: 4.3.2
|
||||
resolution: "debug@npm:4.3.2"
|
||||
dependencies:
|
||||
@@ -4750,7 +4764,17 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eslint-utils@npm:^2.0.0, eslint-utils@npm:^2.1.0":
|
||||
"eslint-scope@npm:^6.0.0":
|
||||
version: 6.0.0
|
||||
resolution: "eslint-scope@npm:6.0.0"
|
||||
dependencies:
|
||||
esrecurse: ^4.3.0
|
||||
estraverse: ^5.2.0
|
||||
checksum: 3f1b3578f288c3820f68ad2aae102300e546be8a98a958f515405dc20cc2fe64fda583d364977628bb14fe3d4f96f37de5e9bc5d6eb26bc310da33ba2a677dc3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eslint-utils@npm:^2.0.0":
|
||||
version: 2.1.0
|
||||
resolution: "eslint-utils@npm:2.1.0"
|
||||
dependencies:
|
||||
@@ -4770,7 +4794,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eslint-visitor-keys@npm:^1.1.0, eslint-visitor-keys@npm:^1.3.0":
|
||||
"eslint-visitor-keys@npm:^1.1.0":
|
||||
version: 1.3.0
|
||||
resolution: "eslint-visitor-keys@npm:1.3.0"
|
||||
checksum: 37a19b712f42f4c9027e8ba98c2b06031c17e0c0a4c696cd429bd9ee04eb43889c446f2cd545e1ff51bef9593fcec94ecd2c2ef89129fcbbf3adadbef520376a
|
||||
@@ -4784,36 +4808,42 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eslint@npm:^7.32.0":
|
||||
version: 7.32.0
|
||||
resolution: "eslint@npm:7.32.0"
|
||||
"eslint-visitor-keys@npm:^3.0.0":
|
||||
version: 3.0.0
|
||||
resolution: "eslint-visitor-keys@npm:3.0.0"
|
||||
checksum: 352607f367a2e0e2f9f234e40d6d9b34c39399345b8a9f204e1343749ddfae505d8343909cba6c4abc2ca03add4cdc0530af5e98f870ad7183fc2a89458669e5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eslint@npm:8.0.1, eslint@npm:^8.0.1":
|
||||
version: 8.0.1
|
||||
resolution: "eslint@npm:8.0.1"
|
||||
dependencies:
|
||||
"@babel/code-frame": 7.12.11
|
||||
"@eslint/eslintrc": ^0.4.3
|
||||
"@humanwhocodes/config-array": ^0.5.0
|
||||
"@eslint/eslintrc": ^1.0.3
|
||||
"@humanwhocodes/config-array": ^0.6.0
|
||||
ajv: ^6.10.0
|
||||
chalk: ^4.0.0
|
||||
cross-spawn: ^7.0.2
|
||||
debug: ^4.0.1
|
||||
debug: ^4.3.2
|
||||
doctrine: ^3.0.0
|
||||
enquirer: ^2.3.5
|
||||
escape-string-regexp: ^4.0.0
|
||||
eslint-scope: ^5.1.1
|
||||
eslint-utils: ^2.1.0
|
||||
eslint-visitor-keys: ^2.0.0
|
||||
espree: ^7.3.1
|
||||
eslint-scope: ^6.0.0
|
||||
eslint-utils: ^3.0.0
|
||||
eslint-visitor-keys: ^3.0.0
|
||||
espree: ^9.0.0
|
||||
esquery: ^1.4.0
|
||||
esutils: ^2.0.2
|
||||
fast-deep-equal: ^3.1.3
|
||||
file-entry-cache: ^6.0.1
|
||||
functional-red-black-tree: ^1.0.1
|
||||
glob-parent: ^5.1.2
|
||||
glob-parent: ^6.0.1
|
||||
globals: ^13.6.0
|
||||
ignore: ^4.0.6
|
||||
import-fresh: ^3.0.0
|
||||
imurmurhash: ^0.1.4
|
||||
is-glob: ^4.0.0
|
||||
js-yaml: ^3.13.1
|
||||
js-yaml: ^4.1.0
|
||||
json-stable-stringify-without-jsonify: ^1.0.1
|
||||
levn: ^0.4.1
|
||||
lodash.merge: ^4.6.2
|
||||
@@ -4821,27 +4851,26 @@ __metadata:
|
||||
natural-compare: ^1.4.0
|
||||
optionator: ^0.9.1
|
||||
progress: ^2.0.0
|
||||
regexpp: ^3.1.0
|
||||
regexpp: ^3.2.0
|
||||
semver: ^7.2.1
|
||||
strip-ansi: ^6.0.0
|
||||
strip-json-comments: ^3.1.0
|
||||
table: ^6.0.9
|
||||
text-table: ^0.2.0
|
||||
v8-compile-cache: ^2.0.3
|
||||
bin:
|
||||
eslint: bin/eslint.js
|
||||
checksum: cc85af9985a3a11085c011f3d27abe8111006d34cc274291b3c4d7bea51a4e2ff6135780249becd919ba7f6d6d1ecc38a6b73dacb6a7be08d38453b344dc8d37
|
||||
checksum: 072dde3e188c1274fa92eaf72d233d77b9c6e87ed859dce071b49c243546959ff7aefdb4759abf09841b650ef9d9f013abaae720b0bd64e0e07700ccefaf1208
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"espree@npm:^7.3.0, espree@npm:^7.3.1":
|
||||
version: 7.3.1
|
||||
resolution: "espree@npm:7.3.1"
|
||||
"espree@npm:^9.0.0":
|
||||
version: 9.0.0
|
||||
resolution: "espree@npm:9.0.0"
|
||||
dependencies:
|
||||
acorn: ^7.4.0
|
||||
acorn: ^8.5.0
|
||||
acorn-jsx: ^5.3.1
|
||||
eslint-visitor-keys: ^1.3.0
|
||||
checksum: aa9b50dcce883449af2e23bc2b8d9abb77118f96f4cb313935d6b220f77137eaef7724a83c3f6243b96bc0e4ab14766198e60818caad99f9519ae5a336a39b45
|
||||
eslint-visitor-keys: ^3.0.0
|
||||
checksum: f313c642e35587ce62a419f57ceea47937a719b084c7b31f649d2ca15ed92bc2dde58e2ac4fc381a74364b0db0b97d9cdb2a5d1ca0ccd7483bde9b4b04fe23e8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -5531,7 +5560,7 @@ fsevents@~2.1.2:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"glob-parent@npm:^5.1.0, glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.0":
|
||||
"glob-parent@npm:^5.1.0, glob-parent@npm:~5.1.0":
|
||||
version: 5.1.2
|
||||
resolution: "glob-parent@npm:5.1.2"
|
||||
dependencies:
|
||||
@@ -5540,6 +5569,15 @@ fsevents@~2.1.2:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"glob-parent@npm:^6.0.1":
|
||||
version: 6.0.2
|
||||
resolution: "glob-parent@npm:6.0.2"
|
||||
dependencies:
|
||||
is-glob: ^4.0.3
|
||||
checksum: c13ee97978bef4f55106b71e66428eb1512e71a7466ba49025fc2aec59a5bfb0954d5abd58fc5ee6c9b076eef4e1f6d3375c2e964b88466ca390da4419a786a8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"glob2base@npm:^0.0.12":
|
||||
version: 0.0.12
|
||||
resolution: "glob2base@npm:0.0.12"
|
||||
@@ -6949,6 +6987,17 @@ fsevents@~2.1.2:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"js-yaml@npm:^4.1.0":
|
||||
version: 4.1.0
|
||||
resolution: "js-yaml@npm:4.1.0"
|
||||
dependencies:
|
||||
argparse: ^2.0.1
|
||||
bin:
|
||||
js-yaml: bin/js-yaml.js
|
||||
checksum: c7830dfd456c3ef2c6e355cc5a92e6700ceafa1d14bba54497b34a99f0376cecbb3e9ac14d3e5849b426d5a5140709a66237a8c991c675431271c4ce5504151a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"jsbn@npm:~0.1.0":
|
||||
version: 0.1.1
|
||||
resolution: "jsbn@npm:0.1.1"
|
||||
@@ -7035,13 +7084,6 @@ fsevents@~2.1.2:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"json-schema-traverse@npm:^1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "json-schema-traverse@npm:1.0.0"
|
||||
checksum: 02f2f466cdb0362558b2f1fd5e15cce82ef55d60cd7f8fa828cf35ba74330f8d767fcae5c5c2adb7851fa811766c694b9405810879bc4e1ddd78a7c0e03658ad
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"json-schema@npm:0.2.3":
|
||||
version: 0.2.3
|
||||
resolution: "json-schema@npm:0.2.3"
|
||||
@@ -7264,13 +7306,6 @@ fsevents@~2.1.2:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lodash.clonedeep@npm:^4.5.0":
|
||||
version: 4.5.0
|
||||
resolution: "lodash.clonedeep@npm:4.5.0"
|
||||
checksum: 92c46f094b064e876a23c97f57f81fbffd5d760bf2d8a1c61d85db6d1e488c66b0384c943abee4f6af7debf5ad4e4282e74ff83177c9e63d8ff081a4837c3489
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lodash.debounce@npm:^4.0.8":
|
||||
version: 4.0.8
|
||||
resolution: "lodash.debounce@npm:4.0.8"
|
||||
@@ -7292,13 +7327,6 @@ fsevents@~2.1.2:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lodash.truncate@npm:^4.4.2":
|
||||
version: 4.4.2
|
||||
resolution: "lodash.truncate@npm:4.4.2"
|
||||
checksum: b463d8a382cfb5f0e71c504dcb6f807a7bd379ff1ea216669aa42c52fc28c54e404bfbd96791aa09e6df0de2c1d7b8f1b7f4b1a61f324d38fe98bc535aeee4f5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.21, lodash@npm:^4.7.0":
|
||||
version: 4.17.21
|
||||
resolution: "lodash@npm:4.17.21"
|
||||
@@ -8674,10 +8702,10 @@ fsevents@~2.1.2:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"regexpp@npm:^3.0.0, regexpp@npm:^3.1.0":
|
||||
version: 3.1.0
|
||||
resolution: "regexpp@npm:3.1.0"
|
||||
checksum: 63bcb2c98d63274774c79bef256e03f716d25f1fa8427267d0302d1436a83fa0d905f4e8a172fdfa99fb4d84833df2fb3bf7da2a1a868f156e913174c32b1139
|
||||
"regexpp@npm:^3.0.0, regexpp@npm:^3.1.0, regexpp@npm:^3.2.0":
|
||||
version: 3.2.0
|
||||
resolution: "regexpp@npm:3.2.0"
|
||||
checksum: a78dc5c7158ad9ddcfe01aa9144f46e192ddbfa7b263895a70a5c6c73edd9ce85faf7c0430e59ac38839e1734e275b9c3de5c57ee3ab6edc0e0b1bdebefccef8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -8773,13 +8801,6 @@ fsevents@~2.1.2:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"require-from-string@npm:^2.0.2":
|
||||
version: 2.0.2
|
||||
resolution: "require-from-string@npm:2.0.2"
|
||||
checksum: a03ef6895445f33a4015300c426699bc66b2b044ba7b670aa238610381b56d3f07c686251740d575e22f4c87531ba662d06937508f0f3c0f1ddc04db3130560b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"requirejs-config-file@npm:^4.0.0":
|
||||
version: 4.0.0
|
||||
resolution: "requirejs-config-file@npm:4.0.0"
|
||||
@@ -8952,7 +8973,7 @@ resolve@^2.0.0-next.3:
|
||||
"@babel/core": ^7.15.8
|
||||
"@babel/register": ^7.15.3
|
||||
"@babel/runtime": ^7.15.4
|
||||
"@polkadot/dev": ^0.62.71
|
||||
"@polkadot/dev": ^0.63.2
|
||||
"@polkadot/ts": ^0.4.9
|
||||
"@polkadot/typegen": "workspace:packages/typegen"
|
||||
"@types/jest": ^27.0.2
|
||||
@@ -9201,17 +9222,6 @@ resolve@^2.0.0-next.3:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"slice-ansi@npm:^4.0.0":
|
||||
version: 4.0.0
|
||||
resolution: "slice-ansi@npm:4.0.0"
|
||||
dependencies:
|
||||
ansi-styles: ^4.0.0
|
||||
astral-regex: ^2.0.0
|
||||
is-fullwidth-code-point: ^3.0.0
|
||||
checksum: 4a82d7f085b0e1b070e004941ada3c40d3818563ac44766cca4ceadd2080427d337554f9f99a13aaeb3b4a94d9964d9466c807b3d7b7541d1ec37ee32d308756
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"sort-keys@npm:^4.0.0":
|
||||
version: 4.2.0
|
||||
resolution: "sort-keys@npm:4.2.0"
|
||||
@@ -9587,20 +9597,6 @@ resolve@^2.0.0-next.3:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"table@npm:^6.0.9":
|
||||
version: 6.7.1
|
||||
resolution: "table@npm:6.7.1"
|
||||
dependencies:
|
||||
ajv: ^8.0.1
|
||||
lodash.clonedeep: ^4.5.0
|
||||
lodash.truncate: ^4.4.2
|
||||
slice-ansi: ^4.0.0
|
||||
string-width: ^4.2.0
|
||||
strip-ansi: ^6.0.0
|
||||
checksum: 053b61fa4e8f8396c65ff7a95da90e85620370932652d501ff7a0a3ed7317f1cc549702bd2abf2bd9ed01e20757b73a8b57374f8a8a2ac02fbe0550276263fb6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tapable@npm:^2.2.0":
|
||||
version: 2.2.0
|
||||
resolution: "tapable@npm:2.2.0"
|
||||
|
||||
Reference in New Issue
Block a user