@pythnetwork/hermes-client 2.1.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/hermes-client.cjs +14 -25
- package/dist/cjs/hermes-client.d.ts +8 -21
- package/dist/cjs/utils.cjs +2 -2
- package/dist/cjs/zodSchemas.cjs +4 -62
- package/dist/cjs/zodSchemas.d.ts +18 -824
- package/dist/esm/hermes-client.d.ts +8 -21
- package/dist/esm/hermes-client.mjs +14 -25
- package/dist/esm/zodSchemas.d.ts +18 -824
- package/dist/esm/zodSchemas.mjs +4 -62
- package/package.json +2 -2
package/dist/esm/zodSchemas.mjs
CHANGED
|
@@ -9,7 +9,9 @@ const AssetType = z.enum([
|
|
|
9
9
|
"crypto_redemption_rate",
|
|
10
10
|
"commodities",
|
|
11
11
|
"crypto_index",
|
|
12
|
-
"crypto_nav"
|
|
12
|
+
"crypto_nav",
|
|
13
|
+
"eco",
|
|
14
|
+
"kalshi"
|
|
13
15
|
]);
|
|
14
16
|
const asset_type = AssetType.nullish();
|
|
15
17
|
const RpcPriceIdentifier = z.string();
|
|
@@ -58,17 +60,6 @@ const LatestPublisherStakeCapsUpdateDataResponse = z.object({
|
|
|
58
60
|
binary: BinaryUpdate,
|
|
59
61
|
parsed: z.array(ParsedPublisherStakeCapsUpdate).nullish()
|
|
60
62
|
}).passthrough();
|
|
61
|
-
const ParsedPriceFeedTwap = z.object({
|
|
62
|
-
down_slots_ratio: z.string(),
|
|
63
|
-
end_timestamp: z.number().int(),
|
|
64
|
-
id: RpcPriceIdentifier,
|
|
65
|
-
start_timestamp: z.number().int(),
|
|
66
|
-
twap: RpcPrice
|
|
67
|
-
}).passthrough();
|
|
68
|
-
const TwapsResponse = z.object({
|
|
69
|
-
binary: BinaryUpdate,
|
|
70
|
-
parsed: z.array(ParsedPriceFeedTwap).nullish()
|
|
71
|
-
}).passthrough();
|
|
72
63
|
export const schemas = {
|
|
73
64
|
AssetType,
|
|
74
65
|
asset_type,
|
|
@@ -83,9 +74,7 @@ export const schemas = {
|
|
|
83
74
|
PriceUpdate,
|
|
84
75
|
ParsedPublisherStakeCap,
|
|
85
76
|
ParsedPublisherStakeCapsUpdate,
|
|
86
|
-
LatestPublisherStakeCapsUpdateDataResponse
|
|
87
|
-
ParsedPriceFeedTwap,
|
|
88
|
-
TwapsResponse
|
|
77
|
+
LatestPublisherStakeCapsUpdateDataResponse
|
|
89
78
|
};
|
|
90
79
|
const endpoints = makeApi([
|
|
91
80
|
{
|
|
@@ -275,53 +264,6 @@ Clients should implement reconnection logic to maintain continuous price updates
|
|
|
275
264
|
}
|
|
276
265
|
],
|
|
277
266
|
response: LatestPublisherStakeCapsUpdateDataResponse
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
method: "get",
|
|
281
|
-
path: "/v2/updates/twap/:window_seconds/latest",
|
|
282
|
-
alias: "latest_twaps",
|
|
283
|
-
description: `Get the latest TWAP by price feed id with a custom time window.
|
|
284
|
-
|
|
285
|
-
Given a collection of price feed ids, retrieve the latest Pyth TWAP price for each price feed.`,
|
|
286
|
-
requestFormat: "json",
|
|
287
|
-
parameters: [
|
|
288
|
-
{
|
|
289
|
-
name: "window_seconds",
|
|
290
|
-
type: "Path",
|
|
291
|
-
schema: z.number().int().gte(0)
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
name: "ids[]",
|
|
295
|
-
type: "Query",
|
|
296
|
-
schema: z.array(PriceIdInput)
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
name: "encoding",
|
|
300
|
-
type: "Query",
|
|
301
|
-
schema: z.enum([
|
|
302
|
-
"hex",
|
|
303
|
-
"base64"
|
|
304
|
-
]).optional()
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
name: "parsed",
|
|
308
|
-
type: "Query",
|
|
309
|
-
schema: z.boolean().optional()
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
name: "ignore_invalid_price_ids",
|
|
313
|
-
type: "Query",
|
|
314
|
-
schema: z.boolean().optional()
|
|
315
|
-
}
|
|
316
|
-
],
|
|
317
|
-
response: TwapsResponse,
|
|
318
|
-
errors: [
|
|
319
|
-
{
|
|
320
|
-
status: 404,
|
|
321
|
-
description: `Price ids not found`,
|
|
322
|
-
schema: z.void()
|
|
323
|
-
}
|
|
324
|
-
]
|
|
325
267
|
}
|
|
326
268
|
]);
|
|
327
269
|
export const api = new Zodios(endpoints);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/hermes-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Pyth Hermes Client",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Pyth Data Association"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"zod": "^3.23.8"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
|
-
"node": "
|
|
43
|
+
"node": "^24.0.0"
|
|
44
44
|
},
|
|
45
45
|
"type": "module",
|
|
46
46
|
"exports": {
|