@sentio/sdk 4.0.0-rc.1 → 4.0.0-rc.3
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/aptos-plugin.d.ts +1 -1
- package/lib/aptos/aptos-plugin.d.ts.map +1 -1
- package/lib/aptos/aptos-plugin.js +43 -42
- package/lib/aptos/aptos-plugin.js.map +1 -1
- package/lib/aptos/aptos-processor.d.ts +1 -1
- package/lib/aptos/aptos-processor.d.ts.map +1 -1
- package/lib/aptos/aptos-processor.js +25 -25
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/aptos-resource-processor-template.d.ts +1 -1
- package/lib/aptos/aptos-resource-processor-template.d.ts.map +1 -1
- package/lib/aptos/aptos-resource-processor-template.js +10 -5
- package/lib/aptos/aptos-resource-processor-template.js.map +1 -1
- package/lib/aptos/context.d.ts +1 -1
- package/lib/aptos/context.d.ts.map +1 -1
- package/lib/aptos/context.js +8 -6
- package/lib/aptos/context.js.map +1 -1
- package/lib/aptos/data.d.ts +4 -4
- package/lib/aptos/data.d.ts.map +1 -1
- package/lib/core/base-context.d.ts +3 -2
- package/lib/core/base-context.d.ts.map +1 -1
- package/lib/core/base-context.js +12 -11
- package/lib/core/base-context.js.map +1 -1
- package/lib/core/core-plugin.d.ts.map +1 -1
- package/lib/core/core-plugin.js +6 -4
- package/lib/core/core-plugin.js.map +1 -1
- package/lib/core/event-logger.d.ts +10 -2
- package/lib/core/event-logger.d.ts.map +1 -1
- package/lib/core/event-logger.js +42 -26
- package/lib/core/event-logger.js.map +1 -1
- package/lib/core/exporter.d.ts.map +1 -1
- package/lib/core/exporter.js +5 -3
- package/lib/core/exporter.js.map +1 -1
- package/lib/core/handler-options.d.ts +1 -1
- package/lib/core/handler-options.d.ts.map +1 -1
- package/lib/core/handler-register.d.ts +1 -1
- package/lib/core/handler-register.d.ts.map +1 -1
- package/lib/core/handler-register.js +2 -2
- package/lib/core/handler-register.js.map +1 -1
- package/lib/core/meter.d.ts +4 -3
- package/lib/core/meter.d.ts.map +1 -1
- package/lib/core/meter.js +5 -4
- package/lib/core/meter.js.map +1 -1
- package/lib/core/normalization.d.ts +1 -1
- package/lib/core/normalization.d.ts.map +1 -1
- package/lib/core/normalization.js +41 -31
- package/lib/core/normalization.js.map +1 -1
- package/lib/core/numberish.d.ts +1 -1
- package/lib/core/numberish.d.ts.map +1 -1
- package/lib/core/numberish.js +35 -30
- package/lib/core/numberish.js.map +1 -1
- package/lib/core/partition-handler-manager.d.ts +1 -1
- package/lib/core/partition-handler-manager.d.ts.map +1 -1
- package/lib/core/partition-handler-manager.js +10 -9
- package/lib/core/partition-handler-manager.js.map +1 -1
- package/lib/cosmos/context.d.ts.map +1 -1
- package/lib/cosmos/context.js +4 -2
- package/lib/cosmos/context.js.map +1 -1
- package/lib/cosmos/cosmos-plugin.d.ts.map +1 -1
- package/lib/cosmos/cosmos-plugin.js +11 -10
- package/lib/cosmos/cosmos-plugin.js.map +1 -1
- package/lib/cosmos/cosmos-processor.js.map +1 -1
- package/lib/eth/abi-decoder/decode-worker.js +2 -2
- package/lib/eth/abi-decoder/decode-worker.js.map +1 -1
- package/lib/eth/account-processor.d.ts +2 -2
- package/lib/eth/account-processor.d.ts.map +1 -1
- package/lib/eth/account-processor.js +10 -9
- package/lib/eth/account-processor.js.map +1 -1
- package/lib/eth/base-processor-template.d.ts +3 -3
- package/lib/eth/base-processor-template.d.ts.map +1 -1
- package/lib/eth/base-processor-template.js +12 -8
- package/lib/eth/base-processor-template.js.map +1 -1
- package/lib/eth/base-processor.d.ts +1 -1
- package/lib/eth/base-processor.d.ts.map +1 -1
- package/lib/eth/base-processor.js +53 -46
- package/lib/eth/base-processor.js.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +48 -46
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.js +18 -16
- package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.js +38 -36
- package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.js +20 -18
- package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.js +30 -28
- package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.js +24 -22
- package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
- package/lib/eth/codegen/file.d.ts.map +1 -1
- package/lib/eth/codegen/file.js +2 -1
- package/lib/eth/codegen/file.js.map +1 -1
- package/lib/eth/codegen/function-calls.js +1 -1
- package/lib/eth/context.d.ts +1 -1
- package/lib/eth/context.d.ts.map +1 -1
- package/lib/eth/context.js +17 -11
- package/lib/eth/context.js.map +1 -1
- package/lib/eth/eth-plugin.d.ts.map +1 -1
- package/lib/eth/eth-plugin.js +83 -75
- package/lib/eth/eth-plugin.js.map +1 -1
- package/lib/eth/eth.d.ts +6 -6
- package/lib/eth/eth.d.ts.map +1 -1
- package/lib/eth/eth.js +39 -26
- package/lib/eth/eth.js.map +1 -1
- package/lib/eth/index.d.ts +1 -1
- package/lib/eth/index.d.ts.map +1 -1
- package/lib/eth/index.js +0 -1
- package/lib/eth/index.js.map +1 -1
- package/lib/fuel/asset-processor.d.ts +2 -2
- package/lib/fuel/asset-processor.d.ts.map +1 -1
- package/lib/fuel/asset-processor.js +5 -3
- package/lib/fuel/asset-processor.js.map +1 -1
- package/lib/fuel/context.d.ts.map +1 -1
- package/lib/fuel/context.js +4 -2
- package/lib/fuel/context.js.map +1 -1
- package/lib/fuel/fuel-plugin.d.ts.map +1 -1
- package/lib/fuel/fuel-plugin.js +41 -53
- package/lib/fuel/fuel-plugin.js.map +1 -1
- package/lib/fuel/fuel-processor-template.d.ts.map +1 -1
- package/lib/fuel/fuel-processor-template.js +7 -5
- package/lib/fuel/fuel-processor-template.js.map +1 -1
- package/lib/fuel/fuel-processor.d.ts.map +1 -1
- package/lib/fuel/fuel-processor.js +30 -20
- package/lib/fuel/fuel-processor.js.map +1 -1
- package/lib/fuel/global-processor.d.ts.map +1 -1
- package/lib/fuel/global-processor.js +2 -1
- package/lib/fuel/global-processor.js.map +1 -1
- package/lib/fuel/types.d.ts +10 -4
- package/lib/fuel/types.d.ts.map +1 -1
- package/lib/fuel/types.js.map +1 -1
- package/lib/iota/context.d.ts +1 -1
- package/lib/iota/context.d.ts.map +1 -1
- package/lib/iota/context.js +8 -6
- package/lib/iota/context.js.map +1 -1
- package/lib/iota/iota-object-processor-template.d.ts +1 -1
- package/lib/iota/iota-object-processor-template.d.ts.map +1 -1
- package/lib/iota/iota-object-processor-template.js +17 -12
- package/lib/iota/iota-object-processor-template.js.map +1 -1
- package/lib/iota/iota-object-processor.d.ts +1 -1
- package/lib/iota/iota-object-processor.d.ts.map +1 -1
- package/lib/iota/iota-object-processor.js +23 -16
- package/lib/iota/iota-object-processor.js.map +1 -1
- package/lib/iota/iota-plugin-part.d.ts +1 -1
- package/lib/iota/iota-plugin-part.d.ts.map +1 -1
- package/lib/iota/iota-plugin-part.js +16 -15
- package/lib/iota/iota-plugin-part.js.map +1 -1
- package/lib/iota/iota-processor.d.ts +1 -1
- package/lib/iota/iota-processor.d.ts.map +1 -1
- package/lib/iota/iota-processor.js +18 -17
- package/lib/iota/iota-processor.js.map +1 -1
- package/lib/iota/network.js +2 -2
- package/lib/iota/network.js.map +1 -1
- package/lib/move/filter.d.ts +1 -1
- package/lib/move/filter.d.ts.map +1 -1
- package/lib/move/index.d.ts +1 -1
- package/lib/move/index.d.ts.map +1 -1
- package/lib/move/index.js +0 -1
- package/lib/move/index.js.map +1 -1
- package/lib/solana/builtin/types.d.ts +4 -4
- package/lib/solana/solana-context.d.ts.map +1 -1
- package/lib/solana/solana-context.js +4 -3
- package/lib/solana/solana-context.js.map +1 -1
- package/lib/solana/solana-plugin.d.ts.map +1 -1
- package/lib/solana/solana-plugin.js +19 -18
- package/lib/solana/solana-plugin.js.map +1 -1
- package/lib/solana/solana-processor.d.ts.map +1 -1
- package/lib/solana/solana-processor.js +8 -3
- package/lib/solana/solana-processor.js.map +1 -1
- package/lib/store/cache.d.ts.map +1 -1
- package/lib/store/cache.js +22 -17
- package/lib/store/cache.js.map +1 -1
- package/lib/store/convert.d.ts +1 -1
- package/lib/store/convert.d.ts.map +1 -1
- package/lib/store/convert.js +67 -104
- package/lib/store/convert.js.map +1 -1
- package/lib/store/decorators.d.ts +1 -1
- package/lib/store/decorators.d.ts.map +1 -1
- package/lib/store/decorators.js +3 -1
- package/lib/store/decorators.js.map +1 -1
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js +24 -16
- package/lib/store/store.js.map +1 -1
- package/lib/store/types.js +24 -32
- package/lib/store/types.js.map +1 -1
- package/lib/store/util.d.ts +1 -1
- package/lib/store/util.d.ts.map +1 -1
- package/lib/store/util.js +13 -17
- package/lib/store/util.js.map +1 -1
- package/lib/sui/context.d.ts +1 -1
- package/lib/sui/context.d.ts.map +1 -1
- package/lib/sui/context.js +8 -6
- package/lib/sui/context.js.map +1 -1
- package/lib/sui/sui-object-processor-template.d.ts +1 -1
- package/lib/sui/sui-object-processor-template.d.ts.map +1 -1
- package/lib/sui/sui-object-processor-template.js +17 -12
- package/lib/sui/sui-object-processor-template.js.map +1 -1
- package/lib/sui/sui-object-processor.d.ts +1 -1
- package/lib/sui/sui-object-processor.d.ts.map +1 -1
- package/lib/sui/sui-object-processor.js +23 -16
- package/lib/sui/sui-object-processor.js.map +1 -1
- package/lib/sui/sui-plugin-part.d.ts +1 -1
- package/lib/sui/sui-plugin-part.d.ts.map +1 -1
- package/lib/sui/sui-plugin-part.js +16 -15
- package/lib/sui/sui-plugin-part.js.map +1 -1
- package/lib/sui/sui-plugin.d.ts +1 -1
- package/lib/sui/sui-plugin.d.ts.map +1 -1
- package/lib/sui/sui-plugin.js +35 -34
- package/lib/sui/sui-plugin.js.map +1 -1
- package/lib/sui/sui-processor.d.ts +1 -1
- package/lib/sui/sui-processor.d.ts.map +1 -1
- package/lib/sui/sui-processor.js +18 -17
- package/lib/sui/sui-processor.js.map +1 -1
- package/lib/testing/aptos-facet.d.ts.map +1 -1
- package/lib/testing/aptos-facet.js +18 -11
- package/lib/testing/aptos-facet.js.map +1 -1
- package/lib/testing/cosmos-facet.d.ts.map +1 -1
- package/lib/testing/cosmos-facet.js +10 -6
- package/lib/testing/cosmos-facet.js.map +1 -1
- package/lib/testing/eth-facet.d.ts +1 -1
- package/lib/testing/eth-facet.d.ts.map +1 -1
- package/lib/testing/eth-facet.js +34 -18
- package/lib/testing/eth-facet.js.map +1 -1
- package/lib/testing/fuel-facet.d.ts.map +1 -1
- package/lib/testing/fuel-facet.js +28 -18
- package/lib/testing/fuel-facet.js.map +1 -1
- package/lib/testing/iota-facet.d.ts.map +1 -1
- package/lib/testing/iota-facet.js +32 -20
- package/lib/testing/iota-facet.js.map +1 -1
- package/lib/testing/memory-database.d.ts +11 -3
- package/lib/testing/memory-database.d.ts.map +1 -1
- package/lib/testing/memory-database.js +84 -71
- package/lib/testing/memory-database.js.map +1 -1
- package/lib/testing/metric-utils.d.ts +2 -2
- package/lib/testing/metric-utils.d.ts.map +1 -1
- package/lib/testing/metric-utils.js +13 -12
- package/lib/testing/metric-utils.js.map +1 -1
- package/lib/testing/solana-facet.d.ts +3 -2
- package/lib/testing/solana-facet.d.ts.map +1 -1
- package/lib/testing/solana-facet.js +8 -5
- package/lib/testing/solana-facet.js.map +1 -1
- package/lib/testing/sui-facet.d.ts.map +1 -1
- package/lib/testing/sui-facet.js +30 -20
- package/lib/testing/sui-facet.js.map +1 -1
- package/lib/testing/test-processor-server.d.ts +1453 -16
- package/lib/testing/test-processor-server.d.ts.map +1 -1
- package/lib/testing/test-processor-server.js +108 -45
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/utils/price.d.ts +1 -1
- package/lib/utils/price.d.ts.map +1 -1
- package/lib/utils/price.js +19 -12
- package/lib/utils/price.js.map +1 -1
- package/package.json +5 -7
- package/src/aptos/aptos-plugin.ts +105 -91
- package/src/aptos/aptos-processor.ts +33 -25
- package/src/aptos/aptos-resource-processor-template.ts +15 -6
- package/src/aptos/context.ts +8 -7
- package/src/aptos/data.ts +4 -4
- package/src/core/base-context.ts +19 -12
- package/src/core/core-plugin.ts +10 -7
- package/src/core/event-logger.ts +63 -34
- package/src/core/exporter.ts +5 -4
- package/src/core/handler-options.ts +1 -1
- package/src/core/handler-register.ts +3 -3
- package/src/core/meter.ts +9 -7
- package/src/core/normalization.ts +53 -31
- package/src/core/numberish.ts +46 -30
- package/src/core/partition-handler-manager.ts +13 -11
- package/src/cosmos/context.ts +4 -3
- package/src/cosmos/cosmos-plugin.ts +19 -15
- package/src/cosmos/cosmos-processor.ts +2 -2
- package/src/eth/abi-decoder/decode-worker.ts +2 -2
- package/src/eth/account-processor.ts +21 -12
- package/src/eth/base-processor-template.ts +22 -10
- package/src/eth/base-processor.ts +66 -54
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +177 -116
- package/src/eth/builtin/internal/erc1155-processor.ts +73 -38
- package/src/eth/builtin/internal/erc20-processor.ts +152 -91
- package/src/eth/builtin/internal/erc20bytes-processor.ts +80 -46
- package/src/eth/builtin/internal/erc721-processor.ts +109 -65
- package/src/eth/builtin/internal/weth9-processor.ts +95 -56
- package/src/eth/codegen/file.ts +2 -1
- package/src/eth/codegen/function-calls.ts +1 -1
- package/src/eth/context.ts +29 -13
- package/src/eth/eth-plugin.ts +135 -118
- package/src/eth/eth.ts +46 -32
- package/src/eth/index.ts +1 -1
- package/src/fuel/asset-processor.ts +16 -8
- package/src/fuel/context.ts +4 -3
- package/src/fuel/fuel-plugin.ts +71 -73
- package/src/fuel/fuel-processor-template.ts +7 -6
- package/src/fuel/fuel-processor.ts +35 -23
- package/src/fuel/global-processor.ts +3 -3
- package/src/fuel/types.ts +10 -4
- package/src/iota/context.ts +8 -7
- package/src/iota/iota-object-processor-template.ts +25 -15
- package/src/iota/iota-object-processor.ts +33 -22
- package/src/iota/iota-plugin-part.ts +41 -34
- package/src/iota/iota-processor.ts +25 -17
- package/src/iota/network.ts +2 -2
- package/src/move/filter.ts +1 -1
- package/src/move/index.ts +1 -1
- package/src/solana/solana-context.ts +4 -3
- package/src/solana/solana-plugin.ts +27 -24
- package/src/solana/solana-processor.ts +14 -6
- package/src/store/cache.ts +22 -18
- package/src/store/convert.ts +68 -104
- package/src/store/decorators.ts +3 -2
- package/src/store/store.ts +30 -22
- package/src/store/types.ts +24 -33
- package/src/store/util.ts +13 -18
- package/src/sui/context.ts +8 -7
- package/src/sui/sui-object-processor-template.ts +25 -15
- package/src/sui/sui-object-processor.ts +33 -22
- package/src/sui/sui-plugin-part.ts +41 -34
- package/src/sui/sui-plugin.ts +49 -47
- package/src/sui/sui-processor.ts +25 -17
- package/src/testing/aptos-facet.ts +18 -11
- package/src/testing/cosmos-facet.ts +10 -6
- package/src/testing/eth-facet.ts +40 -18
- package/src/testing/fuel-facet.ts +28 -18
- package/src/testing/iota-facet.ts +32 -20
- package/src/testing/memory-database.ts +126 -88
- package/src/testing/metric-utils.ts +15 -14
- package/src/testing/solana-facet.ts +11 -6
- package/src/testing/sui-facet.ts +30 -20
- package/src/testing/test-processor-server.ts +169 -79
- package/src/utils/price.ts +20 -13
|
@@ -2,21 +2,27 @@ import { errorString, GLOBAL_CONFIG, mergeProcessResults, Plugin, PluginManager,
|
|
|
2
2
|
import { PartitionHandlerManager } from '../core/index.js'
|
|
3
3
|
import { HandlerRegister } from '../core/handler-register.js'
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
DataBinding,
|
|
5
|
+
AccountConfigSchema,
|
|
6
|
+
ContractConfigSchema,
|
|
7
|
+
type DataBinding,
|
|
8
8
|
HandlerType,
|
|
9
|
-
InitResponse,
|
|
10
|
-
MoveCallHandlerConfig,
|
|
11
|
-
|
|
9
|
+
type InitResponse,
|
|
10
|
+
type MoveCallHandlerConfig,
|
|
11
|
+
MoveCallHandlerConfigSchema,
|
|
12
|
+
type MoveEventHandlerConfig,
|
|
13
|
+
MoveEventHandlerConfigSchema,
|
|
14
|
+
MoveOnIntervalConfigSchema,
|
|
12
15
|
MoveOwnerType,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
MoveResourceChangeConfigSchema,
|
|
17
|
+
type ProcessConfigResponse,
|
|
18
|
+
type ProcessResult,
|
|
19
|
+
type ProcessStreamResponse_Partitions,
|
|
20
|
+
ProcessStreamResponse_PartitionsSchema,
|
|
21
|
+
type StartRequest
|
|
17
22
|
} from '@sentio/protos'
|
|
23
|
+
import { create } from '@bufbuild/protobuf'
|
|
18
24
|
|
|
19
|
-
import {
|
|
25
|
+
import { ConnectError, Code } from '@connectrpc/connect'
|
|
20
26
|
|
|
21
27
|
import { AptosProcessorState, AptosResourceProcessorState } from './aptos-processor.js'
|
|
22
28
|
|
|
@@ -61,7 +67,7 @@ export class AptosPlugin extends Plugin {
|
|
|
61
67
|
network: <AptosNetwork>instance.contract?.chainId || AptosNetwork.MAIN_NET,
|
|
62
68
|
startVersion: instance.startBlock || 0n,
|
|
63
69
|
endVersion: instance.endBlock,
|
|
64
|
-
baseLabels: instance.baseLabels
|
|
70
|
+
baseLabels: instance.baseLabels as { [key: string]: string } | undefined
|
|
65
71
|
},
|
|
66
72
|
NoopContext
|
|
67
73
|
)
|
|
@@ -75,7 +81,7 @@ export class AptosPlugin extends Plugin {
|
|
|
75
81
|
if (forChainId !== undefined && forChainId !== chainId.toString()) {
|
|
76
82
|
continue
|
|
77
83
|
}
|
|
78
|
-
const contractConfig =
|
|
84
|
+
const contractConfig = create(ContractConfigSchema, {
|
|
79
85
|
processorType: USER_PROCESSOR,
|
|
80
86
|
contract: {
|
|
81
87
|
name: aptosProcessor.moduleName,
|
|
@@ -90,7 +96,7 @@ export class AptosPlugin extends Plugin {
|
|
|
90
96
|
for (const handler of aptosProcessor.eventHandlers) {
|
|
91
97
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
92
98
|
this.partitionManager.registerPartitionHandler(HandlerType.APT_EVENT, handlerId, handler.partitionHandler)
|
|
93
|
-
const eventHandlerConfig: MoveEventHandlerConfig = {
|
|
99
|
+
const eventHandlerConfig: MoveEventHandlerConfig = create(MoveEventHandlerConfigSchema, {
|
|
94
100
|
filters: handler.filters.map((f) => {
|
|
95
101
|
return {
|
|
96
102
|
type: f.type,
|
|
@@ -101,7 +107,7 @@ export class AptosPlugin extends Plugin {
|
|
|
101
107
|
fetchConfig: handler.fetchConfig,
|
|
102
108
|
handlerId,
|
|
103
109
|
handlerName: handler.handlerName
|
|
104
|
-
}
|
|
110
|
+
})
|
|
105
111
|
contractConfig.moveEventConfigs.push(eventHandlerConfig)
|
|
106
112
|
}
|
|
107
113
|
|
|
@@ -109,7 +115,7 @@ export class AptosPlugin extends Plugin {
|
|
|
109
115
|
for (const handler of aptosProcessor.callHandlers) {
|
|
110
116
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
111
117
|
this.partitionManager.registerPartitionHandler(HandlerType.APT_CALL, handlerId, handler.partitionHandler)
|
|
112
|
-
const functionHandlerConfig: MoveCallHandlerConfig = {
|
|
118
|
+
const functionHandlerConfig: MoveCallHandlerConfig = create(MoveCallHandlerConfigSchema, {
|
|
113
119
|
filters: handler.filters.map((filter) => {
|
|
114
120
|
return {
|
|
115
121
|
function: filter.function,
|
|
@@ -123,7 +129,7 @@ export class AptosPlugin extends Plugin {
|
|
|
123
129
|
fetchConfig: handler.fetchConfig,
|
|
124
130
|
handlerId,
|
|
125
131
|
handlerName: handler.handlerName
|
|
126
|
-
}
|
|
132
|
+
})
|
|
127
133
|
contractConfig.moveCallConfigs.push(functionHandlerConfig)
|
|
128
134
|
}
|
|
129
135
|
|
|
@@ -131,21 +137,23 @@ export class AptosPlugin extends Plugin {
|
|
|
131
137
|
for (const handler of aptosProcessor.transactionIntervalHandlers) {
|
|
132
138
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
133
139
|
this.partitionManager.registerPartitionHandler(HandlerType.APT_CALL, handlerId, handler.partitionHandler)
|
|
134
|
-
contractConfig.moveIntervalConfigs.push(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
140
|
+
contractConfig.moveIntervalConfigs.push(
|
|
141
|
+
create(MoveOnIntervalConfigSchema, {
|
|
142
|
+
intervalConfig: {
|
|
143
|
+
handlerId: handlerId,
|
|
144
|
+
handlerName: handler.handlerName,
|
|
145
|
+
minutes: 0,
|
|
146
|
+
minutesInterval: handler.timeIntervalInMinutes,
|
|
147
|
+
slot: 0,
|
|
148
|
+
slotInterval: handler.versionInterval,
|
|
149
|
+
fetchConfig: undefined
|
|
150
|
+
},
|
|
151
|
+
ownerType: MoveOwnerType.ADDRESS,
|
|
152
|
+
fetchConfig: handler.fetchConfig,
|
|
153
|
+
resourceFetchConfig: undefined,
|
|
154
|
+
type: ''
|
|
155
|
+
})
|
|
156
|
+
)
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
config.contractConfigs.push(contractConfig)
|
|
@@ -157,7 +165,7 @@ export class AptosPlugin extends Plugin {
|
|
|
157
165
|
if (forChainId !== undefined && forChainId !== chainId.toString()) {
|
|
158
166
|
continue
|
|
159
167
|
}
|
|
160
|
-
const accountConfig =
|
|
168
|
+
const accountConfig = create(AccountConfigSchema, {
|
|
161
169
|
address: aptosProcessor.config.address,
|
|
162
170
|
chainId: aptosProcessor.getChainId(),
|
|
163
171
|
startBlock: aptosProcessor.config.startVersion,
|
|
@@ -166,12 +174,14 @@ export class AptosPlugin extends Plugin {
|
|
|
166
174
|
for (const handler of aptosProcessor.resourceChangeHandlers) {
|
|
167
175
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
168
176
|
this.partitionManager.registerPartitionHandler(HandlerType.APT_RESOURCE, handlerId, handler.partitionHandler)
|
|
169
|
-
accountConfig.moveResourceChangeConfigs.push(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
177
|
+
accountConfig.moveResourceChangeConfigs.push(
|
|
178
|
+
create(MoveResourceChangeConfigSchema, {
|
|
179
|
+
handlerId: handlerId,
|
|
180
|
+
handlerName: handler.handlerName,
|
|
181
|
+
types: typeof handler.type === 'string' ? [handler.type] : handler.type,
|
|
182
|
+
includeDeleted: false
|
|
183
|
+
})
|
|
184
|
+
)
|
|
175
185
|
}
|
|
176
186
|
|
|
177
187
|
config.accountConfigs.push(accountConfig)
|
|
@@ -182,7 +192,7 @@ export class AptosPlugin extends Plugin {
|
|
|
182
192
|
if (forChainId !== undefined && forChainId !== chainId.toString()) {
|
|
183
193
|
continue
|
|
184
194
|
}
|
|
185
|
-
const accountConfig =
|
|
195
|
+
const accountConfig = create(AccountConfigSchema, {
|
|
186
196
|
address: aptosProcessor.config.address,
|
|
187
197
|
chainId: aptosProcessor.getChainId(),
|
|
188
198
|
startBlock: aptosProcessor.config.startVersion,
|
|
@@ -192,29 +202,33 @@ export class AptosPlugin extends Plugin {
|
|
|
192
202
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
193
203
|
this.partitionManager.registerPartitionHandler(HandlerType.APT_RESOURCE, handlerId, handler.partitionHandler)
|
|
194
204
|
if (handler.timeIntervalInMinutes || handler.versionInterval) {
|
|
195
|
-
accountConfig.moveIntervalConfigs.push(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
accountConfig.moveIntervalConfigs.push(
|
|
206
|
+
create(MoveOnIntervalConfigSchema, {
|
|
207
|
+
intervalConfig: {
|
|
208
|
+
handlerId: handlerId,
|
|
209
|
+
handlerName: handler.handlerName,
|
|
210
|
+
minutes: 0,
|
|
211
|
+
minutesInterval: handler.timeIntervalInMinutes,
|
|
212
|
+
slot: 0,
|
|
213
|
+
slotInterval: handler.versionInterval,
|
|
214
|
+
fetchConfig: undefined
|
|
215
|
+
},
|
|
216
|
+
type: (Array.isArray(handler.type) ? handler.type[0] : handler.type) || '',
|
|
217
|
+
ownerType: MoveOwnerType.ADDRESS,
|
|
218
|
+
resourceFetchConfig: handler.fetchConfig,
|
|
203
219
|
fetchConfig: undefined
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
ownerType: MoveOwnerType.ADDRESS,
|
|
207
|
-
resourceFetchConfig: handler.fetchConfig,
|
|
208
|
-
fetchConfig: undefined
|
|
209
|
-
})
|
|
220
|
+
})
|
|
221
|
+
)
|
|
210
222
|
} else if (handler.type) {
|
|
211
223
|
// on resource change
|
|
212
|
-
accountConfig.moveResourceChangeConfigs.push(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
224
|
+
accountConfig.moveResourceChangeConfigs.push(
|
|
225
|
+
create(MoveResourceChangeConfigSchema, {
|
|
226
|
+
handlerId,
|
|
227
|
+
handlerName: handler.handlerName,
|
|
228
|
+
types: typeof handler.type == 'string' ? [handler.type] : handler.type,
|
|
229
|
+
includeDeleted: false
|
|
230
|
+
})
|
|
231
|
+
)
|
|
218
232
|
}
|
|
219
233
|
}
|
|
220
234
|
config.accountConfigs.push(accountConfig)
|
|
@@ -232,7 +246,7 @@ export class AptosPlugin extends Plugin {
|
|
|
232
246
|
case HandlerType.APT_RESOURCE:
|
|
233
247
|
return this.processAptosResource(request)
|
|
234
248
|
default:
|
|
235
|
-
throw new
|
|
249
|
+
throw new ConnectError('No handle type registered ' + request.handlerType, Code.InvalidArgument)
|
|
236
250
|
}
|
|
237
251
|
}
|
|
238
252
|
|
|
@@ -240,42 +254,42 @@ export class AptosPlugin extends Plugin {
|
|
|
240
254
|
let data: any
|
|
241
255
|
switch (request.handlerType) {
|
|
242
256
|
case HandlerType.APT_EVENT:
|
|
243
|
-
if (
|
|
244
|
-
throw new
|
|
257
|
+
if (request.data?.value.case !== 'aptEvent') {
|
|
258
|
+
throw new ConnectError("aptEvent can't be empty", Code.InvalidArgument)
|
|
245
259
|
}
|
|
246
|
-
data = new AptEvent(request.data.
|
|
260
|
+
data = new AptEvent(request.data.value.value)
|
|
247
261
|
break
|
|
248
262
|
case HandlerType.APT_CALL:
|
|
249
|
-
if (
|
|
250
|
-
throw new
|
|
263
|
+
if (request.data?.value.case !== 'aptCall') {
|
|
264
|
+
throw new ConnectError("aptCall can't be empty", Code.InvalidArgument)
|
|
251
265
|
}
|
|
252
|
-
data = new AptCall(request.data.
|
|
266
|
+
data = new AptCall(request.data.value.value)
|
|
253
267
|
break
|
|
254
268
|
case HandlerType.APT_RESOURCE:
|
|
255
|
-
if (
|
|
256
|
-
throw new
|
|
269
|
+
if (request.data?.value.case !== 'aptResource') {
|
|
270
|
+
throw new ConnectError("aptResource can't be empty", Code.InvalidArgument)
|
|
257
271
|
}
|
|
258
|
-
data = new AptResource(request.data.
|
|
272
|
+
data = new AptResource(request.data.value.value)
|
|
259
273
|
break
|
|
260
274
|
default:
|
|
261
|
-
throw new
|
|
275
|
+
throw new ConnectError('No handle type registered ' + request.handlerType, Code.InvalidArgument)
|
|
262
276
|
}
|
|
263
277
|
const partitions = await this.partitionManager.processPartitionForHandlerType(
|
|
264
278
|
request.handlerType,
|
|
265
279
|
request.handlerIds,
|
|
266
280
|
data
|
|
267
281
|
)
|
|
268
|
-
return {
|
|
282
|
+
return create(ProcessStreamResponse_PartitionsSchema, {
|
|
269
283
|
partitions
|
|
270
|
-
}
|
|
284
|
+
})
|
|
271
285
|
}
|
|
272
286
|
|
|
273
287
|
async processAptosEvent(binding: DataBinding): Promise<ProcessResult> {
|
|
274
|
-
if (
|
|
275
|
-
throw new
|
|
288
|
+
if (binding.data?.value.case !== 'aptEvent') {
|
|
289
|
+
throw new ConnectError("Event can't be empty", Code.InvalidArgument)
|
|
276
290
|
}
|
|
277
291
|
const promises: Promise<ProcessResult>[] = []
|
|
278
|
-
const event = new AptEvent(binding.data.
|
|
292
|
+
const event = new AptEvent(binding.data.value.value)
|
|
279
293
|
|
|
280
294
|
for (const handlerId of binding.handlerIds) {
|
|
281
295
|
const promise = this.handlerRegister
|
|
@@ -284,9 +298,9 @@ export class AptosPlugin extends Plugin {
|
|
|
284
298
|
handlerId
|
|
285
299
|
)(event)
|
|
286
300
|
.catch((e: any) => {
|
|
287
|
-
throw new
|
|
288
|
-
|
|
289
|
-
|
|
301
|
+
throw new ConnectError(
|
|
302
|
+
'error processing event: ' + JSON.stringify(event) + '\n' + errorString(e),
|
|
303
|
+
Code.Internal
|
|
290
304
|
)
|
|
291
305
|
})
|
|
292
306
|
if (GLOBAL_CONFIG.execution.sequential) {
|
|
@@ -298,10 +312,10 @@ export class AptosPlugin extends Plugin {
|
|
|
298
312
|
}
|
|
299
313
|
|
|
300
314
|
async processAptosResource(binding: DataBinding): Promise<ProcessResult> {
|
|
301
|
-
if (
|
|
302
|
-
throw new
|
|
315
|
+
if (binding.data?.value.case !== 'aptResource') {
|
|
316
|
+
throw new ConnectError("Resource can't be empty", Code.InvalidArgument)
|
|
303
317
|
}
|
|
304
|
-
const resource = new AptResource(binding.data.
|
|
318
|
+
const resource = new AptResource(binding.data.value.value)
|
|
305
319
|
|
|
306
320
|
const promises: Promise<ProcessResult>[] = []
|
|
307
321
|
for (const handlerId of binding.handlerIds) {
|
|
@@ -311,9 +325,9 @@ export class AptosPlugin extends Plugin {
|
|
|
311
325
|
handlerId
|
|
312
326
|
)(resource)
|
|
313
327
|
.catch((e: any) => {
|
|
314
|
-
throw new
|
|
315
|
-
|
|
316
|
-
|
|
328
|
+
throw new ConnectError(
|
|
329
|
+
'error processing resource: ' + JSON.stringify(resource) + '\n' + errorString(e),
|
|
330
|
+
Code.Internal
|
|
317
331
|
)
|
|
318
332
|
})
|
|
319
333
|
if (GLOBAL_CONFIG.execution.sequential) {
|
|
@@ -325,10 +339,10 @@ export class AptosPlugin extends Plugin {
|
|
|
325
339
|
}
|
|
326
340
|
|
|
327
341
|
async processAptosFunctionCall(binding: DataBinding): Promise<ProcessResult> {
|
|
328
|
-
if (
|
|
329
|
-
throw new
|
|
342
|
+
if (binding.data?.value.case !== 'aptCall') {
|
|
343
|
+
throw new ConnectError("Call can't be empty", Code.InvalidArgument)
|
|
330
344
|
}
|
|
331
|
-
const call = new AptCall(binding.data.
|
|
345
|
+
const call = new AptCall(binding.data.value.value)
|
|
332
346
|
|
|
333
347
|
const promises: Promise<ProcessResult>[] = []
|
|
334
348
|
for (const handlerId of binding.handlerIds) {
|
|
@@ -339,9 +353,9 @@ export class AptosPlugin extends Plugin {
|
|
|
339
353
|
handlerId
|
|
340
354
|
)(call)
|
|
341
355
|
.catch((e: any) => {
|
|
342
|
-
throw new
|
|
343
|
-
|
|
344
|
-
|
|
356
|
+
throw new ConnectError(
|
|
357
|
+
'error processing call: ' + JSON.stringify(call) + '\n' + errorString(e),
|
|
358
|
+
Code.Internal
|
|
345
359
|
)
|
|
346
360
|
})
|
|
347
361
|
if (GLOBAL_CONFIG.execution.sequential) {
|
|
@@ -11,8 +11,17 @@ import {
|
|
|
11
11
|
import { AptosBindOptions, AptosNetwork } from './network.js'
|
|
12
12
|
import { AptosContext, AptosResourcesContext, AptosTransactionContext } from './context.js'
|
|
13
13
|
import { ListStateStorage } from '@sentio/runtime'
|
|
14
|
-
import {
|
|
15
|
-
|
|
14
|
+
import {
|
|
15
|
+
type Data_AptResource,
|
|
16
|
+
type HandleInterval,
|
|
17
|
+
HandleIntervalSchema,
|
|
18
|
+
type MoveAccountFetchConfig,
|
|
19
|
+
MoveAccountFetchConfigSchema,
|
|
20
|
+
type MoveFetchConfig,
|
|
21
|
+
MoveFetchConfigSchema
|
|
22
|
+
} from '@sentio/protos'
|
|
23
|
+
import { create } from '@bufbuild/protobuf'
|
|
24
|
+
import { ConnectError, Code } from '@connectrpc/connect'
|
|
16
25
|
import {
|
|
17
26
|
accountTypeString,
|
|
18
27
|
CallHandler,
|
|
@@ -34,17 +43,17 @@ import { GeneralTransactionResponse, HandlerOptions } from './models.js'
|
|
|
34
43
|
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
|
35
44
|
import { AptCall, AptEvent, AptResource } from './data.js'
|
|
36
45
|
|
|
37
|
-
const DEFAULT_FETCH_CONFIG: MoveFetchConfig = {
|
|
46
|
+
const DEFAULT_FETCH_CONFIG: MoveFetchConfig = create(MoveFetchConfigSchema, {
|
|
38
47
|
resourceChanges: false,
|
|
39
48
|
allEvents: true,
|
|
40
49
|
inputs: true,
|
|
41
50
|
// for backward compatibility
|
|
42
51
|
supportMultisigFunc: true
|
|
43
|
-
}
|
|
52
|
+
})
|
|
44
53
|
|
|
45
|
-
export const DEFAULT_RESOURCE_FETCH_CONFIG: MoveAccountFetchConfig = {
|
|
54
|
+
export const DEFAULT_RESOURCE_FETCH_CONFIG: MoveAccountFetchConfig = create(MoveAccountFetchConfigSchema, {
|
|
46
55
|
owned: true
|
|
47
|
-
}
|
|
56
|
+
})
|
|
48
57
|
|
|
49
58
|
type IndexConfigure = {
|
|
50
59
|
address: string
|
|
@@ -84,7 +93,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
84
93
|
handlerOptions?: HandlerOptions<MoveFetchConfig, T>
|
|
85
94
|
): this {
|
|
86
95
|
let _filters: EventFilter[] = []
|
|
87
|
-
const _fetchConfig =
|
|
96
|
+
const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
|
|
88
97
|
|
|
89
98
|
if (Array.isArray(filter)) {
|
|
90
99
|
_filters = filter
|
|
@@ -100,7 +109,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
100
109
|
handlerName: getHandlerName(),
|
|
101
110
|
handler: async function (data) {
|
|
102
111
|
if (!data.rawTransaction) {
|
|
103
|
-
throw new
|
|
112
|
+
throw new ConnectError('event is null', Code.InvalidArgument)
|
|
104
113
|
}
|
|
105
114
|
const txn = data.transaction
|
|
106
115
|
|
|
@@ -143,7 +152,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
143
152
|
handlerOptions?: HandlerOptions<MoveFetchConfig, T>
|
|
144
153
|
): this {
|
|
145
154
|
let _filters: FunctionNameAndCallFilter[] = []
|
|
146
|
-
const _fetchConfig =
|
|
155
|
+
const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
|
|
147
156
|
|
|
148
157
|
if (Array.isArray(filter)) {
|
|
149
158
|
_filters = filter
|
|
@@ -159,7 +168,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
159
168
|
handlerName: getHandlerName(),
|
|
160
169
|
handler: async function (data) {
|
|
161
170
|
if (!data.rawTransaction) {
|
|
162
|
-
throw new
|
|
171
|
+
throw new ConnectError('call is null', Code.InvalidArgument)
|
|
163
172
|
}
|
|
164
173
|
const tx = data.transaction
|
|
165
174
|
|
|
@@ -201,7 +210,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
201
210
|
},
|
|
202
211
|
handleOptions?: HandlerOptions<MoveFetchConfig, UserTransactionResponse>
|
|
203
212
|
): this {
|
|
204
|
-
const _fetchConfig =
|
|
213
|
+
const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handleOptions })
|
|
205
214
|
|
|
206
215
|
const processor = this
|
|
207
216
|
const filter: FunctionNameAndCallFilter = { function: '', includeFailed: transactionFilter?.includeFailed }
|
|
@@ -216,7 +225,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
216
225
|
handlerName: getHandlerName(),
|
|
217
226
|
handler: async function (data) {
|
|
218
227
|
if (!data.rawTransaction) {
|
|
219
|
-
throw new
|
|
228
|
+
throw new ConnectError('call is null', Code.InvalidArgument)
|
|
220
229
|
}
|
|
221
230
|
const call = data.transaction
|
|
222
231
|
const ctx = new AptosContext(
|
|
@@ -287,9 +296,8 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
287
296
|
handlerName: getHandlerName(),
|
|
288
297
|
handler: async function (data) {
|
|
289
298
|
if (!data.rawResources || !data.version) {
|
|
290
|
-
throw new
|
|
299
|
+
throw new ConnectError('resource is null', Code.InvalidArgument)
|
|
291
300
|
}
|
|
292
|
-
const aptResource = new AptResource(data)
|
|
293
301
|
const timestamp = Number(data.timestampMicros)
|
|
294
302
|
const ctx = new AptosResourcesContext(
|
|
295
303
|
processor.config.network,
|
|
@@ -298,7 +306,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
298
306
|
timestamp,
|
|
299
307
|
processor.config.baseLabels
|
|
300
308
|
)
|
|
301
|
-
let resources = await
|
|
309
|
+
let resources = await data.decodeResources<T>(processor.coder)
|
|
302
310
|
|
|
303
311
|
if (hasAny) {
|
|
304
312
|
resources = resources.filter((r) => {
|
|
@@ -337,12 +345,12 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
337
345
|
handlerName: getHandlerName(),
|
|
338
346
|
handler: async function (data) {
|
|
339
347
|
if (!data.rawTransaction) {
|
|
340
|
-
throw new
|
|
348
|
+
throw new ConnectError('call is null', Code.InvalidArgument)
|
|
341
349
|
}
|
|
342
350
|
const transaction = JSON.parse(data.rawTransaction) as T
|
|
343
351
|
const timestampMicros = BigInt(transaction.timestamp)
|
|
344
352
|
if (timestampMicros > Number.MAX_SAFE_INTEGER) {
|
|
345
|
-
throw new
|
|
353
|
+
throw new ConnectError('timestamp is too large', Code.InvalidArgument)
|
|
346
354
|
}
|
|
347
355
|
|
|
348
356
|
const ctx = new AptosTransactionContext(
|
|
@@ -381,10 +389,10 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
381
389
|
): this {
|
|
382
390
|
return this.onInterval(
|
|
383
391
|
handler,
|
|
384
|
-
{
|
|
392
|
+
create(HandleIntervalSchema, {
|
|
385
393
|
recentInterval: timeIntervalInMinutes,
|
|
386
394
|
backfillInterval: backfillTimeIntervalInMinutes
|
|
387
|
-
},
|
|
395
|
+
}),
|
|
388
396
|
undefined,
|
|
389
397
|
handlerOptions
|
|
390
398
|
)
|
|
@@ -399,7 +407,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
|
399
407
|
return this.onInterval(
|
|
400
408
|
handler,
|
|
401
409
|
undefined,
|
|
402
|
-
{ recentInterval: versionInterval, backfillInterval: backfillVersionInterval },
|
|
410
|
+
create(HandleIntervalSchema, { recentInterval: versionInterval, backfillInterval: backfillVersionInterval }),
|
|
403
411
|
handlerOptions
|
|
404
412
|
)
|
|
405
413
|
}
|
|
@@ -521,7 +529,7 @@ export class AptosResourcesProcessor {
|
|
|
521
529
|
handlerName,
|
|
522
530
|
handler: async function (data) {
|
|
523
531
|
if (data.timestampMicros > Number.MAX_SAFE_INTEGER) {
|
|
524
|
-
throw new
|
|
532
|
+
throw new ConnectError('timestamp is too large', Code.InvalidArgument)
|
|
525
533
|
}
|
|
526
534
|
const aptResource = new AptResource(data)
|
|
527
535
|
const timestamp = Number(data.timestampMicros)
|
|
@@ -562,10 +570,10 @@ export class AptosResourcesProcessor {
|
|
|
562
570
|
): this {
|
|
563
571
|
return this.onInterval(
|
|
564
572
|
handler,
|
|
565
|
-
{
|
|
573
|
+
create(HandleIntervalSchema, {
|
|
566
574
|
recentInterval: timeIntervalInMinutes,
|
|
567
575
|
backfillInterval: backfillTimeIntervalInMinutes
|
|
568
|
-
},
|
|
576
|
+
}),
|
|
569
577
|
undefined,
|
|
570
578
|
type,
|
|
571
579
|
handlerOptions
|
|
@@ -582,7 +590,7 @@ export class AptosResourcesProcessor {
|
|
|
582
590
|
return this.onInterval(
|
|
583
591
|
handler,
|
|
584
592
|
undefined,
|
|
585
|
-
{ recentInterval: versionInterval, backfillInterval: backfillVersionInterval },
|
|
593
|
+
create(HandleIntervalSchema, { recentInterval: versionInterval, backfillInterval: backfillVersionInterval }),
|
|
586
594
|
typePrefix,
|
|
587
595
|
handlerOptions
|
|
588
596
|
)
|
|
@@ -622,7 +630,7 @@ export class AptosResourcesProcessor {
|
|
|
622
630
|
const timestamp = Number(data.timestampMicros)
|
|
623
631
|
|
|
624
632
|
if (!data.rawResources || !data.version) {
|
|
625
|
-
throw new
|
|
633
|
+
throw new ConnectError('resource is null', Code.InvalidArgument)
|
|
626
634
|
}
|
|
627
635
|
const aptResource = new AptResource(data)
|
|
628
636
|
const ctx = new AptosResourcesContext(
|
|
@@ -2,7 +2,13 @@ import { ListStateStorage, processMetrics } from '@sentio/runtime'
|
|
|
2
2
|
import { AptosResourcesContext } from './context.js'
|
|
3
3
|
import { AptosBindOptions } from './network.js'
|
|
4
4
|
import { AptosResourcesProcessor, DEFAULT_RESOURCE_FETCH_CONFIG } from './aptos-processor.js'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
type HandleInterval,
|
|
7
|
+
HandleIntervalSchema,
|
|
8
|
+
type MoveAccountFetchConfig,
|
|
9
|
+
TemplateInstanceSchema
|
|
10
|
+
} from '@sentio/protos'
|
|
11
|
+
import { create } from '@bufbuild/protobuf'
|
|
6
12
|
import { MoveResource } from '@aptos-labs/ts-sdk'
|
|
7
13
|
import { PromiseOrVoid } from '../core/index.js'
|
|
8
14
|
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
|
@@ -40,7 +46,7 @@ export class AptosResourceProcessorTemplate {
|
|
|
40
46
|
options.network = options.network || ctx.network
|
|
41
47
|
options.startVersion = options.startVersion || ctx.version
|
|
42
48
|
|
|
43
|
-
const instance
|
|
49
|
+
const instance = create(TemplateInstanceSchema, {
|
|
44
50
|
templateId: this.id,
|
|
45
51
|
contract: {
|
|
46
52
|
name: '',
|
|
@@ -51,7 +57,7 @@ export class AptosResourceProcessorTemplate {
|
|
|
51
57
|
startBlock: options.startVersion ? BigInt(options.startVersion) : 0n,
|
|
52
58
|
endBlock: options.endVersion ? BigInt(options.endVersion) : 0n,
|
|
53
59
|
baseLabels: options.baseLabels
|
|
54
|
-
}
|
|
60
|
+
})
|
|
55
61
|
|
|
56
62
|
ctx.sendTemplateInstance(instance)
|
|
57
63
|
|
|
@@ -119,10 +125,10 @@ export class AptosResourceProcessorTemplate {
|
|
|
119
125
|
): this {
|
|
120
126
|
return this.onInterval(
|
|
121
127
|
handler,
|
|
122
|
-
{
|
|
128
|
+
create(HandleIntervalSchema, {
|
|
123
129
|
recentInterval: timeIntervalInMinutes,
|
|
124
130
|
backfillInterval: backfillTimeIntervalInMinutes
|
|
125
|
-
},
|
|
131
|
+
}),
|
|
126
132
|
undefined,
|
|
127
133
|
type,
|
|
128
134
|
handlerOptions
|
|
@@ -139,7 +145,10 @@ export class AptosResourceProcessorTemplate {
|
|
|
139
145
|
return this.onInterval(
|
|
140
146
|
handler,
|
|
141
147
|
undefined,
|
|
142
|
-
|
|
148
|
+
create(HandleIntervalSchema, {
|
|
149
|
+
recentInterval: checkpointInterval,
|
|
150
|
+
backfillInterval: backfillCheckpointInterval
|
|
151
|
+
}),
|
|
143
152
|
type,
|
|
144
153
|
handlerOptions
|
|
145
154
|
)
|
package/src/aptos/context.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { RecordMetaData } from '@sentio/protos'
|
|
1
|
+
import { type RecordMetaData, RecordMetaDataSchema } from '@sentio/protos'
|
|
2
|
+
import { create } from '@bufbuild/protobuf'
|
|
2
3
|
import { type Labels, normalizeLabels } from '../index.js'
|
|
3
4
|
import { MoveCoder, RichAptosClientWithContext } from './index.js'
|
|
4
5
|
import {
|
|
@@ -12,7 +13,7 @@ import {
|
|
|
12
13
|
import { defaultMoveCoder } from './move-coder.js'
|
|
13
14
|
import { AptosNetwork } from './network.js'
|
|
14
15
|
import { Endpoints } from '@sentio/runtime'
|
|
15
|
-
import {
|
|
16
|
+
import { ConnectError, Code } from '@connectrpc/connect'
|
|
16
17
|
import { MoveContext } from '../move/index.js'
|
|
17
18
|
import { GeneralTransactionResponse } from './models.js'
|
|
18
19
|
|
|
@@ -30,7 +31,7 @@ export abstract class AptosBaseContext extends MoveContext<AptosNetwork, MoveMod
|
|
|
30
31
|
getClient(): RichAptosClientWithContext {
|
|
31
32
|
const chainServer = Endpoints.INSTANCE.chainServer.get(this.network)
|
|
32
33
|
if (!chainServer) {
|
|
33
|
-
throw new
|
|
34
|
+
throw new ConnectError('RPC endpoint not provided', Code.Internal)
|
|
34
35
|
}
|
|
35
36
|
const fullnode = chainServer + '/v1'
|
|
36
37
|
|
|
@@ -86,7 +87,7 @@ export class AptosTransactionContext<T extends GeneralTransactionResponse> exten
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
|
89
|
-
return {
|
|
90
|
+
return create(RecordMetaDataSchema, {
|
|
90
91
|
address: this.address,
|
|
91
92
|
contractName: this.moduleName,
|
|
92
93
|
blockNumber: this.version,
|
|
@@ -96,7 +97,7 @@ export class AptosTransactionContext<T extends GeneralTransactionResponse> exten
|
|
|
96
97
|
chainId: this.getChainId(),
|
|
97
98
|
name: name,
|
|
98
99
|
labels: normalizeLabels(labels)
|
|
99
|
-
}
|
|
100
|
+
})
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
|
|
@@ -120,7 +121,7 @@ export class AptosResourcesContext extends AptosBaseContext {
|
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
|
123
|
-
return {
|
|
124
|
+
return create(RecordMetaDataSchema, {
|
|
124
125
|
address: this.address,
|
|
125
126
|
contractName: 'resources',
|
|
126
127
|
blockNumber: this.version,
|
|
@@ -130,6 +131,6 @@ export class AptosResourcesContext extends AptosBaseContext {
|
|
|
130
131
|
chainId: this.getChainId(),
|
|
131
132
|
name: name,
|
|
132
133
|
labels: normalizeLabels(labels)
|
|
133
|
-
}
|
|
134
|
+
})
|
|
134
135
|
}
|
|
135
136
|
}
|