@sentio/sdk 2.39.7-rc.8 → 2.40.0-rc.1
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/lib/aptos/codegen/types.test.js.map +1 -1
- package/lib/aptos/ext/coin-event.test.js.map +1 -1
- package/lib/aptos/ext/coin.test.js.map +1 -1
- package/lib/core/event-logger.test.js.map +1 -1
- package/lib/core/normalization.test.js.map +1 -1
- package/lib/core/numberish.test.js.map +1 -1
- package/lib/eth/account-processor.d.ts +14 -8
- package/lib/eth/account-processor.d.ts.map +1 -1
- package/lib/eth/account-processor.js +43 -21
- package/lib/eth/account-processor.js.map +1 -1
- package/lib/eth/base-processor-template.d.ts +9 -6
- package/lib/eth/base-processor-template.d.ts.map +1 -1
- package/lib/eth/base-processor-template.js +25 -12
- package/lib/eth/base-processor-template.js.map +1 -1
- package/lib/eth/base-processor.d.ts +13 -8
- package/lib/eth/base-processor.d.ts.map +1 -1
- package/lib/eth/base-processor.js +109 -28
- package/lib/eth/base-processor.js.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +32 -32
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +62 -62
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.d.ts +17 -17
- package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.js +32 -32
- package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.d.ts +25 -25
- package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.js +48 -48
- package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts +14 -14
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.js +26 -26
- package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.d.ts +21 -21
- package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.js +40 -40
- package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.d.ts +20 -20
- package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.js +38 -38
- package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
- package/lib/eth/codegen/event-handler.d.ts.map +1 -1
- package/lib/eth/codegen/event-handler.js +3 -2
- package/lib/eth/codegen/event-handler.js.map +1 -1
- package/lib/eth/codegen/file.d.ts.map +1 -1
- package/lib/eth/codegen/file.js +6 -4
- package/lib/eth/codegen/file.js.map +1 -1
- package/lib/eth/codegen/functions-handler.js +4 -3
- package/lib/eth/codegen/functions-handler.js.map +1 -1
- package/lib/eth/context.d.ts +6 -5
- package/lib/eth/context.d.ts.map +1 -1
- package/lib/eth/context.js +7 -5
- package/lib/eth/context.js.map +1 -1
- package/lib/eth/eth-plugin.d.ts +22 -10
- package/lib/eth/eth-plugin.d.ts.map +1 -1
- package/lib/eth/eth-plugin.js +105 -10
- package/lib/eth/eth-plugin.js.map +1 -1
- package/lib/eth/eth.js +1 -1
- package/lib/eth/eth.js.map +1 -1
- package/lib/eth/eth.test.js.map +1 -1
- package/lib/eth/generic-processor.test.js.map +1 -1
- package/lib/eth/index.d.ts +2 -2
- package/lib/eth/index.d.ts.map +1 -1
- package/lib/eth/index.js +2 -2
- package/lib/eth/index.js.map +1 -1
- package/lib/eth/provider.d.ts.map +1 -1
- package/lib/eth/provider.js +12 -18
- package/lib/eth/provider.js.map +1 -1
- package/lib/eth/provider.test.js.map +1 -1
- package/lib/store/convert.test.js.map +1 -1
- package/lib/store/schema.js +1 -1
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js +2 -1
- package/lib/store/store.js.map +1 -1
- package/lib/utils/dex-price.test.js.map +1 -1
- package/lib/utils/erc20.test.js.map +1 -1
- package/lib/utils/price.test.js.map +1 -1
- package/package.json +6 -7
- package/src/eth/account-processor.ts +93 -22
- package/src/eth/base-processor-template.ts +60 -14
- package/src/eth/base-processor.ts +181 -37
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +302 -62
- package/src/eth/builtin/internal/erc1155-processor.ts +137 -32
- package/src/eth/builtin/internal/erc20-processor.ts +235 -48
- package/src/eth/builtin/internal/erc20bytes-processor.ts +124 -26
- package/src/eth/builtin/internal/erc721-processor.ts +191 -40
- package/src/eth/builtin/internal/weth9-processor.ts +170 -38
- package/src/eth/codegen/event-handler.ts +3 -2
- package/src/eth/codegen/file.ts +6 -4
- package/src/eth/codegen/functions-handler.ts +4 -3
- package/src/eth/context.ts +23 -7
- package/src/eth/eth-plugin.ts +142 -14
- package/src/eth/eth.ts +1 -1
- package/src/eth/index.ts +2 -2
- package/src/eth/provider.ts +15 -19
- package/src/store/schema.ts +1 -1
- package/src/store/store.ts +22 -13
@@ -20,6 +20,7 @@ import {
|
|
20
20
|
TypedCallTrace,
|
21
21
|
EthContext,
|
22
22
|
EthFetchConfig,
|
23
|
+
PreprocessResult,
|
23
24
|
} from "@sentio/sdk/eth";
|
24
25
|
|
25
26
|
import { WETH9__factory } from "./index.js";
|
@@ -354,7 +355,11 @@ export class WETH9Processor extends BaseProcessor<
|
|
354
355
|
onEventApproval(
|
355
356
|
handler: (event: ApprovalEvent, ctx: WETH9Context) => void,
|
356
357
|
filter?: ApprovalEventFilter | ApprovalEventFilter[],
|
357
|
-
fetchConfig?: Partial<EthFetchConfig
|
358
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
359
|
+
preprocessHandler?: (
|
360
|
+
event: ApprovalEvent,
|
361
|
+
ctx: WETH9Context
|
362
|
+
) => Promise<PreprocessResult>
|
358
363
|
): this {
|
359
364
|
if (!filter) {
|
360
365
|
filter = templateContract.filters["Approval(address,address,uint256)"](
|
@@ -363,13 +368,17 @@ export class WETH9Processor extends BaseProcessor<
|
|
363
368
|
null
|
364
369
|
);
|
365
370
|
}
|
366
|
-
return super.onEthEvent(handler, filter!, fetchConfig);
|
371
|
+
return super.onEthEvent(handler, filter!, fetchConfig, preprocessHandler);
|
367
372
|
}
|
368
373
|
|
369
374
|
onEventTransfer(
|
370
375
|
handler: (event: TransferEvent, ctx: WETH9Context) => void,
|
371
376
|
filter?: TransferEventFilter | TransferEventFilter[],
|
372
|
-
fetchConfig?: Partial<EthFetchConfig
|
377
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
378
|
+
preprocessHandler?: (
|
379
|
+
event: TransferEvent,
|
380
|
+
ctx: WETH9Context
|
381
|
+
) => Promise<PreprocessResult>
|
373
382
|
): this {
|
374
383
|
if (!filter) {
|
375
384
|
filter = templateContract.filters["Transfer(address,address,uint256)"](
|
@@ -378,24 +387,32 @@ export class WETH9Processor extends BaseProcessor<
|
|
378
387
|
null
|
379
388
|
);
|
380
389
|
}
|
381
|
-
return super.onEthEvent(handler, filter!, fetchConfig);
|
390
|
+
return super.onEthEvent(handler, filter!, fetchConfig, preprocessHandler);
|
382
391
|
}
|
383
392
|
|
384
393
|
onEventDeposit(
|
385
394
|
handler: (event: DepositEvent, ctx: WETH9Context) => void,
|
386
395
|
filter?: DepositEventFilter | DepositEventFilter[],
|
387
|
-
fetchConfig?: Partial<EthFetchConfig
|
396
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
397
|
+
preprocessHandler?: (
|
398
|
+
event: DepositEvent,
|
399
|
+
ctx: WETH9Context
|
400
|
+
) => Promise<PreprocessResult>
|
388
401
|
): this {
|
389
402
|
if (!filter) {
|
390
403
|
filter = templateContract.filters["Deposit(address,uint256)"](null, null);
|
391
404
|
}
|
392
|
-
return super.onEthEvent(handler, filter!, fetchConfig);
|
405
|
+
return super.onEthEvent(handler, filter!, fetchConfig, preprocessHandler);
|
393
406
|
}
|
394
407
|
|
395
408
|
onEventWithdrawal(
|
396
409
|
handler: (event: WithdrawalEvent, ctx: WETH9Context) => void,
|
397
410
|
filter?: WithdrawalEventFilter | WithdrawalEventFilter[],
|
398
|
-
fetchConfig?: Partial<EthFetchConfig
|
411
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
412
|
+
preprocessHandler?: (
|
413
|
+
event: WithdrawalEvent,
|
414
|
+
ctx: WETH9Context
|
415
|
+
) => Promise<PreprocessResult>
|
399
416
|
): this {
|
400
417
|
if (!filter) {
|
401
418
|
filter = templateContract.filters["Withdrawal(address,uint256)"](
|
@@ -403,84 +420,183 @@ export class WETH9Processor extends BaseProcessor<
|
|
403
420
|
null
|
404
421
|
);
|
405
422
|
}
|
406
|
-
return super.onEthEvent(handler, filter!, fetchConfig);
|
423
|
+
return super.onEthEvent(handler, filter!, fetchConfig, preprocessHandler);
|
407
424
|
}
|
408
425
|
|
409
426
|
onCallName(
|
410
427
|
handler: (call: NameCallTrace, ctx: WETH9Context) => void,
|
411
|
-
fetchConfig?: Partial<EthFetchConfig
|
428
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
429
|
+
preprocessHandler?: (
|
430
|
+
call: NameCallTrace,
|
431
|
+
ctx: WETH9Context
|
432
|
+
) => Promise<PreprocessResult>
|
412
433
|
): this {
|
413
|
-
return super.onEthTrace(
|
434
|
+
return super.onEthTrace(
|
435
|
+
"0x06fdde03",
|
436
|
+
handler as any,
|
437
|
+
fetchConfig,
|
438
|
+
preprocessHandler
|
439
|
+
);
|
414
440
|
}
|
415
441
|
|
416
442
|
onCallApprove(
|
417
443
|
handler: (call: ApproveCallTrace, ctx: WETH9Context) => void,
|
418
|
-
fetchConfig?: Partial<EthFetchConfig
|
444
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
445
|
+
preprocessHandler?: (
|
446
|
+
call: ApproveCallTrace,
|
447
|
+
ctx: WETH9Context
|
448
|
+
) => Promise<PreprocessResult>
|
419
449
|
): this {
|
420
|
-
return super.onEthTrace(
|
450
|
+
return super.onEthTrace(
|
451
|
+
"0x095ea7b3",
|
452
|
+
handler as any,
|
453
|
+
fetchConfig,
|
454
|
+
preprocessHandler
|
455
|
+
);
|
421
456
|
}
|
422
457
|
|
423
458
|
onCallTotalSupply(
|
424
459
|
handler: (call: TotalSupplyCallTrace, ctx: WETH9Context) => void,
|
425
|
-
fetchConfig?: Partial<EthFetchConfig
|
460
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
461
|
+
preprocessHandler?: (
|
462
|
+
call: TotalSupplyCallTrace,
|
463
|
+
ctx: WETH9Context
|
464
|
+
) => Promise<PreprocessResult>
|
426
465
|
): this {
|
427
|
-
return super.onEthTrace(
|
466
|
+
return super.onEthTrace(
|
467
|
+
"0x18160ddd",
|
468
|
+
handler as any,
|
469
|
+
fetchConfig,
|
470
|
+
preprocessHandler
|
471
|
+
);
|
428
472
|
}
|
429
473
|
|
430
474
|
onCallTransferFrom(
|
431
475
|
handler: (call: TransferFromCallTrace, ctx: WETH9Context) => void,
|
432
|
-
fetchConfig?: Partial<EthFetchConfig
|
476
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
477
|
+
preprocessHandler?: (
|
478
|
+
call: TransferFromCallTrace,
|
479
|
+
ctx: WETH9Context
|
480
|
+
) => Promise<PreprocessResult>
|
433
481
|
): this {
|
434
|
-
return super.onEthTrace(
|
482
|
+
return super.onEthTrace(
|
483
|
+
"0x23b872dd",
|
484
|
+
handler as any,
|
485
|
+
fetchConfig,
|
486
|
+
preprocessHandler
|
487
|
+
);
|
435
488
|
}
|
436
489
|
|
437
490
|
onCallWithdraw(
|
438
491
|
handler: (call: WithdrawCallTrace, ctx: WETH9Context) => void,
|
439
|
-
fetchConfig?: Partial<EthFetchConfig
|
492
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
493
|
+
preprocessHandler?: (
|
494
|
+
call: WithdrawCallTrace,
|
495
|
+
ctx: WETH9Context
|
496
|
+
) => Promise<PreprocessResult>
|
440
497
|
): this {
|
441
|
-
return super.onEthTrace(
|
498
|
+
return super.onEthTrace(
|
499
|
+
"0x2e1a7d4d",
|
500
|
+
handler as any,
|
501
|
+
fetchConfig,
|
502
|
+
preprocessHandler
|
503
|
+
);
|
442
504
|
}
|
443
505
|
|
444
506
|
onCallDecimals(
|
445
507
|
handler: (call: DecimalsCallTrace, ctx: WETH9Context) => void,
|
446
|
-
fetchConfig?: Partial<EthFetchConfig
|
508
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
509
|
+
preprocessHandler?: (
|
510
|
+
call: DecimalsCallTrace,
|
511
|
+
ctx: WETH9Context
|
512
|
+
) => Promise<PreprocessResult>
|
447
513
|
): this {
|
448
|
-
return super.onEthTrace(
|
514
|
+
return super.onEthTrace(
|
515
|
+
"0x313ce567",
|
516
|
+
handler as any,
|
517
|
+
fetchConfig,
|
518
|
+
preprocessHandler
|
519
|
+
);
|
449
520
|
}
|
450
521
|
|
451
522
|
onCallBalanceOf(
|
452
523
|
handler: (call: BalanceOfCallTrace, ctx: WETH9Context) => void,
|
453
|
-
fetchConfig?: Partial<EthFetchConfig
|
524
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
525
|
+
preprocessHandler?: (
|
526
|
+
call: BalanceOfCallTrace,
|
527
|
+
ctx: WETH9Context
|
528
|
+
) => Promise<PreprocessResult>
|
454
529
|
): this {
|
455
|
-
return super.onEthTrace(
|
530
|
+
return super.onEthTrace(
|
531
|
+
"0x70a08231",
|
532
|
+
handler as any,
|
533
|
+
fetchConfig,
|
534
|
+
preprocessHandler
|
535
|
+
);
|
456
536
|
}
|
457
537
|
|
458
538
|
onCallSymbol(
|
459
539
|
handler: (call: SymbolCallTrace, ctx: WETH9Context) => void,
|
460
|
-
fetchConfig?: Partial<EthFetchConfig
|
540
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
541
|
+
preprocessHandler?: (
|
542
|
+
call: SymbolCallTrace,
|
543
|
+
ctx: WETH9Context
|
544
|
+
) => Promise<PreprocessResult>
|
461
545
|
): this {
|
462
|
-
return super.onEthTrace(
|
546
|
+
return super.onEthTrace(
|
547
|
+
"0x95d89b41",
|
548
|
+
handler as any,
|
549
|
+
fetchConfig,
|
550
|
+
preprocessHandler
|
551
|
+
);
|
463
552
|
}
|
464
553
|
|
465
554
|
onCallTransfer(
|
466
555
|
handler: (call: TransferCallTrace, ctx: WETH9Context) => void,
|
467
|
-
fetchConfig?: Partial<EthFetchConfig
|
556
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
557
|
+
preprocessHandler?: (
|
558
|
+
call: TransferCallTrace,
|
559
|
+
ctx: WETH9Context
|
560
|
+
) => Promise<PreprocessResult>
|
468
561
|
): this {
|
469
|
-
return super.onEthTrace(
|
562
|
+
return super.onEthTrace(
|
563
|
+
"0xa9059cbb",
|
564
|
+
handler as any,
|
565
|
+
fetchConfig,
|
566
|
+
preprocessHandler
|
567
|
+
);
|
470
568
|
}
|
471
569
|
|
472
570
|
onCallDeposit(
|
473
571
|
handler: (call: DepositCallTrace, ctx: WETH9Context) => void,
|
474
|
-
fetchConfig?: Partial<EthFetchConfig
|
572
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
573
|
+
preprocessHandler?: (
|
574
|
+
call: DepositCallTrace,
|
575
|
+
ctx: WETH9Context
|
576
|
+
) => Promise<PreprocessResult>
|
475
577
|
): this {
|
476
|
-
return super.onEthTrace(
|
578
|
+
return super.onEthTrace(
|
579
|
+
"0xd0e30db0",
|
580
|
+
handler as any,
|
581
|
+
fetchConfig,
|
582
|
+
preprocessHandler
|
583
|
+
);
|
477
584
|
}
|
478
585
|
|
479
586
|
onCallAllowance(
|
480
587
|
handler: (call: AllowanceCallTrace, ctx: WETH9Context) => void,
|
481
|
-
fetchConfig?: Partial<EthFetchConfig
|
588
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
589
|
+
preprocessHandler?: (
|
590
|
+
call: AllowanceCallTrace,
|
591
|
+
ctx: WETH9Context
|
592
|
+
) => Promise<PreprocessResult>
|
482
593
|
): this {
|
483
|
-
return super.onEthTrace(
|
594
|
+
return super.onEthTrace(
|
595
|
+
"0xdd62ed3e",
|
596
|
+
handler as any,
|
597
|
+
fetchConfig,
|
598
|
+
preprocessHandler
|
599
|
+
);
|
484
600
|
}
|
485
601
|
|
486
602
|
public static filters = {
|
@@ -551,7 +667,11 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
551
667
|
onEventApproval(
|
552
668
|
handler: (event: ApprovalEvent, ctx: WETH9Context) => void,
|
553
669
|
filter?: ApprovalEventFilter | ApprovalEventFilter[],
|
554
|
-
fetchConfig?: Partial<EthFetchConfig
|
670
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
671
|
+
preprocessHandler?: (
|
672
|
+
event: ApprovalEvent,
|
673
|
+
ctx: WETH9Context
|
674
|
+
) => Promise<PreprocessResult>
|
555
675
|
): this {
|
556
676
|
if (!filter) {
|
557
677
|
filter = templateContract.filters["Approval(address,address,uint256)"](
|
@@ -560,13 +680,17 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
560
680
|
null
|
561
681
|
);
|
562
682
|
}
|
563
|
-
return super.onEthEvent(handler, filter!, fetchConfig);
|
683
|
+
return super.onEthEvent(handler, filter!, fetchConfig, preprocessHandler);
|
564
684
|
}
|
565
685
|
|
566
686
|
onEventTransfer(
|
567
687
|
handler: (event: TransferEvent, ctx: WETH9Context) => void,
|
568
688
|
filter?: TransferEventFilter | TransferEventFilter[],
|
569
|
-
fetchConfig?: Partial<EthFetchConfig
|
689
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
690
|
+
preprocessHandler?: (
|
691
|
+
event: TransferEvent,
|
692
|
+
ctx: WETH9Context
|
693
|
+
) => Promise<PreprocessResult>
|
570
694
|
): this {
|
571
695
|
if (!filter) {
|
572
696
|
filter = templateContract.filters["Transfer(address,address,uint256)"](
|
@@ -575,24 +699,32 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
575
699
|
null
|
576
700
|
);
|
577
701
|
}
|
578
|
-
return super.onEthEvent(handler, filter!, fetchConfig);
|
702
|
+
return super.onEthEvent(handler, filter!, fetchConfig, preprocessHandler);
|
579
703
|
}
|
580
704
|
|
581
705
|
onEventDeposit(
|
582
706
|
handler: (event: DepositEvent, ctx: WETH9Context) => void,
|
583
707
|
filter?: DepositEventFilter | DepositEventFilter[],
|
584
|
-
fetchConfig?: Partial<EthFetchConfig
|
708
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
709
|
+
preprocessHandler?: (
|
710
|
+
event: DepositEvent,
|
711
|
+
ctx: WETH9Context
|
712
|
+
) => Promise<PreprocessResult>
|
585
713
|
): this {
|
586
714
|
if (!filter) {
|
587
715
|
filter = templateContract.filters["Deposit(address,uint256)"](null, null);
|
588
716
|
}
|
589
|
-
return super.onEthEvent(handler, filter!, fetchConfig);
|
717
|
+
return super.onEthEvent(handler, filter!, fetchConfig, preprocessHandler);
|
590
718
|
}
|
591
719
|
|
592
720
|
onEventWithdrawal(
|
593
721
|
handler: (event: WithdrawalEvent, ctx: WETH9Context) => void,
|
594
722
|
filter?: WithdrawalEventFilter | WithdrawalEventFilter[],
|
595
|
-
fetchConfig?: Partial<EthFetchConfig
|
723
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
724
|
+
preprocessHandler?: (
|
725
|
+
event: WithdrawalEvent,
|
726
|
+
ctx: WETH9Context
|
727
|
+
) => Promise<PreprocessResult>
|
596
728
|
): this {
|
597
729
|
if (!filter) {
|
598
730
|
filter = templateContract.filters["Withdrawal(address,uint256)"](
|
@@ -600,7 +732,7 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
600
732
|
null
|
601
733
|
);
|
602
734
|
}
|
603
|
-
return super.onEthEvent(handler, filter!, fetchConfig);
|
735
|
+
return super.onEthEvent(handler, filter!, fetchConfig, preprocessHandler);
|
604
736
|
}
|
605
737
|
}
|
606
738
|
|
@@ -11,12 +11,13 @@ export function generateEventHandler(event: EventDeclaration, contractName: stri
|
|
11
11
|
onEvent${eventName}(
|
12
12
|
handler: (event: ${eventNamePrefix}Event, ctx: ${contractName}Context) => void,
|
13
13
|
filter?: ${eventNamePrefix}EventFilter | ${eventNamePrefix}EventFilter[],
|
14
|
-
fetchConfig?: Partial<EthFetchConfig
|
14
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
15
|
+
preprocessHandler?: (event: ${eventNamePrefix}Event, ctx: ${contractName}Context) => Promise<PreprocessResult>
|
15
16
|
): this {
|
16
17
|
if (!filter) {
|
17
18
|
filter = templateContract.filters['${filterName}'](${event.inputs.map(() => 'null').join(',')})
|
18
19
|
}
|
19
|
-
return super.onEthEvent(handler, filter!, fetchConfig)
|
20
|
+
return super.onEthEvent(handler, filter!, fetchConfig, preprocessHandler)
|
20
21
|
}
|
21
22
|
`
|
22
23
|
}
|
package/src/eth/codegen/file.ts
CHANGED
@@ -3,7 +3,7 @@ import {
|
|
3
3
|
createImportsForUsedIdentifiers,
|
4
4
|
EventDeclaration,
|
5
5
|
getFullSignatureAsSymbolForEvent,
|
6
|
-
getFullSignatureForEvent
|
6
|
+
getFullSignatureForEvent
|
7
7
|
} from 'typechain'
|
8
8
|
|
9
9
|
import { reservedKeywords } from '@sentio/ethers-v6/dist/codegen/reserved-keywords.js'
|
@@ -151,7 +151,7 @@ export class ${contract.name}ProcessorTemplate extends BaseProcessorTemplate<${c
|
|
151
151
|
} else {
|
152
152
|
return events.flatMap((e) => [
|
153
153
|
`${getFullSignatureAsSymbolForEvent(e)}_Event`,
|
154
|
-
`${getFullSignatureAsSymbolForEvent(e)}_EventFilter
|
154
|
+
`${getFullSignatureAsSymbolForEvent(e)}_EventFilter`
|
155
155
|
])
|
156
156
|
}
|
157
157
|
})
|
@@ -182,6 +182,7 @@ export class ${contract.name}ProcessorTemplate extends BaseProcessorTemplate<${c
|
|
182
182
|
'getProcessor',
|
183
183
|
'getProvider',
|
184
184
|
'transformEtherError',
|
185
|
+
'defaultPreprocessHandler',
|
185
186
|
'Trace',
|
186
187
|
'BindOptions',
|
187
188
|
'BaseProcessor',
|
@@ -194,12 +195,13 @@ export class ${contract.name}ProcessorTemplate extends BaseProcessorTemplate<${c
|
|
194
195
|
'TypedCallTrace',
|
195
196
|
'EthContext',
|
196
197
|
'EthFetchConfig',
|
198
|
+
'PreprocessResult'
|
197
199
|
],
|
198
200
|
// '@sentio/sdk/eth': ['BaseContext'],
|
199
201
|
// '@sentio/protos': ['EthFetchConfig'],
|
200
202
|
'./common.js': ['PromiseOrValue'],
|
201
203
|
'./index.js': [`${contract.name}__factory`],
|
202
|
-
[`./${contract.name}.js`]: [`${contract.name}`, ...eventsImports, ...uniqueStructImports]
|
204
|
+
[`./${contract.name}.js`]: [`${contract.name}`, ...eventsImports, ...uniqueStructImports]
|
203
205
|
},
|
204
206
|
source
|
205
207
|
)
|
@@ -232,7 +234,7 @@ export function codeGenTestUtilsFile(contract: Contract): string {
|
|
232
234
|
|
233
235
|
const possibleImports = {
|
234
236
|
'ethers/providers': ['LogParams'],
|
235
|
-
'@sentio/sdk/eth': ['EthChainId']
|
237
|
+
'@sentio/sdk/eth': ['EthChainId']
|
236
238
|
} as any
|
237
239
|
possibleImports[`./${contract.name}.js`] = Object.values(contract.events).flatMap((events) => {
|
238
240
|
if (events.length === 1) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
generateOutputComplexTypeAsArray,
|
3
|
-
generateOutputComplexTypesAsObject
|
3
|
+
generateOutputComplexTypesAsObject
|
4
4
|
} from '@sentio/ethers-v6/dist/codegen/types.js'
|
5
5
|
import sha3 from 'js-sha3'
|
6
6
|
import { FunctionDeclaration, getSignatureForFn } from 'typechain'
|
@@ -45,9 +45,10 @@ function generateCallHandler(fn: FunctionDeclaration, contractName: string, over
|
|
45
45
|
return `
|
46
46
|
onCall${upperFirst(overloadedName ?? fn.name)}(
|
47
47
|
handler: (call: ${upperFirst(overloadedName ?? fn.name)}CallTrace, ctx: ${contractName}Context) => void,
|
48
|
-
fetchConfig?: Partial<EthFetchConfig
|
48
|
+
fetchConfig?: Partial<EthFetchConfig>,
|
49
|
+
preprocessHandler?: (call: ${upperFirst(overloadedName ?? fn.name)}CallTrace, ctx: ${contractName}Context) => Promise<PreprocessResult>
|
49
50
|
): this {
|
50
|
-
return super.onEthTrace("${sighash}", handler as any, fetchConfig);
|
51
|
+
return super.onEthTrace("${sighash}", handler as any, fetchConfig, preprocessHandler);
|
51
52
|
}
|
52
53
|
`
|
53
54
|
}
|
package/src/eth/context.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { BaseContract } from 'ethers'
|
2
2
|
import { LogParams, BlockParams, TransactionReceiptParams, TransactionResponseParams } from 'ethers/providers'
|
3
3
|
|
4
|
-
import { RecordMetaData } from '@sentio/protos'
|
4
|
+
import { PreparedData, RecordMetaData } from '@sentio/protos'
|
5
5
|
import { Trace } from './eth.js'
|
6
6
|
import { Labels, normalizeLabels } from '../core/index.js'
|
7
7
|
import { BaseContext } from '../core/base-context.js'
|
@@ -12,12 +12,13 @@ export abstract class EthContext extends BaseContext {
|
|
12
12
|
address: string
|
13
13
|
private readonly log?: LogParams
|
14
14
|
readonly block?: BlockParams
|
15
|
-
|
15
|
+
readonly trace?: Trace
|
16
16
|
readonly blockNumber: number
|
17
17
|
readonly transactionHash?: string
|
18
18
|
readonly transaction?: TransactionResponseParams
|
19
19
|
readonly transactionReceipt?: TransactionReceiptParams
|
20
20
|
readonly timestamp: Date
|
21
|
+
readonly preparedData?: PreparedData
|
21
22
|
|
22
23
|
constructor(
|
23
24
|
chainId: EthChainId,
|
@@ -28,7 +29,8 @@ export abstract class EthContext extends BaseContext {
|
|
28
29
|
trace?: Trace,
|
29
30
|
transaction?: TransactionResponseParams,
|
30
31
|
transactionReceipt?: TransactionReceiptParams,
|
31
|
-
baseLabels?: Labels
|
32
|
+
baseLabels?: Labels,
|
33
|
+
preparedData?: PreparedData
|
32
34
|
) {
|
33
35
|
super(baseLabels)
|
34
36
|
this.chainId = chainId
|
@@ -39,6 +41,7 @@ export abstract class EthContext extends BaseContext {
|
|
39
41
|
this.transaction = transaction
|
40
42
|
this.transactionReceipt = transactionReceipt
|
41
43
|
this.timestamp = timestamp || new Date(0)
|
44
|
+
this.preparedData = preparedData
|
42
45
|
if (log) {
|
43
46
|
this.blockNumber = log.blockNumber
|
44
47
|
this.transactionHash = log.transactionHash
|
@@ -132,9 +135,10 @@ export class GlobalContext extends EthContext {
|
|
132
135
|
trace?: Trace,
|
133
136
|
transaction?: TransactionResponseParams,
|
134
137
|
transactionReceipt?: TransactionReceiptParams,
|
135
|
-
baseLabels?: Labels
|
138
|
+
baseLabels?: Labels,
|
139
|
+
preparedData?: PreparedData
|
136
140
|
) {
|
137
|
-
super(chainId, address, timestamp, block, log, trace, transaction, transactionReceipt, baseLabels)
|
141
|
+
super(chainId, address, timestamp, block, log, trace, transaction, transactionReceipt, baseLabels, preparedData)
|
138
142
|
}
|
139
143
|
protected getContractName(): string {
|
140
144
|
return '*'
|
@@ -165,9 +169,21 @@ export class ContractContext<
|
|
165
169
|
trace?: Trace,
|
166
170
|
transaction?: TransactionResponseParams,
|
167
171
|
transactionReceipt?: TransactionReceiptParams,
|
168
|
-
baseLabels?: Labels
|
172
|
+
baseLabels?: Labels,
|
173
|
+
preparedData?: PreparedData
|
169
174
|
) {
|
170
|
-
super(
|
175
|
+
super(
|
176
|
+
chainId,
|
177
|
+
view.address,
|
178
|
+
timestamp,
|
179
|
+
block,
|
180
|
+
log,
|
181
|
+
trace,
|
182
|
+
transaction,
|
183
|
+
transactionReceipt,
|
184
|
+
baseLabels,
|
185
|
+
preparedData
|
186
|
+
)
|
171
187
|
view.context = this
|
172
188
|
if (view.callStatic) {
|
173
189
|
view.callStatic.context = this
|