Skip to content

Commit 25703a4

Browse files
authored
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`
1 parent 35e5ac1 commit 25703a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/registry/keplr/toKeplrChainInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ export function toKeplrChainInfo(
5252
const currencies: Currency[] = chainRegistryAssetList.assets.map((asset) => ({
5353
coinDenom: asset.symbol,
5454
coinMinimalDenom: asset.base,
55-
coinDecimals: asset.denom_units.filter(
55+
coinDecimals: asset.denom_units.find(
5656
(denomUnit: { denom: string }) => denomUnit.denom === asset.display
57-
)[0]?.exponent,
57+
)?.exponent ?? 6,
5858
coinGeckoId: asset.coingecko_id,
5959
coinImageUrl: asset.logo_URIs?.svg ?? asset.logo_URIs?.png,
6060
}));

0 commit comments

Comments
 (0)