essential-eth 0.9.2-beta.3 → 0.9.2-beta.5

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 (101) hide show
  1. package/dist/cjs/classes/Contract.d.ts +81 -11
  2. package/dist/cjs/classes/test/Contract/crv-abi.d.ts +2 -2
  3. package/dist/cjs/classes/test/Contract/ens-abi.d.ts +2 -2
  4. package/dist/cjs/classes/test/Contract/fei-abi.d.ts +2 -2
  5. package/dist/cjs/classes/test/Contract/foo-abi.d.ts +2 -2
  6. package/dist/cjs/classes/test/Contract/uniswap-abi.d.ts +2 -2
  7. package/dist/cjs/classes/utils/clean-block.d.ts +120 -2
  8. package/dist/cjs/classes/utils/clean-log.d.ts +9 -2
  9. package/dist/cjs/classes/utils/clean-transaction-receipt.d.ts +14 -2
  10. package/dist/cjs/classes/utils/clean-transaction.d.ts +14 -2
  11. package/dist/cjs/classes/utils/encode-decode-transaction.d.ts +16 -4
  12. package/dist/cjs/classes/utils/fetchers.d.ts +53 -15
  13. package/dist/cjs/classes/utils/hex-to-decimal.d.ts +18 -1
  14. package/dist/cjs/classes/utils/prepare-transaction.d.ts +6 -2
  15. package/dist/cjs/index.d.ts +24 -24
  16. package/dist/cjs/index.umd.js +1 -1
  17. package/dist/cjs/index.umd.js.map +1 -1
  18. package/dist/cjs/logger/logger.d.ts +11 -11
  19. package/dist/cjs/logger/package-version.d.ts +1 -1
  20. package/dist/cjs/logger/package-version.js +1 -1
  21. package/dist/cjs/providers/AlchemyProvider.d.ts +4 -4
  22. package/dist/cjs/providers/BaseProvider.d.ts +374 -26
  23. package/dist/cjs/providers/FallthroughProvider.d.ts +24 -11
  24. package/dist/cjs/providers/JsonRpcProvider.d.ts +33 -7
  25. package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.d.ts +14 -14
  26. package/dist/cjs/providers/test/mock-of.d.ts +9 -2
  27. package/dist/cjs/providers/test/rpc-urls.d.ts +12 -12
  28. package/dist/cjs/providers/utils/chains-info.d.ts +24 -24
  29. package/dist/cjs/shared/tiny-big/helpers.d.ts +17 -1
  30. package/dist/cjs/shared/tiny-big/tiny-big.d.ts +58 -10
  31. package/dist/cjs/shared/validate-type.d.ts +3 -3
  32. package/dist/cjs/types/Block.types.d.ts +41 -40
  33. package/dist/cjs/types/Contract.types.d.ts +24 -24
  34. package/dist/cjs/types/FeeData.types.d.ts +7 -7
  35. package/dist/cjs/types/Filter.types.d.ts +16 -12
  36. package/dist/cjs/types/Network.types.d.ts +8 -5
  37. package/dist/cjs/types/Transaction.types.d.ts +123 -113
  38. package/dist/cjs/utils/bytes.d.ts +289 -40
  39. package/dist/cjs/utils/compute-address.d.ts +17 -1
  40. package/dist/cjs/utils/compute-public-key.d.ts +18 -2
  41. package/dist/cjs/utils/ether-to-gwei.d.ts +27 -3
  42. package/dist/cjs/utils/ether-to-wei.d.ts +27 -3
  43. package/dist/cjs/utils/gwei-to-ether.d.ts +27 -3
  44. package/dist/cjs/utils/hash-message.d.ts +14 -2
  45. package/dist/cjs/utils/is-address.d.ts +24 -1
  46. package/dist/cjs/utils/keccak256.d.ts +16 -2
  47. package/dist/cjs/utils/solidity-keccak256.d.ts +39 -2
  48. package/dist/cjs/utils/split-signature.d.ts +24 -2
  49. package/dist/cjs/utils/to-checksum-address.d.ts +17 -1
  50. package/dist/cjs/utils/to-utf8-bytes.d.ts +15 -1
  51. package/dist/cjs/utils/wei-to-ether.d.ts +27 -3
  52. package/dist/esm/classes/Contract.d.ts +11 -11
  53. package/dist/esm/classes/test/Contract/crv-abi.d.ts +2 -2
  54. package/dist/esm/classes/test/Contract/ens-abi.d.ts +2 -2
  55. package/dist/esm/classes/test/Contract/fei-abi.d.ts +2 -2
  56. package/dist/esm/classes/test/Contract/foo-abi.d.ts +2 -2
  57. package/dist/esm/classes/test/Contract/uniswap-abi.d.ts +2 -2
  58. package/dist/esm/classes/utils/clean-block.d.ts +2 -2
  59. package/dist/esm/classes/utils/clean-log.d.ts +2 -2
  60. package/dist/esm/classes/utils/clean-transaction-receipt.d.ts +2 -2
  61. package/dist/esm/classes/utils/clean-transaction.d.ts +2 -2
  62. package/dist/esm/classes/utils/encode-decode-transaction.d.ts +4 -4
  63. package/dist/esm/classes/utils/fetchers.d.ts +15 -15
  64. package/dist/esm/classes/utils/hex-to-decimal.d.ts +1 -1
  65. package/dist/esm/classes/utils/prepare-transaction.d.ts +2 -2
  66. package/dist/esm/index.d.ts +24 -24
  67. package/dist/esm/logger/logger.d.ts +11 -11
  68. package/dist/esm/logger/package-version.d.ts +1 -1
  69. package/dist/esm/logger/package-version.js +1 -1
  70. package/dist/esm/providers/AlchemyProvider.d.ts +4 -4
  71. package/dist/esm/providers/BaseProvider.d.ts +26 -26
  72. package/dist/esm/providers/FallthroughProvider.d.ts +11 -11
  73. package/dist/esm/providers/JsonRpcProvider.d.ts +7 -7
  74. package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.d.ts +14 -14
  75. package/dist/esm/providers/test/mock-of.d.ts +2 -2
  76. package/dist/esm/providers/test/rpc-urls.d.ts +12 -12
  77. package/dist/esm/providers/utils/chains-info.d.ts +24 -24
  78. package/dist/esm/shared/tiny-big/helpers.d.ts +1 -1
  79. package/dist/esm/shared/tiny-big/tiny-big.d.ts +10 -10
  80. package/dist/esm/shared/validate-type.d.ts +3 -3
  81. package/dist/esm/types/Block.types.d.ts +40 -40
  82. package/dist/esm/types/Contract.types.d.ts +24 -24
  83. package/dist/esm/types/FeeData.types.d.ts +7 -7
  84. package/dist/esm/types/Filter.types.d.ts +12 -12
  85. package/dist/esm/types/Network.types.d.ts +5 -5
  86. package/dist/esm/types/Transaction.types.d.ts +113 -113
  87. package/dist/esm/utils/bytes.d.ts +40 -40
  88. package/dist/esm/utils/compute-address.d.ts +1 -1
  89. package/dist/esm/utils/compute-public-key.d.ts +2 -2
  90. package/dist/esm/utils/ether-to-gwei.d.ts +3 -3
  91. package/dist/esm/utils/ether-to-wei.d.ts +3 -3
  92. package/dist/esm/utils/gwei-to-ether.d.ts +3 -3
  93. package/dist/esm/utils/hash-message.d.ts +2 -2
  94. package/dist/esm/utils/is-address.d.ts +1 -1
  95. package/dist/esm/utils/keccak256.d.ts +2 -2
  96. package/dist/esm/utils/solidity-keccak256.d.ts +2 -2
  97. package/dist/esm/utils/split-signature.d.ts +2 -2
  98. package/dist/esm/utils/to-checksum-address.d.ts +1 -1
  99. package/dist/esm/utils/to-utf8-bytes.d.ts +1 -1
  100. package/dist/esm/utils/wei-to-ether.d.ts +3 -3
  101. package/package.json +6 -6
