File tree Expand file tree Collapse file tree 5 files changed +47
-1
lines changed Expand file tree Collapse file tree 5 files changed +47
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @siafoundation/explored-js ' : minor
3
+ ' @siafoundation/explored-react ' : minor
4
+ ' @siafoundation/explored-types ' : minor
5
+ ---
6
+
7
+ Add hostMetrics API.
Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ import {
52
52
ContractByPubkeyParams ,
53
53
ContractByPubkeyPayload ,
54
54
ContractByPubkeyResponse ,
55
+ hostMetricsRoute ,
56
+ HostMetricsParams ,
57
+ HostMetricsPayload ,
58
+ HostMetricsResponse ,
55
59
hostByPubkeyRoute ,
56
60
HostByPubkeyParams ,
57
61
HostByPubkeyPayload ,
@@ -263,6 +267,11 @@ export function Explored({
263
267
BlockMetricsByIDPayload ,
264
268
BlockMetricsByIDResponse
265
269
> ( axios , 'get' , blockMetricsByIDRoute ) ,
270
+ hostMetrics : buildRequestHandler <
271
+ HostMetricsParams ,
272
+ HostMetricsPayload ,
273
+ HostMetricsResponse
274
+ > ( axios , 'get' , hostMetricsRoute ) ,
266
275
// Search
267
276
searchResultType : buildRequestHandler <
268
277
SearchResultTypeParams ,
Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ import {
39
39
HostByPubkeyParams ,
40
40
HostByPubkeyResponse ,
41
41
hostByPubkeyRoute ,
42
+ HostMetricsParams ,
43
+ HostMetricsResponse ,
44
+ hostMetricsRoute ,
42
45
OutputSiacoinParams ,
43
46
OutputSiacoinResponse ,
44
47
outputSiacoinRoute ,
@@ -345,6 +348,15 @@ export function useBlockMetricsByID(
345
348
} )
346
349
}
347
350
351
+ export function useHostMetrics (
352
+ args : HookArgsSwr < HostMetricsParams , HostMetricsResponse >
353
+ ) {
354
+ return useGetSwr ( {
355
+ ...args ,
356
+ route : hostMetricsRoute ,
357
+ } )
358
+ }
359
+
348
360
// Search
349
361
350
362
export function useSearchResultType (
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
16
16
ExplorerTransaction ,
17
17
FileContractID ,
18
18
Hash256 ,
19
+ HostMetrics ,
19
20
Peer ,
20
21
PublicKey ,
21
22
SearchResultType ,
@@ -216,6 +217,11 @@ export type BlockMetricsByIDParams = { id: BlockID }
216
217
export type BlockMetricsByIDPayload = void
217
218
export type BlockMetricsByIDResponse = BlockMetrics
218
219
220
+ export const hostMetricsRoute = '/metrics/host'
221
+ export type HostMetricsParams = void
222
+ export type HostMetricsPayload = void
223
+ export type HostMetricsResponse = HostMetrics
224
+
219
225
// Search
220
226
221
227
// Returns what type of object an ID is.
Original file line number Diff line number Diff line change @@ -107,7 +107,19 @@ export type TxpoolTransactions = {
107
107
v2transactions : V2Transaction [ ]
108
108
}
109
109
110
- // Novel Explored Types - There are three main differences that inform what's below:
110
+ export type HostMetrics = {
111
+ // Number of hosts that were up as of last scan.
112
+ activeHosts : number
113
+ // Total storage of all active hosts, in bytes.
114
+ totalStorage : number
115
+ // Remaining storage of all active hosts, in bytes.
116
+ remainingStorage : number
117
+
118
+ settings : HostSettings
119
+ priceTable : HostPriceTable
120
+ }
121
+
122
+ // Novel Explored Types
111
123
112
124
/**
113
125
* HostAnnouncement represents a signed announcement of a host's network address.
You can’t perform that action at this time.
0 commit comments