From 25703a49474ac7e2237d4e97ffce0cfebdae5962 Mon Sep 17 00:00:00 2001 From: Ryan Conceicao Date: Wed, 22 Nov 2023 12:27:31 +0800 Subject: [PATCH] fix: toKeplrChainInfo undefined currency decimals (#26) Potentially might be not found if assetlist has issues. I think having it default to `6` would be better as its more common than `0` --- src/registry/keplr/toKeplrChainInfo.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/registry/keplr/toKeplrChainInfo.ts b/src/registry/keplr/toKeplrChainInfo.ts index a372afbd..e0bd276b 100644 --- a/src/registry/keplr/toKeplrChainInfo.ts +++ b/src/registry/keplr/toKeplrChainInfo.ts @@ -52,9 +52,9 @@ export function toKeplrChainInfo( const currencies: Currency[] = chainRegistryAssetList.assets.map((asset) => ({ coinDenom: asset.symbol, coinMinimalDenom: asset.base, - coinDecimals: asset.denom_units.filter( + coinDecimals: asset.denom_units.find( (denomUnit: { denom: string }) => denomUnit.denom === asset.display - )[0]?.exponent, + )?.exponent ?? 6, coinGeckoId: asset.coingecko_id, coinImageUrl: asset.logo_URIs?.svg ?? asset.logo_URIs?.png, }));