Skip to content

Commit 0dadcc7

Browse files
committed
fix: normalize chain id and drop empty ethereum node urls
1 parent b362bb0 commit 0dadcc7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

utils/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ export function getConfig(id?: string) {
77
const { walletConnectProjectId, ethereumNodes } = useAppStore.getState()
88
const projectId = id || walletConnectProjectId
99

10-
const urlsByChain = new Map(ethereumNodes.map((node) => [node.chainId, node.urls]))
10+
const urlsByChain = new Map(ethereumNodes.map((node) => [Number(node.chainId), node.urls]))
1111

1212
// Prefer the backend-served public RPC nodes; fall back to viem's defaults
1313
// when the backend has no nodes for a chain (or the list could not be fetched).
1414
const transportFor = (chainId: number) => {
15-
const urls = urlsByChain.get(chainId)
15+
const urls = urlsByChain.get(chainId)?.filter((url) => url.trim() !== '')
1616
return urls?.length ? fallback(urls.map((url) => http(url))) : http()
1717
}
1818

0 commit comments

Comments
 (0)