essential-eth 0.5.6 → 0.5.9
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.
- package/lib/cjs/classes/Contract.d.ts +10 -4
- package/lib/cjs/classes/Contract.js +15 -4
- package/lib/cjs/classes/utils/clean-block.d.ts +115 -0
- package/lib/cjs/classes/utils/clean-block.js +122 -9
- package/lib/cjs/classes/utils/clean-log.d.ts +9 -0
- package/lib/cjs/classes/utils/clean-log.js +37 -0
- package/lib/cjs/classes/utils/clean-transaction-receipt.d.ts +9 -0
- package/lib/cjs/classes/utils/clean-transaction-receipt.js +11 -16
- package/lib/cjs/classes/utils/clean-transaction.d.ts +9 -0
- package/lib/cjs/classes/utils/clean-transaction.js +10 -1
- package/lib/cjs/classes/utils/encode-decode-transaction.d.ts +12 -0
- package/lib/cjs/classes/utils/encode-decode-transaction.js +24 -0
- package/lib/cjs/classes/utils/fetchers.d.ts +31 -1
- package/lib/cjs/classes/utils/fetchers.js +30 -0
- package/lib/cjs/classes/utils/hex-to-decimal.d.ts +14 -1
- package/lib/cjs/classes/utils/hex-to-decimal.js +14 -1
- package/lib/cjs/classes/utils/prepare-transaction.d.ts +6 -0
- package/lib/cjs/classes/utils/prepare-transaction.js +45 -0
- package/lib/cjs/index.d.ts +3 -3
- package/lib/cjs/index.js +0 -1
- package/lib/cjs/logger/package-version.d.ts +1 -1
- package/lib/cjs/logger/package-version.js +1 -1
- package/lib/cjs/providers/BaseProvider.d.ts +261 -212
- package/lib/cjs/providers/BaseProvider.js +332 -225
- package/lib/cjs/providers/JsonRpcProvider.d.ts +6 -0
- package/lib/cjs/providers/JsonRpcProvider.js +6 -0
- package/lib/cjs/providers/utils/chains-info.d.ts +11 -0
- package/lib/cjs/providers/utils/chains-info.js +34 -1
- package/lib/cjs/shared/tiny-big/helpers.d.ts +16 -0
- package/lib/cjs/shared/tiny-big/helpers.js +27 -1
- package/lib/cjs/shared/tiny-big/tiny-big.d.ts +30 -4
- package/lib/cjs/shared/tiny-big/tiny-big.js +34 -4
- package/lib/cjs/types/Block.types.d.ts +11 -7
- package/lib/cjs/types/Filter.types.d.ts +16 -0
- package/lib/cjs/{providers/types.js → types/Filter.types.js} +0 -0
- package/lib/cjs/types/Transaction.types.d.ts +33 -6
- package/lib/cjs/utils/bytes.d.ts +150 -33
- package/lib/cjs/utils/bytes.js +179 -32
- package/lib/cjs/utils/compute-address.d.ts +10 -1
- package/lib/cjs/utils/compute-address.js +10 -1
- package/lib/cjs/utils/compute-public-key.d.ts +12 -3
- package/lib/cjs/utils/compute-public-key.js +12 -3
- package/lib/cjs/utils/ether-to-gwei.d.ts +2 -1
- package/lib/cjs/utils/ether-to-gwei.js +2 -1
- package/lib/cjs/utils/ether-to-wei.d.ts +2 -1
- package/lib/cjs/utils/ether-to-wei.js +2 -1
- package/lib/cjs/utils/gwei-to-ether.d.ts +2 -1
- package/lib/cjs/utils/gwei-to-ether.js +2 -1
- package/lib/cjs/utils/hash-message.d.ts +3 -1
- package/lib/cjs/utils/hash-message.js +3 -1
- package/lib/cjs/utils/is-address.d.ts +2 -2
- package/lib/cjs/utils/is-address.js +2 -2
- package/lib/cjs/utils/keccak256.d.ts +15 -1
- package/lib/cjs/utils/keccak256.js +16 -2
- package/lib/cjs/utils/solidity-keccak256.d.ts +17 -7
- package/lib/cjs/utils/solidity-keccak256.js +27 -7
- package/lib/cjs/utils/split-signature.d.ts +1 -3
- package/lib/cjs/utils/split-signature.js +1 -3
- package/lib/cjs/utils/to-checksum-address.d.ts +2 -2
- package/lib/cjs/utils/to-checksum-address.js +2 -2
- package/lib/cjs/utils/to-utf8-bytes.d.ts +14 -0
- package/lib/cjs/utils/to-utf8-bytes.js +14 -0
- package/lib/cjs/utils/wei-to-ether.d.ts +2 -1
- package/lib/cjs/utils/wei-to-ether.js +2 -1
- package/lib/esm/classes/utils/clean-block.js +7 -8
- package/lib/esm/classes/utils/clean-log.d.ts +2 -0
- package/lib/esm/classes/utils/clean-log.js +26 -0
- package/lib/esm/classes/utils/clean-transaction-receipt.js +2 -16
- package/lib/esm/classes/utils/clean-transaction.js +1 -1
- package/lib/esm/classes/utils/fetchers.d.ts +1 -1
- package/lib/esm/classes/utils/prepare-transaction.d.ts +2 -0
- package/lib/esm/classes/utils/prepare-transaction.js +34 -0
- package/lib/esm/index.d.ts +3 -3
- package/lib/esm/index.js +0 -1
- package/lib/esm/logger/package-version.d.ts +1 -1
- package/lib/esm/logger/package-version.js +1 -1
- package/lib/esm/providers/BaseProvider.d.ts +5 -2
- package/lib/esm/providers/BaseProvider.js +56 -13
- package/lib/esm/providers/utils/chains-info.d.ts +11 -0
- package/lib/esm/providers/utils/chains-info.js +34 -1
- package/lib/esm/shared/tiny-big/tiny-big.js +4 -0
- package/lib/esm/types/Block.types.d.ts +11 -7
- package/lib/esm/types/Filter.types.d.ts +12 -0
- package/lib/esm/{providers/types.js → types/Filter.types.js} +0 -0
- package/lib/esm/types/Transaction.types.d.ts +31 -5
- package/lib/esm/utils/keccak256.d.ts +1 -1
- package/lib/esm/utils/keccak256.js +2 -2
- package/package.json +30 -6
- package/readme.md +643 -291
- package/lib/cjs/providers/types.d.ts +0 -7
- package/lib/esm/providers/types.d.ts +0 -7
package/readme.md
CHANGED
|
@@ -76,16 +76,24 @@
|
|
|
76
76
|
- [`toUtf8Bytes`](#toutf8bytes)
|
|
77
77
|
- [`weiToEther`](#weitoether)
|
|
78
78
|
- [`zeroPad`](#zeropad)
|
|
79
|
-
- [
|
|
80
|
-
- [`
|
|
81
|
-
- [`
|
|
79
|
+
- [Providers](#providers)
|
|
80
|
+
- [`call`](#call)
|
|
81
|
+
- [`estimateGas`](#estimategas)
|
|
82
82
|
- [`getBalance`](#getbalance)
|
|
83
|
-
- [`getNetwork`](#getnetwork)
|
|
84
83
|
- [`getBlock`](#getblock)
|
|
84
|
+
- [`getBlockNumber`](#getblocknumber)
|
|
85
|
+
- [`getCode`](#getcode)
|
|
86
|
+
- [`getGasPrice`](#getgasprice)
|
|
87
|
+
- [`getLogs`](#getlogs)
|
|
88
|
+
- [`getNetwork`](#getnetwork)
|
|
85
89
|
- [`getTransaction`](#gettransaction)
|
|
90
|
+
- [`getTransactionCount`](#gettransactioncount)
|
|
91
|
+
- [`getTransactionReceipt`](#gettransactionreceipt)
|
|
86
92
|
- [Contract](#contract)
|
|
87
93
|
- [`contractFunctionName(args)`](#contractfunctionnameargs)
|
|
88
94
|
- [More Info](#more-info)
|
|
95
|
+
- [Identical vs Similar vs Dissimliar {#isd}](#identical-vs-similar-vs-dissimliar-isd)
|
|
96
|
+
- [Miscellaneous](#miscellaneous)
|
|
89
97
|
|
|
90
98
|
</details>
|
|
91
99
|
|
|
@@ -126,22 +134,19 @@ arrayify(value: number | BytesLike | Hexable, options: DataOptions): Uint8Array
|
|
|
126
134
|
|
|
127
135
|
```js
|
|
128
136
|
import { arrayify } from 'essential-eth';
|
|
129
|
-
|
|
130
|
-
// or in a require environment
|
|
131
|
-
const { arrayify } = require('essential-eth');
|
|
132
137
|
```
|
|
133
138
|
|
|
134
|
-
```
|
|
139
|
+
```javascript
|
|
135
140
|
arrayify(1);
|
|
136
141
|
// Uint8Array(1) [ 1 ]
|
|
137
142
|
```
|
|
138
143
|
|
|
139
|
-
```
|
|
144
|
+
```javascript
|
|
140
145
|
arrayify(0x1234);
|
|
141
146
|
// Uint8Array(2) [ 18, 52 ]
|
|
142
147
|
```
|
|
143
148
|
|
|
144
|
-
```
|
|
149
|
+
```javascript
|
|
145
150
|
arrayify('0x1', { hexPad: 'right' });
|
|
146
151
|
// Uint8Array(1) [ 16 ]
|
|
147
152
|
```
|
|
@@ -156,6 +161,29 @@ arrayify('0x1', { hexPad: 'right' });
|
|
|
156
161
|
computeAddress(key: string): string
|
|
157
162
|
```
|
|
158
163
|
|
|
164
|
+
<details>
|
|
165
|
+
<summary>View Example</summary>
|
|
166
|
+
|
|
167
|
+
```js
|
|
168
|
+
import { computeAddress } from 'essential-eth';
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```javascript
|
|
172
|
+
computeAddress(
|
|
173
|
+
'0x0458eb591f407aef12936bd2989ca699cf5061de9c4964dd6eb6005fd8f580c407434447e813969a1be6e9954b002cad84dfc67a69e032b273e4695e7d0db2d952',
|
|
174
|
+
); // public key
|
|
175
|
+
// '0xA2902059a7BF992f1450BACD7357CCAa5cC8336a'
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```javascript
|
|
179
|
+
computeAddress(
|
|
180
|
+
'0x2f2c419acf4a1da8c1ebea75bb3fcfbd3ec2aa3bf0162901ccdc2f38b8f92427',
|
|
181
|
+
); // private key
|
|
182
|
+
// '0xA2902059a7BF992f1450BACD7357CCAa5cC8336a'
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
</details>
|
|
186
|
+
|
|
159
187
|
<br/>
|
|
160
188
|
|
|
161
189
|
#### [`computePublicKey`](https://essential-eth.vercel.app/docs/api/modules#computepublickey)
|
|
@@ -164,6 +192,30 @@ computeAddress(key: string): string
|
|
|
164
192
|
computePublicKey(privKey: BytesLike): string
|
|
165
193
|
```
|
|
166
194
|
|
|
195
|
+
<details>
|
|
196
|
+
<summary>View Example</summary>
|
|
197
|
+
|
|
198
|
+
```js
|
|
199
|
+
import { computePublicKey } from 'essential-eth';
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
```javascript
|
|
203
|
+
computePublicKey(
|
|
204
|
+
'0xb27cc8dea0177d910110e8d3ec5480d56c723abf433529f4063f261ffdb9297c',
|
|
205
|
+
);
|
|
206
|
+
// '0x045cd0032015eecfde49f82f4e149d804e8ac6e3a0bface32e37c72a71ceac864fe84da7e8df84342f7b11dfb753c4d158f636142b46b29cf7f0f171ae0aa4fb87'
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
```javascript
|
|
210
|
+
computePublicKey([
|
|
211
|
+
50, 102, 50, 99, 52, 49, 57, 97, 99, 102, 52, 97, 49, 100, 97, 56, 99, 49,
|
|
212
|
+
101, 98, 101, 97, 55, 53, 98, 98, 51, 102, 99, 102, 98, 100,
|
|
213
|
+
]);
|
|
214
|
+
// '0x04a9cea77eca949df84f661cee153426fb51f2294b9364b4fac240df57360b9b0ac9c99e4d7966491ab4c81f8c82e0cd24ec5759832ad4ab736d22c7d90b806ee8'
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
</details>
|
|
218
|
+
|
|
167
219
|
<br/>
|
|
168
220
|
|
|
169
221
|
#### [`concat`](https://essential-eth.vercel.app/docs/api/modules#concat)
|
|
@@ -177,12 +229,9 @@ concat(arrayOfBytesLike: Array<BytesLikeWithNumber>): Uint8Array
|
|
|
177
229
|
|
|
178
230
|
```js
|
|
179
231
|
import { concat } from 'essential-eth';
|
|
180
|
-
|
|
181
|
-
// or in a require environment
|
|
182
|
-
const { concat } = require('essential-eth');
|
|
183
232
|
```
|
|
184
233
|
|
|
185
|
-
```
|
|
234
|
+
```javascript
|
|
186
235
|
concat([0, 1]);
|
|
187
236
|
// Uint8Array(2) [ 0, 1 ]
|
|
188
237
|
```
|
|
@@ -202,9 +251,6 @@ etherToGwei(etherQuantity: string | number | TinyBig | Big): TinyBig
|
|
|
202
251
|
|
|
203
252
|
```js
|
|
204
253
|
import { etherToGwei } from 'essential-eth';
|
|
205
|
-
|
|
206
|
-
// or in a require environment
|
|
207
|
-
const { etherToGwei } = require('essential-eth');
|
|
208
254
|
```
|
|
209
255
|
|
|
210
256
|
```javascript
|
|
@@ -236,9 +282,6 @@ etherToWei(etherQuantity: string | number | TinyBig | Big): TinyBig
|
|
|
236
282
|
|
|
237
283
|
```js
|
|
238
284
|
import { etherToWei } from 'essential-eth';
|
|
239
|
-
|
|
240
|
-
// or in a require environment
|
|
241
|
-
const { etherToWei } = require('essential-eth');
|
|
242
285
|
```
|
|
243
286
|
|
|
244
287
|
```javascript
|
|
@@ -270,9 +313,6 @@ gweiToEther(gweiQuantity: string | number | TinyBig | Big): TinyBig
|
|
|
270
313
|
|
|
271
314
|
```js
|
|
272
315
|
import { gweiToEther } from 'essential-eth';
|
|
273
|
-
|
|
274
|
-
// or in a require environment
|
|
275
|
-
const { gweiToEther } = require('essential-eth');
|
|
276
316
|
```
|
|
277
317
|
|
|
278
318
|
```javascript
|
|
@@ -304,12 +344,9 @@ hashMessage(message: string | Bytes): string
|
|
|
304
344
|
|
|
305
345
|
```js
|
|
306
346
|
import { hashMessage } from 'essential-eth';
|
|
307
|
-
|
|
308
|
-
// or in a require environment
|
|
309
|
-
const { hashMessage } = require('essential-eth');
|
|
310
347
|
```
|
|
311
348
|
|
|
312
|
-
```
|
|
349
|
+
```javascript
|
|
313
350
|
hashMessage('Hello World');
|
|
314
351
|
// '0xa1de988600a42c4b4ab089b619297c17d53cffae5d5120d82d8a92d0bb3b78f2'
|
|
315
352
|
```
|
|
@@ -324,14 +361,47 @@ hashMessage('Hello World');
|
|
|
324
361
|
hexConcat(items: Array<BytesLike>): string
|
|
325
362
|
```
|
|
326
363
|
|
|
364
|
+
<details>
|
|
365
|
+
<summary>View Example</summary>
|
|
366
|
+
|
|
367
|
+
```js
|
|
368
|
+
import { hexConcat } from 'essential-eth';
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
```javascript
|
|
372
|
+
hexConcat([[2, 4, 0, 1], 9, '0x2934', '0x3947']);
|
|
373
|
+
// '0x020400010929343947'
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
</details>
|
|
377
|
+
|
|
327
378
|
<br/>
|
|
328
379
|
|
|
329
380
|
#### [`hexDataLength`](https://essential-eth.vercel.app/docs/api/modules#hexdatalength)
|
|
330
381
|
|
|
331
382
|
```typescript
|
|
332
|
-
hexDataLength(data: BytesLike):
|
|
383
|
+
hexDataLength(data: BytesLike): undefined
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
<details>
|
|
387
|
+
<summary>View Example</summary>
|
|
388
|
+
|
|
389
|
+
```js
|
|
390
|
+
import { hexDataLength } from 'essential-eth';
|
|
333
391
|
```
|
|
334
392
|
|
|
393
|
+
```javascript
|
|
394
|
+
hexDataLength([2, 4, 0, 1]);
|
|
395
|
+
// 4
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
```javascript
|
|
399
|
+
hexDataLength('0x3925');
|
|
400
|
+
// 2
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
</details>
|
|
404
|
+
|
|
335
405
|
<br/>
|
|
336
406
|
|
|
337
407
|
#### [`hexDataSlice`](https://essential-eth.vercel.app/docs/api/modules#hexdataslice)
|
|
@@ -340,6 +410,20 @@ hexDataLength(data: BytesLike): null | number
|
|
|
340
410
|
hexDataSlice(data: BytesLikeWithNumber, offset: number, endOffset: number): string
|
|
341
411
|
```
|
|
342
412
|
|
|
413
|
+
<details>
|
|
414
|
+
<summary>View Example</summary>
|
|
415
|
+
|
|
416
|
+
```js
|
|
417
|
+
import { hexDataSlice } from 'essential-eth';
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
```javascript
|
|
421
|
+
hexDataSlice([20, 6, 48], 0, 2);
|
|
422
|
+
// '0x1406'
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
</details>
|
|
426
|
+
|
|
343
427
|
<br/>
|
|
344
428
|
|
|
345
429
|
#### [`hexStripZeros`](https://essential-eth.vercel.app/docs/api/modules#hexstripzeros)
|
|
@@ -348,6 +432,20 @@ hexDataSlice(data: BytesLikeWithNumber, offset: number, endOffset: number): stri
|
|
|
348
432
|
hexStripZeros(value: BytesLike): string
|
|
349
433
|
```
|
|
350
434
|
|
|
435
|
+
<details>
|
|
436
|
+
<summary>View Example</summary>
|
|
437
|
+
|
|
438
|
+
```js
|
|
439
|
+
import { hexStripZeros } from 'essential-eth';
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
```javascript
|
|
443
|
+
hexStripZeros([0, 0, 0, 48]);
|
|
444
|
+
// '0x30'
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
</details>
|
|
448
|
+
|
|
351
449
|
<br/>
|
|
352
450
|
|
|
353
451
|
#### [`hexValue`](https://essential-eth.vercel.app/docs/api/modules#hexvalue)
|
|
@@ -356,6 +454,25 @@ hexStripZeros(value: BytesLike): string
|
|
|
356
454
|
hexValue(value: number | bigint | BytesLike | Hexable): string
|
|
357
455
|
```
|
|
358
456
|
|
|
457
|
+
<details>
|
|
458
|
+
<summary>View Example</summary>
|
|
459
|
+
|
|
460
|
+
```js
|
|
461
|
+
import { hexValue } from 'essential-eth';
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
```javascript
|
|
465
|
+
hexValue(39);
|
|
466
|
+
// '0x27'
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
```javascript
|
|
470
|
+
hexValue([9, 4, 19, 4]);
|
|
471
|
+
// '0x9041304'
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
</details>
|
|
475
|
+
|
|
359
476
|
<br/>
|
|
360
477
|
|
|
361
478
|
#### [`hexZeroPad`](https://essential-eth.vercel.app/docs/api/modules#hexzeropad)
|
|
@@ -369,9 +486,6 @@ hexZeroPad(value: BytesLikeWithNumber, length: number): string
|
|
|
369
486
|
|
|
370
487
|
```js
|
|
371
488
|
import { hexZeroPad } from 'essential-eth';
|
|
372
|
-
|
|
373
|
-
// or in a require environment
|
|
374
|
-
const { hexZeroPad } = require('essential-eth');
|
|
375
489
|
```
|
|
376
490
|
|
|
377
491
|
```javascript
|
|
@@ -404,15 +518,14 @@ hexlify(value: number | bigint | BytesLike | Hexable, options: DataOptions): str
|
|
|
404
518
|
|
|
405
519
|
```js
|
|
406
520
|
import { hexlify } from 'essential-eth';
|
|
407
|
-
|
|
408
|
-
// or in a require environment
|
|
409
|
-
const { hexlify } = require('essential-eth');
|
|
410
521
|
```
|
|
411
522
|
|
|
412
|
-
```
|
|
523
|
+
```javascript
|
|
413
524
|
hexlify(4);
|
|
414
525
|
// '0x04'
|
|
526
|
+
```
|
|
415
527
|
|
|
528
|
+
```javascript
|
|
416
529
|
hexlify(14);
|
|
417
530
|
// '0x0e'
|
|
418
531
|
```
|
|
@@ -432,9 +545,6 @@ isAddress(address: string): boolean
|
|
|
432
545
|
|
|
433
546
|
```js
|
|
434
547
|
import { isAddress } from 'essential-eth';
|
|
435
|
-
|
|
436
|
-
// or in a require environment
|
|
437
|
-
const { isAddress } = require('essential-eth');
|
|
438
548
|
```
|
|
439
549
|
|
|
440
550
|
```javascript
|
|
@@ -468,22 +578,19 @@ isBytes(value: any): value
|
|
|
468
578
|
|
|
469
579
|
```js
|
|
470
580
|
import { isBytes } from 'essential-eth';
|
|
471
|
-
|
|
472
|
-
// or in a require environment
|
|
473
|
-
const { isBytes } = require('essential-eth');
|
|
474
581
|
```
|
|
475
582
|
|
|
476
|
-
```
|
|
583
|
+
```javascript
|
|
477
584
|
isBytes([1, 2, 3]);
|
|
478
585
|
// true
|
|
479
586
|
```
|
|
480
587
|
|
|
481
|
-
```
|
|
588
|
+
```javascript
|
|
482
589
|
isBytes(false);
|
|
483
590
|
// false
|
|
484
591
|
```
|
|
485
592
|
|
|
486
|
-
```
|
|
593
|
+
```javascript
|
|
487
594
|
isBytes(new Uint8Array(1));
|
|
488
595
|
// true
|
|
489
596
|
```
|
|
@@ -503,22 +610,19 @@ isBytesLike(value: any): value
|
|
|
503
610
|
|
|
504
611
|
```js
|
|
505
612
|
import { isBytesLike } from 'essential-eth';
|
|
506
|
-
|
|
507
|
-
// or in a require environment
|
|
508
|
-
const { isBytesLike } = require('essential-eth');
|
|
509
613
|
```
|
|
510
614
|
|
|
511
|
-
```
|
|
615
|
+
```javascript
|
|
512
616
|
isBytesLike([1, 2, 3]);
|
|
513
617
|
// true
|
|
514
618
|
```
|
|
515
619
|
|
|
516
|
-
```
|
|
620
|
+
```javascript
|
|
517
621
|
isBytesLike(false);
|
|
518
622
|
// false
|
|
519
623
|
```
|
|
520
624
|
|
|
521
|
-
```
|
|
625
|
+
```javascript
|
|
522
626
|
isBytesLike(new Uint8Array(1));
|
|
523
627
|
// true
|
|
524
628
|
```
|
|
@@ -533,6 +637,26 @@ isBytesLike(new Uint8Array(1));
|
|
|
533
637
|
isHexString(value: any, length: number): boolean
|
|
534
638
|
```
|
|
535
639
|
|
|
640
|
+
<details>
|
|
641
|
+
<summary>View Example</summary>
|
|
642
|
+
|
|
643
|
+
```js
|
|
644
|
+
import { isHexString } from 'essential-eth';
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
```javascript
|
|
648
|
+
isHexString('0x4924');
|
|
649
|
+
// true
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
```javascript
|
|
653
|
+
isHexString('0x4924', 4);
|
|
654
|
+
// false
|
|
655
|
+
// length of 4 in bytes would mean a hex string with 8 characters
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
</details>
|
|
659
|
+
|
|
536
660
|
<br/>
|
|
537
661
|
|
|
538
662
|
#### [`jsonRpcProvider`](https://essential-eth.vercel.app/docs/api/modules#jsonrpcprovider)
|
|
@@ -546,9 +670,6 @@ jsonRpcProvider(rpcUrl: string): JsonRpcProvider
|
|
|
546
670
|
|
|
547
671
|
```js
|
|
548
672
|
import { jsonRpcProvider } from 'essential-eth';
|
|
549
|
-
|
|
550
|
-
// or in a require environment
|
|
551
|
-
const { jsonRpcProvider } = require('essential-eth');
|
|
552
673
|
```
|
|
553
674
|
|
|
554
675
|
```javascript
|
|
@@ -570,6 +691,23 @@ jsonRpcProvider()
|
|
|
570
691
|
keccak256(data: BytesLike): string
|
|
571
692
|
```
|
|
572
693
|
|
|
694
|
+
<details>
|
|
695
|
+
<summary>View Example</summary>
|
|
696
|
+
|
|
697
|
+
```js
|
|
698
|
+
import { keccak256 } from 'essential-eth';
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
```javascript
|
|
702
|
+
keccak256('essential-eth');
|
|
703
|
+
// '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
|
|
704
|
+
|
|
705
|
+
keccak256('0x123');
|
|
706
|
+
// '0x5fa2358263196dbbf23d1ca7a509451f7a2f64c15837bfbb81298b1e3e24e4fa'
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
</details>
|
|
710
|
+
|
|
573
711
|
<br/>
|
|
574
712
|
|
|
575
713
|
#### [`pack`](https://essential-eth.vercel.app/docs/api/modules#pack)
|
|
@@ -578,6 +716,22 @@ keccak256(data: BytesLike): string
|
|
|
578
716
|
pack(types: Array<string>, values: Array<any>): string
|
|
579
717
|
```
|
|
580
718
|
|
|
719
|
+
<details>
|
|
720
|
+
<summary>View Example</summary>
|
|
721
|
+
|
|
722
|
+
```js
|
|
723
|
+
import { pack } from 'essential-eth';
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
```javascript
|
|
727
|
+
const types = ['bool', 'string', 'uint64'];
|
|
728
|
+
const values = [true, 'text', 30];
|
|
729
|
+
pack(types, values);
|
|
730
|
+
// '0x0174657874000000000000001e'
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
</details>
|
|
734
|
+
|
|
581
735
|
<br/>
|
|
582
736
|
|
|
583
737
|
#### [`solidityKeccak256`](https://essential-eth.vercel.app/docs/api/modules#soliditykeccak256)
|
|
@@ -591,9 +745,6 @@ solidityKeccak256(types: Array<string>, values: Array<any>): string
|
|
|
591
745
|
|
|
592
746
|
```js
|
|
593
747
|
import { solidityKeccak256 } from 'essential-eth';
|
|
594
|
-
|
|
595
|
-
// or in a require environment
|
|
596
|
-
const { solidityKeccak256 } = require('essential-eth');
|
|
597
748
|
```
|
|
598
749
|
|
|
599
750
|
```javascript
|
|
@@ -628,9 +779,6 @@ splitSignature(signature: SignatureLike): Signature
|
|
|
628
779
|
|
|
629
780
|
```js
|
|
630
781
|
import { splitSignature } from 'essential-eth';
|
|
631
|
-
|
|
632
|
-
// or in a require environment
|
|
633
|
-
const { splitSignature } = require('essential-eth');
|
|
634
782
|
```
|
|
635
783
|
|
|
636
784
|
```javascript
|
|
@@ -657,6 +805,21 @@ splitSignature(signature);
|
|
|
657
805
|
stripZeros(value: BytesLike): Uint8Array
|
|
658
806
|
```
|
|
659
807
|
|
|
808
|
+
<details>
|
|
809
|
+
<summary>View Example</summary>
|
|
810
|
+
|
|
811
|
+
```js
|
|
812
|
+
import { stripZeros } from 'essential-eth';
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
```javascript
|
|
816
|
+
stripZeros('0x00002834');
|
|
817
|
+
// Uint8Array { [Iterator] 0: 40, 1: 52 }
|
|
818
|
+
// Equivalent to '0x2834'
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
</details>
|
|
822
|
+
|
|
660
823
|
<br/>
|
|
661
824
|
|
|
662
825
|
#### [`tinyBig`](https://essential-eth.vercel.app/docs/api/modules#tinybig)
|
|
@@ -670,9 +833,6 @@ tinyBig(value: string | number | TinyBig | Big): TinyBig
|
|
|
670
833
|
|
|
671
834
|
```js
|
|
672
835
|
import { tinyBig } from 'essential-eth';
|
|
673
|
-
|
|
674
|
-
// or in a require environment
|
|
675
|
-
const { tinyBig } = require('essential-eth');
|
|
676
836
|
```
|
|
677
837
|
|
|
678
838
|
```javascript
|
|
@@ -695,9 +855,6 @@ toChecksumAddress(address: string): string
|
|
|
695
855
|
|
|
696
856
|
```js
|
|
697
857
|
import { toChecksumAddress } from 'essential-eth';
|
|
698
|
-
|
|
699
|
-
// or in a require environment
|
|
700
|
-
const { toChecksumAddress } = require('essential-eth');
|
|
701
858
|
```
|
|
702
859
|
|
|
703
860
|
```javascript
|
|
@@ -719,6 +876,23 @@ Similar to ["toChecksumAddress" in web3.js](https://web3js.readthedocs.io/en/v1.
|
|
|
719
876
|
toUtf8Bytes(data: string): Uint8Array
|
|
720
877
|
```
|
|
721
878
|
|
|
879
|
+
<details>
|
|
880
|
+
<summary>View Example</summary>
|
|
881
|
+
|
|
882
|
+
```js
|
|
883
|
+
import { toUtf8Bytes } from 'essential-eth';
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
```javascript
|
|
887
|
+
toUtf8Bytes('essential-eth');
|
|
888
|
+
// 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 }
|
|
889
|
+
|
|
890
|
+
toUtf8Bytes('ethereum');
|
|
891
|
+
// Uint8Array { [Iterator] 0: 101, 1: 116, 2: 104, 3: 101, 4: 114, 5: 101, 6: 117, 7: 109 }
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
</details>
|
|
895
|
+
|
|
722
896
|
<br/>
|
|
723
897
|
|
|
724
898
|
#### [`weiToEther`](https://essential-eth.vercel.app/docs/api/modules#weitoether)
|
|
@@ -732,9 +906,6 @@ weiToEther(weiQuantity: string | number | TinyBig | Big): TinyBig
|
|
|
732
906
|
|
|
733
907
|
```js
|
|
734
908
|
import { weiToEther } from 'essential-eth';
|
|
735
|
-
|
|
736
|
-
// or in a require environment
|
|
737
|
-
const { weiToEther } = require('essential-eth');
|
|
738
909
|
```
|
|
739
910
|
|
|
740
911
|
```javascript
|
|
@@ -761,6 +932,26 @@ weiToEther(1000000000000000000000).toNumber();
|
|
|
761
932
|
zeroPad(value: BytesLike, length: number): Uint8Array
|
|
762
933
|
```
|
|
763
934
|
|
|
935
|
+
<details>
|
|
936
|
+
<summary>View Example</summary>
|
|
937
|
+
|
|
938
|
+
```js
|
|
939
|
+
import { zeroPad } from 'essential-eth';
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
```javascript
|
|
943
|
+
zeroPad('0x039284');
|
|
944
|
+
// Uint8Array { [Iterator] 0: 0, 1: 0, 2: 0, 3: 3, 4: 146, 5: 132 }
|
|
945
|
+
// Equivalent to 0x000000039284
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
```javascript
|
|
949
|
+
zeroPad([39, 25, 103, 45], 5);
|
|
950
|
+
// Uint8Array { [Iterator] 0: 0, 1: 39, 2: 25, 3: 103, 4: 45 }
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
</details>
|
|
954
|
+
|
|
764
955
|
<br/>
|
|
765
956
|
|
|
766
957
|
<!-- ⛔️ AUTO-GENERATED-CONTENT:END -->
|
|
@@ -770,15 +961,13 @@ zeroPad(value: BytesLike, length: number): Uint8Array
|
|
|
770
961
|
<br/>
|
|
771
962
|
<br/>
|
|
772
963
|
|
|
773
|
-
##
|
|
964
|
+
## Providers
|
|
774
965
|
|
|
775
966
|
```typescript
|
|
776
967
|
import { JsonRpcProvider } from 'essential-eth';
|
|
777
|
-
const
|
|
778
|
-
'RPC URL HERE' /* Try POKT or Infura */,
|
|
779
|
-
);
|
|
968
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try POKT or Infura */);
|
|
780
969
|
// OR for very quick testing (limited to 10,000 requests)
|
|
781
|
-
const
|
|
970
|
+
const provider = new JsonRpcProvider();
|
|
782
971
|
```
|
|
783
972
|
|
|
784
973
|
<details>
|
|
@@ -804,294 +993,445 @@ provider.getGasPrice().toNumber();
|
|
|
804
993
|
|
|
805
994
|
<br/>
|
|
806
995
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
#### `getGasPrice`
|
|
996
|
+
<!-- ⛔️ AUTO-GENERATED-CONTENT:START (PROVIDER) -->
|
|
810
997
|
|
|
811
|
-
|
|
998
|
+
#### [`call`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#call)
|
|
812
999
|
|
|
813
1000
|
```typescript
|
|
814
|
-
|
|
815
|
-
getGasPrice(): Promise<TinyBig>
|
|
1001
|
+
provider.call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>
|
|
816
1002
|
```
|
|
817
1003
|
|
|
818
|
-
<details>
|
|
1004
|
+
<details>
|
|
819
1005
|
<summary>View Example</summary>
|
|
820
1006
|
|
|
821
|
-
```
|
|
1007
|
+
```js
|
|
822
1008
|
import { JsonRpcProvider } from 'essential-eth';
|
|
823
|
-
|
|
824
|
-
const provider = new JsonRpcProvider('https://free-eth-node.com/api/eth');
|
|
825
|
-
provider.getGasPrice().toNumber();
|
|
826
|
-
/*
|
|
827
|
-
39695942769
|
|
828
|
-
*/
|
|
1009
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
829
1010
|
```
|
|
830
1011
|
|
|
831
|
-
|
|
1012
|
+
```javascript
|
|
1013
|
+
await provider.call({
|
|
1014
|
+
to: '0x6b175474e89094c44da98b954eedeac495271d0f',
|
|
1015
|
+
data: '0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE',
|
|
1016
|
+
});
|
|
1017
|
+
// '0x0000000000000000000000000000000000000000000000000858898f93629000'
|
|
1018
|
+
```
|
|
832
1019
|
|
|
833
|
-
|
|
1020
|
+
</details>
|
|
834
1021
|
|
|
835
|
-
|
|
1022
|
+
<br/>
|
|
836
1023
|
|
|
837
|
-
|
|
1024
|
+
#### [`estimateGas`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#estimategas)
|
|
838
1025
|
|
|
839
1026
|
```typescript
|
|
840
|
-
|
|
841
|
-
// Same API as web3.eth.getBalance
|
|
842
|
-
getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>
|
|
1027
|
+
provider.estimateGas(transaction: TransactionRequest): Promise<TinyBig>
|
|
843
1028
|
```
|
|
844
1029
|
|
|
845
|
-
<details>
|
|
1030
|
+
<details>
|
|
846
1031
|
<summary>View Example</summary>
|
|
847
1032
|
|
|
1033
|
+
```js
|
|
1034
|
+
import { JsonRpcProvider } from 'essential-eth';
|
|
1035
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1036
|
+
```
|
|
1037
|
+
|
|
1038
|
+
```javascript
|
|
1039
|
+
await provider.estimateGas({
|
|
1040
|
+
// Wrapped ETH address
|
|
1041
|
+
to: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
1042
|
+
data: '0xd0e30db0',
|
|
1043
|
+
value: etherToWei('1.0').toHexString(),
|
|
1044
|
+
});
|
|
1045
|
+
// { TinyBig: "27938" }
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
</details>
|
|
1049
|
+
|
|
1050
|
+
<br/>
|
|
1051
|
+
|
|
1052
|
+
#### [`getBalance`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#getbalance)
|
|
1053
|
+
|
|
848
1054
|
```typescript
|
|
1055
|
+
provider.getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
<details>
|
|
1059
|
+
<summary>View Example</summary>
|
|
1060
|
+
|
|
1061
|
+
```js
|
|
849
1062
|
import { JsonRpcProvider } from 'essential-eth';
|
|
1063
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1064
|
+
```
|
|
850
1065
|
|
|
851
|
-
|
|
852
|
-
await provider
|
|
853
|
-
|
|
854
|
-
.then((balance) => console.log(balance.toString()));
|
|
855
|
-
// "28798127851528138"
|
|
1066
|
+
```javascript
|
|
1067
|
+
await provider.getBalance('0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8');
|
|
1068
|
+
// 28798127851528138
|
|
856
1069
|
```
|
|
857
1070
|
|
|
858
|
-
</details>
|
|
1071
|
+
</details>
|
|
859
1072
|
|
|
860
|
-
<br/>
|
|
1073
|
+
<br/>
|
|
861
1074
|
|
|
862
|
-
#### `
|
|
1075
|
+
#### [`getBlock`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#getblock)
|
|
863
1076
|
|
|
864
|
-
|
|
1077
|
+
```typescript
|
|
1078
|
+
provider.getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>
|
|
1079
|
+
```
|
|
1080
|
+
|
|
1081
|
+
<details>
|
|
1082
|
+
<summary>View Example</summary>
|
|
1083
|
+
|
|
1084
|
+
```js
|
|
1085
|
+
import { JsonRpcProvider } from 'essential-eth';
|
|
1086
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1087
|
+
```
|
|
1088
|
+
|
|
1089
|
+
```javascript
|
|
1090
|
+
await provider.getBlock(14879862);
|
|
1091
|
+
// {
|
|
1092
|
+
// baseFeePerGas: { TinyBig: 39095728776 },
|
|
1093
|
+
// difficulty: { TinyBig: 14321294455359973 },
|
|
1094
|
+
// extraData: "0x486976656f6e2073672d6865617679",
|
|
1095
|
+
// gasLimit: { TinyBig: 29970620 },
|
|
1096
|
+
// gasUsed: { TinyBig: 20951384 },
|
|
1097
|
+
// hash: "0x563b458ec3c4f87393b53f70bdddc0058497109b784d8cacd9247ddf267049ab",
|
|
1098
|
+
// logsBloom:
|
|
1099
|
+
// "0x9f38794fe80b521794df6efad8b0d2e9582f9ec3959a3f9384bda0fa371cfa5fac5af9d515c6bdf1ec325f5b5f7ebdd6a3a9fae17b38a86d4dc4b0971afc68d8086640550f4c156e6f923f4a1bb94fb0bed6cdcc474c5c64bfeff7a4a906f72b9a7b94004ee58efc53d63ac66961acd3a431b2d896cc9fd75f6072960bced45f770587caf130f57504decfcb63c6ca8fbc5bdbd749edd5a99a7375d2b81872289adb775fb3c928259f4be39c6d3f4d5b6217822979bb88c1f1fb62429b1b6d41cf4e3f77f9e1db3f5723108f1e5b1255dd734ad8cdb11e7ea22487c788e67c83777b6f395e504ca59c64f52245ee6de3804cf809e5caa4f0ea6a9aa9eb6ed801",
|
|
1100
|
+
// miner: "0x1aD91ee08f21bE3dE0BA2ba6918E714dA6B45836",
|
|
1101
|
+
// mixHash: "0x73cc9419bfb89c9d41c3a8c34ce56b5ebe468bdcf870258d2e77262275d580ec",
|
|
1102
|
+
// nonce: "0x976f3f5d596ffb08",
|
|
1103
|
+
// number: 14879862,
|
|
1104
|
+
// parentHash: "0x95986ae14a71face8d9a6a379edd875b2e8bc73e4de0d9d460e7752bddb0f579",
|
|
1105
|
+
// receiptsRoot: "0x8e6ba2fd9bee602b653dae6e3132f16538c2c5df24f1df8c000392053f73defa",
|
|
1106
|
+
// sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
|
1107
|
+
// size: { TinyBig: 134483 },
|
|
1108
|
+
// stateRoot: "0xbf2bb67bd1c741f3d00904b8451d7c2cf4e3a2726f5a5884792ede2074747b85",
|
|
1109
|
+
// timestamp: { TinyBig: 1654016186 },
|
|
1110
|
+
// totalDifficulty: { TinyBig: 50478104614257705213748 },
|
|
1111
|
+
// transactions: [
|
|
1112
|
+
// "0xb3326a9149809603a2c28545e50e4f7d16e194bf5ee9764e0544603854c4a8d2",
|
|
1113
|
+
// "0x8b42095f8d335404a4896b2817b8e5e3d86a5a87cb434a8eec295d5280a7f48e",
|
|
1114
|
+
// "0x882f78fcb73f0f7ad0700bb0424a8b4beb366aaa93b88a3562c49a8d0ce4dcff",
|
|
1115
|
+
// ...
|
|
1116
|
+
// ],
|
|
1117
|
+
// transactionsRoot: "0x5934902f3dcc263ec34f24318179bf6301f53f4834685792066026f3a4849d72",
|
|
1118
|
+
// uncles: [],
|
|
1119
|
+
// }
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
</details>
|
|
1123
|
+
|
|
1124
|
+
<br/>
|
|
1125
|
+
|
|
1126
|
+
#### [`getBlockNumber`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#getblocknumber)
|
|
865
1127
|
|
|
866
1128
|
```typescript
|
|
867
|
-
|
|
868
|
-
getNetwork(): Promise<Network>
|
|
1129
|
+
provider.getBlockNumber(): Promise<number>
|
|
869
1130
|
```
|
|
870
1131
|
|
|
871
|
-
<details>
|
|
1132
|
+
<details>
|
|
872
1133
|
<summary>View Example</summary>
|
|
873
1134
|
|
|
1135
|
+
```js
|
|
1136
|
+
import { JsonRpcProvider } from 'essential-eth';
|
|
1137
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
```javascript
|
|
1141
|
+
await provider.getBlockNumber();
|
|
1142
|
+
// 1053312
|
|
1143
|
+
```
|
|
1144
|
+
|
|
1145
|
+
</details>
|
|
1146
|
+
|
|
1147
|
+
<br/>
|
|
1148
|
+
|
|
1149
|
+
#### [`getCode`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#getcode)
|
|
1150
|
+
|
|
874
1151
|
```typescript
|
|
1152
|
+
provider.getCode(address: string, blockTag?: BlockTag): Promise<string>
|
|
1153
|
+
```
|
|
1154
|
+
|
|
1155
|
+
<details>
|
|
1156
|
+
<summary>View Example</summary>
|
|
1157
|
+
|
|
1158
|
+
```js
|
|
875
1159
|
import { JsonRpcProvider } from 'essential-eth';
|
|
1160
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1161
|
+
```
|
|
876
1162
|
|
|
877
|
-
|
|
878
|
-
|
|
1163
|
+
```javascript
|
|
1164
|
+
await jsonRpcProvider().getCode(
|
|
1165
|
+
'0xaC6095720221C79C6E7C638d260A2eFBC5D8d880',
|
|
1166
|
+
'latest',
|
|
879
1167
|
);
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
{ chainId: 137, name: 'MATIC', ensAddress: null }
|
|
883
|
-
*/
|
|
1168
|
+
// '0x608060405234801561001057600080fd5b506004361061...'
|
|
1169
|
+
```
|
|
884
1170
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1171
|
+
</details>
|
|
1172
|
+
|
|
1173
|
+
<br/>
|
|
1174
|
+
|
|
1175
|
+
#### [`getGasPrice`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#getgasprice)
|
|
1176
|
+
|
|
1177
|
+
```typescript
|
|
1178
|
+
provider.getGasPrice(): Promise<TinyBig>
|
|
890
1179
|
```
|
|
891
1180
|
|
|
892
|
-
|
|
1181
|
+
<details>
|
|
1182
|
+
<summary>View Example</summary>
|
|
893
1183
|
|
|
894
|
-
|
|
1184
|
+
```js
|
|
1185
|
+
import { JsonRpcProvider } from 'essential-eth';
|
|
1186
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1187
|
+
```
|
|
1188
|
+
|
|
1189
|
+
```javascript
|
|
1190
|
+
await provider.getGasPrice();
|
|
1191
|
+
// 52493941856
|
|
1192
|
+
```
|
|
1193
|
+
|
|
1194
|
+
</details>
|
|
895
1195
|
|
|
896
|
-
|
|
1196
|
+
<br/>
|
|
897
1197
|
|
|
898
|
-
|
|
1198
|
+
#### [`getLogs`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#getlogs)
|
|
899
1199
|
|
|
900
1200
|
```typescript
|
|
901
|
-
|
|
902
|
-
getBlock(timeFrame: number | "latest" | "earliest" | "pending", returnTransactionObjects?: boolean): Promise<Block>
|
|
1201
|
+
provider.getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>
|
|
903
1202
|
```
|
|
904
1203
|
|
|
905
|
-
<details>
|
|
1204
|
+
<details>
|
|
906
1205
|
<summary>View Example</summary>
|
|
907
1206
|
|
|
1207
|
+
```js
|
|
1208
|
+
import { JsonRpcProvider } from 'essential-eth';
|
|
1209
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1210
|
+
```
|
|
1211
|
+
|
|
1212
|
+
```javascript
|
|
1213
|
+
provider.getLogs({
|
|
1214
|
+
address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1215
|
+
topics: [
|
|
1216
|
+
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
1217
|
+
'0x00000000000000000000000021b8065d10f73ee2e260e5b47d3344d3ced7596e',
|
|
1218
|
+
],
|
|
1219
|
+
fromBlock: 14825027,
|
|
1220
|
+
toBlock: 14825039,
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1223
|
+
[
|
|
1224
|
+
{
|
|
1225
|
+
address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
1226
|
+
blockHash:
|
|
1227
|
+
'0x8e0dfac2f704851960f866c8708b3bef2f66c0fee0329cf25ff0261b264ca6bc',
|
|
1228
|
+
blockNumber: 14825029,
|
|
1229
|
+
data: '0x000000000000000000000000000000000000000000000000005f862ee352a38a',
|
|
1230
|
+
logIndex: 384,
|
|
1231
|
+
removed: false,
|
|
1232
|
+
topics: [
|
|
1233
|
+
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
1234
|
+
'0x00000000000000000000000021b8065d10f73ee2e260e5b47d3344d3ced7596e',
|
|
1235
|
+
'0x00000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc45',
|
|
1236
|
+
],
|
|
1237
|
+
transactionHash:
|
|
1238
|
+
'0xbd49031be16f8fd1775f4e0fe79b408ffd8ae9c65b2827ee47e3238e3f51f4c0',
|
|
1239
|
+
transactionIndex: 226,
|
|
1240
|
+
},
|
|
1241
|
+
];
|
|
1242
|
+
```
|
|
1243
|
+
|
|
1244
|
+
</details>
|
|
1245
|
+
|
|
1246
|
+
<br/>
|
|
1247
|
+
|
|
1248
|
+
#### [`getNetwork`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#getnetwork)
|
|
1249
|
+
|
|
908
1250
|
```typescript
|
|
1251
|
+
provider.getNetwork(): Promise<Network>
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
<details>
|
|
1255
|
+
<summary>View Example</summary>
|
|
1256
|
+
|
|
1257
|
+
```js
|
|
909
1258
|
import { JsonRpcProvider } from 'essential-eth';
|
|
910
|
-
const
|
|
911
|
-
|
|
1259
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1260
|
+
```
|
|
912
1261
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
hash: '0x93211a1cd17e154b183565ec685254a03f844a8e34824a46ce1bdd6753dcb669',
|
|
917
|
-
parentHash: '0x1b32bfcba1bb2a57f56e166a3bb06875a1978992999dfc8828397b4c1526f472',
|
|
918
|
-
sha3Uncles: '0x0fb399c67bb5a071ec8a22549223215ab76b7d4009941c9c37aa3c3936010463',
|
|
919
|
-
logsBloom: '0x00000000000000000000101000000000020000000000000000000000000000000000400000010000000000000000000000000000010000000008800000000800000000200000000000000000000000000000000000000000000002000000000000000000000000000040000000000040000000000000000000000000000000000000000000000001000000000004000000000010000000000000000020000000000000000200100020000000000000000080000000000080001000000000000000000001040000000000000000008000000020010100000000200000100000000000000000000000002000000080000000020400000000002000200000000000',
|
|
920
|
-
transactionsRoot: '0xc43b3f13e1fe810e34d3a26ffe465b72c7063a5c70a02de2c78e91e4d10bd9fb',
|
|
921
|
-
stateRoot: '0x04d7bc816537ea7ef3a16e76c9879d29f34f99d4154273c2e98e012a31bad745',
|
|
922
|
-
receiptsRoot: '0x89c6f781ceac0bd49c4d9aa9115df4a5d4dd0e0220ff7668012f15bc04222c6b',
|
|
923
|
-
miner: '0x31fe561eb2c628cD32Ec52573D7c4b7E4C278Bfa',
|
|
924
|
-
difficulty: '1300907486001755331049',
|
|
925
|
-
totalDifficulty: '5989929395521171616186006183',
|
|
926
|
-
extraData: '0xce018c495249532d62613031656132',
|
|
927
|
-
size: 5416,
|
|
928
|
-
gasLimit: 6800000,
|
|
929
|
-
gasUsed: 202955,
|
|
930
|
-
timestamp: 1649884910,
|
|
931
|
-
transactions: [
|
|
932
|
-
'0x6b34a59c7b9aead24fa6dad782f8a3ad84ed4a23ee09bcbf0bcf880840fbbe20',
|
|
933
|
-
'0x9a3851ca24d5336c6a0d48aba2c4b4769d7a672c9b01729c5eb9924efd1b19a7',
|
|
934
|
-
'0xc3ed3d198b62f2f3427ebfa3bbd0fcada4e3c0c189e4464e7eeceb403c75981e'
|
|
935
|
-
],
|
|
936
|
-
uncles: [
|
|
937
|
-
'0x0c567c054e98153f10d651fbbc018891c1dd9d62a9ffd998e87678803e95b6ed',
|
|
938
|
-
'0xb7d69389dbfb057c6fcb4bc0582d46a2ba01170703f0dadf8cd1462b83e88753',
|
|
939
|
-
'0xd5f74ccd0ad4c58b3161e8c2c507c264231e5f28925061b809c02e5e4bb6db28'
|
|
940
|
-
],
|
|
941
|
-
minimumGasPrice: '0x387ee40',
|
|
942
|
-
bitcoinMergedMiningHeader: '0x04000020e8567ed3d2480e15a1dd1b4335e4732ae343c037e4fd03000000000000000000ed10a8340d163d3e813bdd430f902f4e5a56828dc62313b2e23797c0be6b8516eb3e576297d8091735884f42',
|
|
943
|
-
bitcoinMergedMiningCoinbaseTransaction: '0x0000000000000140e910128fda7bac502dc5e0573bbaf12de8e2524f70c22f7bd160dedcb19a2521002b6a2952534b424c4f434b3ae493303f597fa368c0ccc4f8aceabf1c315bb7c9a07605c073a89f260040967aace6a7d9',
|
|
944
|
-
bitcoinMergedMiningMerkleProof: '0xdf63a3d7eb6fbcfb301311faa46e9a15b0408bb1a04e284daee86c273c1dfd65ede23f3170f806e9e0f4cef7ba6b56aa37470d9c23f96ec8e43d08b58645919c5e10bcb892897a731f8f9ce79c72dc0e390896bcd6c67bb38c0bdb72982b6cf05519968d76673572c3f3ef3a08b0ddb464863f1788f7cdbaad3fe44a8a8af576d430ac282fe28852c16df198ca96cc5f71a50695912efe1a836e8442be69e31b6d6f973da2818bce9a3a1c2d9be0671aee9a7776e398d6a03d1e178e20d84646004a3d03c0501334e629d9146aa6a01316dcbaa289df6e6c5e3090cadaddff22699cfc7ff09512fc0d65c5062f17c98561ce3c9510de210d9d654cf99f8d756ff37c9fa21e7122ee8cadb923341690845d572921425f2bd7e044558b7e07983ac4df28928028b0c13c3624dc7a965af8091b0cecc845bf7da5308c03b2c97d607f6706a599f802025894435f1d76ea4e67cc2fc4e1559f1206f559a24633de0f',
|
|
945
|
-
hashForMergedMining: '0xe493303f597fa368c0ccc4f8aceabf1c315bb7c9a07605c073a89f260040967a',
|
|
946
|
-
paidFees: '0xc0744dcb7a0',
|
|
947
|
-
cumulativeDifficulty: '0x1190930db285269e582'
|
|
948
|
-
}
|
|
949
|
-
*/
|
|
1262
|
+
```javascript
|
|
1263
|
+
jsonRpcProvider('https://free-eth-node.com/api/eth').getNetwork();
|
|
1264
|
+
// { chainId: 1, name: 'eth', ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' }
|
|
950
1265
|
```
|
|
951
1266
|
|
|
952
|
-
|
|
1267
|
+
```javascript
|
|
1268
|
+
jsonRpcProvider('https://free-eth-node.com/api/MATIC').getNetwork();
|
|
1269
|
+
// { chainId: 137, name: 'MATIC', ensAddress: null }
|
|
1270
|
+
```
|
|
953
1271
|
|
|
954
|
-
|
|
1272
|
+
</details>
|
|
955
1273
|
|
|
956
|
-
|
|
1274
|
+
<br/>
|
|
957
1275
|
|
|
958
|
-
|
|
1276
|
+
#### [`getTransaction`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#gettransaction)
|
|
959
1277
|
|
|
960
1278
|
```typescript
|
|
961
|
-
|
|
962
|
-
getTransaction(hash: string): Promise<Transaction>
|
|
1279
|
+
provider.getTransaction(transactionHash: string): Promise<TransactionResponse>
|
|
963
1280
|
```
|
|
964
1281
|
|
|
965
|
-
<details>
|
|
1282
|
+
<details>
|
|
966
1283
|
<summary>View Example</summary>
|
|
967
1284
|
|
|
968
|
-
```
|
|
1285
|
+
```js
|
|
969
1286
|
import { JsonRpcProvider } from 'essential-eth';
|
|
970
|
-
const
|
|
1287
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1288
|
+
```
|
|
1289
|
+
|
|
1290
|
+
```javascript
|
|
971
1291
|
await provider.getTransaction(
|
|
972
1292
|
'0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789',
|
|
973
1293
|
);
|
|
1294
|
+
// {
|
|
1295
|
+
// accessList: [],
|
|
1296
|
+
// blockHash: "0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d",
|
|
1297
|
+
// blockNumber: 14578286,
|
|
1298
|
+
// chainId: 1,
|
|
1299
|
+
// from: "0xdfD9dE5f6FA60BD70636c0900752E93a6144AEd4",
|
|
1300
|
+
// gas: { TinyBig: 112163 },
|
|
1301
|
+
// gasPrice: { TinyBig: 48592426858 },
|
|
1302
|
+
// hash: "0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789",
|
|
1303
|
+
// input: "0x83259f17000000000000000000000000000000000000000000...",
|
|
1304
|
+
// maxFeePerGas: { TinyBig: 67681261618 },
|
|
1305
|
+
// maxPriorityFeePerGas: { TinyBig: 1500000000 },
|
|
1306
|
+
// nonce: { TinyBig: 129 },
|
|
1307
|
+
// r: "0x59a7c15b12c18cd68d6c440963d959bff3e73831ffc938e75ecad07f7ee43fbc",
|
|
1308
|
+
// s: "0x1ebaf05f0d9273b16c2a7748b150a79d22533a8cd74552611cbe620fee3dcf1c",
|
|
1309
|
+
// to: "0x39B72d136ba3e4ceF35F48CD09587ffaB754DD8B",
|
|
1310
|
+
// transactionIndex: 29,
|
|
1311
|
+
// type: 2,
|
|
1312
|
+
// v: 0,
|
|
1313
|
+
// value: { TinyBig: 0 },
|
|
1314
|
+
// confirmations: 298140,
|
|
1315
|
+
// }
|
|
1316
|
+
```
|
|
974
1317
|
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
s: 1,
|
|
984
|
-
e: 5,
|
|
985
|
-
c: [ 1, 1, 2, 1, 6, 3 ],
|
|
986
|
-
constructor: <ref *1> [Function: Big] {
|
|
987
|
-
DP: 20,
|
|
988
|
-
RM: 1,
|
|
989
|
-
NE: -7,
|
|
990
|
-
PE: 21,
|
|
991
|
-
strict: false,
|
|
992
|
-
roundDown: 0,
|
|
993
|
-
roundHalfUp: 1,
|
|
994
|
-
roundHalfEven: 2,
|
|
995
|
-
roundUp: 3,
|
|
996
|
-
Big: [Circular *1],
|
|
997
|
-
default: [Circular *1]
|
|
998
|
-
}
|
|
999
|
-
},
|
|
1000
|
-
gasPrice: Big {
|
|
1001
|
-
s: 1,
|
|
1002
|
-
e: 10,
|
|
1003
|
-
c: [
|
|
1004
|
-
4, 8, 5, 9, 2,
|
|
1005
|
-
4, 2, 6, 8, 5,
|
|
1006
|
-
8
|
|
1007
|
-
],
|
|
1008
|
-
constructor: <ref *1> [Function: Big] {
|
|
1009
|
-
DP: 20,
|
|
1010
|
-
RM: 1,
|
|
1011
|
-
NE: -7,
|
|
1012
|
-
PE: 21,
|
|
1013
|
-
strict: false,
|
|
1014
|
-
roundDown: 0,
|
|
1015
|
-
roundHalfUp: 1,
|
|
1016
|
-
roundHalfEven: 2,
|
|
1017
|
-
roundUp: 3,
|
|
1018
|
-
Big: [Circular *1],
|
|
1019
|
-
default: [Circular *1]
|
|
1020
|
-
}
|
|
1021
|
-
},
|
|
1022
|
-
hash: '0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789',
|
|
1023
|
-
input: '0x83259f170000000000000000000000000000000000000000000000000000000000000080000000000000000000000000dfd9de5f6fa60bd70636c0900752e93a6144aed400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000009e99ad11a214fd016b19dc3648678c5944859ae292b21c24ca94f857836c4596f1950c82dd0c23dd621af4763edc2f66466e63c5df9de0c1107b1cd16bf460fe93e43fd308e3444bc79c3d88a4cb961dc8367ab6ad048867afc76d193bca99cf3a068864ed4a7df1dbf1d4c52238eced3e5e05644b4040fc2b3ccb8557b0e99fff6131305a0ea2b8061b90bd418db5bbdd2e92129f52d93f90531465e309c4caec5b85285822b6196398d36f16f511811b61bbda6461e80e29210cd303118bdcee8df6fa0505ffbe8642094fd2ba4dd458496fe3b459ac880bbf71877c713e969ccf5ed7efab8a84ebc07e3939901371ca427e1192e455a8f35a6a1d7ad09e1475dd1758b36fa631dab5d70e99316b23c4c43094188d360cd9c3457355904e07c00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000162074a7047f',
|
|
1024
|
-
maxFeePerGas: Big {
|
|
1025
|
-
s: 1,
|
|
1026
|
-
e: 10,
|
|
1027
|
-
c: [
|
|
1028
|
-
6, 7, 6, 8, 1,
|
|
1029
|
-
2, 6, 1, 6, 1,
|
|
1030
|
-
8
|
|
1031
|
-
],
|
|
1032
|
-
constructor: <ref *1> [Function: Big] {
|
|
1033
|
-
DP: 20,
|
|
1034
|
-
RM: 1,
|
|
1035
|
-
NE: -7,
|
|
1036
|
-
PE: 21,
|
|
1037
|
-
strict: false,
|
|
1038
|
-
roundDown: 0,
|
|
1039
|
-
roundHalfUp: 1,
|
|
1040
|
-
roundHalfEven: 2,
|
|
1041
|
-
roundUp: 3,
|
|
1042
|
-
Big: [Circular *1],
|
|
1043
|
-
default: [Circular *1]
|
|
1044
|
-
}
|
|
1045
|
-
},
|
|
1046
|
-
maxPriorityFeePerGas: Big {
|
|
1047
|
-
s: 1,
|
|
1048
|
-
e: 9,
|
|
1049
|
-
c: [ 1, 5 ],
|
|
1050
|
-
constructor: <ref *1> [Function: Big] {
|
|
1051
|
-
DP: 20,
|
|
1052
|
-
RM: 1,
|
|
1053
|
-
NE: -7,
|
|
1054
|
-
PE: 21,
|
|
1055
|
-
strict: false,
|
|
1056
|
-
roundDown: 0,
|
|
1057
|
-
roundHalfUp: 1,
|
|
1058
|
-
roundHalfEven: 2,
|
|
1059
|
-
roundUp: 3,
|
|
1060
|
-
Big: [Circular *1],
|
|
1061
|
-
default: [Circular *1]
|
|
1062
|
-
}
|
|
1063
|
-
},
|
|
1064
|
-
nonce: 129,
|
|
1065
|
-
r: '0x59a7c15b12c18cd68d6c440963d959bff3e73831ffc938e75ecad07f7ee43fbc',
|
|
1066
|
-
s: '0x1ebaf05f0d9273b16c2a7748b150a79d22533a8cd74552611cbe620fee3dcf1c',
|
|
1067
|
-
to: '0x39B72d136ba3e4ceF35F48CD09587ffaB754DD8B',
|
|
1068
|
-
transactionIndex: 29,
|
|
1069
|
-
type: 2,
|
|
1070
|
-
v: 0,
|
|
1071
|
-
value: Big {
|
|
1072
|
-
s: 1,
|
|
1073
|
-
e: 0,
|
|
1074
|
-
c: [ 0 ],
|
|
1075
|
-
constructor: <ref *1> [Function: Big] {
|
|
1076
|
-
DP: 20,
|
|
1077
|
-
RM: 1,
|
|
1078
|
-
NE: -7,
|
|
1079
|
-
PE: 21,
|
|
1080
|
-
strict: false,
|
|
1081
|
-
roundDown: 0,
|
|
1082
|
-
roundHalfUp: 1,
|
|
1083
|
-
roundHalfEven: 2,
|
|
1084
|
-
roundUp: 3,
|
|
1085
|
-
Big: [Circular *1],
|
|
1086
|
-
default: [Circular *1]
|
|
1087
|
-
}
|
|
1088
|
-
},
|
|
1089
|
-
confirmations: 1210
|
|
1090
|
-
}
|
|
1091
|
-
*/
|
|
1318
|
+
</details>
|
|
1319
|
+
|
|
1320
|
+
<br/>
|
|
1321
|
+
|
|
1322
|
+
#### [`getTransactionCount`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#gettransactioncount)
|
|
1323
|
+
|
|
1324
|
+
```typescript
|
|
1325
|
+
provider.getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>
|
|
1092
1326
|
```
|
|
1093
1327
|
|
|
1094
|
-
|
|
1328
|
+
<details>
|
|
1329
|
+
<summary>View Example</summary>
|
|
1330
|
+
|
|
1331
|
+
```js
|
|
1332
|
+
import { JsonRpcProvider } from 'essential-eth';
|
|
1333
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1334
|
+
```
|
|
1335
|
+
|
|
1336
|
+
```javascript
|
|
1337
|
+
await provider.getTransactionCount(
|
|
1338
|
+
'0x71660c4005ba85c37ccec55d0c4493e66fe775d3',
|
|
1339
|
+
);
|
|
1340
|
+
// 1060000
|
|
1341
|
+
```
|
|
1342
|
+
|
|
1343
|
+
```javascript
|
|
1344
|
+
await provider.getTransactionCount(
|
|
1345
|
+
'0x71660c4005ba85c37ccec55d0c4493e66fe775d3',
|
|
1346
|
+
'latest',
|
|
1347
|
+
);
|
|
1348
|
+
// 1060000
|
|
1349
|
+
```
|
|
1350
|
+
|
|
1351
|
+
```javascript
|
|
1352
|
+
await provider.getTransactionCount(
|
|
1353
|
+
'0x71660c4005ba85c37ccec55d0c4493e66fe775d3',
|
|
1354
|
+
14649390,
|
|
1355
|
+
);
|
|
1356
|
+
// 1053312
|
|
1357
|
+
```
|
|
1358
|
+
|
|
1359
|
+
</details>
|
|
1360
|
+
|
|
1361
|
+
<br/>
|
|
1362
|
+
|
|
1363
|
+
#### [`getTransactionReceipt`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#gettransactionreceipt)
|
|
1364
|
+
|
|
1365
|
+
```typescript
|
|
1366
|
+
provider.getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>
|
|
1367
|
+
```
|
|
1368
|
+
|
|
1369
|
+
<details>
|
|
1370
|
+
<summary>View Example</summary>
|
|
1371
|
+
|
|
1372
|
+
```js
|
|
1373
|
+
import { JsonRpcProvider } from 'essential-eth';
|
|
1374
|
+
const provider = new JsonRpcProvider('RPC URL HERE' /* Try Infura or POKT */);
|
|
1375
|
+
```
|
|
1376
|
+
|
|
1377
|
+
```javascript
|
|
1378
|
+
await provider.getTransactionReceipt(
|
|
1379
|
+
'0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789',
|
|
1380
|
+
);
|
|
1381
|
+
// {
|
|
1382
|
+
// blockHash: "0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d",
|
|
1383
|
+
// blockNumber: 14578286,
|
|
1384
|
+
// contractAddress: null,
|
|
1385
|
+
// cumulativeGasUsed: { TinyBig: 3067973 },
|
|
1386
|
+
// effectiveGasPrice: { TinyBig: 48592426858 },
|
|
1387
|
+
// from: "0xdfD9dE5f6FA60BD70636c0900752E93a6144AEd4",
|
|
1388
|
+
// gasUsed: { TinyBig: 112163 },
|
|
1389
|
+
// logs: [
|
|
1390
|
+
// {
|
|
1391
|
+
// address: "0x0eDF9bc41Bbc1354c70e2107F80C42caE7FBBcA8",
|
|
1392
|
+
// blockHash: "0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d",
|
|
1393
|
+
// blockNumber: 14578286,
|
|
1394
|
+
// data: "0x0000000000000000000000000000000000000000000003a12ec797b5484968c1",
|
|
1395
|
+
// logIndex: 42,
|
|
1396
|
+
// topics: [
|
|
1397
|
+
// "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
|
|
1398
|
+
// "0x00000000000000000000000039b72d136ba3e4cef35f48cd09587ffab754dd8b",
|
|
1399
|
+
// "0x000000000000000000000000dfd9de5f6fa60bd70636c0900752e93a6144aed4",
|
|
1400
|
+
// ],
|
|
1401
|
+
// transactionHash: "0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789",
|
|
1402
|
+
// transactionIndex: 29,
|
|
1403
|
+
// },
|
|
1404
|
+
// {
|
|
1405
|
+
// address: "0x39B72d136ba3e4ceF35F48CD09587ffaB754DD8B",
|
|
1406
|
+
// blockHash: "0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d",
|
|
1407
|
+
// blockNumber: 14578286,
|
|
1408
|
+
// data: "0x0000000000000000000000000000000000000000000003a12ec797b5484968c1",
|
|
1409
|
+
// logIndex: 43,
|
|
1410
|
+
// topics: [
|
|
1411
|
+
// "0x34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf7",
|
|
1412
|
+
// "0x000000000000000000000000dfd9de5f6fa60bd70636c0900752e93a6144aed4",
|
|
1413
|
+
// "0x0000000000000000000000000000000000000000000000000000000000000003",
|
|
1414
|
+
// ],
|
|
1415
|
+
// transactionHash: "0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789",
|
|
1416
|
+
// transactionIndex: 29,
|
|
1417
|
+
// },
|
|
1418
|
+
// ],
|
|
1419
|
+
// logsBloom: "0x00000000000000000000000000000...",
|
|
1420
|
+
// status: 1,
|
|
1421
|
+
// to: "0x39B72d136ba3e4ceF35F48CD09587ffaB754DD8B",
|
|
1422
|
+
// transactionHash: "0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789",
|
|
1423
|
+
// transactionIndex: 29,
|
|
1424
|
+
// type: 2,
|
|
1425
|
+
// byzantium: true,
|
|
1426
|
+
// confirmations: 298171,
|
|
1427
|
+
// }
|
|
1428
|
+
```
|
|
1429
|
+
|
|
1430
|
+
</details>
|
|
1431
|
+
|
|
1432
|
+
<br/>
|
|
1433
|
+
|
|
1434
|
+
<!-- ⛔️ AUTO-GENERATED-CONTENT:END -->
|
|
1095
1435
|
|
|
1096
1436
|
<br/>
|
|
1097
1437
|
|
|
@@ -1176,5 +1516,17 @@ Any function on a contract. Returns are the same as `ethers.js`, except that ins
|
|
|
1176
1516
|
|
|
1177
1517
|
<br/>
|
|
1178
1518
|
|
|
1519
|
+
### Identical vs Similar vs Dissimliar {#isd}
|
|
1520
|
+
|
|
1521
|
+
Throughout the documentation for `essential-eth`, you may notice that some functions are compared to `ethers.js` and `web3.js`. The keywords `identical`, `similar`, and `dissimilar` are used to help you migrate to `essential-eth`. Here's a guide on what these keywords mean:
|
|
1522
|
+
|
|
1523
|
+
- Identical -- should behave exactly like the library you're already using, except the types might be different (`TinyBig` vs [`Bn.js`](https://github.com/indutny/bn.js)).
|
|
1524
|
+
- Similar -- can probably be used as a replacement to the library you're currently using, except there are some differences. Read the notes next to this keyword to see why these aren't considered `identical`.
|
|
1525
|
+
- Dissimilar -- _should not_ be used in place of the function you're currently using. Read the notes next to this keyword to see why these functions aren't considered `similar`, and potentially learn how to alter your implementation to make `essential-eth` work for you.
|
|
1526
|
+
|
|
1527
|
+
Note: In `web3.js`, almost every method or function can be passed a callback. `essential-eth`, like `ethers.js`, does not include this functionality and trusts that users will rely on the much more modern [promise](https://javascript.info/promise-basics) and [async/await](https://javascript.info/async-await) patterns.
|
|
1528
|
+
|
|
1529
|
+
### Miscellaneous
|
|
1530
|
+
|
|
1179
1531
|
- [📓 View full docs](https://essential-eth.vercel.app)
|
|
1180
1532
|
- [📓 View changelog (by looking at releases diff)](https://github.com/dawsbot/essential-eth/releases)
|