Remove support for pre-v2 staking (#2980)

* Remove support for pre-v2 staking

* Adjust with util array functions

* Remove old enumset support

* Empty controller

* withController flag
This commit is contained in:
Jaco Greeff
2020-12-24 08:32:03 +01:00
committed by GitHub
parent 47f2ee725f
commit d6b2b4a1a3
24 changed files with 239 additions and 402 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
"@babel/runtime": "^7.12.5",
"@polkadot/api": "3.1.2-6",
"@polkadot/types": "3.1.2-6",
"@polkadot/util": "^5.1.1",
"@polkadot/util": "^5.1.2-1",
"@polkadot/x-rxjs": "3.1.2-6",
"bn.js": "^4.11.9"
}
+3 -3
View File
@@ -17,13 +17,13 @@
"@polkadot/api": "3.1.2-6",
"@polkadot/rpc-core": "3.1.2-6",
"@polkadot/types": "3.1.2-6",
"@polkadot/util": "^5.1.1",
"@polkadot/util-crypto": "^5.1.1",
"@polkadot/util": "^5.1.2-1",
"@polkadot/util-crypto": "^5.1.2-1",
"@polkadot/x-rxjs": "3.1.2-6",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^5.1.1",
"@polkadot/keyring": "^5.1.2-1",
"@polkadot/rpc-provider": "3.1.2-6"
}
}
+7 -29
View File
@@ -2,40 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { Option } from '@polkadot/types';
import type { AccountId, AccountIndex, BalanceOf } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { isFunction } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, startWith } from '@polkadot/x-rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
function queryEnumSet (api: ApiInterfaceRx, _accountIndex: AccountIndex | string): Observable<AccountId | undefined> {
const accountIndex = _accountIndex instanceof api.registry.createClass('AccountIndex')
? _accountIndex
: api.registry.createType('AccountIndex', _accountIndex);
return api.query.indices.enumSet<Vec<AccountId>>(accountIndex.div(ENUMSET_SIZE)).pipe(
startWith([]),
map((accounts): AccountId | undefined =>
(accounts || [])[accountIndex.mod(ENUMSET_SIZE).toNumber()]
)
);
}
// current
function query (api: ApiInterfaceRx, accountIndex: AccountIndex | string): Observable<AccountId | undefined> {
return api.query.indices.accounts<Option<ITuple<[AccountId, BalanceOf]>>>(accountIndex).pipe(
map((optResult): AccountId | undefined =>
optResult.unwrapOr([])[0]
)
);
}
/**
* @name indexToId
* @param {( AccountIndex | string )} accountIndex - An accounts index in different formats.
@@ -52,9 +28,11 @@ function query (api: ApiInterfaceRx, accountIndex: AccountIndex | string): Obser
export function indexToId (instanceId: string, api: ApiInterfaceRx): (accountIndex: AccountIndex | string) => Observable<AccountId | undefined> {
return memo(instanceId, (accountIndex: AccountIndex | string): Observable<AccountId | undefined> =>
api.query.indices
? isFunction(api.query.indices.accounts)
? query(api, accountIndex)
: queryEnumSet(api, accountIndex)
? api.query.indices.accounts<Option<ITuple<[AccountId, BalanceOf]>>>(accountIndex).pipe(
map((optResult): AccountId | undefined =>
optResult.unwrapOr([])[0]
)
)
: of(undefined)
);
}
+3 -35
View File
@@ -2,47 +2,17 @@
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import type { AccountIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIndexes } from '../types';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { isFunction } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, startWith, switchMap } from '@polkadot/x-rxjs/operators';
import { map, startWith } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
const enumsetSize = ENUMSET_SIZE.toNumber();
let indicesCache: AccountIndexes | null = null;
function queryEnumSet (api: ApiInterfaceRx): Observable<AccountIndexes> {
return api.query.indices.nextEnumSet<AccountIndex>().pipe(
// use the nextEnumSet (which is a counter of the number of sets) to construct
// a range of values to query [0, 1, 2, ...]. Retrieve the full enum set for the
// specific index - each query can return up to ENUMSET_SIZE (64) records, each
// containing an AccountId
switchMap((next: AccountIndex): Observable<Vec<AccountId>[]> =>
api.query.indices.enumSet.multi<Vec<AccountId>>([...Array(next.toNumber() + 1).keys()])
),
map((all: AccountId[][]): AccountIndexes =>
all.reduce((indexes: AccountIndexes, list, outerIndex): AccountIndexes => {
(list || []).forEach((accountId, innerIndex): void => {
// re-create the index based on position 0 is [0][0] and likewise
// 64 (0..63 in first) is [1][0] (the first index value in set 2)
const index = (outerIndex * enumsetSize) + innerIndex;
indexes[accountId.toString()] = api.registry.createType('AccountIndex', index);
});
return indexes;
}, {})
)
);
}
function queryAccounts (api: ApiInterfaceRx): Observable<AccountIndexes> {
return api.query.indices.accounts.entries().pipe(
map((entries): AccountIndexes =>
@@ -78,9 +48,7 @@ export function indexes (instanceId: string, api: ApiInterfaceRx): () => Observa
? of(indicesCache)
: (
api.query.indices
? isFunction(api.query.indices.accounts)
? queryAccounts(api).pipe(startWith({}))
: queryEnumSet(api).pipe(startWith({}))
? queryAccounts(api).pipe(startWith({}))
: of({} as AccountIndexes)
).pipe(
map((indices): AccountIndexes => {
+1 -31
View File
@@ -7,16 +7,11 @@ import type { ActiveEraInfo, EraIndex, Moment, SessionIndex } from '@polkadot/ty
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSessionIndexes } from '../types';
import { isFunction } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
function isEraOpt (era: Option<EraIndex> | EraIndex): era is Option<EraIndex> {
return isFunction((era as Option<EraIndex>).unwrapOrDefault);
}
// parse into Indexes
function parse ([activeEra, activeEraStart, currentEra, currentIndex, validatorCount]: [EraIndex, Option<Moment>, EraIndex, SessionIndex, u32]): DeriveSessionIndexes {
return {
@@ -28,29 +23,6 @@ function parse ([activeEra, activeEraStart, currentEra, currentIndex, validatorC
};
}
// query for previous V2
function queryNoActive (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
return api.queryMulti<[Option<EraIndex> | EraIndex, SessionIndex, u32]>([
api.query.staking.currentEra,
api.query.session.currentIndex,
api.query.staking.validatorCount
]).pipe(
map(([currentEraOpt, currentIndex, validatorCount]): DeriveSessionIndexes => {
const currentEra = isEraOpt(currentEraOpt)
? currentEraOpt.unwrapOrDefault()
: currentEraOpt;
return parse([
currentEra,
api.registry.createType('Option<Moment>'),
currentEra,
currentIndex,
validatorCount
]);
})
);
}
// query based on latest
function query (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
return api.queryMulti<[Option<ActiveEraInfo>, Option<EraIndex>, SessionIndex, u32]>([
@@ -87,9 +59,7 @@ function empty (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
export function indexes (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSessionIndexes> {
return memo(instanceId, (): Observable<DeriveSessionIndexes> =>
api.query.session && api.query.staking
? isFunction(api.query.staking.activeEra)
? query(api)
: queryNoActive(api)
? query(api)
: empty(api)
);
}
+1 -18
View File
@@ -7,7 +7,6 @@ import type { SessionIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSessionInfo, DeriveSessionProgress } from '../types';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
@@ -57,29 +56,13 @@ function queryBabe (api: ApiInterfaceRx): Observable<[DeriveSessionInfo, ResultS
);
}
function queryBabeNoHistory (api: ApiInterfaceRx): Observable<[DeriveSessionInfo, ResultSlotsFlat]> {
return combineLatest([
api.derive.session.info(),
api.queryMulti<ResultSlotsFlat>([
api.query.babe.currentSlot,
api.query.babe.epochIndex,
api.query.babe.genesisSlot,
api.query.staking.currentEraStartSessionIndex
])
]);
}
/**
* @description Retrieves all the session and era query and calculates specific values on it as the length of the session and eras
*/
export function progress (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSessionProgress> {
return memo(instanceId, (): Observable<DeriveSessionProgress> =>
api.consts.babe
? (
isFunction(api.query.staking.erasStartSessionIndex)
? queryBabe(api) // 2.x with Babe
: queryBabeNoHistory(api)
).pipe(
? queryBabe(api).pipe(
map(([info, slots]: [DeriveSessionInfo, ResultSlotsFlat]): DeriveSessionProgress =>
createDerive(api, info, slots)
)
@@ -2,41 +2,21 @@
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, EraPoints, EraRewardPoints, RewardPoint } from '@polkadot/types/interfaces';
import type { EraRewardPoints } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
function retrievePointsPrev (api: ApiInterfaceRx, currentElected: AccountId[]): Observable<EraRewardPoints> {
return api.query.staking.currentEraPointsEarned<EraPoints>().pipe(
map(({ individual, total }): EraRewardPoints =>
api.registry.createType('EraRewardPoints', {
individual: new Map<AccountId, RewardPoint>(
individual
.map((points) => api.registry.createType('RewardPoint', points))
.map((points, index): [AccountId, RewardPoint] => [currentElected[index], points])
),
total
})
)
);
}
/**
* @description Retrieve the staking overview, including elected and points earned
*/
export function currentPoints (instanceId: string, api: ApiInterfaceRx): () => Observable<EraRewardPoints> {
return memo(instanceId, (): Observable<EraRewardPoints> =>
api.derive.staking.overview().pipe(
switchMap(({ activeEra, nextElected }) =>
api.query.staking.erasRewardPoints
? api.query.staking.erasRewardPoints<EraRewardPoints>(activeEra)
: api.query.staking.currentEraPointsEarned
? retrievePointsPrev(api, nextElected)
: of(api.registry.createType('EraRewardPoints'))
api.derive.session.indexes().pipe(
switchMap(({ activeEra }) =>
api.query.staking.erasRewardPoints<EraRewardPoints>(activeEra)
)
));
}
@@ -4,21 +4,24 @@
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakingElected } from '../types';
import type { DeriveStakingElected, StakingQueryFlags } from '../types';
import { arrayFlatten } from '@polkadot/util';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
const DEFAULT_FLAGS = { withController: true, withExposure: true, withPrefs: true };
function combineAccounts (nextElected: AccountId[], validators: AccountId[]): AccountId[] {
return [...nextElected].concat(...validators.filter((v) => !nextElected.find((n) => n.eq(v))));
return arrayFlatten([nextElected, validators.filter((v) => !nextElected.find((n) => n.eq(v)))]);
}
export function electedInfo (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveStakingElected> {
return memo(instanceId, (): Observable<DeriveStakingElected> =>
export function electedInfo (instanceId: string, api: ApiInterfaceRx): (flags?: StakingQueryFlags) => Observable<DeriveStakingElected> {
return memo(instanceId, (flags: StakingQueryFlags = DEFAULT_FLAGS): Observable<DeriveStakingElected> =>
api.derive.staking.validators().pipe(
switchMap(({ nextElected, validators }): Observable<DeriveStakingElected> =>
api.derive.staking.queryMulti(combineAccounts(nextElected, validators), { withExposure: true, withLedger: true, withPrefs: true }).pipe(
api.derive.staking.queryMulti(combineAccounts(nextElected, validators), flags).pipe(
map((info): DeriveStakingElected => ({
info,
nextElected,
+19 -22
View File
@@ -8,36 +8,33 @@ import type { Observable } from '@polkadot/x-rxjs';
import BN from 'bn.js';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
export function erasHistoric (instanceId: string, api: ApiInterfaceRx): (withActive: boolean) => Observable<EraIndex[]> {
return memo(instanceId, (withActive: boolean): Observable<EraIndex[]> =>
api.query.staking?.activeEra
? api.queryMulti<[Option<ActiveEraInfo>, u32]>([
api.query.staking.activeEra,
api.query.staking.historyDepth
]).pipe(
map(([activeEraOpt, historyDepth]): EraIndex[] => {
const result: EraIndex[] = [];
const max = historyDepth.toNumber();
const activeEra: BN = activeEraOpt.unwrapOrDefault().index;
let lastEra = activeEra;
api.queryMulti<[Option<ActiveEraInfo>, u32]>([
api.query.staking.activeEra,
api.query.staking.historyDepth
]).pipe(
map(([activeEraOpt, historyDepth]): EraIndex[] => {
const result: EraIndex[] = [];
const max = historyDepth.toNumber();
const activeEra: BN = activeEraOpt.unwrapOrDefault().index;
let lastEra = activeEra;
while (lastEra.gten(0) && (result.length < max)) {
if ((lastEra !== activeEra) || (withActive === true)) {
result.push(api.registry.createType('EraIndex', lastEra));
}
lastEra = lastEra.subn(1);
while (lastEra.gten(0) && (result.length < max)) {
if ((lastEra !== activeEra) || (withActive === true)) {
result.push(api.registry.createType('EraIndex', lastEra));
}
// go from oldest to newest
return result.reverse();
})
)
: of([])
lastEra = lastEra.subn(1);
}
// go from oldest to newest
return result.reverse();
})
)
);
}
+48 -80
View File
@@ -4,71 +4,63 @@
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { AccountId, EraIndex, Exposure, Nominations, RewardDestination, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakingQuery } from '../types';
import type { DeriveStakingQuery, StakingQueryFlags } from '../types';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
interface QueryFlags {
withDestination?: boolean;
withExposure?: boolean;
withLedger?: boolean;
withNominations?: boolean;
withPrefs?: boolean;
}
type MultiResult = [Option<AccountId>, Option<ITuple<[Nominations]> | Nominations>, RewardDestination, ITuple<[ValidatorPrefs]> | ValidatorPrefs, Exposure];
type MultiResultCombo = [Option<AccountId>, Option<Nominations>, RewardDestination, ValidatorPrefs, Exposure];
function parseDetails (stashId: AccountId, [controllerIdOpt, nominatorsOpt, rewardDestination, validatorPrefs, exposure]: MultiResult, stakingLedgerOpt: Option<StakingLedger>): DeriveStakingQuery {
const nominators = nominatorsOpt && nominatorsOpt.unwrapOr(null);
function parseDetails (stashId: AccountId, controllerIdOpt: Option<AccountId> | null, nominatorsOpt: Option<Nominations>, rewardDestination: RewardDestination, validatorPrefs: ValidatorPrefs, exposure: Exposure, stakingLedgerOpt: Option<StakingLedger>): DeriveStakingQuery {
return {
accountId: stashId,
controllerId: controllerIdOpt && controllerIdOpt.unwrapOr(null),
exposure,
nominators: nominators
? Array.isArray(nominators)
? nominators[0].targets
: nominators.targets
nominators: nominatorsOpt.isSome
? nominatorsOpt.unwrap().targets
: [],
rewardDestination,
stakingLedger: stakingLedgerOpt.unwrapOrDefault(),
stashId,
validatorPrefs: Array.isArray(validatorPrefs)
? validatorPrefs[0]
: validatorPrefs
validatorPrefs
};
}
function retrievePrev (api: ApiInterfaceRx, stashId: AccountId): Observable<MultiResult> {
return api.queryMulti<MultiResult>([
[api.query.staking.bonded, stashId],
[api.query.staking.nominators, stashId],
[api.query.staking.payee, stashId],
[api.query.staking.validators, stashId],
[api.query.staking.stakers, stashId]
]);
function getLedgers (api: ApiInterfaceRx, optIds: (Option<AccountId> | null)[], { withLedger = false }: StakingQueryFlags): Observable<Option<StakingLedger>[]> {
const ids = optIds
.filter((opt): opt is Option<AccountId> => withLedger && !!opt && opt.isSome)
.map((opt) => opt.unwrap());
const emptyLed = api.registry.createType('Option<StakingLedger>');
return (
ids.length
? api.query.staking.ledger.multi<Option<StakingLedger>>(ids)
: of([])
).pipe(
map((optLedgers): Option<StakingLedger>[] => {
let offset = -1;
return optIds.map((opt): Option<StakingLedger> =>
opt && opt.isSome
? optLedgers[++offset] || emptyLed
: emptyLed
);
})
);
}
function retrieveCurr (api: ApiInterfaceRx, stashIds: AccountId[], activeEra: EraIndex, { withDestination, withExposure, withLedger, withNominations, withPrefs }: QueryFlags): Observable<MultiResultCombo[]> {
const emptyCont = api.registry.createType('Option<AccountId>');
function getStashInfo (api: ApiInterfaceRx, stashIds: AccountId[], activeEra: EraIndex, { withController, withDestination, withExposure, withLedger, withNominations, withPrefs }: StakingQueryFlags): Observable<[(Option<AccountId> | null)[], Option<Nominations>[], RewardDestination[], ValidatorPrefs[], Exposure[]]> {
const emptyNoms = api.registry.createType('Option<Nominations>');
const emptyRewa = api.registry.createType('RewardDestination');
const emptyExpo = api.registry.createType('Exposure');
const emptyPrefs = api.registry.createType('ValidatorPrefs');
return combineLatest([
withLedger
withController || withLedger
? api.query.staking.bonded.multi<Option<AccountId>>(stashIds)
: of(stashIds.map(() => emptyCont)),
withNominations && api.query.staking.nominators
: of(stashIds.map(() => null)),
withNominations
? api.query.staking.nominators.multi<Option<Nominations>>(stashIds)
: of(stashIds.map(() => emptyNoms)),
withDestination
@@ -80,67 +72,43 @@ function retrieveCurr (api: ApiInterfaceRx, stashIds: AccountId[], activeEra: Er
withExposure
? api.query.staking.erasStakers.multi<Exposure>(stashIds.map((stashId) => [activeEra, stashId]))
: of(stashIds.map(() => emptyExpo))
]).pipe(
map(([controllerIdOpt, nominatorsOpt, rewardDestination, validatorPrefs, exposure]): MultiResultCombo[] =>
controllerIdOpt.map((controllerIdOpt, index): MultiResultCombo =>
[controllerIdOpt, nominatorsOpt[index], rewardDestination[index], validatorPrefs[index], exposure[index]]
]);
}
function getBatch (api: ApiInterfaceRx, activeEra: EraIndex, stashIds: AccountId[], flags: StakingQueryFlags): Observable<DeriveStakingQuery[]> {
return getStashInfo(api, stashIds, activeEra, flags).pipe(
switchMap(([controllerIdOpt, nominatorsOpt, rewardDestination, validatorPrefs, exposure]): Observable<DeriveStakingQuery[]> =>
getLedgers(api, controllerIdOpt, flags).pipe(
map((stakingLedgerOpts) =>
stashIds.map((stashId, index) =>
parseDetails(stashId, controllerIdOpt[index], nominatorsOpt[index], rewardDestination[index], validatorPrefs[index], exposure[index], stakingLedgerOpts[index])
)
)
)
)
);
}
function retrieveControllers (api: ApiInterfaceRx, optControllerIds: Option<AccountId>[]): Observable<Option<StakingLedger>[]> {
const ids = optControllerIds.filter((opt) => opt.isSome).map((opt) => opt.unwrap());
const emptyLed = api.registry.createType('Option<StakingLedger>');
if (!ids.length) {
return of(optControllerIds.map(() => emptyLed));
}
return api.query.staking.ledger.multi<Option<StakingLedger>>(ids).pipe(
map((optLedgers): Option<StakingLedger>[] => {
let offset = -1;
return optControllerIds.map((opt): Option<StakingLedger> =>
opt.isSome
? optLedgers[++offset]
: emptyLed
);
})
);
}
//
/**
* @description From a stash, retrieve the controllerId and all relevant details
*/
export function query (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, flags: QueryFlags) => Observable<DeriveStakingQuery> {
return memo(instanceId, (accountId: Uint8Array | string, flags: QueryFlags): Observable<DeriveStakingQuery> =>
export function query (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, flags: StakingQueryFlags) => Observable<DeriveStakingQuery> {
return memo(instanceId, (accountId: Uint8Array | string, flags: StakingQueryFlags): Observable<DeriveStakingQuery> =>
api.derive.staking.queryMulti([accountId], flags).pipe(
map(([first]) => first)
)
);
}
export function queryMulti (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], flags: QueryFlags) => Observable<DeriveStakingQuery[]> {
return memo(instanceId, (accountIds: (Uint8Array | string)[], flags: QueryFlags): Observable<DeriveStakingQuery[]> =>
export function queryMulti (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], flags: StakingQueryFlags) => Observable<DeriveStakingQuery[]> {
return memo(instanceId, (accountIds: (Uint8Array | string)[], flags: StakingQueryFlags): Observable<DeriveStakingQuery[]> =>
accountIds.length
? api.derive.session.indexes().pipe(
switchMap(({ activeEra }): Observable<DeriveStakingQuery[]> => {
const stashIds = accountIds.map((accountId) => api.registry.createType('AccountId', accountId));
return (
isFunction(api.query.staking.erasStakers)
? retrieveCurr(api, stashIds, activeEra, flags)
: combineLatest(stashIds.map((stashId) => retrievePrev(api, stashId)))
).pipe(
switchMap((results): Observable<DeriveStakingQuery[]> =>
retrieveControllers(api, results.map(([optController]) => optController)).pipe(
map((stakingLedgerOpts) =>
stashIds.map((stashId, index) => parseDetails(stashId, results[index], stakingLedgerOpts[index]))
)
)
)
);
return getBatch(api, activeEra, stashIds, flags);
})
)
: of([])
@@ -21,7 +21,6 @@ type ErasResult = [{ unwrapOr: (value: BN) => BN }, DeriveEraPoints[], DeriveEra
const ZERO = new BN(0);
const MIN_ONE = new BN(-1);
const COMM_DIV = new BN(1_000_000_000);
const MAX_ERAS = new BN(1_000_000_000);
function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [, erasPoints, erasPrefs, erasRewards]: ErasResult, exposures: DeriveStakerExposure[]): DeriveStakerReward[] {
return exposures.map(({ era, isEmpty, isValidator, nominating, validators: eraValidators }): DeriveStakerReward => {
@@ -126,11 +125,7 @@ function filterRewards (api: ApiInterfaceRx, eras: EraIndex[], { migrateEra, rew
const validators = uniqValidators(rewards);
const filter = filterEras(eras, stakingLedger);
return (
isFunction(api.tx.staking.payoutStakers)
? api.derive.staking.queryMulti(validators, { withLedger: true })
: of([])
).pipe(
return api.derive.staking.queryMulti(validators, { withLedger: true }).pipe(
map((queryValidators): DeriveStakerReward[] =>
rewards
.filter(({ isEmpty }) => !isEmpty)
@@ -162,7 +157,7 @@ export function _stakerRewardsEras (instanceId: string, api: ApiInterfaceRx): (e
combineLatest([
isFunction(api.query.staking.migrateEra)
? api.query.staking.migrateEra<Option<EraIndex>>()
: of({ unwrapOr: () => isFunction(api.tx.staking.payoutStakers) ? ZERO : MAX_ERAS }),
: of(api.registry.createType('Option<EraIndex>')),
api.derive.staking._erasPoints(eras, withActive),
api.derive.staking._erasPrefs(eras, withActive),
api.derive.staking._erasRewards(eras, withActive)
+9
View File
@@ -144,3 +144,12 @@ export interface DeriveStakingOverview extends DeriveSessionIndexes {
nextElected: AccountId[];
validators: AccountId[];
}
export interface StakingQueryFlags {
withController?: boolean;
withDestination?: boolean;
withExposure?: boolean;
withLedger?: boolean;
withNominations?: boolean;
withPrefs?: boolean;
}
@@ -3,15 +3,17 @@
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveStakingWaiting } from '../types';
import type { DeriveStakingWaiting, StakingQueryFlags } from '../types';
import { combineLatest } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
export function waitingInfo (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveStakingWaiting> {
return memo(instanceId, (): Observable<DeriveStakingWaiting> =>
const DEFAULT_FLAGS = { withController: true, withPrefs: true };
export function waitingInfo (instanceId: string, api: ApiInterfaceRx): (flags?: StakingQueryFlags) => Observable<DeriveStakingWaiting> {
return memo(instanceId, (flags: StakingQueryFlags = DEFAULT_FLAGS): Observable<DeriveStakingWaiting> =>
combineLatest([
api.derive.staking.validators(),
api.derive.staking.stashes()
@@ -20,7 +22,7 @@ export function waitingInfo (instanceId: string, api: ApiInterfaceRx): () => Obs
const elected = nextElected.map((a) => a.toString());
const waiting = stashes.filter((v) => !elected.includes(v.toString()));
return api.derive.staking.queryMulti(waiting, { withLedger: true, withPrefs: true }).pipe(
return api.derive.staking.queryMulti(waiting, flags).pipe(
map((info): DeriveStakingWaiting => ({
info,
waiting
+3 -3
View File
@@ -18,14 +18,14 @@
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/api-derive": "3.1.2-6",
"@polkadot/keyring": "^5.1.1",
"@polkadot/keyring": "^5.1.2-1",
"@polkadot/metadata": "3.1.2-6",
"@polkadot/rpc-core": "3.1.2-6",
"@polkadot/rpc-provider": "3.1.2-6",
"@polkadot/types": "3.1.2-6",
"@polkadot/types-known": "3.1.2-6",
"@polkadot/util": "^5.1.1",
"@polkadot/util-crypto": "^5.1.1",
"@polkadot/util": "^5.1.2-1",
"@polkadot/util-crypto": "^5.1.2-1",
"@polkadot/x-rxjs": "3.1.2-6",
"bn.js": "^4.11.9",
"eventemitter3": "^4.0.7"
+37 -53
View File
@@ -12,7 +12,7 @@ import type { ApiInterfaceRx, ApiOptions, ApiTypes, DecoratedRpc, DecoratedRpcSe
import BN from 'bn.js';
import { decorateDerive, DeriveCustom, ExactDerive } from '@polkadot/api-derive';
import { decorateDerive, ExactDerive } from '@polkadot/api-derive';
import { memo } from '@polkadot/api-derive/util';
import { expandMetadata, Metadata } from '@polkadot/metadata';
import { RpcCore } from '@polkadot/rpc-core';
@@ -20,9 +20,9 @@ import { WsProvider } from '@polkadot/rpc-provider';
import { TypeRegistry } from '@polkadot/types/create';
import { DEFAULT_VERSION as EXTRINSIC_DEFAULT_VERSION } from '@polkadot/types/extrinsic/constants';
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import { assert, compactStripLength, logger, u8aToHex } from '@polkadot/util';
import { arrayChunk, arrayFlatten, assert, compactStripLength, logger, u8aToHex } from '@polkadot/util';
import { BehaviorSubject, combineLatest, Observable, of } from '@polkadot/x-rxjs';
import { map, switchMap, take, tap, toArray } from '@polkadot/x-rxjs/operators';
import { map, switchMap, tap, toArray } from '@polkadot/x-rxjs/operators';
import { createSubmittable } from '../submittable';
import { augmentObject } from '../util/augmentObject';
@@ -38,8 +38,8 @@ interface MetaDecoration {
toJSON: () => any;
}
const PAGE_SIZE_KEYS = 384;
const PAGE_SIZE_VALS = PAGE_SIZE_KEYS;
// the max amount of keys/values that we will retrieve at once
const PAGE_SIZE = 384;
const l = logger('api/init');
@@ -453,25 +453,21 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
));
}
// retrieve a set of values for a specific set of keys - here we chunk the keys into PAGE_SIZE_VALS sizes
// retrieve a set of values for a specific set of keys - here we chunk the keys into PAGE_SIZE sizes
private _retrieveMulti (keys: [StorageEntry, Arg | Arg[]][]): Observable<Codec[]> {
if (!keys.length) {
return of([]);
}
return combineLatest(
...Array(Math.ceil(keys.length / PAGE_SIZE_VALS))
.fill(0)
.map((_, index): Observable<Codec[]> =>
(this.hasSubscriptions
? this._rpcCore.state.subscribeStorage
: this._rpcCore.state.queryStorageAt
)(keys.slice(index * PAGE_SIZE_VALS, (index * PAGE_SIZE_VALS) + PAGE_SIZE_VALS))
)
).pipe(
map((valsArr): Codec[] =>
valsArr.reduce((result: Codec[], vals) => result.concat(vals), [])
arrayChunk(keys, PAGE_SIZE).map((keys) =>
(this.hasSubscriptions
? this._rpcCore.state.subscribeStorage
: this._rpcCore.state.queryStorageAt
)(keys)
)
).pipe(
map((valsArr): Codec[] => arrayFlatten(valsArr))
);
}
@@ -481,8 +477,8 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
const headKey = iterKey(arg).toHex();
const startSubject = new BehaviorSubject<string>(headKey);
const query = at
? (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_KEYS, startKey, at)
: (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_KEYS, startKey);
? (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE, startKey, at)
: (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE, startKey);
return startSubject.pipe(
switchMap((startKey) =>
@@ -491,12 +487,12 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
)
),
tap((keys): void => {
keys.length === PAGE_SIZE_KEYS
? startSubject.next(keys[PAGE_SIZE_KEYS - 1].toHex())
keys.length === PAGE_SIZE
? startSubject.next(keys[PAGE_SIZE - 1].toHex())
: startSubject.complete();
}),
toArray(), // toArray since we want to startSubject to be completed
map((keysArr: StorageKey[][]) => keysArr.reduce((result: StorageKey[], keys) => result.concat(keys), []))
map((keysArr: StorageKey[][]) => arrayFlatten(keysArr))
);
}
@@ -511,28 +507,19 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
}
private _retrieveMapEntries (entry: StorageEntry, at: Hash | Uint8Array | string | null, arg?: Arg): Observable<[StorageKey, Codec][]> {
const query = this._rpcCore.state.queryStorageAt
? at
? (keyset: StorageKey[]) => this._rpcCore.state.queryStorageAt(keyset, at)
: (keyset: StorageKey[]) => this._rpcCore.state.queryStorageAt(keyset)
// this is horrible, but need older support (which now doesn't work with at)
: (keyset: StorageKey[]) => this._rpcCore.state.subscribeStorage(keyset).pipe(take(1));
const query = at
? (keyset: StorageKey[]) => this._rpcCore.state.queryStorageAt(keyset, at)
: (keyset: StorageKey[]) => this._rpcCore.state.queryStorageAt(keyset);
return this._retrieveMapKeys(entry, at, arg).pipe(
switchMap((keys) =>
combineLatest<[StorageKey[], ...Codec[][]]>([
of(keys),
...Array(Math.ceil(keys.length / PAGE_SIZE_VALS))
.fill(0)
.map((_, index): Observable<Codec[]> =>
query(keys.slice(index * PAGE_SIZE_VALS, (index * PAGE_SIZE_VALS) + PAGE_SIZE_VALS))
)
])
),
map(([keys, ...valsArr]): [StorageKey, Codec][] =>
valsArr
.reduce((result: Codec[], vals) => result.concat(vals), [])
.map((value, index) => [keys[index], value])
combineLatest(
arrayChunk(keys, PAGE_SIZE).map((keys) => query(keys))
).pipe(
map((valsArr) =>
arrayFlatten(valsArr).map((value, index): [StorageKey, Codec] => [keys[index], value])
)
)
)
);
}
@@ -540,24 +527,21 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
private _retrieveMapEntriesPaged (entry: StorageEntry, opts: PaginationOptions): Observable<[StorageKey, Codec][]> {
return this._retrieveMapKeysPaged(entry, opts).pipe(
switchMap((keys) =>
combineLatest<[StorageKey[], ...Codec[][]]>([
of(keys),
this._rpcCore.state.queryStorageAt<Codec[]>(keys)
])
),
map(([keys, ...valsArr]): [StorageKey, Codec][] =>
valsArr
.reduce((result: Codec[], vals) => result.concat(vals), [])
.map((value, index) => [keys[index], value])
this._rpcCore.state.queryStorageAt(keys).pipe(
map((valsArr) =>
valsArr.map((value, index): [StorageKey, Codec] => [keys[index], value])
)
)
)
);
}
protected _decorateDeriveRx (decorateMethod: DecorateMethod<ApiType>): DeriveAllSections<'rxjs', ExactDerive> {
const specName = this._runtimeVersion?.specName.toString();
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const derives = { ...this._options.derives, ...(this._options.typesBundle?.spec?.[specName ?? '']?.derives as DeriveCustom) }; // use typesBundle
const derives = {
...this._options.derives,
...(this._options.typesBundle?.spec?.[specName ?? '']?.derives || {})
};
// Pull in derive from api-derive
const derive = decorateDerive(this.#instanceId, this._rx, derives);
+3 -3
View File
@@ -19,11 +19,11 @@
"@babel/runtime": "^7.12.5",
"@polkadot/types": "3.1.2-6",
"@polkadot/types-known": "3.1.2-6",
"@polkadot/util": "^5.1.1",
"@polkadot/util-crypto": "^5.1.1",
"@polkadot/util": "^5.1.2-1",
"@polkadot/util-crypto": "^5.1.2-1",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^5.1.1"
"@polkadot/keyring": "^5.1.2-1"
}
}
+2 -2
View File
@@ -17,10 +17,10 @@
"@polkadot/metadata": "3.1.2-6",
"@polkadot/rpc-provider": "3.1.2-6",
"@polkadot/types": "3.1.2-6",
"@polkadot/util": "^5.1.1",
"@polkadot/util": "^5.1.2-1",
"@polkadot/x-rxjs": "3.1.2-6"
},
"devDependencies": {
"@polkadot/keyring": "^5.1.1"
"@polkadot/keyring": "^5.1.2-1"
}
}
+5 -5
View File
@@ -15,15 +15,15 @@
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/types": "3.1.2-6",
"@polkadot/util": "^5.1.1",
"@polkadot/util-crypto": "^5.1.1",
"@polkadot/x-fetch": "^5.1.1",
"@polkadot/x-ws": "^5.1.1",
"@polkadot/util": "^5.1.2-1",
"@polkadot/util-crypto": "^5.1.2-1",
"@polkadot/x-fetch": "^5.1.2-1",
"@polkadot/x-ws": "^5.1.2-1",
"bn.js": "^4.11.9",
"eventemitter3": "^4.0.7"
},
"devDependencies": {
"@polkadot/keyring": "^5.1.1",
"@polkadot/keyring": "^5.1.2-1",
"@polkadot/metadata": "3.1.2-6",
"mock-socket": "^9.0.3",
"nock": "^13.0.5"
+1 -1
View File
@@ -27,7 +27,7 @@
"@polkadot/metadata": "3.1.2-6",
"@polkadot/rpc-provider": "3.1.2-6",
"@polkadot/types": "3.1.2-6",
"@polkadot/util": "^5.1.1",
"@polkadot/util": "^5.1.2-1",
"handlebars": "^4.7.6",
"websocket": "^1.0.33",
"yargs": "^16.2.0"
+1 -1
View File
@@ -15,7 +15,7 @@
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/types": "3.1.2-6",
"@polkadot/util": "^5.1.1",
"@polkadot/util": "^5.1.2-1",
"bn.js": "^4.11.9"
},
"devDependencies": {
+3 -3
View File
@@ -18,13 +18,13 @@
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/metadata": "3.1.2-6",
"@polkadot/util": "^5.1.1",
"@polkadot/util-crypto": "^5.1.1",
"@polkadot/util": "^5.1.2-1",
"@polkadot/util-crypto": "^5.1.2-1",
"@polkadot/x-rxjs": "3.1.2-6",
"@types/bn.js": "^4.11.6",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^5.1.1"
"@polkadot/keyring": "^5.1.2-1"
}
}
+3 -1
View File
@@ -3,6 +3,8 @@
import type { Codec, Constructor, Registry } from '../../types';
import { arrayFlatten } from '@polkadot/util';
/**
* Given an u8a, and an array of Type constructors, decode the u8a against the
* types, and return an array of decoded values.
@@ -22,5 +24,5 @@ export function decodeU8a (registry: Registry, u8a: Uint8Array, _types: Construc
const Type = types[0];
const value = new Type(registry, u8a);
return [value].concat(decodeU8a(registry, u8a.subarray(value.encodedLength), types.slice(1)));
return arrayFlatten([[value], decodeU8a(registry, u8a.subarray(value.encodedLength), types.slice(1))]);
}
@@ -10,8 +10,6 @@ import { decodeAddress, encodeAddress } from '@polkadot/util-crypto';
import { u32 } from '../primitive/U32';
export const ENUMSET_SIZE = new BN(64);
const PREFIX_1BYTE = 0xef;
const PREFIX_2BYTE = 0xfc;
const PREFIX_4BYTE = 0xfd;
+68 -68
View File
@@ -1693,7 +1693,7 @@ __metadata:
"@babel/runtime": ^7.12.5
"@polkadot/api": 3.1.2-6
"@polkadot/types": 3.1.2-6
"@polkadot/util": ^5.1.1
"@polkadot/util": ^5.1.2-1
"@polkadot/x-rxjs": 3.1.2-6
bn.js: ^4.11.9
languageName: unknown
@@ -1705,12 +1705,12 @@ __metadata:
dependencies:
"@babel/runtime": ^7.12.5
"@polkadot/api": 3.1.2-6
"@polkadot/keyring": ^5.1.1
"@polkadot/keyring": ^5.1.2-1
"@polkadot/rpc-core": 3.1.2-6
"@polkadot/rpc-provider": 3.1.2-6
"@polkadot/types": 3.1.2-6
"@polkadot/util": ^5.1.1
"@polkadot/util-crypto": ^5.1.1
"@polkadot/util": ^5.1.2-1
"@polkadot/util-crypto": ^5.1.2-1
"@polkadot/x-rxjs": 3.1.2-6
bn.js: ^4.11.9
languageName: unknown
@@ -1722,14 +1722,14 @@ __metadata:
dependencies:
"@babel/runtime": ^7.12.5
"@polkadot/api-derive": 3.1.2-6
"@polkadot/keyring": ^5.1.1
"@polkadot/keyring": ^5.1.2-1
"@polkadot/metadata": 3.1.2-6
"@polkadot/rpc-core": 3.1.2-6
"@polkadot/rpc-provider": 3.1.2-6
"@polkadot/types": 3.1.2-6
"@polkadot/types-known": 3.1.2-6
"@polkadot/util": ^5.1.1
"@polkadot/util-crypto": ^5.1.1
"@polkadot/util": ^5.1.2-1
"@polkadot/util-crypto": ^5.1.2-1
"@polkadot/x-rxjs": 3.1.2-6
bn.js: ^4.11.9
eventemitter3: ^4.0.7
@@ -1829,17 +1829,17 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/keyring@npm:^5.1.1":
version: 5.1.1
resolution: "@polkadot/keyring@npm:5.1.1"
"@polkadot/keyring@npm:^5.1.2-1":
version: 5.1.2-1
resolution: "@polkadot/keyring@npm:5.1.2-1"
dependencies:
"@babel/runtime": ^7.12.5
"@polkadot/util": 5.1.1
"@polkadot/util-crypto": 5.1.1
"@polkadot/util": 5.1.2-1
"@polkadot/util-crypto": 5.1.2-1
peerDependencies:
"@polkadot/util": 5.1.1
"@polkadot/util-crypto": 5.1.1
checksum: 03d4063c6455460b1e8695d3ef2efec212922ceb09ecefafd7bca171406c61089cc762fd5d2b347db00badae33fb5e7c778ee156425b982807f250807016980c
"@polkadot/util": 5.1.2-1
"@polkadot/util-crypto": 5.1.2-1
checksum: 906202639396f84a08a20ef8dd094ec27810b0896cbdd1aaf9b554a5c10a2df62deea597b9426e457ee4670d8074e15a5a2d590e0f35f8249ce565c752539996
languageName: node
linkType: hard
@@ -1848,21 +1848,21 @@ __metadata:
resolution: "@polkadot/metadata@workspace:packages/metadata"
dependencies:
"@babel/runtime": ^7.12.5
"@polkadot/keyring": ^5.1.1
"@polkadot/keyring": ^5.1.2-1
"@polkadot/types": 3.1.2-6
"@polkadot/types-known": 3.1.2-6
"@polkadot/util": ^5.1.1
"@polkadot/util-crypto": ^5.1.1
"@polkadot/util": ^5.1.2-1
"@polkadot/util-crypto": ^5.1.2-1
bn.js: ^4.11.9
languageName: unknown
linkType: soft
"@polkadot/networks@npm:5.1.1":
version: 5.1.1
resolution: "@polkadot/networks@npm:5.1.1"
"@polkadot/networks@npm:5.1.2-1":
version: 5.1.2-1
resolution: "@polkadot/networks@npm:5.1.2-1"
dependencies:
"@babel/runtime": ^7.12.5
checksum: 0f462315a177c373965a122a4b737546e4f9741fc5df35816d834c2d030de76a9fc433a982a53fdcfca2ce089eabfc20893850cee8298b1c6d17efa8705d4cfe
checksum: 45040d9f1cdbbfe57bc4648e9e526f3e69448cc705fb48d816bcf373d56742d7504a5cb579c5575417c7110bc6f4090ac979d41159bca4a5e4d56b4af7755ff4
languageName: node
linkType: hard
@@ -1871,11 +1871,11 @@ __metadata:
resolution: "@polkadot/rpc-core@workspace:packages/rpc-core"
dependencies:
"@babel/runtime": ^7.12.5
"@polkadot/keyring": ^5.1.1
"@polkadot/keyring": ^5.1.2-1
"@polkadot/metadata": 3.1.2-6
"@polkadot/rpc-provider": 3.1.2-6
"@polkadot/types": 3.1.2-6
"@polkadot/util": ^5.1.1
"@polkadot/util": ^5.1.2-1
"@polkadot/x-rxjs": 3.1.2-6
languageName: unknown
linkType: soft
@@ -1885,13 +1885,13 @@ __metadata:
resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider"
dependencies:
"@babel/runtime": ^7.12.5
"@polkadot/keyring": ^5.1.1
"@polkadot/keyring": ^5.1.2-1
"@polkadot/metadata": 3.1.2-6
"@polkadot/types": 3.1.2-6
"@polkadot/util": ^5.1.1
"@polkadot/util-crypto": ^5.1.1
"@polkadot/x-fetch": ^5.1.1
"@polkadot/x-ws": ^5.1.1
"@polkadot/util": ^5.1.2-1
"@polkadot/util-crypto": ^5.1.2-1
"@polkadot/x-fetch": ^5.1.2-1
"@polkadot/x-ws": ^5.1.2-1
bn.js: ^4.11.9
eventemitter3: ^4.0.7
mock-socket: ^9.0.3
@@ -1919,7 +1919,7 @@ __metadata:
"@polkadot/metadata": 3.1.2-6
"@polkadot/rpc-provider": 3.1.2-6
"@polkadot/types": 3.1.2-6
"@polkadot/util": ^5.1.1
"@polkadot/util": ^5.1.2-1
"@types/websocket": ^1.0.1
"@types/yargs": ^15.0.12
handlebars: ^4.7.6
@@ -1940,7 +1940,7 @@ __metadata:
dependencies:
"@babel/runtime": ^7.12.5
"@polkadot/types": 3.1.2-6
"@polkadot/util": ^5.1.1
"@polkadot/util": ^5.1.2-1
"@types/bn.js": ^4.11.6
bn.js: ^4.11.9
languageName: unknown
@@ -1951,25 +1951,25 @@ __metadata:
resolution: "@polkadot/types@workspace:packages/types"
dependencies:
"@babel/runtime": ^7.12.5
"@polkadot/keyring": ^5.1.1
"@polkadot/keyring": ^5.1.2-1
"@polkadot/metadata": 3.1.2-6
"@polkadot/util": ^5.1.1
"@polkadot/util-crypto": ^5.1.1
"@polkadot/util": ^5.1.2-1
"@polkadot/util-crypto": ^5.1.2-1
"@polkadot/x-rxjs": 3.1.2-6
"@types/bn.js": ^4.11.6
bn.js: ^4.11.9
languageName: unknown
linkType: soft
"@polkadot/util-crypto@npm:5.1.1, @polkadot/util-crypto@npm:^5.1.1":
version: 5.1.1
resolution: "@polkadot/util-crypto@npm:5.1.1"
"@polkadot/util-crypto@npm:5.1.2-1, @polkadot/util-crypto@npm:^5.1.2-1":
version: 5.1.2-1
resolution: "@polkadot/util-crypto@npm:5.1.2-1"
dependencies:
"@babel/runtime": ^7.12.5
"@polkadot/networks": 5.1.1
"@polkadot/util": 5.1.1
"@polkadot/networks": 5.1.2-1
"@polkadot/util": 5.1.2-1
"@polkadot/wasm-crypto": ^3.1.1
"@polkadot/x-randomvalues": 5.1.1
"@polkadot/x-randomvalues": 5.1.2-1
base-x: ^3.0.8
blakejs: ^1.1.0
bn.js: ^4.11.9
@@ -1981,23 +1981,23 @@ __metadata:
tweetnacl: ^1.0.3
xxhashjs: ^0.2.2
peerDependencies:
"@polkadot/util": 5.1.1
checksum: cfa7758cef54443b20a82089f978f8135ad6580b1361212f05cc908666b638dd45264ca4729b5015672f3c54b2299540912389b0b284888ca3e3f9dfa2faf0a5
"@polkadot/util": 5.1.2-1
checksum: 0500aac3e523cf2e999de596ee8458478210947fbadea9408977e4448183c37aa7c31369fba60eb9ce352fff85385baec37d7b23c2ea3c900c9f3b52df0083d9
languageName: node
linkType: hard
"@polkadot/util@npm:5.1.1, @polkadot/util@npm:^5.1.1":
version: 5.1.1
resolution: "@polkadot/util@npm:5.1.1"
"@polkadot/util@npm:5.1.2-1, @polkadot/util@npm:^5.1.2-1":
version: 5.1.2-1
resolution: "@polkadot/util@npm:5.1.2-1"
dependencies:
"@babel/runtime": ^7.12.5
"@polkadot/x-textdecoder": 5.1.1
"@polkadot/x-textencoder": 5.1.1
"@polkadot/x-textdecoder": 5.1.2-1
"@polkadot/x-textencoder": 5.1.2-1
"@types/bn.js": ^4.11.6
bn.js: ^4.11.9
camelcase: ^5.3.1
ip-regex: ^4.2.0
checksum: afb6f3e1082ea4dcc6a2bcf2a84ea3f14384d3fed7e480f936ef095f216be882f35eb31702a2a998493641d158ad05cce89d4b3b4b6e54c863ad8c19f3278ed6
checksum: f3b8224315e66fce79492b4252d6a42ad909a4de29ec71547ae5d4aa6cedb5f167dcce8166869f87e5f23e8a90ca222f212cc173af489cfbc70f83fb63b39792
languageName: node
linkType: hard
@@ -2033,23 +2033,23 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/x-fetch@npm:^5.1.1":
version: 5.1.1
resolution: "@polkadot/x-fetch@npm:5.1.1"
"@polkadot/x-fetch@npm:^5.1.2-1":
version: 5.1.2-1
resolution: "@polkadot/x-fetch@npm:5.1.2-1"
dependencies:
"@babel/runtime": ^7.12.5
"@types/node-fetch": ^2.5.7
node-fetch: ^2.6.1
checksum: 94b601403c9a2b58f89d41acddc80cf459d64329bd3390ebaeded7f7ebf451ded73902a9db38d82e24ecae7d83257c3eb39cb6df9e871bba03ea5b314949b0a9
checksum: dec04d2c277e6a64026bada4422682dfee20c9ef80eb3da7b3f94c0164e607be2b9f1b5f3c8d69f59a4fc842fb2fa02a649a47e28b6aead184ba8a98078c8e51
languageName: node
linkType: hard
"@polkadot/x-randomvalues@npm:5.1.1":
version: 5.1.1
resolution: "@polkadot/x-randomvalues@npm:5.1.1"
"@polkadot/x-randomvalues@npm:5.1.2-1":
version: 5.1.2-1
resolution: "@polkadot/x-randomvalues@npm:5.1.2-1"
dependencies:
"@babel/runtime": ^7.12.5
checksum: e4157b08b7b9147438dbfa9282da6e599a66f80a9140777350427466e15e3217cba82e79d4d5f094849e1392e4ae4a0580df7bbd82e9ca34c1641a999343a608
checksum: 5160e2255ea503549db45e1c25a50c686069a74875bd7171ae1c3e07d019adcfb333b7092fc5353149accb27dfa9ee52525e54c2ea370fa6e5595e9d602289bb
languageName: node
linkType: hard
@@ -2062,32 +2062,32 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/x-textdecoder@npm:5.1.1":
version: 5.1.1
resolution: "@polkadot/x-textdecoder@npm:5.1.1"
"@polkadot/x-textdecoder@npm:5.1.2-1":
version: 5.1.2-1
resolution: "@polkadot/x-textdecoder@npm:5.1.2-1"
dependencies:
"@babel/runtime": ^7.12.5
checksum: 1b86e8c9dfbad3c5e9372126e4e94cc517fa7ccb84a1e3e8106bb778358a6c131675dc49da86db87d6d402be300ea3dcb75bd8f7085a3384daaa4e55f509070d
checksum: 60296ef039260e87fab90ec5a34c84ee91f1789dec05901e3fe30ad52ac909adfd6c5ec4119e039339f33e0f23f7df8c672815c10d056ce90830c3dcc816cb25
languageName: node
linkType: hard
"@polkadot/x-textencoder@npm:5.1.1":
version: 5.1.1
resolution: "@polkadot/x-textencoder@npm:5.1.1"
"@polkadot/x-textencoder@npm:5.1.2-1":
version: 5.1.2-1
resolution: "@polkadot/x-textencoder@npm:5.1.2-1"
dependencies:
"@babel/runtime": ^7.12.5
checksum: bd7773b320b3c6622cd742c0e82c0eb5600b4e38821151111a7fa8adabcdbea895d1a7a9424e1126c108c4eac43c05a85427403ecb8ba4223123a21f75fdb55c
checksum: 14efdace6942e686da249da89893c155fd8a6b3c7779d3f9966f14387a18fb6a942b300a8a9c99e9b5785f60e1aae686b9712d12630c28a2858724c8a87a109b
languageName: node
linkType: hard
"@polkadot/x-ws@npm:^5.1.1":
version: 5.1.1
resolution: "@polkadot/x-ws@npm:5.1.1"
"@polkadot/x-ws@npm:^5.1.2-1":
version: 5.1.2-1
resolution: "@polkadot/x-ws@npm:5.1.2-1"
dependencies:
"@babel/runtime": ^7.12.5
"@types/websocket": ^1.0.1
websocket: ^1.0.33
checksum: 4499db46ab6ee288ca98c21f763849f3e7ed150af12ace3aeda592222012cd49b02bab6238316c4c3b691eeb986300ec18d1803a1ac2536851c769eebf7bac1e
checksum: aa6fdd6acb919958963dbc86a6e3da0d680dea8812639c3d32512d7ad72ffda8682fcd9622a455447c55be98ace604f22c3138452ce236ff50601b2f099a8b78
languageName: node
linkType: hard