essential-eth 0.4.11 โ†’ 0.5.4-alpha.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 (67) hide show
  1. package/lib/cjs/classes/Contract.d.ts +3 -2
  2. package/lib/cjs/classes/Contract.js +3 -2
  3. package/lib/cjs/classes/utils/clean-block.d.ts +3 -3
  4. package/lib/cjs/classes/utils/clean-block.js +3 -2
  5. package/lib/cjs/classes/utils/clean-transaction.d.ts +3 -3
  6. package/lib/cjs/classes/utils/clean-transaction.js +10 -6
  7. package/lib/cjs/classes/utils/encode-decode-transaction.d.ts +1 -0
  8. package/lib/cjs/classes/utils/encode-decode-transaction.js +4 -4
  9. package/lib/cjs/classes/utils/fetchers.d.ts +1 -1
  10. package/lib/cjs/index.d.ts +6 -3
  11. package/lib/cjs/index.js +19 -1
  12. package/lib/cjs/logger/logger.d.ts +11 -0
  13. package/lib/cjs/logger/logger.js +36 -0
  14. package/lib/cjs/logger/package-version.d.ts +1 -0
  15. package/lib/cjs/logger/package-version.js +5 -0
  16. package/lib/cjs/providers/BaseProvider.d.ts +261 -0
  17. package/lib/cjs/providers/BaseProvider.js +340 -0
  18. package/lib/cjs/providers/FallthroughProvider.d.ts +25 -0
  19. package/lib/cjs/providers/FallthroughProvider.js +65 -0
  20. package/lib/cjs/providers/JsonRpcProvider.d.ts +7 -33
  21. package/lib/cjs/providers/JsonRpcProvider.js +11 -93
  22. package/lib/cjs/providers/test/rpc-urls.d.ts +1 -0
  23. package/lib/cjs/providers/test/rpc-urls.js +1 -0
  24. package/lib/cjs/providers/utils/chains-info.d.ts +14 -0
  25. package/lib/cjs/providers/utils/chains-info.js +42 -0
  26. package/lib/cjs/shared/tiny-big/tiny-big.d.ts +9 -2
  27. package/lib/cjs/shared/tiny-big/tiny-big.js +26 -2
  28. package/lib/cjs/types/Block.types.d.ts +8 -19
  29. package/lib/cjs/types/Transaction.types.d.ts +23 -14
  30. package/lib/cjs/utils/bytes.d.ts +171 -0
  31. package/lib/cjs/utils/bytes.js +564 -0
  32. package/lib/cjs/utils/solidity-keccak256.d.ts +30 -0
  33. package/lib/cjs/utils/solidity-keccak256.js +125 -0
  34. package/lib/esm/classes/Contract.js +1 -1
  35. package/lib/esm/classes/utils/clean-block.d.ts +2 -2
  36. package/lib/esm/classes/utils/clean-block.js +2 -1
  37. package/lib/esm/classes/utils/clean-transaction.d.ts +2 -2
  38. package/lib/esm/classes/utils/clean-transaction.js +10 -6
  39. package/lib/esm/classes/utils/encode-decode-transaction.d.ts +1 -0
  40. package/lib/esm/classes/utils/encode-decode-transaction.js +2 -2
  41. package/lib/esm/classes/utils/fetchers.d.ts +1 -1
  42. package/lib/esm/index.d.ts +6 -3
  43. package/lib/esm/index.js +4 -1
  44. package/lib/esm/logger/logger.d.ts +11 -0
  45. package/lib/esm/logger/logger.js +33 -0
  46. package/lib/esm/logger/package-version.d.ts +1 -0
  47. package/lib/esm/logger/package-version.js +1 -0
  48. package/lib/esm/providers/BaseProvider.d.ts +17 -0
  49. package/lib/esm/providers/BaseProvider.js +88 -0
  50. package/lib/esm/providers/FallthroughProvider.d.ts +12 -0
  51. package/lib/esm/providers/FallthroughProvider.js +41 -0
  52. package/lib/esm/providers/JsonRpcProvider.d.ts +4 -9
  53. package/lib/esm/providers/JsonRpcProvider.js +8 -67
  54. package/lib/esm/providers/test/rpc-urls.d.ts +1 -0
  55. package/lib/esm/providers/test/rpc-urls.js +1 -0
  56. package/lib/esm/providers/utils/chains-info.d.ts +14 -0
  57. package/lib/esm/providers/utils/chains-info.js +42 -0
  58. package/lib/esm/shared/tiny-big/tiny-big.d.ts +2 -0
  59. package/lib/esm/shared/tiny-big/tiny-big.js +19 -0
  60. package/lib/esm/types/Block.types.d.ts +7 -19
  61. package/lib/esm/types/Transaction.types.d.ts +22 -14
  62. package/lib/esm/utils/bytes.d.ts +39 -0
  63. package/lib/esm/utils/bytes.js +245 -0
  64. package/lib/esm/utils/solidity-keccak256.d.ts +3 -0
  65. package/lib/esm/utils/solidity-keccak256.js +91 -0
  66. package/package.json +19 -19
  67. package/readme.md +251 -61
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "essential-eth",
3
3
  "description": "Ultralight JS library for Ethereum utilities",
