Remove parachains.watermark (#2026)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import { CollatorId, ParaId } from '@polkadot/types/interfaces';
|
||||
import { DeriveParachainInfo, DeriveParachainFull, DeriveParachainActive } from '../types';
|
||||
import { Active, DidUpdate, Heads, ParaInfoResult, PendingSwap, RelayDispatchQueue, RetryQueue, SelectedThreads, Watermarks } from './types';
|
||||
import { Active, DidUpdate, Heads, ParaInfoResult, PendingSwap, RelayDispatchQueue, RetryQueue, SelectedThreads } from './types';
|
||||
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
@@ -21,8 +21,7 @@ type Result = [
|
||||
ParaInfoResult,
|
||||
PendingSwap,
|
||||
Heads,
|
||||
RelayDispatchQueue,
|
||||
Watermarks
|
||||
RelayDispatchQueue
|
||||
];
|
||||
|
||||
function parseActive (id: ParaId, active: Active): DeriveParachainActive | null {
|
||||
@@ -58,7 +57,7 @@ function parseCollators (id: ParaId, collatorQueue: SelectedThreads | RetryQueue
|
||||
});
|
||||
}
|
||||
|
||||
function parse (id: ParaId, [active, retryQueue, selectedThreads, didUpdate, info, pendingSwap, heads, relayDispatchQueue, watermarks]: Result): DeriveParachainFull | null {
|
||||
function parse (id: ParaId, [active, retryQueue, selectedThreads, didUpdate, info, pendingSwap, heads, relayDispatchQueue]: Result): DeriveParachainFull | null {
|
||||
if (info.isNone) {
|
||||
return null;
|
||||
}
|
||||
@@ -74,8 +73,7 @@ function parse (id: ParaId, [active, retryQueue, selectedThreads, didUpdate, inf
|
||||
pendingSwapId: pendingSwap.unwrapOr(null),
|
||||
relayDispatchQueue,
|
||||
retryCollators: parseCollators(id, retryQueue),
|
||||
selectedCollators: parseCollators(id, selectedThreads),
|
||||
watermark: watermarks.unwrapOr(null)
|
||||
selectedCollators: parseCollators(id, selectedThreads)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -90,8 +88,7 @@ export function info (api: ApiInterfaceRx): (id: ParaId | number) => Observable<
|
||||
[api.query.registrar.paras, id],
|
||||
[api.query.registrar.pendingSwap, id],
|
||||
[api.query.parachains.heads, id],
|
||||
[api.query.parachains.relayDispatchQueue, id],
|
||||
[api.query.parachains.watermarks, id]
|
||||
[api.query.parachains.relayDispatchQueue, id]
|
||||
])
|
||||
.pipe(
|
||||
map((result: Result): DeriveParachainFull | null =>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { ParaId } from '@polkadot/types/interfaces';
|
||||
import { DeriveParachain, DeriveParachainInfo } from '../types';
|
||||
import { DidUpdate, ParaInfoResult, PendingSwap, RelayDispatchQueueSize, Watermarks } from './types';
|
||||
import { DidUpdate, ParaInfoResult, PendingSwap, RelayDispatchQueueSize } from './types';
|
||||
|
||||
import { Observable, combineLatest, of } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
@@ -17,11 +17,10 @@ type Result = [
|
||||
DidUpdate,
|
||||
ParaInfoResult[],
|
||||
PendingSwap[],
|
||||
RelayDispatchQueueSize[],
|
||||
Watermarks[],
|
||||
RelayDispatchQueueSize[]
|
||||
];
|
||||
|
||||
function parse ([ids, didUpdate, infos, pendingSwaps, relayDispatchQueueSizes, watermarks]: Result): DeriveParachain[] {
|
||||
function parse ([ids, didUpdate, infos, pendingSwaps, relayDispatchQueueSizes]: Result): DeriveParachain[] {
|
||||
return ids.map((id, index): DeriveParachain => {
|
||||
return {
|
||||
didUpdate: didUpdate.isSome
|
||||
@@ -30,8 +29,7 @@ function parse ([ids, didUpdate, infos, pendingSwaps, relayDispatchQueueSizes, w
|
||||
id,
|
||||
info: { id, ...infos[index].unwrapOr(null) } as DeriveParachainInfo,
|
||||
pendingSwapId: pendingSwaps[index].unwrapOr(null),
|
||||
relayDispatchQueueSize: relayDispatchQueueSizes[index][0].toNumber(),
|
||||
watermark: watermarks[index].unwrapOr(null)
|
||||
relayDispatchQueueSize: relayDispatchQueueSizes[index][0].toNumber()
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -46,8 +44,7 @@ export function overview (api: ApiInterfaceRx): () => Observable<DeriveParachain
|
||||
api.query.parachains.didUpdate<DidUpdate>(),
|
||||
api.query.registrar.paras.multi<ParaInfoResult>(paraIds),
|
||||
api.query.registrar.pendingSwap.multi<PendingSwap>(paraIds),
|
||||
api.query.parachains.relayDispatchQueueSize.multi<RelayDispatchQueueSize>(paraIds),
|
||||
api.query.parachains.watermarks.multi<Watermarks>(paraIds)
|
||||
api.query.parachains.relayDispatchQueueSize.multi<RelayDispatchQueueSize>(paraIds)
|
||||
])
|
||||
),
|
||||
map((result: Result): DeriveParachain[] =>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { BlockNumber, CollatorId, ParaId, ParaInfo, Retriable, UpwardMessage } from '@polkadot/types/interfaces';
|
||||
import { CollatorId, ParaId, ParaInfo, Retriable, UpwardMessage } from '@polkadot/types/interfaces';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
|
||||
import { Bytes, Option, u32, Vec } from '@polkadot/types';
|
||||
@@ -16,7 +16,6 @@ export type Code = Bytes;
|
||||
export type Heads = Bytes;
|
||||
export type RelayDispatchQueue = Vec<UpwardMessage>
|
||||
export type RelayDispatchQueueSize = ITuple<[u32, u32]>;
|
||||
export type Watermarks = Option<BlockNumber>;
|
||||
export type DidUpdate = Option<Vec<ParaId>>;
|
||||
|
||||
export interface DeriveParachainActive {
|
||||
@@ -38,7 +37,6 @@ export interface DeriveParachain {
|
||||
id: ParaId;
|
||||
info: DeriveParachainInfo | null;
|
||||
relayDispatchQueueSize?: number;
|
||||
watermark: BlockNumber | null;
|
||||
}
|
||||
|
||||
export interface DeriveParachainFull extends DeriveParachain {
|
||||
|
||||
Reference in New Issue
Block a user