@1delta/providers 0.0.39 → 0.0.41

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/dist/evm.js DELETED
@@ -1,813 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.plasma = exports.katana = void 0;
7
- exports.getEvmChain = getEvmChain;
8
- exports.createTransport = createTransport;
9
- exports.getTransport = getTransport;
10
- exports.getEvmClient = getEvmClient;
11
- exports.getEvmClientUniversal = getEvmClientUniversal;
12
- exports.createMulticallRetry = createMulticallRetry;
13
- exports.getEvmClientWithCustomRpcs = getEvmClientWithCustomRpcs;
14
- exports.getEvmClientWithCustomRpcsUniversal = getEvmClientWithCustomRpcsUniversal;
15
- exports.multicallRetry = multicallRetry;
16
- exports.multicallRetryUniversal = multicallRetryUniversal;
17
- const data_sdk_1 = require("@1delta/data-sdk");
18
- const chain_registry_1 = require("@1delta/chain-registry");
19
- const viem_1 = require("viem");
20
- const chains_1 = require("viem/chains");
21
- const lodash_1 = __importDefault(require("lodash"));
22
- // pull the functions you need
23
- const { uniq, isArray } = lodash_1.default;
24
- const crossfi = (0, viem_1.defineChain)({
25
- id: 4158,
26
- name: 'CrossFi Mainet',
27
- nativeCurrency: {
28
- decimals: 18,
29
- name: 'XFI',
30
- symbol: 'XFI',
31
- },
32
- rpcUrls: {
33
- default: {
34
- http: ['https://rpc.mainnet.ms/'],
35
- },
36
- },
37
- blockExplorers: {
38
- default: { name: 'Explorer', url: 'https://xfiscan.com/' },
39
- },
40
- // contracts: {
41
- // multicall3: {
42
- // address: "0xcA11bde05977b3631167028862bE2a173976CA11",
43
- // blockCreated: 1,
44
- // }
45
- // }
46
- });
47
- const botanix = (0, viem_1.defineChain)({
48
- id: 3637,
49
- name: 'Botanix',
50
- nativeCurrency: {
51
- decimals: 18,
52
- name: 'BTC',
53
- symbol: 'BTC',
54
- },
55
- rpcUrls: {
56
- default: {
57
- http: [
58
- 'https://rpc.ankr.com/botanix_mainnet',
59
- 'https://rpc.botanixlabs.com',
60
- ],
61
- },
62
- },
63
- blockExplorers: {
64
- default: { name: 'Explorer', url: 'https://botanixscan.io/' },
65
- },
66
- contracts: {
67
- multicall3: {
68
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
69
- blockCreated: 1,
70
- },
71
- },
72
- });
73
- const hyperEvm = (0, viem_1.defineChain)({
74
- id: 999,
75
- name: 'Hyper EVM',
76
- nativeCurrency: {
77
- decimals: 18,
78
- name: 'HYPE',
79
- symbol: 'HYPE',
80
- },
81
- rpcUrls: {
82
- default: {
83
- http: ['https://rpc.hyperliquid.xyz/evm'],
84
- },
85
- },
86
- blockExplorers: {
87
- default: { name: 'Explorer', url: 'https://hypurrscan.io/' },
88
- },
89
- contracts: {
90
- multicall3: {
91
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
92
- blockCreated: 1,
93
- },
94
- },
95
- });
96
- exports.katana = (0, viem_1.defineChain)({
97
- id: 747474,
98
- name: 'Katana',
99
- nativeCurrency: {
100
- decimals: 18,
101
- name: 'Ether',
102
- symbol: 'ETH',
103
- },
104
- rpcUrls: {
105
- default: {
106
- http: ['https://rpc.katana.network'],
107
- webSocket: [],
108
- },
109
- },
110
- blockExplorers: {
111
- default: { name: 'Explorer', url: 'https://katanascan.com/' },
112
- },
113
- contracts: {
114
- multicall3: {
115
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
116
- blockCreated: 0,
117
- },
118
- },
119
- });
120
- const GraphLinq = (0, viem_1.defineChain)({
121
- id: 614,
122
- name: 'GraphLinq Chain',
123
- nativeCurrency: {
124
- decimals: 18,
125
- name: 'GLQ',
126
- symbol: 'GLQ',
127
- },
128
- rpcUrls: {
129
- default: {
130
- http: ['https://glq-dataseed.graphlinq.io'],
131
- },
132
- },
133
- blockExplorers: {
134
- default: { name: 'Explorer', url: 'https://explorer.graphlinq.io' },
135
- },
136
- // contracts: {
137
- // multicall3: {
138
- // address: "0xcA11bde05977b3631167028862bE2a173976CA11",
139
- // blockCreated: 1,
140
- // }
141
- // }
142
- });
143
- const artela = (0, viem_1.defineChain)({
144
- id: 11820,
145
- name: 'Artela Mainnet',
146
- nativeCurrency: {
147
- decimals: 18,
148
- name: 'ART',
149
- symbol: 'ART',
150
- },
151
- rpcUrls: {
152
- default: {
153
- http: ['https://node-euro.artela.network/rpc'],
154
- },
155
- },
156
- blockExplorers: {
157
- default: { name: 'Explorer', url: 'https://artscan.artela.network' },
158
- },
159
- contracts: {
160
- multicall3: {
161
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
162
- blockCreated: 1,
163
- },
164
- },
165
- });
166
- exports.plasma = (0, viem_1.defineChain)({
167
- id: 9745,
168
- name: 'Plasma Mainnet',
169
- nativeCurrency: {
170
- decimals: 18,
171
- name: 'XPL',
172
- symbol: 'XPL',
173
- },
174
- rpcUrls: {
175
- default: {
176
- http: ['https://rpc.plasma.to'],
177
- },
178
- },
179
- blockExplorers: {
180
- default: { name: 'Explorer', url: ' https://plasmascan.to/' },
181
- },
182
- contracts: {
183
- multicall3: {
184
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
185
- blockCreated: 1,
186
- },
187
- },
188
- });
189
- function getEvmChain(chain) {
190
- switch (chain) {
191
- case chain_registry_1.Chain.ARBITRUM_ONE:
192
- return chains_1.arbitrum;
193
- case chain_registry_1.Chain.ETHEREUM_MAINNET:
194
- return chains_1.mainnet;
195
- case chain_registry_1.Chain.MANTLE:
196
- return chains_1.mantle;
197
- case chain_registry_1.Chain.BNB_SMART_CHAIN_MAINNET:
198
- return chains_1.bsc;
199
- case chain_registry_1.Chain.OPBNB_MAINNET:
200
- return chains_1.opBNB;
201
- case chain_registry_1.Chain.TAIKO_ALETHIA:
202
- return chains_1.taiko;
203
- case chain_registry_1.Chain.AVALANCHE_C_CHAIN:
204
- return chains_1.avalanche;
205
- case chain_registry_1.Chain.OP_MAINNET:
206
- return chains_1.optimism;
207
- case chain_registry_1.Chain.METIS_ANDROMEDA_MAINNET:
208
- return chains_1.metis;
209
- case chain_registry_1.Chain.POLYGON_MAINNET:
210
- return chains_1.polygon;
211
- case chain_registry_1.Chain.ZKSYNC_MAINNET:
212
- return chains_1.zksync;
213
- case chain_registry_1.Chain.SCROLL:
214
- return chains_1.scroll;
215
- case chain_registry_1.Chain.GNOSIS:
216
- return chains_1.gnosis;
217
- case chain_registry_1.Chain.BASE:
218
- return chains_1.base;
219
- case chain_registry_1.Chain.BLAST:
220
- return chains_1.blast;
221
- case chain_registry_1.Chain.KAIA_MAINNET:
222
- return chains_1.kaia;
223
- case chain_registry_1.Chain.FANTOM_OPERA:
224
- return chains_1.fantom;
225
- case chain_registry_1.Chain.SONIC_MAINNET:
226
- return chains_1.sonic;
227
- case chain_registry_1.Chain.LINEA:
228
- return chains_1.linea;
229
- case chain_registry_1.Chain.HEMI_NETWORK:
230
- return {
231
- ...chains_1.hemi,
232
- contracts: {
233
- multicall3: {
234
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
235
- blockCreated: 1,
236
- },
237
- },
238
- };
239
- case chain_registry_1.Chain.NEON_EVM_MAINNET:
240
- return chains_1.neonMainnet;
241
- case chain_registry_1.Chain.DEGEN_CHAIN:
242
- return {
243
- ...chains_1.degen,
244
- contracts: {
245
- multicall3: {
246
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
247
- blockCreated: 1,
248
- },
249
- },
250
- };
251
- case chain_registry_1.Chain.GRAVITY_ALPHA_MAINNET:
252
- return chains_1.gravity;
253
- case chain_registry_1.Chain.LIGHTLINK_PHOENIX_MAINNET:
254
- return chains_1.lightlinkPhoenix;
255
- case chain_registry_1.Chain.PLUME_MAINNET:
256
- return chains_1.plume;
257
- case chain_registry_1.Chain.ABSTRACT:
258
- return chains_1.abstract;
259
- case chain_registry_1.Chain.PEAQ:
260
- return chains_1.peaq;
261
- case chain_registry_1.Chain.EVM_ON_FLOW:
262
- return chains_1.flowMainnet;
263
- case chain_registry_1.Chain.SONEIUM:
264
- return chains_1.soneium;
265
- case chain_registry_1.Chain.GOAT_NETWORK:
266
- return chains_1.goat;
267
- case chain_registry_1.Chain.BERACHAIN:
268
- return chains_1.berachain;
269
- case chain_registry_1.Chain.ROOTSTOCK_MAINNET:
270
- return chains_1.rootstock;
271
- case chain_registry_1.Chain.VANAR_MAINNET:
272
- return chains_1.vanar;
273
- case chain_registry_1.Chain.INK:
274
- return {
275
- ...chains_1.ink,
276
- contracts: {
277
- multicall3: {
278
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
279
- blockCreated: 1,
280
- },
281
- },
282
- };
283
- case chain_registry_1.Chain.FUSE_MAINNET:
284
- return chains_1.fuse;
285
- case chain_registry_1.Chain.SUPERPOSITION:
286
- return chains_1.superposition;
287
- case chain_registry_1.Chain.STORY:
288
- return {
289
- ...chains_1.story,
290
- contracts: {
291
- multicall3: {
292
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
293
- blockCreated: 1,
294
- },
295
- },
296
- };
297
- case chain_registry_1.Chain.APECHAIN:
298
- return chains_1.apeChain;
299
- case chain_registry_1.Chain.IOTEX_NETWORK_MAINNET:
300
- return chains_1.iotex;
301
- case chain_registry_1.Chain.TELOS_EVM_MAINNET:
302
- return chains_1.telos;
303
- case chain_registry_1.Chain.FLARE_MAINNET:
304
- return chains_1.flare;
305
- case chain_registry_1.Chain.AURA_MAINNET:
306
- return chains_1.aurora;
307
- case chain_registry_1.Chain.KAVA:
308
- return chains_1.kava;
309
- case chain_registry_1.Chain.IOTA_EVM:
310
- return chains_1.iota;
311
- case chain_registry_1.Chain.AURORA_MAINNET:
312
- return chains_1.aurora;
313
- case chain_registry_1.Chain.UNICHAIN:
314
- return chains_1.unichain;
315
- case chain_registry_1.Chain.CORE_BLOCKCHAIN_MAINNET:
316
- return chains_1.coreDao;
317
- case chain_registry_1.Chain.MODE:
318
- return chains_1.mode;
319
- case chain_registry_1.Chain.CORN:
320
- return chains_1.corn;
321
- case chain_registry_1.Chain.BOB:
322
- return chains_1.bob;
323
- case chain_registry_1.Chain.RONIN_MAINNET:
324
- return chains_1.ronin;
325
- case chain_registry_1.Chain.MANTA_PACIFIC_MAINNET:
326
- return chains_1.manta;
327
- case chain_registry_1.Chain.ZIRCUIT_MAINNET:
328
- return chains_1.zircuit;
329
- case chain_registry_1.Chain.GRAPHLINQ_BLOCKCHAIN_MAINNET:
330
- return GraphLinq;
331
- case chain_registry_1.Chain.ZETACHAIN_MAINNET:
332
- return chains_1.zetachain;
333
- case chain_registry_1.Chain.BITLAYER_MAINNET:
334
- return chains_1.bitlayer;
335
- case chain_registry_1.Chain.CROSSFI_MAINNET:
336
- return crossfi;
337
- case chain_registry_1.Chain.INEVM_MAINNET:
338
- return chains_1.inEVM;
339
- case chain_registry_1.Chain.XDC_NETWORK:
340
- return chains_1.xdc;
341
- case chain_registry_1.Chain.CRONOS_MAINNET:
342
- return chains_1.cronos;
343
- case chain_registry_1.Chain.CRONOS_ZKEVM_MAINNET:
344
- return chains_1.cronoszkEVM;
345
- case chain_registry_1.Chain.B2_MAINNET:
346
- return {
347
- ...chains_1.bsquared,
348
- contracts: {
349
- multicall3: {
350
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
351
- blockCreated: 1,
352
- },
353
- },
354
- };
355
- case chain_registry_1.Chain.SEI_NETWORK:
356
- return chains_1.sei;
357
- case chain_registry_1.Chain.MERLIN_MAINNET:
358
- return {
359
- ...chains_1.merlin,
360
- contracts: {
361
- multicall3: {
362
- address: '0x46063722c010AF39E465d286B84936A12aFb81F0',
363
- blockCreated: 1,
364
- },
365
- },
366
- };
367
- case chain_registry_1.Chain.X_LAYER_MAINNET:
368
- return chains_1.xLayer;
369
- case chain_registry_1.Chain.CELO_MAINNET:
370
- return chains_1.celo;
371
- case chain_registry_1.Chain.BOTANIX_MAINNET:
372
- return botanix;
373
- case chain_registry_1.Chain.HARMONY_MAINNET_SHARD_0:
374
- return chains_1.harmonyOne;
375
- case chain_registry_1.Chain.HYPEREVM:
376
- return hyperEvm;
377
- case chain_registry_1.Chain.KATANA:
378
- return exports.katana;
379
- case chain_registry_1.Chain.TARAXA_MAINNET:
380
- return chains_1.taraxa;
381
- case chain_registry_1.Chain.METER_MAINNET:
382
- return {
383
- ...chains_1.meter,
384
- contracts: {
385
- multicall3: {
386
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
387
- blockCreated: 1,
388
- },
389
- },
390
- };
391
- case chain_registry_1.Chain.ARTELA_MAINNET:
392
- return artela;
393
- case chain_registry_1.Chain.MORPH:
394
- return chains_1.morph;
395
- case chain_registry_1.Chain.VANA:
396
- return chains_1.vana;
397
- // case Chain.RARI_CHAIN_MAINNET:
398
- // return rariChain
399
- // case Chain.GLUE_MAINNET:
400
- // return glue
401
- case chain_registry_1.Chain.PULSECHAIN:
402
- return chains_1.pulsechain;
403
- case chain_registry_1.Chain.PLASMA_MAINNET:
404
- return exports.plasma;
405
- case chain_registry_1.Chain.MOONBEAM:
406
- return chains_1.moonbeam;
407
- case chain_registry_1.Chain.ZKLINK_NOVA_MAINNET:
408
- return {
409
- ...chains_1.zkLinkNova,
410
- contracts: {
411
- multicall3: {
412
- address: '0x825267E0fA5CAe92F98540828a54198dcB3Eaeb5',
413
- blockCreated: 1,
414
- },
415
- },
416
- };
417
- // case Chain.AILAYER_MAINNET:
418
- // return ailayer
419
- default:
420
- throw new Error('Not in VIEM: ' + chain);
421
- }
422
- }
423
- /**
424
- * Get correct transport according to the input url with optional config
425
- */
426
- function createTransport(url, config) {
427
- if (!url)
428
- throw new Error('URL is required for transport');
429
- if (url.startsWith('wss://')) {
430
- return (0, viem_1.webSocket)(url, config);
431
- }
432
- return (0, viem_1.http)(url, config);
433
- }
434
- /**
435
- * Get correct transport according to the input url
436
- */
437
- function getTransport(url) {
438
- return createTransport(url);
439
- }
440
- const LIST_OVERRIDES = {
441
- [chain_registry_1.Chain.BASE]: [
442
- 'https://base-rpc.publicnode.com',
443
- 'https://base.llamarpc.com',
444
- // 'https://base-mainnet.diamondswap.org/rpc',
445
- 'https://base.public.blockpi.network/v1/rpc/public',
446
- 'https://1rpc.io/base',
447
- 'https://base-pokt.nodies.app',
448
- 'https://base.meowrpc.com',
449
- // 'https://base.gateway.tenderly.co',
450
- // 'https://gateway.tenderly.co/public/base',
451
- // 'https://rpc.notadegen.com/base',
452
- 'https://developer-access-mainnet.base.org',
453
- 'https://base.drpc.org',
454
- 'https://base.api.onfinality.io/public',
455
- // 'https://public.stackup.sh/api/v1/node/base-mainnet',
456
- // 'https://base-mainnet.gateway.tatum.io', // 5 req per min is too low
457
- 'https://base.rpc.subquery.network/public',
458
- 'https://api.zan.top/base-mainnet',
459
- 'https://endpoints.omniatech.io/v1/base/mainnet/public',
460
- 'https://base.lava.build',
461
- // 'https://rpc.numa.network/base',
462
- 'https://0xrpc.io/base',
463
- 'https://base.therpc.io',
464
- ],
465
- [chain_registry_1.Chain.POLYGON_MAINNET]: [
466
- 'https://polygon-bor-rpc.publicnode.com',
467
- 'https://polygon.lava.build',
468
- 'https://polygon.drpc.org',
469
- 'https://gateway.tenderly.co/public/polygon',
470
- // 'https://polygon-mainnet.gateway.tatum.io',
471
- 'https://endpoints.omniatech.io/v1/matic/mainnet/public',
472
- 'https://polygon.therpc.io',
473
- 'https://rpc-mainnet.matic.quiknode.pro',
474
- 'https://polygon-pokt.nodies.app',
475
- 'https://polygon.gateway.tenderly.co',
476
- 'https://polygon-rpc.com',
477
- 'https://polygon.api.onfinality.io/public',
478
- 'https://api.zan.top/polygon-mainnet',
479
- // 'https://1rpc.io/matic',
480
- 'https://polygon.rpc.subquery.network/public',
481
- 'https://polygon-mainnet.nodereal.io/v1/f510fc4d083b49d1ab383d25246cc7de',
482
- 'wss://polygon-mainnet.nodereal.io/ws/v1/f510fc4d083b49d1ab383d25246cc7de',
483
- ],
484
- [chain_registry_1.Chain.HEMI_NETWORK]: [
485
- 'https://rpc.hemi.network/rpc',
486
- // 'https://hemi.drpc.org'
487
- ],
488
- [chain_registry_1.Chain.MANTLE]: [
489
- 'https://rpc.mantle.xyz',
490
- 'https://1rpc.io/mantle',
491
- 'https://api.zan.top/mantle-mainnet',
492
- 'https://mantle-public.nodies.app',
493
- 'https://mantle.drpc.org',
494
- ],
495
- [chain_registry_1.Chain.XDC_NETWORK]: [
496
- 'https://rpc.ankr.com/xdc',
497
- 'https://earpc.xinfin.network',
498
- 'https://rpc.xinfin.network',
499
- 'https://rpc.xdc.org',
500
- 'https://rpc.xdc.network',
501
- 'https://erpc.xdcrpc.com',
502
- ],
503
- [chain_registry_1.Chain.ETHEREUM_MAINNET]: [
504
- 'https://eth.llamarpc.com',
505
- 'https://api.zan.top/eth-mainnet',
506
- 'https://rpc.flashbots.net/fast',
507
- 'https://rpc.owlracle.info/eth/70d38ce1826c4a60bb2a8e05a6c8b20f',
508
- 'https://eth.merkle.io',
509
- 'https://eth-mainnet.nodereal.io/v1/1659dfb40aa24bbb8153a677b98064d7',
510
- 'wss://eth-mainnet.nodereal.io/ws/v1/1659dfb40aa24bbb8153a677b98064d7',
511
- 'https://rpc.payload.de',
512
- 'https://ethereum-rpc.publicnode.com',
513
- 'https://eth-mainnet.g.alchemy.com/v2/demo',
514
- 'https://go.getblock.io/aefd01aa907c4805ba3c00a9e5b48c6b',
515
- 'https://rpc.flashbots.net',
516
- 'https://public-eth.nownodes.io',
517
- 'https://ethereum-json-rpc.stakely.io',
518
- 'https://eth.blockrazor.xyz',
519
- 'https://eth.drpc.org',
520
- 'https://ethereum.public.blockpi.network/v1/rpc/public',
521
- 'https://ethereum-public.nodies.app',
522
- 'https://0xrpc.io/eth',
523
- ],
524
- [chain_registry_1.Chain.PLASMA_MAINNET]: ['https://rpc.plasma.to', 'https://plasma.drpc.org'],
525
- [chain_registry_1.Chain.SCROLL]: [
526
- 'https://rpc.scroll.io',
527
- 'https://1rpc.io/scroll',
528
- 'https://scroll.drpc.org',
529
- 'https://scroll.api.onfinality.io/public',
530
- 'https://endpoints.omniatech.io/v1/scroll/mainnet/public',
531
- 'https://scroll-rpc.publicnode.com',
532
- 'https://scroll.therpc.io',
533
- ],
534
- [chain_registry_1.Chain.SONIC_MAINNET]: [
535
- 'https://sonic.api.onfinality.io/public',
536
- 'https://sonic-rpc.publicnode.com',
537
- 'https://rpc.soniclabs.com',
538
- 'https://sonic.therpc.io',
539
- 'https://sonic.drpc.org',
540
- 'https://sonic-json-rpc.stakely.io',
541
- ],
542
- [chain_registry_1.Chain.KAIA_MAINNET]: [
543
- // 'https://go.getblock.io/d7094dbd80ab474ba7042603fe912332',
544
- 'https://public-en.node.kaia.io',
545
- 'https://klaytn.api.onfinality.io/public',
546
- 'https://kaia-mainnet.gateway.tatum.io',
547
- 'https://kaia-public.nodies.app',
548
- 'https://kaia.blockpi.network/v1/rpc/public',
549
- 'https://rpc.ankr.com/kaia',
550
- 'https://klaytn.drpc.org',
551
- 'https://1rpc.io/klay',
552
- ],
553
- [chain_registry_1.Chain.MOONBEAM]: [
554
- 'https://moonbeam.unitedbloc.com',
555
- 'https://1rpc.io/glmr',
556
- 'https://moonbeam-rpc.dwellir.com',
557
- 'https://moonbeam-rpc.publicnode.com',
558
- 'https://moonbeam.drpc.org',
559
- 'https://endpoints.omniatech.io/v1/moonbeam/mainnet/public',
560
- 'https://rpc.api.moonbeam.network',
561
- 'https://rpc.poolz.finance/moonbeam',
562
- 'https://moonbeam.rpc.grove.city/v1/01fdb492',
563
- 'https://moonbeam.api.onfinality.io/public',
564
- ],
565
- [chain_registry_1.Chain.OP_MAINNET]: [
566
- 'https://optimism.public.blockpi.network/v1/rpc/public',
567
- 'https://optimism-rpc.publicnode.com',
568
- 'https://optimism.drpc.org',
569
- 'https://0xrpc.io/op',
570
- 'https://1rpc.io/op',
571
- 'wss://optimism-rpc.publicnode.com',
572
- 'wss://0xrpc.io/op',
573
- 'wss://optimism.drpc.org',
574
- 'https://optimism.api.onfinality.io/public',
575
- 'https://api.zan.top/opt-mainnet',
576
- ],
577
- [chain_registry_1.Chain.BNB_SMART_CHAIN_MAINNET]: [
578
- 'https://bsc-dataseed.bnbchain.org',
579
- 'https://binance.nodereal.io',
580
- 'https://bsc-mainnet.nodereal.io/v1/64a9df0874fb4a93b9d0a3849de012d3',
581
- 'wss://bsc-mainnet.nodereal.io/ws/v1/64a9df0874fb4a93b9d0a3849de012d3',
582
- 'https://bsc-dataseed.binance.org',
583
- 'https://bsc-dataseed1.binance.org',
584
- 'https://bsc-dataseed1.defibit.io',
585
- 'https://bsc-dataseed2.defibit.io',
586
- 'https://bsc-dataseed3.defibit.io',
587
- 'https://bsc-dataseed4.defibit.io',
588
- 'https://1rpc.io/bnb',
589
- 'https://bsc-rpc.publicnode.com',
590
- 'https://bsc.drpc.org',
591
- 'https://bsc.api.onfinality.io/public',
592
- ],
593
- [chain_registry_1.Chain.ARBITRUM_ONE]: [
594
- 'https://arb1.lava.build',
595
- 'https://arb1.arbitrum.io/rpc',
596
- 'https://arbitrum-one-rpc.publicnode.com',
597
- 'https://arbitrum.drpc.org',
598
- 'https://arbitrum.public.blockpi.network/v1/rpc/public',
599
- 'https://1rpc.io/arb',
600
- 'https://arbitrum.api.onfinality.io/public',
601
- 'https://0xrpc.io/arb',
602
- 'https://arbitrum.therpc.io',
603
- ],
604
- [chain_registry_1.Chain.LINEA]: [
605
- 'https://rpc.linea.build',
606
- 'https://1rpc.io/linea',
607
- 'https://linea.drpc.org',
608
- 'https://linea-rpc.publicnode.com',
609
- 'https://linea.decubate.com',
610
- 'https://linea.api.onfinality.io/public',
611
- ],
612
- [chain_registry_1.Chain.AVALANCHE_C_CHAIN]: [
613
- 'https://avalanche.drpc.org',
614
- 'https://1rpc.io/avax/c',
615
- 'https://avalanche-c-chain-rpc.publicnode.com',
616
- 'https://avalanche.api.onfinality.io/public/ext/bc/C/rpc',
617
- 'https://api.avax.network/ext/bc/C/rpc',
618
- 'https://avalanche.public-rpc.com',
619
- 'https://avax-rpc.gateway.pokt.network',
620
- ],
621
- [chain_registry_1.Chain.CELO_MAINNET]: [
622
- 'https://forno.celo.org',
623
- 'https://1rpc.io/celo',
624
- 'https://celo.drpc.org',
625
- 'https://celo-rpc.publicnode.com',
626
- ],
627
- [chain_registry_1.Chain.BLAST]: [
628
- 'https://rpc.blast.io',
629
- 'https://blast.drpc.org',
630
- 'https://blast-rpc.publicnode.com',
631
- ],
632
- [chain_registry_1.Chain.TAIKO_ALETHIA]: [
633
- 'https://rpc.taiko.xyz',
634
- 'https://rpc.ankr.com/taiko',
635
- 'https://rpc.mainnet.taiko.xyz',
636
- 'https://taiko-rpc.publicnode.com',
637
- ],
638
- [chain_registry_1.Chain.GNOSIS]: [
639
- 'https://gnosis.oat.farm',
640
- 'https://rpc.gnosischain.com',
641
- 'https://gnosis.drpc.org',
642
- 'https://gnosis-rpc.publicnode.com',
643
- 'https://1rpc.io/gnosis',
644
- ],
645
- [chain_registry_1.Chain.CORE_BLOCKCHAIN_MAINNET]: [
646
- 'https://rpc.coredao.org',
647
- 'https://core.drpc.org',
648
- 'https://core-rpc.publicnode.com',
649
- ],
650
- [chain_registry_1.Chain.MODE]: [
651
- 'https://mainnet.mode.network',
652
- 'https://mode.drpc.org',
653
- 'https://mode-rpc.publicnode.com',
654
- ],
655
- [chain_registry_1.Chain.METIS_ANDROMEDA_MAINNET]: [
656
- 'https://andromeda.metis.io/?owner=1088',
657
- 'https://metis.drpc.org',
658
- 'https://metis-rpc.publicnode.com',
659
- 'https://metis.api.onfinality.io/public',
660
- ],
661
- [chain_registry_1.Chain.FANTOM_OPERA]: [
662
- 'https://rpc.fantom.network',
663
- 'https://fantom.drpc.org',
664
- 'https://fantom-rpc.publicnode.com',
665
- 'https://1rpc.io/ftm',
666
- 'https://fantom.api.onfinality.io/public',
667
- ],
668
- [chain_registry_1.Chain.OPBNB_MAINNET]: [
669
- 'https://opbnb-mainnet.nodereal.io/v1/64a9df0874fb4a93b9d0a3849de012d3',
670
- 'wss://opbnb-mainnet.nodereal.io/ws/v1/64a9df0874fb4a93b9d0a3849de012d3',
671
- ],
672
- [chain_registry_1.Chain.X_LAYER_MAINNET]: ['https://xlayerrpc.okx.com'],
673
- [chain_registry_1.Chain.MANTA_PACIFIC_MAINNET]: [
674
- 'https://manta.nirvanalabs.xyz/mantapublic',
675
- 'https://manta-pacific-gascap.calderachain.xyz/http',
676
- 'https://manta-pacific.calderachain.xyz/http',
677
- 'https://pacific-rpc.manta.network/http',
678
- 'https://r1.pacific.manta.systems/http',
679
- 'wss://manta-pacific.calderachain.xyz/ws',
680
- 'https://1rpc.io/manta',
681
- ],
682
- [chain_registry_1.Chain.SEI_NETWORK]: [
683
- 'https://evm-rpc.sei-apis.com',
684
- 'https://sei.drpc.org',
685
- 'https://sei-evm-rpc.stakeme.pro',
686
- 'https://sei-public.nodies.app',
687
- 'wss://sei.drpc.org',
688
- 'wss://evm-ws.sei-apis.com',
689
- ],
690
- };
691
- function trimTrailingSlash(url) {
692
- if (!url)
693
- return undefined;
694
- return url.endsWith('/') ? url.slice(0, -1) : url;
695
- }
696
- function getEvmClientInternal(chain, rpcId = 0) {
697
- const chainInfo = getEvmChain(chain);
698
- let rpc;
699
- if (rpcId === 0)
700
- // use base one - or use override if not available
701
- rpc = chainInfo.rpcUrls.default.http[0] ?? LIST_OVERRIDES[chain]?.[0];
702
- else {
703
- const rpcsChain = LIST_OVERRIDES[chain] ?? (0, data_sdk_1.chains)()?.[chain]?.rpc;
704
- const rpcs = chainInfo.rpcUrls.default.http.map((a) => trimTrailingSlash(a));
705
- const rpcsAdded = rpcsChain.map((a) => trimTrailingSlash(a));
706
- const allRpcs = uniq([...rpcsAdded, ...rpcs]);
707
- const currId = Math.min(allRpcs.length - 1, rpcId);
708
- rpc = allRpcs[currId];
709
- }
710
- if (!rpc)
711
- throw new Error('Failed to get RPC at index ' + rpcId + ' for ' + chain);
712
- return (0, viem_1.createPublicClient)({
713
- chain: chainInfo,
714
- transport: createTransport(rpc),
715
- });
716
- }
717
- /**
718
- * @deprecated Use getEvmClientUniversal instead
719
- */
720
- function getEvmClient(chain, rpcId = 0) {
721
- return getEvmClientInternal(chain, rpcId);
722
- }
723
- function getEvmClientUniversal({ chain, rpcId = 0, }) {
724
- return getEvmClientInternal(chain, rpcId);
725
- }
726
- const DEFAULT_BATCH_SIZE = 4096;
727
- function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
728
- return async function multicallRetry(chain, calls, abi, batchSize = DEFAULT_BATCH_SIZE, maxRetries = 3, providerId = 0, allowFailure = true, logErrors = false) {
729
- try {
730
- const provider = getEvmClientWithCustomRpcs(chain, providerId, customRpcs);
731
- const abiIsArray = isArray(abi[0]);
732
- const data = await provider.multicall({
733
- batchSize,
734
- contracts: calls.map((call, i) => ({
735
- abi: abiIsArray ? abi?.[i] : abi,
736
- address: call.address,
737
- functionName: call.name,
738
- // @ts-ignore
739
- args: call.args ?? call.params ?? [],
740
- })),
741
- allowFailure,
742
- });
743
- if (allowFailure) {
744
- return data.map(({ result, status }) => status !== 'success' ? '0x' : result);
745
- }
746
- return data;
747
- }
748
- catch (e) {
749
- // error if max retries achieved
750
- if (maxRetries === 0)
751
- throw e;
752
- if (logErrors)
753
- console.log(e);
754
- return await multicallRetry(chain, calls, abi, batchSize, maxRetries - 1, providerId + 1, false, logErrors);
755
- }
756
- };
757
- }
758
- function getEvmClientWithCustomRpcsInternal(chain, rpcId = 0, customRpcs = LIST_OVERRIDES) {
759
- const chainInfo = getEvmChain(chain);
760
- let rpc;
761
- if (customRpcs && customRpcs[chain]) {
762
- // Use custom RPC list if any (make sure that they are unique and valid)
763
- const customRpcList = uniq(customRpcs[chain]
764
- .filter(Boolean) // Remove empty ones
765
- .map((url) => trimTrailingSlash(url))
766
- .filter((url) => Boolean(url)));
767
- if (customRpcList.length === 0) {
768
- throw new Error(`No valid custom RPCs provided for chain ${chain}`);
769
- }
770
- rpc = customRpcList[rpcId % customRpcList.length];
771
- }
772
- else {
773
- // Fallback to existing logic
774
- if (rpcId === 0)
775
- rpc = chainInfo.rpcUrls.default.http[0] ?? LIST_OVERRIDES[chain]?.[0];
776
- else {
777
- const rpcsChain = (0, data_sdk_1.chains)()?.[chain]?.rpc;
778
- const rpcs = chainInfo.rpcUrls.default.http.map((a) => trimTrailingSlash(a));
779
- const rpcsAdded = rpcsChain?.map((a) => trimTrailingSlash(a));
780
- const allRpcs = uniq([...rpcs, ...rpcsAdded]);
781
- const currId = Math.min(allRpcs.length - 1, rpcId);
782
- rpc = allRpcs[currId];
783
- }
784
- }
785
- if (!rpc)
786
- throw new Error('Failed to get RPC at index ' + rpcId + ' for ' + chain);
787
- return (0, viem_1.createPublicClient)({
788
- chain: chainInfo,
789
- transport: createTransport(rpc),
790
- });
791
- }
792
- /**
793
- * @deprecated Use getEvmClientWithCustomRpcsUniversal instead
794
- */
795
- function getEvmClientWithCustomRpcs(chain, rpcId = 0, customRpcs = LIST_OVERRIDES) {
796
- return getEvmClientWithCustomRpcsInternal(chain, rpcId, customRpcs);
797
- }
798
- function getEvmClientWithCustomRpcsUniversal({ chain, rpcId = 0, customRpcs = LIST_OVERRIDES, }) {
799
- return getEvmClientWithCustomRpcsInternal(chain, rpcId, customRpcs);
800
- }
801
- async function multicallRetryInternal(chain, calls, abi, batchSize = DEFAULT_BATCH_SIZE, maxRetries = 5, providerId = 0, allowFailure = false, overrdies = LIST_OVERRIDES, logErrors = false) {
802
- const defaultMulticallRetry = createMulticallRetry(overrdies);
803
- return defaultMulticallRetry(chain, calls, abi, batchSize, maxRetries, providerId, allowFailure, logErrors);
804
- }
805
- /**
806
- * @deprecated Use multicallRetryUniversal instead
807
- */
808
- async function multicallRetry(chain, calls, abi, batchSize = DEFAULT_BATCH_SIZE, maxRetries = 5, providerId = 0, allowFailure = false, overrdies = LIST_OVERRIDES, logErrors = false) {
809
- return multicallRetryInternal(chain, calls, abi, batchSize, maxRetries, providerId, allowFailure, overrdies, logErrors);
810
- }
811
- async function multicallRetryUniversal({ chain, calls, abi, batchSize = DEFAULT_BATCH_SIZE, maxRetries = 5, providerId = 0, allowFailure = false, overrdies = LIST_OVERRIDES, logErrors = false, }) {
812
- return multicallRetryInternal(chain, calls, abi, batchSize, maxRetries, providerId, allowFailure, overrdies, logErrors);
813
- }