@pythnetwork/hermes-client 1.1.0 → 1.2.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/README.md +7 -4
- package/lib/HermesClient.d.ts +12 -5
- package/lib/HermesClient.d.ts.map +1 -1
- package/lib/HermesClient.js +13 -7
- package/lib/zodSchemas.d.ts +28 -4
- package/lib/zodSchemas.d.ts.map +1 -1
- package/lib/zodSchemas.js +23 -1
- package/package.json +9 -11
package/README.md
CHANGED
|
@@ -69,12 +69,15 @@ By default, these updates are returned as binary data and is serialized as eithe
|
|
|
69
69
|
|
|
70
70
|
### Examples
|
|
71
71
|
|
|
72
|
-
The [HermesClient](./src/examples/HermesClient.ts) example demonstrates both the
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
The [HermesClient](./src/examples/HermesClient.ts) example demonstrates both the
|
|
73
|
+
examples above. To run the example:
|
|
74
|
+
|
|
75
|
+
1. Clone [the Pyth monorepo](https://github.com/pyth-network/pyth-crosschain)
|
|
76
|
+
2. In the root of the monorepo, run `pnpm example:hermes-client -- <args>`. For
|
|
77
|
+
example, to print BTC and ETH price feeds in the testnet network, run:
|
|
75
78
|
|
|
76
79
|
```bash
|
|
77
|
-
|
|
80
|
+
pnpm example:hermes-client -- \
|
|
78
81
|
--endpoint https://hermes.pyth.network \
|
|
79
82
|
--price-ids \
|
|
80
83
|
0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43 \
|
package/lib/HermesClient.d.ts
CHANGED
|
@@ -78,12 +78,14 @@ export declare class HermesClient {
|
|
|
78
78
|
* @param options Optional parameters:
|
|
79
79
|
* - encoding: Encoding type. If specified, return the price update in the encoding specified by the encoding parameter. Default is hex.
|
|
80
80
|
* - parsed: Boolean to specify if the parsed price update should be included in the response. Default is false.
|
|
81
|
+
* - ignoreInvalidPriceIds: Boolean to specify if invalid price IDs should be ignored instead of returning an error. Default is false.
|
|
81
82
|
*
|
|
82
83
|
* @returns PriceUpdate object containing the latest updates.
|
|
83
84
|
*/
|
|
84
85
|
getLatestPriceUpdates(ids: HexString[], options?: {
|
|
85
86
|
encoding?: EncodingType;
|
|
86
87
|
parsed?: boolean;
|
|
88
|
+
ignoreInvalidPriceIds?: boolean;
|
|
87
89
|
}): Promise<PriceUpdate>;
|
|
88
90
|
/**
|
|
89
91
|
* Fetch the price updates for a set of price feed IDs at a given timestamp.
|
|
@@ -95,12 +97,14 @@ export declare class HermesClient {
|
|
|
95
97
|
* @param options Optional parameters:
|
|
96
98
|
* - encoding: Encoding type. If specified, return the price update in the encoding specified by the encoding parameter. Default is hex.
|
|
97
99
|
* - parsed: Boolean to specify if the parsed price update should be included in the response. Default is false.
|
|
100
|
+
* - ignoreInvalidPriceIds: Boolean to specify if invalid price IDs should be ignored instead of returning an error. Default is false.
|
|
98
101
|
*
|
|
99
102
|
* @returns PriceUpdate object containing the updates at the specified timestamp.
|
|
100
103
|
*/
|
|
101
104
|
getPriceUpdatesAtTimestamp(publishTime: UnixTimestamp, ids: HexString[], options?: {
|
|
102
105
|
encoding?: EncodingType;
|
|
103
106
|
parsed?: boolean;
|
|
107
|
+
ignoreInvalidPriceIds?: boolean;
|
|
104
108
|
}): Promise<PriceUpdate>;
|
|
105
109
|
/**
|
|
106
110
|
* Fetch streaming price updates for a set of price feed IDs.
|
|
@@ -109,12 +113,14 @@ export declare class HermesClient {
|
|
|
109
113
|
* This will return an EventSource that can be used to listen to streaming updates.
|
|
110
114
|
* If an invalid hex-encoded ID is passed, it will throw an error.
|
|
111
115
|
*
|
|
112
|
-
*
|
|
113
116
|
* @param ids Array of hex-encoded price feed IDs for which streaming updates are requested.
|
|
114
|
-
* @param
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
117
|
+
* @param options Optional parameters:
|
|
118
|
+
* - encoding: Encoding type. If specified, updates are returned in the specified encoding. Default is hex.
|
|
119
|
+
* - parsed: Boolean to specify if the parsed price update should be included in the response. Default is false.
|
|
120
|
+
* - allowUnordered: Boolean to specify if unordered updates are allowed to be included in the stream. Default is false.
|
|
121
|
+
* - benchmarksOnly: Boolean to specify if only benchmark prices should be returned. Default is false.
|
|
122
|
+
* - ignoreInvalidPriceIds: Boolean to specify if invalid price IDs should be ignored instead of returning an error. Default is false.
|
|
123
|
+
*
|
|
118
124
|
* @returns An EventSource instance for receiving streaming updates.
|
|
119
125
|
*/
|
|
120
126
|
getPriceUpdatesStream(ids: HexString[], options?: {
|
|
@@ -122,6 +128,7 @@ export declare class HermesClient {
|
|
|
122
128
|
parsed?: boolean;
|
|
123
129
|
allowUnordered?: boolean;
|
|
124
130
|
benchmarksOnly?: boolean;
|
|
131
|
+
ignoreInvalidPriceIds?: boolean;
|
|
125
132
|
}): Promise<EventSource>;
|
|
126
133
|
private appendUrlSearchParams;
|
|
127
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HermesClient.d.ts","sourceRoot":"","sources":["../src/HermesClient.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;AAC1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;AACrE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC1E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;AAChE,MAAM,MA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jC,GACA,OAAO,CAAC,WAAW,CAAC;IAcvB,OAAO,CAAC,qBAAqB;CAU9B"}
|
package/lib/HermesClient.js
CHANGED
|
@@ -102,6 +102,7 @@ class HermesClient {
|
|
|
102
102
|
* @param options Optional parameters:
|
|
103
103
|
* - encoding: Encoding type. If specified, return the price update in the encoding specified by the encoding parameter. Default is hex.
|
|
104
104
|
* - parsed: Boolean to specify if the parsed price update should be included in the response. Default is false.
|
|
105
|
+
* - ignoreInvalidPriceIds: Boolean to specify if invalid price IDs should be ignored instead of returning an error. Default is false.
|
|
105
106
|
*
|
|
106
107
|
* @returns PriceUpdate object containing the latest updates.
|
|
107
108
|
*/
|
|
@@ -111,7 +112,8 @@ class HermesClient {
|
|
|
111
112
|
url.searchParams.append("ids[]", id);
|
|
112
113
|
}
|
|
113
114
|
if (options) {
|
|
114
|
-
|
|
115
|
+
const transformedOptions = (0, utils_1.camelToSnakeCaseObject)(options);
|
|
116
|
+
this.appendUrlSearchParams(url, transformedOptions);
|
|
115
117
|
}
|
|
116
118
|
return this.httpRequest(url.toString(), zodSchemas_1.schemas.PriceUpdate);
|
|
117
119
|
}
|
|
@@ -125,6 +127,7 @@ class HermesClient {
|
|
|
125
127
|
* @param options Optional parameters:
|
|
126
128
|
* - encoding: Encoding type. If specified, return the price update in the encoding specified by the encoding parameter. Default is hex.
|
|
127
129
|
* - parsed: Boolean to specify if the parsed price update should be included in the response. Default is false.
|
|
130
|
+
* - ignoreInvalidPriceIds: Boolean to specify if invalid price IDs should be ignored instead of returning an error. Default is false.
|
|
128
131
|
*
|
|
129
132
|
* @returns PriceUpdate object containing the updates at the specified timestamp.
|
|
130
133
|
*/
|
|
@@ -134,7 +137,8 @@ class HermesClient {
|
|
|
134
137
|
url.searchParams.append("ids[]", id);
|
|
135
138
|
}
|
|
136
139
|
if (options) {
|
|
137
|
-
|
|
140
|
+
const transformedOptions = (0, utils_1.camelToSnakeCaseObject)(options);
|
|
141
|
+
this.appendUrlSearchParams(url, transformedOptions);
|
|
138
142
|
}
|
|
139
143
|
return this.httpRequest(url.toString(), zodSchemas_1.schemas.PriceUpdate);
|
|
140
144
|
}
|
|
@@ -145,12 +149,14 @@ class HermesClient {
|
|
|
145
149
|
* This will return an EventSource that can be used to listen to streaming updates.
|
|
146
150
|
* If an invalid hex-encoded ID is passed, it will throw an error.
|
|
147
151
|
*
|
|
148
|
-
*
|
|
149
152
|
* @param ids Array of hex-encoded price feed IDs for which streaming updates are requested.
|
|
150
|
-
* @param
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
153
|
+
* @param options Optional parameters:
|
|
154
|
+
* - encoding: Encoding type. If specified, updates are returned in the specified encoding. Default is hex.
|
|
155
|
+
* - parsed: Boolean to specify if the parsed price update should be included in the response. Default is false.
|
|
156
|
+
* - allowUnordered: Boolean to specify if unordered updates are allowed to be included in the stream. Default is false.
|
|
157
|
+
* - benchmarksOnly: Boolean to specify if only benchmark prices should be returned. Default is false.
|
|
158
|
+
* - ignoreInvalidPriceIds: Boolean to specify if invalid price IDs should be ignored instead of returning an error. Default is false.
|
|
159
|
+
*
|
|
154
160
|
* @returns An EventSource instance for receiving streaming updates.
|
|
155
161
|
*/
|
|
156
162
|
async getPriceUpdatesStream(ids, options) {
|
package/lib/zodSchemas.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ZodiosOptions } from "@zodios/core";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export declare const schemas: {
|
|
4
|
-
AssetType: z.ZodEnum<["crypto", "fx", "equity", "
|
|
5
|
-
asset_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["crypto", "fx", "equity", "
|
|
4
|
+
AssetType: z.ZodEnum<["crypto", "fx", "equity", "metal", "rates", "crypto_redemption_rate"]>;
|
|
5
|
+
asset_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["crypto", "fx", "equity", "metal", "rates", "crypto_redemption_rate"]>>>;
|
|
6
6
|
RpcPriceIdentifier: z.ZodString;
|
|
7
7
|
PriceFeedMetadata: z.ZodObject<{
|
|
8
8
|
attributes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
@@ -851,7 +851,7 @@ export declare const api: import("@zodios/core").ZodiosInstance<[{
|
|
|
851
851
|
}, {
|
|
852
852
|
name: "asset_type";
|
|
853
853
|
type: "Query";
|
|
854
|
-
schema: z.ZodOptional<z.ZodNullable<z.ZodEnum<["crypto", "fx", "equity", "
|
|
854
|
+
schema: z.ZodOptional<z.ZodNullable<z.ZodEnum<["crypto", "fx", "equity", "metal", "rates", "crypto_redemption_rate"]>>>;
|
|
855
855
|
}];
|
|
856
856
|
response: z.ZodArray<z.ZodObject<{
|
|
857
857
|
attributes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
@@ -885,6 +885,10 @@ export declare const api: import("@zodios/core").ZodiosInstance<[{
|
|
|
885
885
|
name: "parsed";
|
|
886
886
|
type: "Query";
|
|
887
887
|
schema: z.ZodOptional<z.ZodBoolean>;
|
|
888
|
+
}, {
|
|
889
|
+
name: "ignore_invalid_price_ids";
|
|
890
|
+
type: "Query";
|
|
891
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
888
892
|
}];
|
|
889
893
|
response: z.ZodObject<{
|
|
890
894
|
binary: z.ZodObject<{
|
|
@@ -1369,6 +1373,10 @@ export declare const api: import("@zodios/core").ZodiosInstance<[{
|
|
|
1369
1373
|
name: "parsed";
|
|
1370
1374
|
type: "Query";
|
|
1371
1375
|
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1376
|
+
}, {
|
|
1377
|
+
name: "ignore_invalid_price_ids";
|
|
1378
|
+
type: "Query";
|
|
1379
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1372
1380
|
}];
|
|
1373
1381
|
response: z.ZodObject<{
|
|
1374
1382
|
binary: z.ZodObject<{
|
|
@@ -1861,6 +1869,10 @@ export declare const api: import("@zodios/core").ZodiosInstance<[{
|
|
|
1861
1869
|
name: "benchmarks_only";
|
|
1862
1870
|
type: "Query";
|
|
1863
1871
|
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1872
|
+
}, {
|
|
1873
|
+
name: "ignore_invalid_price_ids";
|
|
1874
|
+
type: "Query";
|
|
1875
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1864
1876
|
}];
|
|
1865
1877
|
response: z.ZodObject<{
|
|
1866
1878
|
binary: z.ZodObject<{
|
|
@@ -2492,7 +2504,7 @@ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions
|
|
|
2492
2504
|
}, {
|
|
2493
2505
|
name: "asset_type";
|
|
2494
2506
|
type: "Query";
|
|
2495
|
-
schema: z.ZodOptional<z.ZodNullable<z.ZodEnum<["crypto", "fx", "equity", "
|
|
2507
|
+
schema: z.ZodOptional<z.ZodNullable<z.ZodEnum<["crypto", "fx", "equity", "metal", "rates", "crypto_redemption_rate"]>>>;
|
|
2496
2508
|
}];
|
|
2497
2509
|
response: z.ZodArray<z.ZodObject<{
|
|
2498
2510
|
attributes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
@@ -2526,6 +2538,10 @@ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions
|
|
|
2526
2538
|
name: "parsed";
|
|
2527
2539
|
type: "Query";
|
|
2528
2540
|
schema: z.ZodOptional<z.ZodBoolean>;
|
|
2541
|
+
}, {
|
|
2542
|
+
name: "ignore_invalid_price_ids";
|
|
2543
|
+
type: "Query";
|
|
2544
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
2529
2545
|
}];
|
|
2530
2546
|
response: z.ZodObject<{
|
|
2531
2547
|
binary: z.ZodObject<{
|
|
@@ -3010,6 +3026,10 @@ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions
|
|
|
3010
3026
|
name: "parsed";
|
|
3011
3027
|
type: "Query";
|
|
3012
3028
|
schema: z.ZodOptional<z.ZodBoolean>;
|
|
3029
|
+
}, {
|
|
3030
|
+
name: "ignore_invalid_price_ids";
|
|
3031
|
+
type: "Query";
|
|
3032
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
3013
3033
|
}];
|
|
3014
3034
|
response: z.ZodObject<{
|
|
3015
3035
|
binary: z.ZodObject<{
|
|
@@ -3502,6 +3522,10 @@ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions
|
|
|
3502
3522
|
name: "benchmarks_only";
|
|
3503
3523
|
type: "Query";
|
|
3504
3524
|
schema: z.ZodOptional<z.ZodBoolean>;
|
|
3525
|
+
}, {
|
|
3526
|
+
name: "ignore_invalid_price_ids";
|
|
3527
|
+
type: "Query";
|
|
3528
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
3505
3529
|
}];
|
|
3506
3530
|
response: z.ZodObject<{
|
|
3507
3531
|
binary: z.ZodObject<{
|
package/lib/zodSchemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodSchemas.d.ts","sourceRoot":"","sources":["../src/zodSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"zodSchemas.d.ts","sourceRoot":"","sources":["../src/zodSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+DxB,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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|
|
4
4
|
const core_1 = require("@zodios/core");
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
|
-
const AssetType = zod_1.z.enum([
|
|
6
|
+
const AssetType = zod_1.z.enum([
|
|
7
|
+
"crypto",
|
|
8
|
+
"fx",
|
|
9
|
+
"equity",
|
|
10
|
+
"metal",
|
|
11
|
+
"rates",
|
|
12
|
+
"crypto_redemption_rate",
|
|
13
|
+
]);
|
|
7
14
|
const asset_type = AssetType.nullish();
|
|
8
15
|
const RpcPriceIdentifier = zod_1.z.string();
|
|
9
16
|
const PriceFeedMetadata = zod_1.z
|
|
@@ -125,6 +132,11 @@ Given a collection of price feed ids, retrieve the latest Pyth price for each pr
|
|
|
125
132
|
type: "Query",
|
|
126
133
|
schema: zod_1.z.boolean().optional(),
|
|
127
134
|
},
|
|
135
|
+
{
|
|
136
|
+
name: "ignore_invalid_price_ids",
|
|
137
|
+
type: "Query",
|
|
138
|
+
schema: zod_1.z.boolean().optional(),
|
|
139
|
+
},
|
|
128
140
|
],
|
|
129
141
|
response: PriceUpdate,
|
|
130
142
|
errors: [
|
|
@@ -159,6 +171,11 @@ Given a collection of price feed ids, retrieve the latest Pyth price for each pr
|
|
|
159
171
|
type: "Query",
|
|
160
172
|
schema: zod_1.z.boolean().optional(),
|
|
161
173
|
},
|
|
174
|
+
{
|
|
175
|
+
name: "ignore_invalid_price_ids",
|
|
176
|
+
type: "Query",
|
|
177
|
+
schema: zod_1.z.boolean().optional(),
|
|
178
|
+
},
|
|
162
179
|
],
|
|
163
180
|
response: PriceUpdate,
|
|
164
181
|
errors: [
|
|
@@ -201,6 +218,11 @@ Given a collection of price feed ids, retrieve the latest Pyth price for each pr
|
|
|
201
218
|
type: "Query",
|
|
202
219
|
schema: zod_1.z.boolean().optional(),
|
|
203
220
|
},
|
|
221
|
+
{
|
|
222
|
+
name: "ignore_invalid_price_ids",
|
|
223
|
+
type: "Query",
|
|
224
|
+
schema: zod_1.z.boolean().optional(),
|
|
225
|
+
},
|
|
204
226
|
],
|
|
205
227
|
response: PriceUpdate,
|
|
206
228
|
errors: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/hermes-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Pyth Hermes Client",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Pyth Data Association"
|
|
@@ -20,16 +20,14 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"check-hermes-api-types": "git diff --exit-code src/zodSchemas.ts",
|
|
28
|
-
"example": "pnpm run build && node lib/examples/HermesClient.js",
|
|
23
|
+
"build:typescript": "tsc",
|
|
24
|
+
"build:schemas": "openapi-zod-client ./schema.json --output src/zodSchemas.ts",
|
|
25
|
+
"pull:schema": "curl -o schema.json -z schema.json https://hermes.pyth.network/docs/openapi.json",
|
|
26
|
+
"example": "node lib/examples/HermesClient.js",
|
|
29
27
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
30
|
-
"lint": "eslint src/",
|
|
31
|
-
"prepublishOnly": "pnpm run build && pnpm
|
|
32
|
-
"preversion": "pnpm run lint",
|
|
28
|
+
"test:lint": "eslint src/",
|
|
29
|
+
"prepublishOnly": "pnpm run build:typescript && pnpm run test:lint",
|
|
30
|
+
"preversion": "pnpm run test:lint",
|
|
33
31
|
"version": "pnpm run format && git add -A src"
|
|
34
32
|
},
|
|
35
33
|
"keywords": [
|
|
@@ -57,5 +55,5 @@
|
|
|
57
55
|
"eventsource": "^2.0.2",
|
|
58
56
|
"zod": "^3.23.8"
|
|
59
57
|
},
|
|
60
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "733971809a4415c420922477a162aff3789a7774"
|
|
61
59
|
}
|