essential-eth 0.4.9-beta.3 → 0.4.10

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 (128) hide show
  1. package/{dist → lib}/cjs/classes/Contract.d.ts +0 -0
  2. package/{dist → lib}/cjs/classes/Contract.js +3 -8
  3. package/{dist → lib}/cjs/classes/test/Contract/crv-abi.d.ts +0 -0
  4. package/{dist → lib}/cjs/classes/test/Contract/crv-abi.js +0 -0
  5. package/{dist → lib}/cjs/classes/test/Contract/ens-abi.d.ts +0 -0
  6. package/{dist → lib}/cjs/classes/test/Contract/ens-abi.js +0 -0
  7. package/{dist → lib}/cjs/classes/test/Contract/fei-abi.d.ts +0 -0
  8. package/{dist → lib}/cjs/classes/test/Contract/fei-abi.js +0 -0
  9. package/{dist → lib}/cjs/classes/test/Contract/foo-abi.d.ts +0 -0
  10. package/{dist → lib}/cjs/classes/test/Contract/foo-abi.js +0 -0
  11. package/{dist → lib}/cjs/classes/test/Contract/uniswap-abi.d.ts +0 -0
  12. package/{dist → lib}/cjs/classes/test/Contract/uniswap-abi.js +0 -0
  13. package/{dist → lib}/cjs/classes/utils/clean-block.d.ts +0 -0
  14. package/{dist → lib}/cjs/classes/utils/clean-block.js +2 -2
  15. package/{dist → lib}/cjs/classes/utils/clean-transaction.d.ts +0 -0
  16. package/{dist → lib}/cjs/classes/utils/clean-transaction.js +2 -2
  17. package/{dist → lib}/cjs/classes/utils/encode-decode-transaction.d.ts +0 -0
  18. package/{dist → lib}/cjs/classes/utils/encode-decode-transaction.js +1 -2
  19. package/{dist → lib}/cjs/classes/utils/fetchers.d.ts +1 -1
  20. package/lib/cjs/classes/utils/fetchers.js +51 -0
  21. package/{dist → lib}/cjs/classes/utils/hex-to-decimal.d.ts +0 -0
  22. package/{dist → lib}/cjs/classes/utils/hex-to-decimal.js +0 -0
  23. package/lib/cjs/index.d.ts +14 -0
  24. package/lib/cjs/index.js +23 -0
  25. package/{dist → lib}/cjs/providers/JsonRpcProvider.d.ts +16 -3
  26. package/{dist → lib}/cjs/providers/JsonRpcProvider.js +26 -23
  27. package/lib/cjs/providers/test/rpc-urls.d.ts +8 -0
  28. package/lib/cjs/providers/test/rpc-urls.js +11 -0
  29. package/{dist → lib}/cjs/providers/utils/chains-info.d.ts +22 -1
  30. package/{dist → lib}/cjs/providers/utils/chains-info.js +66 -3
  31. package/{dist → lib}/cjs/shared/tiny-big/helpers.d.ts +0 -0
  32. package/{dist → lib}/cjs/shared/tiny-big/helpers.js +0 -0
  33. package/{dist → lib}/cjs/shared/tiny-big/tiny-big.d.ts +6 -0
  34. package/{dist → lib}/cjs/shared/tiny-big/tiny-big.js +6 -0
  35. package/{dist → lib}/cjs/shared/validate-type.d.ts +0 -0
  36. package/{dist → lib}/cjs/shared/validate-type.js +0 -0
  37. package/{dist → lib}/cjs/types/Block.types.d.ts +0 -0
  38. package/{dist → lib}/cjs/types/Block.types.js +0 -0
  39. package/{dist → lib}/cjs/types/Contract.types.d.ts +0 -0
  40. package/{dist → lib}/cjs/types/Contract.types.js +0 -0
  41. package/{dist → lib}/cjs/types/Network.types.d.ts +0 -0
  42. package/{dist → lib}/cjs/types/Network.types.js +0 -0
  43. package/{dist → lib}/cjs/types/Transaction.types.d.ts +0 -0
  44. package/{dist → lib}/cjs/types/Transaction.types.js +0 -0
  45. package/lib/cjs/utils/ether-to-gwei.d.ts +26 -0
  46. package/lib/cjs/utils/ether-to-gwei.js +34 -0
  47. package/{dist → lib}/cjs/utils/ether-to-wei.d.ts +4 -2
  48. package/{dist → lib}/cjs/utils/ether-to-wei.js +4 -2
  49. package/lib/cjs/utils/gwei-to-ether.d.ts +26 -0
  50. package/lib/cjs/utils/gwei-to-ether.js +34 -0
  51. package/lib/cjs/utils/is-address.d.ts +24 -0
  52. package/{dist → lib}/cjs/utils/is-address.js +21 -2
  53. package/{dist → lib}/cjs/utils/to-checksum-address.d.ts +2 -2
  54. package/{dist → lib}/cjs/utils/to-checksum-address.js +2 -2
  55. package/lib/cjs/utils/wei-to-ether.d.ts +26 -0
  56. package/{dist → lib}/cjs/utils/wei-to-ether.js +11 -11
  57. package/{dist → lib}/esm/classes/Contract.d.ts +0 -0
  58. package/{dist → lib}/esm/classes/Contract.js +3 -8
  59. package/{dist → lib}/esm/classes/test/Contract/crv-abi.d.ts +0 -0
  60. package/{dist → lib}/esm/classes/test/Contract/crv-abi.js +0 -0
  61. package/{dist → lib}/esm/classes/test/Contract/ens-abi.d.ts +0 -0
  62. package/{dist → lib}/esm/classes/test/Contract/ens-abi.js +0 -0
  63. package/{dist → lib}/esm/classes/test/Contract/fei-abi.d.ts +0 -0
  64. package/{dist → lib}/esm/classes/test/Contract/fei-abi.js +0 -0
  65. package/{dist → lib}/esm/classes/test/Contract/foo-abi.d.ts +0 -0
  66. package/{dist → lib}/esm/classes/test/Contract/foo-abi.js +0 -0
  67. package/{dist → lib}/esm/classes/test/Contract/uniswap-abi.d.ts +0 -0
  68. package/{dist → lib}/esm/classes/test/Contract/uniswap-abi.js +0 -0
  69. package/{dist → lib}/esm/classes/utils/clean-block.d.ts +0 -0
  70. package/{dist → lib}/esm/classes/utils/clean-block.js +1 -1
  71. package/{dist → lib}/esm/classes/utils/clean-transaction.d.ts +0 -0
  72. package/{dist → lib}/esm/classes/utils/clean-transaction.js +1 -1
  73. package/{dist → lib}/esm/classes/utils/encode-decode-transaction.d.ts +0 -0
  74. package/{dist → lib}/esm/classes/utils/encode-decode-transaction.js +1 -2
  75. package/{dist → lib}/esm/classes/utils/fetchers.d.ts +1 -1
  76. package/lib/esm/classes/utils/fetchers.js +43 -0
  77. package/{dist → lib}/esm/classes/utils/hex-to-decimal.d.ts +0 -0
  78. package/{dist → lib}/esm/classes/utils/hex-to-decimal.js +0 -0
  79. package/lib/esm/index.d.ts +14 -0
  80. package/lib/esm/index.js +10 -0
  81. package/{dist → lib}/esm/providers/JsonRpcProvider.d.ts +4 -3
  82. package/{dist → lib}/esm/providers/JsonRpcProvider.js +14 -23
  83. package/lib/esm/providers/test/rpc-urls.d.ts +8 -0
  84. package/lib/esm/providers/test/rpc-urls.js +8 -0
  85. package/{dist → lib}/esm/providers/utils/chains-info.d.ts +22 -1
  86. package/{dist → lib}/esm/providers/utils/chains-info.js +66 -3
  87. package/{dist → lib}/esm/shared/tiny-big/helpers.d.ts +0 -0
  88. package/{dist → lib}/esm/shared/tiny-big/helpers.js +0 -0
  89. package/{dist → lib}/esm/shared/tiny-big/tiny-big.d.ts +0 -0
  90. package/{dist → lib}/esm/shared/tiny-big/tiny-big.js +0 -0
  91. package/{dist → lib}/esm/shared/validate-type.d.ts +0 -0
  92. package/{dist → lib}/esm/shared/validate-type.js +0 -0
  93. package/{dist → lib}/esm/types/Block.types.d.ts +0 -0
  94. package/{dist → lib}/esm/types/Block.types.js +0 -0
  95. package/{dist → lib}/esm/types/Contract.types.d.ts +0 -0
  96. package/{dist → lib}/esm/types/Contract.types.js +0 -0
  97. package/{dist → lib}/esm/types/Network.types.d.ts +0 -0
  98. package/{dist → lib}/esm/types/Network.types.js +0 -0
  99. package/{dist → lib}/esm/types/Transaction.types.d.ts +0 -0
  100. package/{dist → lib}/esm/types/Transaction.types.js +0 -0
  101. package/lib/esm/utils/ether-to-gwei.d.ts +3 -0
  102. package/lib/esm/utils/ether-to-gwei.js +7 -0
  103. package/{dist → lib}/esm/utils/ether-to-wei.d.ts +0 -0
  104. package/{dist → lib}/esm/utils/ether-to-wei.js +0 -0
  105. package/lib/esm/utils/gwei-to-ether.d.ts +3 -0
  106. package/lib/esm/utils/gwei-to-ether.js +7 -0
  107. package/{dist → lib}/esm/utils/is-address.d.ts +0 -0
  108. package/{dist → lib}/esm/utils/is-address.js +1 -1
  109. package/{dist → lib}/esm/utils/to-checksum-address.d.ts +0 -0
  110. package/{dist → lib}/esm/utils/to-checksum-address.js +0 -0
  111. package/{dist → lib}/esm/utils/wei-to-ether.d.ts +1 -1
  112. package/{dist → lib}/esm/utils/wei-to-ether.js +0 -0
  113. package/package.json +13 -17
  114. package/readme.md +85 -9
  115. package/dist/cjs/classes/utils/fetchers.js +0 -33
  116. package/dist/cjs/index.d.ts +0 -9
  117. package/dist/cjs/index.js +0 -36
  118. package/dist/cjs/tsconfig-cjs.tsbuildinfo +0 -1
  119. package/dist/cjs/utils/index.d.ts +0 -5
  120. package/dist/cjs/utils/index.js +0 -11
  121. package/dist/cjs/utils/is-address.d.ts +0 -5
  122. package/dist/cjs/utils/wei-to-ether.d.ts +0 -26
  123. package/dist/esm/classes/utils/fetchers.js +0 -25
  124. package/dist/esm/index.d.ts +0 -9
  125. package/dist/esm/index.js +0 -5
  126. package/dist/esm/tsconfig.tsbuildinfo +0 -1
  127. package/dist/esm/utils/index.d.ts +0 -5
  128. package/dist/esm/utils/index.js +0 -5
