Skip to content

Commit

Permalink
Added a check for encoded data in KeysService to handle cases where n…
Browse files Browse the repository at this point in the history
…o data is returned, ensuring a default response of remainingUnBondPeriod as 0. (#1427)
  • Loading branch information
cfaur09 authored Dec 20, 2024
1 parent c051521 commit 8135bf8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/endpoints/keys/keys.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 8135bf8

Please sign in to comment.