4
- "version": "0.4.11",
4
+ "version": "0.5.4-alpha.0",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "main": "./lib/cjs/index.js",
@@ -17,18 +17,21 @@
17
17
  "scripts": {
18
18
  "test": "npm-run-all --parallel jest compile lint",
19
19
  "test:all-node-versions": "npx trevor",
20
- "lint": "eslint .",
20
+ "lint": "eslint --cache --fix .",
21
21
  "compile": "npm-run-all --parallel tsc:esm tsc:cjs",
22
22
  "tsc:esm": "tsc -p tsconfig.json",
23
23
  "tsc:cjs": "tsc -p tsconfig-cjs.json",
24
24
  "build": "rm -rf lib && npm run compile",
25
- "prepublishOnly": "npm run build",
26
25
  "jest": "jest",
27
26
  "build:chains-info": "npx ts-node scripts/fetch-chains-info.ts # used in getNetwork()",
28
- "pre-commit": "sh scripts/pre-commit.sh"
27
+ "update-deps": "sh ./scripts/pre-commit.sh",
28
+ "pre-commit": "run-p build:chains-info update-deps",
29
+ "prepare": "husky install",
30
+ "version": "npx genversion --es6 src/logger/package-version.ts && git add src/logger/package-version.ts",
31
+ "postversion": "git push --follow-tags",
32
+ "prepublishOnly": "npm run build"
29
33
  },
30
34
  "devDependencies": {
31
- "@ethersproject/keccak256": "^5.4.0",
32
35
  "@types/body-parser": "^1.19.1",
33
36
  "@types/eslint": "^8.4.1",
34
37
  "@types/express": "^4.17.13",
@@ -36,27 +39,28 @@
36
39
  "@types/jest-dev-server": "^5.0.0",
37
40
  "@types/node": "^16.10.1",
38
41
  "@types/prettier": "^2.4.4",
39
- "@typescript-eslint/eslint-plugin": "^5.18.0",
40
- "@typescript-eslint/parser": "^5.18.0",
42
+ "@typescript-eslint/eslint-plugin": "^5.21.0",
43
+ "@typescript-eslint/parser": "^5.21.0",
41
44
  "body-parser": "^1.19.0",
42
45
  "dotenv": "^16.0.0",
43
- "eslint": "^8.12.0",
44
- "eslint-plugin-jest": "^26.1.3",
45
- "ethers": "^5.6.2",
46
+ "eslint": "^8.14.0",
47
+ "eslint-plugin-jest": "^26.1.5",
48
+ "ethers": "^5.6.4",
46
49
  "express": "^4.17.1",
47
- "husky": "^4.3.0",
50
+ "husky": "^7.0.4",
48
51
  "jest": "^27.5.1",
49
52
  "jest-dev-server": "^6.0.3",
50
53
  "just-omit": "^2.0.1",
51
- "lint-staged": "^12.3.7",
54
+ "lint-staged": "^12.4.1",
52
55
  "npm-run-all": "^4.1.5",
56
+ "perf_hooks": "^0.0.1",
53
57
  "prettier": "^2.6.2",
54
58
  "prettier-plugin-organize-imports": "^2.3.4",
55
59
  "ts-jest": "^27.1.4",
56
60
  "ts-node": "^10.2.1",
57
61
  "typedoc": "^0.22.13",
58
62
  "typescript": "^4.6.3",
59
- "web3": "^1.7.1"
63
+ "web3": "^1.7.3"
60
64
  },
