Bump static metadata (#5717)

* Bump static metadata

* Adjust society candidate retrieval

* Fix society member retrieval

* Rebuild

* Build runtime

* Adjust types

* Extract re-used types
This commit is contained in:
Jaco
2023-08-29 12:08:41 +03:00
committed by GitHub
parent e9fec17599
commit f49f05c820
45 changed files with 25980 additions and 23833 deletions
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Option, u32, WrapperOpaque } from '@polkadot/types';
import type { Option, u32 } from '@polkadot/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { PalletImOnlineBoundedOpaqueNetworkState } from '@polkadot/types/lookup';
import type { Codec } from '@polkadot/types/types';
import type { DeriveApi, DeriveHeartbeats } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
@@ -13,9 +13,9 @@ import { BN_ZERO } from '@polkadot/util';
import { memo } from '../util/index.js';
type HeartbeatsOpt = Option<WrapperOpaque<PalletImOnlineBoundedOpaqueNetworkState>>;
type Result = [DeriveHeartbeats, AccountId[], Option<Codec>[], u32[]];
function mapResult ([result, validators, heartbeats, numBlocks]: [DeriveHeartbeats, AccountId[], HeartbeatsOpt[], u32[]]): DeriveHeartbeats {
function mapResult ([result, validators, heartbeats, numBlocks]: Result): DeriveHeartbeats {
validators.forEach((validator, index): void => {
const validatorId = validator.toString();
const blockCount = numBlocks[index];
@@ -41,7 +41,7 @@ export function receivedHeartbeats (instanceId: string, api: DeriveApi): () => O
return memo(instanceId, (): Observable<DeriveHeartbeats> =>
api.query.imOnline?.receivedHeartbeats
? api.derive.staking.overview().pipe(
switchMap(({ currentIndex, validators }): Observable<[DeriveHeartbeats, AccountId[], HeartbeatsOpt[], u32[]]> =>
switchMap(({ currentIndex, validators }): Observable<Result> =>
combineLatest([
of({}),
of(validators),