@sentio/sdk 2.59.0-rc.9 → 2.59.1-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/api.d.ts +1 -0
- package/lib/aptos/api.d.ts.map +1 -1
- package/lib/aptos/api.js +13 -1
- package/lib/aptos/api.js.map +1 -1
- package/lib/aptos/aptos-plugin.d.ts +8 -4
- package/lib/aptos/aptos-plugin.d.ts.map +1 -1
- package/lib/aptos/aptos-plugin.js +40 -3
- package/lib/aptos/aptos-plugin.js.map +1 -1
- package/lib/aptos/aptos-processor.d.ts +20 -19
- package/lib/aptos/aptos-processor.d.ts.map +1 -1
- package/lib/aptos/aptos-processor.js +101 -50
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/aptos-resource-processor-template.d.ts +5 -4
- package/lib/aptos/aptos-resource-processor-template.d.ts.map +1 -1
- package/lib/aptos/aptos-resource-processor-template.js +8 -8
- package/lib/aptos/aptos-resource-processor-template.js.map +1 -1
- package/lib/aptos/builtin/0x1.d.ts +333 -332
- package/lib/aptos/builtin/0x1.d.ts.map +1 -1
- package/lib/aptos/builtin/0x1.js +664 -664
- package/lib/aptos/builtin/0x1.js.map +1 -1
- package/lib/aptos/builtin/0x3.d.ts +66 -65
- package/lib/aptos/builtin/0x3.d.ts.map +1 -1
- package/lib/aptos/builtin/0x3.js +130 -130
- package/lib/aptos/builtin/0x3.js.map +1 -1
- package/lib/aptos/builtin/0x4.d.ts +29 -28
- package/lib/aptos/builtin/0x4.d.ts.map +1 -1
- package/lib/aptos/builtin/0x4.js +56 -56
- package/lib/aptos/builtin/0x4.js.map +1 -1
- package/lib/aptos/codegen/codegen.js +27 -0
- package/lib/aptos/codegen/codegen.js.map +1 -1
- package/lib/aptos/data.d.ts +45 -0
- package/lib/aptos/data.d.ts.map +1 -0
- package/lib/aptos/data.js +99 -0
- package/lib/aptos/data.js.map +1 -0
- package/lib/aptos/index.d.ts +1 -0
- package/lib/aptos/index.d.ts.map +1 -1
- package/lib/aptos/index.js.map +1 -1
- package/lib/aptos/models.d.ts +1 -0
- package/lib/aptos/models.d.ts.map +1 -1
- package/lib/aptos/move-coder.d.ts +8 -2
- package/lib/aptos/move-coder.d.ts.map +1 -1
- package/lib/aptos/move-coder.js +84 -1
- package/lib/aptos/move-coder.js.map +1 -1
- package/lib/btc/btc-plugin.d.ts +4 -1
- package/lib/btc/btc-plugin.d.ts.map +1 -1
- package/lib/btc/btc-plugin.js +27 -0
- package/lib/btc/btc-plugin.js.map +1 -1
- package/lib/btc/btc-processor.d.ts +6 -5
- package/lib/btc/btc-processor.d.ts.map +1 -1
- package/lib/btc/btc-processor.js +35 -9
- package/lib/btc/btc-processor.js.map +1 -1
- package/lib/btc/types.d.ts +2 -1
- package/lib/btc/types.d.ts.map +1 -1
- package/lib/core/base-context.d.ts +4 -2
- package/lib/core/base-context.d.ts.map +1 -1
- package/lib/core/base-context.js +10 -5
- package/lib/core/base-context.js.map +1 -1
- package/lib/core/event-logger.d.ts +5 -0
- package/lib/core/event-logger.d.ts.map +1 -1
- package/lib/core/event-logger.js +36 -1
- package/lib/core/event-logger.js.map +1 -1
- package/lib/core/handler-options.d.ts +25 -0
- package/lib/core/handler-options.d.ts.map +1 -0
- package/lib/core/handler-options.js +21 -0
- package/lib/core/handler-options.js.map +1 -0
- package/lib/core/index.d.ts +3 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +3 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/meter.d.ts +45 -2
- package/lib/core/meter.d.ts.map +1 -1
- package/lib/core/meter.js +124 -2
- package/lib/core/meter.js.map +1 -1
- package/lib/core/numberish.d.ts +2 -1
- package/lib/core/numberish.d.ts.map +1 -1
- package/lib/core/numberish.js +35 -1
- package/lib/core/numberish.js.map +1 -1
- package/lib/core/partition-handler-manager.d.ts +44 -0
- package/lib/core/partition-handler-manager.d.ts.map +1 -0
- package/lib/core/partition-handler-manager.js +76 -0
- package/lib/core/partition-handler-manager.js.map +1 -0
- package/lib/cosmos/cosmos-processor.d.ts +3 -2
- package/lib/cosmos/cosmos-processor.d.ts.map +1 -1
- package/lib/cosmos/cosmos-processor.js +11 -1
- package/lib/cosmos/cosmos-processor.js.map +1 -1
- package/lib/cosmos/types.d.ts +1 -0
- package/lib/cosmos/types.d.ts.map +1 -1
- package/lib/eth/base-processor.d.ts +18 -13
- package/lib/eth/base-processor.d.ts.map +1 -1
- package/lib/eth/base-processor.js +151 -26
- package/lib/eth/base-processor.js.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +32 -31
- 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 -16
- 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 -24
- 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 -13
- 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 -20
- 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 -19
- 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.js +2 -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 +1 -0
- package/lib/eth/codegen/file.js.map +1 -1
- package/lib/eth/codegen/functions-handler.js +2 -2
- package/lib/eth/codegen/functions-handler.js.map +1 -1
- package/lib/eth/eth-plugin.d.ts +4 -1
- package/lib/eth/eth-plugin.d.ts.map +1 -1
- package/lib/eth/eth-plugin.js +42 -1
- package/lib/eth/eth-plugin.js.map +1 -1
- package/lib/eth/eth.d.ts +2 -7
- package/lib/eth/eth.d.ts.map +1 -1
- package/lib/eth/eth.js +8 -1
- package/lib/eth/eth.js.map +1 -1
- package/lib/fuel/codegen/codegen.js +5 -5
- package/lib/fuel/codegen/codegen.js.map +1 -1
- package/lib/fuel/fuel-plugin.d.ts +4 -1
- package/lib/fuel/fuel-plugin.d.ts.map +1 -1
- package/lib/fuel/fuel-plugin.js +41 -0
- package/lib/fuel/fuel-plugin.js.map +1 -1
- package/lib/fuel/fuel-processor-template.d.ts +7 -4
- package/lib/fuel/fuel-processor-template.d.ts.map +1 -1
- package/lib/fuel/fuel-processor-template.js +11 -9
- package/lib/fuel/fuel-processor-template.js.map +1 -1
- package/lib/fuel/fuel-processor.d.ts +7 -7
- package/lib/fuel/fuel-processor.d.ts.map +1 -1
- package/lib/fuel/fuel-processor.js +91 -28
- package/lib/fuel/fuel-processor.js.map +1 -1
- package/lib/fuel/types.d.ts +3 -0
- package/lib/fuel/types.d.ts.map +1 -1
- package/lib/move/filter.d.ts +5 -0
- package/lib/move/filter.d.ts.map +1 -1
- package/lib/move/filter.js +5 -0
- package/lib/move/filter.js.map +1 -1
- package/lib/move/shared-network-codegen.d.ts.map +1 -1
- package/lib/move/shared-network-codegen.js +5 -4
- package/lib/move/shared-network-codegen.js.map +1 -1
- package/lib/solana/solana-processor.d.ts +10 -4
- package/lib/solana/solana-processor.d.ts.map +1 -1
- package/lib/solana/solana-processor.js +13 -4
- package/lib/solana/solana-processor.js.map +1 -1
- package/lib/stark/starknet-processor.d.ts +3 -1
- package/lib/stark/starknet-processor.d.ts.map +1 -1
- package/lib/stark/starknet-processor.js +32 -14
- package/lib/stark/starknet-processor.js.map +1 -1
- package/lib/store/codegen.d.ts.map +1 -1
- package/lib/store/codegen.js +36 -2
- package/lib/store/codegen.js.map +1 -1
- package/lib/store/schema.d.ts.map +1 -1
- package/lib/store/schema.js +3 -1
- package/lib/store/schema.js.map +1 -1
- package/lib/store/store.d.ts +4 -3
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js +41 -1
- package/lib/store/store.js.map +1 -1
- package/lib/store/types.d.ts +20 -1
- package/lib/store/types.d.ts.map +1 -1
- package/lib/store/types.js +22 -0
- package/lib/store/types.js.map +1 -1
- package/lib/sui/builtin/0x1.d.ts +7 -6
- package/lib/sui/builtin/0x1.d.ts.map +1 -1
- package/lib/sui/builtin/0x1.js +12 -12
- package/lib/sui/builtin/0x1.js.map +1 -1
- package/lib/sui/builtin/0x2.d.ts +61 -60
- package/lib/sui/builtin/0x2.d.ts.map +1 -1
- package/lib/sui/builtin/0x2.js +120 -120
- package/lib/sui/builtin/0x2.js.map +1 -1
- package/lib/sui/builtin/0x3.d.ts +49 -48
- package/lib/sui/builtin/0x3.d.ts.map +1 -1
- package/lib/sui/builtin/0x3.js +96 -96
- package/lib/sui/builtin/0x3.js.map +1 -1
- package/lib/sui/models.d.ts +1 -0
- package/lib/sui/models.d.ts.map +1 -1
- package/lib/sui/sui-plugin.d.ts +6 -3
- package/lib/sui/sui-plugin.d.ts.map +1 -1
- package/lib/sui/sui-plugin.js +59 -20
- package/lib/sui/sui-plugin.js.map +1 -1
- package/lib/sui/sui-processor.d.ts +5 -4
- package/lib/sui/sui-processor.d.ts.map +1 -1
- package/lib/sui/sui-processor.js +47 -11
- package/lib/sui/sui-processor.js.map +1 -1
- package/package.json +4 -4
- package/src/aptos/api.ts +13 -1
- package/src/aptos/aptos-plugin.ts +51 -8
- package/src/aptos/aptos-processor.ts +112 -74
- package/src/aptos/aptos-resource-processor-template.ts +9 -8
- package/src/aptos/builtin/0x1.ts +1565 -664
- package/src/aptos/builtin/0x3.ts +302 -130
- package/src/aptos/builtin/0x4.ts +123 -56
- package/src/aptos/codegen/codegen.ts +34 -1
- package/src/aptos/data.ts +123 -0
- package/src/aptos/index.ts +2 -0
- package/src/aptos/models.ts +2 -0
- package/src/aptos/move-coder.ts +96 -3
- package/src/btc/btc-plugin.ts +38 -0
- package/src/btc/btc-processor.ts +35 -10
- package/src/btc/types.ts +2 -1
- package/src/core/base-context.ts +10 -5
- package/src/core/event-logger.ts +45 -1
- package/src/core/handler-options.ts +40 -0
- package/src/core/index.ts +17 -1
- package/src/core/meter.ts +159 -4
- package/src/core/numberish.ts +34 -1
- package/src/core/partition-handler-manager.ts +94 -0
- package/src/cosmos/cosmos-processor.ts +12 -1
- package/src/cosmos/types.ts +1 -0
- package/src/eth/base-processor.ts +139 -28
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +118 -62
- package/src/eth/builtin/internal/erc1155-processor.ts +76 -32
- package/src/eth/builtin/internal/erc20-processor.ts +79 -48
- package/src/eth/builtin/internal/erc20bytes-processor.ts +47 -26
- package/src/eth/builtin/internal/erc721-processor.ts +77 -40
- package/src/eth/builtin/internal/weth9-processor.ts +79 -38
- package/src/eth/codegen/event-handler.ts +2 -2
- package/src/eth/codegen/file.ts +1 -0
- package/src/eth/codegen/functions-handler.ts +2 -2
- package/src/eth/eth-plugin.ts +55 -3
- package/src/eth/eth.ts +12 -1
- package/src/fuel/codegen/codegen.ts +5 -5
- package/src/fuel/fuel-plugin.ts +56 -0
- package/src/fuel/fuel-processor-template.ts +17 -10
- package/src/fuel/fuel-processor.ts +90 -22
- package/src/fuel/types.ts +3 -0
- package/src/move/filter.ts +5 -0
- package/src/move/shared-network-codegen.ts +5 -4
- package/src/solana/solana-processor.ts +28 -6
- package/src/stark/starknet-processor.ts +31 -13
- package/src/store/codegen.ts +50 -2
- package/src/store/schema.ts +3 -1
- package/src/store/store.ts +57 -4
- package/src/store/types.ts +30 -1
- package/src/sui/builtin/0x1.ts +22 -12
- package/src/sui/builtin/0x2.ts +220 -120
- package/src/sui/builtin/0x3.ts +241 -96
- package/src/sui/models.ts +2 -0
- package/src/sui/sui-plugin.ts +68 -22
- package/src/sui/sui-processor.ts +48 -11
@@ -2,6 +2,7 @@
|
|
2
2
|
/* tslint:disable */
|
3
3
|
/* eslint-disable */
|
4
4
|
import { BigNumberish, Overrides } from "ethers";
|
5
|
+
import { HandlerOptions } from "@sentio/sdk";
|
5
6
|
import {
|
6
7
|
addContractByABI,
|
7
8
|
getContractByABI,
|
@@ -634,7 +635,7 @@ export class WETH9Processor extends BaseProcessor<
|
|
634
635
|
onEventApproval(
|
635
636
|
handler: (event: ApprovalEvent, ctx: WETH9Context) => void,
|
636
637
|
filter?: ApprovalEventFilter | ApprovalEventFilter[],
|
637
|
-
|
638
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, ApprovalEvent>,
|
638
639
|
preprocessHandler?: (
|
639
640
|
event: ApprovalEvent,
|
640
641
|
ctx: WETH9Context,
|
@@ -648,13 +649,18 @@ export class WETH9Processor extends BaseProcessor<
|
|
648
649
|
null,
|
649
650
|
);
|
650
651
|
}
|
651
|
-
return super.onEthEvent(
|
652
|
+
return super.onEthEvent(
|
653
|
+
handler,
|
654
|
+
filter!,
|
655
|
+
handlerOptions,
|
656
|
+
preprocessHandler,
|
657
|
+
);
|
652
658
|
}
|
653
659
|
|
654
660
|
onEventTransfer(
|
655
661
|
handler: (event: TransferEvent, ctx: WETH9Context) => void,
|
656
662
|
filter?: TransferEventFilter | TransferEventFilter[],
|
657
|
-
|
663
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, TransferEvent>,
|
658
664
|
preprocessHandler?: (
|
659
665
|
event: TransferEvent,
|
660
666
|
ctx: WETH9Context,
|
@@ -668,13 +674,18 @@ export class WETH9Processor extends BaseProcessor<
|
|
668
674
|
null,
|
669
675
|
);
|
670
676
|
}
|
671
|
-
return super.onEthEvent(
|
677
|
+
return super.onEthEvent(
|
678
|
+
handler,
|
679
|
+
filter!,
|
680
|
+
handlerOptions,
|
681
|
+
preprocessHandler,
|
682
|
+
);
|
672
683
|
}
|
673
684
|
|
674
685
|
onEventDeposit(
|
675
686
|
handler: (event: DepositEvent, ctx: WETH9Context) => void,
|
676
687
|
filter?: DepositEventFilter | DepositEventFilter[],
|
677
|
-
|
688
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, DepositEvent>,
|
678
689
|
preprocessHandler?: (
|
679
690
|
event: DepositEvent,
|
680
691
|
ctx: WETH9Context,
|
@@ -684,13 +695,18 @@ export class WETH9Processor extends BaseProcessor<
|
|
684
695
|
if (!filter) {
|
685
696
|
filter = templateContract.filters["Deposit(address,uint256)"](null, null);
|
686
697
|
}
|
687
|
-
return super.onEthEvent(
|
698
|
+
return super.onEthEvent(
|
699
|
+
handler,
|
700
|
+
filter!,
|
701
|
+
handlerOptions,
|
702
|
+
preprocessHandler,
|
703
|
+
);
|
688
704
|
}
|
689
705
|
|
690
706
|
onEventWithdrawal(
|
691
707
|
handler: (event: WithdrawalEvent, ctx: WETH9Context) => void,
|
692
708
|
filter?: WithdrawalEventFilter | WithdrawalEventFilter[],
|
693
|
-
|
709
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, WithdrawalEvent>,
|
694
710
|
preprocessHandler?: (
|
695
711
|
event: WithdrawalEvent,
|
696
712
|
ctx: WETH9Context,
|
@@ -703,12 +719,17 @@ export class WETH9Processor extends BaseProcessor<
|
|
703
719
|
null,
|
704
720
|
);
|
705
721
|
}
|
706
|
-
return super.onEthEvent(
|
722
|
+
return super.onEthEvent(
|
723
|
+
handler,
|
724
|
+
filter!,
|
725
|
+
handlerOptions,
|
726
|
+
preprocessHandler,
|
727
|
+
);
|
707
728
|
}
|
708
729
|
|
709
730
|
onCallName(
|
710
731
|
handler: (call: NameCallTrace, ctx: WETH9Context) => void,
|
711
|
-
|
732
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, NameCallTrace>,
|
712
733
|
preprocessHandler?: (
|
713
734
|
call: NameCallTrace,
|
714
735
|
ctx: WETH9Context,
|
@@ -717,14 +738,14 @@ export class WETH9Processor extends BaseProcessor<
|
|
717
738
|
return super.onEthTrace(
|
718
739
|
"0x06fdde03",
|
719
740
|
handler as any,
|
720
|
-
|
741
|
+
handlerOptions,
|
721
742
|
preprocessHandler,
|
722
743
|
);
|
723
744
|
}
|
724
745
|
|
725
746
|
onCallApprove(
|
726
747
|
handler: (call: ApproveCallTrace, ctx: WETH9Context) => void,
|
727
|
-
|
748
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, ApproveCallTrace>,
|
728
749
|
preprocessHandler?: (
|
729
750
|
call: ApproveCallTrace,
|
730
751
|
ctx: WETH9Context,
|
@@ -733,14 +754,14 @@ export class WETH9Processor extends BaseProcessor<
|
|
733
754
|
return super.onEthTrace(
|
734
755
|
"0x095ea7b3",
|
735
756
|
handler as any,
|
736
|
-
|
757
|
+
handlerOptions,
|
737
758
|
preprocessHandler,
|
738
759
|
);
|
739
760
|
}
|
740
761
|
|
741
762
|
onCallTotalSupply(
|
742
763
|
handler: (call: TotalSupplyCallTrace, ctx: WETH9Context) => void,
|
743
|
-
|
764
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, TotalSupplyCallTrace>,
|
744
765
|
preprocessHandler?: (
|
745
766
|
call: TotalSupplyCallTrace,
|
746
767
|
ctx: WETH9Context,
|
@@ -749,14 +770,14 @@ export class WETH9Processor extends BaseProcessor<
|
|
749
770
|
return super.onEthTrace(
|
750
771
|
"0x18160ddd",
|
751
772
|
handler as any,
|
752
|
-
|
773
|
+
handlerOptions,
|
753
774
|
preprocessHandler,
|
754
775
|
);
|
755
776
|
}
|
756
777
|
|
757
778
|
onCallTransferFrom(
|
758
779
|
handler: (call: TransferFromCallTrace, ctx: WETH9Context) => void,
|
759
|
-
|
780
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, TransferFromCallTrace>,
|
760
781
|
preprocessHandler?: (
|
761
782
|
call: TransferFromCallTrace,
|
762
783
|
ctx: WETH9Context,
|
@@ -765,14 +786,14 @@ export class WETH9Processor extends BaseProcessor<
|
|
765
786
|
return super.onEthTrace(
|
766
787
|
"0x23b872dd",
|
767
788
|
handler as any,
|
768
|
-
|
789
|
+
handlerOptions,
|
769
790
|
preprocessHandler,
|
770
791
|
);
|
771
792
|
}
|
772
793
|
|
773
794
|
onCallWithdraw(
|
774
795
|
handler: (call: WithdrawCallTrace, ctx: WETH9Context) => void,
|
775
|
-
|
796
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, WithdrawCallTrace>,
|
776
797
|
preprocessHandler?: (
|
777
798
|
call: WithdrawCallTrace,
|
778
799
|
ctx: WETH9Context,
|
@@ -781,14 +802,14 @@ export class WETH9Processor extends BaseProcessor<
|
|
781
802
|
return super.onEthTrace(
|
782
803
|
"0x2e1a7d4d",
|
783
804
|
handler as any,
|
784
|
-
|
805
|
+
handlerOptions,
|
785
806
|
preprocessHandler,
|
786
807
|
);
|
787
808
|
}
|
788
809
|
|
789
810
|
onCallDecimals(
|
790
811
|
handler: (call: DecimalsCallTrace, ctx: WETH9Context) => void,
|
791
|
-
|
812
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, DecimalsCallTrace>,
|
792
813
|
preprocessHandler?: (
|
793
814
|
call: DecimalsCallTrace,
|
794
815
|
ctx: WETH9Context,
|
@@ -797,14 +818,14 @@ export class WETH9Processor extends BaseProcessor<
|
|
797
818
|
return super.onEthTrace(
|
798
819
|
"0x313ce567",
|
799
820
|
handler as any,
|
800
|
-
|
821
|
+
handlerOptions,
|
801
822
|
preprocessHandler,
|
802
823
|
);
|
803
824
|
}
|
804
825
|
|
805
826
|
onCallBalanceOf(
|
806
827
|
handler: (call: BalanceOfCallTrace, ctx: WETH9Context) => void,
|
807
|
-
|
828
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, BalanceOfCallTrace>,
|
808
829
|
preprocessHandler?: (
|
809
830
|
call: BalanceOfCallTrace,
|
810
831
|
ctx: WETH9Context,
|
@@ -813,14 +834,14 @@ export class WETH9Processor extends BaseProcessor<
|
|
813
834
|
return super.onEthTrace(
|
814
835
|
"0x70a08231",
|
815
836
|
handler as any,
|
816
|
-
|
837
|
+
handlerOptions,
|
817
838
|
preprocessHandler,
|
818
839
|
);
|
819
840
|
}
|
820
841
|
|
821
842
|
onCallSymbol(
|
822
843
|
handler: (call: SymbolCallTrace, ctx: WETH9Context) => void,
|
823
|
-
|
844
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, SymbolCallTrace>,
|
824
845
|
preprocessHandler?: (
|
825
846
|
call: SymbolCallTrace,
|
826
847
|
ctx: WETH9Context,
|
@@ -829,14 +850,14 @@ export class WETH9Processor extends BaseProcessor<
|
|
829
850
|
return super.onEthTrace(
|
830
851
|
"0x95d89b41",
|
831
852
|
handler as any,
|
832
|
-
|
853
|
+
handlerOptions,
|
833
854
|
preprocessHandler,
|
834
855
|
);
|
835
856
|
}
|
836
857
|
|
837
858
|
onCallTransfer(
|
838
859
|
handler: (call: TransferCallTrace, ctx: WETH9Context) => void,
|
839
|
-
|
860
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, TransferCallTrace>,
|
840
861
|
preprocessHandler?: (
|
841
862
|
call: TransferCallTrace,
|
842
863
|
ctx: WETH9Context,
|
@@ -845,14 +866,14 @@ export class WETH9Processor extends BaseProcessor<
|
|
845
866
|
return super.onEthTrace(
|
846
867
|
"0xa9059cbb",
|
847
868
|
handler as any,
|
848
|
-
|
869
|
+
handlerOptions,
|
849
870
|
preprocessHandler,
|
850
871
|
);
|
851
872
|
}
|
852
873
|
|
853
874
|
onCallDeposit(
|
854
875
|
handler: (call: DepositCallTrace, ctx: WETH9Context) => void,
|
855
|
-
|
876
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, DepositCallTrace>,
|
856
877
|
preprocessHandler?: (
|
857
878
|
call: DepositCallTrace,
|
858
879
|
ctx: WETH9Context,
|
@@ -861,14 +882,14 @@ export class WETH9Processor extends BaseProcessor<
|
|
861
882
|
return super.onEthTrace(
|
862
883
|
"0xd0e30db0",
|
863
884
|
handler as any,
|
864
|
-
|
885
|
+
handlerOptions,
|
865
886
|
preprocessHandler,
|
866
887
|
);
|
867
888
|
}
|
868
889
|
|
869
890
|
onCallAllowance(
|
870
891
|
handler: (call: AllowanceCallTrace, ctx: WETH9Context) => void,
|
871
|
-
|
892
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, AllowanceCallTrace>,
|
872
893
|
preprocessHandler?: (
|
873
894
|
call: AllowanceCallTrace,
|
874
895
|
ctx: WETH9Context,
|
@@ -877,7 +898,7 @@ export class WETH9Processor extends BaseProcessor<
|
|
877
898
|
return super.onEthTrace(
|
878
899
|
"0xdd62ed3e",
|
879
900
|
handler as any,
|
880
|
-
|
901
|
+
handlerOptions,
|
881
902
|
preprocessHandler,
|
882
903
|
);
|
883
904
|
}
|
@@ -950,7 +971,7 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
950
971
|
onEventApproval(
|
951
972
|
handler: (event: ApprovalEvent, ctx: WETH9Context) => void,
|
952
973
|
filter?: ApprovalEventFilter | ApprovalEventFilter[],
|
953
|
-
|
974
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, ApprovalEvent>,
|
954
975
|
preprocessHandler?: (
|
955
976
|
event: ApprovalEvent,
|
956
977
|
ctx: WETH9Context,
|
@@ -964,13 +985,18 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
964
985
|
null,
|
965
986
|
);
|
966
987
|
}
|
967
|
-
return super.onEthEvent(
|
988
|
+
return super.onEthEvent(
|
989
|
+
handler,
|
990
|
+
filter!,
|
991
|
+
handlerOptions,
|
992
|
+
preprocessHandler,
|
993
|
+
);
|
968
994
|
}
|
969
995
|
|
970
996
|
onEventTransfer(
|
971
997
|
handler: (event: TransferEvent, ctx: WETH9Context) => void,
|
972
998
|
filter?: TransferEventFilter | TransferEventFilter[],
|
973
|
-
|
999
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, TransferEvent>,
|
974
1000
|
preprocessHandler?: (
|
975
1001
|
event: TransferEvent,
|
976
1002
|
ctx: WETH9Context,
|
@@ -984,13 +1010,18 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
984
1010
|
null,
|
985
1011
|
);
|
986
1012
|
}
|
987
|
-
return super.onEthEvent(
|
1013
|
+
return super.onEthEvent(
|
1014
|
+
handler,
|
1015
|
+
filter!,
|
1016
|
+
handlerOptions,
|
1017
|
+
preprocessHandler,
|
1018
|
+
);
|
988
1019
|
}
|
989
1020
|
|
990
1021
|
onEventDeposit(
|
991
1022
|
handler: (event: DepositEvent, ctx: WETH9Context) => void,
|
992
1023
|
filter?: DepositEventFilter | DepositEventFilter[],
|
993
|
-
|
1024
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, DepositEvent>,
|
994
1025
|
preprocessHandler?: (
|
995
1026
|
event: DepositEvent,
|
996
1027
|
ctx: WETH9Context,
|
@@ -1000,13 +1031,18 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
1000
1031
|
if (!filter) {
|
1001
1032
|
filter = templateContract.filters["Deposit(address,uint256)"](null, null);
|
1002
1033
|
}
|
1003
|
-
return super.onEthEvent(
|
1034
|
+
return super.onEthEvent(
|
1035
|
+
handler,
|
1036
|
+
filter!,
|
1037
|
+
handlerOptions,
|
1038
|
+
preprocessHandler,
|
1039
|
+
);
|
1004
1040
|
}
|
1005
1041
|
|
1006
1042
|
onEventWithdrawal(
|
1007
1043
|
handler: (event: WithdrawalEvent, ctx: WETH9Context) => void,
|
1008
1044
|
filter?: WithdrawalEventFilter | WithdrawalEventFilter[],
|
1009
|
-
|
1045
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, WithdrawalEvent>,
|
1010
1046
|
preprocessHandler?: (
|
1011
1047
|
event: WithdrawalEvent,
|
1012
1048
|
ctx: WETH9Context,
|
@@ -1019,7 +1055,12 @@ export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
1019
1055
|
null,
|
1020
1056
|
);
|
1021
1057
|
}
|
1022
|
-
return super.onEthEvent(
|
1058
|
+
return super.onEthEvent(
|
1059
|
+
handler,
|
1060
|
+
filter!,
|
1061
|
+
handlerOptions,
|
1062
|
+
preprocessHandler,
|
1063
|
+
);
|
1023
1064
|
}
|
1024
1065
|
}
|
1025
1066
|
|
@@ -11,13 +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
|
-
|
14
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, ${eventNamePrefix}Event>,
|
15
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(',')})
|
19
19
|
}
|
20
|
-
return super.onEthEvent(handler, filter!,
|
20
|
+
return super.onEthEvent(handler, filter!, handlerOptions, preprocessHandler)
|
21
21
|
}
|
22
22
|
`
|
23
23
|
}
|
package/src/eth/codegen/file.ts
CHANGED
@@ -196,6 +196,7 @@ export class ${contract.name}ProcessorTemplate extends BaseProcessorTemplate<${c
|
|
196
196
|
{
|
197
197
|
ethers: ['BigNumberish', 'Overrides', 'BytesLike', 'Interface'],
|
198
198
|
// 'ethers/providers': ['Networkish'],
|
199
|
+
'@sentio/sdk': ['HandlerOptions'],
|
199
200
|
'@sentio/sdk/eth': [
|
200
201
|
'addContractByABI',
|
201
202
|
'getContractByABI',
|
@@ -45,10 +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
|
-
|
48
|
+
handlerOptions?: HandlerOptions<EthFetchConfig, ${upperFirst(overloadedName ?? fn.name)}CallTrace>,
|
49
49
|
preprocessHandler?: (call: ${upperFirst(overloadedName ?? fn.name)}CallTrace, ctx: ${contractName}Context) => Promise<PreprocessResult>
|
50
50
|
): this {
|
51
|
-
return super.onEthTrace("${sighash}", handler as any,
|
51
|
+
return super.onEthTrace("${sighash}", handler as any, handlerOptions, preprocessHandler);
|
52
52
|
}
|
53
53
|
`
|
54
54
|
}
|
package/src/eth/eth-plugin.ts
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
import {
|
2
2
|
errorString,
|
3
|
+
getProvider,
|
4
|
+
GLOBAL_CONFIG,
|
3
5
|
mergeProcessResults,
|
4
6
|
Plugin,
|
5
7
|
PluginManager,
|
6
|
-
USER_PROCESSOR
|
7
|
-
GLOBAL_CONFIG,
|
8
|
-
getProvider
|
8
|
+
USER_PROCESSOR
|
9
9
|
} from '@sentio/runtime'
|
10
|
+
import { PartitionHandlerManager } from '../core/index.js'
|
10
11
|
import {
|
11
12
|
AccountConfig,
|
12
13
|
ContractConfig,
|
@@ -22,6 +23,7 @@ import {
|
|
22
23
|
PreprocessResult,
|
23
24
|
ProcessConfigResponse,
|
24
25
|
ProcessResult,
|
26
|
+
ProcessStreamResponse_Partitions,
|
25
27
|
StartRequest
|
26
28
|
} from '@sentio/protos'
|
27
29
|
|
@@ -68,6 +70,8 @@ export class EthPlugin extends Plugin {
|
|
68
70
|
transactionHandlers: []
|
69
71
|
}
|
70
72
|
|
73
|
+
partitionManager = new PartitionHandlerManager()
|
74
|
+
|
71
75
|
async configure(config: ProcessConfigResponse) {
|
72
76
|
const handlers: Handlers = {
|
73
77
|
blockHandlers: [],
|
@@ -108,6 +112,7 @@ export class EthPlugin extends Plugin {
|
|
108
112
|
for (const blockHandler of processor.blockHandlers) {
|
109
113
|
preprocessHandlers.blockHandlers.push(blockHandler.preprocessHandler ?? defaultPreprocessHandler)
|
110
114
|
const handlerId = handlers.blockHandlers.push(blockHandler.handler) - 1
|
115
|
+
this.partitionManager.registerPartitionHandler(HandlerType.ETH_BLOCK, handlerId, blockHandler.partitionHandler)
|
111
116
|
// TODO wrap the block handler into one
|
112
117
|
|
113
118
|
contractConfig.intervalConfigs.push({
|
@@ -125,6 +130,7 @@ export class EthPlugin extends Plugin {
|
|
125
130
|
for (const traceHandler of processor.traceHandlers) {
|
126
131
|
preprocessHandlers.traceHandlers.push(traceHandler.preprocessHandler ?? defaultPreprocessHandler)
|
127
132
|
const handlerId = handlers.traceHandlers.push(traceHandler.handler) - 1
|
133
|
+
this.partitionManager.registerPartitionHandler(HandlerType.ETH_TRACE, handlerId, traceHandler.partitionHandler)
|
128
134
|
for (const signature of traceHandler.signatures) {
|
129
135
|
contractConfig.traceConfigs.push({
|
130
136
|
signature: signature,
|
@@ -140,6 +146,7 @@ export class EthPlugin extends Plugin {
|
|
140
146
|
// associate id with filter
|
141
147
|
preprocessHandlers.eventHandlers.push(eventsHandler.preprocessHandler ?? defaultPreprocessHandler)
|
142
148
|
const handlerId = handlers.eventHandlers.push(eventsHandler.handler) - 1
|
149
|
+
this.partitionManager.registerPartitionHandler(HandlerType.ETH_LOG, handlerId, eventsHandler.partitionHandler)
|
143
150
|
const logConfig: LogHandlerConfig = {
|
144
151
|
handlerId: handlerId,
|
145
152
|
handlerName: eventsHandler.handlerName,
|
@@ -213,6 +220,11 @@ export class EthPlugin extends Plugin {
|
|
213
220
|
for (const transactionHandler of processor.transactionHandler) {
|
214
221
|
preprocessHandlers.transactionHandlers.push(transactionHandler.preprocessHandler ?? defaultPreprocessHandler)
|
215
222
|
const handlerId = handlers.transactionHandlers.push(transactionHandler.handler) - 1
|
223
|
+
this.partitionManager.registerPartitionHandler(
|
224
|
+
HandlerType.ETH_TRANSACTION,
|
225
|
+
handlerId,
|
226
|
+
transactionHandler.partitionHandler
|
227
|
+
)
|
216
228
|
contractConfig.transactionConfig.push({
|
217
229
|
handlerId: handlerId,
|
218
230
|
handlerName: transactionHandler.handlerName,
|
@@ -323,6 +335,46 @@ export class EthPlugin extends Plugin {
|
|
323
335
|
}
|
324
336
|
}
|
325
337
|
|
338
|
+
async partition(request: DataBinding): Promise<ProcessStreamResponse_Partitions> {
|
339
|
+
let data: any
|
340
|
+
switch (request.handlerType) {
|
341
|
+
case HandlerType.ETH_LOG:
|
342
|
+
if (!request.data?.ethLog) {
|
343
|
+
throw new ServerError(Status.INVALID_ARGUMENT, "ethLog can't be empty")
|
344
|
+
}
|
345
|
+
data = request.data.ethLog
|
346
|
+
break
|
347
|
+
case HandlerType.ETH_TRACE:
|
348
|
+
if (!request.data?.ethTrace) {
|
349
|
+
throw new ServerError(Status.INVALID_ARGUMENT, "ethTrace can't be empty")
|
350
|
+
}
|
351
|
+
data = request.data.ethTrace
|
352
|
+
break
|
353
|
+
case HandlerType.ETH_BLOCK:
|
354
|
+
if (!request.data?.ethBlock) {
|
355
|
+
throw new ServerError(Status.INVALID_ARGUMENT, "ethBlock can't be empty")
|
356
|
+
}
|
357
|
+
data = request.data.ethBlock
|
358
|
+
break
|
359
|
+
case HandlerType.ETH_TRANSACTION:
|
360
|
+
if (!request.data?.ethTransaction) {
|
361
|
+
throw new ServerError(Status.INVALID_ARGUMENT, "ethTransaction can't be empty")
|
362
|
+
}
|
363
|
+
data = request.data.ethTransaction
|
364
|
+
break
|
365
|
+
default:
|
366
|
+
throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)
|
367
|
+
}
|
368
|
+
const partitions = await this.partitionManager.processPartitionForHandlerType(
|
369
|
+
request.handlerType,
|
370
|
+
request.handlerIds,
|
371
|
+
data
|
372
|
+
)
|
373
|
+
return {
|
374
|
+
partitions
|
375
|
+
}
|
376
|
+
}
|
377
|
+
|
326
378
|
async start(request: StartRequest) {
|
327
379
|
const allowedChainIds = new Set<string>(Object.values(EthChainId))
|
328
380
|
|
package/src/eth/eth.ts
CHANGED
@@ -143,7 +143,13 @@ export function formatEthData(data: {
|
|
143
143
|
trace?: any
|
144
144
|
transaction?: any
|
145
145
|
transactionReceipt?: any
|
146
|
+
__formattedEthData?: any
|
146
147
|
}) {
|
148
|
+
// Return cached result if it exists
|
149
|
+
if (data.__formattedEthData) {
|
150
|
+
return data.__formattedEthData
|
151
|
+
}
|
152
|
+
|
147
153
|
const log = data.log ? formatLog(data.log) : undefined
|
148
154
|
if (data.block && !data.block.transactions) {
|
149
155
|
data.block.transactions = []
|
@@ -160,13 +166,18 @@ export function formatEthData(data: {
|
|
160
166
|
transaction = formatTransactionResponse(data.transaction)
|
161
167
|
}
|
162
168
|
const transactionReceipt = data.transactionReceipt ? formatTransactionReceipt(data.transactionReceipt) : undefined
|
163
|
-
|
169
|
+
|
170
|
+
const result = {
|
164
171
|
log,
|
165
172
|
block,
|
166
173
|
trace,
|
167
174
|
transaction,
|
168
175
|
transactionReceipt
|
169
176
|
}
|
177
|
+
|
178
|
+
// Cache the result on the input data object
|
179
|
+
data.__formattedEthData = result
|
180
|
+
return result
|
170
181
|
}
|
171
182
|
|
172
183
|
export function formatRichBlock(block: RichBlock): RichBlock {
|
@@ -119,7 +119,7 @@ async function codegenInternal(abisDir: string, outDir: string): Promise<number>
|
|
119
119
|
import { FuelAbstractProcessor, FuelContractContext, FuelProcessorConfig, TypedCall, FuelFetchConfig, FuelCall, FuelLog, addFuelProcessor, getFuelProcessor, FuelBaseProcessorTemplate } from '@sentio/sdk/fuel'
|
120
120
|
import {${abi.commonTypesInUse.join(',')}} from './common.js'
|
121
121
|
import {${importedTypes.join(',')}, ${abi.capitalizedName}} from './${abi.capitalizedName}.js'
|
122
|
-
|
122
|
+
import { HandlerOptions } from '@sentio/sdk'
|
123
123
|
import type { BigNumberish, BN } from 'fuels';
|
124
124
|
import type { BytesLike, Bytes, StdString, StrSlice, RawSlice, B256Address, ChecksumAddress, Address } from 'fuels';
|
125
125
|
|
@@ -221,8 +221,8 @@ function genCallType(f: IFunction) {
|
|
221
221
|
function genOnCallFunction(contractName: string, f: IFunction) {
|
222
222
|
const name = upperFirst(f.name)
|
223
223
|
return `
|
224
|
-
onCall${name}(handler: (call: ${contractName}.${name}Call, ctx: FuelContractContext<${contractName}>) => void | Promise<void>,
|
225
|
-
return super.onCall('${f.name}', (call, ctx) => handler(new ${contractName}.${name}Call(call), ctx),
|
224
|
+
onCall${name}(handler: (call: ${contractName}.${name}Call, ctx: FuelContractContext<${contractName}>) => void | Promise<void>, handlerOptions?: HandlerOptions<FuelFetchConfig, ${contractName}.${name}Call>) {
|
225
|
+
return super.onCall('${f.name}', (call, ctx) => handler(new ${contractName}.${name}Call(call), ctx), handlerOptions)
|
226
226
|
}`
|
227
227
|
}
|
228
228
|
|
@@ -255,8 +255,8 @@ function genOnLogFunction(contractName: string, [type, ids]: [string, string[]])
|
|
255
255
|
|
256
256
|
if (ids.length == 1) {
|
257
257
|
return `
|
258
|
-
onLog${name}(handler: (log: FuelLog<${type}>, ctx: FuelContractContext<${contractName}>) => void | Promise<void
|
259
|
-
return super.onLog<${type}>([Log${name}Id], (log, ctx) => handler(log, ctx))
|
258
|
+
onLog${name}(handler: (log: FuelLog<${type}>, ctx: FuelContractContext<${contractName}>) => void | Promise<void>, handlerOptions?: HandlerOptions<object, FuelLog<${type}>>) {
|
259
|
+
return super.onLog<${type}>([Log${name}Id], (log, ctx) => handler(log, ctx), handlerOptions)
|
260
260
|
}`
|
261
261
|
}
|
262
262
|
const logIdFilterValues = ids.map((_, idx) => `Log${name}Id${idx}`)
|
package/src/fuel/fuel-plugin.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { errorString, GLOBAL_CONFIG, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime'
|
2
|
+
import { PartitionHandlerManager } from '../core/index.js'
|
2
3
|
import {
|
3
4
|
ContractConfig,
|
4
5
|
Data_FuelBlock,
|
@@ -8,6 +9,7 @@ import {
|
|
8
9
|
HandlerType,
|
9
10
|
ProcessConfigResponse,
|
10
11
|
ProcessResult,
|
12
|
+
ProcessStreamResponse_Partitions,
|
11
13
|
StartRequest
|
12
14
|
} from '@sentio/protos'
|
13
15
|
|
@@ -32,6 +34,8 @@ export class FuelPlugin extends Plugin {
|
|
32
34
|
receiptHandlers: []
|
33
35
|
}
|
34
36
|
|
37
|
+
partitionManager = new PartitionHandlerManager()
|
38
|
+
|
35
39
|
async configure(config: ProcessConfigResponse) {
|
36
40
|
const handlers: Handlers = {
|
37
41
|
transactionHandlers: [],
|
@@ -54,6 +58,11 @@ export class FuelPlugin extends Plugin {
|
|
54
58
|
})
|
55
59
|
for (const txHandler of processor.txHandlers) {
|
56
60
|
const handlerId = handlers.transactionHandlers.push(txHandler.handler) - 1
|
61
|
+
this.partitionManager.registerPartitionHandler(
|
62
|
+
HandlerType.FUEL_TRANSACTION,
|
63
|
+
handlerId,
|
64
|
+
txHandler.partitionHandler
|
65
|
+
)
|
57
66
|
const handlerName = txHandler.handlerName
|
58
67
|
if (processor instanceof FuelProcessor) {
|
59
68
|
// on transaction
|
@@ -82,6 +91,11 @@ export class FuelPlugin extends Plugin {
|
|
82
91
|
|
83
92
|
for (const receiptHandler of processor.receiptHandlers ?? []) {
|
84
93
|
const handlerId = handlers.receiptHandlers.push(receiptHandler.handler) - 1
|
94
|
+
this.partitionManager.registerPartitionHandler(
|
95
|
+
HandlerType.FUEL_RECEIPT,
|
96
|
+
handlerId,
|
97
|
+
receiptHandler.partitionHandler
|
98
|
+
)
|
85
99
|
const handlerName = receiptHandler.handlerName
|
86
100
|
if (processor instanceof FuelProcessor) {
|
87
101
|
contractConfig.fuelReceiptConfigs.push({
|
@@ -94,6 +108,7 @@ export class FuelPlugin extends Plugin {
|
|
94
108
|
|
95
109
|
for (const blockHandler of processor.blockHandlers) {
|
96
110
|
const handlerId = handlers.blockHandlers.push(blockHandler.handler) - 1
|
111
|
+
this.partitionManager.registerPartitionHandler(HandlerType.FUEL_BLOCK, handlerId, blockHandler.partitionHandler)
|
97
112
|
contractConfig.intervalConfigs.push({
|
98
113
|
slot: 0,
|
99
114
|
slotInterval: blockHandler.blockInterval,
|
@@ -132,6 +147,47 @@ export class FuelPlugin extends Plugin {
|
|
132
147
|
}
|
133
148
|
}
|
134
149
|
|
150
|
+
async partition(request: DataBinding): Promise<ProcessStreamResponse_Partitions> {
|
151
|
+
let data: any
|
152
|
+
switch (request.handlerType) {
|
153
|
+
case HandlerType.FUEL_TRANSACTION:
|
154
|
+
if (!request.data?.fuelTransaction) {
|
155
|
+
throw new ServerError(Status.INVALID_ARGUMENT, "fuelTransaction can't be empty")
|
156
|
+
}
|
157
|
+
data = request.data.fuelTransaction
|
158
|
+
break
|
159
|
+
case HandlerType.FUEL_RECEIPT:
|
160
|
+
if (!request.data?.fuelLog) {
|
161
|
+
throw new ServerError(Status.INVALID_ARGUMENT, "fuelReceipt can't be empty")
|
162
|
+
}
|
163
|
+
data = request.data.fuelLog
|
164
|
+
break
|
165
|
+
case HandlerType.FUEL_BLOCK:
|
166
|
+
if (!request.data?.fuelBlock) {
|
167
|
+
throw new ServerError(Status.INVALID_ARGUMENT, "fuelBlock can't be empty")
|
168
|
+
}
|
169
|
+
data = request.data.fuelBlock
|
170
|
+
break
|
171
|
+
case HandlerType.FUEL_CALL:
|
172
|
+
// FUEL_CALL uses the same data as FUEL_TRANSACTION
|
173
|
+
if (!request.data?.fuelTransaction) {
|
174
|
+
throw new ServerError(Status.INVALID_ARGUMENT, "fuelTransaction can't be empty for FUEL_CALL")
|
175
|
+
}
|
176
|
+
data = request.data.fuelTransaction
|
177
|
+
break
|
178
|
+
default:
|
179
|
+
throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)
|
180
|
+
}
|
181
|
+
const partitions = await this.partitionManager.processPartitionForHandlerType(
|
182
|
+
request.handlerType,
|
183
|
+
request.handlerIds,
|
184
|
+
data
|
185
|
+
)
|
186
|
+
return {
|
187
|
+
partitions
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
135
191
|
async start(request: StartRequest) {
|
136
192
|
try {
|
137
193
|
for (const processor of FuelProcessorState.INSTANCE.getValues()) {
|