@@ -145,6 +145,9 @@ exports.default = {
145
145
  "53": [
146
146
  "tcet"
147
147
  ],
148
+ "54": [
149
+ "OP"
150
+ ],
148
151
  "55": [
149
152
  "ZYX"
150
153
  ],
@@ -304,6 +307,9 @@ exports.default = {
304
307
  "137": [
305
308
  "MATIC"
306
309
  ],
310
+ "141": [
311
+ "OPtest"
312
+ ],
307
313
  "142": [
308
314
  "dax"
309
315
  ],
@@ -313,6 +319,9 @@ exports.default = {
313
319
  "163": [
314
320
  "pht"
315
321
  ],
322
+ "168": [
323
+ "aioz"
324
+ ],
316
325
  "170": [
317
326
  "hoosmartchain"
318
327
  ],
@@ -337,9 +346,18 @@ exports.default = {
337
346
  "211": [
338
347
  "EDI"
339
348
  ],
349
+ "218": [
350
+ "SO1-old"
351
+ ],
340
352
  "222": [
341
353
  "ASK"
342
354
  ],
355
+ "225": [
356
+ "LA"
357
+ ],
358
+ "226": [
359
+ "TLA"
360
+ ],
343
361
  "246": [
344
362
  "ewt"
345
363
  ],
@@ -361,6 +379,9 @@ exports.default = {
361
379
  "288": [
362
380
  "Boba"
363
381
  ],
382
+ "300": [
383
+ "ogc"
384
+ ],
364
385
  "321": [
365
386
  "kcs"
366
387
  ],
@@ -445,6 +466,9 @@ exports.default = {
445
466
  "787": [
446
467
  "aca"
447
468
  ],
469
+ "788": [
470
+ "taero"
471
+ ],
448
472
  "803": [
449
473
  "haic"
450
474
  ],
@@ -496,6 +520,9 @@ exports.default = {
496
520
  "1007": [
497
521
  "tnew"
498
522
  ],
523
+ "1008": [
524
+ "eun"
525
+ ],
499
526
  "1010": [
500
527
  "EVC"
501
528
  ],
@@ -550,12 +577,18 @@ exports.default = {
550
577
  "1285": [
551
578
  "mriver"
552
579
  ],
580
+ "1286": [
581
+ "mrock-old"
582
+ ],
553
583
  "1287": [
554
584
  "mbase"
555
585
  ],
556
586
  "1288": [
557
587
  "mrock"
558
588
  ],
589
+ "1337": [
590
+ "cennz-a"
591
+ ],
559
592
  "1618": [
560
593
  "cate"
561
594
  ],
@@ -565,15 +598,24 @@ exports.default = {
565
598
  "1657": [
566
599
  "bta"
567
600
  ],
601
+ "1688": [
602
+ "LUDAN"
603
+ ],
568
604
  "1856": [
569
605
  "tsf"
570
606
  ],
571
607
  "1898": [
572
608
  "boya"
573
609
  ],
610
+ "1984": [
611
+ "euntest"
612
+ ],
574
613
  "1987": [
575
614
  "egem"
576
615
  ],
616
+ "2001": [
617
+ "milkAda"
618
+ ],
577
619
  "2020": [
578
620
  "420"
579
621
  ],
@@ -595,9 +637,18 @@ exports.default = {
595
637
  "2213": [
596
638
  "evanesco"
597
639
  ],
640
+ "2221": [
641
+ "kava"
642
+ ],
598
643
  "2559": [
599
644
  "ktoc"
600
645
  ],
646
+ "3000": [
647
+ "cennz-r"
648
+ ],
649
+ "3001": [
650
+ "cennz-n"
651
+ ],
601
652
  "3331": [
602
653
  "zcrbeach"
603
654
  ],
@@ -625,6 +676,9 @@ exports.default = {
625
676
  "4002": [
626
677
  "tftm"
627
678
  ],
679
+ "4102": [
680
+ "aioz-testnet"
681
+ ],
628
682
  "4689": [
629
683
  "iotex-mainnet"
630
684
  ],
@@ -643,6 +697,9 @@ exports.default = {
643
697
  "5700": [
644
698
  "tsys"
645
699
  ],
700
+ "5777": [
701
+ "dgcc"
702
+ ],
646
703
  "5851": [
647
704
  "Ontology Testnet"
648
705
  ],
@@ -787,6 +844,9 @@ exports.default = {
787
844
  "44787": [
788
845
  "ALFA"
789
846
  ],
847
+ "45000": [
848
+ "autobahn"
849
+ ],
790
850
  "47805": [
791
851
  "REI"
792
852
  ],
@@ -910,6 +970,9 @@ exports.default = {
910
970
  "110008": [
911
971
  "qkc-d-s7"
912
972
  ],
973
+ "200101": [
974
+ "milkTAda"
975
+ ],
913
976
  "200625": [
914
977
  "aka"
915
978
  ],
@@ -919,9 +982,6 @@ exports.default = {
919
982
  "201030": [
920
983
  "alayadev"
921
984
  ],
922
- "210309": [
923
- "platondev"
924
- ],
925
985
  "210425": [
926
986
  "platon"
927
987
  ],
@@ -967,6 +1027,9 @@ exports.default = {
967
1027
  "1337702": [
968
1028
  "kintsugi"
969
1029
  ],
1030
+ "2203181": [
1031
+ "platondev"
1032
+ ],
970
1033
  "7762959": [
971
1034
  "music"
972
1035
  ],
File without changes
File without changes
@@ -15,5 +15,11 @@ export declare class TinyBig extends Big {
15
15
  }
16
16
  /**
17
17
  * Helper factory function so that you don't have to type "new" when instantiating a new TinyBig
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * tinyBig(10).times(3).toNumber()
22
+ * // 30
23
+ * ```
18
24
  */
19
25
  export declare function tinyBig(value: string | number | TinyBig | Big): TinyBig;
@@ -34,6 +34,12 @@ class TinyBig extends big_js_1.default {
34
34
  exports.TinyBig = TinyBig;
35
35
  /**
36
36
  * Helper factory function so that you don't have to type "new" when instantiating a new TinyBig
37
+ *
38
+ * @example
39
+ * ```javascript
40
+ * tinyBig(10).times(3).toNumber()
41
+ * // 30
42
+ * ```
37
43
  */
38
44
  function tinyBig(value) {
39
45
  return new TinyBig(value);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ import Big from 'big.js';
2
+ import { TinyBig } from '../shared/tiny-big/tiny-big';
3
+ /**
4
+ * Convert from Ether to Gwei
5
+ *
6
+ * No direct equivalent in ether.js; requires multiple functions to achieve.
7
+ *
8
+ * No direct equivalent in web3; requires multiple functions to achieve.
9
+ *
10
+ * @example
11
+ * ```javascript
12
+ * etherToGwei('1000').toString()
13
+ * // '1000000000000'
14
+ * etherToGwei(1000).toString()
15
+ * // '1000000000000'
16
+ * ```
17
+ *
18
+ * @example
19
+ * ```javascript
20
+ * etherToGwei('1000').toNumber()
21
+ * // 1000000000000
22
+ * etherToGwei(1000).toNumber()
23
+ * // 1000000000000
24
+ * ```
25
+ */
26
+ export declare function etherToGwei(etherQuantity: string | number | TinyBig | Big): TinyBig;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.etherToGwei = void 0;
4
+ const tiny_big_1 = require("../shared/tiny-big/tiny-big");
5
+ const validate_type_1 = require("../shared/validate-type");
6
+ /**
7
+ * Convert from Ether to Gwei
8
+ *
9
+ * No direct equivalent in ether.js; requires multiple functions to achieve.
10
+ *
11
+ * No direct equivalent in web3; requires multiple functions to achieve.
12
+ *
13
+ * @example
14
+ * ```javascript
15
+ * etherToGwei('1000').toString()
16
+ * // '1000000000000'
17
+ * etherToGwei(1000).toString()
18
+ * // '1000000000000'
19
+ * ```
20
+ *
21
+ * @example
22
+ * ```javascript
23
+ * etherToGwei('1000').toNumber()
24
+ * // 1000000000000
25
+ * etherToGwei(1000).toNumber()
26
+ * // 1000000000000
27
+ * ```
28
+ */
29
+ function etherToGwei(etherQuantity) {
30
+ (0, validate_type_1.validateType)(etherQuantity, ['string', 'number', 'object']);
31
+ const result = (0, tiny_big_1.tinyBig)(etherQuantity).times('1000000000');
32
+ return (0, tiny_big_1.tinyBig)(result);
33
+ }
34
+ exports.etherToGwei = etherToGwei;
@@ -1,9 +1,11 @@
1
1
  import Big from 'big.js';
2
2
  import { TinyBig } from '../shared/tiny-big/tiny-big';
3
3
  /**
4
- * Similar to ["parseEther" in ethers.js](https://docs.ethers.io/v4/api-utils.html#ether-strings-and-wei)
4
+ * Convert Ether to Wei
5
5
  *
6
- * Similar to ["toWei" in web3](https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html?highlight=towei#towei)
6
+ * Similar to ["parseEther" in ethers.js](https://docs.ethers.io/v5/api/utils/display-logic/#utils-parseEther)
7
+ *
8
+ * Similar to ["toWei" in web3.js](https://web3js.readthedocs.io/en/v1.7.1/web3-utils.html#towei)
7
9
  *
8
10
  * @example
9
11
  * ```javascript
@@ -4,9 +4,11 @@ exports.etherToWei = void 0;
4
4
  const tiny_big_1 = require("../shared/tiny-big/tiny-big");
5
5
  const validate_type_1 = require("../shared/validate-type");
6
6
  /**
7
- * Similar to ["parseEther" in ethers.js](https://docs.ethers.io/v4/api-utils.html#ether-strings-and-wei)
7
+ * Convert Ether to Wei
8
8
  *
9
- * Similar to ["toWei" in web3](https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html?highlight=towei#towei)
9
+ * Similar to ["parseEther" in ethers.js](https://docs.ethers.io/v5/api/utils/display-logic/#utils-parseEther)
10
+ *
11
+ * Similar to ["toWei" in web3.js](https://web3js.readthedocs.io/en/v1.7.1/web3-utils.html#towei)
10
12
  *
11
13
  * @example
12
14
  * ```javascript
@@ -0,0 +1,26 @@
1
+ import Big from 'big.js';
2
+ import { TinyBig } from './../shared/tiny-big/tiny-big';
3
+ /**
4
+ * Convert from Gwei to Ether
5
+ *
6
+ * No direct equivalent in ethers.js; requires multiple functions to achieve.
7
+ *
8
+ * No direct equivalent in web3; requires multiple functions to achieve.
9
+ *
10
+ * @example
11
+ * ```javascript
12
+ * gweiToEther('1000000000000').toString()
13
+ * // '1000'
14
+ * gweiToEther(1000000000000).toString()
15
+ * // '1000'
16
+ * ```
17
+ *
18
+ * @example
19
+ * ```javascript
20
+ * gweiToEther('1000000000000').toNumber()
21
+ * // 1000
22
+ * gweiToEther(1000000000000).toNumber()
23
+ * // 1000
24
+ * ```
25
+ */
26
+ export declare function gweiToEther(gweiQuantity: string | number | TinyBig | Big): TinyBig;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gweiToEther = void 0;
4
+ const tiny_big_1 = require("../shared/tiny-big/tiny-big");
5
+ const validate_type_1 = require("../shared/validate-type");
6
+ /**
7
+ * Convert from Gwei to Ether
8
+ *
9
+ * No direct equivalent in ethers.js; requires multiple functions to achieve.
10
+ *
11
+ * No direct equivalent in web3; requires multiple functions to achieve.
12
+ *
13
+ * @example
14
+ * ```javascript
15
+ * gweiToEther('1000000000000').toString()
16
+ * // '1000'
17
+ * gweiToEther(1000000000000).toString()
18
+ * // '1000'
19
+ * ```
20
+ *
21
+ * @example
22
+ * ```javascript
23
+ * gweiToEther('1000000000000').toNumber()
24
+ * // 1000
25
+ * gweiToEther(1000000000000).toNumber()
26
+ * // 1000
27
+ * ```
28
+ */
29
+ function gweiToEther(gweiQuantity) {
30
+ (0, validate_type_1.validateType)(gweiQuantity, ['string', 'number', 'object']);
31
+ const result = (0, tiny_big_1.tinyBig)(gweiQuantity).div('1000000000');
32
+ return (0, tiny_big_1.tinyBig)(result);
33
+ }
34
+ exports.gweiToEther = gweiToEther;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Returns a boolean as to whether the input is a valid address.
3
+ * Does NOT support ICAP addresses
4
+ *
5
+ * @example
6
+ * ```javascript
7
+ * isAddress('0xc0deaf6bd3f0c6574a6a625ef2f22f62a5150eab');
8
+ * // true
9
+ * ```
10
+ *
11
+ * @example
12
+ * ```javascript
13
+ * isAddress('bad');
14
+ * // false
15
+ * ```
16
+ *
17
+ * @example
18
+ * ```javascript
19
+ * // Does NOT support ENS.
20
+ * isAddress('vitalik.eth');
21
+ * // false
22
+ * ```
23
+ */
24
+ export declare function isAddress(address: string): boolean;
@@ -1,16 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isAddress = void 0;
4
+ const __1 = require("..");
4
5
  const validate_type_1 = require("../shared/validate-type");
5
- const utils_1 = require("../utils");
6
6
  /**
7
7
  * Returns a boolean as to whether the input is a valid address.
8
8
  * Does NOT support ICAP addresses
9
+ *
10
+ * @example
11
+ * ```javascript
12
+ * isAddress('0xc0deaf6bd3f0c6574a6a625ef2f22f62a5150eab');
13
+ * // true
14
+ * ```
15
+ *
16
+ * @example
17
+ * ```javascript
18
+ * isAddress('bad');
19
+ * // false
20
+ * ```
21
+ *
22
+ * @example
23
+ * ```javascript
24
+ * // Does NOT support ENS.
25
+ * isAddress('vitalik.eth');
26
+ * // false
27
+ * ```
9
28
  */
10
29
  function isAddress(address) {
11
30
  (0, validate_type_1.validateType)(address, ['string']);
12
31
  try {
13
- (0, utils_1.toChecksumAddress)(address);
32
+ (0, __1.toChecksumAddress)(address);
14
33
  return true;
15
34
  }
16
35
  catch (error) {
@@ -10,8 +10,8 @@
10
10
  * // '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359'
11
11
  * ```
12
12
  *
13
- * Similar to ["getAddress" in ethers.js](https://docs.ethers.io/v4/api-utils.html#utils-getaddress)
13
+ * Similar to ["getAddress" in ethers.js](https://docs.ethers.io/v5/api/utils/address/#utils-getAddress)
14
14
  *
15
- * Similar to ["toChecksumAddress" in web3](https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html#tochecksumaddress)
15
+ * Similar to ["toChecksumAddress" in web3.js](https://web3js.readthedocs.io/en/v1.7.1/web3-utils.html#tochecksumaddress)
16
16
  */
17
17
  export declare function toChecksumAddress(address: string): string;
@@ -15,9 +15,9 @@ const validate_type_1 = require("../shared/validate-type");
15
15
  * // '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359'
16
16
  * ```
17
17
  *
18
- * Similar to ["getAddress" in ethers.js](https://docs.ethers.io/v4/api-utils.html#utils-getaddress)
18
+ * Similar to ["getAddress" in ethers.js](https://docs.ethers.io/v5/api/utils/address/#utils-getAddress)
19
19
  *
20
- * Similar to ["toChecksumAddress" in web3](https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html#tochecksumaddress)
20
+ * Similar to ["toChecksumAddress" in web3.js](https://web3js.readthedocs.io/en/v1.7.1/web3-utils.html#tochecksumaddress)
21
21
  */
22
22
  function toChecksumAddress(address) {
23
23
  (0, validate_type_1.validateType)(address, ['string']);
@@ -0,0 +1,26 @@
1
+ import Big from 'big.js';
2
+ import { TinyBig } from '../shared/tiny-big/tiny-big';
3
+ /**
4
+ * Convert from Wei to Ether
5
+ *
6
+ * Similar to ["formatEther" in ethers.js](https://docs.ethers.io/v5/api/utils/display-logic/#utils-formatEther)
7
+ *
8
+ * Similar to ["fromWei" in web3.js](https://web3js.readthedocs.io/en/v1.7.1/web3-utils.html#fromwei)
9
+ *
10
+ * @example
11
+ * ```javascript
12
+ * weiToEther('1000000000000000000000').toString()
13
+ * // '1000'
14
+ * weiToEther(1000000000000000000000).toString()
15
+ * // '1000'
16
+ * ```
17
+ *
18
+ * @example
19
+ * ```javascript
20
+ * weiToEther('1000000000000000000000').toNumber()
21
+ * // 1000
22
+ * weiToEther(1000000000000000000000).toNumber()
23
+ * // 1000
24
+ * ```
25
+ */
26
+ export declare function weiToEther(weiQuantity: string | number | TinyBig | Big): TinyBig;
@@ -4,26 +4,26 @@ exports.weiToEther = void 0;
4
4
  const tiny_big_1 = require("../shared/tiny-big/tiny-big");
5
5
  const validate_type_1 = require("../shared/validate-type");
6
6
  /**
7
- * Convert from Ether to Wei
7
+ * Convert from Wei to Ether
8
8
  *
9
- * Similar to ["formatEther" in ethers.js](https://docs.ethers.io/v4/api-utils.html#ether-strings-and-wei)
9
+ * Similar to ["formatEther" in ethers.js](https://docs.ethers.io/v5/api/utils/display-logic/#utils-formatEther)
10
10
  *
11
- * Similar to ["fromWei" in web3](https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html#fromwei)
11
+ * Similar to ["fromWei" in web3.js](https://web3js.readthedocs.io/en/v1.7.1/web3-utils.html#fromwei)
12
12
  *
13
13
  * @example
14
14
  * ```javascript
15
- * etherToWei('1000').toString()
16
- * // '1000000000000000000000'
17
- * etherToWei(1000).toString()
18
- * '1000000000000000000000'
15
+ * weiToEther('1000000000000000000000').toString()
16
+ * // '1000'
17
+ * weiToEther(1000000000000000000000).toString()
18
+ * // '1000'
19
19
  * ```
20
20
  *
21
21
  * @example
22
22
  * ```javascript
23
- * etherToWei('1000').toNumber()
24
- * // 1000000000000000000000
25
- * etherToWei(1000).toNumber()
26
- * // 1000000000000000000000
23
+ * weiToEther('1000000000000000000000').toNumber()
24
+ * // 1000
25
+ * weiToEther(1000000000000000000000).toNumber()
26
+ * // 1000
27
27
  * ```
28
28
  */
29
29
  function weiToEther(weiQuantity) {
File without changes
@@ -40,17 +40,12 @@ export class BaseContract {
40
40
  ? estimateGas(data)
41
41
  : null;
42
42
  const req = () => __awaiter(this, void 0, void 0, function* () {
43
- return yield post(this._provider._rpcUrl[this._provider._rpcUrlCounter], buildRPCPostBody('eth_call', [
44
- Object.assign({ to: this._address.toLowerCase(), data: data }, (decimalGas
43
+ return yield post(this._provider._rpcUrl, buildRPCPostBody('eth_call', [
44
+ Object.assign({ to: this._address.toLowerCase(), data }, (decimalGas
45
45
  ? { gas: `0x${decimalGas.toString(16)}` }
46
46
  : {})),
47
47
  'latest',
48
- ])).catch((e) => {
49
- if (e.code === 'ENOTFOUND') {
50
- this._provider._rpcUrlCounter++;
51
- return req();
52
- }
53
- });
48
+ ]));
54
49
  });
55
50
  const nodeResponse = yield req();
56
51
  return decodeRPCResponse(jsonABIArgument, nodeResponse);
File without changes
@@ -1,4 +1,4 @@
1
- import { toChecksumAddress } from '../../utils';
1
+ import { toChecksumAddress } from '../..';
2
2
  import { cleanTransaction } from './clean-transaction';
3
3
  import { hexToDecimal } from './hex-to-decimal';
4
4
  export function cleanBlock(block, returnTransactionObjects) {
@@ -1,4 +1,4 @@
1
- import { toChecksumAddress } from '../../utils';
1
+ import { toChecksumAddress } from '../..';
2
2
  import { hexToDecimal } from './hex-to-decimal';
3
3
  export function cleanTransaction(transaction) {
4
4
  const cleanedTransaction = Object.assign({}, transaction);
@@ -1,6 +1,5 @@
1
1
  import { Keccak } from 'sha3';
2
- import { tinyBig } from '../..';
3
- import { toChecksumAddress } from '../../utils';
2
+ import { tinyBig, toChecksumAddress } from '../..';
4
3
  import { hexToDecimal } from './hex-to-decimal';
5
4
  const hexTrue = '0000000000000000000000000000000000000000000000000000000000000001';
6
5
  const hexFalse = '0000000000000000000000000000000000000000000000000000000000000000';
@@ -1,5 +1,5 @@
1
1
  export declare function post(url: string, body: Record<string, unknown>): Promise<any>;
2
- declare type RPCMethodName = 'eth_getBlockByNumber' | 'eth_call' | 'eth_chainId';
2
+ declare type RPCMethodName = 'eth_getBlockByNumber' | 'eth_call' | 'eth_chainId' | 'eth_gasPrice';
3
3
  export declare function buildRPCPostBody(method: RPCMethodName, params: any[]): {
4
4
  jsonrpc: string;
5
5
  id: number;