mirror of
https://github.com/stjet/banani.git
synced 2025-12-29 09:39:23 +00:00
added rpc calls get_stats and get_confirmation_history (#14)
* add get_stats method and StatsType definitions * add get_confirmation_history method and ConfirmationHistoryRPC definitions * added documentation comment for get_confirmation_history method
This commit is contained in:
62
rpc_types.ts
62
rpc_types.ts
@@ -10,6 +10,8 @@ export type BlockSubtype = BlockBasicTypes | "epoch";
|
||||
export type BlockLegacyTypes = BlockBasicTypes | "open";
|
||||
export type BlockAllTypes = BlockLegacyTypes | "state";
|
||||
|
||||
export type StatsType = "counters" | "samples" | "objects" | "database";
|
||||
|
||||
export interface BlockNoSignature {
|
||||
type: BlockAllTypes;
|
||||
account: Address;
|
||||
@@ -218,4 +220,64 @@ export interface VersionRPC {
|
||||
build_info: string;
|
||||
}
|
||||
|
||||
export interface StatsCountersRPC {
|
||||
type: "counters";
|
||||
created: string;
|
||||
entries: {
|
||||
time: string;
|
||||
type: string;
|
||||
detail: string;
|
||||
dir: "in" | "out";
|
||||
value: `${number}`;
|
||||
}[];
|
||||
}
|
||||
export interface StatsSamplesRPC {
|
||||
type: "samples";
|
||||
created: string;
|
||||
entries:
|
||||
| ""
|
||||
| {
|
||||
time: string;
|
||||
type: string;
|
||||
detail: string;
|
||||
dir: string;
|
||||
value: string;
|
||||
}[];
|
||||
stat_duration_seconds: `${number}`;
|
||||
}
|
||||
export interface StatsUnstableRPC {
|
||||
[key: string]: string | StatsUnstableRPC;
|
||||
}
|
||||
|
||||
export type StatsRPC<T extends StatsType> = T extends "counters" ? StatsCountersRPC : T extends "samples" ? StatsSamplesRPC : T extends "objects" | "database" ? StatsUnstableRPC : never;
|
||||
|
||||
export interface ConfirmationHistoryRPC {
|
||||
confirmation_stats: {
|
||||
count: `${number}`;
|
||||
average: `${number}`;
|
||||
};
|
||||
confirmations:
|
||||
| ""
|
||||
| [
|
||||
{
|
||||
hash: BlockHash;
|
||||
duration: `${number}`;
|
||||
time: `${number}`;
|
||||
tally: `${number}`;
|
||||
blocks: `${number}`;
|
||||
voters: `${number}`;
|
||||
request_count: `${number}`;
|
||||
},
|
||||
{
|
||||
hash: BlockHash;
|
||||
duration: `${number}`;
|
||||
time: `${number}`;
|
||||
tally: `${number}`;
|
||||
blocks: `${number}`;
|
||||
voters: `${number}`;
|
||||
request_count: `${number}`;
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user