Skip to content

Commit 06afae3

Browse files
committed
fix: add test chains support
1 parent 2f0a747 commit 06afae3

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/constants/chains.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
import {
2+
type Chain,
23
arbitrum,
4+
arbitrumSepolia,
35
avalanche,
46
base,
7+
baseSepolia,
58
blast,
69
bsc,
710
celo,
811
mainnet,
912
optimism,
1013
polygon,
14+
sepolia,
15+
unichain,
16+
unichainSepolia,
1117
worldchain,
1218
zksync,
1319
zora,
1420
} from "wagmi/chains";
15-
// uniswap supported chains
16-
/*
17-
Ethereum
18-
Arbitrum
19-
Optimism
20-
Polygon
21-
Base
22-
BNB
23-
Avalanche C-Chain
24-
CELO
25-
Blast
26-
ZKsync
27-
Zora
28-
WorldChain
29-
*/
3021

3122
export const supportedChains = [
3223
arbitrum,
@@ -40,11 +31,21 @@ export const supportedChains = [
4031
zksync,
4132
zora,
4233
worldchain,
34+
unichain,
4335
mainnet,
4436
] as const;
4537

46-
export const getChainById = (chainId: number) => {
47-
const chain = supportedChains.find((chain) => chain.id === chainId);
38+
export const testChains = [
39+
unichainSepolia,
40+
sepolia,
41+
baseSepolia,
42+
arbitrumSepolia,
43+
] as const;
44+
45+
export const getChainById = (chainId: number): Chain => {
46+
const chain = [...supportedChains, ...testChains].find(
47+
(chain) => chain.id === chainId,
48+
);
4849
if (!chain) {
4950
throw new Error(`Chain with id ${chainId} not found`);
5051
}

0 commit comments

Comments
 (0)