Skip to content

Commit 70a54d9

Browse files
committed
attached: filter EVM chains with invalid native currency symbol
1 parent 6306354 commit 70a54d9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

embed/oko_attached/src/window_msgs/get_eth_chain_info.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ export async function handleGetEthChain(
2727
const chainId = message.payload.chain_id;
2828

2929
const allChains = await getAllChainsCached();
30-
const chainInfos = filterEthChains(allChains);
30+
// SDK's OkoEIP1193Provider rejects the entire provider construction if any
31+
// chain's native currency symbol is outside 1-8 chars. Drop registry
32+
// entries that would trip that validator so a single bad chain doesn't
33+
// block the whole EVM provider.
34+
const chainInfos = filterEthChains(allChains).filter((c) => {
35+
const symbol = c.currencies[0]?.coinDenom;
36+
return symbol !== undefined && symbol.length >= 1 && symbol.length <= 8;
37+
});
3138

3239
let resultChains: ChainInfo[] = [];
3340

0 commit comments

Comments
 (0)