essential-eth 0.5.4 → 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.
Files changed (98) hide show
  1. package/lib/cjs/classes/Contract.d.ts +10 -4
  2. package/lib/cjs/classes/Contract.js +15 -4
  3. package/lib/cjs/classes/utils/clean-block.d.ts +115 -0
  4. package/lib/cjs/classes/utils/clean-block.js +122 -9
  5. package/lib/cjs/classes/utils/clean-log.d.ts +9 -0
  6. package/lib/cjs/classes/utils/clean-log.js +37 -0
  7. package/lib/cjs/classes/utils/clean-transaction-receipt.d.ts +9 -0
  8. package/lib/cjs/classes/utils/clean-transaction-receipt.js +11 -16
  9. package/lib/cjs/classes/utils/clean-transaction.d.ts +9 -0
  10. package/lib/cjs/classes/utils/clean-transaction.js +10 -1
  11. package/lib/cjs/classes/utils/encode-decode-transaction.d.ts +12 -0
  12. package/lib/cjs/classes/utils/encode-decode-transaction.js +24 -0
  13. package/lib/cjs/classes/utils/fetchers.d.ts +31 -1
  14. package/lib/cjs/classes/utils/fetchers.js +30 -0
  15. package/lib/cjs/classes/utils/hex-to-decimal.d.ts +14 -1
  16. package/lib/cjs/classes/utils/hex-to-decimal.js +14 -1
  17. package/lib/cjs/classes/utils/prepare-transaction.d.ts +6 -0
  18. package/lib/cjs/classes/utils/prepare-transaction.js +45 -0
  19. package/lib/cjs/index.d.ts +10 -5
  20. package/lib/cjs/index.js +10 -2
  21. package/lib/cjs/logger/package-version.d.ts +1 -1
  22. package/lib/cjs/logger/package-version.js +1 -1
  23. package/lib/cjs/providers/BaseProvider.d.ts +282 -199
  24. package/lib/cjs/providers/BaseProvider.js +365 -214
  25. package/lib/cjs/providers/FallthroughProvider.d.ts +1 -2
  26. package/lib/cjs/providers/JsonRpcProvider.d.ts +6 -0
  27. package/lib/cjs/providers/JsonRpcProvider.js +6 -0
  28. package/lib/cjs/providers/utils/chains-info.d.ts +27 -0
  29. package/lib/cjs/providers/utils/chains-info.js +84 -3
  30. package/lib/cjs/shared/tiny-big/helpers.d.ts +16 -0
  31. package/lib/cjs/shared/tiny-big/helpers.js +27 -1
  32. package/lib/cjs/shared/tiny-big/tiny-big.d.ts +30 -4
  33. package/lib/cjs/shared/tiny-big/tiny-big.js +34 -4
  34. package/lib/cjs/types/Block.types.d.ts +11 -7
  35. package/lib/cjs/types/Filter.types.d.ts +16 -0
  36. package/lib/cjs/types/Filter.types.js +2 -0
  37. package/lib/cjs/types/Transaction.types.d.ts +33 -6
  38. package/lib/cjs/utils/bytes.d.ts +150 -33
  39. package/lib/cjs/utils/bytes.js +179 -32
  40. package/lib/cjs/utils/compute-address.d.ts +17 -0
  41. package/lib/cjs/utils/compute-address.js +33 -0
  42. package/lib/cjs/utils/compute-public-key.d.ts +18 -0
  43. package/lib/cjs/utils/compute-public-key.js +26 -0
  44. package/lib/cjs/utils/ether-to-gwei.d.ts +2 -1
  45. package/lib/cjs/utils/ether-to-gwei.js +2 -1
  46. package/lib/cjs/utils/ether-to-wei.d.ts +2 -1
  47. package/lib/cjs/utils/ether-to-wei.js +2 -1
  48. package/lib/cjs/utils/gwei-to-ether.d.ts +2 -1
  49. package/lib/cjs/utils/gwei-to-ether.js +2 -1
  50. package/lib/cjs/utils/hash-message.d.ts +3 -1
  51. package/lib/cjs/utils/hash-message.js +3 -1
  52. package/lib/cjs/utils/is-address.d.ts +2 -2
  53. package/lib/cjs/utils/is-address.js +2 -2
  54. package/lib/cjs/utils/keccak256.d.ts +15 -1
  55. package/lib/cjs/utils/keccak256.js +16 -2
  56. package/lib/cjs/utils/solidity-keccak256.d.ts +17 -7
  57. package/lib/cjs/utils/solidity-keccak256.js +27 -7
  58. package/lib/cjs/utils/split-signature.d.ts +24 -0
  59. package/lib/cjs/utils/split-signature.js +163 -0
  60. package/lib/cjs/utils/to-checksum-address.d.ts +2 -2
  61. package/lib/cjs/utils/to-checksum-address.js +2 -2
  62. package/lib/cjs/utils/to-utf8-bytes.d.ts +14 -0
  63. package/lib/cjs/utils/to-utf8-bytes.js +14 -0
  64. package/lib/cjs/utils/wei-to-ether.d.ts +2 -1
  65. package/lib/cjs/utils/wei-to-ether.js +14 -3
  66. package/lib/esm/classes/utils/clean-block.js +7 -8
  67. package/lib/esm/classes/utils/clean-log.d.ts +2 -0
  68. package/lib/esm/classes/utils/clean-log.js +26 -0
  69. package/lib/esm/classes/utils/clean-transaction-receipt.js +2 -16
  70. package/lib/esm/classes/utils/clean-transaction.js +1 -1
  71. package/lib/esm/classes/utils/fetchers.d.ts +1 -1
  72. package/lib/esm/classes/utils/prepare-transaction.d.ts +2 -0
  73. package/lib/esm/classes/utils/prepare-transaction.js +34 -0
  74. package/lib/esm/index.d.ts +10 -5
  75. package/lib/esm/index.js +7 -3
  76. package/lib/esm/logger/package-version.d.ts +1 -1
  77. package/lib/esm/logger/package-version.js +1 -1
  78. package/lib/esm/providers/BaseProvider.d.ts +7 -1
  79. package/lib/esm/providers/BaseProvider.js +67 -11
  80. package/lib/esm/providers/FallthroughProvider.d.ts +1 -2
  81. package/lib/esm/providers/utils/chains-info.d.ts +27 -0
  82. package/lib/esm/providers/utils/chains-info.js +84 -3
  83. package/lib/esm/shared/tiny-big/tiny-big.js +4 -0
  84. package/lib/esm/types/Block.types.d.ts +11 -7
  85. package/lib/esm/types/Filter.types.d.ts +12 -0
  86. package/lib/esm/types/Filter.types.js +1 -0
  87. package/lib/esm/types/Transaction.types.d.ts +31 -5
  88. package/lib/esm/utils/compute-address.d.ts +1 -0
  89. package/lib/esm/utils/compute-address.js +11 -0
  90. package/lib/esm/utils/compute-public-key.d.ts +2 -0
  91. package/lib/esm/utils/compute-public-key.js +6 -0
  92. package/lib/esm/utils/keccak256.d.ts +1 -1
  93. package/lib/esm/utils/keccak256.js +2 -2
  94. package/lib/esm/utils/split-signature.d.ts +2 -0
  95. package/lib/esm/utils/split-signature.js +126 -0
  96. package/lib/esm/utils/wei-to-ether.js +11 -2
  97. package/package.json +38 -11
  98. package/readme.md +1209 -335
