Skip to content

Commit b95e34d

Browse files
committed
feat(explored-types): add explorerTip route
1 parent 05b0b5b commit b95e34d

File tree

4 files changed

+44
-8
lines changed

4 files changed

+44
-8
lines changed

.changeset/dry-socks-build.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@siafoundation/explored-js': minor
3+
'@siafoundation/explored-react': minor
4+
'@siafoundation/explored-types': minor
5+
---
6+
7+
Added explorerTip API.

libs/explored-js/src/api.ts

+18-8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ import {
2020
BlockByIDParams,
2121
BlockByIDPayload,
2222
BlockByIDResponse,
23+
blockMetricsRoute,
24+
BlockMetricsParams,
25+
BlockMetricsPayload,
26+
BlockMetricsResponse,
27+
blockMetricsByIDRoute,
28+
BlockMetricsByIDParams,
29+
BlockMetricsByIDPayload,
30+
BlockMetricsByIDResponse,
2331
consensusNetworkRoute,
2432
ConsensusNetworkParams,
2533
ConsensusNetworkPayload,
@@ -56,6 +64,10 @@ import {
5664
ExchangeRatePayload,
5765
ExchangeRateResponse,
5866
exchangeRateRoute,
67+
explorerTipRoute,
68+
ExplorerTipParams,
69+
ExplorerTipPayload,
70+
ExplorerTipResponse,
5971
hostMetricsRoute,
6072
HostMetricsParams,
6173
HostMetricsPayload,
@@ -68,14 +80,6 @@ import {
6880
HostByPubkeyParams,
6981
HostByPubkeyPayload,
7082
HostByPubkeyResponse,
71-
blockMetricsRoute,
72-
BlockMetricsParams,
73-
BlockMetricsPayload,
74-
BlockMetricsResponse,
75-
blockMetricsByIDRoute,
76-
BlockMetricsByIDParams,
77-
BlockMetricsByIDPayload,
78-
BlockMetricsByIDResponse,
7983
OutputSiacoinParams,
8084
OutputSiacoinPayload,
8185
OutputSiacoinResponse,
@@ -303,5 +307,11 @@ export function Explored({
303307
ExchangeRatePayload,
304308
ExchangeRateResponse
305309
>(axios, 'get', exchangeRateRoute),
310+
// Explorer Tip
311+
explorerTip: buildRequestHandler<
312+
ExplorerTipParams,
313+
ExplorerTipPayload,
314+
ExplorerTipResponse
315+
>(axios, 'get', explorerTipRoute),
306316
}
307317
}

libs/explored-react/src/hooks.ts

+13
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ import {
3939
ExchangeRateParams,
4040
ExchangeRateResponse,
4141
exchangeRateRoute,
42+
ExplorerTipParams,
43+
ExplorerTipResponse,
44+
explorerTipRoute,
4245
HostByPubkeyParams,
4346
HostByPubkeyResponse,
4447
hostByPubkeyRoute,
@@ -404,3 +407,13 @@ export function useExchangeRate(
404407
route: exchangeRateRoute,
405408
})
406409
}
410+
411+
// Explorer Tip
412+
export function useExplorerTip(
413+
args: HookArgsSwr<ExplorerTipParams, ExplorerTipResponse>
414+
) {
415+
return useGetSwr({
416+
...args,
417+
route: explorerTipRoute,
418+
})
419+
}

libs/explored-types/src/api.ts

+6
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,9 @@ export const exchangeRateRoute = '/exchange-rate/siacoin/:currency'
260260
export type ExchangeRateParams = { currency: CurrencyID }
261261
export type ExchangeRatePayload = void
262262
export type ExchangeRateResponse = number
263+
264+
// Explorer Tip
265+
export const explorerTipRoute = '/explorer/tip'
266+
export type ExplorerTipParams = void
267+
export type ExplorerTipPayload = void
268+
export type ExplorerTipResponse = ChainIndex

0 commit comments

Comments
 (0)