@exodus/ethereum-api 2.8.5 → 2.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "2.8.5",
3
+ "version": "2.10.0",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -27,5 +27,5 @@
27
27
  "@exodus/assets-base": "^8.0.136",
28
28
  "@exodus/models": "^8.7.2"
29
29
  },
30
- "gitHead": "08478f10b621f7ef9878bdd680d5894b001e3911"
30
+ "gitHead": "fa2d1c7768055ffc7b374663d0c4afd7326e1eee"
31
31
  }
@@ -184,5 +184,45 @@ export function create(defaultURL) {
184
184
  applyPending,
185
185
  })
186
186
  },
187
+
188
+ async getCoinbase() {
189
+ return request('proxy', {
190
+ method: 'eth_coinbase',
191
+ })
192
+ },
193
+
194
+ async getBlockByHash(blockHash, fullTx = false) {
195
+ return request('proxy', {
196
+ method: 'eth_getBlockByHash',
197
+ blockHash,
198
+ fullTx,
199
+ })
200
+ },
201
+
202
+ async getBlockTransactionCountByHash(blockHash) {
203
+ return request('proxy', {
204
+ method: 'eth_getBlockTransactionCountByHash',
205
+ blockHash,
206
+ })
207
+ },
208
+
209
+ async getBlockTransactionCountByNumber(quantityOrTag) {
210
+ return request('proxy', {
211
+ method: 'eth_getBlockTransactionCountByNumber',
212
+ quantityOrTag,
213
+ })
214
+ },
215
+
216
+ async getCompilers() {
217
+ return request('proxy', {
218
+ method: 'eth_getCompilers',
219
+ })
220
+ },
221
+
222
+ async getNetVersion() {
223
+ return request('proxy', {
224
+ method: 'net_version',
225
+ })
226
+ },
187
227
  }
188
228
  }
