From 21e2c148c03040219ec5659efe5541ce016367ed Mon Sep 17 00:00:00 2001 From: Adam A Date: Mon, 22 Jul 2024 20:15:26 +0300 Subject: [PATCH] fix(namada): epoch: handle option bit --- packages/namada/NamadaEpoch.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/namada/NamadaEpoch.ts b/packages/namada/NamadaEpoch.ts index 68d6b39983..36aba87258 100644 --- a/packages/namada/NamadaEpoch.ts +++ b/packages/namada/NamadaEpoch.ts @@ -7,7 +7,8 @@ export async function fetchEpoch ( height?: number|bigint ) { if (height !== undefined) { - return decode(u64, await connection.abciQuery(`/shell/epoch_at_height/${height}`)) + const binary = await connection.abciQuery(`/shell/epoch_at_height/${height}`) + return binary[0] ? decode(u64, binary.slice(1)) : null } else { return decode(u64, await connection.abciQuery("/shell/epoch")) }