@sentio/sdk 2.40.0-rc.16 → 2.40.0-rc.18

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 (55) hide show
  1. package/lib/eth/account-processor.d.ts +21 -7
  2. package/lib/eth/account-processor.d.ts.map +1 -1
  3. package/lib/eth/account-processor.js +2 -2
  4. package/lib/eth/account-processor.js.map +1 -1
  5. package/lib/eth/base-processor-template.d.ts +24 -8
  6. package/lib/eth/base-processor-template.d.ts.map +1 -1
  7. package/lib/eth/base-processor-template.js.map +1 -1
  8. package/lib/eth/base-processor.d.ts +30 -10
  9. package/lib/eth/base-processor.d.ts.map +1 -1
  10. package/lib/eth/base-processor.js +6 -6
  11. package/lib/eth/base-processor.js.map +1 -1
  12. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +24 -8
  13. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  14. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +23 -23
  15. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  16. package/lib/eth/builtin/internal/erc1155-processor.d.ts +24 -8
  17. package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
  18. package/lib/eth/builtin/internal/erc1155-processor.js +8 -8
  19. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  20. package/lib/eth/builtin/internal/erc20-processor.d.ts +18 -6
  21. package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
  22. package/lib/eth/builtin/internal/erc20-processor.js +18 -18
  23. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  24. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts +12 -4
  25. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
  26. package/lib/eth/builtin/internal/erc20bytes-processor.js +9 -9
  27. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  28. package/lib/eth/builtin/internal/erc721-processor.d.ts +18 -6
  29. package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
  30. package/lib/eth/builtin/internal/erc721-processor.js +14 -14
  31. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  32. package/lib/eth/builtin/internal/weth9-processor.d.ts +24 -8
  33. package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
  34. package/lib/eth/builtin/internal/weth9-processor.js +11 -11
  35. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  36. package/lib/eth/codegen/event-handler.js +1 -1
  37. package/lib/eth/codegen/function-calls.js +1 -1
  38. package/lib/eth/codegen/function-calls.js.map +1 -1
  39. package/lib/eth/eth-plugin.d.ts +27 -9
  40. package/lib/eth/eth-plugin.d.ts.map +1 -1
  41. package/lib/eth/eth-plugin.js +13 -13
  42. package/lib/eth/eth-plugin.js.map +1 -1
  43. package/package.json +3 -3
  44. package/src/eth/account-processor.ts +28 -12
  45. package/src/eth/base-processor-template.ts +16 -8
  46. package/src/eth/base-processor.ts +25 -16
  47. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +59 -31
  48. package/src/eth/builtin/internal/erc1155-processor.ts +65 -37
  49. package/src/eth/builtin/internal/erc20-processor.ts +66 -40
  50. package/src/eth/builtin/internal/erc20bytes-processor.ts +24 -13
  51. package/src/eth/builtin/internal/erc721-processor.ts +65 -38
  52. package/src/eth/builtin/internal/weth9-processor.ts +34 -19
  53. package/src/eth/codegen/event-handler.ts +1 -1
  54. package/src/eth/codegen/function-calls.ts +3 -3
  55. package/src/eth/eth-plugin.ts +27 -22
@@ -181,8 +181,8 @@ export class ERC721ContractView extends ContractView<ERC721> {
181
181
  .toArray();
182
182
  return result.length == 1 ? result[0] : result;
183
183
  }
184
+ console.log("missing eth call key:", "totalSupply", key);
184
185
  }
185
- console.debug("missing eth call:", "totalSupply");
186
186
  return await this.contract.getFunction("totalSupply()")(overrides || {});
187
187
  } catch (e) {
188
188
  const stack = new Error().stack;
@@ -213,8 +213,8 @@ export class ERC721ContractView extends ContractView<ERC721> {
213
213
  const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
214
214
  return result.length == 1 ? result[0] : result;
215
215
  }
216
+ console.log("missing eth call key:", "balanceOf", owner, key);
216
217
  }
217
- console.debug("missing eth call:", "balanceOf", owner);
218
218
  return await this.contract.getFunction("balanceOf(address)")(
219
219
  owner,
220
220
  overrides || {}
@@ -250,8 +250,8 @@ export class ERC721ContractView extends ContractView<ERC721> {
250
250
  .toArray();
251
251
  return result.length == 1 ? result[0] : result;
252
252
  }
253
+ console.log("missing eth call key:", "getApproved", tokenId, key);
253
254
  }
254
- console.debug("missing eth call:", "getApproved", tokenId);
255
255
  return await this.contract.getFunction("getApproved(uint256)")(
256
256
  tokenId,
257
257
  overrides || {}
@@ -291,8 +291,14 @@ export class ERC721ContractView extends ContractView<ERC721> {
291
291
  .toArray();
292
292
  return result.length == 1 ? result[0] : result;
293
293
  }
294
+ console.log(
295
+ "missing eth call key:",
296
+ "isApprovedForAll",
297
+ owner,
298
+ operator,
299
+ key
300
+ );
294
301
  }
295
- console.debug("missing eth call:", "isApprovedForAll", owner, operator);
296
302
  return await this.contract.getFunction(
297
303
  "isApprovedForAll(address,address)"
298
304
  )(owner, operator, overrides || {});
@@ -322,8 +328,8 @@ export class ERC721ContractView extends ContractView<ERC721> {
322
328
  const result = iface.decodeFunctionResult("name", ret).toArray();
323
329
  return result.length == 1 ? result[0] : result;
324
330
  }
331
+ console.log("missing eth call key:", "name", key);
325
332
  }
326
- console.debug("missing eth call:", "name");
327
333
  return await this.contract.getFunction("name()")(overrides || {});
328
334
  } catch (e) {
329
335
  const stack = new Error().stack;
@@ -354,8 +360,8 @@ export class ERC721ContractView extends ContractView<ERC721> {
354
360
  const result = iface.decodeFunctionResult("ownerOf", ret).toArray();
355
361
  return result.length == 1 ? result[0] : result;
356
362
  }
363
+ console.log("missing eth call key:", "ownerOf", tokenId, key);
357
364
  }
358
- console.debug("missing eth call:", "ownerOf", tokenId);
359
365
  return await this.contract.getFunction("ownerOf(uint256)")(
360
366
  tokenId,
361
367
  overrides || {}
@@ -393,8 +399,13 @@ export class ERC721ContractView extends ContractView<ERC721> {
393
399
  .toArray();
394
400
  return result.length == 1 ? result[0] : result;
395
401
  }
402
+ console.log(
403
+ "missing eth call key:",
404
+ "supportsInterface",
405
+ interfaceId,
406
+ key
407
+ );
396
408
  }
397
- console.debug("missing eth call:", "supportsInterface", interfaceId);
398
409
  return await this.contract.getFunction("supportsInterface(bytes4)")(
399
410
  interfaceId,
400
411
  overrides || {}
@@ -427,8 +438,8 @@ export class ERC721ContractView extends ContractView<ERC721> {
427
438
  const result = iface.decodeFunctionResult("symbol", ret).toArray();
428
439
  return result.length == 1 ? result[0] : result;
429
440
  }
441
+ console.log("missing eth call key:", "symbol", key);
430
442
  }
431
- console.debug("missing eth call:", "symbol");
432
443
  return await this.contract.getFunction("symbol()")(overrides || {});
433
444
  } catch (e) {
434
445
  const stack = new Error().stack;
@@ -459,8 +470,8 @@ export class ERC721ContractView extends ContractView<ERC721> {
459
470
  const result = iface.decodeFunctionResult("tokenURI", ret).toArray();
460
471
  return result.length == 1 ? result[0] : result;
461
472
  }
473
+ console.log("missing eth call key:", "tokenURI", tokenId, key);
462
474
  }
463
- console.debug("missing eth call:", "tokenURI", tokenId);
464
475
  return await this.contract.getFunction("tokenURI(uint256)")(
465
476
  tokenId,
466
477
  overrides || {}
@@ -498,8 +509,8 @@ export class ERC721ContractView extends ContractView<ERC721> {
498
509
  const result = iface.decodeFunctionResult("approve", ret).toArray();
499
510
  return result.length == 1 ? result[0] : result;
500
511
  }
512
+ console.log("missing eth call key:", "approve", to, tokenId, key);
501
513
  }
