@codkit/config 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +70 -2
- package/dist/chunk-N3OT5BNF.cjs +655 -0
- package/dist/chunk-N3OT5BNF.cjs.map +1 -0
- package/dist/chunk-ZRZNU5KJ.js +655 -0
- package/dist/chunk-ZRZNU5KJ.js.map +1 -0
- package/dist/index.cjs +76 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +41 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/rpc-DaYsu4c7.d.cts +669 -0
- package/dist/rpc-DaYsu4c7.d.ts +669 -0
- package/dist/viem.cjs +30 -0
- package/dist/viem.cjs.map +1 -0
- package/dist/viem.d.cts +20 -0
- package/dist/viem.d.ts +20 -0
- package/dist/viem.js +30 -0
- package/dist/viem.js.map +1 -0
- package/package.json +73 -4
- package/src/chains.ts +160 -0
- package/src/env.ts +59 -0
- package/src/evm-chains.ts +438 -0
- package/src/explorer.ts +13 -0
- package/src/index.ts +5 -0
- package/src/rpc.ts +111 -0
- package/src/types.ts +42 -0
- package/src/viem.ts +33 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
// src/evm-chains.ts
|
|
2
|
+
var evmChains = [
|
|
3
|
+
{
|
|
4
|
+
key: "ethereum",
|
|
5
|
+
id: "eip155:1",
|
|
6
|
+
ecosystem: "evm",
|
|
7
|
+
name: "Ethereum",
|
|
8
|
+
testnet: false,
|
|
9
|
+
chainId: 1,
|
|
10
|
+
nativeCurrency: {
|
|
11
|
+
name: "Ether",
|
|
12
|
+
symbol: "ETH",
|
|
13
|
+
decimals: 18
|
|
14
|
+
},
|
|
15
|
+
rpcUrls: ["https://ethereum.reth.rs/rpc"],
|
|
16
|
+
explorer: {
|
|
17
|
+
name: "Etherscan",
|
|
18
|
+
url: "https://etherscan.io"
|
|
19
|
+
},
|
|
20
|
+
providers: {
|
|
21
|
+
alchemy: "eth-mainnet"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
key: "sepolia",
|
|
26
|
+
id: "eip155:11155111",
|
|
27
|
+
ecosystem: "evm",
|
|
28
|
+
name: "Sepolia",
|
|
29
|
+
testnet: true,
|
|
30
|
+
chainId: 11155111,
|
|
31
|
+
nativeCurrency: {
|
|
32
|
+
name: "Sepolia Ether",
|
|
33
|
+
symbol: "ETH",
|
|
34
|
+
decimals: 18
|
|
35
|
+
},
|
|
36
|
+
rpcUrls: ["https://11155111.rpc.thirdweb.com"],
|
|
37
|
+
explorer: {
|
|
38
|
+
name: "Etherscan",
|
|
39
|
+
url: "https://sepolia.etherscan.io"
|
|
40
|
+
},
|
|
41
|
+
providers: {
|
|
42
|
+
alchemy: "eth-sepolia"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: "base",
|
|
47
|
+
id: "eip155:8453",
|
|
48
|
+
ecosystem: "evm",
|
|
49
|
+
name: "Base",
|
|
50
|
+
testnet: false,
|
|
51
|
+
chainId: 8453,
|
|
52
|
+
nativeCurrency: {
|
|
53
|
+
name: "Ether",
|
|
54
|
+
symbol: "ETH",
|
|
55
|
+
decimals: 18
|
|
56
|
+
},
|
|
57
|
+
rpcUrls: ["https://mainnet.base.org"],
|
|
58
|
+
explorer: {
|
|
59
|
+
name: "Basescan",
|
|
60
|
+
url: "https://basescan.org"
|
|
61
|
+
},
|
|
62
|
+
providers: {
|
|
63
|
+
alchemy: "base-mainnet"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: "base-sepolia",
|
|
68
|
+
id: "eip155:84532",
|
|
69
|
+
ecosystem: "evm",
|
|
70
|
+
name: "Base Sepolia",
|
|
71
|
+
testnet: true,
|
|
72
|
+
chainId: 84532,
|
|
73
|
+
nativeCurrency: {
|
|
74
|
+
name: "Sepolia Ether",
|
|
75
|
+
symbol: "ETH",
|
|
76
|
+
decimals: 18
|
|
77
|
+
},
|
|
78
|
+
rpcUrls: ["https://sepolia.base.org"],
|
|
79
|
+
explorer: {
|
|
80
|
+
name: "Basescan",
|
|
81
|
+
url: "https://sepolia.basescan.org"
|
|
82
|
+
},
|
|
83
|
+
providers: {
|
|
84
|
+
alchemy: "base-sepolia"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: "optimism",
|
|
89
|
+
id: "eip155:10",
|
|
90
|
+
ecosystem: "evm",
|
|
91
|
+
name: "OP Mainnet",
|
|
92
|
+
testnet: false,
|
|
93
|
+
chainId: 10,
|
|
94
|
+
nativeCurrency: {
|
|
95
|
+
name: "Ether",
|
|
96
|
+
symbol: "ETH",
|
|
97
|
+
decimals: 18
|
|
98
|
+
},
|
|
99
|
+
rpcUrls: ["https://mainnet.optimism.io"],
|
|
100
|
+
explorer: {
|
|
101
|
+
name: "Optimism Explorer",
|
|
102
|
+
url: "https://optimistic.etherscan.io"
|
|
103
|
+
},
|
|
104
|
+
providers: {
|
|
105
|
+
alchemy: "opt-mainnet"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: "optimism-sepolia",
|
|
110
|
+
id: "eip155:11155420",
|
|
111
|
+
ecosystem: "evm",
|
|
112
|
+
name: "OP Sepolia",
|
|
113
|
+
testnet: true,
|
|
114
|
+
chainId: 11155420,
|
|
115
|
+
nativeCurrency: {
|
|
116
|
+
name: "Sepolia Ether",
|
|
117
|
+
symbol: "ETH",
|
|
118
|
+
decimals: 18
|
|
119
|
+
},
|
|
120
|
+
rpcUrls: ["https://sepolia.optimism.io"],
|
|
121
|
+
explorer: {
|
|
122
|
+
name: "Blockscout",
|
|
123
|
+
url: "https://optimism-sepolia.blockscout.com"
|
|
124
|
+
},
|
|
125
|
+
providers: {
|
|
126
|
+
alchemy: "opt-sepolia"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
key: "arbitrum",
|
|
131
|
+
id: "eip155:42161",
|
|
132
|
+
ecosystem: "evm",
|
|
133
|
+
name: "Arbitrum One",
|
|
134
|
+
testnet: false,
|
|
135
|
+
chainId: 42161,
|
|
136
|
+
nativeCurrency: {
|
|
137
|
+
name: "Ether",
|
|
138
|
+
symbol: "ETH",
|
|
139
|
+
decimals: 18
|
|
140
|
+
},
|
|
141
|
+
rpcUrls: ["https://arb1.arbitrum.io/rpc"],
|
|
142
|
+
explorer: {
|
|
143
|
+
name: "Arbiscan",
|
|
144
|
+
url: "https://arbiscan.io"
|
|
145
|
+
},
|
|
146
|
+
providers: {
|
|
147
|
+
alchemy: "arb-mainnet"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
key: "arbitrum-sepolia",
|
|
152
|
+
id: "eip155:421614",
|
|
153
|
+
ecosystem: "evm",
|
|
154
|
+
name: "Arbitrum Sepolia",
|
|
155
|
+
testnet: true,
|
|
156
|
+
chainId: 421614,
|
|
157
|
+
nativeCurrency: {
|
|
158
|
+
name: "Arbitrum Sepolia Ether",
|
|
159
|
+
symbol: "ETH",
|
|
160
|
+
decimals: 18
|
|
161
|
+
},
|
|
162
|
+
rpcUrls: ["https://sepolia-rollup.arbitrum.io/rpc"],
|
|
163
|
+
explorer: {
|
|
164
|
+
name: "Arbiscan",
|
|
165
|
+
url: "https://sepolia.arbiscan.io"
|
|
166
|
+
},
|
|
167
|
+
providers: {
|
|
168
|
+
alchemy: "arb-sepolia"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
key: "polygon",
|
|
173
|
+
id: "eip155:137",
|
|
174
|
+
ecosystem: "evm",
|
|
175
|
+
name: "Polygon",
|
|
176
|
+
testnet: false,
|
|
177
|
+
chainId: 137,
|
|
178
|
+
nativeCurrency: {
|
|
179
|
+
name: "POL",
|
|
180
|
+
symbol: "POL",
|
|
181
|
+
decimals: 18
|
|
182
|
+
},
|
|
183
|
+
rpcUrls: ["https://polygon.drpc.org"],
|
|
184
|
+
explorer: {
|
|
185
|
+
name: "PolygonScan",
|
|
186
|
+
url: "https://polygonscan.com"
|
|
187
|
+
},
|
|
188
|
+
providers: {
|
|
189
|
+
alchemy: "polygon-mainnet"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
key: "polygon-amoy",
|
|
194
|
+
id: "eip155:80002",
|
|
195
|
+
ecosystem: "evm",
|
|
196
|
+
name: "Polygon Amoy",
|
|
197
|
+
testnet: true,
|
|
198
|
+
chainId: 80002,
|
|
199
|
+
nativeCurrency: {
|
|
200
|
+
name: "POL",
|
|
201
|
+
symbol: "POL",
|
|
202
|
+
decimals: 18
|
|
203
|
+
},
|
|
204
|
+
rpcUrls: ["https://polygon-amoy.drpc.org"],
|
|
205
|
+
explorer: {
|
|
206
|
+
name: "PolygonScan",
|
|
207
|
+
url: "https://amoy.polygonscan.com"
|
|
208
|
+
},
|
|
209
|
+
providers: {
|
|
210
|
+
alchemy: "polygon-amoy"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
key: "bsc",
|
|
215
|
+
id: "eip155:56",
|
|
216
|
+
ecosystem: "evm",
|
|
217
|
+
name: "BNB Smart Chain",
|
|
218
|
+
testnet: false,
|
|
219
|
+
chainId: 56,
|
|
220
|
+
nativeCurrency: {
|
|
221
|
+
decimals: 18,
|
|
222
|
+
name: "BNB",
|
|
223
|
+
symbol: "BNB"
|
|
224
|
+
},
|
|
225
|
+
rpcUrls: ["https://56.rpc.thirdweb.com"],
|
|
226
|
+
explorer: {
|
|
227
|
+
name: "BscScan",
|
|
228
|
+
url: "https://bscscan.com"
|
|
229
|
+
},
|
|
230
|
+
providers: {
|
|
231
|
+
alchemy: "bnb-mainnet"
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
key: "bsc-testnet",
|
|
236
|
+
id: "eip155:97",
|
|
237
|
+
ecosystem: "evm",
|
|
238
|
+
name: "BNB Smart Chain Testnet",
|
|
239
|
+
testnet: true,
|
|
240
|
+
chainId: 97,
|
|
241
|
+
nativeCurrency: {
|
|
242
|
+
decimals: 18,
|
|
243
|
+
name: "BNB",
|
|
244
|
+
symbol: "tBNB"
|
|
245
|
+
},
|
|
246
|
+
rpcUrls: ["https://data-seed-prebsc-1-s1.bnbchain.org:8545"],
|
|
247
|
+
explorer: {
|
|
248
|
+
name: "BscScan",
|
|
249
|
+
url: "https://testnet.bscscan.com"
|
|
250
|
+
},
|
|
251
|
+
providers: {
|
|
252
|
+
alchemy: "bnb-testnet"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
key: "avalanche",
|
|
257
|
+
id: "eip155:43114",
|
|
258
|
+
ecosystem: "evm",
|
|
259
|
+
name: "Avalanche",
|
|
260
|
+
testnet: false,
|
|
261
|
+
chainId: 43114,
|
|
262
|
+
nativeCurrency: {
|
|
263
|
+
decimals: 18,
|
|
264
|
+
name: "Avalanche",
|
|
265
|
+
symbol: "AVAX"
|
|
266
|
+
},
|
|
267
|
+
rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"],
|
|
268
|
+
explorer: {
|
|
269
|
+
name: "SnowTrace",
|
|
270
|
+
url: "https://snowtrace.io"
|
|
271
|
+
},
|
|
272
|
+
providers: {
|
|
273
|
+
alchemy: "avax-mainnet"
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
key: "avalanche-fuji",
|
|
278
|
+
id: "eip155:43113",
|
|
279
|
+
ecosystem: "evm",
|
|
280
|
+
name: "Avalanche Fuji",
|
|
281
|
+
testnet: true,
|
|
282
|
+
chainId: 43113,
|
|
283
|
+
nativeCurrency: {
|
|
284
|
+
decimals: 18,
|
|
285
|
+
name: "Avalanche Fuji",
|
|
286
|
+
symbol: "AVAX"
|
|
287
|
+
},
|
|
288
|
+
rpcUrls: ["https://api.avax-test.network/ext/bc/C/rpc"],
|
|
289
|
+
explorer: {
|
|
290
|
+
name: "SnowTrace",
|
|
291
|
+
url: "https://testnet.snowtrace.io"
|
|
292
|
+
},
|
|
293
|
+
providers: {
|
|
294
|
+
alchemy: "avax-fuji"
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
key: "celo",
|
|
299
|
+
id: "eip155:42220",
|
|
300
|
+
ecosystem: "evm",
|
|
301
|
+
name: "Celo",
|
|
302
|
+
testnet: false,
|
|
303
|
+
chainId: 42220,
|
|
304
|
+
nativeCurrency: {
|
|
305
|
+
decimals: 18,
|
|
306
|
+
name: "CELO",
|
|
307
|
+
symbol: "CELO"
|
|
308
|
+
},
|
|
309
|
+
rpcUrls: ["https://forno.celo.org"],
|
|
310
|
+
explorer: {
|
|
311
|
+
name: "Celo Explorer",
|
|
312
|
+
url: "https://celoscan.io"
|
|
313
|
+
},
|
|
314
|
+
providers: {
|
|
315
|
+
alchemy: "celo-mainnet"
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
key: "celo-alfajores",
|
|
320
|
+
id: "eip155:44787",
|
|
321
|
+
ecosystem: "evm",
|
|
322
|
+
name: "Alfajores",
|
|
323
|
+
testnet: true,
|
|
324
|
+
chainId: 44787,
|
|
325
|
+
nativeCurrency: {
|
|
326
|
+
decimals: 18,
|
|
327
|
+
name: "CELO",
|
|
328
|
+
symbol: "A-CELO"
|
|
329
|
+
},
|
|
330
|
+
rpcUrls: ["https://alfajores-forno.celo-testnet.org"],
|
|
331
|
+
explorer: {
|
|
332
|
+
name: "Celo Alfajores Explorer",
|
|
333
|
+
url: "https://celo-alfajores.blockscout.com"
|
|
334
|
+
},
|
|
335
|
+
providers: {
|
|
336
|
+
alchemy: "celo-alfajores"
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
key: "linea-sepolia",
|
|
341
|
+
id: "eip155:59141",
|
|
342
|
+
ecosystem: "evm",
|
|
343
|
+
name: "Linea Sepolia Testnet",
|
|
344
|
+
testnet: true,
|
|
345
|
+
chainId: 59141,
|
|
346
|
+
nativeCurrency: {
|
|
347
|
+
name: "Linea Ether",
|
|
348
|
+
symbol: "ETH",
|
|
349
|
+
decimals: 18
|
|
350
|
+
},
|
|
351
|
+
rpcUrls: ["https://rpc.sepolia.linea.build"],
|
|
352
|
+
wsUrls: ["wss://rpc.sepolia.linea.build"],
|
|
353
|
+
explorer: {
|
|
354
|
+
name: "Etherscan",
|
|
355
|
+
url: "https://sepolia.lineascan.build"
|
|
356
|
+
},
|
|
357
|
+
providers: {
|
|
358
|
+
alchemy: "linea-sepolia"
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
key: "scroll-sepolia",
|
|
363
|
+
id: "eip155:534351",
|
|
364
|
+
ecosystem: "evm",
|
|
365
|
+
name: "Scroll Sepolia",
|
|
366
|
+
testnet: true,
|
|
367
|
+
chainId: 534351,
|
|
368
|
+
nativeCurrency: {
|
|
369
|
+
name: "Ether",
|
|
370
|
+
symbol: "ETH",
|
|
371
|
+
decimals: 18
|
|
372
|
+
},
|
|
373
|
+
rpcUrls: ["https://sepolia-rpc.scroll.io"],
|
|
374
|
+
explorer: {
|
|
375
|
+
name: "Scrollscan",
|
|
376
|
+
url: "https://sepolia.scrollscan.com"
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
key: "unichain-sepolia",
|
|
381
|
+
id: "eip155:1301",
|
|
382
|
+
ecosystem: "evm",
|
|
383
|
+
name: "Unichain Sepolia",
|
|
384
|
+
testnet: true,
|
|
385
|
+
chainId: 1301,
|
|
386
|
+
nativeCurrency: {
|
|
387
|
+
name: "Ether",
|
|
388
|
+
symbol: "ETH",
|
|
389
|
+
decimals: 18
|
|
390
|
+
},
|
|
391
|
+
rpcUrls: ["https://sepolia.unichain.org"],
|
|
392
|
+
explorer: {
|
|
393
|
+
name: "Uniscan",
|
|
394
|
+
url: "https://sepolia.uniscan.xyz"
|
|
395
|
+
},
|
|
396
|
+
providers: {
|
|
397
|
+
alchemy: "unichain-sepolia"
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
key: "monad-testnet",
|
|
402
|
+
id: "eip155:10143",
|
|
403
|
+
ecosystem: "evm",
|
|
404
|
+
name: "Monad Testnet",
|
|
405
|
+
testnet: true,
|
|
406
|
+
chainId: 10143,
|
|
407
|
+
nativeCurrency: {
|
|
408
|
+
name: "Testnet MON Token",
|
|
409
|
+
symbol: "MON",
|
|
410
|
+
decimals: 18
|
|
411
|
+
},
|
|
412
|
+
rpcUrls: ["https://testnet-rpc.monad.xyz"],
|
|
413
|
+
explorer: {
|
|
414
|
+
name: "Monad Testnet explorer",
|
|
415
|
+
url: "https://testnet.monadexplorer.com"
|
|
416
|
+
},
|
|
417
|
+
providers: {
|
|
418
|
+
alchemy: "monad-testnet"
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
key: "anvil",
|
|
423
|
+
id: "eip155:31337",
|
|
424
|
+
ecosystem: "evm",
|
|
425
|
+
name: "Anvil",
|
|
426
|
+
testnet: true,
|
|
427
|
+
chainId: 31337,
|
|
428
|
+
nativeCurrency: {
|
|
429
|
+
decimals: 18,
|
|
430
|
+
name: "Ether",
|
|
431
|
+
symbol: "ETH"
|
|
432
|
+
},
|
|
433
|
+
rpcUrls: ["http://127.0.0.1:8545"],
|
|
434
|
+
wsUrls: ["ws://127.0.0.1:8545"]
|
|
435
|
+
}
|
|
436
|
+
];
|
|
437
|
+
|
|
438
|
+
// src/chains.ts
|
|
439
|
+
var SOL = { name: "Solana", symbol: "SOL", decimals: 9 };
|
|
440
|
+
var SUI = { name: "Sui", symbol: "SUI", decimals: 9 };
|
|
441
|
+
var solanaExplorer = (cluster) => ({
|
|
442
|
+
name: "Solana Explorer",
|
|
443
|
+
url: "https://explorer.solana.com",
|
|
444
|
+
tx: `/tx/{hash}${cluster ? `?cluster=${cluster}` : ""}`,
|
|
445
|
+
address: `/address/{address}${cluster ? `?cluster=${cluster}` : ""}`
|
|
446
|
+
});
|
|
447
|
+
var suiscan = (net) => ({ name: "Suiscan", url: `https://suiscan.xyz/${net}`, tx: "/tx/{hash}", address: "/account/{address}" });
|
|
448
|
+
var solanaChains = [
|
|
449
|
+
{
|
|
450
|
+
key: "solana",
|
|
451
|
+
id: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
452
|
+
walletChain: "solana:mainnet",
|
|
453
|
+
ecosystem: "solana",
|
|
454
|
+
name: "Solana",
|
|
455
|
+
testnet: false,
|
|
456
|
+
cluster: "mainnet-beta",
|
|
457
|
+
nativeCurrency: SOL,
|
|
458
|
+
rpcUrls: ["https://api.mainnet-beta.solana.com"],
|
|
459
|
+
wsUrls: ["wss://api.mainnet-beta.solana.com"],
|
|
460
|
+
explorer: solanaExplorer(),
|
|
461
|
+
providers: { alchemy: "solana-mainnet", helius: "mainnet" }
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
key: "solana-devnet",
|
|
465
|
+
id: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
|
|
466
|
+
walletChain: "solana:devnet",
|
|
467
|
+
ecosystem: "solana",
|
|
468
|
+
name: "Solana Devnet",
|
|
469
|
+
testnet: true,
|
|
470
|
+
cluster: "devnet",
|
|
471
|
+
nativeCurrency: SOL,
|
|
472
|
+
rpcUrls: ["https://api.devnet.solana.com"],
|
|
473
|
+
wsUrls: ["wss://api.devnet.solana.com"],
|
|
474
|
+
explorer: solanaExplorer("devnet"),
|
|
475
|
+
providers: { alchemy: "solana-devnet", helius: "devnet" }
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
key: "solana-testnet",
|
|
479
|
+
id: "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",
|
|
480
|
+
walletChain: "solana:testnet",
|
|
481
|
+
ecosystem: "solana",
|
|
482
|
+
name: "Solana Testnet",
|
|
483
|
+
testnet: true,
|
|
484
|
+
cluster: "testnet",
|
|
485
|
+
nativeCurrency: SOL,
|
|
486
|
+
rpcUrls: ["https://api.testnet.solana.com"],
|
|
487
|
+
wsUrls: ["wss://api.testnet.solana.com"],
|
|
488
|
+
explorer: solanaExplorer("testnet")
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
key: "solana-localnet",
|
|
492
|
+
id: "solana:localnet",
|
|
493
|
+
walletChain: "solana:localnet",
|
|
494
|
+
ecosystem: "solana",
|
|
495
|
+
name: "Solana Localnet",
|
|
496
|
+
testnet: true,
|
|
497
|
+
cluster: "localnet",
|
|
498
|
+
nativeCurrency: SOL,
|
|
499
|
+
rpcUrls: ["http://127.0.0.1:8899"],
|
|
500
|
+
wsUrls: ["ws://127.0.0.1:8900"],
|
|
501
|
+
explorer: { ...solanaExplorer("custom"), tx: "/tx/{hash}?cluster=custom&customUrl=http%3A%2F%2F127.0.0.1%3A8899" }
|
|
502
|
+
}
|
|
503
|
+
];
|
|
504
|
+
var suiChains = [
|
|
505
|
+
{
|
|
506
|
+
key: "sui",
|
|
507
|
+
id: "sui:mainnet",
|
|
508
|
+
ecosystem: "sui",
|
|
509
|
+
name: "Sui",
|
|
510
|
+
testnet: false,
|
|
511
|
+
nativeCurrency: SUI,
|
|
512
|
+
rpcUrls: ["https://fullnode.mainnet.sui.io:443"],
|
|
513
|
+
graphqlUrl: "https://graphql.mainnet.sui.io/graphql",
|
|
514
|
+
explorer: suiscan("mainnet")
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
key: "sui-testnet",
|
|
518
|
+
id: "sui:testnet",
|
|
519
|
+
ecosystem: "sui",
|
|
520
|
+
name: "Sui Testnet",
|
|
521
|
+
testnet: true,
|
|
522
|
+
nativeCurrency: SUI,
|
|
523
|
+
rpcUrls: ["https://fullnode.testnet.sui.io:443"],
|
|
524
|
+
graphqlUrl: "https://graphql.testnet.sui.io/graphql",
|
|
525
|
+
explorer: suiscan("testnet")
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
key: "sui-devnet",
|
|
529
|
+
id: "sui:devnet",
|
|
530
|
+
ecosystem: "sui",
|
|
531
|
+
name: "Sui Devnet",
|
|
532
|
+
testnet: true,
|
|
533
|
+
nativeCurrency: SUI,
|
|
534
|
+
rpcUrls: ["https://fullnode.devnet.sui.io:443"],
|
|
535
|
+
graphqlUrl: "https://graphql.devnet.sui.io/graphql",
|
|
536
|
+
explorer: suiscan("devnet")
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
key: "sui-localnet",
|
|
540
|
+
id: "sui:localnet",
|
|
541
|
+
ecosystem: "sui",
|
|
542
|
+
name: "Sui Localnet",
|
|
543
|
+
testnet: true,
|
|
544
|
+
nativeCurrency: SUI,
|
|
545
|
+
rpcUrls: ["http://127.0.0.1:9000"]
|
|
546
|
+
}
|
|
547
|
+
];
|
|
548
|
+
var all = [...evmChains, ...solanaChains, ...suiChains];
|
|
549
|
+
var chains = Object.fromEntries(all.map((c) => [c.key, c]));
|
|
550
|
+
var index = /* @__PURE__ */ new Map();
|
|
551
|
+
for (const c of all) {
|
|
552
|
+
index.set(c.key, c);
|
|
553
|
+
index.set(c.id, c);
|
|
554
|
+
if (c.walletChain) index.set(c.walletChain, c);
|
|
555
|
+
if (c.chainId !== void 0) index.set(c.chainId, c);
|
|
556
|
+
}
|
|
557
|
+
function findChain(ref) {
|
|
558
|
+
return typeof ref === "object" ? ref : index.get(ref);
|
|
559
|
+
}
|
|
560
|
+
function getChain(ref) {
|
|
561
|
+
const c = findChain(ref);
|
|
562
|
+
if (!c) throw new Error(`unknown chain ${JSON.stringify(ref)}; pass a ChainConfig from defineChain() for custom chains`);
|
|
563
|
+
return c;
|
|
564
|
+
}
|
|
565
|
+
function listChains(filter = {}) {
|
|
566
|
+
return all.filter(
|
|
567
|
+
(c) => (filter.ecosystem === void 0 || c.ecosystem === filter.ecosystem) && (filter.testnet === void 0 || c.testnet === filter.testnet)
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
function defineChain(chain) {
|
|
571
|
+
if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(chain.key)) throw new Error(`defineChain: key "${chain.key}" must be kebab-case`);
|
|
572
|
+
if (!/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$/.test(chain.id)) throw new Error(`defineChain: id "${chain.id}" is not CAIP-2`);
|
|
573
|
+
if (chain.ecosystem === "evm" && chain.id !== `eip155:${chain.chainId}`) throw new Error("defineChain: EVM id must be eip155:<chainId>");
|
|
574
|
+
if (!chain.rpcUrls.length) throw new Error("defineChain: at least one rpcUrl is required");
|
|
575
|
+
return chain;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// src/rpc.ts
|
|
579
|
+
var PREFIXES = ["", "NEXT_PUBLIC_", "VITE_", "PUBLIC_", "EXPO_PUBLIC_"];
|
|
580
|
+
var envStem = (chain) => getChain(chain).key.toUpperCase().replace(/-/g, "_");
|
|
581
|
+
function readEnv(env, name) {
|
|
582
|
+
const src = env ?? defaultEnv();
|
|
583
|
+
for (const p of PREFIXES) {
|
|
584
|
+
const v = src[`${p}${name}`]?.trim();
|
|
585
|
+
if (v) return v;
|
|
586
|
+
}
|
|
587
|
+
return void 0;
|
|
588
|
+
}
|
|
589
|
+
var TEMPLATES = {
|
|
590
|
+
alchemy: {
|
|
591
|
+
keyVar: "ALCHEMY_API_KEY",
|
|
592
|
+
http: (slug, key) => `https://${slug}.g.alchemy.com/v2/${key}`,
|
|
593
|
+
ws: (slug, key) => `wss://${slug}.g.alchemy.com/v2/${key}`
|
|
594
|
+
},
|
|
595
|
+
helius: {
|
|
596
|
+
keyVar: "HELIUS_API_KEY",
|
|
597
|
+
http: (slug, key) => `https://${slug}.helius-rpc.com/?api-key=${key}`,
|
|
598
|
+
ws: (slug, key) => `wss://${slug}.helius-rpc.com/?api-key=${key}`
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
function getRpcUrls(chain, opts = {}) {
|
|
602
|
+
return resolve(getChain(chain), opts, "http");
|
|
603
|
+
}
|
|
604
|
+
function getRpcUrl(chain, opts = {}) {
|
|
605
|
+
return getRpcUrls(chain, opts)[0];
|
|
606
|
+
}
|
|
607
|
+
function getWsUrls(chain, opts = {}) {
|
|
608
|
+
return resolve(getChain(chain), opts, "ws");
|
|
609
|
+
}
|
|
610
|
+
function resolve(c, opts, kind) {
|
|
611
|
+
const env = opts.env;
|
|
612
|
+
const out = [];
|
|
613
|
+
const override = readEnv(env, `${envStem(c)}_${kind === "http" ? "RPC" : "WS"}_URL`);
|
|
614
|
+
if (override) out.push(...split(override));
|
|
615
|
+
else if (kind === "ws" && c.ecosystem === "solana") {
|
|
616
|
+
const rpc = readEnv(env, `${envStem(c)}_RPC_URL`);
|
|
617
|
+
if (rpc) out.push(...split(rpc).map((u) => u.replace(/^http/, "ws")));
|
|
618
|
+
}
|
|
619
|
+
const order = opts.providers ?? (c.ecosystem === "solana" ? ["helius", "alchemy"] : ["alchemy"]);
|
|
620
|
+
for (const p of order) {
|
|
621
|
+
const slug = c.providers?.[p];
|
|
622
|
+
const key = slug && readEnv(env, TEMPLATES[p].keyVar);
|
|
623
|
+
if (slug && key) out.push(TEMPLATES[p][kind](slug, key));
|
|
624
|
+
}
|
|
625
|
+
if (opts.public ?? true) out.push(...(kind === "http" ? c.rpcUrls : c.wsUrls) ?? []);
|
|
626
|
+
const urls = [...new Set(out)];
|
|
627
|
+
if (!urls.length)
|
|
628
|
+
throw new Error(
|
|
629
|
+
`no ${kind === "http" ? "RPC" : "WebSocket"} URL for ${c.key}; set ${envStem(c)}_${kind === "http" ? "RPC" : "WS"}_URL`
|
|
630
|
+
);
|
|
631
|
+
return urls;
|
|
632
|
+
}
|
|
633
|
+
var split = (v) => v.split(",").map((s) => s.trim()).filter(Boolean);
|
|
634
|
+
function defaultEnv() {
|
|
635
|
+
const p = globalThis.process;
|
|
636
|
+
return p?.env ?? {};
|
|
637
|
+
}
|
|
638
|
+
function redactRpcUrl(url) {
|
|
639
|
+
return url.replace(/(\/v2\/)[^/?#]+/, "$1<redacted>").replace(/([?&]api-key=)[^&#]+/, "$1<redacted>");
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export {
|
|
643
|
+
chains,
|
|
644
|
+
findChain,
|
|
645
|
+
getChain,
|
|
646
|
+
listChains,
|
|
647
|
+
defineChain,
|
|
648
|
+
envStem,
|
|
649
|
+
readEnv,
|
|
650
|
+
getRpcUrls,
|
|
651
|
+
getRpcUrl,
|
|
652
|
+
getWsUrls,
|
|
653
|
+
redactRpcUrl
|
|
654
|
+
};
|
|
655
|
+
//# sourceMappingURL=chunk-ZRZNU5KJ.js.map
|