From 9bdff5a7cb12a8a1fc7711c425f21b0707f816d4 Mon Sep 17 00:00:00 2001 From: Troy Kessler <43882936+troykessler@users.noreply.github.com> Date: Tue, 8 Aug 2023 10:35:09 +0200 Subject: [PATCH] fix: trim trailing slash and build url correctly (#59) --- common/sdk/src/clients/lcd-client/lcd-client.abstract.ts | 2 +- common/sdk/src/sdk.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/sdk/src/clients/lcd-client/lcd-client.abstract.ts b/common/sdk/src/clients/lcd-client/lcd-client.abstract.ts index 5c440479..632983b7 100644 --- a/common/sdk/src/clients/lcd-client/lcd-client.abstract.ts +++ b/common/sdk/src/clients/lcd-client/lcd-client.abstract.ts @@ -22,7 +22,7 @@ export class AbstractKyveLCDClient { this.restEndpoint = restEndpoint; this.request = (url: string, params?: Record) => axios - .get(new URL(url, this.restEndpoint).href, { params }) + .get(`${this.restEndpoint}${url}`, { params }) .then((res) => res.data); } } diff --git a/common/sdk/src/sdk.ts b/common/sdk/src/sdk.ts index f4165ca9..586f33d3 100644 --- a/common/sdk/src/sdk.ts +++ b/common/sdk/src/sdk.ts @@ -64,11 +64,11 @@ export class KyveSDK { } if (options?.rpc) { - this.config = { ...this.config, rpc: options.rpc }; + this.config = { ...this.config, rpc: options.rpc.replace(/\/$/, "") }; } if (options?.rest) { - this.config = { ...this.config, rest: options.rest }; + this.config = { ...this.config, rest: options.rest.replace(/\/$/, "") }; } if (options?.coin) {