-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbrowserChains.ts
More file actions
71 lines (64 loc) · 2.34 KB
/
Copy pathbrowserChains.ts
File metadata and controls
71 lines (64 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import type { EvmNetwork } from "@dynamic-labs/sdk-react-core";
import { defineChain } from "viem";
export const BROWSER_CHAIN_IDS = {
celo: 42220,
base: 8453,
robinhood: 4663,
} as const;
export type BrowserChainId = (typeof BROWSER_CHAIN_IDS)[keyof typeof BROWSER_CHAIN_IDS];
export const robinhoodChain = defineChain({
id: BROWSER_CHAIN_IDS.robinhood,
name: "Robinhood Chain",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: {
default: { http: [process.env.NEXT_PUBLIC_ROBINHOOD_RPC_URL || "https://rpc.mainnet.chain.robinhood.com"] },
},
blockExplorers: {
default: { name: "Robinhood Chain Explorer", url: "https://robinhoodchain.blockscout.com" },
},
});
export const BROWSER_CHAIN_OPTIONS: ReadonlyArray<{
id: BrowserChainId;
label: string;
shortLabel: string;
}> = [
{ id: BROWSER_CHAIN_IDS.celo, label: "Celo", shortLabel: "Celo" },
{ id: BROWSER_CHAIN_IDS.base, label: "Base", shortLabel: "Base" },
{ id: BROWSER_CHAIN_IDS.robinhood, label: "Robinhood Chain", shortLabel: "RHC" },
];
export function isBrowserChainId(value: unknown): value is BrowserChainId {
return typeof value === "number" && BROWSER_CHAIN_OPTIONS.some((chain) => chain.id === value);
}
const nativeEth = { name: "Ether", symbol: "ETH", decimals: 18 };
export const DYNAMIC_BROWSER_NETWORKS: EvmNetwork[] = [
{
chainId: BROWSER_CHAIN_IDS.celo,
networkId: BROWSER_CHAIN_IDS.celo,
name: "Celo",
vanityName: "Celo",
nativeCurrency: { name: "CELO", symbol: "CELO", decimals: 18 },
rpcUrls: [process.env.NEXT_PUBLIC_CELO_RPC_URL || "https://forno.celo.org"],
blockExplorerUrls: ["https://celoscan.io"],
iconUrls: [],
},
{
chainId: BROWSER_CHAIN_IDS.base,
networkId: BROWSER_CHAIN_IDS.base,
name: "Base",
vanityName: "Base",
nativeCurrency: nativeEth,
rpcUrls: [process.env.NEXT_PUBLIC_BASE_RPC_URL || "https://mainnet.base.org"],
blockExplorerUrls: ["https://base.blockscout.com"],
iconUrls: [],
},
{
chainId: BROWSER_CHAIN_IDS.robinhood,
networkId: BROWSER_CHAIN_IDS.robinhood,
name: "Robinhood Chain",
vanityName: "Robinhood Chain",
nativeCurrency: nativeEth,
rpcUrls: [process.env.NEXT_PUBLIC_ROBINHOOD_RPC_URL || "https://rpc.mainnet.chain.robinhood.com"],
blockExplorerUrls: ["https://robinhoodchain.blockscout.com"],
iconUrls: [],
},
];