essential-eth 0.5.9 → 0.5.10-next.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.
Files changed (195) hide show
  1. package/{lib/esm → dist}/classes/Contract.d.ts +11 -11
  2. package/dist/classes/test/Contract/crv-abi.d.ts +2 -0
  3. package/dist/classes/test/Contract/ens-abi.d.ts +2 -0
  4. package/dist/classes/test/Contract/fei-abi.d.ts +2 -0
  5. package/dist/classes/test/Contract/foo-abi.d.ts +2 -0
  6. package/dist/classes/test/Contract/uniswap-abi.d.ts +2 -0
  7. package/dist/classes/utils/clean-block.d.ts +3 -0
  8. package/{lib/esm → dist}/classes/utils/clean-log.d.ts +2 -2
  9. package/{lib/esm → dist}/classes/utils/clean-transaction-receipt.d.ts +2 -2
  10. package/{lib/esm → dist}/classes/utils/clean-transaction.d.ts +2 -2
  11. package/{lib/esm → dist}/classes/utils/encode-decode-transaction.d.ts +4 -4
  12. package/{lib/esm → dist}/classes/utils/fetchers.d.ts +9 -9
  13. package/{lib/esm → dist}/classes/utils/hex-to-decimal.d.ts +1 -1
  14. package/{lib/esm → dist}/classes/utils/prepare-transaction.d.ts +2 -2
  15. package/{lib/esm → dist}/index.d.ts +25 -25
  16. package/dist/index.js +2 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/index.modern.mjs +2 -0
  19. package/dist/index.modern.mjs.map +1 -0
  20. package/dist/index.module.js +2 -0
  21. package/dist/index.module.js.map +1 -0
  22. package/dist/index.umd.js +2 -0
  23. package/dist/index.umd.js.map +1 -0
  24. package/{lib/esm → dist}/logger/logger.d.ts +11 -11
  25. package/dist/logger/package-version.d.ts +1 -0
  26. package/{lib/esm → dist}/providers/BaseProvider.d.ts +24 -24
  27. package/{lib/esm → dist}/providers/FallthroughProvider.d.ts +11 -11
  28. package/{lib/esm → dist}/providers/JsonRpcProvider.d.ts +7 -7
  29. package/{lib/cjs → dist}/providers/test/rpc-urls.d.ts +11 -11
  30. package/{lib/cjs → dist}/providers/utils/chains-info.d.ts +467 -423
  31. package/{lib/esm → dist}/shared/tiny-big/helpers.d.ts +1 -1
  32. package/{lib/esm → dist}/shared/tiny-big/tiny-big.d.ts +10 -10
  33. package/{lib/cjs → dist}/shared/validate-type.d.ts +3 -3
  34. package/{lib/cjs → dist}/types/Block.types.d.ts +40 -41
  35. package/{lib/cjs → dist}/types/Contract.types.d.ts +24 -24
  36. package/{lib/esm → dist}/types/Filter.types.d.ts +12 -12
  37. package/{lib/esm → dist}/types/Network.types.d.ts +5 -5
  38. package/{lib/esm → dist}/types/Transaction.types.d.ts +113 -113
  39. package/{lib/esm → dist}/utils/bytes.d.ts +40 -40
  40. package/{lib/esm → dist}/utils/compute-address.d.ts +1 -1
  41. package/{lib/esm → dist}/utils/compute-public-key.d.ts +2 -2
  42. package/{lib/esm → dist}/utils/ether-to-gwei.d.ts +3 -3
  43. package/dist/utils/ether-to-wei.d.ts +3 -0
  44. package/dist/utils/gwei-to-ether.d.ts +3 -0
  45. package/{lib/esm → dist}/utils/hash-message.d.ts +2 -2
  46. package/{lib/esm → dist}/utils/is-address.d.ts +1 -1
  47. package/{lib/esm → dist}/utils/keccak256.d.ts +2 -2
  48. package/{lib/esm → dist}/utils/solidity-keccak256.d.ts +2 -2
  49. package/{lib/esm → dist}/utils/split-signature.d.ts +2 -2
  50. package/{lib/esm → dist}/utils/to-checksum-address.d.ts +1 -1
  51. package/{lib/esm → dist}/utils/to-utf8-bytes.d.ts +1 -1
  52. package/dist/utils/wei-to-ether.d.ts +3 -0
  53. package/package.json +21 -14
  54. package/lib/cjs/classes/Contract.d.ts +0 -78
  55. package/lib/cjs/classes/Contract.js +0 -140
  56. package/lib/cjs/classes/test/Contract/crv-abi.d.ts +0 -2
  57. package/lib/cjs/classes/test/Contract/crv-abi.js +0 -488
  58. package/lib/cjs/classes/test/Contract/ens-abi.d.ts +0 -2
  59. package/lib/cjs/classes/test/Contract/ens-abi.js +0 -453
  60. package/lib/cjs/classes/test/Contract/fei-abi.d.ts +0 -2
  61. package/lib/cjs/classes/test/Contract/fei-abi.js +0 -526
  62. package/lib/cjs/classes/test/Contract/foo-abi.d.ts +0 -2
  63. package/lib/cjs/classes/test/Contract/foo-abi.js +0 -42
  64. package/lib/cjs/classes/test/Contract/uniswap-abi.d.ts +0 -2
  65. package/lib/cjs/classes/test/Contract/uniswap-abi.js +0 -121
  66. package/lib/cjs/classes/utils/clean-block.d.ts +0 -121
  67. package/lib/cjs/classes/utils/clean-block.js +0 -160
  68. package/lib/cjs/classes/utils/clean-log.d.ts +0 -9
  69. package/lib/cjs/classes/utils/clean-log.js +0 -37
  70. package/lib/cjs/classes/utils/clean-transaction-receipt.d.ts +0 -14
  71. package/lib/cjs/classes/utils/clean-transaction-receipt.js +0 -50
  72. package/lib/cjs/classes/utils/clean-transaction.d.ts +0 -14
  73. package/lib/cjs/classes/utils/clean-transaction.js +0 -51
  74. package/lib/cjs/classes/utils/encode-decode-transaction.d.ts +0 -16
  75. package/lib/cjs/classes/utils/encode-decode-transaction.js +0 -137
  76. package/lib/cjs/classes/utils/fetchers.d.ts +0 -39
  77. package/lib/cjs/classes/utils/fetchers.js +0 -81
  78. package/lib/cjs/classes/utils/hex-to-decimal.d.ts +0 -18
  79. package/lib/cjs/classes/utils/hex-to-decimal.js +0 -24
  80. package/lib/cjs/classes/utils/prepare-transaction.d.ts +0 -6
  81. package/lib/cjs/classes/utils/prepare-transaction.js +0 -45
  82. package/lib/cjs/index.d.ts +0 -25
  83. package/lib/cjs/index.js +0 -54
  84. package/lib/cjs/logger/logger.d.ts +0 -11
  85. package/lib/cjs/logger/logger.js +0 -36
  86. package/lib/cjs/logger/package-version.d.ts +0 -1
  87. package/lib/cjs/logger/package-version.js +0 -5
  88. package/lib/cjs/providers/BaseProvider.d.ts +0 -353
  89. package/lib/cjs/providers/BaseProvider.js +0 -512
  90. package/lib/cjs/providers/FallthroughProvider.d.ts +0 -24
  91. package/lib/cjs/providers/FallthroughProvider.js +0 -65
  92. package/lib/cjs/providers/JsonRpcProvider.d.ts +0 -33
  93. package/lib/cjs/providers/JsonRpcProvider.js +0 -46
  94. package/lib/cjs/providers/test/rpc-urls.js +0 -14
  95. package/lib/cjs/providers/utils/chains-info.js +0 -1270
  96. package/lib/cjs/shared/tiny-big/helpers.d.ts +0 -17
  97. package/lib/cjs/shared/tiny-big/helpers.js +0 -97
  98. package/lib/cjs/shared/tiny-big/tiny-big.d.ts +0 -58
  99. package/lib/cjs/shared/tiny-big/tiny-big.js +0 -101
  100. package/lib/cjs/shared/validate-type.js +0 -9
  101. package/lib/cjs/types/Block.types.js +0 -2
  102. package/lib/cjs/types/Contract.types.js +0 -2
  103. package/lib/cjs/types/Filter.types.d.ts +0 -16
  104. package/lib/cjs/types/Filter.types.js +0 -2
  105. package/lib/cjs/types/Network.types.d.ts +0 -8
  106. package/lib/cjs/types/Network.types.js +0 -2
  107. package/lib/cjs/types/Transaction.types.d.ts +0 -123
  108. package/lib/cjs/types/Transaction.types.js +0 -2
  109. package/lib/cjs/utils/bytes.d.ts +0 -289
  110. package/lib/cjs/utils/bytes.js +0 -711
  111. package/lib/cjs/utils/compute-address.d.ts +0 -17
  112. package/lib/cjs/utils/compute-address.js +0 -33
  113. package/lib/cjs/utils/compute-public-key.d.ts +0 -18
  114. package/lib/cjs/utils/compute-public-key.js +0 -26
  115. package/lib/cjs/utils/ether-to-gwei.d.ts +0 -27
  116. package/lib/cjs/utils/ether-to-gwei.js +0 -35
  117. package/lib/cjs/utils/ether-to-wei.d.ts +0 -27
  118. package/lib/cjs/utils/ether-to-wei.js +0 -35
  119. package/lib/cjs/utils/gwei-to-ether.d.ts +0 -27
  120. package/lib/cjs/utils/gwei-to-ether.js +0 -35
  121. package/lib/cjs/utils/hash-message.d.ts +0 -14
  122. package/lib/cjs/utils/hash-message.js +0 -28
  123. package/lib/cjs/utils/is-address.d.ts +0 -24
  124. package/lib/cjs/utils/is-address.js +0 -39
  125. package/lib/cjs/utils/keccak256.d.ts +0 -16
  126. package/lib/cjs/utils/keccak256.js +0 -31
  127. package/lib/cjs/utils/solidity-keccak256.d.ts +0 -39
  128. package/lib/cjs/utils/solidity-keccak256.js +0 -138
  129. package/lib/cjs/utils/split-signature.d.ts +0 -24
  130. package/lib/cjs/utils/split-signature.js +0 -163
  131. package/lib/cjs/utils/to-checksum-address.d.ts +0 -17
  132. package/lib/cjs/utils/to-checksum-address.js +0 -46
  133. package/lib/cjs/utils/to-utf8-bytes.d.ts +0 -15
  134. package/lib/cjs/utils/to-utf8-bytes.js +0 -21
  135. package/lib/cjs/utils/wei-to-ether.d.ts +0 -27
  136. package/lib/cjs/utils/wei-to-ether.js +0 -45
  137. package/lib/esm/classes/Contract.js +0 -65
  138. package/lib/esm/classes/test/Contract/crv-abi.d.ts +0 -2
  139. package/lib/esm/classes/test/Contract/crv-abi.js +0 -470
  140. package/lib/esm/classes/test/Contract/ens-abi.d.ts +0 -2
  141. package/lib/esm/classes/test/Contract/ens-abi.js +0 -435
  142. package/lib/esm/classes/test/Contract/fei-abi.d.ts +0 -2
  143. package/lib/esm/classes/test/Contract/fei-abi.js +0 -521
  144. package/lib/esm/classes/test/Contract/foo-abi.d.ts +0 -2
  145. package/lib/esm/classes/test/Contract/foo-abi.js +0 -33
  146. package/lib/esm/classes/test/Contract/uniswap-abi.d.ts +0 -2
  147. package/lib/esm/classes/test/Contract/uniswap-abi.js +0 -116
  148. package/lib/esm/classes/utils/clean-block.d.ts +0 -3
  149. package/lib/esm/classes/utils/clean-block.js +0 -35
  150. package/lib/esm/classes/utils/clean-log.js +0 -26
  151. package/lib/esm/classes/utils/clean-transaction-receipt.js +0 -34
  152. package/lib/esm/classes/utils/clean-transaction.js +0 -33
  153. package/lib/esm/classes/utils/encode-decode-transaction.js +0 -98
  154. package/lib/esm/classes/utils/fetchers.js +0 -43
  155. package/lib/esm/classes/utils/hex-to-decimal.js +0 -3
  156. package/lib/esm/classes/utils/prepare-transaction.js +0 -34
  157. package/lib/esm/index.js +0 -20
  158. package/lib/esm/logger/logger.js +0 -33
  159. package/lib/esm/logger/package-version.d.ts +0 -1
  160. package/lib/esm/logger/package-version.js +0 -1
  161. package/lib/esm/providers/BaseProvider.js +0 -157
  162. package/lib/esm/providers/FallthroughProvider.js +0 -41
  163. package/lib/esm/providers/JsonRpcProvider.js +0 -15
  164. package/lib/esm/providers/test/rpc-urls.d.ts +0 -11
  165. package/lib/esm/providers/test/rpc-urls.js +0 -11
  166. package/lib/esm/providers/utils/chains-info.d.ts +0 -423
  167. package/lib/esm/providers/utils/chains-info.js +0 -1266
  168. package/lib/esm/shared/tiny-big/helpers.js +0 -58
  169. package/lib/esm/shared/tiny-big/tiny-big.js +0 -45
  170. package/lib/esm/shared/validate-type.d.ts +0 -3
  171. package/lib/esm/shared/validate-type.js +0 -5
  172. package/lib/esm/types/Block.types.d.ts +0 -40
  173. package/lib/esm/types/Block.types.js +0 -1
  174. package/lib/esm/types/Contract.types.d.ts +0 -24
  175. package/lib/esm/types/Contract.types.js +0 -1
  176. package/lib/esm/types/Filter.types.js +0 -1
  177. package/lib/esm/types/Network.types.js +0 -1
  178. package/lib/esm/types/Transaction.types.js +0 -1
  179. package/lib/esm/utils/bytes.js +0 -245
  180. package/lib/esm/utils/compute-address.js +0 -11
  181. package/lib/esm/utils/compute-public-key.js +0 -6
  182. package/lib/esm/utils/ether-to-gwei.js +0 -7
  183. package/lib/esm/utils/ether-to-wei.d.ts +0 -3
  184. package/lib/esm/utils/ether-to-wei.js +0 -7
  185. package/lib/esm/utils/gwei-to-ether.d.ts +0 -3
  186. package/lib/esm/utils/gwei-to-ether.js +0 -7
  187. package/lib/esm/utils/hash-message.js +0 -12
  188. package/lib/esm/utils/is-address.js +0 -12
  189. package/lib/esm/utils/keccak256.js +0 -13
  190. package/lib/esm/utils/solidity-keccak256.js +0 -85
  191. package/lib/esm/utils/split-signature.js +0 -126
  192. package/lib/esm/utils/to-checksum-address.js +0 -25
  193. package/lib/esm/utils/to-utf8-bytes.js +0 -3
  194. package/lib/esm/utils/wei-to-ether.d.ts +0 -3
  195. package/lib/esm/utils/wei-to-ether.js +0 -16