@@ -0,0 +1,612 @@
1
+ export default {
2
+ '0x7675e3041f918d49c03030ca0efb6325af8cf806': [
3
+ [
4
+ {
5
+ blockHash: '0xe7f50b7bfedf28315525811043ba0f2ac7117596e4fd04cba9a7369dab21411e',
6
+ blockNumber: '0xd4e85f',
7
+ timestamp: '0x61d721b2',
8
+ confirmations: 902631,
9
+ hash: '0x9f9657d95f5c0b556e7bdac50e34051e8d771091f2e2815403fee058ef3c9b84',
10
+ nonce: '0x21c700',
11
+ gasPrice: '0x425b52e200',
12
+ gas: '0x32918',
13
+ gasUsed: '0x5208',
14
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
15
+ from: '0x56eddb7aa87536c09ccc2793473599fd21a8b17f',
16
+ value: '0x8a71a743f9ec00',
17
+ status: 1,
18
+ error: null,
19
+ internal: [],
20
+ erc20: [],
21
+ erc721: [],
22
+ data: '0x',
23
+ },
24
+ {
25
+ blockHash: '0xb152be9cc244c3caba0686a775f5ba5c526a91337d6055edad182d7e02b111f5',
26
+ blockNumber: '0xd6ff7e',
27
+ timestamp: '0x61f30caa',
28
+ confirmations: 765640,
29
+ hash: '0x93adb877defd5f7fe7004762ca216c863bb7cce82b092a4dc6575e22a3f91bbb',
30
+ nonce: '0x0',
31
+ gasPrice: '0x24f2875958',
32
+ gas: '0x5208',
33
+ gasUsed: '0x5208',
34
+ to: '0x9573b4b23eb7f310e3767cf5d0c5baea485974e0',
35
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
36
+ value: '0x3c3816ce775584',
37
+ status: 1,
38
+ error: null,
39
+ internal: [],
40
+ erc20: [],
41
+ erc721: [],
42
+ data: '0x',
43
+ },
44
+ {
45
+ blockHash: '0x107fba1d82d1ab4cdd2d87f359e8d01cf8b4f0397c76b2068437507ae862bc64',
46
+ blockNumber: '0xd6ff84',
47
+ timestamp: '0x61f30ce2',
48
+ confirmations: 765634,
49
+ hash: '0x6ae4e8e3d2f6b62f7ca018c917ea7693919dfef7885fac48278ac03c311cf2aa',
50
+ nonce: '0x0',
51
+ gasPrice: '0x3416843e95',
52
+ gas: '0x5208',
53
+ gasUsed: '0x5208',
54
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
55
+ from: '0x9573b4b23eb7f310e3767cf5d0c5baea485974e0',
56
+ value: '0x2b873fbe49a6dc',
57
+ status: 1,
58
+ error: null,
59
+ internal: [],
60
+ erc20: [],
61
+ erc721: [],
62
+ data: '0x',
63
+ },
64
+ {
65
+ blockHash: '0x70fb122c2488d152b27e10b39404e108625540acd1f322a70a6c3f673c62bf8a',
66
+ blockNumber: '0xd6ffb3',
67
+ timestamp: '0x61f30f40',
68
+ confirmations: 765587,
69
+ hash: '0x743642daad3fe7b57af15ef8c09b3163d4d5ff2550ec06d612a08ded79cb59e6',
70
+ nonce: '0x1',
71
+ gasPrice: '0x20249c56e7',
72
+ gas: '0x5208',
73
+ gasUsed: '0x5208',
74
+ to: '0x9573b4b23eb7f310e3767cf5d0c5baea485974e0',
75
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
76
+ value: '0x2eeee2cdaf4ec0',
77
+ status: 1,
78
+ error: null,
79
+ internal: [],
80
+ erc20: [],
81
+ erc721: [],
82
+ data: '0x',
83
+ },
84
+ {
85
+ blockHash: '0x5da39cc22fd2997c6295f607caa042cafb863d108f5f68b6cfa5dc328c117f91',
86
+ blockNumber: '0xd6ffb5',
87
+ timestamp: '0x61f30f70',
88
+ confirmations: 765585,
89
+ hash: '0x47d9a88e2cdc094f92c95a122ee17248c18731bb00ae822f6ed75d14913c4076',
90
+ nonce: '0x1',
91
+ gasPrice: '0x3214b83de3',
92
+ gas: '0x5208',
93
+ gasUsed: '0x5208',
94
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
95
+ from: '0x9573b4b23eb7f310e3767cf5d0c5baea485974e0',
96
+ value: '0x1ee2af241aa9a8',
97
+ status: 1,
98
+ error: null,
99
+ internal: [],
100
+ erc20: [],
101
+ erc721: [],
102
+ data: '0x',
103
+ },
104
+ {
105
+ blockHash: '0x219c62e5125976079bf3e873425423552cc2fa9a3636757d58cc7bb5bf69ecc9',
106
+ blockNumber: '0xddc67b',
107
+ timestamp: '0x624dee95',
108
+ confirmations: 321483,
109
+ hash: '0x47c3aa173191cd199f82144a382309297b7fd85b197a272b5e66a394c0ac7445',
110
+ nonce: '0x2',
111
+ gasPrice: '0x10ce3de5dc',
112
+ gas: '0x5208',
113
+ gasUsed: '0x5208',
114
+ to: '0xc0e9573c1168a7a4198a0f63ac70fd8f62b291d0',
115
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
116
+ value: '0x4e2e741d164168',
117
+ status: 1,
118
+ error: null,
119
+ internal: [],
120
+ erc20: [],
121
+ erc721: [],
122
+ data: '0x',
123
+ },
124
+ {
125
+ blockHash: '0x1e4f080c86767069162c151fcb65456e6c3232e9612001243bba5d84bb1b4ff3',
126
+ blockNumber: '0xddc692',
127
+ timestamp: '0x624deff4',
128
+ confirmations: 321460,
129
+ hash: '0xb0cccf530f5b1ccad6423c2fba7e1b8e3be6c2b13850c2a335a7dc004f2633d2',
130
+ nonce: '0x224d5',
131
+ gasPrice: '0xd7bbf0858',
132
+ gas: '0x5208',
133
+ gasUsed: '0x5208',
134
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
135
+ from: '0x24ba1542f8a0a20e8251d096213384cfb0ee3dbc',
136
+ value: '0x165ddb003b4e8b0',
137
+ status: 1,
138
+ error: null,
139
+ internal: [],
140
+ erc20: [],
141
+ erc721: [],
142
+ data: '0x',
143
+ },
144
+ {
145
+ blockHash: '0xa33a0d12496c8e0c20242da25d02a9e9050955964444b7cef139fb2e0cb1fd33',
146
+ blockNumber: '0xddc695',
147
+ timestamp: '0x624df02f',
148
+ confirmations: 321457,
149
+ hash: '0x6cc050b80aa3b9277321cc044d44da66e6ff8ad422da38578e96babaa437e5b3',
150
+ nonce: '0x3',
151
+ gasPrice: '0xf5de58f95',
152
+ gas: '0x5208',
153
+ gasUsed: '0x5208',
154
+ to: '0xc0e9573c1168a7a4198a0f63ac70fd8f62b291d0',
155
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
156
+ value: '0xafe7115f4f7844',
157
+ status: 1,
158
+ error: null,
159
+ internal: [],
160
+ erc20: [],
161
+ erc721: [],
162
+ data: '0x',
163
+ },
164
+ {
165
+ blockHash: '0x8e1360db321441936ee2b2edf9f1df45d996b5dc07ea4495648a9c40760eced4',
166
+ blockNumber: '0xe048df',
167
+ timestamp: '0x626fe579',
168
+ confirmations: 157031,
169
+ hash: '0x368ef9e498d6625f7b9865e96ded30ba53bd5b142b3f10249d17d78135791584',
170
+ nonce: '0x4',
171
+ gasPrice: '0xd247c8f6f',
172
+ gas: '0x5208',
173
+ gasUsed: '0x5208',
174
+ to: '0xe4bbea19ada11c61d52a3b8849206642267a92d7',
175
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
176
+ value: '0x12d1db79fb2d10',
177
+ status: 1,
178
+ error: null,
179
+ internal: [],
180
+ erc20: [],
181
+ erc721: [],
182
+ data: '0x',
183
+ },
184
+ {
185
+ blockHash: '0xb469ebc890716bb01caa346970397b039061c46b7cc65f3380ad362d315b5a54',
186
+ blockNumber: '0xe048f4',
187
+ timestamp: '0x626fe624',
188
+ confirmations: 157010,
189
+ hash: '0x44fe624c01d6d23f6f9e6e5d67b0b38a09d07c0aacfd2faacfc3361adba3633c',
190
+ nonce: '0x5',
191
+ gasPrice: '0xa1cd49d4d',
192
+ gas: '0x5208',
193
+ gasUsed: '0x5208',
194
+ to: '0xe4bbea19ada11c61d52a3b8849206642267a92d7',
195
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
196
+ value: '0x1f64dd2ba8a0c3',
197
+ status: 1,
198
+ error: null,
199
+ internal: [],
200
+ erc20: [],
201
+ erc721: [],
202
+ data: '0x',
203
+ },
204
+ {
205
+ blockHash: '0xa6da629419f2a1acf1370845d3464d048067e88feeb5429c0dd043b57cc7da35',
206
+ blockNumber: '0xe04927',
207
+ timestamp: '0x626fe87c',
208
+ confirmations: 156959,
209
+ hash: '0xa374cb7e17503255a2e7e0c607152aa355b052412dccea670ee40e277c0e1e8c',
210
+ nonce: '0x2bdb',
211
+ gasPrice: '0xcc94f0416',
212
+ gas: '0x5208',
213
+ gasUsed: '0x5208',
214
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
215
+ from: '0x601a74e9b89d8594d08b0e587f0c04c1f87fa162',
216
+ value: '0xaae2915d0bc800',
217
+ status: 1,
218
+ error: null,
219
+ internal: [],
220
+ erc20: [],
221
+ erc721: [],
222
+ data: '0x',
223
+ },
224
+ {
225
+ blockHash: '0x1e3d3b5d6786f3f90dadea424155be6f41be0360863bf156407a4870411ed3d4',
226
+ blockNumber: '0xe09910',
227
+ timestamp: '0x62743047',
228
+ confirmations: 136502,
229
+ hash: '0xf5bf8fe1e9f878c66cc3ac38db56259df9d3fd3d05f4cbf53e850c6e5e2bb175',
230
+ nonce: '0x6',
231
+ gasPrice: '0xee78079a3',
232
+ gas: '0x5208',
233
+ gasUsed: '0x5208',
234
+ to: '0xc0e9573c1168a7a4198a0f63ac70fd8f62b291d0',
235
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
236
+ value: '0x8e97d1d6a2e734',
237
+ status: 1,
238
+ error: null,
239
+ internal: [],
240
+ erc20: [],
241
+ erc721: [],
242
+ data: '0x',
243
+ },
244
+ {
245
+ blockHash: '0x74f27d6f75253def7265214929c24f21a703c89c543b5c9b88d25aeaac10e1b2',
246
+ blockNumber: '0xe09980',
247
+ timestamp: '0x627435ea',
248
+ confirmations: 136390,
249
+ hash: '0xee4b33bbb09b32b3c36737fe37dfd1b3ad6604a9b640a54357962b308046eee3',
250
+ nonce: '0x7',
251
+ gasPrice: '0xfeb4f8381',
252
+ gas: '0x5208',
253
+ gasUsed: '0x5208',
254
+ to: '0x92687b7f5fd09cf364ab50eade3e42a87a8af419',
255
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
256
+ value: '0x444ef1324eba16',
257
+ status: 1,
258
+ error: null,
259
+ internal: [],
260
+ erc20: [],
261
+ erc721: [],
262
+ data: '0x',
263
+ },
264
+ {
265
+ blockHash: '0x70f072ff6c574508373f2aa206d8c0bb661571d098b9d68eff6b23d63aa44ea4',
266
+ blockNumber: '0xe09998',
267
+ timestamp: '0x62743709',
268
+ confirmations: 136366,
269
+ hash: '0xeadf5f9ff5a95675e179a99757c63febaadad477574d9a3382dce2b6403108c3',
270
+ nonce: '0x6',
271
+ gasPrice: '0xc4760086c',
272
+ gas: '0xdae6',
273
+ gasUsed: '0xc826',
274
+ to: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18',
275
+ from: '0x92687b7f5fd09cf364ab50eade3e42a87a8af419',
276
+ value: '0x0',
277
+ status: 1,
278
+ error: null,
279
+ internal: [],
280
+ erc20: [
281
+ {
282
+ events: true,
283
+ address: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18',
284
+ from: '0x92687b7f5fd09cf364ab50eade3e42a87a8af419',
285
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
286
+ value: '0x1a53b5e52e6aa039a4',
287
+ },
288
+ ],
289
+ erc721: [],
290
+ data:
291
+ '0xa9059cbb0000000000000000000000007675e3041f918d49c03030ca0efb6325af8cf80600000000000000000000000000000000000000000000001a53b5e52e6aa039a4',
292
+ },
293
+ {
294
+ blockHash: '0x8ef71d8700630431b25730e3888fd6d6befeff281a9f04e0e91dd4676692602f',
295
+ blockNumber: '0xe099b2',
296
+ timestamp: '0x6274385e',
297
+ confirmations: 136340,
298
+ hash: '0x9ffbe7ab90b62fcfda5df2e545420f2de90c64b2b811188661a46cbb11716999',
299
+ nonce: '0x8',
300
+ gasPrice: '0xf87899ac9',
301
+ gas: '0x106ad',
302
+ gasUsed: '0xc826',
303
+ to: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18',
304
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
305
+ value: '0x0',
306
+ status: 1,
307
+ error: null,
308
+ internal: [],
309
+ erc20: [
310
+ {
311
+ events: true,
312
+ address: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18',
313
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
314
+ to: '0x92687b7f5fd09cf364ab50eade3e42a87a8af419',
315
+ value: '0x1a53b5e52e6aa039a4',
316
+ },
317
+ ],
318
+ erc721: [],
319
+ data:
320
+ '0xa9059cbb00000000000000000000000092687b7f5fd09cf364ab50eade3e42a87a8af41900000000000000000000000000000000000000000000001a53b5e52e6aa039a4',
321
+ },
322
+ {
323
+ blockHash: '0x63e85063fe0a4005da64f53ee4f7a527db9505ec1723e22f4ff1691856f195f1',
324
+ blockNumber: '0xe099b6',
325
+ timestamp: '0x62743890',
326
+ confirmations: 136336,
327
+ hash: '0x5a8721ff2985a4ef84fc8e8c9ffc88c2c6b8158b812e21e9bf26d092251d4e09',
328
+ nonce: '0x7',
329
+ gasPrice: '0xab94f3d4a',
330
+ gas: '0xdae6',
331
+ gasUsed: '0xc826',
332
+ to: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18',
333
+ from: '0x92687b7f5fd09cf364ab50eade3e42a87a8af419',
334
+ value: '0x0',
335
+ status: 1,
336
+ error: null,
337
+ internal: [],
338
+ erc20: [
339
+ {
340
+ events: true,
341
+ address: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18',
342
+ from: '0x92687b7f5fd09cf364ab50eade3e42a87a8af419',
343
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
344
+ value: '0x1a53b5e52e6aa039a4',
345
+ },
346
+ ],
347
+ erc721: [],
348
+ data:
349
+ '0xa9059cbb0000000000000000000000007675e3041f918d49c03030ca0efb6325af8cf80600000000000000000000000000000000000000000000001a53b5e52e6aa039a4',
350
+ },
351
+ {
352
+ blockHash: '0x52fd3dfc4455831abccb25fbe5a6aa59f8118c640e42e62c9f83aeac536e105d',
353
+ blockNumber: '0xe0fbcd',
354
+ timestamp: '0x62797cdb',
355
+ confirmations: 111225,
356
+ hash: '0xfd7377f16fc628a386334b7722e0098443890bb96a1d60e5a128dc34256ea0e6',
357
+ nonce: '0x9',
358
+ gasPrice: '0x13463b7579',
359
+ gas: '0x5208',
360
+ gasUsed: '0x5208',
361
+ to: '0x3f597effc6f03bc7d987d07d31af12838fdd8c73',
362
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
363
+ value: '0x3329b7be681409',
364
+ status: 1,
365
+ error: null,
366
+ internal: [],
367
+ erc20: [],
368
+ erc721: [],
369
+ data: '0x',
370
+ },
371
+ {
372
+ blockHash: '0xf1a473f4b67f762d4bcbef4483e00f9dca026508dd398c78e76d5bc08d831a12',
373
+ blockNumber: '0xe0fbe9',
374
+ timestamp: '0x62797e39',
375
+ confirmations: 111197,
376
+ hash: '0xadaf7134295f65add881d956d4552c6428628c507b6dade2b35a84fc0dd4856e',
377
+ nonce: '0x13204e',
378
+ gasPrice: '0x137ea1c45a',
379
+ gas: '0x32918',
380
+ gasUsed: '0x5208',
381
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
382
+ from: '0x4976a4a02f38326660d17bf34b431dc6e2eb2327',
383
+ value: '0xf95f8fb3a74800',
384
+ status: 1,
385
+ error: null,
386
+ internal: [],
387
+ erc20: [],
388
+ erc721: [],
389
+ data: '0x',
390
+ },
391
+ {
392
+ blockHash: '0x08569afe39e903eecfbf19ea03f008e3358278eaceb23948b70fc6a339424938',
393
+ blockNumber: '0xe0fc06',
394
+ timestamp: '0x62797fe8',
395
+ confirmations: 111168,
396
+ hash: '0x389fca58294fb688a26b6e85bdc64ee5b0bb7fe02c33085f2bb40b1c5faaf862',
397
+ nonce: '0xa',
398
+ gasPrice: '0x1410588f51',
399
+ gas: '0x5208',
400
+ gasUsed: '0x5208',
401
+ to: '0x3f597effc6f03bc7d987d07d31af12838fdd8c73',
402
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
403
+ value: '0x781f63e624c700',
404
+ status: 1,
405
+ error: null,
406
+ internal: [],
407
+ erc20: [],
408
+ erc721: [],
409
+ data: '0x',
410
+ },
411
+ {
412
+ blockHash: '0x10edead9b7364590451231fe669878152fb0fa064f4e38a35772553b630f7c6f',
413
+ blockNumber: '0xe0fc09',
414
+ timestamp: '0x6279802f',
415
+ confirmations: 111165,
416
+ hash: '0x8fb94cad50c6239d1dfd8dec528dc3c86bb1ab7b267b380ad67b8b5632fa240f',
417
+ nonce: '0xb',
418
+ gasPrice: '0x1c2c14aa30',
419
+ gas: '0x106ad',
420
+ gasUsed: '0xc826',
421
+ to: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18',
422
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
423
+ value: '0x0',
424
+ status: 1,
425
+ error: null,
426
+ internal: [],
427
+ erc20: [
428
+ {
429
+ events: true,
430
+ address: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18',
431
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
432
+ to: '0x3f597effc6f03bc7d987d07d31af12838fdd8c73',
433
+ value: '0x1a53b5e52e6aa039a4',
434
+ },
435
+ ],
436
+ erc721: [],
437
+ data:
438
+ '0xa9059cbb0000000000000000000000003f597effc6f03bc7d987d07d31af12838fdd8c7300000000000000000000000000000000000000000000001a53b5e52e6aa039a4',
439
+ },
440
+ {
441
+ blockHash: '0x5edb831ef344c0bc798bbcb8b760a3658fb1f5ad46f642b0a7754b4e1e5c65fc',
442
+ blockNumber: '0xe0fc13',
443
+ timestamp: '0x62798100',
444
+ confirmations: 111155,
445
+ hash: '0x46cacdc4857d3115cc1a6e20d02569312815142e8eb963e0359b502312c4c9d1',
446
+ nonce: '0x0',
447
+ gasPrice: '0x22694740c0',
448
+ gas: '0x106ad',
449
+ gasUsed: '0xc826',
450
+ to: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18',
451
+ from: '0x3f597effc6f03bc7d987d07d31af12838fdd8c73',
452
+ value: '0x0',
453
+ status: 1,
454
+ error: null,
455
+ internal: [],
456
+ erc20: [
457
+ {
458
+ events: true,
459
+ address: '0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18',
460
+ from: '0x3f597effc6f03bc7d987d07d31af12838fdd8c73',
461
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
462
+ value: '0x1a53b5e52e6aa039a4',
463
+ },
464
+ ],
465
+ erc721: [],
466
+ data:
467
+ '0xa9059cbb0000000000000000000000007675e3041f918d49c03030ca0efb6325af8cf80600000000000000000000000000000000000000000000001a53b5e52e6aa039a4',
468
+ },
469
+ {
470
+ blockHash: '0x1a99714626ebf65d916d8ae07e14cb5a0f9d937c38a8ae3f11f5e005abc40ceb',
471
+ blockNumber: '0xe0fc1a',
472
+ timestamp: '0x62798194',
473
+ confirmations: 111148,
474
+ hash: '0x0bd859932bd01696495cde3c3d44e66a1245979d7ccb1371d2be11bf9c29ce43',
475
+ nonce: '0x1',
476
+ gasPrice: '0x22694740c0',
477
+ gas: '0x5208',
478
+ gasUsed: '0x5208',
479
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
480
+ from: '0x3f597effc6f03bc7d987d07d31af12838fdd8c73',
481
+ value: '0x855af43c6bb889',
482
+ status: 1,
483
+ error: null,
484
+ internal: [],
485
+ erc20: [],
486
+ erc721: [],
487
+ data: '0x',
488
+ },
489
+ {
490
+ blockHash: '0x5e03da7c598c6b82f63d94c27453087c5053682d7ba523e68cc33be9fbd11b0d',
491
+ blockNumber: '0xe12c8d',
492
+ timestamp: '0x627c1d98',
493
+ confirmations: 98745,
494
+ hash: '0x0df25e10b74aecbde554f747129614a1c9064c371dd21a1b02c5a450dd24aa7e',
495
+ nonce: '0xc',
496
+ gasPrice: '0x2811a41069',
497
+ gas: '0x5208',
498
+ gasUsed: '0x5208',
499
+ to: '0xc0e9573c1168a7a4198a0f63ac70fd8f62b291d0',
500
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
501
+ value: '0x8e1bc9bf040000',
502
+ status: 1,
503
+ error: null,
504
+ internal: [],
505
+ erc20: [],
506
+ erc721: [],
507
+ data: '0x',
508
+ },
509
+ {
510
+ blockHash: '0x485bfac770189301a18de9349fa03f0bb65df62f545abcbf9123d1078d6e0ba3',
511
+ blockNumber: '0xe12d1e',
512
+ timestamp: '0x627c25a9',
513
+ confirmations: 98600,
514
+ hash: '0x11d494e74c89632b548f1575158b9c95c72f47c0a66a3d939e7f48daed5b5b38',
515
+ nonce: '0x37b6e5',
516
+ gasPrice: '0x4a19eb3428',
517
+ gas: '0x32918',
518
+ gasUsed: '0x5208',
519
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
520
+ from: '0x21a31ee1afc51d94c2efccaa2092ad1028285549',
521
+ value: '0xfc87b85ae87000',
522
+ status: 1,
523
+ error: null,
524
+ internal: [],
525
+ erc20: [],
526
+ erc721: [],
527
+ data: '0x',
528
+ },
529
+ {
530
+ blockHash: '0xfd89aa67c357e3e5d3de4ccaf70a8b4126ab1376634b45917b9c72b7c0071bfd',
531
+ blockNumber: '0xe1b7f2',
532
+ timestamp: '0x62839e4c',
533
+ confirmations: 63060,
534
+ hash: '0x762968149de2f325fb9dfb1ab7c82fc80bbe9e77960aa4ae0ad80c94bcd71107',
535
+ nonce: '0x8',
536
+ gasPrice: '0x72bc35082',
537
+ gas: '0x5208',
538
+ gasUsed: '0x5208',
539
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
540
+ from: '0x92687b7f5fd09cf364ab50eade3e42a87a8af419',
541
+ value: '0x1eaa7c444ec800',
542
+ status: 1,
543
+ error: null,
544
+ internal: [],
545
+ erc20: [],
546
+ erc721: [],
547
+ data: '0x',
548
+ },
549
+ {
550
+ blockHash: '0x4a0d9a936d65a431dc3ece07710576a0b31166efec156aa64c0c484e02ccad38',
551
+ blockNumber: '0xe1b831',
552
+ timestamp: '0x6283a160',
553
+ confirmations: 62997,
554
+ hash: '0xb24da14de82205b4d66cfbccbabd28057f5c37d6afc22f9982c71abdca0814c5',
555
+ nonce: '0xd',
556
+ gasPrice: '0x66e536cbc',
557
+ gas: '0x5208',
558
+ gasUsed: '0x5208',
559
+ to: '0x92687b7f5fd09cf364ab50eade3e42a87a8af419',
560
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
561
+ value: '0xb3e3c898c9c394',
562
+ status: 1,
563
+ error: null,
564
+ internal: [],
565
+ erc20: [],
566
+ erc721: [],
567
+ data: '0x',
568
+ },
569
+ {
570
+ blockHash: '0xcf1979480219415fb18752c05bbb9fd139498f0027f85111759e2504312b5d27',
571
+ blockNumber: '0xe1b837',
572
+ timestamp: '0x6283a1ac',
573
+ confirmations: 62991,
574
+ hash: '0x6082233e7b9bee56e7134291288a312f913496d00f00e0f03bbb563abcda2a1f',
575
+ nonce: '0x9',
576
+ gasPrice: '0x5fe9cd13c',
577
+ gas: '0x5208',
578
+ gasUsed: '0x5208',
579
+ to: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
580
+ from: '0x92687b7f5fd09cf364ab50eade3e42a87a8af419',
581
+ value: '0xb1a2bc2ec50000',
582
+ status: 1,
583
+ error: null,
584
+ internal: [],
585
+ erc20: [],
586
+ erc721: [],
587
+ data: '0x',
588
+ },
589
+ {
590
+ blockHash: '0x8440588f72b353ff9359607ff9308e89543f55b6d1a83f189e001c2a2c39b99e',
591
+ blockNumber: '0xe1eeb3',
592
+ timestamp: '0x6286989a',
593
+ confirmations: 49043,
594
+ hash: '0xe15047ee8fcf2910269f4d479b717633ad8fcf83adf8b455d0ea64822698dcc2',
595
+ nonce: '0xe',
596
+ gasPrice: '0x37a0a9801',
597
+ gas: '0x5208',
598
+ gasUsed: '0x5208',
599
+ to: '0x9fb290de80a7941bb371dad1f380648afac8fe75',
600
+ from: '0x7675e3041f918d49c03030ca0efb6325af8cf806',
601
+ value: '0xd3e245ea736400',
602
+ status: 1,
603
+ error: null,
604
+ internal: [],
605
+ erc20: [],
606
+ erc721: [],
607
+ data: '0x',
608
+ },
609
+ ],
610
+ [],
611
+ ],
612
+ }
@@ -5,6 +5,7 @@ import assetMap from './assets-for-test-helper'
5
5
  import { AccountState } from '@exodus/models'