@@ -1,7 +1,8 @@
1
1
  import { TinyBig } from '../shared/tiny-big/tiny-big';
2
2
  import { BlockResponse, BlockTag } from '../types/Block.types';
3
+ import { Filter, FilterByBlockHash } from '../types/Filter.types';
3
4
  import { Network } from '../types/Network.types';
4
- import { TransactionReceipt, TransactionResponse } from '../types/Transaction.types';
5
+ import { Log, TransactionReceipt, TransactionRequest, TransactionResponse } from '../types/Transaction.types';
5
6
  export declare abstract class BaseProvider {
6
7
  abstract selectRpcUrl(): string;
7
8
  abstract post(body: Record<string, unknown>): Promise<any>;
@@ -9,10 +10,15 @@ export declare abstract class BaseProvider {
9
10
  protected _post: (body: Record<string, unknown>) => Promise<any>;
10
11
  constructor(rpcUrls: string[]);
11
12
  getNetwork(): Promise<Network>;
13
+ getBlockNumber(): Promise<number>;
12
14
  getTransaction(transactionHash: string): Promise<TransactionResponse>;
13
15
  getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
14
16
  getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>;
15
17
  getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>;
16
18
  getGasPrice(): Promise<TinyBig>;
17
19
  getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>;
20
+ getCode(address: string, blockTag?: BlockTag): Promise<string>;
21
+ estimateGas(transaction: TransactionRequest): Promise<TinyBig>;
22
+ getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
23
+ call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>;
18
24
  }
@@ -8,12 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { cleanBlock } from '../classes/utils/clean-block';
11
+ import { cleanLog } from '../classes/utils/clean-log';
11
12
  import { cleanTransaction } from '../classes/utils/clean-transaction';
12
13
  import { cleanTransactionReceipt } from '../classes/utils/clean-transaction-receipt';
13
14
  import { buildRPCPostBody, post } from '../classes/utils/fetchers';
14
15
  import { hexToDecimal } from '../classes/utils/hex-to-decimal';
16
+ import { prepareTransaction } from '../classes/utils/prepare-transaction';
17
+ import { logger } from '../logger/logger';
15
18
  import { tinyBig } from '../shared/tiny-big/tiny-big';
16
19
  import chainsInfo from './utils/chains-info';
20
+ function prepBlockTag(blockTag) {
21
+ return typeof blockTag === 'number'
22
+ ? tinyBig(blockTag).toHexString()
23
+ : blockTag;
24
+ }
17
25
  export class BaseProvider {
18
26
  constructor(rpcUrls) {
19
27
  this._rpcUrls = [];
@@ -32,6 +40,12 @@ export class BaseProvider {
32
40
  };
33
41
  });
34
42
  }
