Pass through node details

This commit is contained in:
maciejhirsz
2018-06-27 16:52:32 +02:00
parent 5c9186670d
commit b57dc22c33
9 changed files with 104 additions and 51 deletions
+15 -10
View File
@@ -4,17 +4,17 @@ import { Id } from './id';
export type FeedId = Id<'Feed'>;
export type NodeId = Id<'Node'>;
export type NodeName = Opaque<string, 'NodeName'>;
export type NodeImplementation = Opaque<string, 'NodeImplementation'>;
export type NodeVersion = Opaque<string, 'NodeVersion'>;
export type BlockNumber = Opaque<number, 'BlockNumber'>;
export type BlockHash = Opaque<string, 'BlockHash'>;
export type Milliseconds = Opaque<number, 'Milliseconds'>;
export type PeerCount = Opaque<number, 'PeerCount'>;
export type TransactionCount = Opaque<number, 'TransactionCount'>;
export interface BlockDetails {
height: BlockNumber;
blockTime: Milliseconds;
}
export interface NodeDetails {
name: NodeName;
}
export type BlockDetails = [BlockNumber, Milliseconds];
export type NodeDetails = [NodeName, NodeImplementation, NodeVersion];
export type NodeStats = [PeerCount, TransactionCount];
interface BestBlock {
action: 'best';
@@ -23,7 +23,7 @@ interface BestBlock {
interface AddedNode {
action: 'added';
payload: [NodeId, NodeDetails, BlockDetails];
payload: [NodeId, NodeDetails, NodeStats, BlockDetails];
}
interface RemovedNode {
@@ -36,4 +36,9 @@ interface Imported {
payload: [NodeId, BlockDetails];
}
export type FeedMessage = BestBlock | AddedNode | RemovedNode | Imported;
interface Stats {
action: 'stats';
payload: [NodeId, NodeStats];
}
export type FeedMessage = BestBlock | AddedNode | RemovedNode | Imported | Stats;