@pythnetwork/hermes-client 1.0.1 → 1.0.3
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/lib/HermesClient.js +4 -4
- package/package.json +8 -6
package/lib/HermesClient.js
CHANGED
|
@@ -63,7 +63,7 @@ class HermesClient {
|
|
|
63
63
|
* @returns Array of PriceFeedMetadata objects.
|
|
64
64
|
*/
|
|
65
65
|
async getPriceFeeds(options) {
|
|
66
|
-
const url = new URL("
|
|
66
|
+
const url = new URL("v2/price_feeds", this.baseURL);
|
|
67
67
|
if (options) {
|
|
68
68
|
this.appendUrlSearchParams(url, options);
|
|
69
69
|
}
|
|
@@ -82,7 +82,7 @@ class HermesClient {
|
|
|
82
82
|
* @returns PriceUpdate object containing the latest updates.
|
|
83
83
|
*/
|
|
84
84
|
async getLatestPriceUpdates(ids, options) {
|
|
85
|
-
const url = new URL(
|
|
85
|
+
const url = new URL(`v2/updates/price/latest`, this.baseURL);
|
|
86
86
|
for (const id of ids) {
|
|
87
87
|
url.searchParams.append("ids[]", id);
|
|
88
88
|
}
|
|
@@ -105,7 +105,7 @@ class HermesClient {
|
|
|
105
105
|
* @returns PriceUpdate object containing the updates at the specified timestamp.
|
|
106
106
|
*/
|
|
107
107
|
async getPriceUpdatesAtTimestamp(publishTime, ids, options) {
|
|
108
|
-
const url = new URL(
|
|
108
|
+
const url = new URL(`v2/updates/price/${publishTime}`, this.baseURL);
|
|
109
109
|
for (const id of ids) {
|
|
110
110
|
url.searchParams.append("ids[]", id);
|
|
111
111
|
}
|
|
@@ -130,7 +130,7 @@ class HermesClient {
|
|
|
130
130
|
* @returns An EventSource instance for receiving streaming updates.
|
|
131
131
|
*/
|
|
132
132
|
async getPriceUpdatesStream(ids, options) {
|
|
133
|
-
const url = new URL("
|
|
133
|
+
const url = new URL("v2/updates/price/stream", this.baseURL);
|
|
134
134
|
ids.forEach((id) => {
|
|
135
135
|
url.searchParams.append("ids[]", id);
|
|
136
136
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/hermes-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Pyth Hermes Client",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Pyth Data Association"
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"build": "tsc",
|
|
26
26
|
"generate-hermes-api-types": "openapi-zod-client https://hermes.pyth.network/docs/openapi.json --output src/zodSchemas.ts && prettier --write src/zodSchemas.ts",
|
|
27
27
|
"check-hermes-api-types": "git diff --exit-code src/zodSchemas.ts",
|
|
28
|
-
"example": "
|
|
28
|
+
"example": "pnpm run build && node lib/examples/HermesClient.js",
|
|
29
29
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
30
30
|
"lint": "eslint src/",
|
|
31
|
-
"prepublishOnly": "
|
|
32
|
-
"preversion": "
|
|
33
|
-
"version": "
|
|
31
|
+
"prepublishOnly": "pnpm run build && pnpm test && pnpm run lint",
|
|
32
|
+
"preversion": "pnpm run lint",
|
|
33
|
+
"version": "pnpm run format && git add -A src"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"pyth",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/eventsource": "^1.1.15",
|
|
42
42
|
"@types/jest": "^29.4.0",
|
|
43
|
+
"@types/node": "^20.14.2",
|
|
43
44
|
"@types/yargs": "^17.0.10",
|
|
44
45
|
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
|
45
46
|
"@typescript-eslint/parser": "^5.21.0",
|
|
@@ -52,8 +53,9 @@
|
|
|
52
53
|
"yargs": "^17.4.1"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
56
|
+
"@zodios/core": "^10.9.6",
|
|
55
57
|
"eventsource": "^2.0.2",
|
|
56
58
|
"zod": "^3.23.8"
|
|
57
59
|
},
|
|
58
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "dcf7a318e23ca38793d22b2adb7d4b902097f179"
|
|
59
61
|
}
|