essential-eth 0.9.0 → 0.9.1-next.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 (106) hide show
  1. package/dist/cjs/classes/Contract.js +38 -34
  2. package/dist/cjs/classes/test/Contract/crv.test.js +146 -339
  3. package/dist/cjs/classes/test/Contract/ens-abi.d.ts +1 -1
  4. package/dist/cjs/classes/test/Contract/ens.test.js +9 -66
  5. package/dist/cjs/classes/test/Contract/fei.test.js +11 -11
  6. package/dist/cjs/classes/test/Contract/foo-abi.d.ts +1 -1
  7. package/dist/cjs/classes/test/Contract/uni.test.js +66 -164
  8. package/dist/cjs/classes/utils/clean-block.js +4 -4
  9. package/dist/cjs/classes/utils/clean-log.js +4 -4
  10. package/dist/cjs/classes/utils/clean-transaction-receipt.js +4 -4
  11. package/dist/cjs/classes/utils/clean-transaction.js +4 -4
  12. package/dist/cjs/classes/utils/encode-decode-transaction.js +10 -10
  13. package/dist/cjs/classes/utils/fetchers.d.ts +8 -2
  14. package/dist/cjs/classes/utils/fetchers.js +20 -12
  15. package/dist/cjs/classes/utils/prepare-transaction.js +4 -4
  16. package/dist/cjs/index.d.ts +21 -22
  17. package/dist/cjs/index.js +21 -22
  18. package/dist/cjs/index.umd.js +1 -1
  19. package/dist/cjs/index.umd.js.map +1 -1
  20. package/dist/cjs/logger/logger.js +79 -41
  21. package/dist/cjs/logger/package-version.d.ts +1 -1
  22. package/dist/cjs/logger/package-version.js +1 -1
  23. package/dist/cjs/providers/AlchemyProvider.js +22 -22
  24. package/dist/cjs/providers/BaseProvider.js +471 -404
  25. package/dist/cjs/providers/FallthroughProvider.js +62 -30
  26. package/dist/cjs/providers/JsonRpcProvider.js +52 -31
  27. package/dist/cjs/providers/test/fallthrough-provider/get-gas-price.test.js +9 -9
  28. package/dist/cjs/providers/test/get-transaction-count.test.js +54 -91
  29. package/dist/cjs/providers/test/json-rpc-provider/call.test.js +87 -148
  30. package/dist/cjs/providers/test/json-rpc-provider/estimate-gas.test.js +45 -116
  31. package/dist/cjs/providers/test/json-rpc-provider/get-balance.test.js +36 -74
  32. package/dist/cjs/providers/test/json-rpc-provider/get-block-number.test.js +13 -9
  33. package/dist/cjs/providers/test/json-rpc-provider/get-block.test.js +191 -254
  34. package/dist/cjs/providers/test/json-rpc-provider/get-code.test.js +106 -135
  35. package/dist/cjs/providers/test/json-rpc-provider/get-fee-data.test.js +48 -73
  36. package/dist/cjs/providers/test/json-rpc-provider/get-gas-price.test.js +11 -8
  37. package/dist/cjs/providers/test/json-rpc-provider/get-logs/get-logs.test.js +219 -0
  38. package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.d.ts +14 -0
  39. package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.js +149 -0
  40. package/dist/cjs/providers/test/json-rpc-provider/get-network.test.js +37 -79
  41. package/dist/cjs/providers/test/json-rpc-provider/get-transaction-receipt.test.js +136 -157
  42. package/dist/cjs/providers/test/json-rpc-provider/get-transaction.test.js +121 -162
  43. package/dist/cjs/providers/test/mock-of.js +0 -5
  44. package/dist/cjs/providers/test/rpc-urls.d.ts +1 -0
  45. package/dist/cjs/providers/test/rpc-urls.js +5 -4
  46. package/dist/cjs/providers/test/test-alchemy-provider.test.js +5 -5
  47. package/dist/cjs/providers/utils/chains-info.d.ts +5 -448
  48. package/dist/cjs/providers/utils/chains-info.js +13 -1344
  49. package/dist/cjs/shared/tiny-big/helpers.js +18 -18
  50. package/dist/cjs/shared/tiny-big/tiny-big.js +96 -56
  51. package/dist/cjs/shared/tiny-big/tiny-big.test.js +2 -2
  52. package/dist/cjs/shared/validate-type.d.ts +1 -1
  53. package/dist/cjs/shared/validate-type.js +4 -4
  54. package/dist/cjs/types/Block.types.d.ts +3 -3
  55. package/dist/cjs/types/Contract.types.d.ts +4 -4
  56. package/dist/cjs/types/Transaction.types.d.ts +5 -5
  57. package/dist/cjs/utils/bytes.d.ts +4 -4
  58. package/dist/cjs/utils/bytes.js +3 -3
  59. package/dist/cjs/utils/tests/bytes/arrayify.test.js +48 -24
  60. package/dist/cjs/utils/tests/bytes/concat.test.js +5 -3
  61. package/dist/cjs/utils/tests/bytes/hex-concat.test.js +15 -13
  62. package/dist/cjs/utils/tests/bytes/hex-data-length.test.js +49 -32
  63. package/dist/cjs/utils/tests/bytes/hex-data-slice.test.js +15 -16
  64. package/dist/cjs/utils/tests/bytes/hex-strip-zeros.test.js +57 -40
  65. package/dist/cjs/utils/tests/bytes/hex-value.test.js +118 -62
  66. package/dist/cjs/utils/tests/bytes/hex-zero-pad.test.js +71 -33
  67. package/dist/cjs/utils/tests/bytes/hexlify.test.js +45 -29
  68. package/dist/cjs/utils/tests/bytes/is-bytes-like.test.js +10 -11
  69. package/dist/cjs/utils/tests/bytes/is-bytes.test.js +70 -27
  70. package/dist/cjs/utils/tests/bytes/is-hex-string.test.js +37 -28
  71. package/dist/cjs/utils/tests/bytes/strip-zeros.test.js +94 -45
  72. package/dist/cjs/utils/tests/bytes/zero-pad.test.js +98 -34
  73. package/dist/cjs/utils/tests/compute-address.test.js +42 -20
  74. package/dist/cjs/utils/tests/compute-public-key.test.js +20 -9
  75. package/dist/cjs/utils/tests/ether-to-wei.test.js +5 -13
  76. package/dist/cjs/utils/tests/hash-message.test.js +26 -15
  77. package/dist/cjs/utils/tests/is-address.test.js +2 -9
  78. package/dist/cjs/utils/tests/keccak256.test.js +36 -12
  79. package/dist/cjs/utils/tests/solidity-keccak256.test.js +43 -42
  80. package/dist/cjs/utils/tests/split-signature.test.js +29 -8
  81. package/dist/cjs/utils/tests/to-checksum-address.test.js +1 -4
  82. package/dist/cjs/utils/tests/to-utf8-bytes.test.js +28 -8
  83. package/dist/cjs/utils/tests/wei-to-ether.test.js +10 -20
  84. package/dist/esm/classes/test/Contract/ens-abi.d.ts +1 -1
  85. package/dist/esm/classes/test/Contract/foo-abi.d.ts +1 -1
  86. package/dist/esm/classes/utils/fetchers.d.ts +8 -2
  87. package/dist/esm/classes/utils/fetchers.js +6 -3
  88. package/dist/esm/index.d.ts +21 -22
  89. package/dist/esm/index.js +16 -17
  90. package/dist/esm/logger/package-version.d.ts +1 -1
  91. package/dist/esm/logger/package-version.js +1 -1
  92. package/dist/esm/providers/FallthroughProvider.js +3 -3
  93. package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.d.ts +14 -0
  94. package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.js +142 -0
  95. package/dist/esm/providers/test/rpc-urls.d.ts +1 -0
  96. package/dist/esm/providers/test/rpc-urls.js +7 -4
  97. package/dist/esm/providers/utils/chains-info.d.ts +5 -448
  98. package/dist/esm/providers/utils/chains-info.js +13 -1344
  99. package/dist/esm/shared/validate-type.d.ts +1 -1
  100. package/dist/esm/types/Block.types.d.ts +3 -3
  101. package/dist/esm/types/Contract.types.d.ts +4 -4
  102. package/dist/esm/types/Transaction.types.d.ts +5 -5
  103. package/dist/esm/utils/bytes.d.ts +4 -4
  104. package/package.json +22 -50
  105. package/readme.md +15 -38
  106. package/dist/cjs/providers/test/json-rpc-provider/get-logs.test.js +0 -361