502
- console.debug("missing eth call:", "approve", to, tokenId);
503
514
  return await this.contract
504
515
  .getFunction("approve(address,uint256)")
505
516
  .staticCall(to, tokenId, overrides || {});
@@ -539,14 +550,15 @@ export class ERC721ContractView extends ContractView<ERC721> {
539
550
  .toArray();
540
551
  return result.length == 1 ? result[0] : result;
541
552
  }
553
+ console.log(
554
+ "missing eth call key:",
555
+ "safeTransferFrom",
556
+ from,
557
+ to,
558
+ tokenId,
559
+ key
560
+ );
542
561
  }
543
- console.debug(
544
- "missing eth call:",
545
- "safeTransferFrom",
546
- from,
547
- to,
548
- tokenId
549
- );
550
562
  return await this.contract
551
563
  .getFunction("safeTransferFrom(address,address,uint256)")
552
564
  .staticCall(from, to, tokenId, overrides || {});
@@ -588,15 +600,16 @@ export class ERC721ContractView extends ContractView<ERC721> {
588
600
  .toArray();
589
601
  return result.length == 1 ? result[0] : result;
590
602
  }
603
+ console.log(
604
+ "missing eth call key:",
605
+ "safeTransferFrom",
606
+ from,
607
+ to,
608
+ tokenId,
609
+ data,
610
+ key
611
+ );
591
612
  }
592
- console.debug(
593
- "missing eth call:",
594
- "safeTransferFrom",
595
- from,
596
- to,
597
- tokenId,
598
- data
599
- );
600
613
  return await this.contract
601
614
  .getFunction("safeTransferFrom(address,address,uint256,bytes)")
602
615
  .staticCall(from, to, tokenId, data, overrides || {});
@@ -634,13 +647,14 @@ export class ERC721ContractView extends ContractView<ERC721> {
634
647
  .toArray();
635
648
  return result.length == 1 ? result[0] : result;
636
649
  }
650
+ console.log(
651
+ "missing eth call key:",
652
+ "setApprovalForAll",
653
+ operator,
654
+ _approved,
655
+ key
656
+ );
637
657
  }
638
- console.debug(
639
- "missing eth call:",
640
- "setApprovalForAll",
641
- operator,
642
- _approved
643
- );
644
658
  return await this.contract
645
659
  .getFunction("setApprovalForAll(address,bool)")
646
660
  .staticCall(operator, _approved, overrides || {});
@@ -680,8 +694,15 @@ export class ERC721ContractView extends ContractView<ERC721> {
680
694
  .toArray();
681
695
  return result.length == 1 ? result[0] : result;
682
696
  }
697
+ console.log(
698
+ "missing eth call key:",
699
+ "transferFrom",
700
+ from,
701
+ to,
702
+ tokenId,
703
+ key
704
+ );
683
705
  }
684
- console.debug("missing eth call:", "transferFrom", from, to, tokenId);
685
706
  return await this.contract
686
707
  .getFunction("transferFrom(address,address,uint256)")
687
708
  .staticCall(from, to, tokenId, overrides || {});
@@ -1529,7 +1550,8 @@ export class ERC721Processor extends BaseProcessor<
1529
1550
  fetchConfig?: Partial<EthFetchConfig>,
1530
1551
  preprocessHandler?: (
1531
1552
  event: ApprovalEvent,
1532
- ctx: ERC721Context
1553
+ ctx: ERC721Context,
1554
+ preprocessStore: { [k: string]: any }
1533
1555
  ) => Promise<PreprocessResult>