43
+ getBlockNumber() {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const currentBlockNumber = (yield this.post(buildRPCPostBody('eth_blockNumber', [])));
46
+ return Number(hexToDecimal(currentBlockNumber));
47
+ });
48
+ }
35
49
  getTransaction(transactionHash) {
36
50
  return __awaiter(this, void 0, void 0, function* () {
37
51
  const [rpcTransaction, blockNumber] = yield Promise.all([
@@ -58,29 +72,22 @@ export class BaseProvider {
58
72
  }
59
73
  getTransactionCount(address, blockTag = 'latest') {
60
74
  return __awaiter(this, void 0, void 0, function* () {
61
- if (typeof blockTag === 'number') {
62
- blockTag = `0x${blockTag.toString(16)}`;
63
- }
75
+ blockTag = prepBlockTag(blockTag);
64
76
  const transactionCount = (yield this.post(buildRPCPostBody('eth_getTransactionCount', [address, blockTag])));
65
77
  return Number(hexToDecimal(transactionCount));
66
78
  });
67
79
  }
68
80
  getBlock(timeFrame = 'latest', returnTransactionObjects = false) {
69
81
  return __awaiter(this, void 0, void 0, function* () {
70
- let rpcTimeFrame;
71
82
  let type = 'Number';
72
- if (typeof timeFrame === 'number') {
73
- rpcTimeFrame = `0x${timeFrame.toString(16)}`;
74
- }
75
- else if (timeFrame.startsWith('0x')) {
76
- rpcTimeFrame = timeFrame;
83
+ if (typeof timeFrame === 'string' && timeFrame.length === 66) {
77
84
  type = 'Hash';
78
85
  }
79
86
  else {
80
- rpcTimeFrame = timeFrame;
87
+ timeFrame = prepBlockTag(timeFrame);
81
88
  }
82
89
  const rpcBlock = (yield this.post(buildRPCPostBody(`eth_getBlockBy${type}`, [
83
- rpcTimeFrame,
90
+ timeFrame,
84
91
  returnTransactionObjects,
85
92
  ])));
86
93
  return cleanBlock(rpcBlock, returnTransactionObjects);
@@ -94,8 +101,57 @@ export class BaseProvider {
94
101
  }
95
102
  getBalance(address, blockTag = 'latest') {
96
103
  return __awaiter(this, void 0, void 0, function* () {
104
+ blockTag = prepBlockTag(blockTag);
97
105
  const hexBalance = (yield this.post(buildRPCPostBody('eth_getBalance', [address, blockTag])));
98
106
  return tinyBig(hexToDecimal(hexBalance));
99
107
  });
100
108
  }
109
+ getCode(address, blockTag = 'latest') {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ blockTag = prepBlockTag(blockTag);
112
+ const contractCode = (yield this.post(buildRPCPostBody('eth_getCode', [address, blockTag])));
113
+ return contractCode;
114
+ });
115
+ }
116
+ estimateGas(transaction) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ const rpcTransaction = prepareTransaction(transaction);
119
+ const gasUsed = (yield this.post(buildRPCPostBody('eth_estimateGas', [rpcTransaction])));
120
+ return tinyBig(hexToDecimal(gasUsed));
121
+ });
122
+ }
123
+ getLogs(filter) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ const filterByRange = filter;
126
+ if (filterByRange.fromBlock)
127
+ filterByRange.fromBlock = prepBlockTag(filterByRange.fromBlock);
128
+ if (filterByRange.toBlock)
129
+ filterByRange.toBlock = prepBlockTag(filterByRange.toBlock);
130
+ const rpcLogs = (yield this.post(buildRPCPostBody('eth_getLogs', [filter])));
131
+ const logs = rpcLogs.map((log) => cleanLog(log, false));
132
+ return logs;
133
+ });
134
+ }
135
+ call(transaction, blockTag = 'latest') {
136
+ return __awaiter(this, void 0, void 0, function* () {
137
+ if (transaction.gasPrice &&
138
+ (transaction.maxPriorityFeePerGas || transaction.maxFeePerGas)) {
139
+ logger.throwError('Cannot specify both "gasPrice" and ("maxPriorityFeePerGas" or "maxFeePerGas")', {
140
+ gasPrice: transaction.gasPrice,
141
+ maxFeePerGas: transaction.maxFeePerGas,
142
+ maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
143
+ });
144
+ }
145
+ if (transaction.maxFeePerGas && transaction.maxPriorityFeePerGas) {
146
+ logger.throwError('Cannot specify both "maxFeePerGas" and "maxPriorityFeePerGas"', {
147
+ maxFeePerGas: transaction.maxFeePerGas,
148
+ maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
149
+ });
150
+ }
151
+ blockTag = prepBlockTag(blockTag);
152
+ const rpcTransaction = prepareTransaction(transaction);
153
+ const transactionRes = (yield this.post(buildRPCPostBody('eth_call', [rpcTransaction, blockTag])));
154
+ return transactionRes;
155
+ });
156
+ }
101
157
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseProvider } from './BaseProvider';
2
- interface ConstructorOptions {
2
+ export interface ConstructorOptions {
3
3
  timeoutDuration?: number;
4
4
  }
5
5
  export declare class FallthroughProvider extends BaseProvider {
@@ -9,4 +9,3 @@ export declare class FallthroughProvider extends BaseProvider {
9
9
  constructor(rpcUrls: string[], options?: ConstructorOptions);
10
10
  post: (body: Record<string, unknown>) => Promise<any>;
11
11
  }
12
- export {};
@@ -119,6 +119,7 @@ declare const _default: {
119
119
  "222": string[];
120
120
  "225": string[];
121
121
  "226": string[];
122
+ "239": string[];
122
123
  "246": string[];
123
124
  "250": string[];
124
125
  "256": string[];
@@ -143,10 +144,14 @@ declare const _default: {
143
144
  "499": string[];
144
145
  "512": string[];
145
146
  "513": string[];
147
+ "534": string[];
146
148
  "555": string[];
147
149
  "558": string[];
148
150
  "588": string[];
151
+ "592": string[];
149
152
  "595": string[];
153
+ "596": string[];
154
+ "597": string[];
150
155
  "600": string[];
151
156
  "666": string[];
152
157
  "686": string[];
@@ -154,6 +159,7 @@ declare const _default: {
154
159
  "707": string[];
155
160
  "708": string[];
156
161
  "721": string[];
162
+ "776": string[];
157
163
  "777": string[];
158
164
  "787": string[];
159
165
  "788": string[];
@@ -197,18 +203,24 @@ declare const _default: {
197
203
  "1287": string[];
198
204
  "1288": string[];
199
205
  "1337": string[];
206
+ "1506": string[];
207
+ "1507": string[];
200
208
  "1618": string[];
201
209
  "1620": string[];
202
210
  "1657": string[];
203
211
  "1688": string[];
212
+ "1819": string[];
204
213
  "1856": string[];
205
214
  "1898": string[];
206
215
  "1984": string[];
207
216
  "1987": string[];
208
217
  "2001": string[];
218
+ "2008": string[];
219
+ "2009": string[];
209
220
  "2020": string[];
210
221
  "2021": string[];
211
222
  "2022": string[];
223
+ "2023": string[];
212
224
  "2025": string[];
213
225
  "2100": string[];
214
226
  "2101": string[];
@@ -219,6 +231,8 @@ declare const _default: {
219
231
  "2223": string[];
220
232
  "2559": string[];
221
233
  "2569": string[];
234
+ "2612": string[];
235
+ "2613": string[];
222
236
  "3000": string[];
223
237
  "3001": string[];
224
238
  "3331": string[];
@@ -231,6 +245,7 @@ declare const _default: {
231
245
  "3967": string[];
232
246
  "4002": string[];
233
247
  "4102": string[];
248
+ "4181": string[];
234
249
  "4689": string[];
235
250
  "4690": string[];
236
251
  "4918": string[];
@@ -254,6 +269,7 @@ declare const _default: {
254
269
  "8723": string[];
255
270
  "8724": string[];
256
271
  "8888": string[];
272
+ "8898": string[];
257
273
  "8995": string[];
258
274
  "9000": string[];
259
275
  "9001": string[];
@@ -264,6 +280,8 @@ declare const _default: {
264
280
  "10001": string[];
265
281
  "10101": string[];
266
282
  "10823": string[];
283
+ "10946": string[];
284
+ "10947": string[];
267
285
  "11111": string[];
268
286
  "11437": string[];
269
287
  "12051": string[];
@@ -274,10 +292,14 @@ declare const _default: {
274
292
  "19845": string[];
275
293
  "21337": string[];
276
294
  "21816": string[];
295
+ "22023": string[];
277
296
  "24484": string[];
278
297
  "24734": string[];
298
+ "26863": string[];
299
+ "30067": string[];
279
300
  "31102": string[];
280
301
  "31337": string[];
302
+ "32520": string[];
281
303
  "32659": string[];
282
304
  "39797": string[];
283
305
  "42069": string[];
@@ -309,6 +331,8 @@ declare const _default: {
309
331
  "70002": string[];
310
332
  "70103": string[];
311
333
  "71393": string[];
334
+ "71401": string[];
335
+ "71402": string[];
312
336
  "73799": string[];
313
337
  "78110": string[];
314
338
  "80001": string[];
@@ -345,7 +369,9 @@ declare const _default: {
345
369
  "333888": string[];
346
370
  "333999": string[];
347
371
  "421611": string[];
372
+ "432201": string[];
348
373
  "444900": string[];
374
+ "474142": string[];
349
375
  "512512": string[];
350
376
  "666666": string[];
351
377
  "888888": string[];
@@ -353,6 +379,7 @@ declare const _default: {
353
379
  "1313114": string[];
354
380
  "1313500": string[];
355
381
  "1337702": string[];
382
+ "1337802": string[];
356
383
  "2203181": string[];
357
384
  "7762959": string[];
358
385
  "11155111": string[];
@@ -363,6 +363,9 @@ export default {
363
363
  "226": [
364
364
  "TLA"
365
365
  ],
366
+ "239": [
367
+ "AITD"
368
+ ],
366
369
  "246": [
367
370
  "ewt"
368
371
  ],
@@ -435,6 +438,9 @@ export default {
435
438
  "513": [
436
439
  "aact"
437
440
  ],
441
+ "534": [
442
+ "CNDL"
443
+ ],
438
444
  "555": [
439
445
  "CLASS"
440
446
  ],
@@ -444,9 +450,18 @@ export default {
444
450
  "588": [
445
451
  "metis-stardust"
446
452
  ],
453
+ "592": [
454
+ "astr"
455
+ ],
447
456
  "595": [
448
457
  "maca"
449
458
  ],
459
+ "596": [
460
+ "tkar"
461
+ ],
462
+ "597": [
463
+ "taca"
464
+ ],
450
465
  "600": [
451
466
  "mesh-chain-testnet"
452
467
  ],
@@ -468,6 +483,9 @@ export default {
468
483
  "721": [
469
484
  "tfeth"
470
485
  ],
486
+ "776": [
487
+ "opc"
488
+ ],
471
489
  "777": [
472
490
  "cth"
473
491
  ],
@@ -597,6 +615,12 @@ export default {
597
615
  "1337": [
598
616
  "cennz-old"
599
617
  ],
618
+ "1506": [
619
+ "Sherpax"
620
+ ],
621
+ "1507": [
622
+ "Sherpax Testnet"
623
+ ],
600
624
  "1618": [
601
625
  "cate"
602
626
  ],
@@ -609,6 +633,9 @@ export default {
609
633
  "1688": [
610
634
  "LUDAN"
611
635
  ],
636
+ "1819": [
637
+ "cubet"
638
+ ],
612
639
  "1856": [
613
640
  "tsf"
614
641
  ],
@@ -624,6 +651,12 @@ export default {
624
651
  "2001": [
625
652
  "milkAda"
626
653
  ],
654
+ "2008": [
655
+ "cloudwalk_testnet"
656
+ ],
657
+ "2009": [
658
+ "cloudwalk_mainnet"
659
+ ],
627
660
  "2020": [
628
661
  "420"
629
662
  ],
@@ -633,6 +666,9 @@ export default {
633
666
  "2022": [
634
667
  "edgt"
635
668
  ],
669
+ "2023": [
670
+ "taycan-testnet"
671
+ ],
636
672
  "2025": [
637
673
  "rpg"
638
674
  ],
@@ -663,6 +699,12 @@ export default {
663
699
  "2569": [
664
700
  "tpc"
665
701
  ],
702
+ "2612": [
703
+ "EZChain"
704
+ ],
705
+ "2613": [
706
+ "Fuji-EZChain"
707
+ ],
666
708
  "3000": [
667
709
  "cennz-r"
668
710
  ],
@@ -699,6 +741,9 @@ export default {
699
741
  "4102": [
700
742
  "aioz-testnet"
701
743
  ],
744
+ "4181": [
745
+ "PHI"
746
+ ],
702
747
  "4689": [
703
748
  "iotex-mainnet"
704
749
  ],
@@ -768,6 +813,9 @@ export default {
768
813
  "8888": [
769
814
  "ambrostestnet"
770
815
  ],
816
+ "8898": [
817
+ "mmt"
818
+ ],
771
819
  "8995": [
772
820
  "berg"
773
821
  ],
@@ -798,6 +846,12 @@ export default {
798
846
  "10823": [
799
847
  "CCP"
800
848
  ],
849
+ "10946": [
850
+ "quadrans"
851
+ ],
852
+ "10947": [
853
+ "quadranstestnet"
854
+ ],
801
855
  "11111": [
802
856
  "WAGMI"
803
857
  ],
@@ -826,7 +880,10 @@ export default {
826
880
  "cennz-a"
827
881
  ],
828
882
  "21816": [
829
- "oml"
883
+ "omc"
884
+ ],
885
+ "22023": [
886
+ "SFL"
830
887
  ],
831
888
  "24484": [
832
889
  "web"
@@ -834,12 +891,21 @@ export default {
834
891
  "24734": [
835
892
  "mintme"
836
893
  ],
894
+ "26863": [
895
+ "OAC"
896
+ ],
897
+ "30067": [
898
+ "Piece"
899
+ ],
837
900
  "31102": [
838
901
  "esn"
839
902
  ],
840
903
  "31337": [
841
904
  "got"
842
905
  ],
906
+ "32520": [
907
+ "Brise"
908
+ ],
843
909
  "32659": [
844
910
  "fsn"
845
911
  ],
@@ -874,7 +940,7 @@ export default {
874
940
  "ALFA"
875
941
  ],
876
942
  "45000": [
877
- "autobahn"
943
+ "Autobahn Network"
878
944
  ],
879
945
  "47805": [
880
946
  "REI"
@@ -933,6 +999,12 @@ export default {
933
999
  "71393": [
934
1000
  "ckb"
935
1001
  ],
1002
+ "71401": [
1003
+ "gw-testnet-v1"
1004
+ ],
1005
+ "71402": [
1006
+ "gw-mainnet-v1"
1007
+ ],
936
1008
  "73799": [
937
1009
  "vt"
938
1010
  ],
@@ -1041,9 +1113,15 @@ export default {
1041
1113
  "421611": [
1042
1114
  "arb-rinkeby"
1043
1115
  ],
1116
+ "432201": [
1117
+ "Dexalot"
1118
+ ],
1044
1119
  "444900": [
1045
1120
  "wlkt"
1046
1121
  ],
1122
+ "474142": [
1123
+ "oc"
1124
+ ],
1047
1125
  "512512": [
1048
1126
  "cmp"
1049
1127
  ],
@@ -1065,6 +1143,9 @@ export default {
1065
1143
  "1337702": [
1066
1144
  "kintsugi"
1067
1145
  ],
1146
+ "1337802": [
1147
+ "kiln"
1148
+ ],
1068
1149
  "2203181": [
1069
1150
  "platondev"
1070
1151
  ],
@@ -1180,6 +1261,6 @@ export default {
1180
1261
  "mole"
1181
1262
  ],
1182
1263
  "868455272153094": [
1183
- "gw-testnet-v1"
1264
+ "gw-testnet-v1-deprecated"
1184
1265
  ]
1185
1266
  };
@@ -1,7 +1,11 @@
1
1
  import Big from 'big.js';
2
+ import { hexToDecimal } from '../../classes/utils/hex-to-decimal';
2
3
  import { scientificStrToDecimalStr } from './helpers';
3
4
  export class TinyBig extends Big {
4
5
  constructor(value) {
6
+ if (typeof value === 'string' && value.startsWith('0x')) {
7
+ value = hexToDecimal(value);
8
+ }
5
9
  super(value);
6
10
  this.padAndChop = (str, padChar, length) => {
7
11
  return (Array(length).fill(padChar).join('') + str).slice(length * -1);
@@ -1,12 +1,16 @@
1
+ import { TinyBig } from './../shared/tiny-big/tiny-big';
1
2
  import { BlockTransactionResponse, RPCTransaction } from './Transaction.types';
2
3
  declare type Modify<T, R> = Omit<T, keyof R> & R;
3
4
  export declare type BlockResponse = Modify<RPCBlock, {
4
- gasLimit: number;
5
- gasUsed: number;
5
+ baseFeePerGas: TinyBig;
6
+ difficulty: TinyBig;
7
+ gasLimit: TinyBig;
8
+ gasUsed: TinyBig;
9
+ nonce: TinyBig;
6
10
  number: number;
7
- size: number;
8
- timestamp: number;
9
- baseFeePerGas: number;
11
+ size: TinyBig;
12
+ timestamp: TinyBig;
13
+ totalDifficulty: TinyBig;
10
14
  transactions: Array<string | BlockTransactionResponse>;
11
15
  }>;
12
16
  export interface RPCBlock {
@@ -28,9 +32,9 @@ export interface RPCBlock {
28
32
  stateRoot: string;
29
33
  timestamp: string;
30
34
  totalDifficulty: string;
31
- transactions: Array<string> | Array<RPCTransaction>;
35
+ transactions: Array<string | RPCTransaction>;
32
36
  transactionsRoot: string;
33
- uncles: unknown[];
37
+ uncles: Array<string>;
34
38
  }
35
39
  export declare type BlockTag = 'latest' | 'earliest' | 'pending' | number | string;
36
40
  export {};
@@ -0,0 +1,12 @@
1
+ import { BlockTag } from './Block.types';
2
+ export interface EventFilter {
3
+ address?: string;
4
+ topics?: Array<string | Array<string> | null>;
5
+ }
6
+ export interface Filter extends EventFilter {
7
+ fromBlock?: BlockTag;
8
+ toBlock?: BlockTag;
9
+ }
10
+ export interface FilterByBlockHash extends EventFilter {
11
+ blockHash?: string;
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,6 @@
1
+ import type Big from 'big.js';
1
2
  import { TinyBig } from '../shared/tiny-big/tiny-big';
3
+ import { BytesLike } from './../utils/bytes';
2
4
  declare type Modify<T, R> = Omit<T, keyof R> & R;
3
5
  export interface RPCTransaction extends RPCBlockTransaction {
4
6
  maxFeePerGas: string;
@@ -7,14 +9,14 @@ export interface RPCTransaction extends RPCBlockTransaction {
7
9
  export declare type TransactionResponse = Modify<RPCTransaction, {
8
10
  blockNumber: number;
9
11
  chainId: number;
10
- nonce: number;
12
+ gas: TinyBig;
13
+ gasLimit: TinyBig;
14
+ gasPrice: TinyBig;
15
+ nonce: TinyBig;
11
16
  transactionIndex: number;
12
17
  type: number;
13
18
  v: number;
14
19
  value: TinyBig;
15
- gasPrice: TinyBig;
16
- gas: TinyBig;
17
- gasLimit: TinyBig;
18
20
  } & {
19
21
  maxFeePerGas: TinyBig;
20
22
  maxPriorityFeePerGas: TinyBig;
@@ -33,7 +35,31 @@ export declare type TransactionReceipt = Modify<RPCTransactionReceipt, {
33
35
  byzantium: boolean;
34
36
  confirmations: number;
35
37
  }>;
36
- export declare type Log = Modify<Omit<RPCLog, 'removed'>, {
38
+ export interface RPCTransactionRequest {
39
+ from?: string;
40
+ to: string;
41
+ gas?: string;
42
+ gasPrice?: string;
43
+ value?: string;
44
+ data?: BytesLike;
45
+ nonce?: string;
46
+ maxPriorityFeePerGas?: string;
47
+ maxFeePerGas?: string;
48
+ }
49
+ export interface TransactionRequest {
50
+ to?: string;
51
+ from?: string;
52
+ nonce?: TinyBig | string | Big | number;
53
+ gas?: TinyBig | number | Big | string;
54
+ gasPrice?: TinyBig | Big | string | number;
55
+ data?: BytesLike;
56
+ value?: TinyBig | string | Big | number;
57
+ chainId?: number;
58
+ type?: number;
59
+ maxPriorityFeePerGas?: TinyBig | string | Big | number;
60
+ maxFeePerGas?: TinyBig | string | Big | number;
61
+ }
62
+ export declare type Log = Modify<RPCLog, {
37
63
  blockNumber: number;
38
64
  logIndex: number;
39
65
  transactionIndex: number;
@@ -0,0 +1 @@
1
+ export declare function computeAddress(key: string): string;
@@ -0,0 +1,11 @@
1
+ import { computePublicKey, toChecksumAddress } from '..';
2
+ import { hexDataSlice } from './bytes';
3
+ import { keccak256 } from './keccak256';
4
+ export function computeAddress(key) {
5
+ if (!key.startsWith('0x04') &&
6
+ !key.startsWith('0x03') &&
7
+ !key.startsWith('0x02')) {
8
+ key = computePublicKey(key);
9
+ }
10
+ return toChecksumAddress(hexDataSlice(keccak256(hexDataSlice(key, 1)), 12));
11
+ }
@@ -0,0 +1,2 @@
1
+ import { BytesLike } from './bytes';
2
+ export declare function computePublicKey(privKey: BytesLike): string;
@@ -0,0 +1,6 @@
1
+ import { Point } from '@noble/secp256k1';
2
+ import { hexlify } from './bytes';
3
+ export function computePublicKey(privKey) {
4
+ privKey = hexlify(privKey).slice(2);
5
+ return '0x' + Point.fromPrivateKey(privKey).toHex();
6
+ }
@@ -1,2 +1,2 @@
1
1
  import { BytesLike } from './bytes';
2
- export declare const keccak256: (data: BytesLike) => string;
2
+ export declare function keccak256(data: BytesLike): string;
@@ -1,5 +1,5 @@
1
1
  import { Keccak } from 'sha3';
2
- export const keccak256 = (data) => {
2
+ export function keccak256(data) {
3
3
  let bufferableData;
4
4
  if (typeof data === 'string') {
5
5
  bufferableData = Buffer.from(data.replace(/^0x/, ''), 'hex');
@@ -10,4 +10,4 @@ export const keccak256 = (data) => {
10
10
  const keccak = new Keccak(256);
11
11
  const addressHash = '0x' + keccak.update(bufferableData).digest('hex');
12
12
  return addressHash;
13
- };
13
+ }
@@ -0,0 +1,2 @@
1
+ import { Signature, SignatureLike } from './bytes';
2
+ export declare function splitSignature(signature: SignatureLike): Signature;