@@ -1,3 +1,3 @@
1
- declare type JSPrimitiveTypes = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function';
1
+ type JSPrimitiveTypes = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function';
2
2
  export declare const validateType: (value: unknown, allowedTypes: JSPrimitiveTypes[]) => void;
3
3
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { TinyBig } from './../shared/tiny-big/tiny-big';
2
2
  import type { BlockTransactionResponse, RPCTransaction } from './Transaction.types';
3
- declare type Modify<T, R> = Omit<T, keyof R> & R;
4
- export declare type BlockResponse = Modify<RPCBlock, {
3
+ type Modify<T, R> = Omit<T, keyof R> & R;
4
+ export type BlockResponse = Modify<RPCBlock, {
5
5
  baseFeePerGas: TinyBig;
6
6
  difficulty: TinyBig;
7
7
  gasLimit: TinyBig;
@@ -36,5 +36,5 @@ export interface RPCBlock {
36
36
  transactionsRoot: string;
37
37
  uncles: Array<string>;
38
38
  }
39
- export declare type BlockTag = 'latest' | 'earliest' | 'pending' | number | string;
39
+ export type BlockTag = 'latest' | 'earliest' | 'pending' | number | string;
40
40
  export {};
@@ -1,6 +1,6 @@
1
- export declare type ContractTypes = 'bool' | 'bytes1' | 'bytes2' | 'bytes3' | 'bytes4' | 'bytes5' | 'bytes6' | 'bytes7' | 'bytes8' | 'bytes9' | 'bytes10' | 'bytes11' | 'bytes12' | 'bytes13' | 'bytes14' | 'bytes15' | 'bytes16' | 'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' | 'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32' | 'bytes32[]' | 'address' | 'address payable' | 'address[4]' | 'address[100]' | 'uint256' | 'uint256[100]' | 'uint8' | 'uint32' | string;
2
- export declare type ContractInterface = JSONABI;
3
- export declare type ContractFunction<T = any> = (...args: Array<any>) => Promise<T>;
1
+ export type ContractTypes = 'bool' | 'bytes1' | 'bytes2' | 'bytes3' | 'bytes4' | 'bytes5' | 'bytes6' | 'bytes7' | 'bytes8' | 'bytes9' | 'bytes10' | 'bytes11' | 'bytes12' | 'bytes13' | 'bytes14' | 'bytes15' | 'bytes16' | 'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' | 'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32' | 'bytes32[]' | 'address' | 'address payable' | 'address[4]' | 'address[100]' | 'uint256' | 'uint256[100]' | 'uint8' | 'uint32' | string;
2
+ export type ContractInterface = JSONABI;
3
+ export type ContractFunction<T = any> = (...args: Array<any>) => Promise<T>;
4
4
  export interface JSONABIArgument {
5
5
  anonymous?: false;
6
6
  inputs: {
@@ -21,4 +21,4 @@ export interface JSONABIArgument {
21
21
  constant?: boolean;
22
22
  payable?: boolean;
23
23
  }
24
- export declare type JSONABI = JSONABIArgument[];
24
+ export type JSONABI = JSONABIArgument[];
@@ -1,12 +1,12 @@
1
1
  import type Big from 'big.js';
2
2
  import type { TinyBig } from '../shared/tiny-big/tiny-big';
3
3
  import type { BytesLike } from './../utils/bytes';
4
- declare type Modify<T, R> = Omit<T, keyof R> & R;
4
+ type Modify<T, R> = Omit<T, keyof R> & R;
5
5
  export interface RPCTransaction extends RPCBlockTransaction {
6
6
  maxFeePerGas: string;
7
7
  maxPriorityFeePerGas: string;
8
8
  }
9
- export declare type TransactionResponse = Modify<RPCTransaction, {
9
+ export type TransactionResponse = Modify<RPCTransaction, {
10
10
  blockNumber: number;
11
11
  chainId: number;
12
12
  gas: TinyBig;
@@ -22,7 +22,7 @@ export declare type TransactionResponse = Modify<RPCTransaction, {
22
22
  maxPriorityFeePerGas: TinyBig;
23
23
  confirmations: number;
24
24
  }>;
25
- export declare type TransactionReceipt = Modify<RPCTransactionReceipt, {
25
+ export type TransactionReceipt = Modify<RPCTransactionReceipt, {
26
26
  blockNumber: number;
27
27
  cumulativeGasUsed: TinyBig;
28
28
  effectiveGasPrice: TinyBig;
@@ -59,12 +59,12 @@ export interface TransactionRequest {
59
59
  maxPriorityFeePerGas?: TinyBig | string | Big | number;
60
60
  maxFeePerGas?: TinyBig | string | Big | number;
61
61
  }
62
- export declare type Log = Modify<RPCLog, {
62
+ export type Log = Modify<RPCLog, {
63
63
  blockNumber: number;
64
64
  logIndex: number;
65
65
  transactionIndex: number;
66
66
  }>;
67
- export declare type BlockTransactionResponse = Omit<TransactionResponse, 'maxFeePerGas' | 'maxPriorityFeePerGas'>;
67
+ export type BlockTransactionResponse = Omit<TransactionResponse, 'maxFeePerGas' | 'maxPriorityFeePerGas'>;
68
68
  export interface RPCBlockTransaction {
69
69
  blockHash: string;
70
70
  blockNumber: string;
@@ -1,6 +1,6 @@
1
- export declare type Bytes = ArrayLike<number>;
2
- export declare type BytesLike = Bytes | string;
3
- export declare type BytesLikeWithNumber = BytesLike | number;
1
+ export type Bytes = ArrayLike<number>;
2
+ export type BytesLike = Bytes | string;
3
+ export type BytesLikeWithNumber = BytesLike | number;
4
4
  export interface DataOptions {
5
5
  allowMissingPrefix?: boolean;
6
6
  hexPad?: 'left' | 'right' | null;
@@ -8,7 +8,7 @@ export interface DataOptions {
8
8
  export interface Hexable {
9
9
  toHexString(): string;
10
10
  }
11
- export declare type SignatureLike = {
11
+ export type SignatureLike = {
12
12
  r: string;
13
13
  s?: string;
14
14
  _vs?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "essential-eth",
3
3
  "description": "Ultralight JS for Ethereum",
4
- "version": "0.9.0",
4
+ "version": "0.9.1-next.0",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "private": false,
@@ -19,28 +19,7 @@
19
19
  },
20
20
  "repository": "https://github.com/dawsbot/essential-eth.git",
21
21
  "author": "@dawsbot",
22
- "size-limit": [
23
- {
24
- "name": "etherToWei",
25
- "path": "src/index.ts",
26
- "import": "{ etherToWei }",
27
- "limit": "3.58kb"
28
- },
29
- {
30
- "name": "JsonRpcProvider",
31
- "path": "src/index.ts",
32
- "import": "{ JsonRpcProvider }",
33
- "limit": "20.32kb"
34
- },
35
- {
36
- "name": "Contract",
37
- "path": "src/index.ts",
38
- "import": "{ Contract }",
39
- "limit": "15.38kb"
40
- }
41
- ],
42
22
  "scripts": {
43
- "size": "npx size-limit",
44
23
  "test": "npm-run-all --parallel jest compile lint",
45
24
  "test:all-node-versions": "npx trevor",
46
25
  "lint": "eslint --cache --fix .",
@@ -51,7 +30,7 @@
51
30
  "build:umd": "microbundle --external none --format umd",
52
31
  "build:readme": "bash ./scripts/markdown-magic/build-readme.sh",
53
32
  "jest": "jest",
54
- "build:chains-info": "npx ts-node scripts/fetch-chains-info.ts # used in getNetwork()",
33
+ "build:chains-info": "npx tsx scripts/update-chains-info/index.ts # used in getNetwork()",
55
34
  "update-deps": "sh ./scripts/pre-commit.sh",
56
35
  "pre-commit": "npm run update-deps",
57
36
  "prepare": "husky install",
@@ -61,40 +40,33 @@
61
40
  "doc": "typedoc"
62
41
  },
63
42
  "devDependencies": {
64
- "@size-limit/preset-small-lib": "^7.0.8",
65
- "@swc/cli": "^0.1.57",
66
- "@swc/core": "^1.3.21",
67
- "@types/body-parser": "^1.19.1",
68
- "@types/eslint": "^8.4.2",
69
- "@types/express": "^4.17.13",
43
+ "@size-limit/preset-small-lib": "^8.2.4",
44
+ "@swc/cli": "^0.1.62",
45
+ "@swc/core": "^1.3.53",
46
+ "@types/bn.js": "^5.1.1",
47
+ "@types/eslint": "^8.37.0",
70
48
  "@types/jest": "^27.4.1",
71
- "@types/jest-dev-server": "^5.0.0",
72
- "@types/node": "^16.10.1",
73
- "@types/prettier": "^2.4.4",
74
- "@typescript-eslint/eslint-plugin": "^5.26.0",
75
- "@typescript-eslint/parser": "^5.26.0",
76
- "body-parser": "^1.19.0",
49
+ "@types/node": "^18.16.0",
50
+ "@types/prettier": "^2.7.2",
51
+ "@typescript-eslint/eslint-plugin": "^5.59.0",
52
+ "@typescript-eslint/parser": "^5.59.0",
53
+ "bn.js": "^5.2.1",
77
54
  "dotenv": "^16.0.0",
78
55
  "eslint": "^8.16.0",
79
56
  "eslint-plugin-jest": "^26.2.2",
80
- "eslint-plugin-jsdoc": "38.0.2",
81
- "ethers": "^5.7.2",
82
- "express": "^4.17.1",
57
+ "eslint-plugin-jsdoc": "^38.0.2",
83
58
  "husky": "^7.0.4",
84
59
  "jest": "^27.5.1",
85
- "jest-dev-server": "^6.0.3",
86
- "just-omit": "^2.0.1",
87
- "lint-staged": "^12.4.1",
88
- "microbundle": "^0.15.0",
60
+ "lint-staged": "^13.2.1",
61
+ "microbundle": "^0.15.1",
89
62
  "npm-run-all": "^4.1.5",
90
63
  "perf_hooks": "^0.0.1",
91
- "prettier": "^2.8.4",
92
- "prettier-plugin-organize-imports": "^2.3.4",
64
+ "prettier": "^3.2.5",
65
+ "prettier-plugin-organize-imports": "^3.2.4",
93
66
  "ts-jest": "^27.1.4",
94
67
  "ts-node": "^10.2.1",
95
- "typedoc": "^0.22.15",
96
- "typescript": "^4.6.4",
97
- "web3": "^1.8.1",
68
+ "typedoc": "^0.24.5",
69
+ "typescript": "^4.9.4",
98
70
  "zod": "^3.21.4"
99
71
  },
100
72
  "dependencies": {
@@ -105,10 +77,10 @@
105
77
  "sha3": "^2.1.4"
106
78
  },
107
79
  "lint-staged": {
108
- "*.{js,jsx,ts,tsx,css,scss,md,json,html,yml,yaml}": [
109
- "prettier --write"
80
+ "*": [
81
+ "prettier --ignore-unknown --write"
110
82
  ],
111
- "*.{ts,tsx}": "eslint --cache --fix"
83
+ "*.{ts,tsx,js,jsx}": "eslint --cache --fix"
112
84
  },
113
85
  "prettier": {
114
86
  "trailingComma": "all",
package/readme.md CHANGED
@@ -36,7 +36,7 @@
36
36
  - 🟣 Polygon
37
37
  - 🔴 Optimism
38
38
  - 🔵 Arbitrum
39
- - [Many more](src/providers/utils/chains-info.ts)
39
+ - [Many more](https://github.com/dawsbot/essential-eth/tree/master/src/providers/utils/chains-info.ts)
40
40
  - 🧪 Strongly tested
41
41
  - 🌲 Tree-shaking and no side-effects
42
42
  - 🙌 All common JS versions (CommonJS, ESM, & UMD)
@@ -103,10 +103,7 @@
103
103
  - [More Info](#more-info)
104
104
  - [Identical vs Similar vs Dissimilar {&#035;isd}](#identical-vs-similar-vs-dissimilar-isd)
105
105
  - [Miscellaneous](#miscellaneous)
106
- - [GitPOAP](#gitpoap)
107
- - [What is a GitPOAP?](#what-is-a-gitpoap)
108
- - [How can I claim?](#how-can-i-claim)
109
- - [What issues should I start on first?](#what-issues-should-i-start-on-first)
106
+ - [Contributing and GitPOAP](#contributing-and-gitpoap)
110
107
 
111
108
  </details>
112
109
 
@@ -129,7 +126,7 @@ Browsers:
129
126
 
130
127
  ```html
131
128
  <!-- index.html -->
132
- <script src="https://unpkg.com/essential-eth@0.9.0"></script>
129
+ <script src="https://unpkg.com/essential-eth@0.9.1-next.0"></script>
133
130
  ```
134
131
 
135
132
  <!-- ⛔️ AUTO-GENERATED-CONTENT:END (UNPKG_SCRIPT_TAG) -->
@@ -808,15 +805,15 @@ import { splitSignature } from 'essential-eth';
808
805
  ```javascript
809
806
  const signature = '0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b3971647252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee331b';
810
807
  splitSignature(signature);
811
- {
812
- r: "0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b39716",
813
- s: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
814
- _vs: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
815
- recoveryParam: 0,
816
- v: 27,
817
- yParityAndS: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
818
- compact: "0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b3971647252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33"
819
- }
808
+ {
809
+ r: "0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b39716",
810
+ s: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
811
+ _vs: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
812
+ recoveryParam: 0,
813
+ v: 27,
814
+ yParityAndS: "0x47252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33",
815
+ compact: "0x60bc4ed91f2021aefe7045f3f77bd12f87eb733aee24bd1965343b3c27b3971647252185b7d2abb411b01b5d1ac4ab41ea486df1e9b396758c1aec6c1b6eee33"
816
+ }
820
817
  ```
821
818
 
822
819
  </details>
@@ -1585,28 +1582,8 @@ Note: In `web3.js`, almost every method or function can be passed a callback. `e
1585
1582
  - [📓 View changelog (by looking at releases diff)](https://github.com/dawsbot/essential-eth/releases)
1586
1583
  - [📋 View our project board](https://github.com/dawsbot/essential-eth/projects/1)
1587
1584
 
1588
- ### GitPOAP
1585
+ ## Contributing and GitPOAP
1589
1586
 
1590
- In partnership with GitPOAP, Essential ETH wants to recognize **all** contributors for their contributions toward the growth of this library. Developers can validate their contributions on Github and showcase their GitPOAP as proof-of-work toward their Web3 identity.
1587
+ We welcome and appreciate all contributions to Essential Eth! If you're interested in helping us improve this library, please read our [Contributing Guidelines](https://github.com/dawsbot/essential-eth/blob/master/CONTRIBUTING.md) to understand the types of contributions we're looking for and the process of making them.
1591
1588
 
1592
- <br/>
1593
-
1594
- ![Alt](https://www.gitpoap.io/_next/image?url=https%3A%2F%2Fassets.poap.xyz%2Fgitpoap3a-2023-essential-eth-contributor-2022-logo-1670961141021.png&w=750&q=75)
1595
-
1596
- <br/>
1597
-
1598
- #### What is a GitPOAP?
1599
-
1600
- GitPOAP is a contributor recognition platform built on top of the POAP Protocol (Proof of Attendance Protocol). Similar to a POAP, each GitPOAP represents a digital collectible. It serves as a badge of validation for the action taken by the individual. By serving as a bridge between Github and Web3, it allows repo maintainers to recognize contributors for their meaningful contributions. Learn more about GitPOAP, [here](https://www.gitpoap.io/).
1601
-
1602
- #### How can I claim?
1603
-
1604
- Here are two steps that you can take to qualify for a GitPOAP:
1605
-
1606
- 1. Contribute to [any open issue](https://github.com/dawsbot/essential-eth/issues) and submit a PR. Upon approval of PR merge, the GitPOAP will automatically be issued to the Github account.
1607
-
1608
- 2. Head to gitpoap.io and connect your GitHub account to mint!
1609
-
1610
- #### What issues should I start on first?
1611
-
1612
- We have set up a GitHub project [here](https://github.com/dawsbot/essential-eth/projects/1) for you to see all the issues by priority.
1589
+ In partnership with GitPOAP, Essential ETH wants to recognize **all** contributors for their contributions toward the growth of this library. More information about GitPOAP can be found on the [Contributing Guidelines](https://github.com/dawsbot/essential-eth/blob/master/CONTRIBUTING.md#GitPOAP).
@@ -1,361 +0,0 @@
1
- function _arrayLikeToArray(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _arrayWithHoles(arr) {
7
- if (Array.isArray(arr)) return arr;
8
- }
9
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10
- try {
11
- var info = gen[key](arg);
12
- var value = info.value;
13
- } catch (error) {
14
- reject(error);
15
- return;
16
- }
17
- if (info.done) {
18
- resolve(value);
19
- } else {
20
- Promise.resolve(value).then(_next, _throw);
21
- }
22
- }
23
- function _asyncToGenerator(fn) {
24
- return function() {
25
- var self = this, args = arguments;
26
- return new Promise(function(resolve, reject) {
27
- var gen = fn.apply(self, args);
28
- function _next(value) {
29
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
30
- }
31
- function _throw(err) {
32
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
33
- }
34
- _next(undefined);
35
- });
36
- };
37
- }
38
- function _iterableToArrayLimit(arr, i) {
39
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
40
- if (_i == null) return;
41
- var _arr = [];
42
- var _n = true;
43
- var _d = false;
44
- var _s, _e;
45
- try {
46
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
47
- _arr.push(_s.value);
48
- if (i && _arr.length === i) break;
49
- }
50
- } catch (err) {
51
- _d = true;
52
- _e = err;
53
- } finally{
54
- try {
55
- if (!_n && _i["return"] != null) _i["return"]();
56
- } finally{
57
- if (_d) throw _e;
58
- }
59
- }
60
- return _arr;
61
- }
62
- function _nonIterableRest() {
63
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
64
- }
65
- function _slicedToArray(arr, i) {
66
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
67
- }
68
- function _unsupportedIterableToArray(o, minLen) {
69
- if (!o) return;
70
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
71
- var n = Object.prototype.toString.call(o).slice(8, -1);
72
- if (n === "Object" && o.constructor) n = o.constructor.name;
73
- if (n === "Map" || n === "Set") return Array.from(n);
74
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
75
- }
76
- var __generator = this && this.__generator || function(thisArg, body) {
77
- var f, y, t, g, _ = {
78
- label: 0,
79
- sent: function() {
80
- if (t[0] & 1) throw t[1];
81
- return t[1];
82
- },
83
- trys: [],
84
- ops: []
85
- };
86
- return g = {
87
- next: verb(0),
88
- "throw": verb(1),
89
- "return": verb(2)
90
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
91
- return this;
92
- }), g;
93
- function verb(n) {
94
- return function(v) {
95
- return step([
96
- n,
97
- v
98
- ]);
99
- };
100
- }
101
- function step(op) {
102
- if (f) throw new TypeError("Generator is already executing.");
103
- while(_)try {
104
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
105
- if (y = 0, t) op = [
106
- op[0] & 2,
107
- t.value
108
- ];
109
- switch(op[0]){
110
- case 0:
111
- case 1:
112
- t = op;
113
- break;
114
- case 4:
115
- _.label++;
116
- return {
117
- value: op[1],
118
- done: false
119
- };
120
- case 5:
121
- _.label++;
122
- y = op[1];
123
- op = [
124
- 0
125
- ];
126
- continue;
127
- case 7:
128
- op = _.ops.pop();
129
- _.trys.pop();
130
- continue;
131
- default:
132
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
133
- _ = 0;
134
- continue;
135
- }
136
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
137
- _.label = op[1];
138
- break;
139
- }
140
- if (op[0] === 6 && _.label < t[1]) {
141
- _.label = t[1];
142
- t = op;
143
- break;
144
- }
145
- if (t && _.label < t[2]) {
146
- _.label = t[2];
147
- _.ops.push(op);
148
- break;
149
- }
150
- if (t[2]) _.ops.pop();
151
- _.trys.pop();
152
- continue;
153
- }
154
- op = body.call(thisArg, _);
155
- } catch (e) {
156
- op = [
157
- 6,
158
- e
159
- ];
160
- y = 0;
161
- } finally{
162
- f = t = 0;
163
- }
164
- if (op[0] & 5) throw op[1];
165
- return {
166
- value: op[0] ? op[1] : void 0,
167
- done: true
168
- };
169
- }
170
- };
171
- import { StaticJsonRpcProvider } from "@ethersproject/providers";
172
- import Web3 from "web3";
173
- import { JsonRpcProvider } from "../../../index";
174
- import { rpcUrls } from "./../rpc-urls";
175
- var rpcUrl = rpcUrls.mainnet;
176
- describe("provider.getLogs", function() {
177
- var testLogEquality = function testLogEquality(ee, other) {
178
- expect(ee).not.toBe([]); // indicates that filter needs to be updated; logs are from blocks too long ago to retrieve without full archive
179
- other.forEach(function(log) {
180
- if (log.id) delete log.id;
181
- });
182
- expect(ee).toMatchObject(other);
183
- };
184
- var essentialEthProvider = new JsonRpcProvider(rpcUrl);
185
- var ethersProvider = new StaticJsonRpcProvider(rpcUrl);
186
- var web3Provider = new Web3(rpcUrl);
187
- // Example logs that should be returned
188
- // https://etherscan.io/address/0xfbddadd80fe7bda00b901fbaf73803f2238ae655#events
189
- // Block(s) are 14809329
190
- var STRONGBLOCK_ADDRESS = "0xfbddadd80fe7bda00b901fbaf73803f2238ae655";
191
- var filterAddressFromTo = {
192
- address: STRONGBLOCK_ADDRESS,
193
- fromBlock: "0xE1F8F1",
194
- toBlock: "0xE1F8F1"
195
- };
196
- // Example logs that should be returned
197
- // https://etherscan.io/address/0x596a0f276ee432d8a28441e55737ff55cf30d0f7#events
198
- var RARELAND_ADDRESS = "0x596a0f276ee432d8a28441e55737ff55cf30d0f7";
199
- var filterAddressTopics = {
200
- address: RARELAND_ADDRESS,
201
- topics: [
202
- "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"
203
- ]
204
- };
205
- // https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#events
206
- // Address is for Wrapped Ether Contract
207
- var WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
208
- var filterAll = {
209
- address: WETH_ADDRESS,
210
- topics: [
211
- "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
212
- "0x00000000000000000000000021b8065d10f73ee2e260e5b47d3344d3ced7596e"
213
- ],
214
- fromBlock: 14825027,
215
- toBlock: 14825039
216
- };
217
- it("should match ethers.js -- address, from, to", /*#__PURE__*/ _asyncToGenerator(function() {
218
- var _ref, eeLogs, ethersLogs;
219
- return __generator(this, function(_state) {
220
- switch(_state.label){
221
- case 0:
222
- return [
223
- 4,
224
- Promise.all([
225
- essentialEthProvider.getLogs(filterAddressFromTo),
226
- ethersProvider.getLogs(filterAddressFromTo)
227
- ])
228
- ];
229
- case 1:
230
- _ref = _slicedToArray.apply(void 0, [
231
- _state.sent(),
232
- 2
233
- ]), eeLogs = _ref[0], ethersLogs = _ref[1];
234
- testLogEquality(eeLogs, ethersLogs);
235
- return [
236
- 2
237
- ];
238
- }
239
- });
240
- }));
241
- it("should match ethers.js -- address, topics", /*#__PURE__*/ _asyncToGenerator(function() {
242
- var _ref, eeLogs, ethersLogs;
243
- return __generator(this, function(_state) {
244
- switch(_state.label){
245
- case 0:
246
- return [
247
- 4,
248
- Promise.all([
249
- essentialEthProvider.getLogs(filterAddressTopics),
250
- ethersProvider.getLogs(filterAddressTopics)
251
- ])
252
- ];
253
- case 1:
254
- _ref = _slicedToArray.apply(void 0, [
255
- _state.sent(),
256
- 2
257
- ]), eeLogs = _ref[0], ethersLogs = _ref[1];
258
- testLogEquality(eeLogs, ethersLogs);
259
- return [
260
- 2
261
- ];
262
- }
263
- });
264
- }));
265
- it("should match ethers.js -- address, topics, from, to", /*#__PURE__*/ _asyncToGenerator(function() {
266
- var _ref, eeLogs, ethersLogs;
267
- return __generator(this, function(_state) {
268
- switch(_state.label){
269
- case 0:
270
- return [
271
- 4,
272
- Promise.all([
273
- essentialEthProvider.getLogs(filterAll),
274
- ethersProvider.getLogs(filterAll)
275
- ])
276
- ];
277
- case 1:
278
- _ref = _slicedToArray.apply(void 0, [
279
- _state.sent(),
280
- 2
281
- ]), eeLogs = _ref[0], ethersLogs = _ref[1];
282
- testLogEquality(eeLogs, ethersLogs);
283
- return [
284
- 2
285
- ];
286
- }
287
- });
288
- }));
289
- it("should match web3.js -- address, from, to", /*#__PURE__*/ _asyncToGenerator(function() {
290
- var _ref, eeLogs, web3Logs;
291
- return __generator(this, function(_state) {
292
- switch(_state.label){
293
- case 0:
294
- return [
295
- 4,
296
- Promise.all([
297
- essentialEthProvider.getLogs(filterAddressFromTo),
298
- web3Provider.eth.getPastLogs(filterAddressFromTo)
299
- ])
300
- ];
301
- case 1:
302
- _ref = _slicedToArray.apply(void 0, [
303
- _state.sent(),
304
- 2
305
- ]), eeLogs = _ref[0], web3Logs = _ref[1];
306
- testLogEquality(eeLogs, web3Logs);
307
- return [
308
- 2
309
- ];
310
- }
311
- });
312
- }));
313
- it("should match web3.js -- address, topics", /*#__PURE__*/ _asyncToGenerator(function() {
314
- var _ref, eeLogs, web3Logs;
315
- return __generator(this, function(_state) {
316
- switch(_state.label){
317
- case 0:
318
- return [
319
- 4,
320
- Promise.all([
321
- essentialEthProvider.getLogs(filterAddressTopics),
322
- web3Provider.eth.getPastLogs(filterAddressTopics)
323
- ])
324
- ];
325
- case 1:
326
- _ref = _slicedToArray.apply(void 0, [
327
- _state.sent(),
328
- 2
329
- ]), eeLogs = _ref[0], web3Logs = _ref[1];
330
- testLogEquality(eeLogs, web3Logs);
331
- return [
332
- 2
333
- ];
334
- }
335
- });
336
- }));
337
- it("should match web3.js -- address, topics, from, to", /*#__PURE__*/ _asyncToGenerator(function() {
338
- var _ref, eeLogs, web3Logs;
339
- return __generator(this, function(_state) {
340
- switch(_state.label){
341
- case 0:
342
- return [
343
- 4,
344
- Promise.all([
345
- essentialEthProvider.getLogs(filterAll),
346
- web3Provider.eth.getPastLogs(filterAll)
347
- ])
348
- ];
349
- case 1:
350
- _ref = _slicedToArray.apply(void 0, [
351
- _state.sent(),
352
- 2
353
- ]), eeLogs = _ref[0], web3Logs = _ref[1];
354
- testLogEquality(eeLogs, web3Logs);
355
- return [
356
- 2
357
- ];
358
- }
359
- });
360
- }));
361
- });