@@ -1,17 +0,0 @@
1
- /**
2
- * Converts a string in scientific notation formatting to string in decimal format
3
- *
4
- * @param scientificString a string in scientific format to convert to decimal
5
- * @returns a string of a decimal number equivalent to the specified scientificString
6
- * @example
7
- * ```javascript
8
- * scientificStrToDecimalStr('2.3e-5');
9
- * // '0.000023'
10
- * ```
11
- * @example
12
- * ```javascript
13
- * scientificStrToDecimalStr('2.3e+5');
14
- * // '230000'
15
- * ```
16
- */
17
- export declare function scientificStrToDecimalStr(scientificString: string): string;
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scientificStrToDecimalStr = void 0;
4
- /**
5
- * Strips both leading and trailing zeroes from a number string
6
- *
7
- * @param numberString the string of numbers to strip zeros from
8
- * @returns a string of numbers without leading or trailing zeros
9
- * @example
10
- * ```javascript
11
- * stripTrailingZeros('0005280');
12
- * // '5280'
13
- * ```
14
- */
15
- function stripTrailingZeroes(numberString) {
16
- const isNegative = numberString.startsWith('-');
17
- numberString = numberString.replace('-', '');
18
- numberString = numberString.replace(/\.0*$/g, '' /* for numbers like "1.0" -> "1" */);
19
- numberString = numberString.replace(/^0+/, '');
20
- // for numbers like "1.10" -> "1.1"
21
- if (numberString.includes('.')) {
22
- numberString = numberString.replace(/0+$/, '');
23
- }
24
- if (numberString.startsWith('.')) {
25
- // so that ".1" returns as "0.1"
26
- numberString = `0${numberString}`;
27
- }
28
- return `${isNegative ? '-' : ''}${numberString}`;
29
- }
30
- /**
31
- * Converts a string in scientific notation formatting to string in decimal format
32
- *
33
- * @param scientificString a string in scientific format to convert to decimal
34
- * @returns a string of a decimal number equivalent to the specified scientificString
35
- * @example
36
- * ```javascript
37
- * scientificStrToDecimalStr('2.3e-5');
38
- * // '0.000023'
39
- * ```
40
- * @example
41
- * ```javascript
42
- * scientificStrToDecimalStr('2.3e+5');
43
- * // '230000'
44
- * ```
45
- */
46
- function scientificStrToDecimalStr(scientificString) {
47
- // Does not contain "e" nor "E"
48
- if (!scientificString.match(/e/i /* lowercase and uppercase E */)) {
49
- return stripTrailingZeroes(scientificString);
50
- }
51
- // eslint-disable-next-line prefer-const
52
- let [base, power] = scientificString.split(/e/i /* lowercase and uppercase E */);
53
- // remove the leading "-" if negative
54
- const isNegative = Number(base) < 0;
55
- base = base.replace('-', '');
56
- base = stripTrailingZeroes(base);
57
- const [wholeNumber, fraction /* move decimal this many places */ = ''] = base.split('.');
58
- if (Number(power) === 0) {
59
- return `${isNegative ? '-' : ''}${stripTrailingZeroes(base)}`;
60
- }
61
- else {
62
- const includesDecimal = base.includes('.');
63
- if (!includesDecimal) {
64
- base = `${base}.`;
65
- }
66
- base = base.replace('.', '');
67
- const baseLength = base.length;
68
- let splitPaddedNumber;
69
- if (Number(power) < 0) {
70
- // move decimal left
71
- if (wholeNumber.length < Math.abs(Number(power))) {
72
- base = base.padStart(baseLength + Math.abs(Number(power)) - wholeNumber.length, '0');
73
- }
74
- splitPaddedNumber = base.split('');
75
- if (wholeNumber.length < Math.abs(Number(power))) {
76
- // starts with zeroes
77
- splitPaddedNumber = ['.', ...splitPaddedNumber];
78
- }
79
- else {
80
- splitPaddedNumber.splice(splitPaddedNumber.length - Math.abs(Number(power)), 0, '.');
81
- }
82
- }
83
- else {
84
- // move decimal right
85
- if (fraction.length < Math.abs(Number(power))) {
86
- base = base.padEnd(baseLength + Math.abs(Number(power)) - fraction.length, '0');
87
- }
88
- splitPaddedNumber = base.split('');
89
- if (fraction.length > Math.abs(Number(power))) {
90
- splitPaddedNumber.splice(splitPaddedNumber.length - Math.abs(Number(power)), 0, '.');
91
- }
92
- }
93
- const toReturn = stripTrailingZeroes(splitPaddedNumber.join(''));
94
- return `${isNegative ? '-' : ''}${toReturn}`;
95
- }
96
- }
97
- exports.scientificStrToDecimalStr = scientificStrToDecimalStr;
@@ -1,58 +0,0 @@
1
- import Big from 'big.js';
2
- /**
3
- * A wrapper around [big.js](https://github.com/MikeMcl/big.js) which expands scientific notation and creates a "toHexString" function.
4
- * This is the return type of every operation on ether, wei, etc.
5
- */
6
- export declare class TinyBig extends Big {
7
- constructor(value: string | number | TinyBig | Big);
8
- /**
9
- * Used anytime you're passing in "value" to ethers or web3
10
- * For now, TypeScript will complain that `TinyBig` is not a `BigNumberish`. You can // @ts-ignore or call this
11
- *
12
- * @returns the TinyBig represented as a hex string
13
- * @example
14
- * ```javascript
15
- * tinyBig(293).toHexString();
16
- * // '0x125'
17
- * ```
18
- * @example
19
- * ```javascript
20
- * tinyBig(681365874).toHexString();
21
- * // '0x289cd172'
22
- */
23
- toHexString(): string;
24
- toNumber(): number;
25
- toString(): string;
26
- /**
27
- * Eithers pads or shortens a string to a specified length
28
- *
29
- * @param str the string to pad or chop
30
- * @param padChar the character to pad the string with
31
- * @param length the desired length of the given string
32
- * @returns a string of the desired length, either padded with the specified padChar or with the beginning of the string chopped off
33
- * @example
34
- * ```javascript
35
- * padAndChop('essential-eth', 'a', 8);
36
- * // 'tial-eth'
37
- * ```
38
- * @example
39
- * ```javascript
40
- * padAndChop('essential-eth', 'A', 20);
41
- * // 'AAAAAAAessential-eth'
42
- * ```
43
- */
44
- private padAndChop;
45
- toTwos(bitCount: number): Big;
46
- }
47
- /**
48
- * Helper factory function so that you don't have to type "new" when instantiating a new TinyBig
49
- *
50
- * @param value the value to initiate the TinyBig with
51
- * @returns an initiated {@link TinyBig}
52
- * @example
53
- * ```javascript
54
- * tinyBig(10).times(3).toNumber()
55
- * // 30
56
- * ```
57
- */
58
- export declare function tinyBig(value: string | number | TinyBig | Big): TinyBig;
@@ -1,101 +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.tinyBig = exports.TinyBig = void 0;
7
- const big_js_1 = __importDefault(require("big.js"));
8
- const hex_to_decimal_1 = require("../../classes/utils/hex-to-decimal");
9
- const helpers_1 = require("./helpers");
10
- /**
11
- * A wrapper around [big.js](https://github.com/MikeMcl/big.js) which expands scientific notation and creates a "toHexString" function.
12
- * This is the return type of every operation on ether, wei, etc.
13
- */
14
- class TinyBig extends big_js_1.default {
15
- constructor(value) {
16
- if (typeof value === 'string' && value.startsWith('0x')) {
17
- value = (0, hex_to_decimal_1.hexToDecimal)(value);
18
- }
19
- super(value);
20
- /**
21
- * Eithers pads or shortens a string to a specified length
22
- *
23
- * @param str the string to pad or chop
24
- * @param padChar the character to pad the string with
25
- * @param length the desired length of the given string
26
- * @returns a string of the desired length, either padded with the specified padChar or with the beginning of the string chopped off
27
- * @example
28
- * ```javascript
29
- * padAndChop('essential-eth', 'a', 8);
30
- * // 'tial-eth'
31
- * ```
32
- * @example
33
- * ```javascript
34
- * padAndChop('essential-eth', 'A', 20);
35
- * // 'AAAAAAAessential-eth'
36
- * ```
37
- */
38
- this.padAndChop = (str, padChar, length) => {
39
- return (Array(length).fill(padChar).join('') + str).slice(length * -1);
40
- };
41
- }
42
- /**
43
- * Used anytime you're passing in "value" to ethers or web3
44
- * For now, TypeScript will complain that `TinyBig` is not a `BigNumberish`. You can // @ts-ignore or call this
45
- *
46
- * @returns the TinyBig represented as a hex string
47
- * @example
48
- * ```javascript
49
- * tinyBig(293).toHexString();
50
- * // '0x125'
51
- * ```
52
- * @example
53
- * ```javascript
54
- * tinyBig(681365874).toHexString();
55
- * // '0x289cd172'
56
- */
57
- toHexString() {
58
- return `0x${BigInt(this.toString()).toString(16)}`;
59
- }
60
- toNumber() {
61
- return Number((0, helpers_1.scientificStrToDecimalStr)(super.toString()));
62
- }
63
- toString() {
64
- if (this.toNumber() === 0) {
65
- return '0';
66
- }
67
- return (0, helpers_1.scientificStrToDecimalStr)(super.toString());
68
- }
69
- toTwos(bitCount) {
70
- let binaryStr;
71
- if (this.gte(0)) {
72
- const twosComp = this.toNumber().toString(2);
73
- binaryStr = this.padAndChop(twosComp, '0', bitCount || twosComp.length);
74
- }
75
- else {
76
- binaryStr = this.plus(Math.pow(2, bitCount)).toNumber().toString(2);
77
- if (Number(binaryStr) < 0) {
78
- throw new Error('Cannot calculate twos complement');
79
- }
80
- }
81
- const binary = `0b${binaryStr}`;
82
- const decimal = Number(binary);
83
- return tinyBig(decimal);
84
- }
85
- }
86
- exports.TinyBig = TinyBig;
87
- /**
88
- * Helper factory function so that you don't have to type "new" when instantiating a new TinyBig
89
- *
90
- * @param value the value to initiate the TinyBig with
91
- * @returns an initiated {@link TinyBig}
92
- * @example
93
- * ```javascript
94
- * tinyBig(10).times(3).toNumber()
95
- * // 30
96
- * ```
97
- */
98
- function tinyBig(value) {
99
- return new TinyBig(value);
100
- }
101
- exports.tinyBig = tinyBig;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateType = void 0;
4
- const validateType = (value, allowedTypes) => {
5
- if (!allowedTypes.includes(typeof value)) {
6
- throw new Error(`${allowedTypes.join(' or ')} required. Received ${typeof value}`);
7
- }
8
- };
9
- exports.validateType = validateType;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +0,0 @@
1
- import { BlockTag } from './Block.types';
2
- export interface EventFilter {
3
- address?: string;
4
- topics?: Array<string | Array<string> | null>;
5
- }
6
- /**
7
- * @param fromBlock block as starting point for range, inclusive
8
- * @param toBlock block as ending point for range, inclusive
9
- */
10
- export interface Filter extends EventFilter {
11
- fromBlock?: BlockTag;
12
- toBlock?: BlockTag;
13
- }
14
- export interface FilterByBlockHash extends EventFilter {
15
- blockHash?: string;
16
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- /**
2
- * A trimmed version of https://chainid.network/chains.json
3
- */
4
- export interface Network {
5
- chainId: number;
6
- ensAddress: string | null;
7
- name: string;
8
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,123 +0,0 @@
1
- import type Big from 'big.js';
2
- import { TinyBig } from '../shared/tiny-big/tiny-big';
3
- import { BytesLike } from './../utils/bytes';
4
- declare type Modify<T, R> = Omit<T, keyof R> & R;
5
- export interface RPCTransaction extends RPCBlockTransaction {
6
- maxFeePerGas: string;
7
- maxPriorityFeePerGas: string;
8
- }
9
- export declare type TransactionResponse = Modify<RPCTransaction, {
10
- blockNumber: number;
11
- chainId: number;
12
- gas: TinyBig;
13
- gasLimit: TinyBig;
14
- gasPrice: TinyBig;
15
- nonce: TinyBig;
16
- transactionIndex: number;
17
- type: number;
18
- v: number;
19
- value: TinyBig;
20
- } & {
21
- maxFeePerGas: TinyBig;
22
- maxPriorityFeePerGas: TinyBig;
23
- confirmations: number;
24
- }>;
25
- /**
26
- * Type that contains information from the receipt of a transaction
27
- *
28
- * * Similar to [`Type TransactionReceipt on ethers.providers`](https://docs.ethers.io/v5/api/providers/types/#providers-TransactionReceipt)
29
- */
30
- export declare type TransactionReceipt = Modify<RPCTransactionReceipt, {
31
- blockNumber: number;
32
- cumulativeGasUsed: TinyBig;
33
- effectiveGasPrice: TinyBig;
34
- gasUsed: TinyBig;
35
- logs: Array<Log>;
36
- status: number;
37
- transactionIndex: number;
38
- type: number;
39
- } & {
40
- byzantium: boolean;
41
- confirmations: number;
42
- }>;
43
- export interface RPCTransactionRequest {
44
- from?: string;
45
- to: string;
46
- gas?: string;
47
- gasPrice?: string;
48
- value?: string;
49
- data?: BytesLike;
50
- nonce?: string;
51
- maxPriorityFeePerGas?: string;
52
- maxFeePerGas?: string;
53
- }
54
- export interface TransactionRequest {
55
- to?: string;
56
- from?: string;
57
- nonce?: TinyBig | string | Big | number;
58
- gas?: TinyBig | number | Big | string;
59
- gasPrice?: TinyBig | Big | string | number;
60
- data?: BytesLike;
61
- value?: TinyBig | string | Big | number;
62
- chainId?: number;
63
- type?: number;
64
- maxPriorityFeePerGas?: TinyBig | string | Big | number;
65
- maxFeePerGas?: TinyBig | string | Big | number;
66
- }
67
- /**
68
- * Type for the logs that are included in transaction receipts
69
- * Similar to [`Type Log on ethers.providers`](https://docs.ethers.io/v5/api/providers/types/#providers-Log)
70
- */
71
- export declare type Log = Modify<RPCLog, {
72
- blockNumber: number;
73
- logIndex: number;
74
- transactionIndex: number;
75
- }>;
76
- export declare type BlockTransactionResponse = Omit<TransactionResponse, 'maxFeePerGas' | 'maxPriorityFeePerGas'>;
77
- /** What JSONRPC responds with in getBlock transaction array */
78
- export interface RPCBlockTransaction {
79
- blockHash: string;
80
- blockNumber: string;
81
- chainId: string;
82
- from: string;
83
- gas: string;
84
- gasPrice: string;
85
- hash: string;
86
- input: string;
87
- nonce: string;
88
- r: string;
89
- s: string;
90
- to: string;
91
- transactionIndex: string;
92
- type: string;
93
- v: string;
94
- value: string;
95
- }
96
- export interface RPCTransactionReceipt {
97
- blockHash: string;
98
- blockNumber: string;
99
- contractAddress: string;
100
- cumulativeGasUsed: string;
101
- effectiveGasPrice: string;
102
- from: string;
103
- gasUsed: string;
104
- logs: Array<RPCLog>;
105
- logsBloom: string;
106
- status: string;
107
- to: string;
108
- transactionHash: string;
109
- transactionIndex: string;
110
- type: string;
111
- }
112
- export interface RPCLog {
113
- address: string;
114
- blockHash: string;
115
- blockNumber: string;
116
- data: string;
117
- logIndex: string;
118
- removed?: boolean;
119
- topics: Array<string>;
120
- transactionHash: string;
121
- transactionIndex: string;
122
- }
123
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });