Skip to content

Commit

Permalink
Fix chain id typescript error (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
codingki authored Nov 20, 2024
1 parent c67255b commit cc8c27a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-spiders-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@skip-go/widget': patch
---

fix chainId typescript error
5 changes: 3 additions & 2 deletions packages/widget/src/hooks/useCW20Balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ export const useCW20Balance = ({
}) => {
const skipClientConfig = useAtomValue(skipClientConfigAtom)
const query = useQuery({
queryKey: ["cw20Balance", { denom: asset?.denom, address }],
queryKey: ["cw20Balance", { denom: asset?.denom, address, chainID: asset?.chainID }],
queryFn: async () => {
if (!asset?.chainID) throw new Error("Chain ID not found");
const rpcURL = await skipClientConfig.endpointOptions?.getRpcEndpointForChain?.(asset?.chainID) || getChainInfo({
chainId: asset?.chainID,
})?.rpc
Expand All @@ -28,7 +29,7 @@ export const useCW20Balance = ({
if (!asset) throw new Error("Asset not found");
return getCosmosCW20Balance(rpcURL, address, asset);
},
enabled: !!address && !!asset?.tokenContract && !!asset?.isCW20,
enabled: !!address && !!asset?.tokenContract && !!asset?.isCW20 && !!asset?.chainID,
})
return query;
}
Expand Down

0 comments on commit cc8c27a

Please sign in to comment.