essential-eth 0.5.12 → 0.5.13-next.2

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 (208) hide show
  1. package/dist/cjs/classes/Contract.d.ts +11 -0
  2. package/{lib → dist}/cjs/classes/Contract.js +0 -0
  3. package/{lib/esm → dist/cjs}/classes/test/Contract/crv-abi.d.ts +2 -2
  4. package/{lib → dist}/cjs/classes/test/Contract/crv-abi.js +0 -0
  5. package/{lib/esm → dist/cjs}/classes/test/Contract/ens-abi.d.ts +2 -2
  6. package/{lib → dist}/cjs/classes/test/Contract/ens-abi.js +0 -0
  7. package/{lib/esm → dist/cjs}/classes/test/Contract/fei-abi.d.ts +2 -2
  8. package/{lib → dist}/cjs/classes/test/Contract/fei-abi.js +0 -0
  9. package/{lib/esm → dist/cjs}/classes/test/Contract/foo-abi.d.ts +2 -2
  10. package/{lib → dist}/cjs/classes/test/Contract/foo-abi.js +0 -0
  11. package/{lib/esm → dist/cjs}/classes/test/Contract/uniswap-abi.d.ts +2 -2
  12. package/{lib → dist}/cjs/classes/test/Contract/uniswap-abi.js +0 -0
  13. package/dist/cjs/classes/utils/clean-block.d.ts +3 -0
  14. package/{lib → dist}/cjs/classes/utils/clean-block.js +0 -0
  15. package/dist/cjs/classes/utils/clean-log.d.ts +2 -0
  16. package/{lib → dist}/cjs/classes/utils/clean-log.js +0 -0
  17. package/dist/cjs/classes/utils/clean-transaction-receipt.d.ts +2 -0
  18. package/{lib → dist}/cjs/classes/utils/clean-transaction-receipt.js +0 -0
  19. package/dist/cjs/classes/utils/clean-transaction.d.ts +2 -0
  20. package/{lib → dist}/cjs/classes/utils/clean-transaction.js +0 -0
  21. package/{lib → dist}/cjs/classes/utils/encode-decode-transaction.d.ts +4 -16
  22. package/{lib → dist}/cjs/classes/utils/encode-decode-transaction.js +0 -0
  23. package/dist/cjs/classes/utils/fetchers.d.ts +9 -0
  24. package/{lib → dist}/cjs/classes/utils/fetchers.js +0 -0
  25. package/dist/cjs/classes/utils/hex-to-decimal.d.ts +1 -0
  26. package/{lib → dist}/cjs/classes/utils/hex-to-decimal.js +0 -0
  27. package/{lib → dist}/cjs/classes/utils/prepare-transaction.d.ts +2 -6
  28. package/{lib → dist}/cjs/classes/utils/prepare-transaction.js +0 -0
  29. package/{lib/esm → dist/cjs}/index.d.ts +25 -25
  30. package/{lib → dist}/cjs/index.js +0 -0
  31. package/dist/cjs/index.umd.js +2 -0
  32. package/dist/cjs/index.umd.js.map +1 -0
  33. package/{lib/esm → dist/cjs}/logger/logger.d.ts +11 -11
  34. package/{lib → dist}/cjs/logger/logger.js +0 -0
  35. package/dist/cjs/logger/package-version.d.ts +1 -0
  36. package/{lib → dist}/cjs/logger/package-version.js +1 -1
  37. package/dist/cjs/providers/BaseProvider.d.ts +24 -0
  38. package/{lib → dist}/cjs/providers/BaseProvider.js +0 -0
  39. package/{lib → dist}/cjs/providers/FallthroughProvider.d.ts +11 -24
  40. package/{lib → dist}/cjs/providers/FallthroughProvider.js +0 -0
  41. package/dist/cjs/providers/JsonRpcProvider.d.ts +7 -0
  42. package/{lib → dist}/cjs/providers/JsonRpcProvider.js +0 -0
  43. package/{lib/esm → dist/cjs}/providers/test/rpc-urls.d.ts +11 -11
  44. package/{lib → dist}/cjs/providers/test/rpc-urls.js +0 -0
  45. package/{lib/esm → dist/cjs}/providers/utils/chains-info.d.ts +467 -467
  46. package/{lib → dist}/cjs/providers/utils/chains-info.js +0 -0
  47. package/dist/cjs/shared/tiny-big/helpers.d.ts +1 -0
  48. package/{lib → dist}/cjs/shared/tiny-big/helpers.js +0 -0
  49. package/dist/cjs/shared/tiny-big/tiny-big.d.ts +10 -0
  50. package/{lib → dist}/cjs/shared/tiny-big/tiny-big.js +0 -0
  51. package/{lib/esm → dist/cjs}/shared/validate-type.d.ts +3 -3
  52. package/{lib → dist}/cjs/shared/validate-type.js +0 -0
  53. package/{lib → dist}/cjs/types/Block.types.d.ts +40 -41
  54. package/{lib → dist}/cjs/types/Block.types.js +0 -0
  55. package/{lib/esm → dist/cjs}/types/Contract.types.d.ts +24 -24
  56. package/{lib → dist}/cjs/types/Contract.types.js +0 -0
  57. package/{lib → dist}/cjs/types/Filter.types.d.ts +12 -16
  58. package/{lib → dist}/cjs/types/Filter.types.js +0 -0
  59. package/{lib → dist}/cjs/types/Network.types.d.ts +5 -8
  60. package/{lib → dist}/cjs/types/Network.types.js +0 -0
  61. package/{lib → dist}/cjs/types/Transaction.types.d.ts +113 -123
  62. package/{lib → dist}/cjs/types/Transaction.types.js +0 -0
  63. package/dist/cjs/utils/bytes.d.ts +40 -0
  64. package/{lib → dist}/cjs/utils/bytes.js +0 -0
  65. package/dist/cjs/utils/compute-address.d.ts +1 -0
  66. package/{lib → dist}/cjs/utils/compute-address.js +0 -0
  67. package/dist/cjs/utils/compute-public-key.d.ts +2 -0
  68. package/{lib → dist}/cjs/utils/compute-public-key.js +0 -0
  69. package/dist/cjs/utils/ether-to-gwei.d.ts +3 -0
  70. package/{lib → dist}/cjs/utils/ether-to-gwei.js +0 -0
  71. package/dist/cjs/utils/ether-to-wei.d.ts +3 -0
  72. package/{lib → dist}/cjs/utils/ether-to-wei.js +0 -0
  73. package/dist/cjs/utils/gwei-to-ether.d.ts +3 -0
  74. package/{lib → dist}/cjs/utils/gwei-to-ether.js +0 -0
  75. package/dist/cjs/utils/hash-message.d.ts +2 -0
  76. package/{lib → dist}/cjs/utils/hash-message.js +0 -0
  77. package/dist/cjs/utils/is-address.d.ts +1 -0
  78. package/{lib → dist}/cjs/utils/is-address.js +0 -0
  79. package/dist/cjs/utils/keccak256.d.ts +2 -0
  80. package/{lib → dist}/cjs/utils/keccak256.js +0 -0
  81. package/dist/cjs/utils/solidity-keccak256.d.ts +2 -0
  82. package/{lib → dist}/cjs/utils/solidity-keccak256.js +0 -0
  83. package/dist/cjs/utils/split-signature.d.ts +2 -0
  84. package/{lib → dist}/cjs/utils/split-signature.js +0 -0
  85. package/dist/cjs/utils/to-checksum-address.d.ts +1 -0
  86. package/{lib → dist}/cjs/utils/to-checksum-address.js +0 -0
  87. package/dist/cjs/utils/to-utf8-bytes.d.ts +1 -0
  88. package/{lib → dist}/cjs/utils/to-utf8-bytes.js +0 -0
  89. package/dist/cjs/utils/wei-to-ether.d.ts +3 -0
  90. package/{lib → dist}/cjs/utils/wei-to-ether.js +0 -0
  91. package/{lib → dist}/esm/classes/Contract.d.ts +0 -0
  92. package/{lib → dist}/esm/classes/Contract.js +0 -0
  93. package/{lib/cjs → dist/esm}/classes/test/Contract/crv-abi.d.ts +0 -0
  94. package/{lib → dist}/esm/classes/test/Contract/crv-abi.js +0 -0
  95. package/{lib/cjs → dist/esm}/classes/test/Contract/ens-abi.d.ts +0 -0
  96. package/{lib → dist}/esm/classes/test/Contract/ens-abi.js +0 -0
  97. package/{lib/cjs → dist/esm}/classes/test/Contract/fei-abi.d.ts +0 -0
  98. package/{lib → dist}/esm/classes/test/Contract/fei-abi.js +0 -0
  99. package/{lib/cjs → dist/esm}/classes/test/Contract/foo-abi.d.ts +0 -0
  100. package/{lib → dist}/esm/classes/test/Contract/foo-abi.js +0 -0
  101. package/{lib/cjs → dist/esm}/classes/test/Contract/uniswap-abi.d.ts +0 -0
  102. package/{lib → dist}/esm/classes/test/Contract/uniswap-abi.js +0 -0
  103. package/{lib → dist}/esm/classes/utils/clean-block.d.ts +0 -0
  104. package/{lib → dist}/esm/classes/utils/clean-block.js +0 -0
  105. package/{lib → dist}/esm/classes/utils/clean-log.d.ts +0 -0
  106. package/{lib → dist}/esm/classes/utils/clean-log.js +0 -0
  107. package/{lib → dist}/esm/classes/utils/clean-transaction-receipt.d.ts +0 -0
  108. package/{lib → dist}/esm/classes/utils/clean-transaction-receipt.js +0 -0
  109. package/{lib → dist}/esm/classes/utils/clean-transaction.d.ts +0 -0
  110. package/{lib → dist}/esm/classes/utils/clean-transaction.js +0 -0
  111. package/{lib → dist}/esm/classes/utils/encode-decode-transaction.d.ts +0 -0
  112. package/{lib → dist}/esm/classes/utils/encode-decode-transaction.js +0 -0
  113. package/{lib → dist}/esm/classes/utils/fetchers.d.ts +0 -0
  114. package/{lib → dist}/esm/classes/utils/fetchers.js +0 -0
  115. package/{lib → dist}/esm/classes/utils/hex-to-decimal.d.ts +0 -0
  116. package/{lib → dist}/esm/classes/utils/hex-to-decimal.js +0 -0
  117. package/{lib → dist}/esm/classes/utils/prepare-transaction.d.ts +0 -0
  118. package/{lib → dist}/esm/classes/utils/prepare-transaction.js +0 -0
  119. package/{lib/cjs → dist/esm}/index.d.ts +0 -0
  120. package/{lib → dist}/esm/index.js +0 -0
  121. package/{lib/cjs → dist/esm}/logger/logger.d.ts +0 -0
  122. package/{lib → dist}/esm/logger/logger.js +0 -0
  123. package/dist/esm/logger/package-version.d.ts +1 -0
  124. package/dist/esm/logger/package-version.js +1 -0
  125. package/{lib → dist}/esm/providers/BaseProvider.d.ts +0 -0
  126. package/{lib → dist}/esm/providers/BaseProvider.js +0 -0
  127. package/{lib → dist}/esm/providers/FallthroughProvider.d.ts +0 -0
  128. package/{lib → dist}/esm/providers/FallthroughProvider.js +0 -0
  129. package/{lib → dist}/esm/providers/JsonRpcProvider.d.ts +0 -0
  130. package/{lib → dist}/esm/providers/JsonRpcProvider.js +0 -0
  131. package/{lib/cjs → dist/esm}/providers/test/rpc-urls.d.ts +0 -0
  132. package/{lib → dist}/esm/providers/test/rpc-urls.js +0 -0
  133. package/{lib/cjs → dist/esm}/providers/utils/chains-info.d.ts +0 -0
  134. package/{lib → dist}/esm/providers/utils/chains-info.js +0 -0
  135. package/{lib → dist}/esm/shared/tiny-big/helpers.d.ts +0 -0
  136. package/{lib → dist}/esm/shared/tiny-big/helpers.js +0 -0
  137. package/{lib → dist}/esm/shared/tiny-big/tiny-big.d.ts +0 -0
  138. package/{lib → dist}/esm/shared/tiny-big/tiny-big.js +0 -0
  139. package/{lib/cjs → dist/esm}/shared/validate-type.d.ts +0 -0
  140. package/{lib → dist}/esm/shared/validate-type.js +0 -0
  141. package/{lib → dist}/esm/types/Block.types.d.ts +0 -0
  142. package/{lib → dist}/esm/types/Block.types.js +0 -0
  143. package/{lib/cjs → dist/esm}/types/Contract.types.d.ts +0 -0
  144. package/{lib → dist}/esm/types/Contract.types.js +0 -0
  145. package/{lib → dist}/esm/types/Filter.types.d.ts +0 -0
  146. package/{lib → dist}/esm/types/Filter.types.js +0 -0
  147. package/{lib → dist}/esm/types/Network.types.d.ts +0 -0
  148. package/{lib → dist}/esm/types/Network.types.js +0 -0
  149. package/{lib → dist}/esm/types/Transaction.types.d.ts +0 -0
  150. package/{lib → dist}/esm/types/Transaction.types.js +0 -0
  151. package/{lib → dist}/esm/utils/bytes.d.ts +0 -0
  152. package/{lib → dist}/esm/utils/bytes.js +0 -0
  153. package/{lib → dist}/esm/utils/compute-address.d.ts +0 -0
  154. package/{lib → dist}/esm/utils/compute-address.js +0 -0
  155. package/{lib → dist}/esm/utils/compute-public-key.d.ts +0 -0
  156. package/{lib → dist}/esm/utils/compute-public-key.js +0 -0
  157. package/{lib → dist}/esm/utils/ether-to-gwei.d.ts +0 -0
  158. package/{lib → dist}/esm/utils/ether-to-gwei.js +0 -0
  159. package/{lib → dist}/esm/utils/ether-to-wei.d.ts +0 -0
  160. package/{lib → dist}/esm/utils/ether-to-wei.js +0 -0
  161. package/{lib → dist}/esm/utils/gwei-to-ether.d.ts +0 -0
  162. package/{lib → dist}/esm/utils/gwei-to-ether.js +0 -0
  163. package/{lib → dist}/esm/utils/hash-message.d.ts +0 -0
  164. package/{lib → dist}/esm/utils/hash-message.js +0 -0
  165. package/{lib → dist}/esm/utils/is-address.d.ts +0 -0
  166. package/{lib → dist}/esm/utils/is-address.js +0 -0
  167. package/{lib → dist}/esm/utils/keccak256.d.ts +0 -0
  168. package/{lib → dist}/esm/utils/keccak256.js +0 -0
  169. package/{lib → dist}/esm/utils/solidity-keccak256.d.ts +0 -0
  170. package/{lib → dist}/esm/utils/solidity-keccak256.js +0 -0
  171. package/{lib → dist}/esm/utils/split-signature.d.ts +0 -0
  172. package/{lib → dist}/esm/utils/split-signature.js +0 -0
  173. package/{lib → dist}/esm/utils/to-checksum-address.d.ts +0 -0
  174. package/{lib → dist}/esm/utils/to-checksum-address.js +0 -0
  175. package/{lib → dist}/esm/utils/to-utf8-bytes.d.ts +0 -0
  176. package/{lib → dist}/esm/utils/to-utf8-bytes.js +0 -0
  177. package/{lib → dist}/esm/utils/wei-to-ether.d.ts +0 -0
  178. package/{lib → dist}/esm/utils/wei-to-ether.js +0 -0
  179. package/package.json +25 -13
  180. package/readme.md +70 -51
  181. package/lib/cjs/classes/Contract.d.ts +0 -78
  182. package/lib/cjs/classes/utils/clean-block.d.ts +0 -121
  183. package/lib/cjs/classes/utils/clean-log.d.ts +0 -9
  184. package/lib/cjs/classes/utils/clean-transaction-receipt.d.ts +0 -14
  185. package/lib/cjs/classes/utils/clean-transaction.d.ts +0 -14
  186. package/lib/cjs/classes/utils/fetchers.d.ts +0 -39
  187. package/lib/cjs/classes/utils/hex-to-decimal.d.ts +0 -18
  188. package/lib/cjs/logger/package-version.d.ts +0 -1
  189. package/lib/cjs/providers/BaseProvider.d.ts +0 -353
  190. package/lib/cjs/providers/JsonRpcProvider.d.ts +0 -33
  191. package/lib/cjs/shared/tiny-big/helpers.d.ts +0 -17
  192. package/lib/cjs/shared/tiny-big/tiny-big.d.ts +0 -58
  193. package/lib/cjs/utils/bytes.d.ts +0 -289
  194. package/lib/cjs/utils/compute-address.d.ts +0 -17
  195. package/lib/cjs/utils/compute-public-key.d.ts +0 -18
  196. package/lib/cjs/utils/ether-to-gwei.d.ts +0 -27
  197. package/lib/cjs/utils/ether-to-wei.d.ts +0 -27
  198. package/lib/cjs/utils/gwei-to-ether.d.ts +0 -27
  199. package/lib/cjs/utils/hash-message.d.ts +0 -14
  200. package/lib/cjs/utils/is-address.d.ts +0 -24
  201. package/lib/cjs/utils/keccak256.d.ts +0 -16
  202. package/lib/cjs/utils/solidity-keccak256.d.ts +0 -39
  203. package/lib/cjs/utils/split-signature.d.ts +0 -24
  204. package/lib/cjs/utils/to-checksum-address.d.ts +0 -17
  205. package/lib/cjs/utils/to-utf8-bytes.d.ts +0 -15
  206. package/lib/cjs/utils/wei-to-ether.d.ts +0 -27
  207. package/lib/esm/logger/package-version.d.ts +0 -1
  208. package/lib/esm/logger/package-version.js +0 -1