1534
1556
  ): this {
1535
1557
  if (!filter) {
@@ -1548,7 +1570,8 @@ export class ERC721Processor extends BaseProcessor<
1548
1570
  fetchConfig?: Partial<EthFetchConfig>,
1549
1571
  preprocessHandler?: (
1550
1572
  event: ApprovalForAllEvent,
1551
- ctx: ERC721Context
1573
+ ctx: ERC721Context,
1574
+ preprocessStore: { [k: string]: any }
1552
1575
  ) => Promise<PreprocessResult>
1553
1576
  ): this {
1554
1577
  if (!filter) {
@@ -1567,7 +1590,8 @@ export class ERC721Processor extends BaseProcessor<
1567
1590
  fetchConfig?: Partial<EthFetchConfig>,
1568
1591
  preprocessHandler?: (
1569
1592
  event: TransferEvent,
1570
- ctx: ERC721Context
1593
+ ctx: ERC721Context,
1594
+ preprocessStore: { [k: string]: any }
1571
1595
  ) => Promise<PreprocessResult>
1572
1596
  ): this {
1573
1597
  if (!filter) {
@@ -1886,7 +1910,8 @@ export class ERC721ProcessorTemplate extends BaseProcessorTemplate<
1886
1910
  fetchConfig?: Partial<EthFetchConfig>,
1887
1911
  preprocessHandler?: (
1888
1912
  event: ApprovalEvent,
1889
- ctx: ERC721Context
1913
+ ctx: ERC721Context,
1914
+ preprocessStore: { [k: string]: any }
1890
1915
  ) => Promise<PreprocessResult>
1891
1916
  ): this {
1892
1917
  if (!filter) {
@@ -1905,7 +1930,8 @@ export class ERC721ProcessorTemplate extends BaseProcessorTemplate<
1905
1930
  fetchConfig?: Partial<EthFetchConfig>,
1906
1931
  preprocessHandler?: (
1907
1932
  event: ApprovalForAllEvent,
1908
- ctx: ERC721Context
1933
+ ctx: ERC721Context,
1934
+ preprocessStore: { [k: string]: any }
1909
1935
  ) => Promise<PreprocessResult>
1910
1936
  ): this {
1911
1937
  if (!filter) {
@@ -1924,7 +1950,8 @@ export class ERC721ProcessorTemplate extends BaseProcessorTemplate<
1924
1950
  fetchConfig?: Partial<EthFetchConfig>,
1925
1951
  preprocessHandler?: (
1926
1952
  event: TransferEvent,
1927
- ctx: ERC721Context
1953
+ ctx: ERC721Context,
1954
+ preprocessStore: { [k: string]: any }
1928
1955
  ) => Promise<PreprocessResult>
1929
1956
  ): this {
1930
1957
  if (!filter) {
@@ -134,8 +134,8 @@ export class WETH9ContractView extends ContractView<WETH9> {
134
134
  const result = iface.decodeFunctionResult("name", ret).toArray();
135
135
  return result.length == 1 ? result[0] : result;
136
136
  }
137
+ console.log("missing eth call key:", "name", key);
137
138
  }
138
- console.debug("missing eth call:", "name");
139
139
  return await this.contract.getFunction("name()")(overrides || {});
140
140
  } catch (e) {
141
141
  const stack = new Error().stack;
@@ -167,8 +167,8 @@ export class WETH9ContractView extends ContractView<WETH9> {
167
167
  .toArray();
168
168
  return result.length == 1 ? result[0] : result;
169
169
  }
170
+ console.log("missing eth call key:", "totalSupply", key);
170
171
  }
171
- console.debug("missing eth call:", "totalSupply");
172
172
  return await this.contract.getFunction("totalSupply()")(overrides || {});
173
173
  } catch (e) {
174
174
  const stack = new Error().stack;
@@ -198,8 +198,8 @@ export class WETH9ContractView extends ContractView<WETH9> {
198
198
  const result = iface.decodeFunctionResult("decimals", ret).toArray();
199
199
  return result.length == 1 ? result[0] : result;
200
200
  }
201
+ console.log("missing eth call key:", "decimals", key);
201
202
  }
202
- console.debug("missing eth call:", "decimals");
203
203
  return await this.contract.getFunction("decimals()")(overrides || {});
204
204
  } catch (e) {
205
205
  const stack = new Error().stack;
@@ -230,8 +230,8 @@ export class WETH9ContractView extends ContractView<WETH9> {
230
230
  const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
231
231
  return result.length == 1 ? result[0] : result;
232
232
  }
233
+ console.log("missing eth call key:", "balanceOf", arg0, key);
233
234
  }
234
- console.debug("missing eth call:", "balanceOf", arg0);
235
235
  return await this.contract.getFunction("balanceOf(address)")(
236
236
  arg0,
237
237
  overrides || {}
@@ -264,8 +264,8 @@ export class WETH9ContractView extends ContractView<WETH9> {
264
264
  const result = iface.decodeFunctionResult("symbol", ret).toArray();
265
265
  return result.length == 1 ? result[0] : result;
266
266
  }
267
+ console.log("missing eth call key:", "symbol", key);
267
268
  }
268
- console.debug("missing eth call:", "symbol");
269
269
  return await this.contract.getFunction("symbol()")(overrides || {});
270
270
  } catch (e) {
271
271
  const stack = new Error().stack;
@@ -297,8 +297,8 @@ export class WETH9ContractView extends ContractView<WETH9> {
297
297
  const result = iface.decodeFunctionResult("allowance", ret).toArray();
298
298
  return result.length == 1 ? result[0] : result;
299
299
  }
300
+ console.log("missing eth call key:", "allowance", arg0, arg1, key);
300
301
  }
301
- console.debug("missing eth call:", "allowance", arg0, arg1);
302
302
  return await this.contract.getFunction("allowance(address,address)")(
303
303
  arg0,
304
304
  arg1,
@@ -337,8 +337,8 @@ export class WETH9ContractView extends ContractView<WETH9> {
337
337
  const result = iface.decodeFunctionResult("approve", ret).toArray();
338
338
  return result.length == 1 ? result[0] : result;
339
339
  }
340
+ console.log("missing eth call key:", "approve", guy, wad, key);
340
341
  }
341
- console.debug("missing eth call:", "approve", guy, wad);
342
342
  return await this.contract
343
343
  .getFunction("approve(address,uint256)")
344
344
  .staticCall(guy, wad, overrides || {});
@@ -378,8 +378,15 @@ export class WETH9ContractView extends ContractView<WETH9> {
378
378
  .toArray();
379
379
  return result.length == 1 ? result[0] : result;
380
380
  }
381
+ console.log(
382
+ "missing eth call key:",
383
+ "transferFrom",
384
+ src,
385
+ dst,
386
+ wad,
387
+ key
388
+ );
381
389
  }
382
- console.debug("missing eth call:", "transferFrom", src, dst, wad);
383
390
  return await this.contract
384
391
  .getFunction("transferFrom(address,address,uint256)")
385
392
  .staticCall(src, dst, wad, overrides || {});
@@ -413,8 +420,8 @@ export class WETH9ContractView extends ContractView<WETH9> {
413
420
  .toArray();
414
421
  return result.length == 1 ? result[0] : result;
415
422
  }
423
+ console.log("missing eth call key:", "withdraw", wad, key);
416
424
  }
