From ba39dbe4997c2a1e3c2372b6d9fefced23bf5d35 Mon Sep 17 00:00:00 2001 From: adairrr <32375605+adairrr@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:26:34 -0500 Subject: [PATCH] Fix hostChainNameToName --- .changeset/hip-turtles-sin.md | 5 +++++ .../core/src/utils/chain-registry/host-chain-name-to-name.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/hip-turtles-sin.md diff --git a/.changeset/hip-turtles-sin.md b/.changeset/hip-turtles-sin.md new file mode 100644 index 00000000..80af7a1f --- /dev/null +++ b/.changeset/hip-turtles-sin.md @@ -0,0 +1,5 @@ +--- +"@abstract-money/core": patch +--- + +Ensure that hostChainNameToName doesn't throw diff --git a/packages/core/src/utils/chain-registry/host-chain-name-to-name.ts b/packages/core/src/utils/chain-registry/host-chain-name-to-name.ts index 1be09e13..6aefa417 100644 --- a/packages/core/src/utils/chain-registry/host-chain-name-to-name.ts +++ b/packages/core/src/utils/chain-registry/host-chain-name-to-name.ts @@ -4,7 +4,7 @@ export function hostChainNameToName(hostChainName: string) { const chainName = chains.find( ({ chain_name, chain_id }) => chain_name === hostChainName || - chainIdToHostChainName(chain_id) === hostChainName, + (chain_id && chainIdToHostChainName(chain_id) === hostChainName), )?.chain_name if (!chainName) { throw new Error(`Chain not found by hostChain: ${hostChainName}`)