6
6
  import { ethereum as feeData } from '@exodus/ethereum-lib/src/fee-data'
7
7
  import historyReturnValuesForTest from './ethereum-history-return-values-for-test-helper'
8
+ import historyReturnValuesUnknownToken from './ethereum-history-unknown-token-helper'
8
9
  import { size, cloneDeep } from 'lodash'
9
10
 
10
11
  const { ethereum } = assetMap
@@ -149,6 +150,86 @@ describe('ethereum monitor', () => {
149
150
  expect(monitor.timer.isRunning).toEqual(false)
150
151
  })
151
152
 
153
+ test('emits unknown-tokens events', async () => {
154
+ const publicKeys = {
155
+ ethereum: [
156
+ Buffer.from('03f583b2ccd8cc072baabecf9e124783d8112e0ee76b893e8b341e54d910729fbe', 'hex'),
157
+ Buffer.from('03ab984a086ae1c31207e642ce7c17b9f0811a1cdc66cbe8f78f940a646462b3a8', 'hex'),
158
+ ],
159
+ }
160
+ const assetClientInterface = createAssetClientInterface({
161
+ logger,
162
+ walletPublicKeys: publicKeys,
163
+ })
164
+
165
+ const getHistoryV2Returns = cloneDeep(historyReturnValuesUnknownToken)
166
+ const server = {
167
+ getURL() {
168
+ return 'https://mockMe'
169
+ },
170
+ ws: { watch: jest.fn(), events: { on: jest.fn() }, open: jest.fn() },
171
+
172
+ getHistoryV2: jest.fn((address) => {
173
+ const history = getHistoryV2Returns[address]
174
+ const txPage = history?.shift()
175
+ return Promise.resolve(txPage || [])
176
+ }),
177
+ }
178
+
179
+ const monitor = new EthereumMonitor({
180
+ interval: 20,
181
+ asset: ethereum,
182
+ assetClientInterface,
183
+ logger,
184
+ server: server,
185
+ })
186
+
187
+ const handler = jest.fn(() => {})
188
+ monitor.on('unknown-tokens', handler)
189
+
190
+ await monitor.start()
191
+ await monitor.stop()
192
+ expect(logger.warn).not.toBeCalled()
193
+ expect(logger.error).not.toBeCalled()
194
+
195
+ const toBalanceFromTx = (txSet) => {
196
+ return txSet.getMutations().slice(-1)[0].balance
197
+ }
198
+
199
+ // Sintax sugar
200
+ const txs = (walletAccount, assetName) => {
201
+ return assetClientInterface.getTxLog({ walletAccount, assetName })
202
+ }
203
+ const state = (walletAccount, assetName) => {
204
+ return assetClientInterface.getAccountState({ walletAccount, assetName })
205
+ }
206
+
207
+ const expectSameValue = (actual, expected) => {
208
+ expect(actual).toEqual(expected)
209
+ expect(actual.equals(expected)).toEqual(true)
210
+ }
211
+
212
+ expect((await txs('exodus0', 'ethereum')).size).toEqual(25)
213
+
214
+ expectSameValue(
215
+ toBalanceFromTx(await txs('exodus0', 'ethereum')),
216
+ ethereum.currency.defaultUnit('0.040838166275376413') // string due to floating error
217
+ )
218
+
219
+ // It seems eth balances and tokenBalances are not being filled. Clients needs to read tx like above
220
+ expectSameValue((await state('exodus0', 'ethereum')).balance, ethereum.currency.defaultUnit(0))
221
+ expect((await state('exodus0', 'ethereum')).tokenBalances).toEqual({})
222
+ expect(size(assetClientInterface.states)).toEqual(2)
223
+
224
+ expect(logger.error).not.toBeCalled()
225
+ expect(logger.warn).not.toBeCalled()
226
+ expect(monitor.timer.isRunning).toEqual(false)
227
+
228
+ // unknown token call checks
229
+ expect(handler.mock.calls.length).toBe(1)
230
+ expect(handler.mock.calls[0][0]).toEqual(['0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18'])
231
+ })
232
+
152
233
  test('validate address', () => {
153
234
  expect(encodePublic(walletPublicKeys.ethereum[0])).toEqual(
154
235
  '0x90E481d9A664ebbE4Be180d9501962255463036d'
@@ -153,13 +153,15 @@ export class EthereumMonitor extends BaseMonitor {
153
153
  const assetSource = { asset: this.asset.name, walletAccount }
154
154
 
155
155
  const derivedData = await this.deriveData({ assetSource, tokens })
156
+ const derivedIndex = derivedData.currentAccountState?.index
156
157
 
157
158
  const { allTransactionsFromServer, index } = await getHistoryFromServer({
158
159
  server: this.server,
159
160
  ourWalletAddress: derivedData.ourWalletAddress,
160
161
  minimumConfirmations: derivedData.minimumConfirmations,
161
- index: refresh ? 0 : derivedData.currentAccountState?.index ?? 0,
162
+ index: refresh ? 0 : derivedIndex ?? 0,
162
163
  })
164
+ const hasNewIndex = !derivedIndex || index > derivedIndex
163
165
 
164
166
  const logItemsByAsset = getAllLogItemsByAsset({
165
167
  ourWalletAddress: derivedData.ourWalletAddress,
@@ -186,6 +188,15 @@ export class EthereumMonitor extends BaseMonitor {
186
188
 
187
189
  await this.removeFromTxLog(txsToRemove)
188
190
  await this.updateTxLogByAsset({ logItemsByAsset, walletAccount, refresh })
191
+ if (refresh || hasNewIndex) {
192
+ const unknownTokenAddresses = this._getUnknownTokenAddresses({
193
+ transactions: allTransactionsFromServer,
194
+ tokensByAddress,
195
+ })
196
+ if (unknownTokenAddresses.length > 0) {
197
+ this.emit('unknown-tokens', unknownTokenAddresses)
198
+ }
199
+ }
189
200
  }
190
201
 
191
202
  async updateGasPrice(newGasPrice) {
@@ -244,6 +255,20 @@ export class EthereumMonitor extends BaseMonitor {
244
255
  })
245
256
  }
246
257
 
258
+ _getUnknownTokenAddresses({ transactions, tokensByAddress }) {
259
+ const set = transactions.reduce((acc, txn) => {
260
+ const transfers = txn.erc20 || []
261
+ transfers.forEach((transfer) => {
262
+ const addr = transfer.address.toLowerCase()
263
+ if (!tokensByAddress.has(addr)) {
264
+ acc.add(addr)
265
+ }
266
+ }, acc)
267
+ return acc
268
+ }, new Set())
269
+ return Array.from(set)
270
+ }
271
+
247
272
  async beforeStart() {
248
273
  const addressesByWalletAccount = await this.getReceiveAddressesByWalletAccount()
249
274
  enableWSUpdates({