viem 0.0.1-alpha.19 → 0.0.1-alpha.20

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.
Files changed (151) hide show
  1. package/dist/{rpc-858670f1.d.ts → chain-32f56cfa.d.ts} +68 -18
  2. package/dist/chain-f12cdc7f.d.ts +5 -0
  3. package/dist/chains.d.ts +757 -170
  4. package/dist/chains.js +80 -86
  5. package/dist/chains.js.map +1 -1
  6. package/dist/chains.mjs +120 -126
  7. package/dist/chains.mjs.map +1 -1
  8. package/dist/{chunk-PHSAQQGZ.mjs → chunk-5Q6FSUU2.mjs} +75 -37
  9. package/dist/chunk-5Q6FSUU2.mjs.map +1 -0
  10. package/dist/{chunk-24EKKMUO.js → chunk-FHXXG7I6.js} +12 -12
  11. package/dist/chunk-FHXXG7I6.js.map +1 -0
  12. package/dist/{chunk-HRE6LYF3.js → chunk-IAQPMSGJ.js} +13 -13
  13. package/dist/chunk-IAQPMSGJ.js.map +1 -0
  14. package/dist/{chunk-IVWG22RQ.mjs → chunk-MYQNZSWD.mjs} +69 -12
  15. package/dist/chunk-MYQNZSWD.mjs.map +1 -0
  16. package/dist/{chunk-NYMS65YI.js → chunk-NHAKUPTF.js} +124 -67
  17. package/dist/chunk-NHAKUPTF.js.map +1 -0
  18. package/dist/{chunk-BZFF747V.js → chunk-SF4I2NKC.js} +81 -43
  19. package/dist/chunk-SF4I2NKC.js.map +1 -0
  20. package/dist/{chunk-VAT5CEF7.mjs → chunk-T7CBAKLI.mjs} +2 -2
  21. package/dist/chunk-T7CBAKLI.mjs.map +1 -0
  22. package/dist/{chunk-CTU4PQLY.js → chunk-YFKR74XG.js} +14 -14
  23. package/dist/{chunk-CTU4PQLY.js.map → chunk-YFKR74XG.js.map} +0 -0
  24. package/dist/{chunk-NSRORL3O.mjs → chunk-YODUQCHJ.mjs} +2 -2
  25. package/dist/{chunk-NSRORL3O.mjs.map → chunk-YODUQCHJ.mjs.map} +0 -0
  26. package/dist/{chunk-E7LH5H76.mjs → chunk-ZVGTYLKU.mjs} +2 -2
  27. package/dist/chunk-ZVGTYLKU.mjs.map +1 -0
  28. package/dist/clients/index.d.ts +7 -8
  29. package/dist/clients/index.js +3 -3
  30. package/dist/clients/index.mjs +2 -2
  31. package/dist/{transactionReceipt-aed524b4.d.ts → contract-9af4608b.d.ts} +30 -18
  32. package/dist/{createClient-03ba79e8.d.ts → createClient-5d316c7e.d.ts} +2 -2
  33. package/dist/{createPublicClient-818241ba.d.ts → createPublicClient-9d2b42e1.d.ts} +3 -3
  34. package/dist/{createTestClient-24eb7be8.d.ts → createTestClient-79498dab.d.ts} +3 -3
  35. package/dist/{createWalletClient-7cbd6ad1.d.ts → createWalletClient-f69a5230.d.ts} +3 -3
  36. package/dist/{eip1193-71d8e27d.d.ts → eip1193-6c485d63.d.ts} +1 -1
  37. package/dist/index.d.ts +45 -23
  38. package/dist/index.js +10 -6
  39. package/dist/index.mjs +9 -5
  40. package/dist/{parseGwei-dbd12305.d.ts → parseGwei-4308ad80.d.ts} +17 -4
  41. package/dist/public.d.ts +9 -10
  42. package/dist/public.js +4 -4
  43. package/dist/public.mjs +3 -3
  44. package/dist/{sendTransaction-d09961a7.d.ts → sendTransaction-1c8290a9.d.ts} +3 -4
  45. package/dist/{stopImpersonatingAccount-c8a00be7.d.ts → stopImpersonatingAccount-7781842a.d.ts} +2 -2
  46. package/dist/test.d.ts +5 -6
  47. package/dist/test.js +3 -3
  48. package/dist/test.mjs +2 -2
  49. package/dist/transactionRequest-341b6ed2.d.ts +15 -0
  50. package/dist/utils/index.d.ts +9 -8
  51. package/dist/utils/index.js +22 -2
  52. package/dist/utils/index.mjs +25 -5
  53. package/dist/wallet.d.ts +7 -8
  54. package/dist/wallet.js +3 -3
  55. package/dist/wallet.mjs +2 -2
  56. package/dist/{watchAsset-c39645b7.d.ts → watchAsset-afaad3c7.d.ts} +3 -4
  57. package/dist/{watchPendingTransactions-01e6be4f.d.ts → watchPendingTransactions-3b722547.d.ts} +21 -16
  58. package/dist/{webSocket-3a00015b.d.ts → webSocket-b180e679.d.ts} +2 -2
  59. package/dist/window.d.ts +3 -2
  60. package/package.json +3 -3
  61. package/src/_test/abis.ts +188 -0
  62. package/src/_test/constants.ts +0 -3
  63. package/src/_test/index.ts +5 -2
  64. package/src/actions/index.test.ts +2 -0
  65. package/src/actions/index.ts +6 -0
  66. package/src/actions/public/call.ts +2 -1
  67. package/src/actions/public/createContractEventFilter.test.ts +119 -0
  68. package/src/actions/public/createContractEventFilter.ts +69 -0
  69. package/src/actions/public/createEventFilter.ts +5 -8
  70. package/src/actions/public/deployContract.ts +1 -2
  71. package/src/actions/public/getBlock.test.ts +3 -3
  72. package/src/actions/public/getBlock.ts +1 -2
  73. package/src/actions/public/getBlockTransactionCount.ts +1 -2
  74. package/src/actions/public/getFilterChanges.test.ts +9 -7
  75. package/src/actions/public/getFilterLogs.test.ts +7 -5
  76. package/src/actions/public/getLogs.test.ts +7 -5
  77. package/src/actions/public/getLogs.ts +3 -2
  78. package/src/actions/public/getTransaction.ts +1 -2
  79. package/src/actions/public/getTransactionConfirmations.ts +1 -2
  80. package/src/actions/public/getTransactionReceipt.test.ts +24 -62
  81. package/src/actions/public/getTransactionReceipt.ts +1 -2
  82. package/src/actions/public/index.test.ts +4 -0
  83. package/src/actions/public/index.ts +18 -0
  84. package/src/actions/public/readContract.ts +1 -1
  85. package/src/actions/public/simulateContract.ts +1 -1
  86. package/src/actions/public/waitForTransactionReceipt.ts +1 -2
  87. package/src/actions/public/watchBlocks.test.ts +27 -2
  88. package/src/actions/public/watchBlocks.ts +33 -14
  89. package/src/actions/public/watchContractEvent.test.ts +301 -0
  90. package/src/actions/public/watchContractEvent.ts +108 -0
  91. package/src/actions/public/watchEvent.test.ts +190 -0
  92. package/src/actions/public/watchEvent.ts +95 -0
  93. package/src/actions/public/watchPendingTransactions.ts +1 -0
  94. package/src/actions/wallet/addChain.ts +1 -1
  95. package/src/actions/wallet/sendTransaction.ts +2 -1
  96. package/src/actions/wallet/switchChain.ts +1 -1
  97. package/src/actions/wallet/writeContract.ts +1 -1
  98. package/src/chains.test.ts +830 -52
  99. package/src/chains.ts +90 -158
  100. package/src/clients/createClient.ts +1 -1
  101. package/src/clients/createPublicClient.ts +1 -1
  102. package/src/clients/createTestClient.ts +1 -1
  103. package/src/clients/createWalletClient.ts +1 -1
  104. package/src/clients/transports/createTransport.ts +1 -1
  105. package/src/index.test.ts +2 -0
  106. package/src/index.ts +10 -2
  107. package/src/types/chain.ts +6 -0
  108. package/src/types/contract.ts +17 -2
  109. package/src/types/formatter.ts +23 -0
  110. package/src/types/index.ts +6 -0
  111. package/src/types/transaction.ts +1 -1
  112. package/src/utils/abi/decodeErrorResult.ts +2 -2
  113. package/src/utils/abi/decodeFunctionData.ts +2 -2
  114. package/src/utils/abi/encodeErrorResult.ts +2 -2
  115. package/src/utils/abi/encodeEventTopics.ts +4 -4
  116. package/src/utils/abi/encodeFunctionData.ts +2 -2
  117. package/src/utils/abi/{formatAbiItemWithParams.test.ts → formatAbiItem.test.ts} +11 -11
  118. package/src/utils/abi/{formatAbiItemWithParams.ts → formatAbiItem.ts} +1 -1
  119. package/src/utils/abi/index.test.ts +1 -1
  120. package/src/utils/abi/index.ts +1 -1
  121. package/src/utils/chain.test.ts +43 -0
  122. package/src/utils/chain.ts +8 -0
  123. package/src/utils/contract/getContractError.ts +2 -6
  124. package/src/utils/formatters/block.ts +4 -3
  125. package/src/utils/formatters/extract.ts +1 -1
  126. package/src/utils/formatters/format.ts +39 -2
  127. package/src/utils/formatters/index.test.ts +10 -0
  128. package/src/utils/formatters/index.ts +15 -5
  129. package/src/utils/formatters/transaction.ts +16 -4
  130. package/src/utils/formatters/transactionReceipt.ts +13 -4
  131. package/src/utils/formatters/transactionRequest.ts +12 -3
  132. package/src/utils/hash/getEventSignature.ts +2 -2
  133. package/src/utils/index.test.ts +24 -1
  134. package/src/utils/index.ts +12 -1
  135. package/src/{constants.test.ts → utils/unit/constants.test.ts} +0 -5
  136. package/src/{constants.ts → utils/unit/constants.ts} +0 -6
  137. package/src/utils/unit/formatEther.ts +1 -1
  138. package/src/utils/unit/formatGwei.ts +1 -1
  139. package/src/utils/unit/index.test.ts +12 -0
  140. package/src/utils/unit/index.ts +1 -0
  141. package/src/utils/unit/parseEther.ts +1 -1
  142. package/src/utils/unit/parseGwei.ts +1 -1
  143. package/dist/chunk-24EKKMUO.js.map +0 -1
  144. package/dist/chunk-BZFF747V.js.map +0 -1
  145. package/dist/chunk-E7LH5H76.mjs.map +0 -1
  146. package/dist/chunk-HRE6LYF3.js.map +0 -1
  147. package/dist/chunk-IVWG22RQ.mjs.map +0 -1
  148. package/dist/chunk-NYMS65YI.js.map +0 -1
  149. package/dist/chunk-PHSAQQGZ.mjs.map +0 -1
  150. package/dist/chunk-VAT5CEF7.mjs.map +0 -1
  151. package/dist/transactionRequest-8e970b0e.d.ts +0 -33
