Skip to content

Commit

Permalink
Bump dev (w/ ts-eslint updates) (#5691)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr authored Aug 16, 2023
1 parent 319535a commit d8136a8
Show file tree
Hide file tree
Showing 73 changed files with 358 additions and 268 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"test:one": "polkadot-dev-run-test --env node"
},
"devDependencies": {
"@polkadot/dev": "^0.75.26",
"@polkadot/dev": "^0.76.1",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/node": "^20.4.0"
"@types/node": "^20.4.2"
},
"resolutions": {
"typescript": "^5.0.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/api-base/src/types/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface PaginationOptions<A = unknown> {
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
type AsCodec<R> = R extends Codec
? R
: Codec;

Expand Down
9 changes: 4 additions & 5 deletions packages/api-base/src/types/calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ 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>;
? <T = ReturnCodec<F>> (...args: Parameters<F>) => Observable<T>
: <T = ReturnCodec<F>> (...args: Parameters<F>) => Promise<T>;

export type AugmentedCall<ApiType extends ApiTypes, F extends AnyFunction = (...args: any[]) => Observable<Codec>> = DecoratedCallBase<ApiType, F> & {
/** The metadata/description/definition for this method */
Expand All @@ -22,11 +22,10 @@ export interface AugmentedCalls<ApiType extends ApiTypes> extends EmptyBase<ApiT
// augmented
}

// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
export interface QueryableCalls<ApiType extends ApiTypes> extends AugmentedCalls<ApiType> {
// when non-augmented, we need to at least have Codec results
[key: string]: QueryableModuleCalls<ApiType>;
}

export interface QueryableModuleCalls<ApiType extends ApiTypes> {
[key: string]: DecoratedCallBase<ApiType>;
}
export type QueryableModuleCalls<ApiType extends ApiTypes> = Record<string, DecoratedCallBase<ApiType>>;
5 changes: 2 additions & 3 deletions packages/api-base/src/types/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ export interface AugmentedConsts<ApiType extends ApiTypes> extends EmptyBase<Api
// augmented
}

// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
export interface QueryableConsts<ApiType extends ApiTypes> extends AugmentedConsts<ApiType> {
// when non-augmented, we need to at least have Codec results
[key: string]: QueryableModuleConsts;
}

export interface QueryableModuleConsts {
[key: string]: Codec;
}
export type QueryableModuleConsts = Record<string, Codec>;
5 changes: 2 additions & 3 deletions packages/api-base/src/types/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ export interface AugmentedErrors<ApiType extends ApiTypes> extends EmptyBase<Api
// augmented
}

// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
export interface DecoratedErrors<ApiType extends ApiTypes> extends AugmentedErrors<ApiType> {
// when non-augmented, we need to at least have Codec results
[key: string]: ModuleErrors<ApiType>;
}

export interface ModuleErrors<ApiType extends ApiTypes> {
[key: string]: AugmentedError<ApiType>;
}
export type ModuleErrors<ApiType extends ApiTypes> = Record<string, AugmentedError<ApiType>>;
5 changes: 2 additions & 3 deletions packages/api-base/src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ export interface AugmentedEvents<ApiType extends ApiTypes> extends EmptyBase<Api
// augmented
}

// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
export interface DecoratedEvents<ApiType extends ApiTypes> extends AugmentedEvents<ApiType> {
// when non-augmented, we need to at least have Codec results
[key: string]: ModuleEvents<ApiType>;
}

export interface ModuleEvents<ApiType extends ApiTypes> {
[key: string]: AugmentedEvent<ApiType>;
}
export type ModuleEvents<ApiType extends ApiTypes> = Record<string, AugmentedEvent<ApiType>>;
30 changes: 12 additions & 18 deletions packages/api-base/src/types/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { AnyFunction, AnyTuple, Callback, Codec, IStorageKey } from '@polkadot/types/types';
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[]>;
}
type StorageEntryObservableMulti<R extends Codec = Codec> = <T extends Codec = R>(args: unknown[]) => Observable<T[]>;

interface StorageEntryPromiseMulti<R extends Codec = Codec> {
<T extends Codec = R>(args: (unknown[] | unknown)[]): Promise<T[]>;
<T extends Codec = R>(args: (unknown[] | unknown)[], callback: Callback<T[]>): UnsubscribePromise;
<T extends Codec = R>(args: unknown[]): Promise<T[]>;
<T extends Codec = R>(args: unknown[], callback: Callback<T[]>): UnsubscribePromise;
}

