From 967dad7c17a9b042b6f6ae5de9b726b8587c1a26 Mon Sep 17 00:00:00 2001 From: C H Date: Thu, 11 Jul 2024 11:01:29 +0800 Subject: [PATCH 1/4] Added fix for undefined display exponent --- context/ChainsContext/helpers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context/ChainsContext/helpers.tsx b/context/ChainsContext/helpers.tsx index 0ac88bd..b563a2f 100644 --- a/context/ChainsContext/helpers.tsx +++ b/context/ChainsContext/helpers.tsx @@ -26,7 +26,7 @@ export const isChainInfoFilled = (chain: Partial): chain is ChainInfo chain.nodeAddresses?.length && chain.denom && chain.displayDenom && - chain.displayDenomExponent && + chain.displayDenomExponent !== undefined && chain.displayDenomExponent >= 0 && chain.assets?.length && chain.gasPrice && From 57b370f8463facdae0eb1a0a1b70921971883de0 Mon Sep 17 00:00:00 2001 From: abefernan <44572727+abefernan@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:28:03 +0200 Subject: [PATCH 2/4] Use isSafeInteger --- context/ChainsContext/helpers.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/context/ChainsContext/helpers.tsx b/context/ChainsContext/helpers.tsx index b563a2f..2b3cf79 100644 --- a/context/ChainsContext/helpers.tsx +++ b/context/ChainsContext/helpers.tsx @@ -26,8 +26,7 @@ export const isChainInfoFilled = (chain: Partial): chain is ChainInfo chain.nodeAddresses?.length && chain.denom && chain.displayDenom && - chain.displayDenomExponent !== undefined && - chain.displayDenomExponent >= 0 && + Number.isSafeInteger(chain.displayDenomExponent) && chain.assets?.length && chain.gasPrice && chain.addressPrefix, From 2fa20005c7a0addcf550be8d448686541ff6179a Mon Sep 17 00:00:00 2001 From: abefernan <44572727+abefernan@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:50:47 +0200 Subject: [PATCH 3/4] Add previous checks --- context/ChainsContext/helpers.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/context/ChainsContext/helpers.tsx b/context/ChainsContext/helpers.tsx index 2b3cf79..e4cb172 100644 --- a/context/ChainsContext/helpers.tsx +++ b/context/ChainsContext/helpers.tsx @@ -27,6 +27,8 @@ export const isChainInfoFilled = (chain: Partial): chain is ChainInfo chain.denom && chain.displayDenom && Number.isSafeInteger(chain.displayDenomExponent) && + chain.displayDenomExponent && // Check not needed but narrows next line's type + chain.displayDenomExponent >= 0 && chain.assets?.length && chain.gasPrice && chain.addressPrefix, From 1e4dcfab2e290afe4d7f49f27d3cb099a40f5b0d Mon Sep 17 00:00:00 2001 From: abefernan <44572727+abefernan@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:54:54 +0200 Subject: [PATCH 4/4] Check number enabling 0 --- context/ChainsContext/helpers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context/ChainsContext/helpers.tsx b/context/ChainsContext/helpers.tsx index e4cb172..a679714 100644 --- a/context/ChainsContext/helpers.tsx +++ b/context/ChainsContext/helpers.tsx @@ -27,7 +27,7 @@ export const isChainInfoFilled = (chain: Partial): chain is ChainInfo chain.denom && chain.displayDenom && Number.isSafeInteger(chain.displayDenomExponent) && - chain.displayDenomExponent && // Check not needed but narrows next line's type + typeof chain.displayDenomExponent === "number" && chain.displayDenomExponent >= 0 && chain.assets?.length && chain.gasPrice &&