@@ -1,11 +1,11 @@
1
- declare class Logger {
2
- private packageVersion;
3
- constructor();
4
- throwError(message: string, args: {
5
- [key: string]: any;
6
- }): never;
7
- throwArgumentError(message: string, arg: string, value: any): never;
8
- checkSafeUint53(value: number, message?: string): void;
9
- }
10
- export declare const logger: Logger;
11
- export {};
1
+ declare class Logger {
2
+ private packageVersion;
3
+ constructor();
4
+ throwError(message: string, args: {
5
+ [key: string]: any;
6
+ }): never;
7
+ throwArgumentError(message: string, arg: string, value: any): never;
8
+ checkSafeUint53(value: number, message?: string): void;
9
+ }
10
+ export declare const logger: Logger;
11
+ export {};
@@ -1 +1 @@
1
- export declare const version = "0.9.2-beta.3";
1
+ export declare const version = "0.9.2-beta.5";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = '0.9.2-beta.3';
5
+ exports.version = '0.9.2-beta.5';
@@ -1,4 +1,4 @@
1
- import { JsonRpcProvider } from './JsonRpcProvider';
2
- export declare class AlchemyProvider extends JsonRpcProvider {
3
- constructor(apiKey: string, network?: string);
4
- }
1
+ import { JsonRpcProvider } from './JsonRpcProvider';
2
+ export declare class AlchemyProvider extends JsonRpcProvider {
3
+ constructor(apiKey: string, network?: string);
4
+ }
@@ -1,26 +1,374 @@
1
- import type { TinyBig } from '../shared/tiny-big/tiny-big';
2
- import type { BlockResponse, BlockTag } from '../types/Block.types';
3
- import type { FeeData } from '../types/FeeData.types';
4
- import type { Filter, FilterByBlockHash } from '../types/Filter.types';
5
- import type { Network } from '../types/Network.types';
6
- import type { Log, TransactionReceipt, TransactionRequest, TransactionResponse } from '../types/Transaction.types';
7
- export declare abstract class BaseProvider {
8
- abstract selectRpcUrl(): string;
9
- abstract post(body: Record<string, unknown>): Promise<any>;
10
- readonly _rpcUrls: string[];
11
- protected _post: (body: Record<string, unknown>) => Promise<any>;
12
- constructor(rpcUrls: string[]);
13
- getNetwork(): Promise<Network>;
14
- getBlockNumber(): Promise<number>;
15
- getTransaction(transactionHash: string): Promise<TransactionResponse>;
16
- getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
17
- getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>;
18
- getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>;
19
- getGasPrice(): Promise<TinyBig>;
20
- getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>;
21
- getCode(address: string, blockTag?: BlockTag): Promise<string>;
22
- estimateGas(transaction: TransactionRequest): Promise<TinyBig>;
23
- getFeeData(): Promise<FeeData>;
24
- getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
25
- call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>;
26
- }
1
+ import type { TinyBig } from '../shared/tiny-big/tiny-big';
2
+ import type { BlockResponse, BlockTag } from '../types/Block.types';
3
+ import type { FeeData } from '../types/FeeData.types';
4
+ import type { Filter, FilterByBlockHash } from '../types/Filter.types';
5
+ import type { Network } from '../types/Network.types';
6
+ import type { Log, TransactionReceipt, TransactionRequest, TransactionResponse } from '../types/Transaction.types';
7
+ export declare abstract class BaseProvider {
8
+ /**
9
+ * ignore
10
+ */
11
+ abstract selectRpcUrl(): string;
12
+ abstract post(body: Record<string, unknown>): Promise<any>;
13
+ /**
14
+ * @ignore
15
+ */
16
+ readonly _rpcUrls: string[];
17
+ /**
18
+ * @ignore
19
+ */
20
+ protected _post: (body: Record<string, unknown>) => Promise<any>;
21
+ /**
22
+ * @param rpcUrls The URL(s) to your Eth node(s). Consider POKT or Infura
23
+ * @example
24
+ * `https://free-eth-node.com/api/eth`
25
+ * @example
26
+ * `https://mainnet.infura.io/v3/YOUR-PROJECT-ID`
27
+ */
28
+ constructor(rpcUrls: string[]);
29
+ /**
30
+ * Gets information (name, chainId, and ensAddress when applicable) about the network the provider is connected to.
31
+ *
32
+ * * [Identical](/docs/api#isd) to [`ethers.provider.getNetwork`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getNetwork) in ethers.js
33
+ * * [Similar](/docs/api#isd) to [`web3.eth.getChainId`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getchainid) in web3.js, returns more than just the `chainId`
34
+ *
35
+ * @returns information about the network this provider is currently connected to
36
+ * @example
37
+ * ```javascript
38
+ * jsonRpcProvider('https://free-eth-node.com/api/eth').getNetwork();
39
+ * // { chainId: 1, name: 'eth', ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' }
40
+ * ```
41
+ * @example
42
+ * ```javascript
43
+ * jsonRpcProvider('https://free-eth-node.com/api/MATIC').getNetwork();
44
+ * // { chainId: 137, name: 'MATIC', ensAddress: null }
45
+ * ```
46
+ */
47
+ getNetwork(): Promise<Network>;
48
+ /**
49
+ * Gets the number of the most recently mined block on the network the provider is connected to.
50
+ *
51
+ * * [Identical](/docs/api#isd) to [`ethers.provider.getBlockNumber`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getBlockNumber) in ethers.js
52
+ * * [Identical](/docs/api#isd) to [`web3.eth.getBlockNumber`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getblocknumber) in web3.js
53
+ *
54
+ * @returns the number of the most recently mined block
55
+ * @example
56
+ * ```javascript
57
+ * await provider.getBlockNumber();
58
+ * // 1053312
59
+ * ```
60
+ */
61
+ getBlockNumber(): Promise<number>;
62
+ /**
63
+ * Gets information about a specified transaction, even if it hasn't been mined yet.
64
+ *
65
+ * * [Similar](/docs/api#isd) to [`ethers.provider.getTransaction`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getTransaction) in ethers.js, does not have `wait` method that waits until the transaction has been mined
66
+ * * [Similar](/docs/api#isd) to [`web3.eth.getTransaction`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#gettransaction) in web3.js, some information returned using different types
67
+ *
68
+ * @param transactionHash the hash of the transaction to get information about
69
+ * @returns information about the specified transaction
70
+ * @example
71
+ * ```javascript
72
+ * await provider.getTransaction('0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789');
73
+ * // {
74
+ * // accessList: [],
75
+ * // blockHash: "0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d",
76
+ * // blockNumber: 14578286,
77
+ * // chainId: 1,
78
+ * // from: "0xdfD9dE5f6FA60BD70636c0900752E93a6144AEd4",
79
+ * // gas: { TinyBig: 112163 },
80
+ * // gasPrice: { TinyBig: 48592426858 },
81
+ * // hash: "0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789",
82
+ * // input: "0x83259f17000000000000000000000000000000000000000000...",
83
+ * // maxFeePerGas: { TinyBig: 67681261618 },
84
+ * // maxPriorityFeePerGas: { TinyBig: 1500000000 },
85
+ * // nonce: { TinyBig: 129 },
86
+ * // r: "0x59a7c15b12c18cd68d6c440963d959bff3e73831ffc938e75ecad07f7ee43fbc",
87
+ * // s: "0x1ebaf05f0d9273b16c2a7748b150a79d22533a8cd74552611cbe620fee3dcf1c",
88
+ * // to: "0x39B72d136ba3e4ceF35F48CD09587ffaB754DD8B",
89
+ * // transactionIndex: 29,
90
+ * // type: 2,
91
+ * // v: 0,
92
+ * // value: { TinyBig: 0 },
93
+ * // confirmations: 298140,
94
+ * // }
95
+ * ```
96
+ */
97
+ getTransaction(transactionHash: string): Promise<TransactionResponse>;
98
+ /**
99
+ * Gives information about a transaction that has already been mined. Includes additional information beyond what's provided by [`getTransaction`](/docs/api/modules#gettransaction).
100
+ *
101
+ * * [Identical](/docs/api#isd) to [`ethers.provider.getTransactionReceipt`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getTransactionReceipt) in ethers.js
102
+ * * [Similar](/docs/api#isd) to [`web3.eth.getTransactionReceipt`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#gettransactionreceipt) in web3.js, some information returned using different types
103
+ *
104
+ * @param transactionHash the hash of the transaction to get information about
105
+ * @returns information about the specified transaction that has already been mined
106
+ * @example
107
+ * ```javascript
108
+ * await provider.getTransactionReceipt('0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789');
109
+ * // {
110
+ * // blockHash: "0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d",
111
+ * // blockNumber: 14578286,
112
+ * // contractAddress: null,
113
+ * // cumulativeGasUsed: { TinyBig: 3067973 },
114
+ * // effectiveGasPrice: { TinyBig: 48592426858 },
115
+ * // from: "0xdfD9dE5f6FA60BD70636c0900752E93a6144AEd4",
116
+ * // gasUsed: { TinyBig: 112163 },
117
+ * // logs: [
118
+ * // {
119
+ * // address: "0x0eDF9bc41Bbc1354c70e2107F80C42caE7FBBcA8",
120
+ * // blockHash: "0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d",
121
+ * // blockNumber: 14578286,
122
+ * // data: "0x0000000000000000000000000000000000000000000003a12ec797b5484968c1",
123
+ * // logIndex: 42,
124
+ * // topics: [
125
+ * // "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
126
+ * // "0x00000000000000000000000039b72d136ba3e4cef35f48cd09587ffab754dd8b",
127
+ * // "0x000000000000000000000000dfd9de5f6fa60bd70636c0900752e93a6144aed4",
128
+ * // ],
129
+ * // transactionHash: "0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789",
130
+ * // transactionIndex: 29,
131
+ * // },
132
+ * // {
133
+ * // address: "0x39B72d136ba3e4ceF35F48CD09587ffaB754DD8B",
134
+ * // blockHash: "0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d",
135
+ * // blockNumber: 14578286,
136
+ * // data: "0x0000000000000000000000000000000000000000000003a12ec797b5484968c1",
137
+ * // logIndex: 43,
138
+ * // topics: [
139
+ * // "0x34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf7",
140
+ * // "0x000000000000000000000000dfd9de5f6fa60bd70636c0900752e93a6144aed4",
141
+ * // "0x0000000000000000000000000000000000000000000000000000000000000003",
142
+ * // ],
143
+ * // transactionHash: "0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789",
144
+ * // transactionIndex: 29,
145
+ * // },
146
+ * // ],
147
+ * // logsBloom: "0x00000000000000000000000000000...",
148
+ * // status: 1,
149
+ * // to: "0x39B72d136ba3e4ceF35F48CD09587ffaB754DD8B",
150
+ * // transactionHash: "0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789",
151
+ * // transactionIndex: 29,
152
+ * // type: 2,
153
+ * // byzantium: true,
154
+ * // confirmations: 298171,
155
+ * // }
156
+ * ```
157
+ */
158
+ getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
159
+ /**
160
+ * Returns the number of sent transactions by an address, from genesis (or as far back as a provider looks) up to specified block.
161
+ *
162
+ * * [Identical](/docs/api#isd) to [`ethers.provider.getTransactionCount`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getTransactionCount) in ethers.js
163
+ * * [Identical](/docs/api#isd) to [`web3.eth.getTransactionCount`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#gettransactioncount) in web3.js
164
+ *
165
+ * @param address the address to count number of sent transactions
166
+ * @param blockTag the block to count transactions up to, inclusive
167
+ * @returns the number of transactions sent by the specified address
168
+ * @example
169
+ * ```javascript
170
+ * await provider.getTransactionCount('0x71660c4005ba85c37ccec55d0c4493e66fe775d3');
171
+ * // 1060000
172
+ * ```
173
+ * @example
174
+ * ```javascript
175
+ * await provider.getTransactionCount('0x71660c4005ba85c37ccec55d0c4493e66fe775d3', 'latest');
176
+ * // 1060000
177
+ * ```
178
+ * @example
179
+ * ```javascript
180
+ * await provider.getTransactionCount('0x71660c4005ba85c37ccec55d0c4493e66fe775d3', 14649390);
181
+ * // 1053312
182
+ * ```
183
+ */
184
+ getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>;
185
+ /**
186
+ * Gets information about a certain block, optionally with full transaction objects.
187
+ *
188
+ * * [Similar](/docs/api#isd) to [`ethers.provider.getBlock`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getLogs) in ethers.js, includes some additional information. Can also return block with full transaction objects, similar to [`ethers.providers.getBlockWithTransactions`]
189
+ * * [Identical](/docs/api#isd) to [`web3.eth.getBlock`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getpastlogs) in web3.js
190
+ *
191
+ * @param timeFrame The number, hash, or text-based description ('latest', 'earliest', or 'pending') of the block to collect information on.
192
+ * @param returnTransactionObjects Whether to also return data about the transactions on the block.
193
+ * @returns A BlockResponse object with information about the specified block
194
+ * @example
195
+ * ```javascript
196
+ * await provider.getBlock(14879862);
197
+ * // {
198
+ * // baseFeePerGas: { TinyBig: 39095728776 },
199
+ * // difficulty: { TinyBig: 14321294455359973 },
200
+ * // extraData: "0x486976656f6e2073672d6865617679",
201
+ * // gasLimit: { TinyBig: 29970620 },
202
+ * // gasUsed: { TinyBig: 20951384 },
203
+ * // hash: "0x563b458ec3c4f87393b53f70bdddc0058497109b784d8cacd9247ddf267049ab",
204
+ * // logsBloom:
205
+ * // "0x9f38794fe80b521794df6efad8b0d2e9582f9ec3959a3f9384bda0fa371cfa5fac5af9d515c6bdf1ec325f5b5f7ebdd6a3a9fae17b38a86d4dc4b0971afc68d8086640550f4c156e6f923f4a1bb94fb0bed6cdcc474c5c64bfeff7a4a906f72b9a7b94004ee58efc53d63ac66961acd3a431b2d896cc9fd75f6072960bced45f770587caf130f57504decfcb63c6ca8fbc5bdbd749edd5a99a7375d2b81872289adb775fb3c928259f4be39c6d3f4d5b6217822979bb88c1f1fb62429b1b6d41cf4e3f77f9e1db3f5723108f1e5b1255dd734ad8cdb11e7ea22487c788e67c83777b6f395e504ca59c64f52245ee6de3804cf809e5caa4f0ea6a9aa9eb6ed801",
206
+ * // miner: "0x1aD91ee08f21bE3dE0BA2ba6918E714dA6B45836",
207
+ * // mixHash: "0x73cc9419bfb89c9d41c3a8c34ce56b5ebe468bdcf870258d2e77262275d580ec",
208
+ * // nonce: "0x976f3f5d596ffb08",
209
+ * // number: 14879862,
210
+ * // parentHash: "0x95986ae14a71face8d9a6a379edd875b2e8bc73e4de0d9d460e7752bddb0f579",
211
+ * // receiptsRoot: "0x8e6ba2fd9bee602b653dae6e3132f16538c2c5df24f1df8c000392053f73defa",
212
+ * // sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
213
+ * // size: { TinyBig: 134483 },
214
+ * // stateRoot: "0xbf2bb67bd1c741f3d00904b8451d7c2cf4e3a2726f5a5884792ede2074747b85",
215
+ * // timestamp: { TinyBig: 1654016186 },
216
+ * // totalDifficulty: { TinyBig: 50478104614257705213748 },
217
+ * // transactions: [
218
+ * // "0xb3326a9149809603a2c28545e50e4f7d16e194bf5ee9764e0544603854c4a8d2",
219
+ * // "0x8b42095f8d335404a4896b2817b8e5e3d86a5a87cb434a8eec295d5280a7f48e",
220
+ * // "0x882f78fcb73f0f7ad0700bb0424a8b4beb366aaa93b88a3562c49a8d0ce4dcff",
221
+ * // ...
222
+ * // ],
223
+ * // transactionsRoot: "0x5934902f3dcc263ec34f24318179bf6301f53f4834685792066026f3a4849d72",
224
+ * // uncles: [],
225
+ * // }
226
+ * ```
227
+ */
228
+ getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>;
229
+ /**
230
+ * Gives an estimate of the current gas price in wei.
231
+ *
232
+ * * [Similar](/docs/api#isd) to [`ethers.provider.getGasPrice`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getGasPrice) in ethers.js, does not have a parameter specifying what unit you'd like to return. See also [`weiToEther`](/docs/api/modules#weitoether) and [`etherToGwei`](/docs/api/modules#ethertogwei)
233
+ * * [Identical](/docs/api#isd) to [`web3.eth.getGasPrice`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getgasprice) in web3.js, returns a number (TinyBig) instead of a string
234
+ *
235
+ * @returns an estimate of the current gas price in wei
236
+ * @example
237
+ * ```javascript
238
+ * await provider.getGasPrice();
239
+ * // 52493941856
240
+ * ```
241
+ */
242
+ getGasPrice(): Promise<TinyBig>;
243
+ /**
244
+ * Returns the balance of the account in wei.
245
+ *
246
+ * * [Identical](/docs/api#isd) to [`ethers.provider.getBalance`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getBalance) in ethers.js
247
+ * * [Identical](/docs/api#isd) to [`web3.eth.getBalance`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getbalance) in web3.js, returns a number (TinyBig) instead of a string
248
+ *
249
+ * @param address the address to check the balance of
250
+ * @param blockTag the block to check the specified address' balance on
251
+ * @returns the balance of the network's native token for the specified address on the specified block
252
+ * @example
253
+ * ```javascript
254
+ * await provider.getBalance('0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8');
255
+ * // 28798127851528138
256
+ * ```
257
+ */
258
+ getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>;
259
+ /**
260
+ * Gets the code of a contract on a specified block.
261
+ *
262
+ * * [Identical](/docs/api#isd) to [`ethers.provider.getCode`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getCode) in ethers.js
263
+ * * [Identical](/docs/api#isd) to [`web3.eth.getCode`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getcode) in web3.js
264
+ *
265
+ * @param address the contract address to get the contract code from
266
+ * @param blockTag the block height to search for the contract code from. Contract code can change, so this allows for checking a specific block
267
+ * @returns the contract creation code for the specified address at the specified block height
268
+ * @example
269
+ * ```javascript
270
+ * await jsonRpcProvider().getCode('0xaC6095720221C79C6E7C638d260A2eFBC5D8d880', 'latest');
271
+ * // '0x608060405234801561001057600080fd5b506004361061...'
272
+ * ```
273
+ */
274
+ getCode(address: string, blockTag?: BlockTag): Promise<string>;
275
+ /**
276
+ * Returns an estimate of the amount of gas that would be required to submit transaction to the network.
277
+ * An estimate may not be accurate since there could be another transaction on the network that was not accounted for.
278
+ *
279
+ * * [Identical](/docs/api#isd) to [`ethers.provider.estimateGas`](https://docs.ethers.io/v5/api/providers/provider/#Provider-estimateGas) in ethers.js
280
+ * * [Identical](/docs/api#isd) to [`web3.eth.estimateGas`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#estimateGas) in web3.js
281
+ *
282
+ * @param transaction the transaction to check the estimated gas cost for
283
+ * @returns the estimated amount of gas charged for submitting the specified transaction to the blockchain
284
+ * @example
285
+ * ```javascript
286
+ * await provider.estimateGas({
287
+ * // Wrapped ETH address
288
+ * to: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
289
+ * data: "0xd0e30db0",
290
+ * value: etherToWei('1.0').toHexString(),
291
+ * });
292
+ * // { TinyBig: "27938" }
293
+ * ```
294
+ */
295
+ estimateGas(transaction: TransactionRequest): Promise<TinyBig>;
296
+ /**
297
+ * Returns the current recommended FeeData to use in a transaction.
298
+ * For an EIP-1559 transaction, the maxFeePerGas and maxPriorityFeePerGas should be used.
299
+ * For legacy transactions and networks which do not support EIP-1559, the gasPrice should be used.Returns an estimate of the amount of gas that would be required to submit transaction to the network.
300
+ *
301
+ * * [Identical](/docs/api#isd) to [`ethers.provider.getFeeData`](https://docs.ethers.org/v5/api/providers/provider/#Provider-getFeeData) in ethers.js
302
+ *
303
+ * @returns an object with gas estimates for the network currently
304
+ * @example
305
+ * ```javascript
306
+ * await provider.getFeeData();
307
+ * // {
308
+ * // gasPrice: { TinyBig: "14184772639" },
309
+ * // lastBaseFeePerGas: { TinyBig: "14038523098" },
310
+ * // maxFeePerGas: { TinyBig: "29577046196" },
311
+ * // maxPriorityFeePerGas: { TinyBig: "1500000000" }
312
+ * // }
313
+ * ```
314
+ */
315
+ getFeeData(): Promise<FeeData>;
316
+ /**
317
+ * Returns transaction receipt event logs that match a specified filter.
318
+ * May return `[]` if parameters are too broad, even if logs exist.
319
+ *
320
+ * * [Identical](/docs/api#isd) to [`ethers.provider.getLogs`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getLogs) in ethers.js
321
+ * * [Identical](/docs/api#isd) to [`web3.eth.getPastLogs`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getpastlogs) in web3.js
322
+ *
323
+ * @param filter parameters to filter the logs by
324
+ * @returns an array of logs matching the specified filter
325
+ * @example
326
+ * ```javascript
327
+ * provider.getLogs({
328
+ * address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
329
+ * topics: [
330
+ * "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
331
+ * "0x00000000000000000000000021b8065d10f73ee2e260e5b47d3344d3ced7596e",
332
+ * ],
333
+ * fromBlock: 14825027,
334
+ * toBlock: 14825039,
335
+ * });
336
+ *
337
+ * [
338
+ * {
339
+ * address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
340
+ * blockHash: '0x8e0dfac2f704851960f866c8708b3bef2f66c0fee0329cf25ff0261b264ca6bc',
341
+ * blockNumber: 14825029,
342
+ * data: '0x000000000000000000000000000000000000000000000000005f862ee352a38a',
343
+ * logIndex: 384,
344
+ * removed: false,
345
+ * topics: [
346
+ * '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
347
+ * '0x00000000000000000000000021b8065d10f73ee2e260e5b47d3344d3ced7596e',
348
+ * '0x00000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc45'
349
+ * ],
350
+ * transactionHash: '0xbd49031be16f8fd1775f4e0fe79b408ffd8ae9c65b2827ee47e3238e3f51f4c0',
351
+ * transactionIndex: 226
352
+ * }
353
+ * ]
354
+ * ```
355
+ */
356
+ getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
357
+ /**
358
+ * Returns the result of adding a transaction to the blockchain without actually adding that transaction to the blockchain.
359
+ * Does not require any ether as gas.
360
+ *
361
+ * * [Identical](/docs/api#isd) to [`ethers.provider.call`](https://docs.ethers.io/v5/api/providers/provider/#Provider-call) in ethers.js
362
+ * * [Identical](/docs/api#isd) to [`web3.eth.call`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#call) in web3.js
363
+ *
364
+ * @param transaction the transaction object to, in theory, execute. Doesn't actually get added to the blockchain.
365
+ * @param blockTag the block to execute this transaction on
366
+ * @returns the result of executing the transaction on the specified block
367
+ * @example
368
+ * ```javascript
369
+ * await provider.call({ to: "0x6b175474e89094c44da98b954eedeac495271d0f", data: "0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE" });
370
+ * // '0x0000000000000000000000000000000000000000000000000858898f93629000'
371
+ * ```
372
+ */
373
+ call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>;
374
+ }
@@ -1,11 +1,24 @@
1
- import { BaseProvider } from './BaseProvider';
2
- export interface ConstructorOptions {
3
- timeoutDuration?: number;
4
- }
5
- export declare class FallthroughProvider extends BaseProvider {
6
- private rpcUrlCounter;
7
- private readonly timeoutDuration;
8
- selectRpcUrl(): string;
9
- constructor(rpcUrls: string[], options?: ConstructorOptions);
10
- post: (body: Record<string, unknown>) => Promise<any>;
11
- }
1
+ import { BaseProvider } from './BaseProvider';
2
+ export interface ConstructorOptions {
3
+ timeoutDuration?: number;
4
+ }
5
+ /**
6
+ * @beta
7
+ * A JSON RPC Provider which moves to the next URL when one fails.
8
+ */
9
+ export declare class FallthroughProvider extends BaseProvider {
10
+ /**
11
+ * @ignore
12
+ */
13
+ private rpcUrlCounter;
14
+ private readonly timeoutDuration;
15
+ /**
16
+ * @ignore
17
+ */
18
+ selectRpcUrl(): string;
19
+ constructor(rpcUrls: string[], options?: ConstructorOptions);
20
+ /**
21
+ * @ignore
22
+ */
23
+ post: (body: Record<string, unknown>) => Promise<any>;
24
+ }
@@ -1,7 +1,33 @@
1
- import { BaseProvider } from './BaseProvider';
2
- export declare class JsonRpcProvider extends BaseProvider {
3
- selectRpcUrl(): string;
4
- post(body: Record<string, unknown>): Promise<any>;
5
- constructor(rpcUrl?: string);
6
- }
7
- export declare function jsonRpcProvider(rpcUrl?: string): JsonRpcProvider;
1
+ import { BaseProvider } from './BaseProvider';
2
+ export declare class JsonRpcProvider extends BaseProvider {
3
+ /**
4
+ * @ignore
5
+ */
6
+ selectRpcUrl(): string;
7
+ /**
8
+ * @ignore
9
+ */
10
+ post(body: Record<string, unknown>): Promise<any>;
11
+ /**
12
+ * @param rpcUrl The URL to your Eth node. Consider POKT or Infura
13
+ * @example
14
+ * `https://free-eth-node.com/api/eth`
15
+ * @example
16
+ * `https://mainnet.infura.io/v3/YOUR-PROJECT-ID`
17
+ */
18
+ constructor(rpcUrl?: string);
19
+ }
20
+ /**
21
+ * Helper function to avoid "new"
22
+ *
23
+ * @param rpcUrl the RPC URL to post requests to
24
+ * @returns an initiated {@link JsonRpcProvider}
25
+ * @example
26
+ * ```javascript
27
+ * jsonRpcProvider().getBlock('latest').then(block => {
28
+ * console.log(block.number);
29
+ * })
30
+ * // 14530496
31
+ * ```
32
+ */
33
+ export declare function jsonRpcProvider(rpcUrl?: string): JsonRpcProvider;
@@ -1,14 +1,14 @@
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
+ 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,2 +1,9 @@
1
- /// <reference types="jest" />
2
- export declare const mockOf: <FunctionParameters extends unknown[], FunctionReturnType>(fn: (...args: FunctionParameters) => FunctionReturnType) => jest.Mock<FunctionReturnType, FunctionParameters>;
1
+ /// <reference types="jest" />
2
+ /**
3
+ * Helper function for mocking other functions.
4
+ *
5
+ * @param fn
6
+ * @example mockOf(stripe.checkout.sessions.create).mockResolvedValue(mockSession);
7
+ * @see https://twitter.com/scastiel/status/1631354119192473601?s=20
8
+ */
9
+ export declare const mockOf: <FunctionParameters extends unknown[], FunctionReturnType>(fn: (...args: FunctionParameters) => FunctionReturnType) => jest.Mock<FunctionReturnType, FunctionParameters>;
@@ -1,12 +1,12 @@
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
+ 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,24 +1,24 @@
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
+ 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;