export interface StorageEntryPromiseOverloads {
Expand Down Expand Up @@ -48,12 +46,12 @@ export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunctio
/**
* @deprecated Use api.at(<blockHash>)
*/
at: <T extends Codec | any = ReturnCodec<F>>(hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, T>;
at: <T = ReturnCodec<F>>(hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, T>;
creator: StorageEntry;
/**
* @deprecated Use api.at(<blockHash>)
*/
entriesAt: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(hash: Hash | Uint8Array | string, ...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
entriesAt: <T = ReturnCodec<F>, K extends AnyTuple = A>(hash: Hash | Uint8Array | string, ...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
/**
* @deprecated Use api.at(<blockHash>)
*/
Expand All @@ -68,8 +66,8 @@ export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunctio
}

export interface StorageEntryBaseAt<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> {
entries: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
entriesPaged: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
entries: <T = ReturnCodec<F>, K extends AnyTuple = A>(...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
entriesPaged: <T = ReturnCodec<F>, K extends AnyTuple = A>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
is: (key: IStorageKey<AnyTuple>) => key is IStorageKey<A>;
key: (...args: Parameters<F>) => string;
Expand All @@ -79,21 +77,15 @@ export interface StorageEntryBaseAt<ApiType extends ApiTypes, F extends AnyFunct
size: (...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
}

export interface QueryableModuleStorage<ApiType extends ApiTypes> {
[key: string]: QueryableStorageEntry<ApiType, AnyTuple>;
}
export type QueryableModuleStorage<ApiType extends ApiTypes> = Record<string, QueryableStorageEntry<ApiType, AnyTuple>>;

export interface QueryableModuleStorageAt<ApiType extends ApiTypes> {
[key: string]: QueryableStorageEntryAt<ApiType, AnyTuple>;
}
export type QueryableModuleStorageAt<ApiType extends ApiTypes> = Record<string, QueryableStorageEntryAt<ApiType, AnyTuple>>;

export type QueryableStorageMultiArg<ApiType extends ApiTypes> =
QueryableStorageEntry<ApiType> |
[QueryableStorageEntry<ApiType>, ...unknown[]];

export interface QueryableStorageMultiBase<ApiType extends ApiTypes> {
<T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[]): Observable<T>;
}
export type QueryableStorageMultiBase<ApiType extends ApiTypes> = <T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[]) => Observable<T>;

export interface QueryableStorageMultiPromise<ApiType extends ApiTypes> {
<T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[], callback: Callback<T>): UnsubscribePromise;
Expand All @@ -119,11 +111,13 @@ export interface AugmentedQueries<ApiType extends ApiTypes> extends EmptyBase<Ap
// augmented
}

// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
// when non-augmented, we need to at least have Codec results
[key: string]: QueryableModuleStorage<ApiType>;
}

// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
export interface QueryableStorageAt<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
[key: string]: QueryableModuleStorageAt<ApiType>;
}
5 changes: 1 addition & 4 deletions packages/api-base/src/types/submittable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,4 @@ export interface SubmittableExtrinsics<ApiType extends ApiTypes> extends Augment
[key: string]: SubmittableModuleExtrinsics<ApiType>;
}

export interface SubmittableModuleExtrinsics<ApiType extends ApiTypes> {
// only with is<Type> augmentation
[key: string]: SubmittableExtrinsicFunction<ApiType>;
}
export type SubmittableModuleExtrinsics<ApiType extends ApiTypes> = Record<string, SubmittableExtrinsicFunction<ApiType>>;
2 changes: 1 addition & 1 deletion packages/api-contract/src/Abi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class Abi {
readonly messages: AbiMessage[];
readonly metadata: ContractMetadataLatest;
readonly registry: Registry;
readonly environment: Map<string, TypeDef | Codec> = new Map();
readonly environment = new Map<string, TypeDef | Codec>();

constructor (abiJson: Record<string, unknown> | string, chainProperties?: ChainProperties) {
[this.json, this.registry, this.metadata, this.info] = parseJson(
Expand Down
4 changes: 1 addition & 3 deletions packages/api-contract/src/base/Blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ import { Base } from './Base.js';
import { Contract } from './Contract.js';
import { convertWeight, createBluePrintTx, encodeSalt } from './util.js';

export interface BlueprintConstructor<ApiType extends ApiTypes> {
new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, codeHash: string | Hash | Uint8Array): Blueprint<ApiType>;
}
export type BlueprintConstructor<ApiType extends ApiTypes> = new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, codeHash: string | Hash | Uint8Array) => Blueprint<ApiType>;

export class BlueprintSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
readonly contract?: Contract<ApiType> | undefined;
Expand Down
4 changes: 1 addition & 3 deletions packages/api-contract/src/base/Code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import { Blueprint } from './Blueprint.js';
import { Contract } from './Contract.js';
import { convertWeight, createBluePrintTx, encodeSalt } from './util.js';

export interface CodeConstructor<ApiType extends ApiTypes> {
new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, wasm: Uint8Array | string | Buffer | null | undefined): Code<ApiType>;
}
export type CodeConstructor<ApiType extends ApiTypes> = new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, wasm: Uint8Array | string | Buffer | null | undefined) => Code<ApiType>;

