essential-eth 0.4.9-beta.3 → 0.4.10

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 (128) hide show
  1. package/{dist → lib}/cjs/classes/Contract.d.ts +0 -0
  2. package/{dist → lib}/cjs/classes/Contract.js +3 -8
  3. package/{dist → lib}/cjs/classes/test/Contract/crv-abi.d.ts +0 -0
  4. package/{dist → lib}/cjs/classes/test/Contract/crv-abi.js +0 -0
  5. package/{dist → lib}/cjs/classes/test/Contract/ens-abi.d.ts +0 -0
  6. package/{dist → lib}/cjs/classes/test/Contract/ens-abi.js +0 -0
  7. package/{dist → lib}/cjs/classes/test/Contract/fei-abi.d.ts +0 -0
  8. package/{dist → lib}/cjs/classes/test/Contract/fei-abi.js +0 -0
  9. package/{dist → lib}/cjs/classes/test/Contract/foo-abi.d.ts +0 -0
  10. package/{dist → lib}/cjs/classes/test/Contract/foo-abi.js +0 -0
  11. package/{dist → lib}/cjs/classes/test/Contract/uniswap-abi.d.ts +0 -0
  12. package/{dist → lib}/cjs/classes/test/Contract/uniswap-abi.js +0 -0
  13. package/{dist → lib}/cjs/classes/utils/clean-block.d.ts +0 -0
  14. package/{dist → lib}/cjs/classes/utils/clean-block.js +2 -2
  15. package/{dist → lib}/cjs/classes/utils/clean-transaction.d.ts +0 -0
  16. package/{dist → lib}/cjs/classes/utils/clean-transaction.js +2 -2
  17. package/{dist → lib}/cjs/classes/utils/encode-decode-transaction.d.ts +0 -0
  18. package/{dist → lib}/cjs/classes/utils/encode-decode-transaction.js +1 -2
  19. package/{dist → lib}/cjs/classes/utils/fetchers.d.ts +1 -1
  20. package/lib/cjs/classes/utils/fetchers.js +51 -0
  21. package/{dist → lib}/cjs/classes/utils/hex-to-decimal.d.ts +0 -0
  22. package/{dist → lib}/cjs/classes/utils/hex-to-decimal.js +0 -0
  23. package/lib/cjs/index.d.ts +14 -0
  24. package/lib/cjs/index.js +23 -0
  25. package/{dist → lib}/cjs/providers/JsonRpcProvider.d.ts +16 -3
  26. package/{dist → lib}/cjs/providers/JsonRpcProvider.js +26 -23
  27. package/lib/cjs/providers/test/rpc-urls.d.ts +8 -0
  28. package/lib/cjs/providers/test/rpc-urls.js +11 -0
  29. package/{dist → lib}/cjs/providers/utils/chains-info.d.ts +22 -1
  30. package/{dist → lib}/cjs/providers/utils/chains-info.js +66 -3
  31. package/{dist → lib}/cjs/shared/tiny-big/helpers.d.ts +0 -0
  32. package/{dist → lib}/cjs/shared/tiny-big/helpers.js +0 -0
  33. package/{dist → lib}/cjs/shared/tiny-big/tiny-big.d.ts +6 -0
  34. package/{dist → lib}/cjs/shared/tiny-big/tiny-big.js +6 -0
  35. package/{dist → lib}/cjs/shared/validate-type.d.ts +0 -0
  36. package/{dist → lib}/cjs/shared/validate-type.js +0 -0
  37. package/{dist → lib}/cjs/types/Block.types.d.ts +0 -0
  38. package/{dist → lib}/cjs/types/Block.types.js +0 -0
  39. package/{dist → lib}/cjs/types/Contract.types.d.ts +0 -0
  40. package/{dist → lib}/cjs/types/Contract.types.js +0 -0
  41. package/{dist → lib}/cjs/types/Network.types.d.ts +0 -0
  42. package/{dist → lib}/cjs/types/Network.types.js +0 -0
  43. package/{dist → lib}/cjs/types/Transaction.types.d.ts +0 -0
  44. package/{dist → lib}/cjs/types/Transaction.types.js +0 -0
  45. package/lib/cjs/utils/ether-to-gwei.d.ts +26 -0
  46. package/lib/cjs/utils/ether-to-gwei.js +34 -0
  47. package/{dist → lib}/cjs/utils/ether-to-wei.d.ts +4 -2
  48. package/{dist → lib}/cjs/utils/ether-to-wei.js +4 -2
  49. package/lib/cjs/utils/gwei-to-ether.d.ts +26 -0
  50. package/lib/cjs/utils/gwei-to-ether.js +34 -0
  51. package/lib/cjs/utils/is-address.d.ts +24 -0
  52. package/{dist → lib}/cjs/utils/is-address.js +21 -2
  53. package/{dist → lib}/cjs/utils/to-checksum-address.d.ts +2 -2
  54. package/{dist → lib}/cjs/utils/to-checksum-address.js +2 -2
  55. package/lib/cjs/utils/wei-to-ether.d.ts +26 -0
  56. package/{dist → lib}/cjs/utils/wei-to-ether.js +11 -11
  57. package/{dist → lib}/esm/classes/Contract.d.ts +0 -0
  58. package/{dist → lib}/esm/classes/Contract.js +3 -8
  59. package/{dist → lib}/esm/classes/test/Contract/crv-abi.d.ts +0 -0
  60. package/{dist → lib}/esm/classes/test/Contract/crv-abi.js +0 -0
  61. package/{dist → lib}/esm/classes/test/Contract/ens-abi.d.ts +0 -0
  62. package/{dist → lib}/esm/classes/test/Contract/ens-abi.js +0 -0
  63. package/{dist → lib}/esm/classes/test/Contract/fei-abi.d.ts +0 -0
  64. package/{dist → lib}/esm/classes/test/Contract/fei-abi.js +0 -0
  65. package/{dist → lib}/esm/classes/test/Contract/foo-abi.d.ts +0 -0
  66. package/{dist → lib}/esm/classes/test/Contract/foo-abi.js +0 -0
  67. package/{dist → lib}/esm/classes/test/Contract/uniswap-abi.d.ts +0 -0
  68. package/{dist → lib}/esm/classes/test/Contract/uniswap-abi.js +0 -0
  69. package/{dist → lib}/esm/classes/utils/clean-block.d.ts +0 -0
  70. package/{dist → lib}/esm/classes/utils/clean-block.js +1 -1
  71. package/{dist → lib}/esm/classes/utils/clean-transaction.d.ts +0 -0
  72. package/{dist → lib}/esm/classes/utils/clean-transaction.js +1 -1
  73. package/{dist → lib}/esm/classes/utils/encode-decode-transaction.d.ts +0 -0
  74. package/{dist → lib}/esm/classes/utils/encode-decode-transaction.js +1 -2
  75. package/{dist → lib}/esm/classes/utils/fetchers.d.ts +1 -1
  76. package/lib/esm/classes/utils/fetchers.js +43 -0
  77. package/{dist → lib}/esm/classes/utils/hex-to-decimal.d.ts +0 -0
  78. package/{dist → lib}/esm/classes/utils/hex-to-decimal.js +0 -0
  79. package/lib/esm/index.d.ts +14 -0
  80. package/lib/esm/index.js +10 -0
  81. package/{dist → lib}/esm/providers/JsonRpcProvider.d.ts +4 -3
  82. package/{dist → lib}/esm/providers/JsonRpcProvider.js +14 -23
  83. package/lib/esm/providers/test/rpc-urls.d.ts +8 -0
  84. package/lib/esm/providers/test/rpc-urls.js +8 -0
  85. package/{dist → lib}/esm/providers/utils/chains-info.d.ts +22 -1
  86. package/{dist → lib}/esm/providers/utils/chains-info.js +66 -3
  87. package/{dist → lib}/esm/shared/tiny-big/helpers.d.ts +0 -0
  88. package/{dist → lib}/esm/shared/tiny-big/helpers.js +0 -0
  89. package/{dist → lib}/esm/shared/tiny-big/tiny-big.d.ts +0 -0
  90. package/{dist → lib}/esm/shared/tiny-big/tiny-big.js +0 -0
  91. package/{dist → lib}/esm/shared/validate-type.d.ts +0 -0
  92. package/{dist → lib}/esm/shared/validate-type.js +0 -0
  93. package/{dist → lib}/esm/types/Block.types.d.ts +0 -0
  94. package/{dist → lib}/esm/types/Block.types.js +0 -0
  95. package/{dist → lib}/esm/types/Contract.types.d.ts +0 -0
  96. package/{dist → lib}/esm/types/Contract.types.js +0 -0
  97. package/{dist → lib}/esm/types/Network.types.d.ts +0 -0
  98. package/{dist → lib}/esm/types/Network.types.js +0 -0
  99. package/{dist → lib}/esm/types/Transaction.types.d.ts +0 -0
  100. package/{dist → lib}/esm/types/Transaction.types.js +0 -0
  101. package/lib/esm/utils/ether-to-gwei.d.ts +3 -0
  102. package/lib/esm/utils/ether-to-gwei.js +7 -0
  103. package/{dist → lib}/esm/utils/ether-to-wei.d.ts +0 -0
  104. package/{dist → lib}/esm/utils/ether-to-wei.js +0 -0
  105. package/lib/esm/utils/gwei-to-ether.d.ts +3 -0
  106. package/lib/esm/utils/gwei-to-ether.js +7 -0
  107. package/{dist → lib}/esm/utils/is-address.d.ts +0 -0
  108. package/{dist → lib}/esm/utils/is-address.js +1 -1
  109. package/{dist → lib}/esm/utils/to-checksum-address.d.ts +0 -0
  110. package/{dist → lib}/esm/utils/to-checksum-address.js +0 -0
  111. package/{dist → lib}/esm/utils/wei-to-ether.d.ts +1 -1
  112. package/{dist → lib}/esm/utils/wei-to-ether.js +0 -0
  113. package/package.json +13 -17
  114. package/readme.md +85 -9
  115. package/dist/cjs/classes/utils/fetchers.js +0 -33
  116. package/dist/cjs/index.d.ts +0 -9
  117. package/dist/cjs/index.js +0 -36
  118. package/dist/cjs/tsconfig-cjs.tsbuildinfo +0 -1
  119. package/dist/cjs/utils/index.d.ts +0 -5
  120. package/dist/cjs/utils/index.js +0 -11
  121. package/dist/cjs/utils/is-address.d.ts +0 -5
  122. package/dist/cjs/utils/wei-to-ether.d.ts +0 -26
  123. package/dist/esm/classes/utils/fetchers.js +0 -25
  124. package/dist/esm/index.d.ts +0 -9
  125. package/dist/esm/index.js +0 -5
  126. package/dist/esm/tsconfig.tsbuildinfo +0 -1
  127. package/dist/esm/utils/index.d.ts +0 -5
  128. package/dist/esm/utils/index.js +0 -5