61
65
  "dependencies": {
62
66
  "@types/big.js": "^6.1.3",
@@ -64,15 +68,11 @@
64
68
  "isomorphic-unfetch": "^3.1.0",
65
69
  "sha3": "^2.1.4"
66
70
  },
67
- "husky": {
68
- "hooks": {
69
- "pre-commit": "lint-staged && run-p pre-commit test build:chains-info"
70
- }
71
- },
72
71
  "lint-staged": {
73
72
  "*.{js,jsx,ts,tsx,css,scss,md,json,html,yml,yaml}": [
74
73
  "prettier --write"
75
- ]
74
+ ],
75
+ "*.{ts,tsx}": "eslint --cache --fix"
76
76
  },
77
77
  "prettier": {
78
78
  "trailingComma": "all",
package/readme.md CHANGED
@@ -1,12 +1,14 @@
1
1
  <p align="center">
2
- <a><img src="https://user-images.githubusercontent.com/3408480/161474132-ae95d289-2298-46f1-b48d-9c02d88f7e38.png" title="Logo" height="400" /></a>
2
+ <img src="https://user-images.githubusercontent.com/3408480/163274699-ae4fb0f4-fca0-4745-bcd7-4868f80deaf6.png" height="220" title="Logo"/>
3
+
3
4
  </p>
4
5
  <p align="center">
6
+
5
7
  <b>
6
- Essential Eth
8
+ ๐Ÿชถ Essential Eth ๐Ÿชถ
7
9
  </b>
8
10
  <br/>
9
- <i>A replacement for ethers & web3 that's 50x smaller</i>
11
+ <i>A replacement for ethers & web3 that's 20x smaller</i>
10
12
  <br/>
11
13
  </p>
12
14
 
@@ -20,18 +22,14 @@
20
22
  <img src="https://user-images.githubusercontent.com/3408480/133322814-f3d18424-4ba8-4a37-8cbc-c5e6828354a3.png" title="Import size comparison" width="900"/>
21
23
  </p>
22
24
 
23
- ![Screen Shot 2022-01-12 at 10 25 29 AM](https://user-images.githubusercontent.com/3408480/149190699-9bc15719-9382-46af-a77b-45e138f37643.png)
24
-
25
- ![Screen Shot 2022-01-12 at 10 24 57 AM](https://user-images.githubusercontent.com/3408480/149190691-ed2913b9-8c14-4a8e-b5f8-0895fbac279b.png)
26
-
27
25
  ---
28
26
 
29
27
  <br/>
30
28
 
31
- - โšก๏ธ A replacement for `web3` and `ethers`
32
- - ๐ŸŽ [The TINIEST code size possible](https://bundlephobia.com/package/essential-eth)
29
+ - ๐Ÿ†๏ธ <sub><sup>[smallest code size possible](https://bundlephobia.com/package/essential-eth)</sup></sub>
33
30
  - สฆ Fully typed with TypeScript (also works with JavaScript)
34
31
  - ๐Ÿงช Tested to match both `web3` and `ethers`
32
+ - - โšก๏ธ Near-identical API to `ethers`
35
33
  - ๐ŸŒฒ Tree-shaking and no side-effects
36
34
  - ๐Ÿ™Œ Supports multiple JS versions (CommonJS and ESM)
37
35
  - โœ… Node 17, 16, 14, & 12
@@ -39,13 +37,7 @@
39
37
 
40
38
  <br/>
41
39
 
42
- ## More Info
43
-
44
- ๐Ÿงช This repo is under active development. The API is less-fully featured than `web3` and `ethers`. More functions added often!
45
-
46
- ![](https://badgen.net/bundlephobia/minzip/essential-eth) ![](https://badgen.net/bundlephobia/tree-shaking/essential-eth) ![](https://img.shields.io/npm/v/essential-eth) ![](https://badgen.net/bundlephobia/dependency-count/essential-eth)
47
-
48
- ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป Breaking changes will exist between minor versions until `1.0.0` (Versions go `major.minor.patch`)
40
+ [![๐Ÿงช tests](https://github.com/Earnifi/essential-eth/actions/workflows/test.yml/badge.svg)](https://github.com/Earnifi/essential-eth/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/Earnifi/essential-eth/branch/master/graph/badge.svg?token=E44EK6RWTZ)](https://codecov.io/gh/Earnifi/essential-eth) ![](https://badgen.net/bundlephobia/minzip/essential-eth) ![](https://badgen.net/bundlephobia/tree-shaking/essential-eth) ![](https://img.shields.io/npm/v/essential-eth)
49
41
 
50
42
  <br/>
51
43
 
@@ -227,6 +219,35 @@ isAddress('vitalik.eth');
227
219
 
228
220
  <br/>
229
221
 
222
+ #### `hexZeroPad`
223
+
224
+ ```typescript
225
+ // returns a hex string padded to a specified length of bytes
226
+ // if the hex value provided is already longer than the padding value, the value itself is returned without alteration
227
+ hexZeroPad(hexValue: string | number, length: number): string
228
+ ```
229
+
230
+ <details>
231
+ <summary>View Example</summary>
232
+
233
+ ```typescript
234
+ import { hexZeroPad } from 'essential-eth';
235
+
236
+ hexZeroPad('0x60', 2);
237
+ // '0x0060'
238
+
239
+ hexZeroPad(0x60, 3);
240
+ // '0x000060'
241
+
242
+ // Length of string is already longer than padding value
243
+ hexZeroPad('0x31323334', 3);
244
+ // Throws error
245
+ ```
246
+
247
+ </details>
248
+
249
+ <br/>
250
+
230
251
  ## RPC
231
252
 
232
253
  ```typescript
@@ -234,10 +255,35 @@ import { JsonRpcProvider } from 'essential-eth';
234
255
  const essentialEth = new JsonRpcProvider(
235
256
  'RPC URL HERE' /* Try POKT or Infura */,
236
257
  );
237
- // OR for very quick testing (limited to 500 requests)
258
+ // OR for very quick testing (limited to 10,000 requests)
238
259
  const essentialEth = new JsonRpcProvider();
239
260
  ```
240
261
 
262
+ <details>
263
+ <summary>Want a redundant provider that handles outages?</summary>
264
+
265
+ ```typescript
266
+ import { FallthroughProvider } from 'essential-eth';
267
+
268
+ // The FallthroughProvider handles falling through to the next valid URL.
269
+ // It's dynamic to never trust one URL again when it fails * until it has tried all other provided URLs
270
+ // The default timeout for a request is 8 seconds after which it moves to the next URL
271
+ const provider = new FallthroughProvider([
272
+ 'https://bad.com',
273
+ 'https://free-eth-node.com/api/eth',
274
+ ]);
275
+ provider.getGasPrice().toNumber();
276
+ /*
277
+ 39695942769
278
+ */
279
+ ```
280
+
281
+ </details>
282
+
283
+ <br/>
284
+
285
+ #### [`getTransactionCount(address, blockTag?): Promise<number>`](https://essential-eth.vercel.app/docs/api/classes/JsonRpcProvider#gettransactioncount)
286
+
241
287
  #### `getGasPrice`
242
288
 
243
289
  Returns the current gas price in gwei
@@ -344,49 +390,182 @@ essentialEth.getBlock('latest');
344
390
 
345
391
  /*
346
392
  {
347
- "baseFeePerGas": "0xf639de71c",
348
- "extraData": "0x4b75436f696e506f6f6c201360d0ff24ef3c3c",
349
- "gasLimit": 30000000,
350
- "gasUsed": 1344062,
351
- "hash": "0xd61a202c828a67085a08a69c4b1e5e096781d7169eaccb47be26147a15145f38",
352
- "logsBloom": "0x00a001060000000000a00000800810010600000040100000000200000020000000c800000000000000004a8000000101020080100800200040400000102061080000048000000918c800400c0800406000000000004010000440120080200008820009000800000004001804000000000041802010000400008200900808a010110000416010201100900008010480050000100101400008040010420010200002101240000020800000008080000000406000880000003000200602100200000001000260000240240000800020100400200000000a0010001000020680000000102008080081400004000800000004000000212000c0500148089002000000",
353
- "miner": "0xd757fd54b273BB1234d4d9993f27699d28d0EDD2",
354
- "mixHash": "0x363138be56fd5304ca6f0ce56d24d6469f4a5a88c771da1ddf7e69fb23c7d599",
355
- "nonce": "0xdb88082877e8b003",
356
- "number": 13402040,
357
- "parentHash": "0xfb7ef17413a17f07791301897f406a05eb3e99acb495bf3bab146a30af5615eb",
358
- "receiptsRoot": "0xfc35fd7463baadc116202ef7a87ddba23a80bd277dd44a4bd3a2b2f48b469be8",
359
- "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
360
- "size": 7672,
361
- "stateRoot": "0x8fef1cb4b33ce55f43e8d3e2d19a6db55a8311aead0a25b359eef4d6e8ab6870",
362
- "timestamp": 1634019741,
363
- "transactions": Array [
364
- "0x4b5ee005588efa1881d4bdd97c20fb1b311896bd150a62f0379256c12b4d3243",
365
- "0xe28945b5b7bb1963e765b117a88b2fd785ef751bb141fbdf03435994ebd22383",
366
- "0xb15b9d44303f0f7a10e5c27320421aa790e12af6bb4f300963da43d5c2ad3a3c",
367
- "0x67296bb97ab2accb35b9b73d2fb856f7f28081a469b8ff7e17a89799af9fb729",
368
- "0xe8530f6c51c4efe9e15bdcc90b5f879895e0f6682de543c92c5d3d09ec149bd7",
369
- "0xbbefd1fc51bac8e10998ccfa2601643a063c68c16cf4b6a91756936084849f36",
370
- "0x37c8ae4037b833936163b22c17f39f11169fbeb2cfc249830b0514411d2a2859",
371
- "0xe47b2ba6979470bc5aa6529fda7969e0758b3123a91b65d9da49b133f196eaa6",
372
- "0x738d2ca35f180a42af6407cb2b724b0c589168740a39e7e1719e30c644766a55",
373
- "0x60df73109fc534c3a2126df1a4ed4cb4946a188bb6d34a49025ec4e41d0ee601",
374
- "0xaf51a25e70321b5c8987acb3e4a2d5e9e8869f9bb74303984e56c37090dbd8ba",
375
- "0xb42bd613800595b21717ea55ea5c2390ffe0ba12297aae0811f6938fbd86c605",
376
- "0x628d637eae8f3bf4c3867fffadfb6c6f09228f0d037abc921d30cb4a7e28fa57",
377
- "0xf6f19b03636250610e9a724eff7b265cbeed737b0a018500ebbe91e3aaf9ebaf",
378
- "0x2376f3a78b63d482d4edcfd7903faeaee49e95b0fb12894f49e6c0ed6709d51a",
379
- "0xbbc5634af5882ec73d713f6a3c34a6ff6915c18ab445c9c6d5ff1fb185dcb2d2",
380
- "0x15349a7d15861d7f50310a392397a3c7c43a19d70c5543738943b6222460633a",
381
- "0x2a166ca1491a05decf2c107050877c62e194c3bdc95a72de79acb39271ebfea1",
382
- "0x55efd630c466b58e2051afb55f66f8f415c93c330c7e48e439f0667cf67407c1",
383
- "0xbd095088949d323b4ab7cbeeba2534693c14d2a9c25e923bf87cd5c1edfce00a",
384
- "0xeb4f9d928020962c6a13ac7de0fb09d0d5c0a0064060d11f2e8cebc6d60443f0",
385
- "0x482fb59cef1804ff20752c50b737ab44b4db942e7816d4ff38827109f79c5b6c",
386
- "0xf0d87f44454bf2f2d23c72c775ca9051848bf8fe4ce293c8d0a7160a5c7b366d",
387
- ],
388
- "transactionsRoot": "0x7fd87cbada35409e8a235c7d087d8bb7af6cfa0c7985d825ca69851b4192879f",
389
- "uncles": Array [],
393
+ number: 4232826,
394
+ hash: '0x93211a1cd17e154b183565ec685254a03f844a8e34824a46ce1bdd6753dcb669',
395
+ parentHash: '0x1b32bfcba1bb2a57f56e166a3bb06875a1978992999dfc8828397b4c1526f472',
396
+ sha3Uncles: '0x0fb399c67bb5a071ec8a22549223215ab76b7d4009941c9c37aa3c3936010463',
397
+ logsBloom: '0x00000000000000000000101000000000020000000000000000000000000000000000400000010000000000000000000000000000010000000008800000000800000000200000000000000000000000000000000000000000000002000000000000000000000000000040000000000040000000000000000000000000000000000000000000000001000000000004000000000010000000000000000020000000000000000200100020000000000000000080000000000080001000000000000000000001040000000000000000008000000020010100000000200000100000000000000000000000002000000080000000020400000000002000200000000000',
398
+ transactionsRoot: '0xc43b3f13e1fe810e34d3a26ffe465b72c7063a5c70a02de2c78e91e4d10bd9fb',
399
+ stateRoot: '0x04d7bc816537ea7ef3a16e76c9879d29f34f99d4154273c2e98e012a31bad745',
400
+ receiptsRoot: '0x89c6f781ceac0bd49c4d9aa9115df4a5d4dd0e0220ff7668012f15bc04222c6b',
401
+ miner: '0x31fe561eb2c628cD32Ec52573D7c4b7E4C278Bfa',
402
+ difficulty: '1300907486001755331049',
403
+ totalDifficulty: '5989929395521171616186006183',
404
+ extraData: '0xce018c495249532d62613031656132',
405
+ size: 5416,
406
+ gasLimit: 6800000,
407
+ gasUsed: 202955,
408
+ timestamp: 1649884910,
409
+ transactions: [
410
+ '0x6b34a59c7b9aead24fa6dad782f8a3ad84ed4a23ee09bcbf0bcf880840fbbe20',
411
+ '0x9a3851ca24d5336c6a0d48aba2c4b4769d7a672c9b01729c5eb9924efd1b19a7',
412
+ '0xc3ed3d198b62f2f3427ebfa3bbd0fcada4e3c0c189e4464e7eeceb403c75981e'
413
+ ],
414
+ uncles: [
415
+ '0x0c567c054e98153f10d651fbbc018891c1dd9d62a9ffd998e87678803e95b6ed',
416
+ '0xb7d69389dbfb057c6fcb4bc0582d46a2ba01170703f0dadf8cd1462b83e88753',
417
+ '0xd5f74ccd0ad4c58b3161e8c2c507c264231e5f28925061b809c02e5e4bb6db28'
418
+ ],
419
+ minimumGasPrice: '0x387ee40',
420
+ bitcoinMergedMiningHeader: '0x04000020e8567ed3d2480e15a1dd1b4335e4732ae343c037e4fd03000000000000000000ed10a8340d163d3e813bdd430f902f4e5a56828dc62313b2e23797c0be6b8516eb3e576297d8091735884f42',
421
+ bitcoinMergedMiningCoinbaseTransaction: '0x0000000000000140e910128fda7bac502dc5e0573bbaf12de8e2524f70c22f7bd160dedcb19a2521002b6a2952534b424c4f434b3ae493303f597fa368c0ccc4f8aceabf1c315bb7c9a07605c073a89f260040967aace6a7d9',
422
+ bitcoinMergedMiningMerkleProof: '0xdf63a3d7eb6fbcfb301311faa46e9a15b0408bb1a04e284daee86c273c1dfd65ede23f3170f806e9e0f4cef7ba6b56aa37470d9c23f96ec8e43d08b58645919c5e10bcb892897a731f8f9ce79c72dc0e390896bcd6c67bb38c0bdb72982b6cf05519968d76673572c3f3ef3a08b0ddb464863f1788f7cdbaad3fe44a8a8af576d430ac282fe28852c16df198ca96cc5f71a50695912efe1a836e8442be69e31b6d6f973da2818bce9a3a1c2d9be0671aee9a7776e398d6a03d1e178e20d84646004a3d03c0501334e629d9146aa6a01316dcbaa289df6e6c5e3090cadaddff22699cfc7ff09512fc0d65c5062f17c98561ce3c9510de210d9d654cf99f8d756ff37c9fa21e7122ee8cadb923341690845d572921425f2bd7e044558b7e07983ac4df28928028b0c13c3624dc7a965af8091b0cecc845bf7da5308c03b2c97d607f6706a599f802025894435f1d76ea4e67cc2fc4e1559f1206f559a24633de0f',
423
+ hashForMergedMining: '0xe493303f597fa368c0ccc4f8aceabf1c315bb7c9a07605c073a89f260040967a',
424
+ paidFees: '0xc0744dcb7a0',
425
+ cumulativeDifficulty: '0x1190930db285269e582'
426
+ }
427
+ */
428
+ ```
429
+
430
+ </details>
431
+
432
+ <br/>
433
+
434
+ #### `getTransaction`
435
+
436
+ Returns the Transaction associated with a given hash
437
+
438
+ ```typescript
439
+ // Similar to ethers.provider.getTransaction, formatting may differ
440
+ getTransaction(hash: string): Promise<Transaction>
441
+ ```
442
+
443
+ <details>
444
+ <summary>View Example</summary>
445
+
446
+ ```typescript
447
+ import { JsonRpcProvider } from 'essential-eth';
448
+ const essentialEth = new JsonRpcProvider();
449
+ await provider.getTransaction(
450
+ '0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789',
451
+ );
452
+
453
+ /*
454
+ {
455
+ accessList: [],
456
+ blockHash: '0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d',
457
+ blockNumber: 14578286,
458
+ chainId: 1,
459
+ from: '0xdfD9dE5f6FA60BD70636c0900752E93a6144AEd4',
460
+ gas: Big {
461
+ s: 1,
462
+ e: 5,
463
+ c: [ 1, 1, 2, 1, 6, 3 ],
464
+ constructor: <ref *1> [Function: Big] {
465
+ DP: 20,
466
+ RM: 1,
467
+ NE: -7,
468
+ PE: 21,
469
+ strict: false,
470
+ roundDown: 0,
471
+ roundHalfUp: 1,
472
+ roundHalfEven: 2,
473
+ roundUp: 3,
474
+ Big: [Circular *1],
475
+ default: [Circular *1]
476
+ }
477
+ },
478
+ gasPrice: Big {
479
+ s: 1,
480
+ e: 10,
481
+ c: [
482
+ 4, 8, 5, 9, 2,
483
+ 4, 2, 6, 8, 5,
484
+ 8
485
+ ],
486
+ constructor: <ref *1> [Function: Big] {
487
+ DP: 20,
488
+ RM: 1,
489
+ NE: -7,
490
+ PE: 21,
491
+ strict: false,
492
+ roundDown: 0,
493
+ roundHalfUp: 1,
494
+ roundHalfEven: 2,
495
+ roundUp: 3,
496
+ Big: [Circular *1],
497
+ default: [Circular *1]
498
+ }
499
+ },
500
+ hash: '0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789',
501
+ input: '0x83259f170000000000000000000000000000000000000000000000000000000000000080000000000000000000000000dfd9de5f6fa60bd70636c0900752e93a6144aed400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000009e99ad11a214fd016b19dc3648678c5944859ae292b21c24ca94f857836c4596f1950c82dd0c23dd621af4763edc2f66466e63c5df9de0c1107b1cd16bf460fe93e43fd308e3444bc79c3d88a4cb961dc8367ab6ad048867afc76d193bca99cf3a068864ed4a7df1dbf1d4c52238eced3e5e05644b4040fc2b3ccb8557b0e99fff6131305a0ea2b8061b90bd418db5bbdd2e92129f52d93f90531465e309c4caec5b85285822b6196398d36f16f511811b61bbda6461e80e29210cd303118bdcee8df6fa0505ffbe8642094fd2ba4dd458496fe3b459ac880bbf71877c713e969ccf5ed7efab8a84ebc07e3939901371ca427e1192e455a8f35a6a1d7ad09e1475dd1758b36fa631dab5d70e99316b23c4c43094188d360cd9c3457355904e07c00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000162074a7047f',
502
+ maxFeePerGas: Big {
503
+ s: 1,
504
+ e: 10,
505
+ c: [
506
+ 6, 7, 6, 8, 1,
507
+ 2, 6, 1, 6, 1,
508
+ 8
509
+ ],
510
+ constructor: <ref *1> [Function: Big] {
511
+ DP: 20,
512
+ RM: 1,
513
+ NE: -7,
514
+ PE: 21,
515
+ strict: false,
516
+ roundDown: 0,
517
+ roundHalfUp: 1,
518
+ roundHalfEven: 2,
519
+ roundUp: 3,
520
+ Big: [Circular *1],
521
+ default: [Circular *1]
522
+ }
523
+ },
524
+ maxPriorityFeePerGas: Big {
525
+ s: 1,
526
+ e: 9,
527
+ c: [ 1, 5 ],
528
+ constructor: <ref *1> [Function: Big] {
529
+ DP: 20,
530
+ RM: 1,
531
+ NE: -7,
532
+ PE: 21,
533
+ strict: false,
534
+ roundDown: 0,
535
+ roundHalfUp: 1,
536
+ roundHalfEven: 2,
537
+ roundUp: 3,
538
+ Big: [Circular *1],
539
+ default: [Circular *1]
540
+ }
541
+ },
542
+ nonce: 129,
543
+ r: '0x59a7c15b12c18cd68d6c440963d959bff3e73831ffc938e75ecad07f7ee43fbc',
544
+ s: '0x1ebaf05f0d9273b16c2a7748b150a79d22533a8cd74552611cbe620fee3dcf1c',
545
+ to: '0x39B72d136ba3e4ceF35F48CD09587ffaB754DD8B',
546
+ transactionIndex: 29,
547
+ type: 2,
548
+ v: 0,
549
+ value: Big {
550
+ s: 1,
551
+ e: 0,
552
+ c: [ 0 ],
553
+ constructor: <ref *1> [Function: Big] {
554
+ DP: 20,
555
+ RM: 1,
556
+ NE: -7,
557
+ PE: 21,
558
+ strict: false,
559
+ roundDown: 0,
560
+ roundHalfUp: 1,
561
+ roundHalfEven: 2,
562
+ roundUp: 3,
563
+ Big: [Circular *1],
564
+ default: [Circular *1]
565
+ }
566
+ },
567
+ confirmations: 1210
568
+ }
390
569
  */
391
570
  ```
392
571
 
@@ -459,6 +638,17 @@ Any function on a contract. Returns are the same as `ethers.js`, except that ins
459
638
  <br/>
460
639
  <br/>
461
640
 
641
+ ![Screen Shot 2022-01-12 at 10 25 29 AM](https://user-images.githubusercontent.com/3408480/149190699-9bc15719-9382-46af-a77b-45e138f37643.png)
642
+
643
+ ![Screen Shot 2022-01-12 at 10 24 57 AM](https://user-images.githubusercontent.com/3408480/149190691-ed2913b9-8c14-4a8e-b5f8-0895fbac279b.png)
644
+
645
+ ## More Info
646
+
647
+ ๐Ÿงช This repo is under active development. The API is less-fully featured than `web3` and `ethers`. More functions added often!
648
+
649
+ ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป Breaking changes will exist between minor versions until `1.0.0` (Versions go `major.minor.patch`)
650
+
651
+ <br/>
652
+
462
653
  - [๐Ÿ““ View full docs](https://essential-eth.vercel.app)
463
654
  - [๐Ÿ““ View changelog (by looking at releases diff)](https://github.com/dawsbot/essential-eth/releases)
464
- - [๐Ÿ““ View docs for an older version](https://essential-eth.vercel.app/versions)