export class CodeSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
readonly blueprint?: Blueprint<ApiType> | undefined;
Expand Down
4 changes: 1 addition & 3 deletions packages/api-contract/src/base/Contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import { applyOnEvent } from '../util.js';
import { Base } from './Base.js';
import { convertWeight, withMeta } from './util.js';

export interface ContractConstructor<ApiType extends ApiTypes> {
new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, address: string | AccountId): Contract<ApiType>;
}
export type ContractConstructor<ApiType extends ApiTypes> = new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, address: string | AccountId) => Contract<ApiType>;

// As per Rust, 5 * GAS_PER_SEC
const MAX_CALL_GAS = new BN(5_000_000_000_000).isub(BN_ONE);
Expand Down
16 changes: 4 additions & 12 deletions packages/api-contract/src/base/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ export interface ContractTx<ApiType extends ApiTypes> extends MessageMeta {
(options: ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
}

export interface ContractGeneric<O, T> {
(messageOrId: AbiMessage | string | number, options: O, ...params: unknown[]): T;
}
export type ContractGeneric<O, T> = (messageOrId: AbiMessage | string | number, options: O, ...params: unknown[]) => T;

export type ContractCallResult<ApiType extends ApiTypes, T> = ApiType extends 'rxjs'
? Observable<T>
Expand All @@ -35,14 +33,8 @@ export interface ContractCallSend<ApiType extends ApiTypes> {
send (account: string | AccountId | Uint8Array): ContractCallResult<ApiType, ContractCallOutcome>;
}

export interface MapConstructorExec<ApiType extends ApiTypes> {
[message: string]: BlueprintDeploy<ApiType>;
}
export type MapConstructorExec<ApiType extends ApiTypes> = Record<string, BlueprintDeploy<ApiType>>;

export interface MapMessageTx<ApiType extends ApiTypes> {
[message: string]: ContractTx<ApiType>;
}
export type MapMessageTx<ApiType extends ApiTypes> = Record<string, ContractTx<ApiType>>;

export interface MapMessageQuery<ApiType extends ApiTypes> {
[message: string]: ContractQuery<ApiType>;
}
export type MapMessageQuery<ApiType extends ApiTypes> = Record<string, ContractQuery<ApiType>>;
2 changes: 1 addition & 1 deletion packages/api-contract/src/base/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function createBluePrintWithId <T> (fn: (constructorOrId: AbiConstructor
export function encodeSalt (salt: Uint8Array | string | null = randomAsU8a()): Uint8Array {
return salt instanceof Bytes
? salt
: salt && salt.length
: salt?.length
? compactAddLength(u8aToU8a(salt))
: EMPTY_SALT;
}
Expand Down
6 changes: 2 additions & 4 deletions packages/api-contract/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ export interface AbiMessage {

export type AbiConstructor = AbiMessage;

export interface InterfaceContractCalls {
// eslint-disable-next-line @typescript-eslint/ban-types
[index: string]: Function;
}
// eslint-disable-next-line @typescript-eslint/ban-types
export type InterfaceContractCalls = Record<string, Function>;

export interface ContractCallOutcome {
debugMessage: Text;
Expand Down
2 changes: 1 addition & 1 deletion packages/api-derive/src/accounts/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type FlagsIntermediate = [
];

function parseFlags (address: AccountId | Address | string | null | undefined, [electionsMembers, councilMembers, technicalCommitteeMembers, societyMembers, sudoKey]: FlagsIntermediate): DeriveAccountFlags {
const addrStr = address && address.toString();
const addrStr = address?.toString();
const isIncluded = (id: AccountId | Address | string) =>
id.toString() === addrStr;

Expand Down
2 changes: 1 addition & 1 deletion packages/api-derive/src/accounts/idToIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function idToIndex (instanceId: string, api: DeriveApi): (accountId: Acco
return memo(instanceId, (accountId: AccountId | string): Observable<AccountIndex | undefined> =>
api.derive.accounts.indexes().pipe(
map((indexes: AccountIndexes): AccountIndex | undefined =>
(indexes || {})[accountId.toString()]
indexes[accountId.toString()]
)
));
}
2 changes: 1 addition & 1 deletion packages/api-derive/src/accounts/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function extractIdentity (identityOfOpt?: Option<PalletIdentityRegistration>, su
judgements,
legal: dataAsString(info.legal),
other: extractOther(info.additional),
parent: superOf && superOf[0],
parent: superOf?.[0],
pgp: info.pgpFingerprint.unwrapOr(UNDEF_HEX).toHex(),
riot: dataAsString(info.riot),
twitter: dataAsString(info.twitter),
Expand Down
8 changes: 3 additions & 5 deletions packages/api-derive/src/balances/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ type BalanceResult = [Balance, Balance, Balance, Balance];

type Result = [Index, BalanceResult[]];

type DeriveCustomAccount = DeriveApi['derive'] & {
[custom: string]: {
customAccount?: DeriveApi['query']['balances']['account']
}
}
type DeriveCustomAccount = DeriveApi['derive'] & Record<string, {
customAccount?: DeriveApi['query']['balances']['account']
}>

function zeroBalance (api: DeriveApi) {
return api.registry.createType('Balance');
Expand Down
8 changes: 3 additions & 5 deletions packages/api-derive/src/balances/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ interface AllLocked {
vestingLocked: Balance
}

type DeriveCustomLocks = DeriveApi['derive'] & {
[custom: string]: {
customLocks?: DeriveApi['query']['balances']['locks']
}
}
type DeriveCustomLocks = DeriveApi['derive'] & Record<string, {
customLocks?: DeriveApi['query']['balances']['locks']
}>

const VESTING_ID = '0x76657374696e6720';

Expand Down
2 changes: 1 addition & 1 deletion packages/api-derive/src/balances/votingBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { memo } from '../util/index.js';

export function votingBalances (instanceId: string, api: DeriveApi): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DeriveBalancesAccount[]> {
return memo(instanceId, (addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DeriveBalancesAccount[]> =>
!addresses || !addresses.length
!addresses?.length
? of([] as DeriveBalancesAccount[])
: combineLatest(
addresses.map((accountId): Observable<DeriveBalancesAccount> =>
Expand Down
2 changes: 1 addition & 1 deletion packages/api-derive/src/bounties/bounties.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ describe('bounties derive', () => {
expect(result).toHaveLength(2);
expect(result[0].proposals).toHaveLength(0);
expect(result[1].proposals).toHaveLength(1);
expect(result[1].proposals[0].proposal && result[1].proposals[0].proposal.method).toEqual('approveBounty');
expect(result[1].proposals[0].proposal?.method).toEqual('approveBounty');
});
});
2 changes: 1 addition & 1 deletion packages/api-derive/src/collective/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { memo } from '../util/index.js';

export function getInstance (api: DeriveApi, section: string): DeriveApi['query']['council'] {
const instances = api.registry.getModuleInstances(api.runtimeVersion.specName, section);
const name = instances && instances.length
const name = instances?.length
? instances[0]
: section;

Expand Down
10 changes: 6 additions & 4 deletions packages/api-derive/src/staking/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ export function setEraMultiCache <T extends { era: EraIndex }> (CACHE_KEY: strin
}

export function filterCachedEras <T extends { era: EraIndex }> (eras: EraIndex[], cached: T[], query: T[]): T[] {
return eras.map((e) =>
cached.find(({ era }) => e.eq(era)) ||
query.find(({ era }) => e.eq(era)) as T
);
return eras
.map((e) =>
cached.find(({ era }) => e.eq(era)) ||
query.find(({ era }) => e.eq(era))
)
.filter((e): e is T => !!e);
}
2 changes: 1 addition & 1 deletion packages/api-derive/src/staking/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { firstMemo, memo } from '../util/index.js';
function parseDetails (stashId: AccountId, controllerIdOpt: Option<AccountId> | null, nominatorsOpt: Option<PalletStakingNominations>, rewardDestination: PalletStakingRewardDestination, validatorPrefs: PalletStakingValidatorPrefs, exposure: PalletStakingExposure, stakingLedgerOpt: Option<PalletStakingStakingLedger>): DeriveStakingQuery {
return {
accountId: stashId,
controllerId: controllerIdOpt && controllerIdOpt.unwrapOr(null),
controllerId: controllerIdOpt?.unwrapOr(null) || null,
exposure,
nominators: nominatorsOpt.isSome
? nominatorsOpt.unwrap().targets
Expand Down
10 changes: 6 additions & 4 deletions packages/api-derive/src/staking/stakerRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ export function _stakerRewards (instanceId: string, api: DeriveApi): (accountIds
queries.map(({ stakingLedger }, index): DeriveStakerReward[] =>
filterRewards(
eras,
stashValidators[index].map((validatorId): [string, DeriveStakingQuery] => [
validatorId,
queriedVals.find((q) => q.accountId.eq(validatorId)) as DeriveStakingQuery
]),
stashValidators[index]
.map((validatorId): [string, DeriveStakingQuery | undefined] => [
validatorId,
queriedVals.find((q) => q.accountId.eq(validatorId))
])
.filter((v): v is [string, DeriveStakingQuery] => !!v[1]),
{
rewards: allRewards[index],
stakingLedger
Expand Down
Loading

0 comments on commit d8136a8

Please sign in to comment.