@@ -0,0 +1,43 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import unfetch from 'isomorphic-unfetch';
11
+ export function post(url, body) {
12
+ return unfetch(url, {
13
+ method: 'POST',
14
+ headers: {
15
+ 'Content-Type': 'application/json',
16
+ },
17
+ body: JSON.stringify(body),
18
+ })
19
+ .then((r) => __awaiter(this, void 0, void 0, function* () {
20
+ const t = yield r.text();
21
+ try {
22
+ return JSON.parse(t);
23
+ }
24
+ catch (_a) {
25
+ throw new Error(`Invalid JSON RPC response: "${t}"`);
26
+ }
27
+ }))
28
+ .then((response) => {
29
+ const result = response === null || response === void 0 ? void 0 : response.result;
30
+ if (!result) {
31
+ throw new Error(`Invalid JSON RPC response: ${JSON.stringify(response)}`);
32
+ }
33
+ return response.result;
34
+ });
35
+ }
36
+ export function buildRPCPostBody(method, params) {
37
+ return {
38
+ jsonrpc: '2.0',
39
+ id: 1,
40
+ method,
41
+ params,
42
+ };
43
+ }
@@ -0,0 +1,14 @@
1
+ import { Contract } from './classes/Contract';
2
+ import { JsonRpcProvider, jsonRpcProvider } from './providers/JsonRpcProvider';
3
+ import { tinyBig, TinyBig } from './shared/tiny-big/tiny-big';
4
+ import { Block } from './types/Block.types';
5
+ import { ContractTypes, JSONABI, JSONABIArgument } from './types/Contract.types';
6
+ import { Network } from './types/Network.types';
7
+ import { Transaction } from './types/Transaction.types';
8
+ import { etherToGwei } from './utils/ether-to-gwei';
9
+ import { etherToWei } from './utils/ether-to-wei';
10
+ import { gweiToEther } from './utils/gwei-to-ether';
11
+ import { isAddress } from './utils/is-address';
12
+ import { toChecksumAddress } from './utils/to-checksum-address';
13
+ import { weiToEther } from './utils/wei-to-ether';
14
+ export { etherToWei, etherToGwei, isAddress, jsonRpcProvider, JsonRpcProvider, tinyBig, toChecksumAddress, weiToEther, gweiToEther, Contract, TinyBig, Block, ContractTypes, JSONABI, JSONABIArgument, Network, Transaction, };
@@ -0,0 +1,10 @@
1
+ import { Contract } from './classes/Contract';
2
+ import { JsonRpcProvider, jsonRpcProvider } from './providers/JsonRpcProvider';
3
+ import { tinyBig, TinyBig } from './shared/tiny-big/tiny-big';
4
+ import { etherToGwei } from './utils/ether-to-gwei';
5
+ import { etherToWei } from './utils/ether-to-wei';
6
+ import { gweiToEther } from './utils/gwei-to-ether';
7
+ import { isAddress } from './utils/is-address';
8
+ import { toChecksumAddress } from './utils/to-checksum-address';
9
+ import { weiToEther } from './utils/wei-to-ether';
10
+ export { etherToWei, etherToGwei, isAddress, jsonRpcProvider, JsonRpcProvider, tinyBig, toChecksumAddress, weiToEther, gweiToEther, Contract, TinyBig, };
@@ -1,10 +1,11 @@
1
+ import { TinyBig } from '../shared/tiny-big/tiny-big';
1
2
  import { Block } from '../types/Block.types';
