@sentio/sdk 4.0.0-rc.1 → 4.0.0-rc.2
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 +12 -10
- 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 +22 -14
- 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 +1 -1
- package/lib/testing/memory-database.d.ts.map +1 -1
- package/lib/testing/memory-database.js +81 -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 +19 -13
- package/lib/testing/test-processor-server.d.ts.map +1 -1
- package/lib/testing/test-processor-server.js +22 -20
- 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 +18 -11
- package/src/eth/eth-plugin.ts +135 -118
- package/src/eth/eth.ts +29 -20
- 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 +109 -85
- 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 +64 -58
- package/src/utils/price.ts +20 -13
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { USER_PROCESSOR } from '@sentio/runtime'
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
AccountConfigSchema,
|
|
4
|
+
ContractConfigSchema,
|
|
5
5
|
HandlerType,
|
|
6
|
-
InitResponse,
|
|
7
|
-
MoveCallHandlerConfig,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
type InitResponse,
|
|
7
|
+
type MoveCallHandlerConfig,
|
|
8
|
+
MoveCallHandlerConfigSchema,
|
|
9
|
+
type MoveEventHandlerConfig,
|
|
10
|
+
MoveEventHandlerConfigSchema,
|
|
11
|
+
MoveOnIntervalConfigSchema,
|
|
12
|
+
type MoveResourceChangeConfig,
|
|
13
|
+
MoveResourceChangeConfigSchema,
|
|
14
|
+
type ProcessConfigResponse,
|
|
15
|
+
type StartRequest
|
|
12
16
|
} from '@sentio/protos'
|
|
17
|
+
import { create } from '@bufbuild/protobuf'
|
|
13
18
|
|
|
14
19
|
import { PartitionHandlerManager } from '../core/index.js'
|
|
15
20
|
import { HandlerRegister } from '../core/handler-register.js'
|
|
@@ -75,7 +80,7 @@ export class SuiPluginPart {
|
|
|
75
80
|
if (forChainId !== undefined && forChainId !== chainId.toString()) {
|
|
76
81
|
continue
|
|
77
82
|
}
|
|
78
|
-
const contractConfig =
|
|
83
|
+
const contractConfig = create(ContractConfigSchema, {
|
|
79
84
|
transactionConfig: [],
|
|
80
85
|
processorType: USER_PROCESSOR,
|
|
81
86
|
contract: {
|
|
@@ -90,7 +95,7 @@ export class SuiPluginPart {
|
|
|
90
95
|
for (const handler of suiProcessor.eventHandlers) {
|
|
91
96
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
92
97
|
this.partitionManager.registerPartitionHandler(HandlerType.SUI_EVENT, handlerId, handler.partitionHandler)
|
|
93
|
-
const eventHandlerConfig: MoveEventHandlerConfig = {
|
|
98
|
+
const eventHandlerConfig: MoveEventHandlerConfig = create(MoveEventHandlerConfigSchema, {
|
|
94
99
|
filters: handler.filters.map((f) => {
|
|
95
100
|
return {
|
|
96
101
|
type: f.type,
|
|
@@ -101,13 +106,13 @@ export class SuiPluginPart {
|
|
|
101
106
|
fetchConfig: handler.fetchConfig,
|
|
102
107
|
handlerId,
|
|
103
108
|
handlerName: handler.handlerName
|
|
104
|
-
}
|
|
109
|
+
})
|
|
105
110
|
contractConfig.moveEventConfigs.push(eventHandlerConfig)
|
|
106
111
|
}
|
|
107
112
|
for (const handler of suiProcessor.callHandlers) {
|
|
108
113
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
109
114
|
this.partitionManager.registerPartitionHandler(HandlerType.SUI_CALL, handlerId, handler.partitionHandler)
|
|
110
|
-
const functionHandlerConfig: MoveCallHandlerConfig = {
|
|
115
|
+
const functionHandlerConfig: MoveCallHandlerConfig = create(MoveCallHandlerConfigSchema, {
|
|
111
116
|
filters: handler.filters.map((filter) => {
|
|
112
117
|
return {
|
|
113
118
|
function: filter.function,
|
|
@@ -121,18 +126,18 @@ export class SuiPluginPart {
|
|
|
121
126
|
fetchConfig: handler.fetchConfig,
|
|
122
127
|
handlerId,
|
|
123
128
|
handlerName: handler.handlerName
|
|
124
|
-
}
|
|
129
|
+
})
|
|
125
130
|
contractConfig.moveCallConfigs.push(functionHandlerConfig)
|
|
126
131
|
}
|
|
127
132
|
// deprecated, use objectType processor instead
|
|
128
133
|
for (const handler of suiProcessor.objectChangeHandlers) {
|
|
129
134
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
130
|
-
const objectChangeHandler: MoveResourceChangeConfig = {
|
|
135
|
+
const objectChangeHandler: MoveResourceChangeConfig = create(MoveResourceChangeConfigSchema, {
|
|
131
136
|
types: typeof handler.type === 'string' ? [handler.type] : handler.type,
|
|
132
137
|
handlerId,
|
|
133
138
|
handlerName: handler.handlerName,
|
|
134
139
|
includeDeleted: false
|
|
135
|
-
}
|
|
140
|
+
})
|
|
136
141
|
contractConfig.moveResourceChangeConfigs.push(objectChangeHandler)
|
|
137
142
|
}
|
|
138
143
|
config.contractConfigs.push(contractConfig)
|
|
@@ -143,7 +148,7 @@ export class SuiPluginPart {
|
|
|
143
148
|
if (forChainId !== undefined && forChainId !== chainId.toString()) {
|
|
144
149
|
continue
|
|
145
150
|
}
|
|
146
|
-
const accountConfig =
|
|
151
|
+
const accountConfig = create(AccountConfigSchema, {
|
|
147
152
|
address: processor.config.address,
|
|
148
153
|
chainId: processor.getChainId(),
|
|
149
154
|
startBlock: processor.config.startCheckpoint, // TODO maybe use another field
|
|
@@ -152,39 +157,41 @@ export class SuiPluginPart {
|
|
|
152
157
|
|
|
153
158
|
for (const handler of processor.objectChangeHandlers) {
|
|
154
159
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
155
|
-
const objectChangeHandler: MoveResourceChangeConfig = {
|
|
160
|
+
const objectChangeHandler: MoveResourceChangeConfig = create(MoveResourceChangeConfigSchema, {
|
|
156
161
|
types: typeof handler.type === 'string' ? [handler.type] : handler.type,
|
|
157
162
|
handlerId,
|
|
158
163
|
handlerName: handler.handlerName,
|
|
159
164
|
includeDeleted: false
|
|
160
|
-
}
|
|
165
|
+
})
|
|
161
166
|
accountConfig.moveResourceChangeConfigs.push(objectChangeHandler)
|
|
162
167
|
}
|
|
163
168
|
|
|
164
169
|
for (const handler of processor.objectHandlers) {
|
|
165
170
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
166
171
|
|
|
167
|
-
accountConfig.moveIntervalConfigs.push(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
accountConfig.moveIntervalConfigs.push(
|
|
173
|
+
create(MoveOnIntervalConfigSchema, {
|
|
174
|
+
intervalConfig: {
|
|
175
|
+
handlerId: handlerId,
|
|
176
|
+
handlerName: handler.handlerName,
|
|
177
|
+
minutes: 0,
|
|
178
|
+
minutesInterval: handler.timeIntervalInMinutes,
|
|
179
|
+
slot: 0,
|
|
180
|
+
slotInterval: handler.checkPointInterval,
|
|
181
|
+
fetchConfig: undefined
|
|
182
|
+
},
|
|
183
|
+
type: handler.type || '',
|
|
184
|
+
ownerType: processor.ownerType,
|
|
185
|
+
resourceFetchConfig: handler.fetchConfig,
|
|
175
186
|
fetchConfig: undefined
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
ownerType: processor.ownerType,
|
|
179
|
-
resourceFetchConfig: handler.fetchConfig,
|
|
180
|
-
fetchConfig: undefined
|
|
181
|
-
})
|
|
187
|
+
})
|
|
188
|
+
)
|
|
182
189
|
}
|
|
183
190
|
|
|
184
191
|
if (processor instanceof SuiAddressProcessor) {
|
|
185
192
|
for (const handler of processor.callHandlers) {
|
|
186
193
|
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
|
187
|
-
const functionHandlerConfig: MoveCallHandlerConfig = {
|
|
194
|
+
const functionHandlerConfig: MoveCallHandlerConfig = create(MoveCallHandlerConfigSchema, {
|
|
188
195
|
filters: handler.filters.map((filter) => {
|
|
189
196
|
return {
|
|
190
197
|
function: filter.function,
|
|
@@ -198,7 +205,7 @@ export class SuiPluginPart {
|
|
|
198
205
|
fetchConfig: handler.fetchConfig,
|
|
199
206
|
handlerId,
|
|
200
207
|
handlerName: handler.handlerName
|
|
201
|
-
}
|
|
208
|
+
})
|
|
202
209
|
accountConfig.moveCallConfigs.push(functionHandlerConfig)
|
|
203
210
|
}
|
|
204
211
|
}
|
package/src/sui/sui-plugin.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { errorString, mergeProcessResults, Plugin, PluginManager } from '@sentio/runtime'
|
|
2
2
|
import {
|
|
3
|
-
DataBinding,
|
|
3
|
+
type DataBinding,
|
|
4
4
|
HandlerType,
|
|
5
|
-
InitResponse,
|
|
6
|
-
ProcessConfigResponse,
|
|
7
|
-
ProcessResult,
|
|
8
|
-
ProcessStreamResponse_Partitions,
|
|
9
|
-
|
|
5
|
+
type InitResponse,
|
|
6
|
+
type ProcessConfigResponse,
|
|
7
|
+
type ProcessResult,
|
|
8
|
+
type ProcessStreamResponse_Partitions,
|
|
9
|
+
ProcessStreamResponse_PartitionsSchema,
|
|
10
|
+
type StartRequest
|
|
10
11
|
} from '@sentio/protos'
|
|
12
|
+
import { create } from '@bufbuild/protobuf'
|
|
11
13
|
|
|
12
|
-
import {
|
|
14
|
+
import { ConnectError, Code } from '@connectrpc/connect'
|
|
13
15
|
import { PartitionHandlerManager } from '../core/index.js'
|
|
14
16
|
import { HandlerRegister } from '../core/handler-register.js'
|
|
15
17
|
|
|
@@ -60,7 +62,7 @@ export class SuiPlugin extends Plugin {
|
|
|
60
62
|
case HandlerType.SUI_OBJECT_CHANGE:
|
|
61
63
|
return this.processSuiObjectChange(request)
|
|
62
64
|
default:
|
|
63
|
-
throw new
|
|
65
|
+
throw new ConnectError('No handle type registered ' + request.handlerType, Code.InvalidArgument)
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
|
|
@@ -68,48 +70,48 @@ export class SuiPlugin extends Plugin {
|
|
|
68
70
|
let data: any
|
|
69
71
|
switch (request.handlerType) {
|
|
70
72
|
case HandlerType.SUI_EVENT:
|
|
71
|
-
if (
|
|
72
|
-
throw new
|
|
73
|
+
if (request.data?.value.case !== 'suiEvent') {
|
|
74
|
+
throw new ConnectError("suiEvent can't be empty", Code.InvalidArgument)
|
|
73
75
|
}
|
|
74
|
-
data = request.data.
|
|
76
|
+
data = request.data.value.value
|
|
75
77
|
break
|
|
76
78
|
case HandlerType.SUI_CALL:
|
|
77
|
-
if (
|
|
78
|
-
throw new
|
|
79
|
+
if (request.data?.value.case !== 'suiCall') {
|
|
80
|
+
throw new ConnectError("suiCall can't be empty", Code.InvalidArgument)
|
|
79
81
|
}
|
|
80
|
-
data = request.data.
|
|
82
|
+
data = request.data.value.value
|
|
81
83
|
break
|
|
82
84
|
case HandlerType.SUI_OBJECT:
|
|
83
|
-
if (
|
|
84
|
-
throw new
|
|
85
|
+
if (request.data?.value.case !== 'suiObject') {
|
|
86
|
+
throw new ConnectError("suiObject can't be empty", Code.InvalidArgument)
|
|
85
87
|
}
|
|
86
|
-
data = request.data.
|
|
88
|
+
data = request.data.value.value
|
|
87
89
|
break
|
|
88
90
|
case HandlerType.SUI_OBJECT_CHANGE:
|
|
89
|
-
if (
|
|
90
|
-
throw new
|
|
91
|
+
if (request.data?.value.case !== 'suiObjectChange') {
|
|
92
|
+
throw new ConnectError("suiObjectChange can't be empty", Code.InvalidArgument)
|
|
91
93
|
}
|
|
92
|
-
data = request.data.
|
|
94
|
+
data = request.data.value.value
|
|
93
95
|
break
|
|
94
96
|
default:
|
|
95
|
-
throw new
|
|
97
|
+
throw new ConnectError('No handle type registered ' + request.handlerType, Code.InvalidArgument)
|
|
96
98
|
}
|
|
97
99
|
const partitions = await this.partitionManager.processPartitionForHandlerType(
|
|
98
100
|
request.handlerType,
|
|
99
101
|
request.handlerIds,
|
|
100
102
|
data
|
|
101
103
|
)
|
|
102
|
-
return {
|
|
104
|
+
return create(ProcessStreamResponse_PartitionsSchema, {
|
|
103
105
|
partitions
|
|
104
|
-
}
|
|
106
|
+
})
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
async processSuiEvent(binding: DataBinding): Promise<ProcessResult> {
|
|
108
|
-
if (
|
|
109
|
-
throw new
|
|
110
|
+
if (binding.data?.value.case !== 'suiEvent') {
|
|
111
|
+
throw new ConnectError("Event can't be empty", Code.InvalidArgument)
|
|
110
112
|
}
|
|
111
113
|
const promises: Promise<ProcessResult>[] = []
|
|
112
|
-
const event = binding.data.
|
|
114
|
+
const event = binding.data.value.value
|
|
113
115
|
|
|
114
116
|
for (const handlerId of binding.handlerIds) {
|
|
115
117
|
promises.push(
|
|
@@ -119,9 +121,9 @@ export class SuiPlugin extends Plugin {
|
|
|
119
121
|
handlerId
|
|
120
122
|
)(event)
|
|
121
123
|
.catch((e: any) => {
|
|
122
|
-
throw new
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
throw new ConnectError(
|
|
125
|
+
'error processing event: ' + JSON.stringify(event) + '\n' + errorString(e),
|
|
126
|
+
Code.Internal
|
|
125
127
|
)
|
|
126
128
|
})
|
|
127
129
|
)
|
|
@@ -130,10 +132,10 @@ export class SuiPlugin extends Plugin {
|
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
async processSuiFunctionCall(binding: DataBinding): Promise<ProcessResult> {
|
|
133
|
-
if (
|
|
134
|
-
throw new
|
|
135
|
+
if (binding.data?.value.case !== 'suiCall') {
|
|
136
|
+
throw new ConnectError("Call can't be empty", Code.InvalidArgument)
|
|
135
137
|
}
|
|
136
|
-
const call = binding.data.
|
|
138
|
+
const call = binding.data.value.value
|
|
137
139
|
|
|
138
140
|
const promises: Promise<ProcessResult>[] = []
|
|
139
141
|
for (const handlerId of binding.handlerIds) {
|
|
@@ -143,9 +145,9 @@ export class SuiPlugin extends Plugin {
|
|
|
143
145
|
handlerId
|
|
144
146
|
)(call)
|
|
145
147
|
.catch((e: any) => {
|
|
146
|
-
throw new
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
throw new ConnectError(
|
|
149
|
+
'error processing call: ' + JSON.stringify(call) + '\n' + errorString(e),
|
|
150
|
+
Code.Internal
|
|
149
151
|
)
|
|
150
152
|
})
|
|
151
153
|
promises.push(promise)
|
|
@@ -154,10 +156,10 @@ export class SuiPlugin extends Plugin {
|
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
async processSuiObject(binding: DataBinding): Promise<ProcessResult> {
|
|
157
|
-
if (
|
|
158
|
-
throw new
|
|
159
|
+
if (binding.data?.value.case !== 'suiObject') {
|
|
160
|
+
throw new ConnectError("Object can't be empty", Code.InvalidArgument)
|
|
159
161
|
}
|
|
160
|
-
const object = binding.data.
|
|
162
|
+
const object = binding.data.value.value
|
|
161
163
|
|
|
162
164
|
const promises: Promise<ProcessResult>[] = []
|
|
163
165
|
for (const handlerId of binding.handlerIds) {
|
|
@@ -168,9 +170,9 @@ export class SuiPlugin extends Plugin {
|
|
|
168
170
|
handlerId
|
|
169
171
|
)(object)
|
|
170
172
|
.catch((e: any) => {
|
|
171
|
-
throw new
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
throw new ConnectError(
|
|
174
|
+
'error processing object: ' + JSON.stringify(object) + '\n' + errorString(e),
|
|
175
|
+
Code.Internal
|
|
174
176
|
)
|
|
175
177
|
})
|
|
176
178
|
)
|
|
@@ -179,10 +181,10 @@ export class SuiPlugin extends Plugin {
|
|
|
179
181
|
}
|
|
180
182
|
|
|
181
183
|
async processSuiObjectChange(binding: DataBinding): Promise<ProcessResult> {
|
|
182
|
-
if (
|
|
183
|
-
throw new
|
|
184
|
+
if (binding.data?.value.case !== 'suiObjectChange') {
|
|
185
|
+
throw new ConnectError("Object change can't be empty", Code.InvalidArgument)
|
|
184
186
|
}
|
|
185
|
-
const objectChange = binding.data.
|
|
187
|
+
const objectChange = binding.data.value.value
|
|
186
188
|
|
|
187
189
|
const promises: Promise<ProcessResult>[] = []
|
|
188
190
|
for (const handlerId of binding.handlerIds) {
|
|
@@ -193,9 +195,9 @@ export class SuiPlugin extends Plugin {
|
|
|
193
195
|
handlerId
|
|
194
196
|
)(objectChange)
|
|
195
197
|
.catch((e: any) => {
|
|
196
|
-
throw new
|
|
197
|
-
|
|
198
|
-
|
|
198
|
+
throw new ConnectError(
|
|
199
|
+
'error processing object change: ' + JSON.stringify(objectChange) + '\n' + errorString(e),
|
|
200
|
+
Code.Internal
|
|
199
201
|
)
|
|
200
202
|
})
|
|
201
203
|
)
|
package/src/sui/sui-processor.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type Data_SuiCall,
|
|
3
|
+
type Data_SuiEvent,
|
|
4
|
+
type Data_SuiObjectChange,
|
|
5
|
+
type MoveFetchConfig,
|
|
6
|
+
MoveFetchConfigSchema,
|
|
7
|
+
timestampDate
|
|
8
|
+
} from '@sentio/protos'
|
|
9
|
+
import { create } from '@bufbuild/protobuf'
|
|
2
10
|
import { ListStateStorage } from '@sentio/runtime'
|
|
3
11
|
import { SuiNetwork } from './network.js'
|
|
4
|
-
import {
|
|
12
|
+
import { ConnectError, Code } from '@connectrpc/connect'
|
|
5
13
|
import { SuiContext, SuiObjectChangeContext } from './context.js'
|
|
6
14
|
import type { SuiObjectChange } from '@mysten/sui/jsonRpc'
|
|
7
15
|
import type { GrpcTypes } from '@mysten/sui/grpc'
|
|
@@ -23,11 +31,11 @@ import { Required } from 'utility-types'
|
|
|
23
31
|
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
|
24
32
|
import { HandlerOptions } from './models.js'
|
|
25
33
|
|
|
26
|
-
export const DEFAULT_FETCH_CONFIG: MoveFetchConfig = {
|
|
34
|
+
export const DEFAULT_FETCH_CONFIG: MoveFetchConfig = create(MoveFetchConfigSchema, {
|
|
27
35
|
resourceChanges: false,
|
|
28
36
|
allEvents: true,
|
|
29
37
|
inputs: true
|
|
30
|
-
}
|
|
38
|
+
})
|
|
31
39
|
|
|
32
40
|
export type IndexConfigure = Required<SuiBindOptions, 'startCheckpoint' | 'network'>
|
|
33
41
|
|
|
@@ -82,7 +90,7 @@ export class SuiBaseProcessor {
|
|
|
82
90
|
handlerOptions?: HandlerOptions<MoveFetchConfig, T>
|
|
83
91
|
): SuiBaseProcessor {
|
|
84
92
|
let _filters: EventFilter[] = []
|
|
85
|
-
const _fetchConfig =
|
|
93
|
+
const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
|
|
86
94
|
|
|
87
95
|
if (Array.isArray(filter)) {
|
|
88
96
|
_filters = filter
|
|
@@ -99,7 +107,7 @@ export class SuiBaseProcessor {
|
|
|
99
107
|
handlerName: getHandlerName(),
|
|
100
108
|
handler: async function (data) {
|
|
101
109
|
if (!data.rawTransaction) {
|
|
102
|
-
throw new
|
|
110
|
+
throw new ConnectError('event is null', Code.InvalidArgument)
|
|
103
111
|
}
|
|
104
112
|
const txn = JSON.parse(data.rawTransaction) as GrpcTypes.ExecutedTransaction
|
|
105
113
|
|
|
@@ -111,7 +119,7 @@ export class SuiBaseProcessor {
|
|
|
111
119
|
processor.moduleName,
|
|
112
120
|
processor.config.network,
|
|
113
121
|
processor.config.address,
|
|
114
|
-
data.timestamp
|
|
122
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
115
123
|
data.slot,
|
|
116
124
|
txn,
|
|
117
125
|
idx,
|
|
@@ -145,7 +153,7 @@ export class SuiBaseProcessor {
|
|
|
145
153
|
handlerOptions?: HandlerOptions<MoveFetchConfig, T>
|
|
146
154
|
): SuiBaseProcessor {
|
|
147
155
|
let _filters: FunctionNameAndCallFilter[] = []
|
|
148
|
-
const _fetchConfig =
|
|
156
|
+
const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
|
|
149
157
|
|
|
150
158
|
if (Array.isArray(filter)) {
|
|
151
159
|
_filters = filter
|
|
@@ -160,7 +168,7 @@ export class SuiBaseProcessor {
|
|
|
160
168
|
handlerName: getHandlerName(),
|
|
161
169
|
handler: async function (data) {
|
|
162
170
|
if (!data.rawTransaction) {
|
|
163
|
-
throw new
|
|
171
|
+
throw new ConnectError('call is null', Code.InvalidArgument)
|
|
164
172
|
}
|
|
165
173
|
const tx = JSON.parse(data.rawTransaction) as GrpcTypes.ExecutedTransaction
|
|
166
174
|
|
|
@@ -168,7 +176,7 @@ export class SuiBaseProcessor {
|
|
|
168
176
|
processor.moduleName,
|
|
169
177
|
processor.config.network,
|
|
170
178
|
processor.config.address,
|
|
171
|
-
data.timestamp
|
|
179
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
172
180
|
data.slot,
|
|
173
181
|
tx,
|
|
174
182
|
0,
|
|
@@ -178,7 +186,7 @@ export class SuiBaseProcessor {
|
|
|
178
186
|
const calls = getMoveCalls(tx)
|
|
179
187
|
const programmableTx = getProgrammableTransaction(tx)
|
|
180
188
|
if (!programmableTx) {
|
|
181
|
-
throw new
|
|
189
|
+
throw new ConnectError('Unexpected getTransactionKind get empty', Code.InvalidArgument)
|
|
182
190
|
}
|
|
183
191
|
|
|
184
192
|
// TODO potential pass index
|
|
@@ -228,7 +236,7 @@ export class SuiBaseProcessor {
|
|
|
228
236
|
filter?: TransactionFilter,
|
|
229
237
|
handlerOptions?: HandlerOptions<MoveFetchConfig, GrpcTypes.ExecutedTransaction>
|
|
230
238
|
): this {
|
|
231
|
-
const _fetchConfig =
|
|
239
|
+
const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
|
|
232
240
|
|
|
233
241
|
const processor = this
|
|
234
242
|
|
|
@@ -236,7 +244,7 @@ export class SuiBaseProcessor {
|
|
|
236
244
|
handlerName: getHandlerName(),
|
|
237
245
|
handler: async function (data) {
|
|
238
246
|
if (!data.rawTransaction) {
|
|
239
|
-
throw new
|
|
247
|
+
throw new ConnectError('transaction is null', Code.InvalidArgument)
|
|
240
248
|
}
|
|
241
249
|
const tx = JSON.parse(data.rawTransaction) as GrpcTypes.ExecutedTransaction
|
|
242
250
|
|
|
@@ -244,7 +252,7 @@ export class SuiBaseProcessor {
|
|
|
244
252
|
processor.moduleName,
|
|
245
253
|
processor.config.network,
|
|
246
254
|
processor.config.address,
|
|
247
|
-
data.timestamp
|
|
255
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
248
256
|
data.slot,
|
|
249
257
|
tx,
|
|
250
258
|
0,
|
|
@@ -275,7 +283,7 @@ export class SuiBaseProcessor {
|
|
|
275
283
|
type: string | string[]
|
|
276
284
|
): this {
|
|
277
285
|
if (this.config.network === SuiNetwork.TEST_NET) {
|
|
278
|
-
throw new
|
|
286
|
+
throw new ConnectError('object change not supported in testnet', Code.InvalidArgument)
|
|
279
287
|
}
|
|
280
288
|
const processor = this
|
|
281
289
|
this.objectChangeHandlers.push({
|
|
@@ -284,7 +292,7 @@ export class SuiBaseProcessor {
|
|
|
284
292
|
const ctx = new SuiObjectChangeContext(
|
|
285
293
|
processor.config.network,
|
|
286
294
|
processor.config.address,
|
|
287
|
-
data.timestamp
|
|
295
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
288
296
|
data.slot,
|
|
289
297
|
data.txDigest,
|
|
290
298
|
processor.config.baseLabels
|
|
@@ -316,7 +324,7 @@ export class SuiGlobalProcessor extends SuiBaseProcessor {
|
|
|
316
324
|
): this {
|
|
317
325
|
// TODO enable more strict check
|
|
318
326
|
// if (!filter.publicKeyPrefix || filter.publicKeyPrefix.length < 2) {
|
|
319
|
-
// throw new
|
|
327
|
+
// throw new ConnectError('restriction too low for global processor', Code.InvalidArgument)
|
|
320
328
|
// }
|
|
321
329
|
return super.onTransactionBlock(handler, filter, fetchConfig)
|
|
322
330
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UserTransactionResponse, EntryFunctionPayloadResponse } from '@aptos-labs/ts-sdk'
|
|
2
|
-
import { DataBinding, HandlerType } from '@sentio/protos'
|
|
2
|
+
import { type DataBinding, DataBindingSchema, HandlerType } from '@sentio/protos'
|
|
3
|
+
import { create } from '@bufbuild/protobuf'
|
|
3
4
|
import { TestProcessorServer } from './test-processor-server.js'
|
|
4
5
|
import { AptosNetwork } from '../aptos/index.js'
|
|
5
6
|
import { parseMoveType, accountTypeString } from '../move/index.js'
|
|
@@ -40,16 +41,19 @@ export class AptosFacet {
|
|
|
40
41
|
for (const callConfig of config.moveCallConfigs) {
|
|
41
42
|
for (const callFilter of callConfig.filters) {
|
|
42
43
|
if (accountTypeString(config.contract.address) + '::' + callFilter.function === payload.function) {
|
|
43
|
-
return {
|
|
44
|
+
return create(DataBindingSchema, {
|
|
44
45
|
data: {
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
value: {
|
|
47
|
+
case: 'aptCall',
|
|
48
|
+
value: {
|
|
49
|
+
rawTransaction: JSON.stringify(transaction)
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
52
|
},
|
|
49
53
|
handlerIds: [callConfig.handlerId],
|
|
50
54
|
handlerType: HandlerType.APT_CALL,
|
|
51
55
|
chainId: network
|
|
52
|
-
}
|
|
56
|
+
})
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
}
|
|
@@ -81,18 +85,21 @@ export class AptosFacet {
|
|
|
81
85
|
accountTypeString(config.contract.address) + '::' + eventFilter.type ===
|
|
82
86
|
parseMoveType(event.type).qname
|
|
83
87
|
) {
|
|
84
|
-
return {
|
|
88
|
+
return create(DataBindingSchema, {
|
|
85
89
|
data: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
value: {
|
|
91
|
+
case: 'aptEvent',
|
|
92
|
+
value: {
|
|
93
|
+
rawEvent: JSON.stringify(event),
|
|
94
|
+
eventIndex: idx,
|
|
95
|
+
rawTransaction: JSON.stringify(transaction)
|
|
96
|
+
}
|
|
90
97
|
}
|
|
91
98
|
},
|
|
92
99
|
handlerIds: [eventConfig.handlerId],
|
|
93
100
|
handlerType: HandlerType.APT_EVENT,
|
|
94
101
|
chainId: network
|
|
95
|
-
}
|
|
102
|
+
})
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TestProcessorServer } from './test-processor-server.js'
|
|
2
|
-
import { DataBinding, HandlerType } from '@sentio/protos'
|
|
2
|
+
import { type DataBinding, DataBindingSchema, HandlerType, timestampNow } from '@sentio/protos'
|
|
3
|
+
import { create } from '@bufbuild/protobuf'
|
|
3
4
|
import { CosmosNetwork } from '../cosmos/network.js'
|
|
4
5
|
|
|
5
6
|
export class CosmosFacet {
|
|
@@ -28,17 +29,20 @@ export class CosmosFacet {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
for (const logConfig of config.cosmosLogConfigs) {
|
|
31
|
-
const binding = {
|
|
32
|
+
const binding = create(DataBindingSchema, {
|
|
32
33
|
data: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
value: {
|
|
35
|
+
case: 'cosmosCall',
|
|
36
|
+
value: {
|
|
37
|
+
transaction,
|
|
38
|
+
timestamp: timestampNow()
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
},
|
|
38
42
|
handlerIds: [logConfig.handlerId],
|
|
39
43
|
handlerType: HandlerType.COSMOS_CALL,
|
|
40
44
|
chainId: network
|
|
41
|
-
}
|
|
45
|
+
})
|
|
42
46
|
|
|
43
47
|
const logFilters = logConfig.logFilters
|
|
44
48
|
for (const log of transaction.logs || []) {
|