@@ -114,6 +114,81 @@ test('exports chains', () => {
114
114
  },
115
115
  "testnet": true,
116
116
  },
117
+ "aurora": {
118
+ "blockExplorers": {
119
+ "default": {
120
+ "name": "Aurorascan",
121
+ "url": "https://aurorascan.dev",
122
+ },
123
+ "etherscan": {
124
+ "name": "Aurorascan",
125
+ "url": "https://aurorascan.dev",
126
+ },
127
+ },
128
+ "id": 1313161554,
129
+ "name": "Aurora",
130
+ "nativeCurrency": {
131
+ "decimals": 18,
132
+ "name": "Ether",
133
+ "symbol": "ETH",
134
+ },
135
+ "network": "aurora",
136
+ "rpcUrls": {
137
+ "default": {
138
+ "http": [
139
+ "https://mainnet.aurora.dev",
140
+ ],
141
+ },
142
+ "infura": {
143
+ "http": [
144
+ "https://aurora-mainnet.infura.io/v3",
145
+ ],
146
+ },
147
+ "public": {
148
+ "http": [
149
+ "https://mainnet.aurora.dev",
150
+ ],
151
+ },
152
+ },
153
+ },
154
+ "auroraGoerli": {
155
+ "blockExplorers": {
156
+ "default": {
157
+ "name": "Aurorascan",
158
+ "url": "https://testnet.aurorascan.dev",
159
+ },
160
+ "etherscan": {
161
+ "name": "Aurorascan",
162
+ "url": "https://testnet.aurorascan.dev",
163
+ },
164
+ },
165
+ "id": 1313161555,
166
+ "name": "Aurora Testnet",
167
+ "nativeCurrency": {
168
+ "decimals": 18,
169
+ "name": "Ether",
170
+ "symbol": "ETH",
171
+ },
172
+ "network": "aurora-testnet",
173
+ "rpcUrls": {
174
+ "default": {
175
+ "http": [
176
+ "https://testnet.aurora.dev",
177
+ ],
178
+ },
179
+ "infura": {
180
+ "http": [
181
+ "https://aurora-testnet.infura.io/v3",
182
+ ],
183
+ },
184
+ "public": {
185
+ "http": [
186
+ "https://testnet.aurora.dev",
187
+ ],
188
+ },
189
+ },
190
+ "testnet": true,
191
+ },
117
192
  "avalanche": {
118
193
  "blockExplorers": {
119
194
  "default": {
@@ -191,6 +266,63 @@ test('exports chains', () => {
191
266
  },
192
267
  "testnet": true,
193
268
  },
269
+ "bronos": {
270
+ "blockExplorers": {
271
+ "default": {
272
+ "name": "BronoScan",
273
+ "url": "https://broscan.bronos.org",
274
+ },
275
+ },
276
+ "id": 1039,
277
+ "name": "Bronos",
278
+ "nativeCurrency": {
279
+ "decimals": 18,
280
+ "name": "BRO",
281
+ "symbol": "BRO",
282
+ },
283
+ "network": "bronos",
284
+ "rpcUrls": {
285
+ "default": {
286
+ "http": [
287
+ "https://evm.bronos.org",
288
+ ],
289
+ },
290
+ "public": {
291
+ "http": [
292
+ "https://evm.bronos.org",
293
+ ],
294
+ },
295
+ },
296
+ },
297
+ "bronosTestnet": {
298
+ "blockExplorers": {
299
+ "default": {
300
+ "name": "BronoScan",
301
+ "url": "https://tbroscan.bronos.org",
302
+ },
303
+ },
304
+ "id": 1038,
305
+ "name": "Bronos Testnet",
306
+ "nativeCurrency": {
307
+ "decimals": 18,
308
+ "name": "Bronos Coin",
309
+ "symbol": "tBRO",
310
+ },
311
+ "network": "bronos-testnet",
312
+ "rpcUrls": {
313
+ "default": {
314
+ "http": [
315
+ "https://evm-testnet.bronos.org",
316
+ ],
317
+ },
318
+ "public": {
319
+ "http": [
320
+ "https://evm-testnet.bronos.org",
321
+ ],
322
+ },
323
+ },
324
+ "testnet": true,
325
+ },
194
326
  "bsc": {
195
327
  "blockExplorers": {
196
328
  "default": {
@@ -268,38 +400,225 @@ test('exports chains', () => {
268
400
  },
269
401
  "testnet": true,
270
402
  },
403
+ "canto": {
404
+ "blockExplorers": {
405
+ "default": {
406
+ "name": "Canto EVM Explorer (Blockscout)",
407
+ "url": "https://evm.explorer.canto.io",
408
+ },
409
+ },
410
+ "id": 7700,
411
+ "name": "Canto",
412
+ "nativeCurrency": {
413
+ "decimals": 18,
414
+ "name": "Canto",
415
+ "symbol": "CANTO",
416
+ },
417
+ "network": "canto",
418
+ "rpcUrls": {
419
+ "default": {
420
+ "http": [
421
+ "https://canto.slingshot.finance",
422
+ ],
423
+ },
424
+ "public": {
425
+ "http": [
426
+ "https://canto.slingshot.finance",
427
+ ],
428
+ },
429
+ },
430
+ },
271
431
  "celo": {
432
+ "blockExplorers": {
433
+ "default": {
434
+ "name": "Celo Explorer",
435
+ "url": "https://explorer.celo.org/mainnet",
436
+ },
437
+ "etherscan": {
438
+ "name": "CeloScan",
439
+ "url": "https://celoscan.io",
440
+ },
441
+ },
442
+ "contracts": {
443
+ "multicall3": {
444
+ "address": "0xcA11bde05977b3631167028862bE2a173976CA11",
445
+ "blockCreated": 13112599,
446
+ },
447
+ },
272
448
  "formatters": {
273
449
  "block": [Function],
274
450
  "transaction": [Function],
451
+ "transactionReceipt": [Function],
275
452
  "transactionRequest": [Function],
276
453
  },
277
454
  "id": 42220,
278
455
  "name": "Celo",
279
456
  "nativeCurrency": {
280
457
  "decimals": 18,
281
- "name": "Celo",
458
+ "name": "CELO",
282
459
  "symbol": "CELO",
283
460
  },
284
461
  "network": "celo",
285
462
  "rpcUrls": {
286
463
  "default": {
287
464
  "http": [
288
- "https://rpc.ankr.com/celo",
465
+ "https://forno.celo.org",
466
+ ],
467
+ },
468
+ "infura": {
469
+ "http": [
470
+ "https://celo-mainnet.infura.io/v3",
471
+ ],
472
+ },
473
+ "public": {
474
+ "http": [
475
+ "https://forno.celo.org",
476
+ ],
477
+ },
478
+ },
479
+ "testnet": false,
480
+ },
481
+ "celoAlfajores": {
482
+ "blockExplorers": {
483
+ "default": {
484
+ "name": "Celo Explorer",
485
+ "url": "https://explorer.celo.org/alfajores",
486
+ },
487
+ "etherscan": {
488
+ "name": "CeloScan",
489
+ "url": "https://alfajores.celoscan.io/",
490
+ },
491
+ },
492
+ "contracts": {
493
+ "multicall3": {
494
+ "address": "0xcA11bde05977b3631167028862bE2a173976CA11",
495
+ "blockCreated": 14569001,
496
+ },
497
+ },
498
+ "formatters": {
499
+ "block": [Function],
500
+ "transaction": [Function],
501
+ "transactionReceipt": [Function],
502
+ "transactionRequest": [Function],
503
+ },
504
+ "id": 44787,
505
+ "name": "Alfajores",
506
+ "nativeCurrency": {
507
+ "decimals": 18,
508
+ "name": "CELO",
509
+ "symbol": "A-CELO",
510
+ },
511
+ "network": "celo-alfajores",
512
+ "rpcUrls": {
513
+ "default": {
514
+ "http": [
515
+ "https://alfajores-forno.celo-testnet.org",
516
+ ],
517
+ },
518
+ "infura": {
519
+ "http": [
520
+ "https://celo-alfajores.infura.io/v3",
289
521
  ],
290
522
  },
291
523
  "public": {
292
524
  "http": [
293
- "https://rpc.ankr.com/celo",
525
+ "https://alfajores-forno.celo-testnet.org",
526
+ ],
527
+ },
528
+ },
529
+ "testnet": true,
530
+ },
531
+ "crossbell": {
532
+ "blockExplorers": {
533
+ "default": {
534
+ "name": "CrossScan",
535
+ "url": "https://scan.crossbell.io",
536
+ },
537
+ },
538
+ "contracts": {
539
+ "multicall3": {
540
+ "address": "0xBB9759009cDaC82774EfC84D94cD9F7440f75Fcf",
541
+ "blockCreated": 23499787,
542
+ },
543
+ },
544
+ "id": 3737,
545
+ "name": "Crossbell",
546
+ "nativeCurrency": {
547
+ "decimals": 18,
548
+ "name": "CSB",
549
+ "symbol": "CSB",
550
+ },
551
+ "network": "crossbell",
552
+ "rpcUrls": {
553
+ "default": {
554
+ "http": [
555
+ "https://rpc.crossbell.io",
556
+ ],
557
+ },
558
+ "public": {
559
+ "http": [
560
+ "https://rpc.crossbell.io",
294
561
  ],
295
562
  },
296
563
  },
297
564
  },
298
- "defineBlock": [Function],
299
565
  "defineChain": [Function],
300
- "defineTransaction": [Function],
301
- "defineTransactionReceipt": [Function],
302
- "defineTransactionRequest": [Function],
566
+ "evmos": {
567
+ "blockExplorers": {
568
+ "default": {
569
+ "name": "Evmos Block Explorer",
570
+ "url": "https://escan.live/",
571
+ },
572
+ },
573
+ "id": 9001,
574
+ "name": "Evmos",
575
+ "nativeCurrency": {
576
+ "decimals": 18,
577
+ "name": "Evmos",
578
+ "symbol": "EVMOS",
579
+ },
580
+ "network": "evmos",
581
+ "rpcUrls": {
582
+ "default": {
583
+ "http": [
584
+ "https://eth.bd.evmos.org:8545",
585
+ ],
586
+ },
587
+ "public": {
588
+ "http": [
589
+ "https://eth.bd.evmos.org:8545",
590
+ ],
591
+ },
592
+ },
593
+ },
594
+ "evmosTestnet": {
595
+ "blockExplorers": {
596
+ "default": {
597
+ "name": "Evmos Testnet Block Explorer",
598
+ "url": "https://evm.evmos.dev/",
599
+ },
600
+ },
601
+ "id": 9000,
602
+ "name": "Evmos Testnet",
603
+ "nativeCurrency": {
604
+ "decimals": 18,
605
+ "name": "Evmos",
606
+ "symbol": "EVMOS",
607
+ },
608
+ "network": "evmos-testnet",
609
+ "rpcUrls": {
610
+ "default": {
611
+ "http": [
612
+ "https://eth.bd.evmos.dev:8545",
613
+ ],
614
+ },
615
+ "public": {
616
+ "http": [
617
+ "https://eth.bd.evmos.dev:8545",
618
+ ],
619
+ },
620
+ },
621
+ },
303
622
  "fantom": {
304
623
  "blockExplorers": {
305
624
  "default": {
@@ -376,6 +695,74 @@ test('exports chains', () => {
376
695
  },
377
696
  },
378
697
  },
698
+ "filecoin": {
699
+ "blockExplorers": {
700
+ "default": {
701
+ "name": "Filfox",
702
+ "url": "https://filfox.info/en",
703
+ },
704
+ "filscan": {
705
+ "name": "Filscan",
706
+ "url": "https://filscan.io",
707
+ },
708
+ "filscout": {
709
+ "name": "Filscout",
710
+ "url": "https://filscout.io/en",
711
+ },
712
+ },
713
+ "id": 314,
714
+ "name": "Filecoin Mainnet",
715
+ "nativeCurrency": {
716
+ "decimals": 18,
717
+ "name": "filecoin",
718
+ "symbol": "FIL",
719
+ },
720
+ "network": "filecoin-mainnet",
721
+ "rpcUrls": {
722
+ "default": {
723
+ "http": [
724
+ "https://api.node.glif.io",
725
+ ],
726
+ },
727
+ "public": {
728
+ "http": [
729
+ "https://api.node.glif.io",
730
+ ],
731
+ },
732
+ },
733
+ },
734
+ "filecoinTestnet": {
735
+ "blockExplorers": {
736
+ "default": {
737
+ "name": "Filfox",
738
+ "url": "https://hyperspace.filfox.info/en",
739
+ },
740
+ "gilf": {
741
+ "name": "Glif",
742
+ "url": "https://explorer.glif.io/?network=hyperspace",
743
+ },
744
+ },
745
+ "id": 3141,
746
+ "name": "Filecoin Hyperspace",
747
+ "nativeCurrency": {
748
+ "decimals": 18,
749
+ "name": "testnet filecoin",
750
+ "symbol": "tFIL",
751
+ },
752
+ "network": "filecoin-hyperspace",
753
+ "rpcUrls": {
754
+ "default": {
755
+ "http": [
756
+ "https://api.hyperspace.node.glif.io/rpc/v1",
757
+ ],
758
+ },
759
+ "public": {
760
+ "http": [
761
+ "https://api.hyperspace.node.glif.io/rpc/v1",
762
+ ],
763
+ },
764
+ },
765
+ },
379
766
  "foundry": {
380
767
  "id": 31337,
381
768
  "name": "Foundry",
@@ -398,6 +785,66 @@ test('exports chains', () => {
398
785
  },
399
786
  },
400
787
  },
788
+ "gnosis": {
789
+ "blockExplorers": {
790
+ "default": {
791
+ "name": "Gnosis Chain Explorer",
792
+ "url": "https://blockscout.com/xdai/mainnet/",
793
+ },
794
+ "etherscan": {
795
+ "name": "Gnosisscan",
796
+ "url": "https://gnosisscan.io/",
797
+ },
798
+ },
799
+ "id": 100,
800
+ "name": "Gnosis",
801
+ "nativeCurrency": {
802
+ "decimals": 18,
803
+ "name": "Gnosis",
804
+ "symbol": "xDAI",
805
+ },
806
+ "network": "gnosis",
807
+ "rpcUrls": {
808
+ "default": {
809
+ "http": [
810
+ "https://rpc.gnosischain.com",
811
+ ],
812
+ },
813
+ "public": {
814
+ "http": [
815
+ "https://rpc.gnosischain.com",
816
+ ],
817
+ },
818
+ },
819
+ },
820
+ "gnosisChiado": {
821
+ "blockExplorers": {
822
+ "default": {
823
+ "name": "Blockscout",
824
+ "url": "https://blockscout.chiadochain.net",
825
+ },
826
+ },
827
+ "id": 10200,
828
+ "name": "Gnosis Chiado",
829
+ "nativeCurrency": {
830
+ "decimals": 18,
831
+ "name": "Gnosis",
832
+ "symbol": "xDAI",
833
+ },
834
+ "network": "chiado",
835
+ "rpcUrls": {
836
+ "default": {
837
+ "http": [
838
+ "https://rpc.chiadochain.net",
839
+ ],
840
+ },
841
+ "public": {
842
+ "http": [
843
+ "https://rpc.chiadochain.net",
844
+ ],
845
+ },
846
+ },
847
+ },
401
848
  "goerli": {
402
849
  "blockExplorers": {
403
850
  "default": {
@@ -435,45 +882,113 @@ test('exports chains', () => {
435
882
  "wss://eth-goerli.g.alchemy.com/v2",
436
883
  ],
437
884
  },
438
- "default": {
885
+ "default": {
886
+ "http": [
887
+ "https://rpc.ankr.com/eth_goerli",
888
+ ],
889
+ },
890
+ "infura": {
891
+ "http": [
892
+ "https://goerli.infura.io/v3",
893
+ ],
894
+ "webSocket": [
895
+ "wss://goerli.infura.io/ws/v3",
896
+ ],
897
+ },
898
+ "public": {
899
+ "http": [
900
+ "https://rpc.ankr.com/eth_goerli",
901
+ ],
902
+ },
903
+ },
904
+ "testnet": true,
905
+ },
906
+ "hardhat": {
907
+ "id": 31337,
908
+ "name": "Hardhat",
909
+ "nativeCurrency": {
910
+ "decimals": 18,
911
+ "name": "Ether",
912
+ "symbol": "ETH",
913
+ },
914
+ "network": "hardhat",
915
+ "rpcUrls": {
916
+ "default": {
917
+ "http": [
918
+ "http://127.0.0.1:8545",
919
+ ],
920
+ },
921
+ "public": {
439
922
  "http": [
440
- "https://rpc.ankr.com/eth_goerli",
923
+ "http://127.0.0.1:8545",
441
924
  ],
442
925
  },
443
- "infura": {
926
+ },
927
+ },
928
+ "iotex": {
929
+ "blockExplorers": {
930
+ "default": {
931
+ "name": "IoTeXScan",
932
+ "url": "https://iotexscan.io",
933
+ },
934
+ },
935
+ "id": 4689,
936
+ "name": "IoTeX",
937
+ "nativeCurrency": {
938
+ "decimals": 18,
939
+ "name": "IoTeX",
940
+ "symbol": "IOTX",
941
+ },
942
+ "network": "iotex",
943
+ "rpcUrls": {
944
+ "default": {
444
945
  "http": [
445
- "https://goerli.infura.io/v3",
946
+ "https://babel-api.mainnet.iotex.io",
446
947
  ],
447
948
  "webSocket": [
448
- "wss://goerli.infura.io/ws/v3",
949
+ "wss://babel-api.mainnet.iotex.io",
449
950
  ],
450
951
  },
451
952
  "public": {
452
953
  "http": [
453
- "https://rpc.ankr.com/eth_goerli",
954
+ "https://babel-api.mainnet.iotex.io",
955
+ ],
956
+ "webSocket": [
957
+ "wss://babel-api.mainnet.iotex.io",
454
958
  ],
455
959
  },
456
960
  },
457
- "testnet": true,
458
961
  },
459
- "hardhat": {
460
- "id": 31337,
461
- "name": "Hardhat",
962
+ "iotexTestnet": {
963
+ "blockExplorers": {
964
+ "default": {
965
+ "name": "IoTeXScan",
966
+ "url": "https://testnet.iotexscan.io",
967
+ },
968
+ },
969
+ "id": 4690,
970
+ "name": "IoTeX Testnet",
462
971
  "nativeCurrency": {
463
972
  "decimals": 18,
464
- "name": "Ether",
465
- "symbol": "ETH",
973
+ "name": "IoTeX",
974
+ "symbol": "IOTX",
466
975
  },
467
- "network": "hardhat",
976
+ "network": "iotex-testnet",
468
977
  "rpcUrls": {
469
978
  "default": {
470
979
  "http": [
471
- "http://127.0.0.1:8545",
980
+ "https://babel-api.testnet.iotex.io",
981
+ ],
982
+ "webSocket": [
983
+ "wss://babel-api.testnet.iotex.io",
472
984
  ],
473
985
  },
474
986
  "public": {
475
987
  "http": [
476
- "http://127.0.0.1:8545",
988
+ "https://babel-api.testnet.iotex.io",
989
+ ],
990
+ "webSocket": [
991
+ "wss://babel-api.testnet.iotex.io",
477
992
  ],
478
993
  },
479
994
  },
@@ -557,6 +1072,62 @@ test('exports chains', () => {
557
1072
  },
558
1073
  },
559
1074
  },
1075
+ "metis": {
1076
+ "blockExplorers": {
1077
+ "default": {
1078
+ "name": "Andromeda Explorer",
1079
+ "url": "https://andromeda-explorer.metis.io",
1080
+ },
1081
+ },
1082
+ "id": 1088,
1083
+ "name": "Metis",
1084
+ "nativeCurrency": {
1085
+ "decimals": 18,
1086
+ "name": "Metis",
1087
+ "symbol": "METIS",
1088
+ },
1089
+ "network": "andromeda",
1090
+ "rpcUrls": {
1091
+ "default": {
1092
+ "http": [
1093
+ "https://andromeda.metis.io/?owner=1088",
1094
+ ],
1095
+ },
1096
+ "public": {
1097
+ "http": [
1098
+ "https://andromeda.metis.io/?owner=1088",
1099
+ ],
1100
+ },
1101
+ },
1102
+ },
1103
+ "metisGoerli": {
1104
+ "blockExplorers": {
1105
+ "default": {
1106
+ "name": "Metis Goerli Explorer",
1107
+ "url": "https://goerli.explorer.metisdevops.link",
1108
+ },
1109
+ },
1110
+ "id": 599,
1111
+ "name": "Metis Goerli",
1112
+ "nativeCurrency": {
1113
+ "decimals": 18,
1114
+ "name": "Metis Goerli",
1115
+ "symbol": "METIS",
1116
+ },
1117
+ "network": "metis-goerli",
1118
+ "rpcUrls": {
1119
+ "default": {
1120
+ "http": [
1121
+ "https://goerli.gateway.metisdevops.link",
1122
+ ],
1123
+ },
1124
+ "public": {
1125
+ "http": [
1126
+ "https://goerli.gateway.metisdevops.link",
1127
+ ],
1128
+ },
1129
+ },
1130
+ },
560
1131
  "optimism": {
561
1132
  "blockExplorers": {
562
1133
  "default": {
@@ -822,51 +1393,140 @@ test('exports chains', () => {
822
1393
  },
823
1394
  "testnet": true,
824
1395
  },
825
- }
826
- `)
827
- })
828
-
829
- describe('defineChain', () => {
830
- test('default', () => {
831
- expect(
832
- chains.defineChain({
833
- id: 42220,
834
- name: 'Celo',
835
- network: 'celo',
836
- nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 },
837
- rpcUrls: {
838
- public: { http: ['https://rpc.ankr.com/celo'] },
839
- default: { http: ['https://rpc.ankr.com/celo'] },
1396
+ "taraxa": {
1397
+ "blockExplorers": {
1398
+ "default": {
1399
+ "name": "Taraxa Explorer",
1400
+ "url": "https://explorer.mainnet.taraxa.io",
1401
+ },
840
1402
  },
841
- }),
842
- ).toMatchInlineSnapshot(`
843
- {
844
- "id": 42220,
845
- "name": "Celo",
1403
+ "id": 841,
1404
+ "name": "Taraxa Mainnet",
846
1405
  "nativeCurrency": {
847
1406
  "decimals": 18,
848
- "name": "Celo",
849
- "symbol": "CELO",
1407
+ "name": "Tara",
1408
+ "symbol": "TARA",
850
1409
  },
851
- "network": "celo",
1410
+ "network": "taraxa",
852
1411
  "rpcUrls": {
853
1412
  "default": {
854
1413
  "http": [
855
- "https://rpc.ankr.com/celo",
1414
+ "https://rpc.mainnet.taraxa.io",
856
1415
  ],
857
1416
  },
858
1417
  "public": {
859
1418
  "http": [
860
- "https://rpc.ankr.com/celo",
1419
+ "https://rpc.mainnet.taraxa.io",
861
1420
  ],
862
1421
  },
863
1422
  },
864
- }
865
- `)
866
- })
1423
+ },
1424
+ "taraxaTestnet": {
1425
+ "blockExplorers": {
1426
+ "default": {
1427
+ "name": "Taraxa Explorer",
1428
+ "url": "https://explorer.testnet.taraxa.io",
1429
+ },
1430
+ },
1431
+ "id": 842,
1432
+ "name": "Taraxa Testnet",
1433
+ "nativeCurrency": {
1434
+ "decimals": 18,
1435
+ "name": "Tara",
1436
+ "symbol": "TARA",
1437
+ },
1438
+ "network": "taraxa-testnet",
1439
+ "rpcUrls": {
1440
+ "default": {
1441
+ "http": [
1442
+ "https://rpc.testnet.taraxa.io",
1443
+ ],
1444
+ },
1445
+ "public": {
1446
+ "http": [
1447
+ "https://rpc.testnet.taraxa.io",
1448
+ ],
1449
+ },
1450
+ },
1451
+ "testnet": true,
1452
+ },
1453
+ "zkSync": {
1454
+ "blockExplorers": {
1455
+ "default": {
1456
+ "name": "zkExplorer",
1457
+ "url": "https://explorer.zksync.io",
1458
+ },
1459
+ },
1460
+ "id": 324,
1461
+ "name": "zkSync",
1462
+ "nativeCurrency": {
1463
+ "decimals": 18,
1464
+ "name": "Ether",
1465
+ "symbol": "ETH",
1466
+ },
1467
+ "network": "zksync",
1468
+ "rpcUrls": {
1469
+ "default": {
1470
+ "http": [
1471
+ "https://zksync2-mainnet.zksync.io",
1472
+ ],
1473
+ "webSocket": [
1474
+ "wss://zksync2-mainnet.zksync.io/ws",
1475
+ ],
1476
+ },
1477
+ "public": {
1478
+ "http": [
1479
+ "https://zksync2-mainnet.zksync.io",
1480
+ ],
1481
+ "webSocket": [
1482
+ "wss://zksync2-mainnet.zksync.io/ws",
1483
+ ],
1484
+ },
1485
+ },
1486
+ },
1487
+ "zkSyncTestnet": {
1488
+ "blockExplorers": {
1489
+ "default": {
1490
+ "name": "zkExplorer",
1491
+ "url": "https://goerli.explorer.zksync.io",
1492
+ },
1493
+ },
1494
+ "id": 280,
1495
+ "name": "zkSync Testnet",
1496
+ "nativeCurrency": {
1497
+ "decimals": 18,
1498
+ "name": "Ether",
1499
+ "symbol": "ETH",
1500
+ },
1501
+ "network": "zksync-testnet",
1502
+ "rpcUrls": {
1503
+ "default": {
1504
+ "http": [
1505
+ "https://zksync2-testnet.zksync.dev",
1506
+ ],
1507
+ "webSocket": [
1508
+ "wss://zksync2-testnet.zksync.dev/ws",
1509
+ ],
1510
+ },
1511
+ "public": {
1512
+ "http": [
1513
+ "https://zksync2-testnet.zksync.dev",
1514
+ ],
1515
+ "webSocket": [
1516
+ "wss://zksync2-testnet.zksync.dev/ws",
1517
+ ],
1518
+ },
1519
+ },
1520
+ "testnet": true,
1521
+ },
1522
+ }
1523
+ `)
1524
+ })
867
1525
 
868
- test('args: formatters', () => {
869
- const { block, transaction, transactionRequest } = chains.celo.formatters!
1526
+ describe('formatters', () => {
1527
+ test('celo', () => {
1528
+ const { block, transaction, transactionReceipt, transactionRequest } =
1529
+ chains.celo.formatters!
870
1530
 
871
1531
  expect(
872
1532
  block({
@@ -1104,6 +1764,124 @@ describe('defineChain', () => {
1104
1764
  }
1105
1765
  `)
1106
1766
 
1767
+ expect(
1768
+ transactionReceipt({
1769
+ accessList: [],
1770
+ blockHash:
1771
+ '0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d',
1772
+ blockNumber: '0x1',
1773
+ chainId: '0x1',
1774
+ feeCurrency: null,
1775
+ from: '0xa152f8bb749c55e9943a3a0a3111d18ee2b3f94e',
1776
+ gas: '0x2',
1777
+ gasPrice: undefined,
1778
+ gatewayFee: null,
1779
+ gatewayFeeRecipient: null,
1780
+ hash: '0xa4b1f606b66105fa45cb5db23d2f6597075701e7f0e2367f4e6a39d17a8cf98b',
1781
+ input:
1782
+ '0x23b872dd000000000000000000000000a00f99bc38b1ecda1fd70eaa1cd31d576a9f46b0000000000000000000000000f16e9b0d03470827a95cdfd0cb8a8a3b46969b910000000000000000000000000000000000000000000000000000002b3b6fb3d0',
1783
+ maxFeePerGas: '0x4',
1784
+ maxPriorityFeePerGas: '0x5',
1785
+ nonce: '0x6',
1786
+ r: '0x5e49a7bd0534c6b6d3bbe581659424d3747f920d40ce56e48d26e5d94aac32ca',
1787
+ s: '0x1746abe27b7c4f00bda1ec714ac1f7083e9025b6ca3b2248e439a173e4ab55e0',
1788
+ to: '0x15d4c048f83bd7e37d49ea4c83a07267ec4203da',
1789
+ transactionIndex: '0x7',
1790
+ type: '0x2',
1791
+ v: '0x1',
1792
+ value: '0x0',
1793
+ }),
1794
+ ).toMatchInlineSnapshot(`
1795
+ {
1796
+ "accessList": [],
1797
+ "blockHash": "0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d",
1798
+ "blockNumber": 1n,
1799
+ "chainId": "0x1",
1800
+ "cumulativeGasUsed": null,
1801
+ "effectiveGasPrice": null,
1802
+ "feeCurrency": null,
1803
+ "from": "0xa152f8bb749c55e9943a3a0a3111d18ee2b3f94e",
1804
+ "gas": "0x2",
1805
+ "gasPrice": undefined,
1806
+ "gasUsed": null,
1807
+ "gatewayFee": null,
1808
+ "gatewayFeeRecipient": null,
1809
+ "hash": "0xa4b1f606b66105fa45cb5db23d2f6597075701e7f0e2367f4e6a39d17a8cf98b",
1810
+ "input": "0x23b872dd000000000000000000000000a00f99bc38b1ecda1fd70eaa1cd31d576a9f46b0000000000000000000000000f16e9b0d03470827a95cdfd0cb8a8a3b46969b910000000000000000000000000000000000000000000000000000002b3b6fb3d0",
1811
+ "logs": null,
1812
+ "maxFeePerGas": "0x4",
1813
+ "maxPriorityFeePerGas": "0x5",
1814
+ "nonce": "0x6",
1815
+ "r": "0x5e49a7bd0534c6b6d3bbe581659424d3747f920d40ce56e48d26e5d94aac32ca",
1816
+ "s": "0x1746abe27b7c4f00bda1ec714ac1f7083e9025b6ca3b2248e439a173e4ab55e0",
1817
+ "status": null,
1818
+ "to": "0x15d4c048f83bd7e37d49ea4c83a07267ec4203da",
1819
+ "transactionIndex": 7,
1820
+ "type": "eip1559",
1821
+ "v": "0x1",
1822
+ "value": "0x0",
1823
+ }
1824
+ `)
1825
+
1826
+ expect(
1827
+ transactionReceipt({
1828
+ accessList: [],
1829
+ blockHash:
1830
+ '0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d',
1831
+ blockNumber: '0x1',
1832
+ chainId: '0x1',
1833
+ feeCurrency: null,
1834
+ from: '0xa152f8bb749c55e9943a3a0a3111d18ee2b3f94e',
1835
+ gas: '0x2',
1836
+ gasPrice: undefined,
1837
+ gatewayFee: '0x1',
1838
+ gatewayFeeRecipient: null,
1839
+ hash: '0xa4b1f606b66105fa45cb5db23d2f6597075701e7f0e2367f4e6a39d17a8cf98b',
1840
+ input:
1841
+ '0x23b872dd000000000000000000000000a00f99bc38b1ecda1fd70eaa1cd31d576a9f46b0000000000000000000000000f16e9b0d03470827a95cdfd0cb8a8a3b46969b910000000000000000000000000000000000000000000000000000002b3b6fb3d0',
1842
+ maxFeePerGas: '0x4',
1843
+ maxPriorityFeePerGas: '0x5',
1844
+ nonce: '0x6',
1845
+ r: '0x5e49a7bd0534c6b6d3bbe581659424d3747f920d40ce56e48d26e5d94aac32ca',
1846
+ s: '0x1746abe27b7c4f00bda1ec714ac1f7083e9025b6ca3b2248e439a173e4ab55e0',
1847
+ to: '0x15d4c048f83bd7e37d49ea4c83a07267ec4203da',
1848
+ transactionIndex: '0x7',
1849
+ type: '0x2',
1850
+ v: '0x1',
1851
+ value: '0x0',
1852
+ }),
1853
+ ).toMatchInlineSnapshot(`
1854
+ {
1855
+ "accessList": [],
1856
+ "blockHash": "0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d",
1857
+ "blockNumber": 1n,
1858
+ "chainId": "0x1",
1859
+ "cumulativeGasUsed": null,
1860
+ "effectiveGasPrice": null,
1861
+ "feeCurrency": null,
1862
+ "from": "0xa152f8bb749c55e9943a3a0a3111d18ee2b3f94e",
1863
+ "gas": "0x2",
1864
+ "gasPrice": undefined,
1865
+ "gasUsed": null,
1866
+ "gatewayFee": 1n,
1867
+ "gatewayFeeRecipient": null,
1868
+ "hash": "0xa4b1f606b66105fa45cb5db23d2f6597075701e7f0e2367f4e6a39d17a8cf98b",
1869
+ "input": "0x23b872dd000000000000000000000000a00f99bc38b1ecda1fd70eaa1cd31d576a9f46b0000000000000000000000000f16e9b0d03470827a95cdfd0cb8a8a3b46969b910000000000000000000000000000000000000000000000000000002b3b6fb3d0",
1870
+ "logs": null,
1871
+ "maxFeePerGas": "0x4",
1872
+ "maxPriorityFeePerGas": "0x5",
1873
+ "nonce": "0x6",
1874
+ "r": "0x5e49a7bd0534c6b6d3bbe581659424d3747f920d40ce56e48d26e5d94aac32ca",
1875
+ "s": "0x1746abe27b7c4f00bda1ec714ac1f7083e9025b6ca3b2248e439a173e4ab55e0",
1876
+ "status": null,
1877
+ "to": "0x15d4c048f83bd7e37d49ea4c83a07267ec4203da",
1878
+ "transactionIndex": 7,
1879
+ "type": "eip1559",
1880
+ "v": "0x1",
1881
+ "value": "0x0",
1882
+ }
1883
+ `)
1884
+
1107
1885
  expect(
1108
1886
  transactionRequest({
1109
1887
  feeCurrency: '0x0f16e9b0d03470827a95cdfd0cb8a8a3b46969b9',