@toruslabs/ethereum-controllers 5.11.0 → 6.0.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 (111) hide show
  1. package/dist/ethereumControllers.cjs.js +80 -431
  2. package/dist/ethereumControllers.esm.js +30 -349
  3. package/dist/ethereumControllers.umd.min.js +1 -1
  4. package/dist/ethereumControllers.umd.min.js.LICENSE.txt +7 -2
  5. package/dist/lib.cjs/Account/AccountTrackerController.js +160 -0
  6. package/dist/lib.cjs/Block/PollingBlockTracker.js +85 -0
  7. package/dist/lib.cjs/Currency/CurrencyController.js +111 -0
  8. package/dist/lib.cjs/Gas/GasFeeController.js +214 -0
  9. package/dist/lib.cjs/Gas/gasUtil.js +148 -0
  10. package/dist/lib.cjs/Keyring/KeyringController.js +93 -0
  11. package/dist/lib.cjs/Message/AbstractMessageController.js +107 -0
  12. package/dist/lib.cjs/Message/AddChainController.js +78 -0
  13. package/dist/lib.cjs/Message/MessageController.js +77 -0
  14. package/dist/lib.cjs/Message/PersonalMessageController.js +77 -0
  15. package/dist/lib.cjs/Message/SwitchChainController.js +78 -0
  16. package/dist/lib.cjs/Message/TypedMessageController.js +81 -0
  17. package/dist/lib.cjs/Message/utils.js +112 -0
  18. package/dist/lib.cjs/Network/NetworkController.js +201 -0
  19. package/dist/lib.cjs/Network/cacheIdentifier.js +112 -0
  20. package/dist/lib.cjs/Network/createEthereumMiddleware.js +302 -0
  21. package/dist/lib.cjs/Network/createJsonRpcClient.js +64 -0
  22. package/dist/lib.cjs/Nfts/NftHandler.js +180 -0
  23. package/dist/lib.cjs/Nfts/NftsController.js +213 -0
  24. package/dist/lib.cjs/Preferences/PreferencesController.js +476 -0
  25. package/dist/lib.cjs/Tokens/TokenHandler.js +51 -0
  26. package/dist/lib.cjs/Tokens/TokenRatesController.js +112 -0
  27. package/dist/lib.cjs/Tokens/TokensController.js +259 -0
  28. package/dist/lib.cjs/Transaction/NonceTracker.js +150 -0
  29. package/dist/lib.cjs/Transaction/PendingTransactionTracker.js +222 -0
  30. package/dist/lib.cjs/Transaction/TransactionController.js +515 -0
  31. package/dist/lib.cjs/Transaction/TransactionGasUtil.js +81 -0
  32. package/dist/lib.cjs/Transaction/TransactionStateHistoryHelper.js +42 -0
  33. package/dist/lib.cjs/Transaction/TransactionStateManager.js +296 -0
  34. package/dist/lib.cjs/Transaction/TransactionUtils.js +341 -0
  35. package/dist/lib.cjs/index.js +171 -0
  36. package/dist/lib.cjs/utils/abis.js +510 -0
  37. package/dist/lib.cjs/utils/constants.js +362 -0
  38. package/dist/lib.cjs/utils/contractAddresses.js +16 -0
  39. package/dist/lib.cjs/utils/conversionUtils.js +232 -0
  40. package/dist/lib.cjs/utils/helpers.js +244 -0
  41. package/dist/lib.cjs/utils/lodashUtils.js +25 -0
  42. package/dist/lib.esm/Account/AccountTrackerController.js +158 -0
  43. package/dist/lib.esm/Block/PollingBlockTracker.js +83 -0
  44. package/dist/lib.esm/Currency/CurrencyController.js +109 -0
  45. package/dist/lib.esm/Gas/GasFeeController.js +212 -0
  46. package/dist/lib.esm/Gas/gasUtil.js +141 -0
  47. package/dist/lib.esm/Keyring/KeyringController.js +91 -0
  48. package/dist/lib.esm/Message/AbstractMessageController.js +105 -0
  49. package/dist/lib.esm/Message/AddChainController.js +76 -0
  50. package/dist/lib.esm/Message/MessageController.js +75 -0
  51. package/dist/lib.esm/Message/PersonalMessageController.js +75 -0
  52. package/dist/lib.esm/Message/SwitchChainController.js +76 -0
  53. package/dist/lib.esm/Message/TypedMessageController.js +79 -0
  54. package/dist/lib.esm/Message/utils.js +105 -0
  55. package/dist/lib.esm/Network/NetworkController.js +199 -0
  56. package/dist/lib.esm/Network/cacheIdentifier.js +107 -0
  57. package/dist/lib.esm/Network/createEthereumMiddleware.js +289 -0
  58. package/dist/lib.esm/Network/createJsonRpcClient.js +60 -0
  59. package/dist/lib.esm/Nfts/NftHandler.js +178 -0
  60. package/dist/lib.esm/Nfts/NftsController.js +211 -0
  61. package/dist/lib.esm/Preferences/PreferencesController.js +474 -0
  62. package/dist/lib.esm/Tokens/TokenHandler.js +49 -0
  63. package/dist/lib.esm/Tokens/TokenRatesController.js +109 -0
  64. package/dist/lib.esm/Tokens/TokensController.js +257 -0
  65. package/dist/lib.esm/Transaction/NonceTracker.js +148 -0
  66. package/dist/lib.esm/Transaction/PendingTransactionTracker.js +220 -0
  67. package/dist/lib.esm/Transaction/TransactionController.js +513 -0
  68. package/dist/lib.esm/Transaction/TransactionGasUtil.js +79 -0
  69. package/dist/lib.esm/Transaction/TransactionStateHistoryHelper.js +38 -0
  70. package/dist/lib.esm/Transaction/TransactionStateManager.js +294 -0
  71. package/dist/lib.esm/Transaction/TransactionUtils.js +326 -0
  72. package/dist/lib.esm/index.js +33 -0
  73. package/dist/lib.esm/utils/abis.js +505 -0
  74. package/dist/lib.esm/utils/constants.js +323 -0
  75. package/dist/lib.esm/utils/contractAddresses.js +14 -0
  76. package/dist/lib.esm/utils/conversionUtils.js +218 -0
  77. package/dist/lib.esm/utils/helpers.js +227 -0
  78. package/dist/lib.esm/utils/lodashUtils.js +21 -0
  79. package/dist/types/Account/AccountTrackerController.d.ts +5 -5
  80. package/dist/types/Block/PollingBlockTracker.d.ts +1 -2
  81. package/dist/types/Currency/CurrencyController.d.ts +1 -1
  82. package/dist/types/Gas/GasFeeController.d.ts +3 -3
  83. package/dist/types/Gas/gasUtil.d.ts +1 -1
  84. package/dist/types/Keyring/KeyringController.d.ts +3 -5
  85. package/dist/types/Message/AbstractMessageController.d.ts +5 -6
  86. package/dist/types/Message/AddChainController.d.ts +4 -4
  87. package/dist/types/Message/MessageController.d.ts +4 -4
  88. package/dist/types/Message/PersonalMessageController.d.ts +4 -4
  89. package/dist/types/Message/SwitchChainController.d.ts +4 -4
  90. package/dist/types/Message/TypedMessageController.d.ts +6 -7
  91. package/dist/types/Message/utils.d.ts +2 -7
  92. package/dist/types/Network/NetworkController.d.ts +4 -4
  93. package/dist/types/Network/cacheIdentifier.d.ts +1 -1
  94. package/dist/types/Network/createEthereumMiddleware.d.ts +2 -18
  95. package/dist/types/Network/createJsonRpcClient.d.ts +2 -2
  96. package/dist/types/Nfts/NftsController.d.ts +2 -2
  97. package/dist/types/Preferences/PreferencesController.d.ts +4 -4
  98. package/dist/types/Tokens/TokensController.d.ts +3 -3
  99. package/dist/types/Transaction/NonceTracker.d.ts +5 -5
  100. package/dist/types/Transaction/PendingTransactionTracker.d.ts +5 -5
  101. package/dist/types/Transaction/TransactionController.d.ts +12 -12
  102. package/dist/types/Transaction/TransactionGasUtil.d.ts +4 -4
  103. package/dist/types/Transaction/TransactionStateManager.d.ts +3 -3
  104. package/dist/types/Transaction/TransactionUtils.d.ts +1 -1
  105. package/dist/types/index.d.ts +12 -14
  106. package/dist/types/utils/constants.d.ts +1 -5
  107. package/dist/types/utils/helpers.d.ts +4 -4
  108. package/dist/types/utils/interfaces.d.ts +43 -23
  109. package/package.json +7 -7
  110. package/dist/types/Message/DecryptMessageController.d.ts +0 -20
  111. package/dist/types/Message/EncryptionPublicKeyController.d.ts +0 -20
