From 8135bf83dcb057a12db46bacbd037492e0407a0b Mon Sep 17 00:00:00 2001 From: Catalin Faur <52102171+cfaur09@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:33:43 +0200 Subject: [PATCH] Added a check for encoded data in KeysService to handle cases where no data is returned, ensuring a default response of remainingUnBondPeriod as 0. (#1427) --- src/endpoints/keys/keys.service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/endpoints/keys/keys.service.ts b/src/endpoints/keys/keys.service.ts index 149196bf3..b4887e654 100644 --- a/src/endpoints/keys/keys.service.ts +++ b/src/endpoints/keys/keys.service.ts @@ -27,6 +27,10 @@ export class KeysService { [key] ); + if (!encoded || !encoded[0]) { + return { remainingUnBondPeriod: 0 }; + } + let remainingUnBondPeriod = parseInt(Buffer.from(encoded[0], 'base64').toString('ascii')); if (isNaN(remainingUnBondPeriod)) {