Bump deps (& remove unused overrides) (#5549)

This commit is contained in:
Jaco
2023-03-18 11:59:42 +02:00
committed by GitHub
parent ac8446b30c
commit cf1fabaecf
53 changed files with 138 additions and 170 deletions
+7 -2
View File
@@ -62,8 +62,7 @@ export interface PaginationOptions<A = unknown> {
startKey?: string;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type DecorateMethod<ApiType extends ApiTypes, T = any> =
export type DecorateMethod<_ApiType extends ApiTypes, T = any> =
<M extends (...args: any[]) => Observable<any>>(method: M, options?: DecorateMethodOptions) => T;
type AsCodec<R extends Codec | any> = R extends Codec
@@ -71,3 +70,9 @@ type AsCodec<R extends Codec | any> = R extends Codec
: Codec;
export type ReturnCodec<F extends AnyFunction> = AsCodec<ObsInnerType<ReturnType<F>>>;
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface EmptyBase<_> {
// this is use to allow use to have unused vars in augmented interfaces,
// so intentionally left empty
}
+3 -4
View File
@@ -3,14 +3,13 @@
import type { Observable } from 'rxjs';
import type { AnyFunction, Codec, DefinitionCallNamed } from '@polkadot/types/types';
import type { ApiTypes, ReturnCodec } from './base.js';
import type { ApiTypes, EmptyBase, ReturnCodec } from './base.js';
export type DecoratedCallBase<ApiType extends ApiTypes, F extends AnyFunction = (...args: any[]) => Observable<Codec>> =
ApiType extends 'rxjs'
? <T extends Codec | any = ReturnCodec<F>> (...args: Parameters<F>) => Observable<T>
: <T extends Codec | any = ReturnCodec<F>> (...args: Parameters<F>) => Promise<T>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type AugmentedCall<ApiType extends ApiTypes, F extends AnyFunction = (...args: any[]) => Observable<Codec>> = DecoratedCallBase<ApiType, F> & {
/** The metadata/description/definition for this method */
meta: DefinitionCallNamed
@@ -18,8 +17,8 @@ export type AugmentedCall<ApiType extends ApiTypes, F extends AnyFunction = (...
// augmented interfaces
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-interface
export interface AugmentedCalls<ApiType extends ApiTypes> {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AugmentedCalls<ApiType extends ApiTypes> extends EmptyBase<ApiType> {
// augmented
}
+4 -5
View File
@@ -3,17 +3,16 @@
import type { PalletConstantMetadataLatest } from '@polkadot/types/interfaces';
import type { Codec } from '@polkadot/types/types';
import type { ApiTypes } from './base.js';
import type { ApiTypes, EmptyBase } from './base.js';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export interface AugmentedConst<ApiType extends ApiTypes> {
export interface AugmentedConst<_ extends ApiTypes> {
meta: PalletConstantMetadataLatest;
}
// augmented interfaces
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-interface
export interface AugmentedConsts<ApiType extends ApiTypes> {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AugmentedConsts<ApiType extends ApiTypes> extends EmptyBase<ApiType> {
// augmented
}
+4 -5
View File
@@ -2,15 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
import type { IsError } from '@polkadot/types/metadata/decorate/types';
import type { ApiTypes } from './base.js';
import type { ApiTypes, EmptyBase } from './base.js';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type AugmentedError<ApiType extends ApiTypes> = IsError;
export type AugmentedError<_ extends ApiTypes> = IsError;
// augmented interfaces
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-interface
export interface AugmentedErrors<ApiType extends ApiTypes> {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AugmentedErrors<ApiType extends ApiTypes> extends EmptyBase<ApiType> {
// augmented
}
+4 -5
View File
@@ -3,15 +3,14 @@
import type { IsEvent } from '@polkadot/types/metadata/decorate/types';
import type { AnyTuple } from '@polkadot/types/types';
import type { ApiTypes } from './base.js';
import type { ApiTypes, EmptyBase } from './base.js';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type AugmentedEvent<ApiType extends ApiTypes, T extends AnyTuple = AnyTuple, N = unknown> = IsEvent<T, N>;
export type AugmentedEvent<_ extends ApiTypes, T extends AnyTuple = AnyTuple, N = unknown> = IsEvent<T, N>;
// augmented interfaces
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-interface
export interface AugmentedEvents<ApiType extends ApiTypes> {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AugmentedEvents<ApiType extends ApiTypes> extends EmptyBase<ApiType> {
// augmented
}
+3 -3
View File
@@ -6,7 +6,7 @@ import type { StorageKey, u64 } from '@polkadot/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { AnyFunction, AnyTuple, Callback, Codec, IStorageKey } from '@polkadot/types/types';
import type { ApiTypes, DropLast, MethodResult, PaginationOptions, PromiseOrObs, ReturnCodec, UnsubscribePromise } from './base.js';
import type { ApiTypes, DropLast, EmptyBase, MethodResult, PaginationOptions, PromiseOrObs, ReturnCodec, UnsubscribePromise } from './base.js';
interface StorageEntryObservableMulti<R extends Codec = Codec> {
<T extends Codec = R>(args: (unknown[] | unknown)[]): Observable<T[]>;
@@ -114,8 +114,8 @@ export type AugmentedQueryDoubleMap<ApiType extends ApiTypes, F extends AnyFunct
// augmented interfaces
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-interface
export interface AugmentedQueries<ApiType extends ApiTypes> {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AugmentedQueries<ApiType extends ApiTypes> extends EmptyBase<ApiType> {
// augmented
}
+3 -3
View File
@@ -4,7 +4,7 @@
import type { Observable } from 'rxjs';
import type { AccountId, Address, ApplyExtrinsicResult, BlockNumber, Call, DispatchError, DispatchInfo, EventRecord, Extrinsic, ExtrinsicStatus, Hash, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
import type { AnyFunction, AnyNumber, AnyTuple, Callback, CallBase, Codec, IExtrinsicEra, IKeyringPair, ISubmittableResult, Signer } from '@polkadot/types/types';
import type { ApiTypes, PromiseOrObs } from './base.js';
import type { ApiTypes, EmptyBase, PromiseOrObs } from './base.js';
export type AugmentedSubmittable<T extends AnyFunction, A extends AnyTuple = AnyTuple> = T & CallBase<A>;
@@ -81,8 +81,8 @@ export interface SubmittableExtrinsicFunction<ApiType extends ApiTypes, A extend
// augmented interfaces
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-interface
export interface AugmentedSubmittables<ApiType extends ApiTypes> {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AugmentedSubmittables<ApiType extends ApiTypes> extends EmptyBase<ApiType> {
// augmented
}
+1 -1
View File
@@ -23,7 +23,7 @@ function createConverter <I, O> (next: (registry: Registry, input: O) => Contrac
next(registry, step(registry, input));
}
export function v4ToLatest (registry: Registry, v4: ContractMetadataV4): ContractMetadataLatest {
export function v4ToLatest (_registry: Registry, v4: ContractMetadataV4): ContractMetadataLatest {
return v4;
}
+1 -1
View File
@@ -4,6 +4,6 @@
import type { ContractMetadataV3, ContractMetadataV4 } from '@polkadot/types/interfaces';
import type { Registry } from '@polkadot/types/types';
export function v3ToV4 (registry: Registry, v3: ContractMetadataV3): ContractMetadataV4 {
export function v3ToV4 (_registry: Registry, v3: ContractMetadataV3): ContractMetadataV4 {
return v3;
}
@@ -46,7 +46,7 @@ export function idAndIndex (instanceId: string, api: DeriveApi): (address?: Addr
return api.derive.accounts.indexToId(accountIndex.toString()).pipe(
map((accountId): AccountIdAndIndex => [accountId, accountIndex])
);
} catch (error) {
} catch {
return of([undefined, undefined]);
}
});
@@ -11,7 +11,6 @@ import { firstMemo, memo } from '../util/index.js';
import { erasHistoricApplyAccount } from './util.js';
export function _ownExposures (instanceId: string, api: DeriveApi): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveOwnExposure[]> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveOwnExposure[]> =>
eras.length
? combineLatest([
@@ -12,7 +12,6 @@ import { firstMemo, memo } from '../util/index.js';
import { erasHistoricApplyAccount } from './util.js';
export function _ownSlashes (instanceId: string, api: DeriveApi): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerSlashes[]> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveStakerSlashes[]> =>
eras.length
? combineLatest([
@@ -11,7 +11,6 @@ import { memo } from '../util/index.js';
import { erasHistoricApplyAccount } from './util.js';
export function _stakerPrefs (instanceId: string, api: DeriveApi): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerPrefs[]> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveStakerPrefs[]> =>
api.query.staking.erasValidatorPrefs.multi(eras.map((e) => [e, accountId])).pipe(
map((all): DeriveStakerPrefs[] =>
+2 -2
View File
@@ -62,7 +62,7 @@ export class Combinator<T extends unknown[] = unknown[]> {
try {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.#callback(this.#results as T);
} catch (error) {
} catch {
// swallow, we don't want the handler to trip us up
}
}
@@ -82,7 +82,7 @@ export class Combinator<T extends unknown[] = unknown[]> {
if (isFunction(unsubscribe)) {
unsubscribe();
}
} catch (error) {
} catch {
// ignore
}
});
+1 -2
View File
@@ -98,8 +98,7 @@ describe('Combinator', (): void => {
mocker,
// eslint-disable-next-line @typescript-eslint/require-await
async (): UnsubscribePromise => (): void => undefined
// eslint-disable-next-line @typescript-eslint/no-unused-vars
], (value: any[]): void => {
], (_: any[]): void => {
// ignore
});
+1 -1
View File
@@ -33,7 +33,7 @@ describe('methodSend', (): void => {
};
provider = {
send: jest.fn((method: string, params: unknown[]): Promise<unknown> =>
send: jest.fn((_method: string, params: unknown[]): Promise<unknown> =>
Promise.resolve(params[0])
)
} as unknown as ProviderInterface;
+5 -6
View File
@@ -112,8 +112,7 @@ export class HttpProvider implements ProviderInterface {
* @summary Events are not supported with the HttpProvider, see [[WsProvider]].
* @description HTTP Provider does not have 'on' emitters. WebSockets should be used instead.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public on (type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb): () => void {
public on (_type: ProviderInterfaceEmitted, _sub: ProviderInterfaceEmitCb): () => void {
l.error('HTTP Provider does not have \'on\' emitters, use WebSockets instead');
return (): void => {
@@ -185,8 +184,8 @@ export class HttpProvider implements ProviderInterface {
/**
* @summary Subscriptions are not supported with the HttpProvider, see [[WsProvider]].
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/require-await
public async subscribe (types: string, method: string, params: unknown[], cb: ProviderInterfaceCallback): Promise<number> {
// eslint-disable-next-line @typescript-eslint/require-await
public async subscribe (_types: string, _method: string, _params: unknown[], _cb: ProviderInterfaceCallback): Promise<number> {
l.error(ERROR_SUBSCRIBE);
throw new Error(ERROR_SUBSCRIBE);
@@ -195,8 +194,8 @@ export class HttpProvider implements ProviderInterface {
/**
* @summary Subscriptions are not supported with the HttpProvider, see [[WsProvider]].
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/require-await
public async unsubscribe (type: string, method: string, id: number): Promise<boolean> {
// eslint-disable-next-line @typescript-eslint/require-await
public async unsubscribe (_type: string, _method: string, _id: number): Promise<boolean> {
l.error(ERROR_SUBSCRIBE);
throw new Error(ERROR_SUBSCRIBE);
+3 -4
View File
@@ -53,9 +53,8 @@ export class MockProvider implements ProviderInterface {
private prevNumber = new BN(-1);
private requests: Record<string, (...params: any[]) => unknown> = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-unsafe-member-access
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
chain_getBlock: () => this.registry.createType('SignedBlock', rpcSignedBlock.result).toJSON(),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
chain_getBlockHash: () => '0x1234000000000000000000000000000000000000000000000000000000000000',
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
chain_getFinalizedHead: () => this.registry.createType('Header', rpcHeader.result).hash,
@@ -144,7 +143,7 @@ export class MockProvider implements ProviderInterface {
}
// eslint-disable-next-line @typescript-eslint/require-await
public async subscribe (type: string, method: string, ...params: unknown[]): Promise<number> {
public async subscribe (_type: string, method: string, ...params: unknown[]): Promise<number> {
l.debug(() => ['subscribe', method, params]);
if (!this.subscriptions[method]) {
@@ -165,7 +164,7 @@ export class MockProvider implements ProviderInterface {
}
// eslint-disable-next-line @typescript-eslint/require-await
public async unsubscribe (type: string, method: string, id: number): Promise<boolean> {
public async unsubscribe (_type: string, _method: string, id: number): Promise<boolean> {
const sub = this.subscriptionMap[id];
l.debug(() => ['unsubscribe', id, sub]);
+1 -1
View File
@@ -25,7 +25,7 @@ export function mockHttp (requests: Request[]): Mock {
return requests.reduce((scope: HttpMock, request: Request) =>
scope
.post('/')
.reply(request.code || 200, (uri: string, body: { id: string }) => {
.reply(request.code || 200, (_uri: string, body: { id: string }) => {
scope.body = scope.body || {};
scope.body[request.method] = body;
@@ -113,7 +113,7 @@ class InnerChecker {
try {
parsedRequest = JSON.parse(request) as JSONRequest;
} catch (err) {
} catch {
return;
}
@@ -131,7 +131,7 @@ class InnerChecker {
try {
parsedResponse = JSON.parse(jsonRpcResponse) as { id: string, result: undefined | SmoldotHealth };
} catch (err) {
} catch {
return jsonRpcResponse;
}
+2 -2
View File
@@ -243,7 +243,7 @@ export class WsProvider implements ProviderInterface {
if (this.#autoConnectMs > 0) {
try {
await this.connect();
} catch (error) {
} catch {
setTimeout((): void => {
this.connectWithRetry().catch((): void => {
// does not throw
@@ -417,7 +417,7 @@ export class WsProvider implements ProviderInterface {
return this.isConnected && !isNull(this.#websocket)
? this.send<boolean>(method, [id])
: true;
} catch (error) {
} catch {
return false;
}
}
+1 -1
View File
@@ -218,7 +218,7 @@ function generateLookupTypes (registry: Registry, filtered: [PortableType, TypeD
writeFile(path.join(destDir, 'index.ts'), () => generateLookupIndexTmpl({ headerType: 'defs' }), true);
}
function generateRegistry (registry: Registry, filtered: [PortableType, TypeDef][], destDir: string, subPath: string): void {
function generateRegistry (_registry: Registry, filtered: [PortableType, TypeDef][], destDir: string, subPath: string): void {
writeFile(path.join(destDir, `${subPath}.ts`), (): string => {
const items = filtered
.map(([, { lookupName }]) => lookupName)
+3 -5
View File
@@ -32,8 +32,7 @@ export function createGetter (definitions: Record<string, ModuleTypes>, name = '
}
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function errorUnhandled (_: Registry, definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
function errorUnhandled (_: Registry, _definitions: Record<string, ModuleTypes>, def: TypeDef, _imports: TypeImports): string {
throw new Error(`Generate: ${def.name || ''}: Unhandled type ${TypeDefInfo[def.info]}`);
}
@@ -96,7 +95,7 @@ function tsInt (_: Registry, definitions: Record<string, ModuleTypes>, def: Type
}
/** @internal */
function tsNull (registry: Registry, definitions: Record<string, ModuleTypes>, { lookupIndex = -1, name }: TypeDef, imports: TypeImports): string {
function tsNull (_registry: Registry, definitions: Record<string, ModuleTypes>, { lookupIndex = -1, name }: TypeDef, imports: TypeImports): string {
setImports(definitions, imports, ['Null']);
// * @description extends [[${base}]]
@@ -151,8 +150,7 @@ function tsResult (registry: Registry, definitions: Record<string, ModuleTypes>,
}
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function tsSi (registry: Registry, definitions: Record<string, ModuleTypes>, typeDef: TypeDef, imports: TypeImports): string {
function tsSi (_registry: Registry, _definitions: Record<string, ModuleTypes>, typeDef: TypeDef, _imports: TypeImports): string {
// FIXME
return `// SI: ${JSON.stringify(typeDef)}`;
}
+7 -9
View File
@@ -1,8 +1,6 @@
// Copyright 2017-2023 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable @typescript-eslint/no-unused-vars */
import type { AnyString, Registry } from '@polkadot/types/types';
import type { LookupString } from '@polkadot/types-codec/types';
import type { TypeDef } from '@polkadot/types-create/types';
@@ -139,13 +137,13 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
return singleParamNotation(registry, 'Compact', typeDef, definitions, imports, withShortcut);
},
[TypeDefInfo.DoNotConstruct]: (registry: Registry, { lookupName }: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
[TypeDefInfo.DoNotConstruct]: (_registry: Registry, _typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, _withShortcut: boolean) => {
setImports(definitions, imports, ['DoNotConstruct']);
return 'DoNotConstruct';
},
[TypeDefInfo.Enum]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
[TypeDefInfo.Enum]: (_registry: Registry, typeDef: TypeDef, _definitions: Record<string, ModuleTypes>, _imports: TypeImports, _withShortcut: boolean) => {
if (typeDef.lookupName) {
return typeDef.lookupName;
}
@@ -153,15 +151,15 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
throw new Error(`TypeDefInfo.Enum: Parameter formatting not implemented on ${stringify(typeDef)}`);
},
[TypeDefInfo.Int]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
[TypeDefInfo.Int]: (_registry: Registry, typeDef: TypeDef, _definitions: Record<string, ModuleTypes>, _imports: TypeImports, _withShortcut: boolean) => {
throw new Error(`TypeDefInfo.Int: Parameter formatting not implemented on ${stringify(typeDef)}`);
},
[TypeDefInfo.UInt]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
[TypeDefInfo.UInt]: (_registry: Registry, typeDef: TypeDef, _definitions: Record<string, ModuleTypes>, _imports: TypeImports, _withShortcut: boolean) => {
throw new Error(`TypeDefInfo.UInt: Parameter formatting not implemented on ${stringify(typeDef)}`);
},
[TypeDefInfo.Null]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
[TypeDefInfo.Null]: (_registry: Registry, _typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, _withShortcut: boolean) => {
setImports(definitions, imports, ['Null']);
return 'Null';
@@ -171,7 +169,7 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
return singleParamNotation(registry, 'Option', typeDef, definitions, imports, withShortcut);
},
[TypeDefInfo.Plain]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
[TypeDefInfo.Plain]: (_registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, _withShortcut: boolean) => {
setImports(definitions, imports, [typeDef.type]);
return typeDef.type;
@@ -185,7 +183,7 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
return singleParamNotation(registry, 'RangeInclusive', typeDef, definitions, imports, withShortcut);
},
[TypeDefInfo.Set]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
[TypeDefInfo.Set]: (_registry: Registry, typeDef: TypeDef, _definitions: Record<string, ModuleTypes>, _imports: TypeImports, _withShortcut: boolean) => {
throw new Error(`TypeDefInfo.Set: Parameter formatting not implemented on ${stringify(typeDef)}`);
},
+3
View File
@@ -36,6 +36,9 @@ async function getWsData <T> (endpoint: string, method: 'rpc_methods' | 'state_g
websocket.close();
};
} catch (error) {
console.error();
console.error(error);
console.error();
process.exit(1);
}
});
+2 -4
View File
@@ -197,8 +197,7 @@ export abstract class AbstractInt extends BN implements INumber {
/**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public toHuman (isExpanded?: boolean): string {
public toHuman (_isExpanded?: boolean): string {
const rawType = this.toRawType();
if (rawType === 'Balance') {
@@ -263,8 +262,7 @@ export abstract class AbstractInt extends BN implements INumber {
* @description Encodes the value as a Uint8Array as per the SCALE specifications
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public toU8a (isBare?: boolean): Uint8Array {
public toU8a (_isBare?: boolean): Uint8Array {
return bnToU8a(this, {
bitLength: this.bitLength(),
isLe: true,
+1 -2
View File
@@ -195,8 +195,7 @@ export class Compact<T extends INumber> implements ICompact<T> {
* @description Encodes the value as a Uint8Array as per the SCALE specifications
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public toU8a (isBare?: boolean): Uint8Array {
public toU8a (_isBare?: boolean): Uint8Array {
return compactToU8a(this.#raw.toBn());
}
+1 -2
View File
@@ -91,8 +91,7 @@ export class Null implements Codec {
* @description Encodes the value as a Uint8Array as per the SCALE specifications
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public toU8a (isBare?: boolean): Uint8Array {
public toU8a (_isBare?: boolean): Uint8Array {
return new Uint8Array();
}
}
+1 -1
View File
@@ -131,7 +131,7 @@ describe('Vec', (): void => {
it('exposes a working filter', (): void => {
expect(
vector.filter((e, i): boolean => i >= 3).toString()
vector.filter((_, i): boolean => i >= 3).toString()
).toEqual('4567,56789');
});
+5 -5
View File
@@ -118,14 +118,14 @@ export class Vec<T extends Codec> extends AbstractArray<T> {
/**
* @description Finds the index of the value in the array
*/
public override indexOf (_other?: unknown): number {
public override indexOf (other?: unknown): number {
// convert type first, this removes overhead from the eq
const other = _other instanceof this.#Type
? _other
: new this.#Type(this.registry, _other);
const check = other instanceof this.#Type
? other
: new this.#Type(this.registry, other);
for (let i = 0; i < this.length; i++) {
if (other.eq(this[i])) {
if (check.eq(this[i])) {
return i;
}
}
+1 -2
View File
@@ -132,8 +132,7 @@ export class bool extends Boolean implements Codec {
* @description Encodes the value as a Uint8Array as per the SCALE specifications
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public toU8a (isBare?: boolean): Uint8Array {
public toU8a (_isBare?: boolean): Uint8Array {
return new Uint8Array([this.valueOf() ? 1 : 0]);
}
}
+1 -2
View File
@@ -164,8 +164,7 @@ export class CodecDate extends Date implements INumber {
* @description Encodes the value as a Uint8Array as per the SCALE specifications
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public toU8a (isBare?: boolean): Uint8Array {
public toU8a (_isBare?: boolean): Uint8Array {
return bnToU8a(this.toNumber(), U8A_OPTS);
}
}
+1 -2
View File
@@ -141,8 +141,7 @@ export class Json extends Map<string, any> implements Codec {
/**
* @description Unimplemented, will throw
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public toU8a (isBare?: boolean): Uint8Array {
public toU8a (_isBare?: boolean): Uint8Array {
throw new Error('Unimplemented');
}
}
+1 -2
View File
@@ -155,8 +155,7 @@ export class Raw extends Uint8Array implements IU8a {
* @description Encodes the value as a Uint8Array as per the SCALE specifications
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public toU8a (isBare?: boolean): Uint8Array {
public toU8a (_isBare?: boolean): Uint8Array {
return Uint8Array.from(this);
}
+1 -2
View File
@@ -259,8 +259,7 @@ export class CodecSet extends Set<string> implements ISet<string> {
* @description Encodes the value as a Uint8Array as per the SCALE specifications
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public toU8a (isBare?: boolean): Uint8Array {
public toU8a (_isBare?: boolean): Uint8Array {
return bnToU8a(this.valueEncoded, {
bitLength: this.#byteLength * 8,
isLe: true
+1 -1
View File
@@ -75,7 +75,7 @@ function decodeStructFromObject (registry: Registry, [Types, keys]: Definition,
try {
type = new Type(registry).toRawType();
} catch (error) {
} catch {
// ignore
}
+1 -1
View File
@@ -6,7 +6,7 @@ import type { Codec, CodecClass, Registry } from '../types/index.js';
import { u8aToHex } from '@polkadot/util';
/** @internal */
function formatFailure (registry: Registry, fn: 'decodeU8a' | 'decodeU8aStruct' | 'decodeU8aVec', result: unknown[], { message }: Error, u8a: Uint8Array, i: number, count: number, Type: CodecClass, key?: string): string {
function formatFailure (registry: Registry, fn: 'decodeU8a' | 'decodeU8aStruct' | 'decodeU8aVec', _result: unknown[], { message }: Error, u8a: Uint8Array, i: number, count: number, Type: CodecClass, key?: string): string {
let type = '';
try {
+21 -22
View File
@@ -70,19 +70,19 @@ function createWithSub (Clazz: { with: (t: string) => CodecClass<Codec> }, value
}
const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => CodecClass<Codec>> = {
[TypeDefInfo.BTreeMap]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.BTreeMap]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
createHashMap(BTreeMap, value),
[TypeDefInfo.BTreeSet]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.BTreeSet]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
createWithSub(BTreeSet, value),
[TypeDefInfo.Compact]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.Compact]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
createWithSub(Compact, value),
[TypeDefInfo.DoNotConstruct]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.DoNotConstruct]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
DoNotConstruct.with(value.displayName || value.type),
[TypeDefInfo.Enum]: (registry: Registry, value: TypeDef): CodecClass<Codec> => {
[TypeDefInfo.Enum]: (_registry: Registry, value: TypeDef): CodecClass<Codec> => {
const subs = getSubDefArray(value);
return Enum.with(
@@ -96,14 +96,14 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
);
},
[TypeDefInfo.HashMap]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.HashMap]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
createHashMap(HashMap, value),
[TypeDefInfo.Int]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.Int]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
createInt(Int, value),
// We have circular deps between Linkage & Struct
[TypeDefInfo.Linkage]: (registry: Registry, value: TypeDef): CodecClass<Codec> => {
[TypeDefInfo.Linkage]: (_registry: Registry, value: TypeDef): CodecClass<Codec> => {
const type = `Option<${getSubType(value)}>`;
// eslint-disable-next-line sort-keys
const Clazz = Struct.with({ previous: type, next: type } as any);
@@ -117,11 +117,10 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
return Clazz;
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[TypeDefInfo.Null]: (registry: Registry, _: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.Null]: (_registry: Registry, _value: TypeDef): CodecClass<Codec> =>
Null,
[TypeDefInfo.Option]: (registry: Registry, value: TypeDef): CodecClass<Codec> => {
[TypeDefInfo.Option]: (_registry: Registry, value: TypeDef): CodecClass<Codec> => {
if (!value.sub || Array.isArray(value.sub)) {
throw new Error('Expected type information for Option');
}
@@ -137,20 +136,20 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
[TypeDefInfo.Plain]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
registry.getOrUnknown(value.type),
[TypeDefInfo.Range]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.Range]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
createWithSub(Range, value),
[TypeDefInfo.RangeInclusive]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.RangeInclusive]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
createWithSub(RangeInclusive, value),
[TypeDefInfo.Result]: (registry: Registry, value: TypeDef): CodecClass<Codec> => {
[TypeDefInfo.Result]: (_registry: Registry, value: TypeDef): CodecClass<Codec> => {
const [Ok, Err] = getTypeClassArray(value);
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return Result.with({ Err, Ok });
},
[TypeDefInfo.Set]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.Set]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
CodecSet.with(
getSubDefArray(value).reduce<Record<string, number>>((result, { index, name }) => {
result[name as string] = index as number;
@@ -163,16 +162,16 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
[TypeDefInfo.Si]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
getTypeClass(registry, registry.lookup.getTypeDef(value.type as LookupString)),
[TypeDefInfo.Struct]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.Struct]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
Struct.with(getTypeClassMap(value), value.alias),
[TypeDefInfo.Tuple]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.Tuple]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
Tuple.with(getTypeClassArray(value)),
[TypeDefInfo.UInt]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.UInt]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
createInt(UInt, value),
[TypeDefInfo.Vec]: (registry: Registry, { sub }: TypeDef): CodecClass<Codec> => {
[TypeDefInfo.Vec]: (_registry: Registry, { sub }: TypeDef): CodecClass<Codec> => {
if (!sub || Array.isArray(sub)) {
throw new Error('Expected type information for vector');
}
@@ -184,7 +183,7 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
);
},
[TypeDefInfo.VecFixed]: (registry: Registry, { displayName, length, sub }: TypeDef): CodecClass<Codec> => {
[TypeDefInfo.VecFixed]: (_registry: Registry, { displayName, length, sub }: TypeDef): CodecClass<Codec> => {
if (!isNumber(length) || !sub || Array.isArray(sub)) {
throw new Error('Expected length & type information for fixed vector');
}
@@ -196,10 +195,10 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
);
},
[TypeDefInfo.WrapperKeepOpaque]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.WrapperKeepOpaque]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
createWithSub(WrapperKeepOpaque, value),
[TypeDefInfo.WrapperOpaque]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
[TypeDefInfo.WrapperOpaque]: (_registry: Registry, value: TypeDef): CodecClass<Codec> =>
createWithSub(WrapperOpaque, value)
};
+7 -11
View File
@@ -96,21 +96,19 @@ const encoders: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef) => st
[TypeDefInfo.HashMap]: (registry: Registry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'HashMap'),
[TypeDefInfo.Int]: (registry: Registry, { length = 32 }: TypeDef) =>
[TypeDefInfo.Int]: (_registry: Registry, { length = 32 }: TypeDef) =>
`Int<${length}>`,
[TypeDefInfo.Linkage]: (registry: Registry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'Linkage'),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[TypeDefInfo.Null]: (registry: Registry, typeDef: TypeDef) =>
[TypeDefInfo.Null]: (_registry: Registry, _typeDef: TypeDef) =>
'Null',
[TypeDefInfo.Option]: (registry: Registry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'Option'),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[TypeDefInfo.Plain]: (registry: Registry, { displayName, type }: TypeDef) =>
[TypeDefInfo.Plain]: (_registry: Registry, { displayName, type }: TypeDef) =>
displayName || type,
[TypeDefInfo.Range]: (registry: Registry, typeDef: TypeDef) =>
@@ -122,8 +120,7 @@ const encoders: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef) => st
[TypeDefInfo.Result]: (registry: Registry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'Result'),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[TypeDefInfo.Set]: (registry: Registry, { length = 8, sub }: TypeDef): string => {
[TypeDefInfo.Set]: (_registry: Registry, { length = 8, sub }: TypeDef): string => {
if (!Array.isArray(sub)) {
throw new Error('Unable to encode Set type');
}
@@ -135,8 +132,7 @@ const encoders: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef) => st
});
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[TypeDefInfo.Si]: (registry: Registry, { lookupName, type }: TypeDef) =>
[TypeDefInfo.Si]: (_registry: Registry, { lookupName, type }: TypeDef) =>
lookupName || type,
[TypeDefInfo.Struct]: (registry: Registry, { alias, sub }: TypeDef): string => {
@@ -163,13 +159,13 @@ const encoders: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef) => st
return `(${sub.map((type) => encodeTypeDef(registry, type)).join(',')})`;
},
[TypeDefInfo.UInt]: (registry: Registry, { length = 32 }: TypeDef) =>
[TypeDefInfo.UInt]: (_registry: Registry, { length = 32 }: TypeDef) =>
`UInt<${length}>`,
[TypeDefInfo.Vec]: (registry: Registry, typeDef: TypeDef) =>
encodeWithParams(registry, typeDef, 'Vec'),
[TypeDefInfo.VecFixed]: (registry: Registry, { length, sub }: TypeDef): string => {
[TypeDefInfo.VecFixed]: (_registry: Registry, { length, sub }: TypeDef): string => {
if (!isNumber(length) || !sub || Array.isArray(sub)) {
throw new Error('Unable to encode VecFixed type');
}
@@ -89,7 +89,6 @@ function _decodeSet (value: TypeDef, details: Record<string, number>, fallbackTy
}
// 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 {
const parsed = JSON.parse(type) as Record<string, unknown> & { _alias: string, _fallback?: string };
const keys = Object.keys(parsed);
@@ -114,7 +113,6 @@ function _decodeStruct (value: TypeDef, type: string, _: string, count: number):
}
// decode a fixed vector, e.g. [u8;32]
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function _decodeFixedVec (value: TypeDef, type: string, _: string, count: number): TypeDef {
const max = type.length - 1;
let index = -1;
@@ -173,7 +171,6 @@ function _decodeTuple (value: TypeDef, _: string, subType: string, count: number
}
// decode a Int/UInt<bitLength[, name]>
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function _decodeAnyInt (value: TypeDef, type: string, _: string, clazz: 'Int' | 'UInt'): TypeDef {
const [strLength, displayName] = type.substring(clazz.length + 1, type.length - 1).split(',');
const length = parseInt(strLength.trim(), 10);
@@ -196,7 +193,6 @@ function _decodeUInt (value: TypeDef, type: string, subType: string): TypeDef {
return _decodeAnyInt(value, type, subType, 'UInt');
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function _decodeDoNotConstruct (value: TypeDef, type: string, _: string): TypeDef {
const NAME_LENGTH = 'DoNotConstruct'.length;
+2 -4
View File
@@ -118,8 +118,7 @@ function decodeExtrinsicEra (value: IExtrinsicEra | MortalMethod | MortalEnumDef
* The ImmortalEra for an extrinsic
*/
export class ImmortalEra extends Raw {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
constructor (registry: Registry, value?: AnyU8a) {
constructor (registry: Registry, _value?: AnyU8a) {
// For immortals, we always provide the known value (i.e. treated as a
// constant no matter how it is constructed - it is a fixed structure)
super(registry, IMMORTAL_ERA);
@@ -187,8 +186,7 @@ export class MortalEra extends Tuple {
* greater than 1 << 12, then it will be a factor of the times greater than 1<<12 that
* `period` is.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public override toU8a (isBare?: boolean): Uint8Array {
public override toU8a (_isBare?: boolean): Uint8Array {
const period = this.period.toNumber();
const encoded = Math.min(
15,
@@ -12,7 +12,7 @@ import { Struct } from '@polkadot/types-codec';
* A default handler for payloads where the version is not known (default throw)
*/
export class GenericExtrinsicPayloadUnknown extends Struct {
constructor (registry: Registry, value?: unknown, { version = 0 }: Partial<ExtrinsicPayloadOptions> = {}) {
constructor (registry: Registry, _value?: unknown, { version = 0 }: Partial<ExtrinsicPayloadOptions> = {}) {
super(registry, {});
throw new Error(`Unsupported extrinsic payload version ${version}`);
@@ -14,7 +14,7 @@ import { UNMASK_VERSION } from './constants.js';
* A default handler for extrinsics where the version is not known (default throw)
*/
export class GenericExtrinsicUnknown extends Struct {
constructor (registry: Registry, value?: unknown, { isSigned = false, version = 0 }: Partial<ExtrinsicOptions> = {}) {
constructor (registry: Registry, _value?: unknown, { isSigned = false, version = 0 }: Partial<ExtrinsicOptions> = {}) {
super(registry, {});
throw new Error(`Unsupported ${isSigned ? '' : 'un'}signed extrinsic version ${version & UNMASK_VERSION}`);
+2 -2
View File
@@ -137,7 +137,7 @@ export class GenericCall<A extends AnyTuple = AnyTuple> extends Struct implement
const c = registry.findMetaCall(decoded.callIndex);
method = `${c.section}.${c.method}`;
} catch (error) {
} catch {
// ignore
}
@@ -218,7 +218,7 @@ export class GenericCall<A extends AnyTuple = AnyTuple> extends Struct implement
try {
call = this.registry.findMetaCall(this.callIndex);
} catch (error) {
} catch {
// swallow
}
+1 -1
View File
@@ -24,7 +24,7 @@ function decodeU8a (registry: Registry, u8a: Uint8Array): MetadataVersioned | Ui
// when we fail on V9, try to re-parse it as v10...
try {
return new MetadataVersioned(registry, u8a);
} catch (error) {
} catch {
u8a[VERSION_IDX] = 10;
return u8a;
@@ -10,7 +10,6 @@ import { hexToU8a, lazyMethod, lazyMethods, stringCamelCase } from '@polkadot/ut
import { objectNameToCamel } from '../util.js';
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function decorateConstants (registry: Registry, { pallets }: MetadataLatest, _version: number): Constants {
const result: Constants = {};
@@ -17,7 +17,6 @@ const VERSION_KEY = ':__STORAGE_VERSION__:';
const VERSION_DOCS = { docs: 'Returns the current pallet version from storage', type: 'u16' };
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function decorateStorage (registry: Registry, { pallets }: MetadataLatest, _metaVersion: number): Storage {
const result: Storage = getStorage(registry);
-2
View File
@@ -174,7 +174,6 @@ function convertConstants (specs: TypeSpec[], registry: Registry, constants: Mod
* Apply module-specific type overrides (always be done as part of toV14)
* @internal
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function convertErrors (specs: TypeSpec[], registry: Registry, modName: Text, errors: ErrorMetadataV13[], _sectionTypes: OverrideModuleType): PalletErrorMetadataV14 {
const variants = errors.map(({ docs, name }, index): SiVariant =>
registry.createTypeUnsafe('SiVariant', [{
@@ -293,7 +292,6 @@ function convertStorage (specs: TypeSpec[], registry: Registry, { items, prefix
}
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function convertExtrinsic (registry: Registry, { signedExtensions, version }: ExtrinsicMetadataV13): ExtrinsicMetadataV14 {
return registry.createTypeUnsafe('ExtrinsicMetadataV14', [{
signedExtensions: signedExtensions.map((identifier) => ({
+1 -2
View File
@@ -8,7 +8,6 @@ import type { MetadataLatest, MetadataV14 } from '../../interfaces/metadata/inde
* Convert the Metadata (which is an alias) to latest
* @internal
**/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function toLatest (registry: Registry, v14: MetadataV14, _metaVersion: number): MetadataLatest {
export function toLatest (_registry: Registry, v14: MetadataV14, _metaVersion: number): MetadataLatest {
return v14;
}
+1 -1
View File
@@ -241,7 +241,7 @@ export class StorageKey<A extends AnyTuple = AnyTuple> extends Bytes implements
try {
this.#args = decodeArgsFromMeta(this.registry, this.toU8a(true), meta);
} catch (error) {
} catch {
// ignore...
}