From b8dc3ca40cdee4ef68223568c98db832ad1ac2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 22 Nov 2024 09:29:40 +0100 Subject: [PATCH] blank to makes endpoint fail --- packages/api-kit/src/SafeApiKit.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/api-kit/src/SafeApiKit.ts b/packages/api-kit/src/SafeApiKit.ts index 94eeb3632..2067ac103 100644 --- a/packages/api-kit/src/SafeApiKit.ts +++ b/packages/api-kit/src/SafeApiKit.ts @@ -122,14 +122,21 @@ class SafeApiKit { * @throws "Not Found" * @throws "Ensure this field has at least 1 hexadecimal chars (not counting 0x)." */ - async decodeData(data: string, to: string = ''): Promise { + async decodeData(data: string, to?: string): Promise { if (data === '') { throw new Error('Invalid data') } + + const dataDecoderRequest: { data: string; to?: string } = { data } + + if (to) { + dataDecoderRequest.to = to + } + return sendRequest({ url: `${this.#txServiceBaseUrl}/v1/data-decoder/`, method: HttpMethod.Post, - body: { data, to } + body: dataDecoderRequest }) }