Просмотр исходного кода

fix(apps/hermes/client): allow baseURL with suffixes (#1728)

* fix(apps/hermes/client): allow baseURL with prefixes

* use baseURL + url format

* update package version
Mubaris 1 год назад
Родитель
Сommit
dcf7a318e2
2 измененных файлов с 5 добавлено и 5 удалено
  1. 1 1
      apps/hermes/client/js/package.json
  2. 4 4
      apps/hermes/client/js/src/HermesClient.ts

+ 1 - 1
apps/hermes/client/js/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@pythnetwork/hermes-client",
-  "version": "1.0.2",
+  "version": "1.0.3",
   "description": "Pyth Hermes Client",
   "author": {
     "name": "Pyth Data Association"

+ 4 - 4
apps/hermes/client/js/src/HermesClient.ts

@@ -100,7 +100,7 @@ export class HermesClient {
     query?: string;
     filter?: string;
   }): Promise<PriceFeedMetadata[]> {
-    const url = new URL("/v2/price_feeds", this.baseURL);
+    const url = new URL("v2/price_feeds", this.baseURL);
     if (options) {
       this.appendUrlSearchParams(url, options);
     }
@@ -129,7 +129,7 @@ export class HermesClient {
       parsed?: boolean;
     }
   ): Promise<PriceUpdate> {
-    const url = new URL(`${this.baseURL}/v2/updates/price/latest`);
+    const url = new URL(`v2/updates/price/latest`, this.baseURL);
     for (const id of ids) {
       url.searchParams.append("ids[]", id);
     }
@@ -162,7 +162,7 @@ export class HermesClient {
       parsed?: boolean;
     }
   ): Promise<PriceUpdate> {
-    const url = new URL(`${this.baseURL}/v2/updates/price/${publishTime}`);
+    const url = new URL(`v2/updates/price/${publishTime}`, this.baseURL);
     for (const id of ids) {
       url.searchParams.append("ids[]", id);
     }
@@ -198,7 +198,7 @@ export class HermesClient {
       benchmarksOnly?: boolean;
     }
   ): Promise<EventSource> {
-    const url = new URL("/v2/updates/price/stream", this.baseURL);
+    const url = new URL("v2/updates/price/stream", this.baseURL);
     ids.forEach((id) => {
       url.searchParams.append("ids[]", id);
     });