essential-eth 0.10.2 → 0.10.4-beta.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 (205) hide show
  1. package/dist/index.cjs +2024 -0
  2. package/dist/index.d.cts +330 -0
  3. package/dist/index.d.ts +330 -0
  4. package/dist/index.js +1952 -0
  5. package/package.json +13 -14
  6. package/readme.md +1 -1
  7. package/dist/cjs/classes/Contract.d.ts +0 -81
  8. package/dist/cjs/classes/Contract.js +0 -139
  9. package/dist/cjs/classes/test/Contract/crv-abi.d.ts +0 -2
  10. package/dist/cjs/classes/test/Contract/crv-abi.js +0 -413
  11. package/dist/cjs/classes/test/Contract/ens-abi.d.ts +0 -2
  12. package/dist/cjs/classes/test/Contract/ens-abi.js +0 -453
  13. package/dist/cjs/classes/test/Contract/fei-abi.d.ts +0 -2
  14. package/dist/cjs/classes/test/Contract/fei-abi.js +0 -526
  15. package/dist/cjs/classes/test/Contract/foo-abi.d.ts +0 -2
  16. package/dist/cjs/classes/test/Contract/foo-abi.js +0 -42
  17. package/dist/cjs/classes/test/Contract/jokerrace-abi.d.ts +0 -2
  18. package/dist/cjs/classes/test/Contract/jokerrace-abi.js +0 -22
  19. package/dist/cjs/classes/test/Contract/uniswap-abi.d.ts +0 -2
  20. package/dist/cjs/classes/test/Contract/uniswap-abi.js +0 -121
  21. package/dist/cjs/classes/utils/clean-block.d.ts +0 -120
  22. package/dist/cjs/classes/utils/clean-block.js +0 -160
  23. package/dist/cjs/classes/utils/clean-log.d.ts +0 -9
  24. package/dist/cjs/classes/utils/clean-log.js +0 -39
  25. package/dist/cjs/classes/utils/clean-transaction-receipt.d.ts +0 -14
  26. package/dist/cjs/classes/utils/clean-transaction-receipt.js +0 -53
  27. package/dist/cjs/classes/utils/clean-transaction.d.ts +0 -14
  28. package/dist/cjs/classes/utils/clean-transaction.js +0 -54
  29. package/dist/cjs/classes/utils/encode-decode-transaction.d.ts +0 -16
  30. package/dist/cjs/classes/utils/encode-decode-transaction.js +0 -186
  31. package/dist/cjs/classes/utils/fetchers.d.ts +0 -53
  32. package/dist/cjs/classes/utils/fetchers.js +0 -85
  33. package/dist/cjs/classes/utils/hex-to-decimal.d.ts +0 -18
  34. package/dist/cjs/classes/utils/hex-to-decimal.js +0 -24
  35. package/dist/cjs/classes/utils/prepare-transaction.d.ts +0 -6
  36. package/dist/cjs/classes/utils/prepare-transaction.js +0 -47
  37. package/dist/cjs/index.d.ts +0 -24
  38. package/dist/cjs/index.js +0 -58
  39. package/dist/cjs/index.umd.js +0 -2
  40. package/dist/cjs/index.umd.js.map +0 -1
  41. package/dist/cjs/logger/logger.d.ts +0 -11
  42. package/dist/cjs/logger/logger.js +0 -37
  43. package/dist/cjs/logger/package-version.d.ts +0 -1
  44. package/dist/cjs/logger/package-version.js +0 -5
  45. package/dist/cjs/package.json +0 -1
  46. package/dist/cjs/providers/AlchemyProvider.d.ts +0 -4
  47. package/dist/cjs/providers/AlchemyProvider.js +0 -11
  48. package/dist/cjs/providers/BaseProvider.d.ts +0 -374
  49. package/dist/cjs/providers/BaseProvider.js +0 -514
  50. package/dist/cjs/providers/FallthroughProvider.d.ts +0 -24
  51. package/dist/cjs/providers/FallthroughProvider.js +0 -74
  52. package/dist/cjs/providers/JsonRpcProvider.d.ts +0 -33
  53. package/dist/cjs/providers/JsonRpcProvider.js +0 -46
  54. package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.d.ts +0 -14
  55. package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.js +0 -152
  56. package/dist/cjs/providers/test/mock-of.d.ts +0 -8
  57. package/dist/cjs/providers/test/mock-of.js +0 -12
  58. package/dist/cjs/providers/test/rpc-urls.d.ts +0 -12
  59. package/dist/cjs/providers/test/rpc-urls.js +0 -27
  60. package/dist/cjs/providers/utils/chains-info.d.ts +0 -24
  61. package/dist/cjs/providers/utils/chains-info.js +0 -71
  62. package/dist/cjs/shared/tiny-big/helpers.d.ts +0 -17
  63. package/dist/cjs/shared/tiny-big/helpers.js +0 -97
  64. package/dist/cjs/shared/tiny-big/tiny-big.d.ts +0 -58
  65. package/dist/cjs/shared/tiny-big/tiny-big.js +0 -101
  66. package/dist/cjs/shared/validate-type.d.ts +0 -3
  67. package/dist/cjs/shared/validate-type.js +0 -9
  68. package/dist/cjs/types/Block.types.d.ts +0 -41
  69. package/dist/cjs/types/Block.types.js +0 -2
  70. package/dist/cjs/types/Contract.types.d.ts +0 -24
  71. package/dist/cjs/types/Contract.types.js +0 -2
  72. package/dist/cjs/types/FeeData.types.d.ts +0 -7
  73. package/dist/cjs/types/FeeData.types.js +0 -2
  74. package/dist/cjs/types/Filter.types.d.ts +0 -16
  75. package/dist/cjs/types/Filter.types.js +0 -2
  76. package/dist/cjs/types/Network.types.d.ts +0 -8
  77. package/dist/cjs/types/Network.types.js +0 -2
  78. package/dist/cjs/types/Transaction.types.d.ts +0 -123
  79. package/dist/cjs/types/Transaction.types.js +0 -2
  80. package/dist/cjs/utils/bytes.d.ts +0 -289
  81. package/dist/cjs/utils/bytes.js +0 -711
  82. package/dist/cjs/utils/compute-address.d.ts +0 -17
  83. package/dist/cjs/utils/compute-address.js +0 -34
  84. package/dist/cjs/utils/compute-public-key.d.ts +0 -18
  85. package/dist/cjs/utils/compute-public-key.js +0 -26
  86. package/dist/cjs/utils/ether-to-gwei.d.ts +0 -27
  87. package/dist/cjs/utils/ether-to-gwei.js +0 -35
  88. package/dist/cjs/utils/ether-to-wei.d.ts +0 -27
  89. package/dist/cjs/utils/ether-to-wei.js +0 -35
  90. package/dist/cjs/utils/gwei-to-ether.d.ts +0 -27
  91. package/dist/cjs/utils/gwei-to-ether.js +0 -35
  92. package/dist/cjs/utils/hash-message.d.ts +0 -14
  93. package/dist/cjs/utils/hash-message.js +0 -30
  94. package/dist/cjs/utils/is-address.d.ts +0 -24
  95. package/dist/cjs/utils/is-address.js +0 -39
  96. package/dist/cjs/utils/keccak256.d.ts +0 -16
  97. package/dist/cjs/utils/keccak256.js +0 -31
  98. package/dist/cjs/utils/solidity-keccak256.d.ts +0 -39
  99. package/dist/cjs/utils/solidity-keccak256.js +0 -138
  100. package/dist/cjs/utils/split-signature.d.ts +0 -24
  101. package/dist/cjs/utils/split-signature.js +0 -163
  102. package/dist/cjs/utils/to-checksum-address.d.ts +0 -17
  103. package/dist/cjs/utils/to-checksum-address.js +0 -46
  104. package/dist/cjs/utils/to-utf8-bytes.d.ts +0 -15
  105. package/dist/cjs/utils/to-utf8-bytes.js +0 -21
  106. package/dist/cjs/utils/wei-to-ether.d.ts +0 -27
  107. package/dist/cjs/utils/wei-to-ether.js +0 -45
  108. package/dist/esm/classes/Contract.d.ts +0 -11
  109. package/dist/esm/classes/Contract.js +0 -58
  110. package/dist/esm/classes/test/Contract/crv-abi.d.ts +0 -2
  111. package/dist/esm/classes/test/Contract/crv-abi.js +0 -395
  112. package/dist/esm/classes/test/Contract/ens-abi.d.ts +0 -2
  113. package/dist/esm/classes/test/Contract/ens-abi.js +0 -435
  114. package/dist/esm/classes/test/Contract/fei-abi.d.ts +0 -2
  115. package/dist/esm/classes/test/Contract/fei-abi.js +0 -521
  116. package/dist/esm/classes/test/Contract/foo-abi.d.ts +0 -2
  117. package/dist/esm/classes/test/Contract/foo-abi.js +0 -33
  118. package/dist/esm/classes/test/Contract/jokerrace-abi.d.ts +0 -2
  119. package/dist/esm/classes/test/Contract/jokerrace-abi.js +0 -18
  120. package/dist/esm/classes/test/Contract/uniswap-abi.d.ts +0 -2
  121. package/dist/esm/classes/test/Contract/uniswap-abi.js +0 -116
  122. package/dist/esm/classes/utils/clean-block.d.ts +0 -2
  123. package/dist/esm/classes/utils/clean-block.js +0 -35
  124. package/dist/esm/classes/utils/clean-log.d.ts +0 -2
  125. package/dist/esm/classes/utils/clean-log.js +0 -28
  126. package/dist/esm/classes/utils/clean-transaction-receipt.d.ts +0 -2
  127. package/dist/esm/classes/utils/clean-transaction-receipt.js +0 -37
  128. package/dist/esm/classes/utils/clean-transaction.d.ts +0 -2
  129. package/dist/esm/classes/utils/clean-transaction.js +0 -36
  130. package/dist/esm/classes/utils/encode-decode-transaction.d.ts +0 -4
  131. package/dist/esm/classes/utils/encode-decode-transaction.js +0 -143
  132. package/dist/esm/classes/utils/fetchers.d.ts +0 -15
  133. package/dist/esm/classes/utils/fetchers.js +0 -37
  134. package/dist/esm/classes/utils/hex-to-decimal.d.ts +0 -1
  135. package/dist/esm/classes/utils/hex-to-decimal.js +0 -3
  136. package/dist/esm/classes/utils/prepare-transaction.d.ts +0 -2
  137. package/dist/esm/classes/utils/prepare-transaction.js +0 -36
  138. package/dist/esm/index.d.ts +0 -24
  139. package/dist/esm/index.js +0 -19
  140. package/dist/esm/logger/logger.d.ts +0 -11
  141. package/dist/esm/logger/logger.js +0 -34
  142. package/dist/esm/logger/package-version.d.ts +0 -1
  143. package/dist/esm/logger/package-version.js +0 -1
  144. package/dist/esm/providers/AlchemyProvider.d.ts +0 -4
  145. package/dist/esm/providers/AlchemyProvider.js +0 -7
  146. package/dist/esm/providers/BaseProvider.d.ts +0 -26
  147. package/dist/esm/providers/BaseProvider.js +0 -137
  148. package/dist/esm/providers/FallthroughProvider.d.ts +0 -11
  149. package/dist/esm/providers/FallthroughProvider.js +0 -50
  150. package/dist/esm/providers/JsonRpcProvider.d.ts +0 -7
  151. package/dist/esm/providers/JsonRpcProvider.js +0 -15
  152. package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.d.ts +0 -14
  153. package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.js +0 -142
  154. package/dist/esm/providers/test/mock-of.d.ts +0 -1
  155. package/dist/esm/providers/test/mock-of.js +0 -1
  156. package/dist/esm/providers/test/rpc-urls.d.ts +0 -12
  157. package/dist/esm/providers/test/rpc-urls.js +0 -21
  158. package/dist/esm/providers/utils/chains-info.d.ts +0 -24
  159. package/dist/esm/providers/utils/chains-info.js +0 -67
  160. package/dist/esm/shared/tiny-big/helpers.d.ts +0 -1
  161. package/dist/esm/shared/tiny-big/helpers.js +0 -58
  162. package/dist/esm/shared/tiny-big/tiny-big.d.ts +0 -10
  163. package/dist/esm/shared/tiny-big/tiny-big.js +0 -45
  164. package/dist/esm/shared/validate-type.d.ts +0 -3
  165. package/dist/esm/shared/validate-type.js +0 -5
  166. package/dist/esm/types/Block.types.d.ts +0 -40
  167. package/dist/esm/types/Block.types.js +0 -1
  168. package/dist/esm/types/Contract.types.d.ts +0 -24
  169. package/dist/esm/types/Contract.types.js +0 -1
  170. package/dist/esm/types/FeeData.types.d.ts +0 -7
  171. package/dist/esm/types/FeeData.types.js +0 -1
  172. package/dist/esm/types/Filter.types.d.ts +0 -12
  173. package/dist/esm/types/Filter.types.js +0 -1
  174. package/dist/esm/types/Network.types.d.ts +0 -5
  175. package/dist/esm/types/Network.types.js +0 -1
  176. package/dist/esm/types/Transaction.types.d.ts +0 -113
  177. package/dist/esm/types/Transaction.types.js +0 -1
  178. package/dist/esm/utils/bytes.d.ts +0 -40
  179. package/dist/esm/utils/bytes.js +0 -245
  180. package/dist/esm/utils/compute-address.d.ts +0 -1
  181. package/dist/esm/utils/compute-address.js +0 -12
  182. package/dist/esm/utils/compute-public-key.d.ts +0 -2
  183. package/dist/esm/utils/compute-public-key.js +0 -6
  184. package/dist/esm/utils/ether-to-gwei.d.ts +0 -3
  185. package/dist/esm/utils/ether-to-gwei.js +0 -7
  186. package/dist/esm/utils/ether-to-wei.d.ts +0 -3
  187. package/dist/esm/utils/ether-to-wei.js +0 -7
  188. package/dist/esm/utils/gwei-to-ether.d.ts +0 -3
  189. package/dist/esm/utils/gwei-to-ether.js +0 -7
  190. package/dist/esm/utils/hash-message.d.ts +0 -2
  191. package/dist/esm/utils/hash-message.js +0 -14
  192. package/dist/esm/utils/is-address.d.ts +0 -1
  193. package/dist/esm/utils/is-address.js +0 -12
  194. package/dist/esm/utils/keccak256.d.ts +0 -2
  195. package/dist/esm/utils/keccak256.js +0 -13
  196. package/dist/esm/utils/solidity-keccak256.d.ts +0 -2
  197. package/dist/esm/utils/solidity-keccak256.js +0 -85
  198. package/dist/esm/utils/split-signature.d.ts +0 -2
  199. package/dist/esm/utils/split-signature.js +0 -126
  200. package/dist/esm/utils/to-checksum-address.d.ts +0 -1
  201. package/dist/esm/utils/to-checksum-address.js +0 -25
  202. package/dist/esm/utils/to-utf8-bytes.d.ts +0 -1
  203. package/dist/esm/utils/to-utf8-bytes.js +0 -3
  204. package/dist/esm/utils/wei-to-ether.d.ts +0 -3
  205. package/dist/esm/utils/wei-to-ether.js +0 -16
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsonRpcProvider = exports.JsonRpcProvider = void 0;
4
- const BaseProvider_1 = require("./BaseProvider");
5
- class JsonRpcProvider extends BaseProvider_1.BaseProvider {
6
- /**
7
- * @ignore
8
- */
9
- selectRpcUrl() {
10
- return this._rpcUrls[0];
11
- }
12
- /**
13
- * @ignore
14
- */
15
- post(body) {
16
- return this._post(body);
17
- }
18
- /**
19
- * @param rpcUrl The URL to your Eth node. Consider POKT or Infura
20
- * @example
21
- * `https://free-eth-node.com/api/eth`
22
- * @example
23
- * `https://mainnet.infura.io/v3/YOUR-PROJECT-ID`
24
- */
25
- constructor(rpcUrl = 'https://free-eth-node.com/api/eth') {
26
- super([rpcUrl]);
27
- }
28
- }
29
- exports.JsonRpcProvider = JsonRpcProvider;
30
- /**
31
- * Helper function to avoid "new"
32
- *
33
- * @param rpcUrl the RPC URL to post requests to
34
- * @returns an initiated {@link JsonRpcProvider}
35
- * @example
36
- * ```javascript
37
- * jsonRpcProvider().getBlock('latest').then(block => {
38
- * console.log(block.number);
39
- * })
40
- * // 14530496
41
- * ```
42
- */
43
- function jsonRpcProvider(rpcUrl) {
44
- return new JsonRpcProvider(rpcUrl);
45
- }
46
- exports.jsonRpcProvider = jsonRpcProvider;
@@ -1,14 +0,0 @@
1
- import type { Filter } from '../../../../types/Filter.types';
2
- import type { RPCLog } from '../../../../types/Transaction.types';
3
- export declare const STRONGBLOCK_ADDRESS = "0xfbddadd80fe7bda00b901fbaf73803f2238ae655";
4
- export declare const filterAddressFromTo: Filter;
5
- export declare const RARELAND_ADDRESS = "0x596a0f276ee432d8a28441e55737ff55cf30d0f7";
6
- export declare const filterAddressTopics: Filter;
7
- export declare const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
8
- export declare const filterAll: Filter;
9
- export declare const mockfilterAddressFromToLogs: RPCLog[];
10
- export declare const mockfilterAddressTopicsLogs: RPCLog[];
11
- export declare const mockfilterAllLogs: RPCLog[];
12
- export declare const mockRpcAddressFromToResponse: string;
13
- export declare const mockRpcAddressTopicsResponse: string;
14
- export declare const mockRpcAllResponse: string;
@@ -1,152 +0,0 @@
1
- "use strict";
2
- // Example logs that should be returned
3
- // https://etherscan.io/address/0xfbddadd80fe7bda00b901fbaf73803f2238ae655#events
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.mockRpcAllResponse = exports.mockRpcAddressTopicsResponse = exports.mockRpcAddressFromToResponse = exports.mockfilterAllLogs = exports.mockfilterAddressTopicsLogs = exports.mockfilterAddressFromToLogs = exports.filterAll = exports.WETH_ADDRESS = exports.filterAddressTopics = exports.RARELAND_ADDRESS = exports.filterAddressFromTo = exports.STRONGBLOCK_ADDRESS = void 0;
6
- // Block(s) are 14809329
7
- exports.STRONGBLOCK_ADDRESS = '0xfbddadd80fe7bda00b901fbaf73803f2238ae655';
8
- exports.filterAddressFromTo = {
9
- address: exports.STRONGBLOCK_ADDRESS,
10
- fromBlock: '0xE1F8F1',
11
- toBlock: '0xE1F8F1',
12
- };
13
- // Example logs that should be returned
14
- // https://etherscan.io/address/0x596a0f276ee432d8a28441e55737ff55cf30d0f7#events
15
- exports.RARELAND_ADDRESS = '0x596a0f276ee432d8a28441e55737ff55cf30d0f7';
16
- exports.filterAddressTopics = {
17
- address: exports.RARELAND_ADDRESS,
18
- topics: [
19
- '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925',
20
- ],
21
- };
22
- // https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#events
23
- // Address is for Wrapped Ether Contract
24
- exports.WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
25
- exports.filterAll = {
26
- address: exports.WETH_ADDRESS,
27
- topics: [
28
- '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
29
- '0x00000000000000000000000021b8065d10f73ee2e260e5b47d3344d3ced7596e',
30
- ],
31
- fromBlock: 14825027,
32
- toBlock: 14825039,
33
- };
34
- exports.mockfilterAddressFromToLogs = [
35
- {
36
- address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
37
- topics: [
38
- '0xd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a',
39
- '0x00000000000000000000000028c2e3e17f8c61a9b7515f7bb1e1347846588b82',
40
- ],
41
- data: '0x0000000000000000000000000000000000000000000000001dbaed81bf64db6d',
42
- blockNumber: '0xe1f8f1',
43
- transactionHash: '0x5dec3a55b87edac0af5c4a9afdd015bb04303fdf86525dd1cc4e7aa7653b6301',
44
- transactionIndex: '0x29',
45
- blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
46
- logIndex: '0x88',
47
- removed: false,
48
- },
49
- {
50
- address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
51
- topics: [
52
- '0xd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a',
53
- '0x000000000000000000000000c3b80d78bb52fd734c4f730dad5e190ba4ecb830',
54
- ],
55
- data: '0x0000000000000000000000000000000000000000000000001c277de315af8924',
56
- blockNumber: '0xe1f8f1',
57
- transactionHash: '0xae04b63efd57852e34bdc84e257bb413f9f942288f63a131d4b7071c8ee0b896',
58
- transactionIndex: '0x2f',
59
- blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
60
- logIndex: '0x95',
61
- removed: false,
62
- },
63
- {
64
- address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
65
- topics: [
66
- '0xd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a',
67
- '0x000000000000000000000000f1a192063f0a2b2be0cbcb2978b13e95e7f35f6b',
68
- ],
69
- data: '0x00000000000000000000000000000000000000000000000018ecfa70ea275b6d',
70
- blockNumber: '0xe1f8f1',
71
- transactionHash: '0xbdba7260507b4ca24757809ac9a23e5225e80a491475ccf89a04c1894a693c77',
72
- transactionIndex: '0x30',
73
- blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
74
- logIndex: '0x97',
75
- removed: false,
76
- },
77
- {
78
- address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
79
- topics: [
80
- '0xd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a',
81
- '0x000000000000000000000000c78dc12c9b04858d57a108ae948020344895e910',
82
- ],
83
- data: '0x0000000000000000000000000000000000000000000000000da5142efe16e492',
84
- blockNumber: '0xe1f8f1',
85
- transactionHash: '0xdcf29bd8a44ec89a3b53488dd60b76bd7f1c532db76f88e166f3de1ab216537e',
86
- transactionIndex: '0x31',
87
- blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
88
- logIndex: '0x99',
89
- removed: false,
90
- },
91
- {
92
- address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
93
- topics: [
94
- '0xd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a',
95
- '0x000000000000000000000000aaf5c3760f4a77bdf23974f98d69f9ccfd778aea',
96
- ],
97
- data: '0x0000000000000000000000000000000000000000000000001086ed3d87034000',
98
- blockNumber: '0xe1f8f1',
99
- transactionHash: '0x56130c6e8fdafd0e08411b21ce984eeb56dc61d99a91f03efc7edde748d7ad81',
100
- transactionIndex: '0x35',
101
- blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
102
- logIndex: '0xac',
103
- removed: false,
104
- },
105
- {
106
- address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
107
- topics: [
108
- '0x39b0a0620bb668047ab7248973ddfd93d53dff1d4952bd2d56bbf5934edc1fd0',
109
- '0x0000000000000000000000001753de22132990dd5ab35f13a5951431c8ba08ea',
110
- ],
111
- data: '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000e3203b',
112
- blockNumber: '0xe1f8f1',
113
- transactionHash: '0xf5a77d85296cc670d577d3c9a76b1fa18be77239a4cb4c05493530866d60c36f',
114
- transactionIndex: '0x3a',
115
- blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
116
- logIndex: '0xb5',
117
- removed: false,
118
- },
119
- ];
120
- exports.mockfilterAddressTopicsLogs = [];
121
- exports.mockfilterAllLogs = [
122
- {
123
- address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
124
- topics: [
125
- '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
126
- '0x00000000000000000000000021b8065d10f73ee2e260e5b47d3344d3ced7596e',
127
- '0x00000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc45',
128
- ],
129
- data: '0x000000000000000000000000000000000000000000000000005f862ee352a38a',
130
- blockNumber: '0xe23645',
131
- transactionHash: '0xbd49031be16f8fd1775f4e0fe79b408ffd8ae9c65b2827ee47e3238e3f51f4c0',
132
- transactionIndex: '0xe2',
133
- blockHash: '0x8e0dfac2f704851960f866c8708b3bef2f66c0fee0329cf25ff0261b264ca6bc',
134
- logIndex: '0x180',
135
- removed: false,
136
- },
137
- ];
138
- exports.mockRpcAddressFromToResponse = JSON.stringify({
139
- jsonrpc: '2.0',
140
- id: 1,
141
- result: exports.mockfilterAddressFromToLogs,
142
- });
143
- exports.mockRpcAddressTopicsResponse = JSON.stringify({
144
- jsonrpc: '2.0',
145
- id: 1,
146
- result: exports.mockfilterAddressTopicsLogs,
147
- });
148
- exports.mockRpcAllResponse = JSON.stringify({
149
- jsonrpc: '2.0',
150
- id: 1,
151
- result: exports.mockfilterAllLogs,
152
- });
@@ -1,8 +0,0 @@
1
- /**
2
- * Helper function for mocking other functions.
3
- *
4
- * @param fn
5
- * @example mockOf(stripe.checkout.sessions.create).mockResolvedValue(mockSession);
6
- * @see https://twitter.com/scastiel/status/1631354119192473601?s=20
7
- */
8
- export declare const mockOf: <FunctionParameters extends unknown[], FunctionReturnType>(fn: (...args: FunctionParameters) => FunctionReturnType) => (...args: FunctionParameters) => FunctionReturnType;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mockOf = void 0;
4
- /**
5
- * Helper function for mocking other functions.
6
- *
7
- * @param fn
8
- * @example mockOf(stripe.checkout.sessions.create).mockResolvedValue(mockSession);
9
- * @see https://twitter.com/scastiel/status/1631354119192473601?s=20
10
- */
11
- const mockOf = (fn) => fn;
12
- exports.mockOf = mockOf;
@@ -1,12 +0,0 @@
1
- export declare const fakeUrls: {
2
- readonly notRPCButRealHttp: "https://httpstat.us/200";
3
- };
4
- export declare const rpcUrls: {
5
- mainnet: string;
6
- oeth: string;
7
- matic: string;
8
- gno: string;
9
- bnb: string;
10
- arb1: string;
11
- gor: string;
12
- };
@@ -1,27 +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.rpcUrls = exports.fakeUrls = void 0;
7
- const zod_1 = __importDefault(require("zod"));
8
- exports.fakeUrls = {
9
- notRPCButRealHttp: 'https://httpstat.us/200',
10
- };
11
- const RPC_ORIGIN = 'https://free-eth-node.com';
12
- zod_1.default.string({
13
- required_error: '"RPC_ORIGIN" required but not found',
14
- })
15
- .url('Expected url for "RPC_ORIGIN"')
16
- .parse(RPC_ORIGIN);
17
- const ALCHEMY_API_KEY = process.env.ALCHEMY_API_KEY;
18
- const MAINNET_RPC_ORIGIN = `https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}`;
19
- exports.rpcUrls = {
20
- mainnet: MAINNET_RPC_ORIGIN,
21
- oeth: `${RPC_ORIGIN}/api/oeth`,
22
- matic: `${RPC_ORIGIN}/api/MATIC`,
23
- gno: `${RPC_ORIGIN}/api/gno`,
24
- bnb: `${RPC_ORIGIN}/api/bnb`,
25
- arb1: `${RPC_ORIGIN}/api/arb1`,
26
- gor: `${RPC_ORIGIN}/api/gor`,
27
- };
@@ -1,24 +0,0 @@
1
- declare const _default: {
2
- "1": string[];
3
- "5": string[];
4
- "10": string[];
5
- "50": string[];
6
- "56": string[];
7
- "100": string[];
8
- "137": string[];
9
- "250": string[];
10
- "324": string[];
11
- "1101": string[];
12
- "1337": string[];
13
- "7700": string[];
14
- "9001": string[];
15
- "42161": string[];
16
- "42220": string[];
17
- "43114": string[];
18
- "59140": string[];
19
- "80001": string[];
20
- "421613": string[];
21
- "534352": string[];
22
- "11155111": string[];
23
- };
24
- export default _default;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // autogenerated in "fetch-chains-info.ts"
4
- // Do not edit directly
5
- exports.default = {
6
- "1": [
7
- "eth",
8
- "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
9
- ],
10
- "5": [
11
- "gor",
12
- "0x112234455c3a32fd11230c42e7bccd4a84e02010"
13
- ],
14
- "10": [
15
- "oeth"
16
- ],
17
- "50": [
18
- "xdc"
19
- ],
20
- "56": [
21
- "bnb"
22
- ],
23
- "100": [
24
- "gno"
25
- ],
26
- "137": [
27
- "matic"
28
- ],
29
- "250": [
30
- "ftm"
31
- ],
32
- "324": [
33
- "zksync"
34
- ],
35
- "1101": [
36
- "zkevm"
37
- ],
38
- "1337": [
39
- "geth"
40
- ],
41
- "7700": [
42
- "canto"
43
- ],
44
- "9001": [
45
- "evmos"
46
- ],
47
- "42161": [
48
- "arb1"
49
- ],
50
- "42220": [
51
- "celo"
52
- ],
53
- "43114": [
54
- "avax"
55
- ],
56
- "59140": [
57
- "linea-testnet"
58
- ],
59
- "80001": [
60
- "maticmum"
61
- ],
62
- "421613": [
63
- "arb-goerli"
64
- ],
65
- "534352": [
66
- "scr"
67
- ],
68
- "11155111": [
69
- "sep"
70
- ]
71
- };
@@ -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
- /**
22
- * Used anytime you're passing in "value" to ethers or web3
23
- * For now, TypeScript will complain that `TinyBig` is not a `BigNumberish`. You can // @ts-ignore or call this
24
- *
25
- * @returns the TinyBig represented as a hex string
26
- * @example
27
- * ```javascript
28
- * tinyBig(293).toHexString();
29
- * // '0x125'
30
- * ```
31
- * @example
32
- * ```javascript
33
- * tinyBig(681365874).toHexString();
34
- * // '0x289cd172'
35
- */
36
- toHexString() {
37
- return `0x${BigInt(this.toString()).toString(16)}`;
38
- }
39
- toNumber() {
40
- return Number((0, helpers_1.scientificStrToDecimalStr)(super.toString()));
41
- }
42
- toString() {
43
- if (this.toNumber() === 0) {
44
- return '0';
45
- }
46
- return (0, helpers_1.scientificStrToDecimalStr)(super.toString());
47
- }
48
- /**
49
- * Eithers pads or shortens a string to a specified length
50
- *
51
- * @param str the string to pad or chop
52
- * @param padChar the character to pad the string with
53
- * @param length the desired length of the given string
54
- * @returns a string of the desired length, either padded with the specified padChar or with the beginning of the string chopped off
55
- * @example
56
- * ```javascript
57
- * padAndChop('essential-eth', 'a', 8);
58
- * // 'tial-eth'
59
- * ```
60
- * @example
61
- * ```javascript
62
- * padAndChop('essential-eth', 'A', 20);
63
- * // 'AAAAAAAessential-eth'
64
- * ```
65
- */
66
- padAndChop = (str, padChar, length) => {
67
- return (Array(length).fill(padChar).join('') + str).slice(length * -1);
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,3 +0,0 @@
1
- type JSPrimitiveTypes = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function';
2
- export declare const validateType: (value: unknown, allowedTypes: JSPrimitiveTypes[]) => void;
3
- export {};
@@ -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;