Skip to content

Commit a702f4c

Browse files
committed
chore(api-reference) Add Chain Override file
1 parent d10790d commit a702f4c

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { defineChain } from "viem";
2+
import type { Chain } from "viem";
3+
4+
/**
5+
* Chain overrides for chains that are not available in viem's built-in chain list.
6+
* These chains will take priority over viem's built-in chains when matching by chain ID.
7+
*
8+
* To add a new chain override:
9+
* 1. Find the chain ID from EvmChains.json
10+
* 2. Add a new defineChain entry with the following required fields:
11+
* - id: chainId. id in EvmChains.json is the name
12+
* - name: Chain display name
13+
* - nativeCurrency: { name, symbol, decimals }
14+
* - rpcUrls: { default: { http: ['...'] } }
15+
* - testnet: true/false (optional, defaults to false for mainnet)
16+
* - blockExplorers: { default: { name, url } } (optional)
17+
*/
18+
export const chainOverrides: readonly Chain[] = [
19+
// Example chain override (remove or replace with actual chains):
20+
// defineChain({
21+
// id: 7701,
22+
// name: 'Custom Chain Name',
23+
// nativeCurrency: {
24+
// name: 'Custom Token',
25+
// symbol: 'CTK',
26+
// decimals: 18,
27+
// },
28+
// rpcUrls: {
29+
// default: { http: ['https://rpc.example.com'] },
30+
// },
31+
// testnet: false,
32+
// blockExplorers: {
33+
// default: {
34+
// name: 'Custom Explorer',
35+
// url: 'https://explorer.example.com',
36+
// },
37+
// },
38+
// }),
39+
defineChain({
40+
id: 999,
41+
name: "Hyperliquid",
42+
nativeCurrency: {
43+
name: "Hyper",
44+
symbol: "HYPE",
45+
decimals: 18,
46+
},
47+
rpcUrls: {
48+
default: { http: ["https://rpc.hyperliquid.xyz/evm"] },
49+
},
50+
testnet: false,
51+
blockExplorers: {
52+
default: {
53+
name: "Hyperliquid",
54+
url: "https://hyperevmscan.io/",
55+
},
56+
},
57+
}),
58+
defineChain({
59+
id: 964,
60+
name: "Bittensor",
61+
nativeCurrency: {
62+
name: "TAO",
63+
symbol: "TAO",
64+
decimals: 18,
65+
},
66+
rpcUrls: {
67+
default: { http: ["https://bittensor-finney.api.onfinality.io/public"] },
68+
},
69+
testnet: false,
70+
blockExplorers: {
71+
default: {
72+
name: "Bittensor",
73+
url: "https://evm.taostats.io/",
74+
},
75+
},
76+
}),
77+
];
78+

0 commit comments

Comments
 (0)