Skip to content

Commit 2262723

Browse files
authoredDec 10, 2024
Merge pull request #949 from n00b21337/947-add_other_EVMs
947 add other evm chains to wallet
2 parents e8ec603 + 6bfacd1 commit 2262723

File tree

7 files changed

+464
-80
lines changed

7 files changed

+464
-80
lines changed
 

‎packages/plugin-evm/src/actions/bridge.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
ExtendedChain,
77
getRoutes,
88
} from "@lifi/sdk";
9-
import { getChainConfigs, WalletProvider } from "../providers/wallet";
9+
import { WalletProvider } from "../providers/wallet";
10+
import { getChainConfigs } from "../providers/chainConfigs";
1011
import { bridgeTemplate } from "../templates";
1112
import type { BridgeParams, Transaction } from "../types";
1213

‎packages/plugin-evm/src/actions/swap.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
ExtendedChain,
77
getRoutes,
88
} from "@lifi/sdk";
9-
import { getChainConfigs, WalletProvider } from "../providers/wallet";
9+
import { WalletProvider } from "../providers/wallet";
10+
import { getChainConfigs } from "../providers/chainConfigs";
1011
import { swapTemplate } from "../templates";
1112
import type { SwapParams, Transaction } from "../types";
1213

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,339 @@
1+
import {
2+
mainnet,
3+
base,
4+
sepolia,
5+
bsc,
6+
arbitrum,
7+
avalanche,
8+
polygon,
9+
optimism,
10+
cronos,
11+
gnosis,
12+
fantom,
13+
klaytn,
14+
celo,
15+
moonbeam,
16+
aurora,
17+
harmonyOne,
18+
moonriver,
19+
arbitrumNova,
20+
mantle,
21+
linea,
22+
scroll,
23+
filecoin,
24+
taiko,
25+
zksync,
26+
canto,
27+
} from "viem/chains";
28+
import type { ChainMetadata, SupportedChain } from "../types";
29+
import type { IAgentRuntime } from "@ai16z/eliza";
30+
31+
export const DEFAULT_CHAIN_CONFIGS: Record<SupportedChain, ChainMetadata> = {
32+
ethereum: {
33+
chainId: 1,
34+
name: "Ethereum",
35+
chain: mainnet,
36+
rpcUrl: "https://eth.llamarpc.com",
37+
nativeCurrency: {
38+
name: "Ether",
39+
symbol: "ETH",
40+
decimals: 18,
41+
},
42+
blockExplorerUrl: "https://etherscan.io",
43+
},
44+
base: {
45+
chainId: 8453,
46+
name: "Base",
47+
chain: base,
48+
rpcUrl: "https://base.llamarpc.com",
49+
nativeCurrency: {
50+
name: "Ether",
51+
symbol: "ETH",
52+
decimals: 18,
53+
},
54+
blockExplorerUrl: "https://basescan.org",
55+
},
56+
sepolia: {
57+
chainId: 11155111,
58+
name: "Sepolia",
59+
chain: sepolia,
60+
rpcUrl: "https://rpc.sepolia.org",
61+
nativeCurrency: {
62+
name: "Sepolia Ether",
63+
symbol: "ETH",
64+
decimals: 18,
65+
},
66+
blockExplorerUrl: "https://sepolia.etherscan.io",
67+
},
68+
bsc: {
69+
chainId: 56,
70+
name: "BNB Smart Chain",
71+
chain: bsc,
72+
rpcUrl: "https://bsc-dataseed1.binance.org/",
73+
nativeCurrency: {
74+
name: "Binance Coin",
75+
symbol: "BNB",
76+
decimals: 18,
77+
},
78+
blockExplorerUrl: "https://bscscan.com",
79+
},
80+
arbitrum: {
81+
chainId: 42161,
82+
name: "Arbitrum One",
83+
chain: arbitrum,
84+
rpcUrl: "https://arb1.arbitrum.io/rpc",
85+
nativeCurrency: {
86+
name: "Ether",
87+
symbol: "ETH",
88+
decimals: 18,
89+
},
90+
blockExplorerUrl: "https://arbiscan.io",
91+
},
92+
avalanche: {
93+
chainId: 43114,
94+
name: "Avalanche C-Chain",
95+
chain: avalanche,
96+
rpcUrl: "https://api.avax.network/ext/bc/C/rpc",
97+
nativeCurrency: {
98+
name: "Avalanche",
99+
symbol: "AVAX",
100+
decimals: 18,
101+
},
102+
blockExplorerUrl: "https://snowtrace.io",
103+
},
104+
polygon: {
105+
chainId: 137,
106+
name: "Polygon",
107+
chain: polygon,
108+
rpcUrl: "https://polygon-rpc.com",
109+
nativeCurrency: {
110+
name: "MATIC",
111+
symbol: "MATIC",
112+
decimals: 18,
113+
},
114+
blockExplorerUrl: "https://polygonscan.com",
115+
},
116+
optimism: {
117+
chainId: 10,
118+
name: "Optimism",
119+
chain: optimism,
120+
rpcUrl: "https://mainnet.optimism.io",
121+
nativeCurrency: {
122+
name: "Ether",
123+
symbol: "ETH",
124+
decimals: 18,
125+
},
126+
blockExplorerUrl: "https://optimistic.etherscan.io",
127+
},
128+
cronos: {
129+
chainId: 25,
130+
name: "Cronos",
131+
chain: cronos,
132+
rpcUrl: "https://evm.cronos.org",
133+
nativeCurrency: {
134+
name: "Cronos",
135+
symbol: "CRO",
136+
decimals: 18,
137+
},
138+
blockExplorerUrl: "https://cronoscan.com",
139+
},
140+
gnosis: {
141+
chainId: 100,
142+
name: "Gnosis",
143+
chain: gnosis,
144+
rpcUrl: "https://rpc.gnosischain.com",
145+
nativeCurrency: {
146+
name: "xDAI",
147+
symbol: "XDAI",
148+
decimals: 18,
149+
},
150+
blockExplorerUrl: "https://gnosisscan.io",
151+
},
152+
fantom: {
153+
chainId: 250,
154+
name: "Fantom",
155+
chain: fantom,
156+
rpcUrl: "https://rpc.ftm.tools",
157+
nativeCurrency: {
158+
name: "Fantom",
159+
symbol: "FTM",
160+
decimals: 18,
161+
},
162+
blockExplorerUrl: "https://ftmscan.com",
163+
},
164+
klaytn: {
165+
chainId: 8217,
166+
name: "Klaytn",
167+
chain: klaytn,
168+
rpcUrl: "https://public-node-api.klaytnapi.com/v1/cypress",
169+
nativeCurrency: {
170+
name: "KLAY",
171+
symbol: "KLAY",
172+
decimals: 18,
173+
},
174+
blockExplorerUrl: "https://scope.klaytn.com",
175+
},
176+
celo: {
177+
chainId: 42220,
178+
name: "Celo",
179+
chain: celo,
180+
rpcUrl: "https://forno.celo.org",
181+
nativeCurrency: {
182+
name: "Celo",
183+
symbol: "CELO",
184+
decimals: 18,
185+
},
186+
blockExplorerUrl: "https://celoscan.io",
187+
},
188+
moonbeam: {
189+
chainId: 1284,
190+
name: "Moonbeam",
191+
chain: moonbeam,
192+
rpcUrl: "https://rpc.api.moonbeam.network",
193+
nativeCurrency: {
194+
name: "Glimmer",
195+
symbol: "GLMR",
196+
decimals: 18,
197+
},
198+
blockExplorerUrl: "https://moonscan.io",
199+
},
200+
aurora: {
201+
chainId: 1313161554,
202+
name: "Aurora",
203+
chain: aurora,
204+
rpcUrl: "https://mainnet.aurora.dev",
205+
nativeCurrency: {
206+
name: "Ether",
207+
symbol: "ETH",
208+
decimals: 18,
209+
},
210+
blockExplorerUrl: "https://aurorascan.dev",
211+
},
212+
harmonyOne: {
213+
chainId: 1666600000,
214+
name: "harmonyOne",
215+
chain: harmonyOne,
216+
rpcUrl: "https://api.harmonyOne.one",
217+
nativeCurrency: {
218+
name: "ONE",
219+
symbol: "ONE",
220+
decimals: 18,
221+
},
222+
blockExplorerUrl: "https://explorer.harmonyOne.one",
223+
},
224+
moonriver: {
225+
chainId: 1285,
226+
name: "Moonriver",
227+
chain: moonriver,
228+
rpcUrl: "https://rpc.api.moonriver.moonbeam.network",
229+
nativeCurrency: {
230+
name: "Moonriver",
231+
symbol: "MOVR",
232+
decimals: 18,
233+
},
234+
blockExplorerUrl: "https://moonriver.moonscan.io",
235+
},
236+
arbitrumNova: {
237+
chainId: 42170,
238+
name: "Arbitrum Nova",
239+
chain: arbitrumNova,
240+
rpcUrl: "https://nova.arbitrum.io/rpc",
241+
nativeCurrency: {
242+
name: "Ether",
243+
symbol: "ETH",
244+
decimals: 18,
245+
},
246+
blockExplorerUrl: "https://nova-explorer.arbitrum.io",
247+
},
248+
mantle: {
249+
chainId: 5000,
250+
name: "Mantle",
251+
chain: mantle,
252+
rpcUrl: "https://rpc.mantle.xyz",
253+
nativeCurrency: {
254+
name: "Mantle",
255+
symbol: "MNT",
256+
decimals: 18,
257+
},
258+
blockExplorerUrl: "https://explorer.mantle.xyz",
259+
},
260+
linea: {
261+
chainId: 59144,
262+
name: "Linea",
263+
chain: linea,
264+
rpcUrl: "https://linea-mainnet.rpc.build",
265+
nativeCurrency: {
266+
name: "Ether",
267+
symbol: "ETH",
268+
decimals: 18,
269+
},
270+
blockExplorerUrl: "https://lineascan.build",
271+
},
272+
scroll: {
273+
chainId: 534353,
274+
name: "Scroll Alpha Testnet",
275+
chain: scroll,
276+
rpcUrl: "https://alpha-rpc.scroll.io/l2",
277+
nativeCurrency: {
278+
name: "Ether",
279+
symbol: "ETH",
280+
decimals: 18,
281+
},
282+
blockExplorerUrl: "https://blockscout.scroll.io",
283+
},
284+
filecoin: {
285+
chainId: 314,
286+
name: "Filecoin",
287+
chain: filecoin,
288+
rpcUrl: "https://api.node.glif.io/rpc/v1",
289+
nativeCurrency: {
290+
name: "Filecoin",
291+
symbol: "FIL",
292+
decimals: 18,
293+
},
294+
blockExplorerUrl: "https://filfox.info/en",
295+
},
296+
taiko: {
297+
chainId: 167005,
298+
name: "Taiko (Alpha-3) Testnet",
299+
chain: taiko,
300+
rpcUrl: "https://rpc.a3.taiko.xyz",
301+
nativeCurrency: {
302+
name: "Ether",
303+
symbol: "ETH",
304+
decimals: 18,
305+
},
306+
blockExplorerUrl: "https://explorer.a3.taiko.xyz",
307+
},
308+
zksync: {
309+
chainId: 324,
310+
name: "zksync Era",
311+
chain: zksync,
312+
rpcUrl: "https://mainnet.era.zksync.io",
313+
nativeCurrency: {
314+
name: "Ether",
315+
symbol: "ETH",
316+
decimals: 18,
317+
},
318+
blockExplorerUrl: "https://explorer.zksync.io",
319+
},
320+
canto: {
321+
chainId: 7700,
322+
name: "Canto",
323+
chain: canto,
324+
rpcUrl: "https://canto.slingshot.finance",
325+
nativeCurrency: {
326+
name: "CANTO",
327+
symbol: "CANTO",
328+
decimals: 18,
329+
},
330+
blockExplorerUrl: "https://tuber.build",
331+
},
332+
} as const;
333+
334+
export const getChainConfigs = (runtime: IAgentRuntime) => {
335+
return (
336+
(runtime.character.settings.chains?.evm as ChainMetadata[]) ||
337+
DEFAULT_CHAIN_CONFIGS
338+
);
339+
};

0 commit comments

Comments
 (0)
Please sign in to comment.