2
3
  import { Network } from '../types/Network.types';
3
4
  export declare class JsonRpcProvider {
4
- readonly _rpcUrl: Array<string>;
5
- _rpcUrlCounter: number;
6
- constructor(rpcUrl?: string | Array<string>);
5
+ readonly _rpcUrl: string;
6
+ constructor(rpcUrl?: string);
7
7
  getBlock(timeFrame: 'latest' | 'earliest' | 'pending' | number, returnTransactionObjects?: boolean): Promise<Block>;
8
8
  getNetwork(): Promise<Network>;
9
+ getGasPrice(): Promise<TinyBig>;
9
10
  }
10
11
  export declare function jsonRpcProvider(rpcUrl?: string): JsonRpcProvider;
@@ -10,19 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { cleanBlock } from '../classes/utils/clean-block';
11
11
  import { buildRPCPostBody, post } from '../classes/utils/fetchers';
12
12
  import { hexToDecimal } from '../classes/utils/hex-to-decimal';
13
+ import { tinyBig } from '../shared/tiny-big/tiny-big';
13
14
  import chainsInfo from './utils/chains-info';
14
15
  export class JsonRpcProvider {
15
16
  constructor(rpcUrl) {
16
- this._rpcUrl = (() => {
17
- if (!rpcUrl) {
18
- return ['https://free-eth-node.com/api/eth'];
19
- }
20
- else if (!Array.isArray(rpcUrl)) {
21
- return [rpcUrl];
22
- }
23
- return rpcUrl;
24
- })();
25
- this._rpcUrlCounter = 0;
17
+ this._rpcUrl = rpcUrl || 'https://free-eth-node.com/api/eth';
26
18
  }
27
19
  getBlock(timeFrame, returnTransactionObjects = false) {
28
20
  return __awaiter(this, void 0, void 0, function* () {
@@ -34,15 +26,10 @@ export class JsonRpcProvider {
34
26
  rpcTimeFrame = timeFrame;
35
27
  }
36
28
  const req = () => __awaiter(this, void 0, void 0, function* () {
37
- return yield post(this._rpcUrl[this._rpcUrlCounter], buildRPCPostBody('eth_getBlockByNumber', [
29
+ return yield post(this._rpcUrl, buildRPCPostBody('eth_getBlockByNumber', [
38
30
  rpcTimeFrame,
39
31
  returnTransactionObjects,
40
- ])).catch((e) => {
41
- if (e.code === 'ENOTFOUND') {
42
- this._rpcUrlCounter++;
43
- return req();
44
- }
45
- });
32
+ ]));
46
33
  });
47
34
  const nodeResponse = (yield req());
48
35
  return cleanBlock(nodeResponse, returnTransactionObjects);
@@ -51,12 +38,7 @@ export class JsonRpcProvider {
51
38
  getNetwork() {
52
39
  return __awaiter(this, void 0, void 0, function* () {
53
40
  const req = () => __awaiter(this, void 0, void 0, function* () {
54
- return yield post(this._rpcUrl[this._rpcUrlCounter], buildRPCPostBody('eth_chainId', [])).catch((e) => {
55
- if (e.code === 'ENOTFOUND') {
56
- this._rpcUrlCounter++;
57
- return req();
58
- }
59
- });
41
+ return yield post(this._rpcUrl, buildRPCPostBody('eth_chainId', []));
60
42
  });
61
43
  const nodeResponse = (yield req());
62
44
  const chainId = hexToDecimal(nodeResponse);
@@ -68,6 +50,15 @@ export class JsonRpcProvider {
68
50
  };
69
51
  });
70
52
  }
53
+ getGasPrice() {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const req = () => __awaiter(this, void 0, void 0, function* () {
56
+ return yield post(this._rpcUrl, buildRPCPostBody('eth_gasPrice', []));
57
+ });
58
+ const nodeResponse = (yield req());
59
+ return tinyBig(hexToDecimal(nodeResponse));
60
+ });
61
+ }
71
62
  }
72
63
  export function jsonRpcProvider(rpcUrl) {
73
64
  return new JsonRpcProvider(rpcUrl);
@@ -0,0 +1,8 @@
1
+ export declare const fakeUrls: {
2
+ readonly notRPCButRealHttp: "https://httpstat.us/200";
3
+ };
4
+ export declare const rpcUrls: {
5
+ mainnet: string;
6
+ gno: string;
7
+ bnb: string;
8
+ };
@@ -0,0 +1,8 @@
1
+ export const fakeUrls = {
2
+ notRPCButRealHttp: 'https://httpstat.us/200',
3
+ };
4
+ export const rpcUrls = {
5
+ mainnet: `${process.env.RPC_ORIGIN}/api/eth`,
6
+ gno: `${process.env.RPC_ORIGIN}/api/gno`,
7
+ bnb: `${process.env.RPC_ORIGIN}/api/bnb`,
8
+ };
@@ -45,6 +45,7 @@ declare const _default: {
45
45
  "51": string[];
46
46
  "52": string[];
47
47
  "53": string[];
48
+ "54": string[];
48
49
  "55": string[];
49
50
  "56": string[];
50
51
  "57": string[];
@@ -98,9 +99,11 @@ declare const _default: {
98
99
  "127": string[];
99
100
  "128": string[];
100
101
  "137": string[];
102
+ "141": string[];
101
103
  "142": string[];
102
104
  "162": string[];
103
105
  "163": string[];
106
+ "168": string[];
104
107
  "170": string[];
105
108
  "172": string[];
106
109
  "186": string[];
@@ -109,7 +112,10 @@ declare const _default: {
109
112
  "199": string[];
110
113
  "200": string[];
111
114
  "211": string[];
115
+ "218": string[];
112
116
  "222": string[];
117
+ "225": string[];
118
+ "226": string[];
113
119
  "246": string[];
114
120
  "250": string[];
115
121
  "256": string[];
@@ -117,6 +123,7 @@ declare const _default: {
117
123
  "262": string[];
118
124
  "269": string[];
119
125
  "288": string[];
126
+ "300": string[];
120
127
  "321": string[];
121
128
  "322": string[];
122
129
  "333": string[];
@@ -145,6 +152,7 @@ declare const _default: {
145
152
  "721": string[];
146
153
  "777": string[];
147
154
  "787": string[];
155
+ "788": string[];
148
156
  "803": string[];
149
157
  "820": string[];
150
158
  "821": string[];
@@ -162,6 +170,7 @@ declare const _default: {
162
170
  "999": string[];
163
171
  "1001": string[];
164
172
  "1007": string[];
173
+ "1008": string[];
165
174
  "1010": string[];
166
175
  "1012": string[];
167
176
  "1022": string[];
@@ -180,14 +189,19 @@ declare const _default: {
180
189
  "1280": string[];
181
190
  "1284": string[];
182
191
  "1285": string[];
192
+ "1286": string[];
183
193
  "1287": string[];
184
194
  "1288": string[];
195
+ "1337": string[];
185
196
  "1618": string[];
186
197
  "1620": string[];
187
198
  "1657": string[];
199
+ "1688": string[];
188
200
  "1856": string[];
189
201
  "1898": string[];
202
+ "1984": string[];
190
203
  "1987": string[];
204
+ "2001": string[];
191
205
  "2020": string[];
192
206
  "2021": string[];
193
207
  "2022": string[];
@@ -195,7 +209,10 @@ declare const _default: {
195
209
  "2100": string[];
196
210
  "2101": string[];
197
211
  "2213": string[];
212
+ "2221": string[];
198
213
  "2559": string[];
214
+ "3000": string[];
215
+ "3001": string[];
199
216
  "3331": string[];
200
217
  "3333": string[];
201
218
  "3334": string[];
@@ -205,12 +222,14 @@ declare const _default: {
205
222
  "3966": string[];
206
223
  "3967": string[];
207
224
  "4002": string[];
225
+ "4102": string[];
208
226
  "4689": string[];
209
227
  "4690": string[];
210
228
  "4918": string[];
211
229
  "5197": string[];
212
230
  "5315": string[];
213
231
  "5700": string[];
232
+ "5777": string[];
214
233
  "5851": string[];
215
234
  "5869": string[];
216
235
  "6626": string[];
@@ -259,6 +278,7 @@ declare const _default: {
259
278
  "43113": string[];
260
279
  "43114": string[];
261
280
  "44787": string[];
281
+ "45000": string[];
262
282
  "47805": string[];
263
283
  "49797": string[];
264
284
  "53935": string[];
@@ -300,10 +320,10 @@ declare const _default: {
300
320
  "110006": string[];
301
321
  "110007": string[];
302
322
  "110008": string[];
323
+ "200101": string[];
303
324
  "200625": string[];
304
325
  "201018": string[];
305
326
  "201030": string[];
306
- "210309": string[];
307
327
  "210425": string[];
308
328
  "234666": string[];
309
329
  "246529": string[];
@@ -319,6 +339,7 @@ declare const _default: {
319
339
  "1313114": string[];
320
340
  "1313500": string[];
321
341
  "1337702": string[];
342
+ "2203181": string[];
322
343
  "7762959": string[];
323
344
  "11155111": string[];
324
345
  "13371337": string[];
@@ -141,6 +141,9 @@ export default {
141
141
  "53": [
142
142
  "tcet"
143
143
  ],
144
+ "54": [
145
+ "OP"
146
+ ],
144
147
  "55": [
145
148
  "ZYX"
146
149
  ],
@@ -300,6 +303,9 @@ export default {
300
303
  "137": [
301
304
  "MATIC"
302
305
  ],
306
+ "141": [
307
+ "OPtest"
308
+ ],
303
309
  "142": [
304
310
  "dax"
305
311
  ],
@@ -309,6 +315,9 @@ export default {
309
315
  "163": [
310
316
  "pht"
311
317
  ],
318
+ "168": [
319
+ "aioz"
320
+ ],
312
321
  "170": [
313
322
  "hoosmartchain"
314
323
  ],
@@ -333,9 +342,18 @@ export default {
333
342
  "211": [
334
343
  "EDI"
335
344
  ],
345
+ "218": [
346
+ "SO1-old"
347
+ ],
336
348
  "222": [
337
349
  "ASK"
338
350
  ],
351
+ "225": [
352
+ "LA"
353
+ ],
354
+ "226": [
355
+ "TLA"
356
+ ],
339
357
  "246": [
340
358
  "ewt"
341
359
  ],
@@ -357,6 +375,9 @@ export default {
357
375
  "288": [
358
376
  "Boba"
359
377
  ],
378
+ "300": [
379
+ "ogc"
380
+ ],
360
381
  "321": [
361
382
  "kcs"
362
383
  ],
@@ -441,6 +462,9 @@ export default {
441
462
  "787": [
442
463
  "aca"
443
464
  ],
465
+ "788": [
466
+ "taero"
467
+ ],
444
468
  "803": [
445
469
  "haic"
446
470
  ],
@@ -492,6 +516,9 @@ export default {
492
516
  "1007": [
493
517
  "tnew"
494
518
  ],
519
+ "1008": [
520
+ "eun"
521
+ ],
495
522
  "1010": [
496
523
  "EVC"
497
524
  ],
@@ -546,12 +573,18 @@ export default {
546
573
  "1285": [
547
574
  "mriver"
548
575
  ],
576
+ "1286": [
577
+ "mrock-old"
578
+ ],
549
579
  "1287": [
550
580
  "mbase"
551
581
  ],
552
582
  "1288": [
553
583
  "mrock"
554
584
  ],
585
+ "1337": [
586
+ "cennz-a"
587
+ ],
555
588
  "1618": [
556
589
  "cate"
557
590
  ],
@@ -561,15 +594,24 @@ export default {
561
594
  "1657": [
562
595
  "bta"
563
596
  ],
597
+ "1688": [
598
+ "LUDAN"
599
+ ],
564
600
  "1856": [
565
601
  "tsf"
566
602
  ],
567
603
  "1898": [
568
604
  "boya"
569
605
  ],
606
+ "1984": [
607
+ "euntest"
608
+ ],
570
609
  "1987": [
571
610
  "egem"
572
611
  ],
612
+ "2001": [
613
+ "milkAda"
614
+ ],
573
615
  "2020": [
574
616
  "420"
575
617
  ],
@@ -591,9 +633,18 @@ export default {
591
633
  "2213": [
592
634
  "evanesco"
593
635
  ],
636
+ "2221": [
637
+ "kava"
638
+ ],
594
639
  "2559": [
595
640
  "ktoc"
596
641
  ],
642
+ "3000": [
643
+ "cennz-r"
644
+ ],
645
+ "3001": [
646
+ "cennz-n"
647
+ ],
597
648
  "3331": [
598
649
  "zcrbeach"
599
650
  ],
@@ -621,6 +672,9 @@ export default {
621
672
  "4002": [
622
673
  "tftm"
623
674
  ],
675
+ "4102": [
676
+ "aioz-testnet"
677
+ ],
624
678
  "4689": [
625
679
  "iotex-mainnet"
626
680
  ],
@@ -639,6 +693,9 @@ export default {
639
693
  "5700": [
640
694
  "tsys"
641
695
  ],
696
+ "5777": [
697
+ "dgcc"
698
+ ],
642
699
  "5851": [
643
700
  "Ontology Testnet"
644
701
  ],
@@ -783,6 +840,9 @@ export default {
783
840
  "44787": [
784
841
  "ALFA"
785
842
  ],
843
+ "45000": [
844
+ "autobahn"
845
+ ],
786
846
  "47805": [
787
847
  "REI"
788
848
  ],
@@ -906,6 +966,9 @@ export default {
906
966
  "110008": [
907
967
  "qkc-d-s7"
908
968
  ],
969
+ "200101": [
970
+ "milkTAda"
971
+ ],
909
972
  "200625": [
910
973
  "aka"
911
974
  ],
@@ -915,9 +978,6 @@ export default {
915
978
  "201030": [
916
979
  "alayadev"
917
980
  ],
918
- "210309": [
919
- "platondev"
920
- ],
921
981
  "210425": [
922
982
  "platon"
923
983
  ],
@@ -963,6 +1023,9 @@ export default {
963
1023
  "1337702": [
964
1024
  "kintsugi"
965
1025
  ],
1026
+ "2203181": [
1027
+ "platondev"
1028
+ ],
966
1029
  "7762959": [
967
1030
  "music"
968
1031
  ],
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ import Big from 'big.js';
2
+ import { TinyBig } from '../shared/tiny-big/tiny-big';
3
+ export declare function etherToGwei(etherQuantity: string | number | TinyBig | Big): TinyBig;
@@ -0,0 +1,7 @@
1
+ import { tinyBig } from '../shared/tiny-big/tiny-big';
2
+ import { validateType } from '../shared/validate-type';
3
+ export function etherToGwei(etherQuantity) {
4
+ validateType(etherQuantity, ['string', 'number', 'object']);
5
+ const result = tinyBig(etherQuantity).times('1000000000');
6
+ return tinyBig(result);
7
+ }
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ import Big from 'big.js';
2
+ import { TinyBig } from './../shared/tiny-big/tiny-big';
3
+ export declare function gweiToEther(gweiQuantity: string | number | TinyBig | Big): TinyBig;
@@ -0,0 +1,7 @@
1
+ import { tinyBig } from '../shared/tiny-big/tiny-big';
2
+ import { validateType } from '../shared/validate-type';
3
+ export function gweiToEther(gweiQuantity) {
4
+ validateType(gweiQuantity, ['string', 'number', 'object']);
5
+ const result = tinyBig(gweiQuantity).div('1000000000');
6
+ return tinyBig(result);
7
+ }
File without changes
@@ -1,5 +1,5 @@
1
+ import { toChecksumAddress } from '..';
1
2
  import { validateType } from '../shared/validate-type';
2
- import { toChecksumAddress } from '../utils';
3
3
  export function isAddress(address) {
4
4
  validateType(address, ['string']);
5
5
  try {
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  import Big from 'big.js';
2
- import { TinyBig } from './../shared/tiny-big/tiny-big';
2
+ import { TinyBig } from '../shared/tiny-big/tiny-big';
3
3
  export declare function weiToEther(weiQuantity: string | number | TinyBig | Big): TinyBig;
File without changes
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "essential-eth",
3
3
  "description": "Ultralight JS library for Ethereum utilities",
4
- "version": "0.4.9-beta.3",
4
+ "version": "0.4.10",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
- "main": "./dist/cjs/index.js",
8
- "module": "./dist/esm/index.js",
9
- "types": "./dist/cjs/index.d.ts",
7
+ "main": "./lib/cjs/index.js",
8
+ "module": "./lib/esm/index.js",
10
9
  "files": [
11
- "dist/"
10
+ "lib/"
12
11
  ],
13
12
  "bugs": {
14
13
  "url": "https://github.com/dawsbot/essential-eth/issues"
@@ -17,16 +16,15 @@
17
16
  "author": "@dawsbot",
18
17
  "scripts": {
19
18
  "test": "npm-run-all --parallel jest compile lint",
19
+ "test:all-node-versions": "npx trevor",
20
20
  "lint": "eslint .",
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
- "build": "rm -rf dist && npm run compile",
25
- "prepublishOnly": "npm run build && npm run build:website && npm run build:website:new-version",
24
+ "build": "rm -rf lib && npm run compile",
25
+ "prepublishOnly": "npm run build",
26
26
  "jest": "jest",
27
27
  "build:chains-info": "npx ts-node scripts/fetch-chains-info.ts # used in getNetwork()",
28
- "build:website": "sh scripts/build-website.sh",
29
- "build:website:new-version": "typedoc --options typedoc/options-new-version.js",
30
28
  "pre-commit": "sh scripts/pre-commit.sh"
31
29
  },
32
30
  "devDependencies": {
@@ -38,9 +36,8 @@
38
36
  "@types/jest-dev-server": "^5.0.0",
39
37
  "@types/node": "^16.10.1",
40
38
  "@types/prettier": "^2.4.4",
41
- "@types/supertest": "^2.0.11",
42
- "@typescript-eslint/eslint-plugin": "^5.17.0",
43
- "@typescript-eslint/parser": "^5.17.0",
39
+ "@typescript-eslint/eslint-plugin": "^5.18.0",
40
+ "@typescript-eslint/parser": "^5.18.0",
44
41
  "body-parser": "^1.19.0",
45
42
  "dotenv": "^16.0.0",
46
43
  "eslint": "^8.12.0",
@@ -50,15 +47,14 @@
50
47
  "husky": "^4.3.0",
51
48
  "jest": "^27.5.1",
52
49
  "jest-dev-server": "^6.0.3",
53
- "just-omit": "^1.2.0",
50
+ "just-omit": "^2.0.1",
54
51
  "lint-staged": "^12.3.7",
55
52
  "npm-run-all": "^4.1.5",
56
- "prettier": "^2.6.1",
53
+ "prettier": "^2.6.2",
57
54
  "prettier-plugin-organize-imports": "^2.3.4",
58
- "supertest": "^6.1.6",
59
55
  "ts-jest": "^27.1.4",
60
56
  "ts-node": "^10.2.1",
61
- "typedoc": "^0.22.12",
57
+ "typedoc": "^0.22.13",
62
58
  "typescript": "^4.6.3",
63
59
  "web3": "^1.7.1"
64
60
  },
@@ -70,7 +66,7 @@
70
66
  },
71
67
  "husky": {
72
68
  "hooks": {
73
- "pre-commit": "lint-staged && run-p pre-commit test build:website build:chains-info"
69
+ "pre-commit": "lint-staged && run-p pre-commit test build:chains-info"
74
70
  }
75
71
  },
76
72
  "lint-staged": {