@@ -0,0 +1,505 @@
1
+ const erc20Abi = [{
2
+ constant: true,
3
+ inputs: [],
4
+ name: "name",
5
+ outputs: [{
6
+ name: "",
7
+ type: "string"
8
+ }],
9
+ payable: false,
10
+ type: "function"
11
+ }, {
12
+ constant: false,
13
+ inputs: [{
14
+ name: "_spender",
15
+ type: "address"
16
+ }, {
17
+ name: "_value",
18
+ type: "uint256"
19
+ }],
20
+ name: "approve",
21
+ outputs: [{
22
+ name: "success",
23
+ type: "bool"
24
+ }],
25
+ payable: false,
26
+ type: "function"
27
+ }, {
28
+ constant: true,
29
+ inputs: [],
30
+ name: "totalSupply",
31
+ outputs: [{
32
+ name: "",
33
+ type: "uint256"
34
+ }],
35
+ payable: false,
36
+ type: "function"
37
+ }, {
38
+ constant: false,
39
+ inputs: [{
40
+ name: "_from",
41
+ type: "address"
42
+ }, {
43
+ name: "_to",
44
+ type: "address"
45
+ }, {
46
+ name: "_value",
47
+ type: "uint256"
48
+ }],
49
+ name: "transferFrom",
50
+ outputs: [{
51
+ name: "success",
52
+ type: "bool"
53
+ }],
54
+ payable: false,
55
+ type: "function"
56
+ }, {
57
+ constant: true,
58
+ inputs: [],
59
+ name: "decimals",
60
+ outputs: [{
61
+ name: "",
62
+ type: "uint256"
63
+ }],
64
+ payable: false,
65
+ type: "function"
66
+ }, {
67
+ constant: true,
68
+ inputs: [{
69
+ name: "_owner",
70
+ type: "address"
71
+ }],
72
+ name: "balanceOf",
73
+ outputs: [{
74
+ name: "balance",
75
+ type: "uint256"
76
+ }],
77
+ payable: false,
78
+ type: "function"
79
+ }, {
80
+ constant: true,
81
+ inputs: [],
82
+ name: "symbol",
83
+ outputs: [{
84
+ name: "",
85
+ type: "string"
86
+ }],
87
+ payable: false,
88
+ type: "function"
89
+ }, {
90
+ constant: false,
91
+ inputs: [{
92
+ name: "_to",
93
+ type: "address"
94
+ }, {
95
+ name: "_value",
96
+ type: "uint256"
97
+ }],
98
+ name: "transfer",
99
+ outputs: [{
100
+ name: "success",
101
+ type: "bool"
102
+ }],
103
+ payable: false,
104
+ type: "function"
105
+ }, {
106
+ constant: false,
107
+ inputs: [{
108
+ name: "_spender",
109
+ type: "address"
110
+ }, {
111
+ name: "_value",
112
+ type: "uint256"
113
+ }, {
114
+ name: "_extraData",
115
+ type: "bytes"
116
+ }],
117
+ name: "approveAndCall",
118
+ outputs: [{
119
+ name: "success",
120
+ type: "bool"
121
+ }],
122
+ payable: false,
123
+ type: "function"
124
+ }, {
125
+ constant: true,
126
+ inputs: [{
127
+ name: "_owner",
128
+ type: "address"
129
+ }, {
130
+ name: "_spender",
131
+ type: "address"
132
+ }],
133
+ name: "allowance",
134
+ outputs: [{
135
+ name: "remaining",
136
+ type: "uint256"
137
+ }],
138
+ payable: false,
139
+ type: "function"
140
+ }, {
141
+ inputs: [{
142
+ name: "_initialAmount",
143
+ type: "uint256"
144
+ }, {
145
+ name: "_tokenName",
146
+ type: "string"
147
+ }, {
148
+ name: "_decimalUnits",
149
+ type: "uint8"
150
+ }, {
151
+ name: "_tokenSymbol",
152
+ type: "string"
153
+ }],
154
+ type: "constructor"
155
+ }, {
156
+ payable: false,
157
+ type: "fallback"
158
+ }];
159
+ const erc721Abi = [{
160
+ constant: true,
161
+ inputs: [{
162
+ name: "interfaceID",
163
+ type: "bytes4"
164
+ }],
165
+ name: "supportsInterface",
166
+ outputs: [{
167
+ name: "",
168
+ type: "bool"
169
+ }],
170
+ payable: false,
171
+ stateMutability: "view",
172
+ type: "function"
173
+ }, {
174
+ constant: true,
175
+ inputs: [],
176
+ name: "name",
177
+ outputs: [{
178
+ name: "_name",
179
+ type: "string"
180
+ }],
181
+ payable: false,
182
+ stateMutability: "view",
183
+ type: "function"
184
+ }, {
185
+ constant: true,
186
+ inputs: [{
187
+ name: "_tokenId",
188
+ type: "uint256"
189
+ }],
190
+ name: "getApproved",
191
+ outputs: [{
192
+ name: "",
193
+ type: "address"
194
+ }],
195
+ payable: false,
196
+ stateMutability: "view",
197
+ type: "function"
198
+ }, {
199
+ constant: false,
200
+ inputs: [{
201
+ name: "_approved",
202
+ type: "address"
203
+ }, {
204
+ name: "_tokenId",
205
+ type: "uint256"
206
+ }],
207
+ name: "approve",
208
+ outputs: [],
209
+ payable: true,
210
+ stateMutability: "payable",
211
+ type: "function"
212
+ }, {
213
+ constant: true,
214
+ inputs: [],
215
+ name: "totalSupply",
216
+ outputs: [{
217
+ name: "",
218
+ type: "uint256"
219
+ }],
220
+ payable: false,
221
+ stateMutability: "view",
222
+ type: "function"
223
+ }, {
224
+ constant: false,
225
+ inputs: [{
226
+ name: "_from",
227
+ type: "address"
228
+ }, {
229
+ name: "_to",
230
+ type: "address"
231
+ }, {
232
+ name: "_tokenId",
233
+ type: "uint256"
234
+ }],
235
+ name: "transferFrom",
236
+ outputs: [],
237
+ payable: true,
238
+ stateMutability: "payable",
239
+ type: "function"
240
+ }, {
241
+ constant: true,
242
+ inputs: [{
243
+ name: "_owner",
244
+ type: "address"
245
+ }, {
246
+ name: "_index",
247
+ type: "uint256"
248
+ }],
249
+ name: "tokenOfOwnerByIndex",
250
+ outputs: [{
251
+ name: "",
252
+ type: "uint256"
253
+ }],
254
+ payable: false,
255
+ stateMutability: "view",
256
+ type: "function"
257
+ }, {
258
+ constant: false,
259
+ inputs: [{
260
+ name: "_from",
261
+ type: "address"
262
+ }, {
263
+ name: "_to",
264
+ type: "address"
265
+ }, {
266
+ name: "_tokenId",
267
+ type: "uint256"
268
+ }],
269
+ name: "safeTransferFrom",
270
+ outputs: [],
271
+ payable: true,
272
+ stateMutability: "payable",
273
+ type: "function"
274
+ }, {
275
+ constant: true,
276
+ inputs: [{
277
+ name: "_index",
278
+ type: "uint256"
279
+ }],
280
+ name: "tokenByIndex",
281
+ outputs: [{
282
+ name: "",
283
+ type: "uint256"
284
+ }],
285
+ payable: false,
286
+ stateMutability: "view",
287
+ type: "function"
288
+ }, {
289
+ constant: true,
290
+ inputs: [{
291
+ name: "_tokenId",
292
+ type: "uint256"
293
+ }],
294
+ name: "ownerOf",
295
+ outputs: [{
296
+ name: "",
297
+ type: "address"
298
+ }],
299
+ payable: false,
300
+ stateMutability: "view",
301
+ type: "function"
302
+ }, {
303
+ constant: true,
304
+ inputs: [{
305
+ name: "_owner",
306
+ type: "address"
307
+ }],
308
+ name: "balanceOf",
309
+ outputs: [{
310
+ name: "",
311
+ type: "uint256"
312
+ }],
313
+ payable: false,
314
+ stateMutability: "view",
315
+ type: "function"
316
+ }, {
317
+ constant: true,
318
+ inputs: [],
319
+ name: "symbol",
320
+ outputs: [{
321
+ name: "_symbol",
322
+ type: "string"
323
+ }],
324
+ payable: false,
325
+ stateMutability: "view",
326
+ type: "function"
327
+ }, {
328
+ constant: true,
329
+ inputs: [{
330
+ name: "_tokenId",
331
+ type: "uint256"
332
+ }],
333
+ name: "tokenURI",
334
+ outputs: [{
335
+ name: "",
336
+ type: "string"
337
+ }],
338
+ payable: false,
339
+ stateMutability: "view",
340
+ type: "function"
341
+ }];
342
+ const erc1155Abi = [{
343
+ inputs: [{
344
+ internalType: "address",
345
+ name: "_owner",
346
+ type: "address"
347
+ }, {
348
+ internalType: "uint256",
349
+ name: "_id",
350
+ type: "uint256"
351
+ }],
352
+ name: "balanceOf",
353
+ outputs: [{
354
+ internalType: "uint256",
355
+ name: "",
356
+ type: "uint256"
357
+ }],
358
+ stateMutability: "view",
359
+ type: "function"
360
+ }, {
361
+ inputs: [{
362
+ internalType: "address[]",
363
+ name: "_owners",
364
+ type: "address[]"
365
+ }, {
366
+ internalType: "uint256[]",
367
+ name: "_ids",
368
+ type: "uint256[]"
369
+ }],
370
+ name: "balanceOfBatch",
371
+ outputs: [{
372
+ internalType: "uint256[]",
373
+ name: "",
374
+ type: "uint256[]"
375
+ }],
376
+ stateMutability: "view",
377
+ type: "function"
378
+ }, {
379
+ inputs: [{
380
+ internalType: "address",
381
+ name: "_owner",
382
+ type: "address"
383
+ }, {
384
+ internalType: "address",
385
+ name: "_operator",
386
+ type: "address"
387
+ }],
388
+ name: "isApprovedForAll",
389
+ outputs: [{
390
+ internalType: "bool",
391
+ name: "isOperator",
392
+ type: "bool"
393
+ }],
394
+ stateMutability: "view",
395
+ type: "function"
396
+ }, {
397
+ inputs: [{
398
+ internalType: "address",
399
+ name: "_from",
400
+ type: "address"
401
+ }, {
402
+ internalType: "address",
403
+ name: "_to",
404
+ type: "address"
405
+ }, {
406
+ internalType: "uint256",
407
+ name: "_id",
408
+ type: "uint256"
409
+ }, {
410
+ internalType: "uint256",
411
+ name: "_amount",
412
+ type: "uint256"
413
+ }, {
414
+ internalType: "bytes",
415
+ name: "_data",
416
+ type: "bytes"
417
+ }],
418
+ name: "safeTransferFrom",
419
+ outputs: [],
420
+ stateMutability: "nonpayable",
421
+ type: "function"
422
+ }, {
423
+ inputs: [{
424
+ internalType: "address",
425
+ name: "_operator",
426
+ type: "address"
427
+ }, {
428
+ internalType: "bool",
429
+ name: "_approved",
430
+ type: "bool"
431
+ }],
432
+ name: "setApprovalForAll",
433
+ outputs: [],
434
+ stateMutability: "nonpayable",
435
+ type: "function"
436
+ }, {
437
+ inputs: [{
438
+ internalType: "bytes4",
439
+ name: "_interfaceID",
440
+ type: "bytes4"
441
+ }],
442
+ name: "supportsInterface",
443
+ outputs: [{
444
+ internalType: "bool",
445
+ name: "",
446
+ type: "bool"
447
+ }],
448
+ stateMutability: "pure",
449
+ type: "function"
450
+ }, {
451
+ inputs: [{
452
+ internalType: "uint256",
453
+ name: "_id",
454
+ type: "uint256"
455
+ }],
456
+ name: "uri",
457
+ outputs: [{
458
+ internalType: "string",
459
+ name: "",
460
+ type: "string"
461
+ }],
462
+ stateMutability: "view",
463
+ type: "function"
464
+ }];
465
+ const singleBalanceCheckerAbi = [{
466
+ payable: true,
467
+ stateMutability: "payable",
468
+ type: "fallback"
469
+ }, {
470
+ constant: true,
471
+ inputs: [{
472
+ name: "user",
473
+ type: "address"
474
+ }, {
475
+ name: "token",
476
+ type: "address"
477
+ }],
478
+ name: "tokenBalance",
479
+ outputs: [{
480
+ name: "",
481
+ type: "uint256"
482
+ }],
483
+ payable: false,
484
+ stateMutability: "view",
485
+ type: "function"
486
+ }, {
487
+ constant: true,
488
+ inputs: [{
489
+ name: "users",
490
+ type: "address[]"
491
+ }, {
492
+ name: "tokens",
493
+ type: "address[]"
494
+ }],
495
+ name: "balances",
496
+ outputs: [{
497
+ name: "",
498
+ type: "uint256[]"
499
+ }],
500
+ payable: false,
501
+ stateMutability: "view",
502
+ type: "function"
503
+ }];
504
+
505
+ export { erc1155Abi, erc20Abi, erc721Abi, singleBalanceCheckerAbi };