@@ -1,289 +0,0 @@
1
- export declare type Bytes = ArrayLike<number>;
2
- /**
3
- * @example
4
- * [1,2,3]
5
- * @example
6
- * 0x123
7
- * @example
8
- * '0x123'
9
- */
10
- export declare type BytesLike = Bytes | string;
11
- export declare type BytesLikeWithNumber = BytesLike | number;
12
- export interface DataOptions {
13
- allowMissingPrefix?: boolean;
14
- hexPad?: 'left' | 'right' | null;
15
- }
16
- export interface Hexable {
17
- toHexString(): string;
18
- }
19
- export declare type SignatureLike = {
20
- r: string;
21
- s?: string;
22
- _vs?: string;
23
- recoveryParam?: number;
24
- v?: number;
25
- } | BytesLike;
26
- export interface Signature {
27
- r: string;
28
- s: string;
29
- _vs: string;
30
- recoveryParam: number;
31
- v: number;
32
- yParityAndS: string;
33
- compact: string;
34
- }
35
- /**
36
- * Returns true if and only if value is a valid [Bytes](#bytes) or DataHexString
37
- * Same as [`ethers.utils.isBytesLike`](https://docs.ethers.io/v5/api/utils/bytes/#utils-isBytesLike)
38
- *
39
- * @param value the value to check whether or not it matches BytesLike
40
- * @returns whether or not the value matches BytesLike
41
- * @example
42
- * ```javascript
43
- * isBytesLike([1,2,3]);
44
- * // true
45
- * ```
46
- * @example
47
- * ```javascript
48
- * isBytesLike(false);
49
- * // false
50
- * ```
51
- * @example
52
- * ```javascript
53
- * isBytesLike(new Uint8Array(1));
54
- * // true
55
- * ```
56
- */
57
- export declare function isBytesLike(value: any): value is BytesLike;
58
- /**
59
- * Returns true if and only if value is a valid [Bytes](#bytes)
60
- * Same as [`ethers.utils.isBytes`](https://docs.ethers.io/v5/api/utils/bytes/#utils-isBytes)
61
- *
62
- * @param value the value to check whether or not it matches Bytes
63
- * @returns whether or not the value matches Bytes
64
- * @example
65
- * ```javascript
66
- * isBytes([1,2,3]);
67
- * // true
68
- * ```
69
- * @example
70
- * ```javascript
71
- * isBytes(false);
72
- * // false
73
- * ```
74
- * @example
75
- * ```javascript
76
- * isBytes(new Uint8Array(1));
77
- * // true
78
- * ```
79
- */
80
- export declare function isBytes(value: any): value is Bytes;
81
- /**
82
- * Converts DataHexStringOrArrayish to a Uint8Array
83
- * Same as [`ethers.utils.arrayify`](https://docs.ethers.io/v5/api/utils/bytes/#utils-arrayify)
84
- *
85
- * @param value the value to convert to a Uint8Array
86
- * @param options options to use when converting the value to a Uint8Array
87
- * @returns the value represented as a Uint8Array
88
- * @example
89
- * ```javascript
90
- * arrayify(1);
91
- * // Uint8Array(1) [ 1 ]
92
- * ```
93
- * @example
94
- * ```javascript
95
- * arrayify(0x1234);
96
- * // Uint8Array(2) [ 18, 52 ]
97
- * ```
98
- * @example
99
- * ```javascript
100
- * arrayify('0x1', { hexPad: 'right' });
101
- * // Uint8Array(1) [ 16 ]
102
- * ```
103
- */
104
- export declare function arrayify(value: BytesLike | Hexable | number, options?: DataOptions): Uint8Array;
105
- /**
106
- * Concatenates all the BytesLike in arrayOfBytesLike into a single Uint8Array.
107
- * Same as [`ethers.utils.concat`](https://docs.ethers.io/v5/api/utils/bytes/#utils-concat)
108
- *
109
- * @param arrayOfBytesLike the array of {@link BytesLike} to concatenate together
110
- * @returns a concatenated Uint8Array
111
- * @example
112
- * ```javascript
113
- * concat([0, 1]);
114
- * // Uint8Array(2) [ 0, 1 ]
115
- * ```
116
- */
117
- export declare function concat(arrayOfBytesLike: ReadonlyArray<BytesLikeWithNumber>): Uint8Array;
118
- /**
119
- * Strips leading zeros from a BytesLike object
120
- *
121
- * @param value the value to strip leading zeros from
122
- * @returns value without leading zeroes, expressed as a Uint8Array
123
- * @example
124
- * ```javascript
125
- * stripZeros('0x00002834');
126
- * // Uint8Array { [Iterator] 0: 40, 1: 52 }
127
- * // Equivalent to '0x2834'
128
- * ```
129
- */
130
- export declare function stripZeros(value: BytesLike): Uint8Array;
131
- /**
132
- * Pads the beginning of a {@link BytesLike} with zeros so it's the specified length as a Uint8Array
133
- *
134
- * @param value the value to pad
135
- * @param length the desired length of the value
136
- * @returns the value padded with zeros to the specified length
137
- * @example
138
- * ```javascript
139
- * zeroPad('0x039284');
140
- * // Uint8Array { [Iterator] 0: 0, 1: 0, 2: 0, 3: 3, 4: 146, 5: 132 }
141
- * // Equivalent to 0x000000039284
142
- * ```
143
- * @example
144
- * ```javascript
145
- * zeroPad([39, 25, 103, 45], 5);
146
- * // Uint8Array { [Iterator] 0: 0, 1: 39, 2: 25, 3: 103, 4: 45 }
147
- * ```
148
- */
149
- export declare function zeroPad(value: BytesLike, length: number): Uint8Array;
150
- /**
151
- * Returns true if and only if object is a valid hex string.
152
- * If length is specified and object is not a valid DataHexString of length bytes, an InvalidArgument error is thrown.
153
- * Same as [`ethers.utils.isHexString`](https://docs.ethers.io/v5/api/utils/bytes/#utils-isHexString)
154
- *
155
- * @param value the value to check whether or not it's a hex string
156
- * @param length a length of bytes that the value should be equal to
157
- * @returns whether the value is a valid hex string (and optionally, whether it matches the length specified)
158
- * @example
159
- * ```javascript
160
- * isHexString('0x4924');
161
- * // true
162
- * ```
163
- * @example
164
- * ```javascript
165
- * isHexString('0x4924', 4);
166
- * // false
167
- * // length of 4 in bytes would mean a hex string with 8 characters
168
- * ```
169
- */
170
- export declare function isHexString(value: any, length?: number): boolean;
171
- /**
172
- * Converts a value into a hex string
173
- *
174
- * @param value the value to convert
175
- * @param options options to use when converting the value to a hex string
176
- * @returns the value represented as a hex string
177
- * @example
178
- * ```javascript
179
- * hexlify(4);
180
- * // '0x04'
181
- * ```
182
- * @example
183
- * ```javascript
184
- * hexlify(14);
185
- * // '0x0e'
186
- * ```
187
- */
188
- export declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string;
189
- /**
190
- * Gets the length of data represented as a hex string
191
- *
192
- * @param data the data to check the length of
193
- * @returns the length of the data
194
- * @example
195
- * ```javascript
196
- * hexDataLength([2, 4, 0, 1]);
197
- * // 4
198
- * ```
199
- * @example
200
- * ```javascript
201
- * hexDataLength('0x3925');
202
- * // 2
203
- * ```
204
- */
205
- export declare function hexDataLength(data: BytesLike): number | null;
206
- /**
207
- * Slices a {@link BytesLike} to extract a certain part of the input
208
- *
209
- * @param data the data to slice from
210
- * @param offset the index to start extraction at
211
- * @param endOffset the index to end extraction at
212
- * @returns the extracted data as a hex string
213
- * @example
214
- * ```javascript
215
- * hexDataSlice([20, 6, 48], 0, 2);
216
- * // '0x1406'
217
- * ```
218
- */
219
- export declare function hexDataSlice(data: BytesLikeWithNumber, offset: number, endOffset?: number): string;
220
- /**
221
- * Concatenates values together into one hex string
222
- *
223
- * @param items the items to concatenate together
224
- * @returns a single hex string including all of the items to be concatenated
225
- * @example
226
- * ```javascript
227
- * hexConcat([[2, 4, 0, 1], 9, '0x2934', '0x3947']);
228
- * // '0x020400010929343947'
229
- * ```
230
- */
231
- export declare function hexConcat(items: ReadonlyArray<BytesLike>): string;
232
- /**
233
- * Converts a number of different types into a hex string
234
- *
235
- * @param value the value to convert into a hex string
236
- * @returns the value represented as a hex string
237
- * @example
238
- * ```javascript
239
- * hexValue(39);
240
- * // '0x27'
241
- * ```
242
- * @example
243
- * ```javascript
244
- * hexValue([9, 4, 19, 4]);
245
- * // '0x9041304'
246
- * ```
247
- */
248
- export declare function hexValue(value: BytesLike | Hexable | number | bigint): string;
249
- /**
250
- * Strips the leading zeros from a value and returns it as a hex string
251
- *
252
- * @param value the value to strip zeros from
253
- * @returns a hex string representation of the value, without leading zeros
254
- * @example
255
- * ```javascript
256
- * hexStripZeros([0,0,0,48]);
257
- * // '0x30'
258
- * ```
259
- */
260
- export declare function hexStripZeros(value: BytesLike): string;
261
- /**
262
- * Returns a hex string padded to a specified length of bytes.
263
- *
264
- * Similar to ["hexZeroPad" in ethers.js](https://docs.ethers.io/v5/api/utils/bytes/#utils-hexZeroPad)
265
- *
266
- * Differs from ["padLeft" in web3.js](https://web3js.readthedocs.io/en/v1.7.1/web3-utils.html#padleft) because web3 counts by characters, not bytes.
267
- *
268
- * @param value A hex-string, hex-number, or decimal number (auto-converts to base-16) to be padded
269
- * @param length The final length in bytes
270
- * @returns A hex string padded to the specified length
271
- * @throws If the value is not a hex string or number
272
- * @throws If the value is longer than the length
273
- * @example
274
- * ```javascript
275
- * hexZeroPad('0x60', 2);
276
- * // '0x0060'
277
- * ```
278
- * @example
279
- * ```javascript
280
- * hexZeroPad(0x60, 3);
281
- * // '0x000060'
282
- * ```
283
- * @example
284
- * ```javascript
285
- * hexZeroPad('12345', 1);
286
- * // Throws
287
- * ```
288
- */
289
- export declare function hexZeroPad(value: BytesLikeWithNumber, length: number): string;
@@ -1,17 +0,0 @@
1
- /**
2
- * Computes the address that corresponds to a specified public or private key
3
- *
4
- * @param key the public or private key to find the address related to
5
- * @returns the address that corresponds to the key specified
6
- * @example
7
- * ```javascript
8
- * computeAddress('0x0458eb591f407aef12936bd2989ca699cf5061de9c4964dd6eb6005fd8f580c407434447e813969a1be6e9954b002cad84dfc67a69e032b273e4695e7d0db2d952'); // public key
9
- * // '0xA2902059a7BF992f1450BACD7357CCAa5cC8336a'
10
- * ```
11
- * @example
12
- * ```javascript
13
- * computeAddress('0x2f2c419acf4a1da8c1ebea75bb3fcfbd3ec2aa3bf0162901ccdc2f38b8f92427'); // private key
14
- * // '0xA2902059a7BF992f1450BACD7357CCAa5cC8336a'
15
- * ```
16
- */
17
- export declare function computeAddress(key: string): string;
@@ -1,18 +0,0 @@
1
- import type { BytesLike } from './bytes';
2
- /**
3
- * Computes the public key from a given private key
4
- *
5
- * @param privKey the private key to find a public key from
6
- * @returns the public key related to the specified private key
7
- * @example
8
- * ```javascript
9
- * computePublicKey('0xb27cc8dea0177d910110e8d3ec5480d56c723abf433529f4063f261ffdb9297c');
10
- * // '0x045cd0032015eecfde49f82f4e149d804e8ac6e3a0bface32e37c72a71ceac864fe84da7e8df84342f7b11dfb753c4d158f636142b46b29cf7f0f171ae0aa4fb87'
11
- * ```
12
- * @example
13
- * ```javascript
14
- * computePublicKey([50,102,50,99,52,49,57,97,99,102,52,97,49,100,97,56,99,49,101,98,101,97,55,53,98,98,51,102,99,102,98,100]);
15
- * // '0x04a9cea77eca949df84f661cee153426fb51f2294b9364b4fac240df57360b9b0ac9c99e4d7966491ab4c81f8c82e0cd24ec5759832ad4ab736d22c7d90b806ee8'
16
- * ```
17
- */
18
- export declare function computePublicKey(privKey: BytesLike): string;
@@ -1,27 +0,0 @@
1
- import type Big from 'big.js';
2
- import type { 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
- * @param etherQuantity the amount of ether to convert to gwei
11
- * @returns a number of gwei equivalent to the specified ether
12
- * @example
13
- * ```javascript
14
- * etherToGwei('1000').toString()
15
- * // '1000000000000'
16
- * etherToGwei(1000).toString()
17
- * // '1000000000000'
18
- * ```
19
- * @example
20
- * ```javascript
21
- * etherToGwei('1000').toNumber()
22
- * // 1000000000000
23
- * etherToGwei(1000).toNumber()
24
- * // 1000000000000
25
- * ```
26
- */
27
- export declare function etherToGwei(etherQuantity: string | number | TinyBig | Big): TinyBig;
@@ -1,27 +0,0 @@
1
- import type Big from 'big.js';
2
- import type { TinyBig } from '../shared/tiny-big/tiny-big';
3
- /**
4
- * Convert Ether to Wei
5
- *
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)
9
- *
10
- * @param etherQuantity the amount of ether to convert to wei
11
- * @returns a number of wei equivalent to the specified ether
12
- * @example
13
- * ```javascript
14
- * etherToWei('1000').toString()
15
- * // '1000000000000000000000'
16
- * etherToWei(1000).toString()
17
- * // '1000000000000000000000'
18
- * ```
19
- * @example
20
- * ```javascript
21
- * etherToWei('1000').toNumber()
22
- * // 1000000000000000000000
23
- * etherToWei(1000).toNumber()
24
- * // 1000000000000000000000
25
- * ```
26
- */
27
- export declare function etherToWei(etherQuantity: string | number | TinyBig | Big): TinyBig;
@@ -1,27 +0,0 @@
1
- import type Big from 'big.js';
2
- import type { 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
- * @param gweiQuantity the amount of gwei to convert to ether
11
- * @returns a number of ether equivalent to the specified gwei
12
- * @example
13
- * ```javascript
14
- * gweiToEther('1000000000000').toString()
15
- * // '1000'
16
- * gweiToEther(1000000000000).toString()
17
- * // '1000'
18
- * ```
19
- * @example
20
- * ```javascript
21
- * gweiToEther('1000000000000').toNumber()
22
- * // 1000
23
- * gweiToEther(1000000000000).toNumber()
24
- * // 1000
25
- * ```
26
- */
27
- export declare function gweiToEther(gweiQuantity: string | number | TinyBig | Big): TinyBig;
@@ -1,14 +0,0 @@
1
- import type { Bytes } from '../index';
2
- /**
3
- * Computes the EIP-191 personal message digest of message.
4
- * Personal messages are converted to UTF-8 bytes and prefixed with \x19Ethereum Signed Message: and the length of message.
5
- *
6
- * @param message the message to hash
7
- * @returns a message hashed using Keccak256 that matches the EIP-191 standard
8
- * @example
9
- * ```javascript
10
- * hashMessage("Hello World");
11
- * // '0xa1de988600a42c4b4ab089b619297c17d53cffae5d5120d82d8a92d0bb3b78f2'
12
- * ```
13
- */
14
- export declare function hashMessage(message: Bytes | string): string;
@@ -1,24 +0,0 @@
1
- /**
2
- * Returns a boolean as to whether the input is a valid address.
3
- * Does NOT support ICAP addresses
4
- *
5
- * @param address the address to check the validity of
6
- * @returns a boolean for whether the input is a valid address
7
- * @example
8
- * ```javascript
9
- * isAddress('0xc0deaf6bd3f0c6574a6a625ef2f22f62a5150eab');
10
- * // true
11
- * ```
12
- * @example
13
- * ```javascript
14
- * isAddress('bad');
15
- * // false
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 +0,0 @@
1
- import type { BytesLike } from './bytes';
2
- /**
3
- * Hashes data into a Keccak256 hex string
4
- *
5
- * @param data the data to be hashed using Keccak256
6
- * @returns a hex string with data hashed using Keccak256
7
- * @example
8
- * ```javascript
9
- * keccak256('essential-eth');
10
- * // '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
11
- *
12
- * keccak256('0x123');
13
- * // '0x5fa2358263196dbbf23d1ca7a509451f7a2f64c15837bfbb81298b1e3e24e4fa'
14
- * ```
15
- */
16
- export declare function keccak256(data: BytesLike): string;
@@ -1,39 +0,0 @@
1
- /**
2
- * Converts arrays with types and values into a hex string that can be hashed
3
- *
4
- * @param types array of Solidity types, where `type[0]` is the type for `value[0]`
5
- * @param values array of values, where `value[0]` is of type `type[0]`
6
- * @returns a hex string with the data given, packed to include its types
7
- * @example
8
- * ```javascript
9
- * const types = ['bool', 'string', 'uint64'];
10
- * const values = [true, 'text', 30];
11
- * pack(types, values);
12
- * // '0x0174657874000000000000001e'
13
- * ```
14
- */
15
- export declare function pack(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
16
- /**
17
- * Hashes data from Solidity using the Keccak256 algorithm.
18
- *
19
- * Similar to ["solidityKeccak256" in ethers.js](https://docs.ethers.io/v5/api/utils/hashing/#utils-solidityKeccak256)
20
- *
21
- * @param types Each [Solidity type](https://docs.soliditylang.org/en/v0.8.13/types.html) corresponding to the values passed in. Helps the function parse and pack data properly.
22
- * @param values Data to be concatenated (combined) and then hashed.
23
- * @returns A Keccak256 hash (hex string) based on the values provided
24
- * @example
25
- * ```javascript
26
- * const types = ['string', 'bool', 'uint32'];
27
- * const values = ['essential-eth is great', true, 14];
28
- * solidityKeccak256(types, values);
29
- * // '0xe4d4c8e809faac09d58f468f0aeab9474fe8965d554c6c0f868c433c3fd6acab'
30
- * ```
31
- * @example
32
- * ```javascript
33
- * const types = ['bytes4', 'uint32[5]'];
34
- * const values = [[116, 101, 115, 116], [5, 3, 4, 9, 18]];
35
- * solidityKeccak256(types, values);
36
- * // '0x038707a887f09355dc545412b058e7ba8f3c74047050c7c5e5e52eec608053d9'
37
- * ```
38
- */
39
- export declare function solidityKeccak256(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
@@ -1,24 +0,0 @@
1
- import type { Signature, SignatureLike } from './bytes';
2
- /**
3
- * Expands a signature into the full signature object and fills in missing properties.
4
- *
5
- * Same as ["splitSignature" in ethers.js](https://docs.ethers.io/v5/api/utils/bytes/#utils-splitSignature)
6
- *
7
- * @param signature the signature object to split, parse, and compute missing properties from
8
- * @returns a full signature object with all properties filled
9
- * @example
10
- * ```javascript
11
- * const signature = '0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b3971647252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee331b';
12
- * splitSignature(signature);
13
- * {
14
- * r: "0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b39716",
15
- * s: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
16
- * _vs: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
17
- * recoveryParam: 0,
18
- * v: 27,
19
- * yParityAndS: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
20
- * compact: "0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b3971647252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33"
21
- * }
22
- * ```
23
- */
24
- export declare function splitSignature(signature: SignatureLike): Signature;
@@ -1,17 +0,0 @@
1
- /**
2
- * Returns an Ethereum address in proper mixed-case checksum.
3
- * Does NOT support ICAP
4
- *
5
- * @param address An Ethereum address. Mixed, lower, and uppercase are all valid
6
- * @returns a valid checksum address
7
- * @example
8
- * ```javascript
9
- * toChecksumAddress('0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359');
10
- * // '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359'
11
- * ```
12
- *
13
- * Similar to ["getAddress" in ethers.js](https://docs.ethers.io/v5/api/utils/address/#utils-getAddress)
14
- *
15
- * Similar to ["toChecksumAddress" in web3.js](https://web3js.readthedocs.io/en/v1.7.1/web3-utils.html#tochecksumaddress)
16
- */
17
- export declare function toChecksumAddress(address: string): string;
@@ -1,15 +0,0 @@
1
- /**
2
- * Converts a string into a UTF-8 Byte Array
3
- *
4
- * @param data the input to be converted to a UTF-8 Byte Array
5
- * @returns the specified data as a UTF-8 Byte Array
6
- * @example
7
- * ```javascript
8
- * toUtf8Bytes('essential-eth');
9
- * // Uint8Array { [Iterator] 0: 101, 1: 115, 2: 115, 3: 101, 4: 110, 5: 116, 6: 105, 7: 97, 8: 108, 9: 45, 10: 101, 11: 116, 12: 104 }
10
- *
11
- * toUtf8Bytes('ethereum');
12
- * // Uint8Array { [Iterator] 0: 101, 1: 116, 2: 104, 3: 101, 4: 114, 5: 101, 6: 117, 7: 109 }
13
- * ```
14
- */
15
- export declare function toUtf8Bytes(data: string): Uint8Array;
@@ -1,27 +0,0 @@
1
- import type Big from 'big.js';
2
- import type { 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
- * @param weiQuantity the amount of wei to convert to ether
11
- * @returns a number of ether equivalent to the specified wei
12
- * @example
13
- * ```javascript
14
- * weiToEther('1000000000000000000000').toString()
15
- * // '1000'
16
- * weiToEther(1000000000000000000000).toString()
17
- * // '1000'
18
- * ```
19
- * @example
20
- * ```javascript
21
- * weiToEther('1000000000000000000000').toNumber()
22
- * // 1000
23
- * weiToEther(1000000000000000000000).toNumber()
24
- * // 1000
25
- * ```
26
- */
27
- export declare function weiToEther(weiQuantity: string | number | TinyBig | Big): TinyBig;
@@ -1 +0,0 @@
1
- export declare const version = "0.5.12";
@@ -1 +0,0 @@
1
- export const version = '0.5.12';