From 036781d4c012efb41acd58c8e7d8f1c4d554437b Mon Sep 17 00:00:00 2001 From: Ryan Conceicao Date: Wed, 20 Dec 2023 12:34:20 +0800 Subject: [PATCH] fix: coingecko id empty string (#30) Keplr throws error `Error: "currencies[n]" does not match any of the allowed types` when using chain info with currencies that have `coinGeckoId: ""` instead of `undefined` such as [Sei asset in chain registry](https://github.com/cosmos/chain-registry/blob/master/sei/assetlist.json#L53) --- src/registry/keplr/toKeplrChainInfo.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registry/keplr/toKeplrChainInfo.ts b/src/registry/keplr/toKeplrChainInfo.ts index e0bd276b..e9371ac2 100644 --- a/src/registry/keplr/toKeplrChainInfo.ts +++ b/src/registry/keplr/toKeplrChainInfo.ts @@ -55,7 +55,7 @@ export function toKeplrChainInfo( coinDecimals: asset.denom_units.find( (denomUnit: { denom: string }) => denomUnit.denom === asset.display )?.exponent ?? 6, - coinGeckoId: asset.coingecko_id, + coinGeckoId: asset.coingecko_id === "" ? undefined : asset.coingecko_id, coinImageUrl: asset.logo_URIs?.svg ?? asset.logo_URIs?.png, }));