417
- console.debug("missing eth call:", "withdraw", wad);
418
425
  return await this.contract
419
426
  .getFunction("withdraw(uint256)")
420
427
  .staticCall(wad, overrides || {});
@@ -449,8 +456,8 @@ export class WETH9ContractView extends ContractView<WETH9> {
449
456
  .toArray();
450
457
  return result.length == 1 ? result[0] : result;
451
458
  }
459
+ console.log("missing eth call key:", "transfer", dst, wad, key);
452
460
  }
453
- console.debug("missing eth call:", "transfer", dst, wad);
454
461
  return await this.contract
455
462
  .getFunction("transfer(address,uint256)")
456
463
  .staticCall(dst, wad, overrides || {});
@@ -481,8 +488,8 @@ export class WETH9ContractView extends ContractView<WETH9> {
481
488
  const result = iface.decodeFunctionResult("deposit", ret).toArray();
482
489
  return result.length == 1 ? result[0] : result;
483
490
  }
491
+ console.log("missing eth call key:", "deposit", key);
484
492
  }
485
- console.debug("missing eth call:", "deposit");
486
493
  return await this.contract
487
494
  .getFunction("deposit()")
488
495
  .staticCall(overrides || {});
@@ -1078,7 +1085,8 @@ export class WETH9Processor extends BaseProcessor<
1078
1085
  fetchConfig?: Partial<EthFetchConfig>,
1079
1086
  preprocessHandler?: (
1080
1087
  event: ApprovalEvent,
1081
- ctx: WETH9Context
1088
+ ctx: WETH9Context,
1089
+ preprocessStore: { [k: string]: any }
1082
1090
  ) => Promise<PreprocessResult>
