@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.
@@ -0,0 +1,669 @@
1
+ type Ecosystem = "evm" | "solana" | "sui";
2
+ interface NativeCurrency {
3
+ name: string;
4
+ symbol: string;
5
+ decimals: number;
6
+ }
7
+ /** One chain: plain data, no SDK objects, so it works on servers, in browsers and in build scripts. */
8
+ interface ChainConfig {
9
+ /** Stable slug, also the env-var stem: `base-sepolia` → `BASE_SEPOLIA_RPC_URL`. */
10
+ key: string;
11
+ /** CAIP-2: `eip155:84532`, `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1`, `sui:testnet`. */
12
+ id: string;
13
+ ecosystem: Ecosystem;
14
+ name: string;
15
+ testnet: boolean;
16
+ /** EVM only: the numeric chain id. */
17
+ chainId?: number;
18
+ /** Solana only: the cluster name used by explorers and CLIs. */
19
+ cluster?: string;
20
+ /** Wallet Standard chain id, where it differs from `id` (Solana wallets use `solana:devnet`, not the genesis hash). */
21
+ walletChain?: string;
22
+ nativeCurrency: NativeCurrency;
23
+ /**
24
+ * Public endpoints, in fallback order. On Sui these are fullnode base URLs for gRPC
25
+ * (`SuiGrpcClient`): public fullnodes no longer serve JSON-RPC.
26
+ */
27
+ rpcUrls: readonly string[];
28
+ /** Sui only: the public GraphQL endpoint. */
29
+ graphqlUrl?: string;
30
+ wsUrls?: readonly string[];
31
+ explorer?: {
32
+ name: string;
33
+ url: string;
34
+ /** `{base}`-relative templates; defaults suit Etherscan/Blockscout-style explorers. */
35
+ tx?: string;
36
+ address?: string;
37
+ };
38
+ /** Network slugs for keyed RPC providers. */
39
+ providers?: {
40
+ alchemy?: string;
41
+ helius?: string;
42
+ };
43
+ }
44
+
45
+ declare const all: ({
46
+ readonly key: "solana";
47
+ readonly id: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
48
+ readonly walletChain: "solana:mainnet";
49
+ readonly ecosystem: "solana";
50
+ readonly name: "Solana";
51
+ readonly testnet: false;
52
+ readonly cluster: "mainnet-beta";
53
+ readonly nativeCurrency: {
54
+ readonly name: "Solana";
55
+ readonly symbol: "SOL";
56
+ readonly decimals: 9;
57
+ };
58
+ readonly rpcUrls: readonly ["https://api.mainnet-beta.solana.com"];
59
+ readonly wsUrls: readonly ["wss://api.mainnet-beta.solana.com"];
60
+ readonly explorer: {
61
+ name: string;
62
+ url: string;
63
+ tx: string;
64
+ address: string;
65
+ };
66
+ readonly providers: {
67
+ readonly alchemy: "solana-mainnet";
68
+ readonly helius: "mainnet";
69
+ };
70
+ } | {
71
+ readonly key: "solana-devnet";
72
+ readonly id: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
73
+ readonly walletChain: "solana:devnet";
74
+ readonly ecosystem: "solana";
75
+ readonly name: "Solana Devnet";
76
+ readonly testnet: true;
77
+ readonly cluster: "devnet";
78
+ readonly nativeCurrency: {
79
+ readonly name: "Solana";
80
+ readonly symbol: "SOL";
81
+ readonly decimals: 9;
82
+ };
83
+ readonly rpcUrls: readonly ["https://api.devnet.solana.com"];
84
+ readonly wsUrls: readonly ["wss://api.devnet.solana.com"];
85
+ readonly explorer: {
86
+ name: string;
87
+ url: string;
88
+ tx: string;
89
+ address: string;
90
+ };
91
+ readonly providers: {
92
+ readonly alchemy: "solana-devnet";
93
+ readonly helius: "devnet";
94
+ };
95
+ } | {
96
+ readonly key: "solana-testnet";
97
+ readonly id: "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
98
+ readonly walletChain: "solana:testnet";
99
+ readonly ecosystem: "solana";
100
+ readonly name: "Solana Testnet";
101
+ readonly testnet: true;
102
+ readonly cluster: "testnet";
103
+ readonly nativeCurrency: {
104
+ readonly name: "Solana";
105
+ readonly symbol: "SOL";
106
+ readonly decimals: 9;
107
+ };
108
+ readonly rpcUrls: readonly ["https://api.testnet.solana.com"];
109
+ readonly wsUrls: readonly ["wss://api.testnet.solana.com"];
110
+ readonly explorer: {
111
+ name: string;
112
+ url: string;
113
+ tx: string;
114
+ address: string;
115
+ };
116
+ } | {
117
+ readonly key: "solana-localnet";
118
+ readonly id: "solana:localnet";
119
+ readonly walletChain: "solana:localnet";
120
+ readonly ecosystem: "solana";
121
+ readonly name: "Solana Localnet";
122
+ readonly testnet: true;
123
+ readonly cluster: "localnet";
124
+ readonly nativeCurrency: {
125
+ readonly name: "Solana";
126
+ readonly symbol: "SOL";
127
+ readonly decimals: 9;
128
+ };
129
+ readonly rpcUrls: readonly ["http://127.0.0.1:8899"];
130
+ readonly wsUrls: readonly ["ws://127.0.0.1:8900"];
131
+ readonly explorer: {
132
+ readonly tx: "/tx/{hash}?cluster=custom&customUrl=http%3A%2F%2F127.0.0.1%3A8899";
133
+ readonly name: string;
134
+ readonly url: string;
135
+ readonly address: string;
136
+ };
137
+ } | {
138
+ readonly key: "sui";
139
+ readonly id: "sui:mainnet";
140
+ readonly ecosystem: "sui";
141
+ readonly name: "Sui";
142
+ readonly testnet: false;
143
+ readonly nativeCurrency: {
144
+ readonly name: "Sui";
145
+ readonly symbol: "SUI";
146
+ readonly decimals: 9;
147
+ };
148
+ readonly rpcUrls: readonly ["https://fullnode.mainnet.sui.io:443"];
149
+ readonly graphqlUrl: "https://graphql.mainnet.sui.io/graphql";
150
+ readonly explorer: {
151
+ name: string;
152
+ url: string;
153
+ tx: string;
154
+ address: string;
155
+ };
156
+ } | {
157
+ readonly key: "sui-testnet";
158
+ readonly id: "sui:testnet";
159
+ readonly ecosystem: "sui";
160
+ readonly name: "Sui Testnet";
161
+ readonly testnet: true;
162
+ readonly nativeCurrency: {
163
+ readonly name: "Sui";
164
+ readonly symbol: "SUI";
165
+ readonly decimals: 9;
166
+ };
167
+ readonly rpcUrls: readonly ["https://fullnode.testnet.sui.io:443"];
168
+ readonly graphqlUrl: "https://graphql.testnet.sui.io/graphql";
169
+ readonly explorer: {
170
+ name: string;
171
+ url: string;
172
+ tx: string;
173
+ address: string;
174
+ };
175
+ } | {
176
+ readonly key: "sui-devnet";
177
+ readonly id: "sui:devnet";
178
+ readonly ecosystem: "sui";
179
+ readonly name: "Sui Devnet";
180
+ readonly testnet: true;
181
+ readonly nativeCurrency: {
182
+ readonly name: "Sui";
183
+ readonly symbol: "SUI";
184
+ readonly decimals: 9;
185
+ };
186
+ readonly rpcUrls: readonly ["https://fullnode.devnet.sui.io:443"];
187
+ readonly graphqlUrl: "https://graphql.devnet.sui.io/graphql";
188
+ readonly explorer: {
189
+ name: string;
190
+ url: string;
191
+ tx: string;
192
+ address: string;
193
+ };
194
+ } | {
195
+ readonly key: "sui-localnet";
196
+ readonly id: "sui:localnet";
197
+ readonly ecosystem: "sui";
198
+ readonly name: "Sui Localnet";
199
+ readonly testnet: true;
200
+ readonly nativeCurrency: {
201
+ readonly name: "Sui";
202
+ readonly symbol: "SUI";
203
+ readonly decimals: 9;
204
+ };
205
+ readonly rpcUrls: readonly ["http://127.0.0.1:9000"];
206
+ } | {
207
+ readonly key: "ethereum";
208
+ readonly id: "eip155:1";
209
+ readonly ecosystem: "evm";
210
+ readonly name: "Ethereum";
211
+ readonly testnet: false;
212
+ readonly chainId: 1;
213
+ readonly nativeCurrency: {
214
+ readonly name: "Ether";
215
+ readonly symbol: "ETH";
216
+ readonly decimals: 18;
217
+ };
218
+ readonly rpcUrls: readonly ["https://ethereum.reth.rs/rpc"];
219
+ readonly explorer: {
220
+ readonly name: "Etherscan";
221
+ readonly url: "https://etherscan.io";
222
+ };
223
+ readonly providers: {
224
+ readonly alchemy: "eth-mainnet";
225
+ };
226
+ } | {
227
+ readonly key: "sepolia";
228
+ readonly id: "eip155:11155111";
229
+ readonly ecosystem: "evm";
230
+ readonly name: "Sepolia";
231
+ readonly testnet: true;
232
+ readonly chainId: 11155111;
233
+ readonly nativeCurrency: {
234
+ readonly name: "Sepolia Ether";
235
+ readonly symbol: "ETH";
236
+ readonly decimals: 18;
237
+ };
238
+ readonly rpcUrls: readonly ["https://11155111.rpc.thirdweb.com"];
239
+ readonly explorer: {
240
+ readonly name: "Etherscan";
241
+ readonly url: "https://sepolia.etherscan.io";
242
+ };
243
+ readonly providers: {
244
+ readonly alchemy: "eth-sepolia";
245
+ };
246
+ } | {
247
+ readonly key: "base";
248
+ readonly id: "eip155:8453";
249
+ readonly ecosystem: "evm";
250
+ readonly name: "Base";
251
+ readonly testnet: false;
252
+ readonly chainId: 8453;
253
+ readonly nativeCurrency: {
254
+ readonly name: "Ether";
255
+ readonly symbol: "ETH";
256
+ readonly decimals: 18;
257
+ };
258
+ readonly rpcUrls: readonly ["https://mainnet.base.org"];
259
+ readonly explorer: {
260
+ readonly name: "Basescan";
261
+ readonly url: "https://basescan.org";
262
+ };
263
+ readonly providers: {
264
+ readonly alchemy: "base-mainnet";
265
+ };
266
+ } | {
267
+ readonly key: "base-sepolia";
268
+ readonly id: "eip155:84532";
269
+ readonly ecosystem: "evm";
270
+ readonly name: "Base Sepolia";
271
+ readonly testnet: true;
272
+ readonly chainId: 84532;
273
+ readonly nativeCurrency: {
274
+ readonly name: "Sepolia Ether";
275
+ readonly symbol: "ETH";
276
+ readonly decimals: 18;
277
+ };
278
+ readonly rpcUrls: readonly ["https://sepolia.base.org"];
279
+ readonly explorer: {
280
+ readonly name: "Basescan";
281
+ readonly url: "https://sepolia.basescan.org";
282
+ };
283
+ readonly providers: {
284
+ readonly alchemy: "base-sepolia";
285
+ };
286
+ } | {
287
+ readonly key: "optimism";
288
+ readonly id: "eip155:10";
289
+ readonly ecosystem: "evm";
290
+ readonly name: "OP Mainnet";
291
+ readonly testnet: false;
292
+ readonly chainId: 10;
293
+ readonly nativeCurrency: {
294
+ readonly name: "Ether";
295
+ readonly symbol: "ETH";
296
+ readonly decimals: 18;
297
+ };
298
+ readonly rpcUrls: readonly ["https://mainnet.optimism.io"];
299
+ readonly explorer: {
300
+ readonly name: "Optimism Explorer";
301
+ readonly url: "https://optimistic.etherscan.io";
302
+ };
303
+ readonly providers: {
304
+ readonly alchemy: "opt-mainnet";
305
+ };
306
+ } | {
307
+ readonly key: "optimism-sepolia";
308
+ readonly id: "eip155:11155420";
309
+ readonly ecosystem: "evm";
310
+ readonly name: "OP Sepolia";
311
+ readonly testnet: true;
312
+ readonly chainId: 11155420;
313
+ readonly nativeCurrency: {
314
+ readonly name: "Sepolia Ether";
315
+ readonly symbol: "ETH";
316
+ readonly decimals: 18;
317
+ };
318
+ readonly rpcUrls: readonly ["https://sepolia.optimism.io"];
319
+ readonly explorer: {
320
+ readonly name: "Blockscout";
321
+ readonly url: "https://optimism-sepolia.blockscout.com";
322
+ };
323
+ readonly providers: {
324
+ readonly alchemy: "opt-sepolia";
325
+ };
326
+ } | {
327
+ readonly key: "arbitrum";
328
+ readonly id: "eip155:42161";
329
+ readonly ecosystem: "evm";
330
+ readonly name: "Arbitrum One";
331
+ readonly testnet: false;
332
+ readonly chainId: 42161;
333
+ readonly nativeCurrency: {
334
+ readonly name: "Ether";
335
+ readonly symbol: "ETH";
336
+ readonly decimals: 18;
337
+ };
338
+ readonly rpcUrls: readonly ["https://arb1.arbitrum.io/rpc"];
339
+ readonly explorer: {
340
+ readonly name: "Arbiscan";
341
+ readonly url: "https://arbiscan.io";
342
+ };
343
+ readonly providers: {
344
+ readonly alchemy: "arb-mainnet";
345
+ };
346
+ } | {
347
+ readonly key: "arbitrum-sepolia";
348
+ readonly id: "eip155:421614";
349
+ readonly ecosystem: "evm";
350
+ readonly name: "Arbitrum Sepolia";
351
+ readonly testnet: true;
352
+ readonly chainId: 421614;
353
+ readonly nativeCurrency: {
354
+ readonly name: "Arbitrum Sepolia Ether";
355
+ readonly symbol: "ETH";
356
+ readonly decimals: 18;
357
+ };
358
+ readonly rpcUrls: readonly ["https://sepolia-rollup.arbitrum.io/rpc"];
359
+ readonly explorer: {
360
+ readonly name: "Arbiscan";
361
+ readonly url: "https://sepolia.arbiscan.io";
362
+ };
363
+ readonly providers: {
364
+ readonly alchemy: "arb-sepolia";
365
+ };
366
+ } | {
367
+ readonly key: "polygon";
368
+ readonly id: "eip155:137";
369
+ readonly ecosystem: "evm";
370
+ readonly name: "Polygon";
371
+ readonly testnet: false;
372
+ readonly chainId: 137;
373
+ readonly nativeCurrency: {
374
+ readonly name: "POL";
375
+ readonly symbol: "POL";
376
+ readonly decimals: 18;
377
+ };
378
+ readonly rpcUrls: readonly ["https://polygon.drpc.org"];
379
+ readonly explorer: {
380
+ readonly name: "PolygonScan";
381
+ readonly url: "https://polygonscan.com";
382
+ };
383
+ readonly providers: {
384
+ readonly alchemy: "polygon-mainnet";
385
+ };
386
+ } | {
387
+ readonly key: "polygon-amoy";
388
+ readonly id: "eip155:80002";
389
+ readonly ecosystem: "evm";
390
+ readonly name: "Polygon Amoy";
391
+ readonly testnet: true;
392
+ readonly chainId: 80002;
393
+ readonly nativeCurrency: {
394
+ readonly name: "POL";
395
+ readonly symbol: "POL";
396
+ readonly decimals: 18;
397
+ };
398
+ readonly rpcUrls: readonly ["https://polygon-amoy.drpc.org"];
399
+ readonly explorer: {
400
+ readonly name: "PolygonScan";
401
+ readonly url: "https://amoy.polygonscan.com";
402
+ };
403
+ readonly providers: {
404
+ readonly alchemy: "polygon-amoy";
405
+ };
406
+ } | {
407
+ readonly key: "bsc";
408
+ readonly id: "eip155:56";
409
+ readonly ecosystem: "evm";
410
+ readonly name: "BNB Smart Chain";
411
+ readonly testnet: false;
412
+ readonly chainId: 56;
413
+ readonly nativeCurrency: {
414
+ readonly decimals: 18;
415
+ readonly name: "BNB";
416
+ readonly symbol: "BNB";
417
+ };
418
+ readonly rpcUrls: readonly ["https://56.rpc.thirdweb.com"];
419
+ readonly explorer: {
420
+ readonly name: "BscScan";
421
+ readonly url: "https://bscscan.com";
422
+ };
423
+ readonly providers: {
424
+ readonly alchemy: "bnb-mainnet";
425
+ };
426
+ } | {
427
+ readonly key: "bsc-testnet";
428
+ readonly id: "eip155:97";
429
+ readonly ecosystem: "evm";
430
+ readonly name: "BNB Smart Chain Testnet";
431
+ readonly testnet: true;
432
+ readonly chainId: 97;
433
+ readonly nativeCurrency: {
434
+ readonly decimals: 18;
435
+ readonly name: "BNB";
436
+ readonly symbol: "tBNB";
437
+ };
438
+ readonly rpcUrls: readonly ["https://data-seed-prebsc-1-s1.bnbchain.org:8545"];
439
+ readonly explorer: {
440
+ readonly name: "BscScan";
441
+ readonly url: "https://testnet.bscscan.com";
442
+ };
443
+ readonly providers: {
444
+ readonly alchemy: "bnb-testnet";
445
+ };
446
+ } | {
447
+ readonly key: "avalanche";
448
+ readonly id: "eip155:43114";
449
+ readonly ecosystem: "evm";
450
+ readonly name: "Avalanche";
451
+ readonly testnet: false;
452
+ readonly chainId: 43114;
453
+ readonly nativeCurrency: {
454
+ readonly decimals: 18;
455
+ readonly name: "Avalanche";
456
+ readonly symbol: "AVAX";
457
+ };
458
+ readonly rpcUrls: readonly ["https://api.avax.network/ext/bc/C/rpc"];
459
+ readonly explorer: {
460
+ readonly name: "SnowTrace";
461
+ readonly url: "https://snowtrace.io";
462
+ };
463
+ readonly providers: {
464
+ readonly alchemy: "avax-mainnet";
465
+ };
466
+ } | {
467
+ readonly key: "avalanche-fuji";
468
+ readonly id: "eip155:43113";
469
+ readonly ecosystem: "evm";
470
+ readonly name: "Avalanche Fuji";
471
+ readonly testnet: true;
472
+ readonly chainId: 43113;
473
+ readonly nativeCurrency: {
474
+ readonly decimals: 18;
475
+ readonly name: "Avalanche Fuji";
476
+ readonly symbol: "AVAX";
477
+ };
478
+ readonly rpcUrls: readonly ["https://api.avax-test.network/ext/bc/C/rpc"];
479
+ readonly explorer: {
480
+ readonly name: "SnowTrace";
481
+ readonly url: "https://testnet.snowtrace.io";
482
+ };
483
+ readonly providers: {
484
+ readonly alchemy: "avax-fuji";
485
+ };
486
+ } | {
487
+ readonly key: "celo";
488
+ readonly id: "eip155:42220";
489
+ readonly ecosystem: "evm";
490
+ readonly name: "Celo";
491
+ readonly testnet: false;
492
+ readonly chainId: 42220;
493
+ readonly nativeCurrency: {
494
+ readonly decimals: 18;
495
+ readonly name: "CELO";
496
+ readonly symbol: "CELO";
497
+ };
498
+ readonly rpcUrls: readonly ["https://forno.celo.org"];
499
+ readonly explorer: {
500
+ readonly name: "Celo Explorer";
501
+ readonly url: "https://celoscan.io";
502
+ };
503
+ readonly providers: {
504
+ readonly alchemy: "celo-mainnet";
505
+ };
506
+ } | {
507
+ readonly key: "celo-alfajores";
508
+ readonly id: "eip155:44787";
509
+ readonly ecosystem: "evm";
510
+ readonly name: "Alfajores";
511
+ readonly testnet: true;
512
+ readonly chainId: 44787;
513
+ readonly nativeCurrency: {
514
+ readonly decimals: 18;
515
+ readonly name: "CELO";
516
+ readonly symbol: "A-CELO";
517
+ };
518
+ readonly rpcUrls: readonly ["https://alfajores-forno.celo-testnet.org"];
519
+ readonly explorer: {
520
+ readonly name: "Celo Alfajores Explorer";
521
+ readonly url: "https://celo-alfajores.blockscout.com";
522
+ };
523
+ readonly providers: {
524
+ readonly alchemy: "celo-alfajores";
525
+ };
526
+ } | {
527
+ readonly key: "linea-sepolia";
528
+ readonly id: "eip155:59141";
529
+ readonly ecosystem: "evm";
530
+ readonly name: "Linea Sepolia Testnet";
531
+ readonly testnet: true;
532
+ readonly chainId: 59141;
533
+ readonly nativeCurrency: {
534
+ readonly name: "Linea Ether";
535
+ readonly symbol: "ETH";
536
+ readonly decimals: 18;
537
+ };
538
+ readonly rpcUrls: readonly ["https://rpc.sepolia.linea.build"];
539
+ readonly wsUrls: readonly ["wss://rpc.sepolia.linea.build"];
540
+ readonly explorer: {
541
+ readonly name: "Etherscan";
542
+ readonly url: "https://sepolia.lineascan.build";
543
+ };
544
+ readonly providers: {
545
+ readonly alchemy: "linea-sepolia";
546
+ };
547
+ } | {
548
+ readonly key: "scroll-sepolia";
549
+ readonly id: "eip155:534351";
550
+ readonly ecosystem: "evm";
551
+ readonly name: "Scroll Sepolia";
552
+ readonly testnet: true;
553
+ readonly chainId: 534351;
554
+ readonly nativeCurrency: {
555
+ readonly name: "Ether";
556
+ readonly symbol: "ETH";
557
+ readonly decimals: 18;
558
+ };
559
+ readonly rpcUrls: readonly ["https://sepolia-rpc.scroll.io"];
560
+ readonly explorer: {
561
+ readonly name: "Scrollscan";
562
+ readonly url: "https://sepolia.scrollscan.com";
563
+ };
564
+ } | {
565
+ readonly key: "unichain-sepolia";
566
+ readonly id: "eip155:1301";
567
+ readonly ecosystem: "evm";
568
+ readonly name: "Unichain Sepolia";
569
+ readonly testnet: true;
570
+ readonly chainId: 1301;
571
+ readonly nativeCurrency: {
572
+ readonly name: "Ether";
573
+ readonly symbol: "ETH";
574
+ readonly decimals: 18;
575
+ };
576
+ readonly rpcUrls: readonly ["https://sepolia.unichain.org"];
577
+ readonly explorer: {
578
+ readonly name: "Uniscan";
579
+ readonly url: "https://sepolia.uniscan.xyz";
580
+ };
581
+ readonly providers: {
582
+ readonly alchemy: "unichain-sepolia";
583
+ };
584
+ } | {
585
+ readonly key: "monad-testnet";
586
+ readonly id: "eip155:10143";
587
+ readonly ecosystem: "evm";
588
+ readonly name: "Monad Testnet";
589
+ readonly testnet: true;
590
+ readonly chainId: 10143;
591
+ readonly nativeCurrency: {
592
+ readonly name: "Testnet MON Token";
593
+ readonly symbol: "MON";
594
+ readonly decimals: 18;
595
+ };
596
+ readonly rpcUrls: readonly ["https://testnet-rpc.monad.xyz"];
597
+ readonly explorer: {
598
+ readonly name: "Monad Testnet explorer";
599
+ readonly url: "https://testnet.monadexplorer.com";
600
+ };
601
+ readonly providers: {
602
+ readonly alchemy: "monad-testnet";
603
+ };
604
+ } | {
605
+ readonly key: "anvil";
606
+ readonly id: "eip155:31337";
607
+ readonly ecosystem: "evm";
608
+ readonly name: "Anvil";
609
+ readonly testnet: true;
610
+ readonly chainId: 31337;
611
+ readonly nativeCurrency: {
612
+ readonly decimals: 18;
613
+ readonly name: "Ether";
614
+ readonly symbol: "ETH";
615
+ };
616
+ readonly rpcUrls: readonly ["http://127.0.0.1:8545"];
617
+ readonly wsUrls: readonly ["ws://127.0.0.1:8545"];
618
+ })[];
619
+ type ChainKey = (typeof all)[number]["key"];
620
+ /** Every built-in chain by key: `chains["base-sepolia"]`. */
621
+ declare const chains: { [K in ChainKey]: Extract<(typeof all)[number], {
622
+ key: K;
623
+ }>; };
624
+ /** A chain key, CAIP-2 id, Wallet Standard id (`solana:devnet`), EVM chain id, or a `ChainConfig` (for custom chains). */
625
+ type ChainRef = ChainKey | (string & {}) | number | ChainConfig;
626
+ declare function findChain(ref: ChainRef): ChainConfig | undefined;
627
+ declare function getChain(ref: ChainRef): ChainConfig;
628
+ /** Built-in chains, optionally filtered: `listChains({ ecosystem: "evm", testnet: true })`. */
629
+ declare function listChains(filter?: {
630
+ ecosystem?: ChainConfig["ecosystem"];
631
+ testnet?: boolean;
632
+ }): ChainConfig[];
633
+ /** Declare a chain that isn't built in. Validates the shape; use the result anywhere a `ChainRef` is accepted. */
634
+ declare function defineChain<const C extends ChainConfig>(chain: C): C;
635
+
636
+ type Env = Record<string, string | undefined>;
637
+ type RpcProvider = "alchemy" | "helius";
638
+ interface RpcOptions {
639
+ /**
640
+ * Where to read variables. Default: `process.env` when it exists. In browsers pass your
641
+ * public env explicitly (Vite: `import.meta.env`; Next.js: an object of `process.env.NEXT_PUBLIC_…`).
642
+ */
643
+ env?: Env;
644
+ /** Keyed providers to try, in order. Default: Helius then Alchemy on Solana; Alchemy elsewhere. */
645
+ providers?: RpcProvider[];
646
+ /** Append the chain's public endpoints as the last fallbacks. Default true. */
647
+ public?: boolean;
648
+ }
649
+ /** `base-sepolia` → `BASE_SEPOLIA`, the stem of `BASE_SEPOLIA_RPC_URL`. */
650
+ declare const envStem: (chain: ChainRef) => string;
651
+ /** Read `name`, also under the public prefixes (`NEXT_PUBLIC_name`, `VITE_name` …). */
652
+ declare function readEnv(env: Env | undefined, name: string): string | undefined;
653
+ /**
654
+ * RPC endpoints for a chain, best first:
655
+ * 1. `<KEY>_RPC_URL` (comma-separated for several), e.g. `BASE_SEPOLIA_RPC_URL`
656
+ * 2. keyed providers whose API key is set (`HELIUS_API_KEY`, `ALCHEMY_API_KEY`)
657
+ * 3. the chain's public endpoints
658
+ * Every variable is also read with the `NEXT_PUBLIC_` / `VITE_` / `PUBLIC_` prefixes.
659
+ */
660
+ declare function getRpcUrls(chain: ChainRef, opts?: RpcOptions): string[];
661
+ /** The first of `getRpcUrls`. */
662
+ declare function getRpcUrl(chain: ChainRef, opts?: RpcOptions): string;
663
+ /** WebSocket endpoints (`<KEY>_WS_URL`, then providers, then public; Solana derives `wss://` from overridden RPC URLs). */
664
+ declare function getWsUrls(chain: ChainRef, opts?: RpcOptions): string[];
665
+ /** Replace API keys in URLs with `<redacted>`, for logs and error messages. */
666
+ declare function redactRpcUrl(url: string): string;
667
+
668
+ export { chains as e, defineChain as f, envStem as g, findChain as h, getChain as i, getRpcUrl as j, getRpcUrls as k, getWsUrls as l, listChains as m, redactRpcUrl as n, readEnv as r };
669
+ export type { ChainRef as C, Env as E, NativeCurrency as N, RpcOptions as R, ChainConfig as a, ChainKey as b, Ecosystem as c, RpcProvider as d };
package/dist/viem.cjs ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkN3OT5BNFcjs = require('./chunk-N3OT5BNF.cjs');
5
+
6
+ // src/viem.ts
7
+ var _viem = require('viem');
8
+ function viemChain(chain, opts = {}) {
9
+ const c = _chunkN3OT5BNFcjs.getChain.call(void 0, chain);
10
+ if (c.ecosystem !== "evm" || c.chainId === void 0) throw new Error(`viemChain: ${c.key} is not an EVM chain`);
11
+ const http2 = _chunkN3OT5BNFcjs.getRpcUrls.call(void 0, c, opts);
12
+ return _viem.defineChain.call(void 0, {
13
+ id: c.chainId,
14
+ name: c.name,
15
+ nativeCurrency: c.nativeCurrency,
16
+ rpcUrls: { default: { http: http2, ...c.wsUrls && { webSocket: [...c.wsUrls] } } },
17
+ ...c.explorer && { blockExplorers: { default: { name: c.explorer.name, url: c.explorer.url } } },
18
+ testnet: c.testnet
19
+ });
20
+ }
21
+ function viemTransport(chain, opts = {}) {
22
+ const urls = _chunkN3OT5BNFcjs.getRpcUrls.call(void 0, chain, opts);
23
+ const transports = urls.map((u) => _viem.http.call(void 0, u, opts.http));
24
+ return transports.length === 1 ? transports[0] : _viem.fallback.call(void 0, transports);
25
+ }
26
+
27
+
28
+
29
+ exports.viemChain = viemChain; exports.viemTransport = viemTransport;
30
+ //# sourceMappingURL=viem.cjs.map