1083
1091
  ): this {
1084
1092
  if (!filter) {
@@ -1097,7 +1105,8 @@ export class WETH9Processor extends BaseProcessor<
1097
1105
  fetchConfig?: Partial<EthFetchConfig>,
1098
1106
  preprocessHandler?: (
1099
1107
  event: TransferEvent,
1100
- ctx: WETH9Context
1108
+ ctx: WETH9Context,
1109
+ preprocessStore: { [k: string]: any }
1101
1110
  ) => Promise<PreprocessResult>
1102
1111
  ): this {
1103
1112
  if (!filter) {
@@ -1116,7 +1125,8 @@ export class WETH9Processor extends BaseProcessor<
1116
1125
  fetchConfig?: Partial<EthFetchConfig>,
1117
1126
  preprocessHandler?: (
1118
1127
  event: DepositEvent,
1119
- ctx: WETH9Context
1128
+ ctx: WETH9Context,
1129
+ preprocessStore: { [k: string]: any }
1120
1130
  ) => Promise<PreprocessResult>
1121
1131
  ): this {
1122
1132
  if (!filter) {
@@ -1131,7 +1141,8 @@ export class WETH9Processor extends BaseProcessor<
1131
1141
  fetchConfig?: Partial<EthFetchConfig>,
1132
1142
  preprocessHandler?: (
1133
1143
  event: WithdrawalEvent,
1134
- ctx: WETH9Context
1144
+ ctx: WETH9Context,
1145
+ preprocessStore: { [k: string]: any }
1135
1146
  ) => Promise<PreprocessResult>
1136
1147
  ): this {
1137
1148
  if (!filter) {
@@ -1390,7 +1401,8 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
1390
1401
  fetchConfig?: Partial<EthFetchConfig>,
1391
1402
  preprocessHandler?: (
1392
1403
  event: ApprovalEvent,
1393
- ctx: WETH9Context
1404
+ ctx: WETH9Context,
1405
+ preprocessStore: { [k: string]: any }
1394
1406
  ) => Promise<PreprocessResult>
1395
1407
  ): this {
1396
1408
  if (!filter) {
@@ -1409,7 +1421,8 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
1409
1421
  fetchConfig?: Partial<EthFetchConfig>,
1410
1422
  preprocessHandler?: (
1411
1423
  event: TransferEvent,
1412
- ctx: WETH9Context
1424
+ ctx: WETH9Context,
1425
+ preprocessStore: { [k: string]: any }
1413
1426
  ) => Promise<PreprocessResult>
1414
1427
  ): this {
1415
1428
  if (!filter) {
@@ -1428,7 +1441,8 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
1428
1441
  fetchConfig?: Partial<EthFetchConfig>,
1429
1442
  preprocessHandler?: (
1430
1443
  event: DepositEvent,
1431
- ctx: WETH9Context
1444
+ ctx: WETH9Context,
1445
+ preprocessStore: { [k: string]: any }
1432
1446
  ) => Promise<PreprocessResult>
1433
1447
  ): this {
1434
1448
  if (!filter) {
@@ -1443,7 +1457,8 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
1443
1457
  fetchConfig?: Partial<EthFetchConfig>,
1444
1458
  preprocessHandler?: (
1445
1459
  event: WithdrawalEvent,
1446
- ctx: WETH9Context
1460
+ ctx: WETH9Context,
1461
+ preprocessStore: { [k: string]: any }
1447
1462
  ) => Promise<PreprocessResult>
1448
1463
  ): this {
1449
1464
  if (!filter) {
@@ -12,7 +12,7 @@ export function generateEventHandler(event: EventDeclaration, contractName: stri
12
12
  handler: (event: ${eventNamePrefix}Event, ctx: ${contractName}Context) => void,
13
13
  filter?: ${eventNamePrefix}EventFilter | ${eventNamePrefix}EventFilter[],
14
14
  fetchConfig?: Partial<EthFetchConfig>,
15
- preprocessHandler?: (event: ${eventNamePrefix}Event, ctx: ${contractName}Context) => Promise<PreprocessResult>
15
+ preprocessHandler?: (event: ${eventNamePrefix}Event, ctx: ${contractName}Context, preprocessStore: {[k: string]: any}) => Promise<PreprocessResult>
16
16
  ): this {
17
17
  if (!filter) {
18
18
  filter = templateContract.filters['${filterName}'](${event.inputs.map(() => 'null').join(',')})
@@ -58,10 +58,10 @@ export function generateViewFunction(view: boolean, fn: FunctionDeclaration, inc
58
58
  const result = iface.decodeFunctionResult("${fn.name}", ret).toArray()
59
59
  return result.length == 1? result[0]: result
60
60
  }
61
+ console.log("missing eth call key:", "${fn.name}", ${
62
+ fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
63
+ }key)
61
64
  }
62
- console.debug("missing eth call:", "${fn.name}", ${
63
- fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
64
- })
65
65
  return await ${func}${call}(${
66
66
  fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
67
67
  } overrides || {})
@@ -35,10 +35,13 @@ interface Handlers {
35
35
  }
36
36
 
37
37
  interface PreprocessHandlers {
38
- eventHandlers: ((event: Data_EthLog) => Promise<PreprocessResult>)[]
39
- traceHandlers: ((trace: Data_EthTrace) => Promise<PreprocessResult>)[]
40
- blockHandlers: ((block: Data_EthBlock) => Promise<PreprocessResult>)[]
41
- transactionHandlers: ((txn: Data_EthTransaction) => Promise<PreprocessResult>)[]
38
+ eventHandlers: ((event: Data_EthLog, preprocessStore: { [k: string]: any }) => Promise<PreprocessResult>)[]
39
+ traceHandlers: ((trace: Data_EthTrace, preprocessStore: { [k: string]: any }) => Promise<PreprocessResult>)[]
40
+ blockHandlers: ((block: Data_EthBlock, preprocessStore: { [k: string]: any }) => Promise<PreprocessResult>)[]
41
+ transactionHandlers: ((
42
+ txn: Data_EthTransaction,
43
+ preprocessStore: { [k: string]: any }
44
+ ) => Promise<PreprocessResult>)[]
42
45
  }
43
46
 
44
47
  export class EthPlugin extends Plugin {
@@ -278,16 +281,16 @@ export class EthPlugin extends Plugin {
278
281
  }
279
282
  }
280
283
 
281
- preprocessBinding(request: DataBinding): Promise<PreprocessResult> {
284
+ preprocessBinding(request: DataBinding, preprocessStore: { [k: string]: any }): Promise<PreprocessResult> {
282
285
  switch (request.handlerType) {
283
286
  case HandlerType.ETH_LOG:
284
- return this.preprocessLog(request)
287
+ return this.preprocessLog(request, preprocessStore)
285
288
  case HandlerType.ETH_TRACE:
286
- return this.preprocessTrace(request)
289
+ return this.preprocessTrace(request, preprocessStore)
287
290
  case HandlerType.ETH_BLOCK:
288
- return this.preprocessBlock(request)
291
+ return this.preprocessBlock(request, preprocessStore)
289
292
  case HandlerType.ETH_TRANSACTION:
290
- return this.preprocessTransaction(request)
293
+ return this.preprocessTransaction(request, preprocessStore)
291
294
  default:
292
295
  throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)
293
296
  }
@@ -326,7 +329,7 @@ export class EthPlugin extends Plugin {
326
329
  return TemplateInstanceState.INSTANCE.getValues().length !== config.templateInstances.length
327
330
  }
328
331
 
329
- async preprocessLog(request: DataBinding): Promise<PreprocessResult> {
332
+ async preprocessLog(request: DataBinding, preprocessStore: { [k: string]: any }): Promise<PreprocessResult> {
330
333
  if (!request.data?.ethLog?.log) {
331
334
  throw new ServerError(Status.INVALID_ARGUMENT, "Log can't be null")
332
335
  }
@@ -335,7 +338,7 @@ export class EthPlugin extends Plugin {
335
338
  const promises: Promise<PreprocessResult>[] = []
336
339
  for (const handlerId of request.handlerIds) {
337
340
  const handler = this.preprocessHandlers.eventHandlers[handlerId]
338
- const promise = handler(ethLog).catch((e) => {
341
+ const promise = handler(ethLog, preprocessStore).catch((e) => {
339
342
  throw new ServerError(
340
343
  Status.INTERNAL,
341
344
  'error processing log: ' + JSON.stringify(ethLog.log) + '\n' + errorString(e)
@@ -346,7 +349,7 @@ export class EthPlugin extends Plugin {
346
349
  return mergePreprocessResults(await Promise.all(promises))
347
350
  }
348
351
 
349
- async preprocessTrace(binding: DataBinding): Promise<PreprocessResult> {
352
+ async preprocessTrace(binding: DataBinding, preprocessStore: { [k: string]: any }): Promise<PreprocessResult> {
350
353
  if (!binding.data?.ethTrace?.trace) {
351
354
  throw new ServerError(Status.INVALID_ARGUMENT, "Trace can't be null")
352
355
  }
@@ -355,7 +358,7 @@ export class EthPlugin extends Plugin {
355
358
  const promises: Promise<PreprocessResult>[] = []
356
359
 
357
360
  for (const handlerId of binding.handlerIds) {
358
- const promise = this.preprocessHandlers.traceHandlers[handlerId](ethTrace).catch((e) => {
361
+ const promise = this.preprocessHandlers.traceHandlers[handlerId](ethTrace, preprocessStore).catch((e) => {
359
362
  throw new ServerError(
360
363
  Status.INTERNAL,
361
364
  'error processing trace: ' + JSON.stringify(ethTrace.trace) + '\n' + errorString(e)
@@ -366,7 +369,7 @@ export class EthPlugin extends Plugin {
366
369
  return mergePreprocessResults(await Promise.all(promises))
367
370
  }
368
371
 
369
- async preprocessBlock(binding: DataBinding): Promise<PreprocessResult> {
372
+ async preprocessBlock(binding: DataBinding, preprocessStore: { [k: string]: any }): Promise<PreprocessResult> {
370
373
  if (!binding.data?.ethBlock?.block) {
371
374
  throw new ServerError(Status.INVALID_ARGUMENT, "Block can't be empty")
372
375
  }
@@ -374,7 +377,7 @@ export class EthPlugin extends Plugin {
374
377
 
375
378
  const promises: Promise<PreprocessResult>[] = []
376
379
  for (const handlerId of binding.handlerIds) {
377
- const promise = this.preprocessHandlers.blockHandlers[handlerId](ethBlock).catch((e) => {
380
+ const promise = this.preprocessHandlers.blockHandlers[handlerId](ethBlock, preprocessStore).catch((e) => {
378
381
  throw new ServerError(
379
382
  Status.INTERNAL,
380
383
  'error processing block: ' + ethBlock.block?.number + '\n' + errorString(e)
@@ -385,7 +388,7 @@ export class EthPlugin extends Plugin {
385
388
  return mergePreprocessResults(await Promise.all(promises))
386
389
  }
387
390
 
388
- async preprocessTransaction(binding: DataBinding): Promise<PreprocessResult> {
391
+ async preprocessTransaction(binding: DataBinding, preprocessStore: { [k: string]: any }): Promise<PreprocessResult> {
389
392
  if (!binding.data?.ethTransaction?.transaction) {
390
393
  throw new ServerError(Status.INVALID_ARGUMENT, "transaction can't be null")
391
394
  }
@@ -394,12 +397,14 @@ export class EthPlugin extends Plugin {
394
397
  const promises: Promise<PreprocessResult>[] = []
395
398
 
396
399
  for (const handlerId of binding.handlerIds) {
397
- const promise = this.preprocessHandlers.transactionHandlers[handlerId](ethTransaction).catch((e) => {
398
- throw new ServerError(
399
- Status.INTERNAL,
400
- 'error processing transaction: ' + JSON.stringify(ethTransaction.transaction) + '\n' + errorString(e)
401
- )
402
- })
400
+ const promise = this.preprocessHandlers.transactionHandlers[handlerId](ethTransaction, preprocessStore).catch(
401
+ (e) => {
402
+ throw new ServerError(
403
+ Status.INTERNAL,
404
+ 'error processing transaction: ' + JSON.stringify(ethTransaction.transaction) + '\n' + errorString(e)
405
+ )
406
+ }
407
+ )
403
408
  promises.push(promise)
404
409
  }
405
410
  return mergePreprocessResults(await Promise.all(promises))