@sentio/sdk 3.9.0-rc.9 → 4.0.0-rc.10
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 +4 -4
- 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 +11 -9
- 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/aptos/network.js +1 -1
- package/lib/aptos/network.js.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 -27
- 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 +14 -8
- package/lib/eth/base-processor-template.js.map +1 -1
- package/lib/eth/base-processor.d.ts +3 -3
- 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 +85 -76
- 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/generic-processor.js +1 -1
- package/lib/eth/generic-processor.js.map +1 -1
- package/lib/eth/index.d.ts +2 -2
- package/lib/eth/index.d.ts.map +1 -1
- package/lib/eth/index.js +1 -2
- package/lib/eth/index.js.map +1 -1
- package/lib/eth/provider.d.ts +13 -0
- package/lib/eth/provider.d.ts.map +1 -0
- package/lib/eth/provider.js +164 -0
- package/lib/eth/provider.js.map +1 -0
- 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 +9 -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/network.js +5 -5
- package/lib/fuel/network.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 +3 -3
- package/lib/iota/iota-processor.d.ts.map +1 -1
- package/lib/iota/iota-processor.js +20 -19
- package/lib/iota/iota-processor.js.map +1 -1
- package/lib/iota/network.js +6 -6
- 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/codegen/codegen.d.ts +1 -1
- package/lib/solana/codegen/codegen.d.ts.map +1 -1
- package/lib/solana/codegen/codegen.js +2 -2
- package/lib/solana/codegen/codegen.js.map +1 -1
- 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 +2 -2
- 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/codegen.js +2 -2
- package/lib/store/codegen.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/network.d.ts.map +1 -1
- package/lib/sui/network.js +11 -6
- package/lib/sui/network.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 +29 -21
- 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 +3 -3
- package/lib/sui/sui-processor.d.ts.map +1 -1
- package/lib/sui/sui-processor.js +23 -21
- package/lib/sui/sui-processor.js.map +1 -1
- package/lib/sui/to-client-types.d.ts +4 -0
- package/lib/sui/to-client-types.d.ts.map +1 -0
- package/lib/sui/to-client-types.js +69 -0
- package/lib/sui/to-client-types.js.map +1 -0
- 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 +85 -69
- 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 +1452 -16
- package/lib/testing/test-processor-server.d.ts.map +1 -1
- package/lib/testing/test-processor-server.js +109 -46
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/testing/test-provider.js +1 -1
- package/lib/testing/test-provider.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 +10 -12
- package/src/aptos/aptos-plugin.ts +105 -91
- package/src/aptos/aptos-processor.ts +42 -34
- package/src/aptos/aptos-resource-processor-template.ts +15 -6
- package/src/aptos/context.ts +11 -10
- package/src/aptos/data.ts +4 -4
- package/src/aptos/network.ts +1 -1
- package/src/core/base-context.ts +19 -12
- package/src/core/core-plugin.ts +10 -7
- package/src/core/event-logger.ts +63 -35
- 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 +27 -11
- package/src/eth/base-processor.ts +77 -65
- 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 +137 -127
- package/src/eth/eth.ts +46 -32
- package/src/eth/generic-processor.ts +1 -1
- package/src/eth/index.ts +2 -2
- package/src/eth/provider.ts +193 -0
- 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 +10 -7
- package/src/fuel/fuel-processor.ts +35 -23
- package/src/fuel/global-processor.ts +3 -3
- package/src/fuel/network.ts +5 -5
- 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 +35 -27
- package/src/iota/network.ts +6 -6
- package/src/move/filter.ts +1 -1
- package/src/move/index.ts +1 -1
- package/src/solana/codegen/codegen.ts +2 -2
- package/src/solana/solana-context.ts +4 -3
- package/src/solana/solana-plugin.ts +27 -24
- package/src/solana/solana-processor.ts +23 -11
- package/src/store/cache.ts +22 -18
- package/src/store/codegen.ts +2 -2
- package/src/store/convert.ts +68 -104
- package/src/store/decorators.ts +3 -2
- package/src/store/store.ts +31 -23
- package/src/store/types.ts +24 -33
- package/src/store/util.ts +13 -18
- package/src/sui/context.ts +8 -7
- package/src/sui/network.ts +12 -7
- package/src/sui/sui-object-processor-template.ts +25 -15
- package/src/sui/sui-object-processor.ts +50 -28
- package/src/sui/sui-plugin-part.ts +41 -34
- package/src/sui/sui-plugin.ts +49 -47
- package/src/sui/sui-processor.ts +38 -29
- package/src/sui/to-client-types.ts +75 -0
- 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 -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 +170 -80
- package/src/testing/test-provider.ts +1 -1
- package/src/utils/price.ts +20 -13
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'
|
|
@@ -22,12 +30,13 @@ import { ALL_ADDRESS, Labels, PromiseOrVoid } from '../core/index.js'
|
|
|
22
30
|
import { Required } from 'utility-types'
|
|
23
31
|
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
|
24
32
|
import { HandlerOptions } from './models.js'
|
|
33
|
+
import { toSuiClientEvent } from './to-client-types.js'
|
|
25
34
|
|
|
26
|
-
export const DEFAULT_FETCH_CONFIG: MoveFetchConfig = {
|
|
35
|
+
export const DEFAULT_FETCH_CONFIG: MoveFetchConfig = create(MoveFetchConfigSchema, {
|
|
27
36
|
resourceChanges: false,
|
|
28
37
|
allEvents: true,
|
|
29
38
|
inputs: true
|
|
30
|
-
}
|
|
39
|
+
})
|
|
31
40
|
|
|
32
41
|
export type IndexConfigure = Required<SuiBindOptions, 'startCheckpoint' | 'network'>
|
|
33
42
|
|
|
@@ -76,13 +85,13 @@ export class SuiBaseProcessor {
|
|
|
76
85
|
return this.config.network
|
|
77
86
|
}
|
|
78
87
|
|
|
79
|
-
protected onMoveEvent(
|
|
80
|
-
handler: (event:
|
|
88
|
+
protected onMoveEvent<T extends SuiEventInput = SuiEventInput>(
|
|
89
|
+
handler: (event: T, ctx: SuiContext) => PromiseOrVoid,
|
|
81
90
|
filter: EventFilter | EventFilter[],
|
|
82
|
-
handlerOptions?: HandlerOptions<MoveFetchConfig,
|
|
91
|
+
handlerOptions?: HandlerOptions<MoveFetchConfig, T>
|
|
83
92
|
): SuiBaseProcessor {
|
|
84
93
|
let _filters: EventFilter[] = []
|
|
85
|
-
const _fetchConfig =
|
|
94
|
+
const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
|
|
86
95
|
|
|
87
96
|
if (Array.isArray(filter)) {
|
|
88
97
|
_filters = filter
|
|
@@ -99,11 +108,11 @@ export class SuiBaseProcessor {
|
|
|
99
108
|
handlerName: getHandlerName(),
|
|
100
109
|
handler: async function (data) {
|
|
101
110
|
if (!data.rawTransaction) {
|
|
102
|
-
throw new
|
|
111
|
+
throw new ConnectError('event is null', Code.InvalidArgument)
|
|
103
112
|
}
|
|
104
113
|
const txn = JSON.parse(data.rawTransaction) as GrpcTypes.ExecutedTransaction
|
|
105
114
|
|
|
106
|
-
const evt = JSON.parse(data.rawEvent)
|
|
115
|
+
const evt = toSuiClientEvent(JSON.parse(data.rawEvent))
|
|
107
116
|
// gRPC events carry no sequence; index is resolved by the runtime.
|
|
108
117
|
const idx = 0
|
|
109
118
|
|
|
@@ -111,15 +120,15 @@ export class SuiBaseProcessor {
|
|
|
111
120
|
processor.moduleName,
|
|
112
121
|
processor.config.network,
|
|
113
122
|
processor.config.address,
|
|
114
|
-
data.timestamp
|
|
123
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
115
124
|
data.slot,
|
|
116
125
|
txn,
|
|
117
126
|
idx,
|
|
118
127
|
processor.config.baseLabels
|
|
119
128
|
)
|
|
120
129
|
|
|
121
|
-
const decoded = await processor.coder.decodeEvent<
|
|
122
|
-
await handler(decoded || evt, ctx)
|
|
130
|
+
const decoded = await processor.coder.decodeEvent<T>(evt)
|
|
131
|
+
await handler((decoded || evt) as T, ctx)
|
|
123
132
|
|
|
124
133
|
return ctx.stopAndGetResult()
|
|
125
134
|
},
|
|
@@ -129,9 +138,9 @@ export class SuiBaseProcessor {
|
|
|
129
138
|
const p = handlerOptions?.partitionKey
|
|
130
139
|
if (!p) return undefined
|
|
131
140
|
if (typeof p === 'function') {
|
|
132
|
-
const evt = JSON.parse(data.rawEvent)
|
|
141
|
+
const evt = toSuiClientEvent(JSON.parse(data.rawEvent))
|
|
133
142
|
const decoded = await processor.coder.decodeEvent<any>(evt)
|
|
134
|
-
return p(decoded || evt)
|
|
143
|
+
return p((decoded || evt) as T)
|
|
135
144
|
}
|
|
136
145
|
return p
|
|
137
146
|
}
|
|
@@ -139,13 +148,13 @@ export class SuiBaseProcessor {
|
|
|
139
148
|
return this
|
|
140
149
|
}
|
|
141
150
|
|
|
142
|
-
protected onEntryFunctionCall(
|
|
143
|
-
handler: (call:
|
|
151
|
+
protected onEntryFunctionCall<T extends GrpcTypes.MoveCall = GrpcTypes.MoveCall>(
|
|
152
|
+
handler: (call: T, ctx: SuiContext) => PromiseOrVoid,
|
|
144
153
|
filter: FunctionNameAndCallFilter | FunctionNameAndCallFilter[],
|
|
145
|
-
handlerOptions?: HandlerOptions<MoveFetchConfig,
|
|
154
|
+
handlerOptions?: HandlerOptions<MoveFetchConfig, T>
|
|
146
155
|
): SuiBaseProcessor {
|
|
147
156
|
let _filters: FunctionNameAndCallFilter[] = []
|
|
148
|
-
const _fetchConfig =
|
|
157
|
+
const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
|
|
149
158
|
|
|
150
159
|
if (Array.isArray(filter)) {
|
|
151
160
|
_filters = filter
|
|
@@ -160,7 +169,7 @@ export class SuiBaseProcessor {
|
|
|
160
169
|
handlerName: getHandlerName(),
|
|
161
170
|
handler: async function (data) {
|
|
162
171
|
if (!data.rawTransaction) {
|
|
163
|
-
throw new
|
|
172
|
+
throw new ConnectError('call is null', Code.InvalidArgument)
|
|
164
173
|
}
|
|
165
174
|
const tx = JSON.parse(data.rawTransaction) as GrpcTypes.ExecutedTransaction
|
|
166
175
|
|
|
@@ -168,7 +177,7 @@ export class SuiBaseProcessor {
|
|
|
168
177
|
processor.moduleName,
|
|
169
178
|
processor.config.network,
|
|
170
179
|
processor.config.address,
|
|
171
|
-
data.timestamp
|
|
180
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
172
181
|
data.slot,
|
|
173
182
|
tx,
|
|
174
183
|
0,
|
|
@@ -178,7 +187,7 @@ export class SuiBaseProcessor {
|
|
|
178
187
|
const calls = getMoveCalls(tx)
|
|
179
188
|
const programmableTx = getProgrammableTransaction(tx)
|
|
180
189
|
if (!programmableTx) {
|
|
181
|
-
throw new
|
|
190
|
+
throw new ConnectError('Unexpected getTransactionKind get empty', Code.InvalidArgument)
|
|
182
191
|
}
|
|
183
192
|
|
|
184
193
|
// TODO potential pass index
|
|
@@ -205,7 +214,7 @@ export class SuiBaseProcessor {
|
|
|
205
214
|
const calls = getMoveCalls(tx)
|
|
206
215
|
// For simplicity, use the first call for partitioning
|
|
207
216
|
if (calls.length > 0) {
|
|
208
|
-
return p(calls[0])
|
|
217
|
+
return p(calls[0] as T)
|
|
209
218
|
}
|
|
210
219
|
return undefined
|
|
211
220
|
}
|
|
@@ -228,7 +237,7 @@ export class SuiBaseProcessor {
|
|
|
228
237
|
filter?: TransactionFilter,
|
|
229
238
|
handlerOptions?: HandlerOptions<MoveFetchConfig, GrpcTypes.ExecutedTransaction>
|
|
230
239
|
): this {
|
|
231
|
-
const _fetchConfig =
|
|
240
|
+
const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
|
|
232
241
|
|
|
233
242
|
const processor = this
|
|
234
243
|
|
|
@@ -236,7 +245,7 @@ export class SuiBaseProcessor {
|
|
|
236
245
|
handlerName: getHandlerName(),
|
|
237
246
|
handler: async function (data) {
|
|
238
247
|
if (!data.rawTransaction) {
|
|
239
|
-
throw new
|
|
248
|
+
throw new ConnectError('transaction is null', Code.InvalidArgument)
|
|
240
249
|
}
|
|
241
250
|
const tx = JSON.parse(data.rawTransaction) as GrpcTypes.ExecutedTransaction
|
|
242
251
|
|
|
@@ -244,7 +253,7 @@ export class SuiBaseProcessor {
|
|
|
244
253
|
processor.moduleName,
|
|
245
254
|
processor.config.network,
|
|
246
255
|
processor.config.address,
|
|
247
|
-
data.timestamp
|
|
256
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
248
257
|
data.slot,
|
|
249
258
|
tx,
|
|
250
259
|
0,
|
|
@@ -275,7 +284,7 @@ export class SuiBaseProcessor {
|
|
|
275
284
|
type: string | string[]
|
|
276
285
|
): this {
|
|
277
286
|
if (this.config.network === SuiNetwork.TEST_NET) {
|
|
278
|
-
throw new
|
|
287
|
+
throw new ConnectError('object change not supported in testnet', Code.InvalidArgument)
|
|
279
288
|
}
|
|
280
289
|
const processor = this
|
|
281
290
|
this.objectChangeHandlers.push({
|
|
@@ -284,7 +293,7 @@ export class SuiBaseProcessor {
|
|
|
284
293
|
const ctx = new SuiObjectChangeContext(
|
|
285
294
|
processor.config.network,
|
|
286
295
|
processor.config.address,
|
|
287
|
-
data.timestamp
|
|
296
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
288
297
|
data.slot,
|
|
289
298
|
data.txDigest,
|
|
290
299
|
processor.config.baseLabels
|
|
@@ -316,7 +325,7 @@ export class SuiGlobalProcessor extends SuiBaseProcessor {
|
|
|
316
325
|
): this {
|
|
317
326
|
// TODO enable more strict check
|
|
318
327
|
// if (!filter.publicKeyPrefix || filter.publicKeyPrefix.length < 2) {
|
|
319
|
-
// throw new
|
|
328
|
+
// throw new ConnectError('restriction too low for global processor', Code.InvalidArgument)
|
|
320
329
|
// }
|
|
321
330
|
return super.onTransactionBlock(handler, filter, fetchConfig)
|
|
322
331
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { SuiClientTypes } from '@mysten/sui/client'
|
|
2
|
+
import type { SuiEventInput, SuiMoveObjectInput } from '@typemove/sui'
|
|
3
|
+
|
|
4
|
+
// The Sentio driver delivers Sui objects/events as protojson of the gRPC
|
|
5
|
+
// `sui.rpc.v2.{Object,Event}` messages — field names like `objectType` and
|
|
6
|
+
// `contents`. typemove's decoder, and the SDK's public handler types, speak
|
|
7
|
+
// the unified `@mysten/sui/client` `SuiClientTypes` shape (`type`, `bcs`).
|
|
8
|
+
// Normalize at the SDK boundary so nothing downstream ever sees the raw gRPC
|
|
9
|
+
// shape: `getType`/`getData` resolve cleanly (`.type` / `.json`) and the
|
|
10
|
+
// decoded envelope honestly matches its declared `SuiClientTypes.Object` type.
|
|
11
|
+
// `SuiGrpcClient.core` performs the equivalent mapping for standalone callers,
|
|
12
|
+
// so both delivery paths converge on `SuiClientTypes` before decoding.
|
|
13
|
+
|
|
14
|
+
function base64ToBytes(b64: string): Uint8Array {
|
|
15
|
+
return new Uint8Array(Buffer.from(b64, 'base64'))
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Mirrors mapOwner in @mysten/sui's grpc core. protojson serializes the
|
|
19
|
+
// Owner.OwnerKind enum to its proto value name and uint64 `version` to a string.
|
|
20
|
+
function mapOwner(owner: any): SuiClientTypes.ObjectOwner | null {
|
|
21
|
+
if (!owner) {
|
|
22
|
+
return null
|
|
23
|
+
}
|
|
24
|
+
switch (owner.kind) {
|
|
25
|
+
case 'IMMUTABLE':
|
|
26
|
+
return { $kind: 'Immutable', Immutable: true }
|
|
27
|
+
case 'ADDRESS':
|
|
28
|
+
return { $kind: 'AddressOwner', AddressOwner: owner.address }
|
|
29
|
+
case 'OBJECT':
|
|
30
|
+
return { $kind: 'ObjectOwner', ObjectOwner: owner.address }
|
|
31
|
+
case 'SHARED':
|
|
32
|
+
return { $kind: 'Shared', Shared: { initialSharedVersion: String(owner.version) } }
|
|
33
|
+
case 'CONSENSUS_ADDRESS':
|
|
34
|
+
return {
|
|
35
|
+
$kind: 'ConsensusAddressOwner',
|
|
36
|
+
ConsensusAddressOwner: { startVersion: String(owner.version), owner: owner.address }
|
|
37
|
+
}
|
|
38
|
+
default:
|
|
39
|
+
return { $kind: 'Unknown' }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// protojson `sui.rpc.v2.Object` -> unified `SuiClientTypes.Object<{ json: true }>`.
|
|
44
|
+
// Already-unified inputs (from `SuiGrpcClient.core`) pass through: `.type` and
|
|
45
|
+
// `.json` are read with the gRPC names falling back to the unified ones. With
|
|
46
|
+
// `Include = { json: true }` every field except objectId/version/digest/owner/
|
|
47
|
+
// type/json is typed `undefined`, so we deliberately leave them unset.
|
|
48
|
+
export function toSuiClientObject(o: any): SuiMoveObjectInput {
|
|
49
|
+
return {
|
|
50
|
+
objectId: o.objectId,
|
|
51
|
+
version: o.version,
|
|
52
|
+
digest: o.digest,
|
|
53
|
+
owner: mapOwner(o.owner)!,
|
|
54
|
+
type: o.objectType ?? o.type ?? '',
|
|
55
|
+
content: undefined,
|
|
56
|
+
previousTransaction: undefined,
|
|
57
|
+
objectBcs: undefined,
|
|
58
|
+
json: o.json ?? null,
|
|
59
|
+
display: undefined
|
|
60
|
+
} as SuiMoveObjectInput
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// protojson `sui.rpc.v2.Event` -> unified `SuiClientTypes.Event`. The
|
|
64
|
+
// discriminating fields (`eventType`, `json`) already share names; only the
|
|
65
|
+
// BCS payload is renamed (`contents` -> `bcs`).
|
|
66
|
+
export function toSuiClientEvent(e: any): SuiEventInput {
|
|
67
|
+
return {
|
|
68
|
+
packageId: e.packageId,
|
|
69
|
+
module: e.module,
|
|
70
|
+
sender: e.sender,
|
|
71
|
+
eventType: e.eventType ?? e.type ?? '',
|
|
72
|
+
bcs: e.contents?.value != null ? base64ToBytes(e.contents.value) : (e.bcs ?? new Uint8Array()),
|
|
73
|
+
json: e.json ?? null
|
|
74
|
+
} as SuiEventInput
|
|
75
|
+
}
|
|
@@ -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 || []) {
|
package/src/testing/eth-facet.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { TestProcessorServer } from './test-processor-server.js'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type DataBinding,
|
|
4
|
+
DataBindingSchema,
|
|
5
|
+
HandlerType,
|
|
6
|
+
type ProcessBindingResponse,
|
|
7
|
+
timestampNow
|
|
8
|
+
} from '@sentio/protos'
|
|
9
|
+
import { create } from '@bufbuild/protobuf'
|
|
3
10
|
import { Trace } from '../eth/eth.js'
|
|
4
11
|
import { BlockParams, LogParams, TransactionResponseParams } from 'ethers/providers'
|
|
5
12
|
import { ChainId, EthChainId } from '@sentio/chain'
|
|
@@ -48,17 +55,20 @@ export class EthFacet {
|
|
|
48
55
|
}
|
|
49
56
|
for (const config of contract.traceConfigs) {
|
|
50
57
|
if (config.signature == signature) {
|
|
51
|
-
return {
|
|
58
|
+
return create(DataBindingSchema, {
|
|
52
59
|
data: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
value: {
|
|
61
|
+
case: 'ethTrace',
|
|
62
|
+
value: {
|
|
63
|
+
rawTrace: JSON.stringify(trace),
|
|
64
|
+
timestamp: timestampNow()
|
|
65
|
+
}
|
|
56
66
|
}
|
|
57
67
|
},
|
|
58
68
|
handlerIds: [config.handlerId],
|
|
59
69
|
handlerType: HandlerType.ETH_TRACE,
|
|
60
70
|
chainId: network
|
|
61
|
-
}
|
|
71
|
+
})
|
|
62
72
|
}
|
|
63
73
|
}
|
|
64
74
|
}
|
|
@@ -116,14 +126,17 @@ export class EthFacet {
|
|
|
116
126
|
break
|
|
117
127
|
}
|
|
118
128
|
if (match) {
|
|
119
|
-
return {
|
|
129
|
+
return create(DataBindingSchema, {
|
|
120
130
|
data: {
|
|
121
|
-
|
|
131
|
+
value: {
|
|
132
|
+
case: 'ethLog',
|
|
133
|
+
value: { timestamp: timestampNow(), rawLog: JSON.stringify(log) }
|
|
134
|
+
}
|
|
122
135
|
},
|
|
123
136
|
handlerIds: [config.handlerId],
|
|
124
137
|
handlerType: HandlerType.ETH_LOG,
|
|
125
138
|
chainId: network
|
|
126
|
-
}
|
|
139
|
+
})
|
|
127
140
|
}
|
|
128
141
|
}
|
|
129
142
|
}
|
|
@@ -190,14 +203,17 @@ export class EthFacet {
|
|
|
190
203
|
break
|
|
191
204
|
}
|
|
192
205
|
if (match) {
|
|
193
|
-
return {
|
|
206
|
+
return create(DataBindingSchema, {
|
|
194
207
|
data: {
|
|
195
|
-
|
|
208
|
+
value: {
|
|
209
|
+
case: 'ethLog',
|
|
210
|
+
value: { timestamp: timestampNow(), rawLog: JSON.stringify(log) }
|
|
211
|
+
}
|
|
196
212
|
},
|
|
197
213
|
handlerIds: [config.handlerId],
|
|
198
214
|
handlerType: HandlerType.ETH_LOG,
|
|
199
215
|
chainId: network
|
|
200
|
-
}
|
|
216
|
+
})
|
|
201
217
|
}
|
|
202
218
|
}
|
|
203
219
|
}
|
|
@@ -230,14 +246,17 @@ export class EthFacet {
|
|
|
230
246
|
block: Partial<BlockParams> & { number: number },
|
|
231
247
|
network: EthChainId = EthChainId.ETHEREUM
|
|
232
248
|
): DataBinding {
|
|
233
|
-
const binding: DataBinding = {
|
|
249
|
+
const binding: DataBinding = create(DataBindingSchema, {
|
|
234
250
|
data: {
|
|
235
|
-
|
|
251
|
+
value: {
|
|
252
|
+
case: 'ethBlock',
|
|
253
|
+
value: { rawBlock: JSON.stringify(block) }
|
|
254
|
+
}
|
|
236
255
|
},
|
|
237
256
|
handlerType: HandlerType.ETH_BLOCK,
|
|
238
257
|
handlerIds: [],
|
|
239
258
|
chainId: network
|
|
240
|
-
}
|
|
259
|
+
})
|
|
241
260
|
for (const contract of this.server.contractConfigs) {
|
|
242
261
|
if (contract.contract?.chainId !== network) {
|
|
243
262
|
continue
|
|
@@ -282,14 +301,17 @@ export class EthFacet {
|
|
|
282
301
|
transaction: Partial<TransactionResponseParams>,
|
|
283
302
|
network: EthChainId = EthChainId.ETHEREUM
|
|
284
303
|
): DataBinding {
|
|
285
|
-
const binding: DataBinding = {
|
|
304
|
+
const binding: DataBinding = create(DataBindingSchema, {
|
|
286
305
|
data: {
|
|
287
|
-
|
|
306
|
+
value: {
|
|
307
|
+
case: 'ethTransaction',
|
|
308
|
+
value: { timestamp: timestampNow(), rawTransaction: JSON.stringify(transaction) }
|
|
309
|
+
}
|
|
288
310
|
},
|
|
289
311
|
handlerType: HandlerType.ETH_TRANSACTION,
|
|
290
312
|
handlerIds: [],
|
|
291
313
|
chainId: network
|
|
292
|
-
}
|
|
314
|
+
})
|
|
293
315
|
for (const contract of this.server.contractConfigs) {
|
|
294
316
|
if (contract.contract?.chainId !== network) {
|
|
295
317
|
continue
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TestProcessorServer } from './test-processor-server.js'
|
|
2
2
|
import { FuelChainId } from '@sentio/chain'
|
|
3
|
-
import { DataBinding, HandlerType } from '@sentio/protos'
|
|
3
|
+
import { type DataBinding, DataBindingSchema, HandlerType, timestampNow } from '@sentio/protos'
|
|
4
|
+
import { create } from '@bufbuild/protobuf'
|
|
4
5
|
import { FuelNetwork } from '../fuel/index.js'
|
|
5
6
|
import { getRpcEndpoint } from '../fuel/network.js'
|
|
6
7
|
|
|
@@ -47,33 +48,39 @@ export class FuelFacet {
|
|
|
47
48
|
continue
|
|
48
49
|
}
|
|
49
50
|
for (const callConfig of config.fuelTransactionConfigs) {
|
|
50
|
-
const binding = {
|
|
51
|
+
const binding = create(DataBindingSchema, {
|
|
51
52
|
data: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
value: {
|
|
54
|
+
case: 'fuelTransaction',
|
|
55
|
+
value: {
|
|
56
|
+
transaction,
|
|
57
|
+
timestamp: timestampNow()
|
|
58
|
+
}
|
|
55
59
|
}
|
|
56
60
|
},
|
|
57
61
|
handlerIds: [callConfig.handlerId],
|
|
58
62
|
handlerType: HandlerType.FUEL_TRANSACTION,
|
|
59
63
|
chainId: network
|
|
60
|
-
}
|
|
64
|
+
})
|
|
61
65
|
|
|
62
66
|
res.push(binding)
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
for (const assetConfig of config.assetConfigs) {
|
|
66
|
-
const binding = {
|
|
70
|
+
const binding = create(DataBindingSchema, {
|
|
67
71
|
data: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
value: {
|
|
73
|
+
case: 'fuelTransaction',
|
|
74
|
+
value: {
|
|
75
|
+
transaction,
|
|
76
|
+
timestamp: timestampNow()
|
|
77
|
+
}
|
|
71
78
|
}
|
|
72
79
|
},
|
|
73
80
|
handlerIds: [assetConfig.handlerId],
|
|
74
81
|
handlerType: HandlerType.FUEL_TRANSACTION,
|
|
75
82
|
chainId: network
|
|
76
|
-
}
|
|
83
|
+
})
|
|
77
84
|
|
|
78
85
|
res.push(binding)
|
|
79
86
|
}
|
|
@@ -89,20 +96,23 @@ export class FuelFacet {
|
|
|
89
96
|
|
|
90
97
|
for (const config of this.server.contractConfigs) {
|
|
91
98
|
for (const logConfig of config.fuelReceiptConfigs) {
|
|
92
|
-
const logIds = logConfig.log
|
|
99
|
+
const logIds = logConfig.receiptFilter?.case === 'log' ? logConfig.receiptFilter.value.logIds : []
|
|
93
100
|
if (logIds.includes(receipt.rb)) {
|
|
94
|
-
const binding = {
|
|
101
|
+
const binding = create(DataBindingSchema, {
|
|
95
102
|
data: {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
value: {
|
|
104
|
+
case: 'fuelReceipt',
|
|
105
|
+
value: {
|
|
106
|
+
transaction,
|
|
107
|
+
timestamp: timestampNow(),
|
|
108
|
+
receiptIndex: BigInt(i)
|
|
109
|
+
}
|
|
100
110
|
}
|
|
101
111
|
},
|
|
102
112
|
handlerIds: [logConfig.handlerId],
|
|
103
113
|
handlerType: HandlerType.FUEL_RECEIPT,
|
|
104
114
|
chainId: network
|
|
105
|
-
}
|
|
115
|
+
})
|
|
106
116
|
res.push(binding)
|
|
107
117
|
}
|
|
108
118
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MoveCallIotaTransaction, IotaTransactionBlockResponse } from '@iota/iota-sdk/client'
|
|
2
|
-
import { DataBinding, HandlerType } from '@sentio/protos'
|
|
2
|
+
import { type DataBinding, DataBindingSchema, HandlerType, timestampFromDate, timestampNow } from '@sentio/protos'
|
|
3
|
+
import { create } from '@bufbuild/protobuf'
|
|
3
4
|
import { TestProcessorServer } from './test-processor-server.js'
|
|
4
5
|
import { accountTypeString, parseMoveType, SPLITTER } from '../move/index.js'
|
|
5
6
|
import { IotaNetwork } from '../iota/index.js'
|
|
@@ -47,18 +48,21 @@ export class IotaFacet {
|
|
|
47
48
|
for (const callConfig of config.moveCallConfigs) {
|
|
48
49
|
for (const callFilter of callConfig.filters) {
|
|
49
50
|
if (accountTypeString(config.contract.address) + '::' + callFilter.function === functionType) {
|
|
50
|
-
return {
|
|
51
|
+
return create(DataBindingSchema, {
|
|
51
52
|
data: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
value: {
|
|
54
|
+
case: 'suiCall',
|
|
55
|
+
value: {
|
|
56
|
+
rawTransaction: JSON.stringify(transaction),
|
|
57
|
+
timestamp: timestampNow(),
|
|
58
|
+
slot: 10000n
|
|
59
|
+
}
|
|
56
60
|
}
|
|
57
61
|
},
|
|
58
62
|
handlerIds: [callConfig.handlerId],
|
|
59
63
|
handlerType: HandlerType.SUI_CALL,
|
|
60
64
|
chainId: network
|
|
61
|
-
}
|
|
65
|
+
})
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
}
|
|
@@ -91,18 +95,23 @@ export class IotaFacet {
|
|
|
91
95
|
throw Error('Invalid test global transaction: ' + JSON.stringify(transaction))
|
|
92
96
|
}
|
|
93
97
|
|
|
94
|
-
const binding: DataBinding = {
|
|
98
|
+
const binding: DataBinding = create(DataBindingSchema, {
|
|
95
99
|
handlerIds,
|
|
96
100
|
handlerType: HandlerType.SUI_CALL,
|
|
97
101
|
data: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
value: {
|
|
103
|
+
case: 'suiCall',
|
|
104
|
+
value: {
|
|
105
|
+
rawTransaction: JSON.stringify(transaction),
|
|
106
|
+
timestamp: transaction.timestampMs
|
|
107
|
+
? timestampFromDate(new Date(Number(transaction.timestampMs)))
|
|
108
|
+
: timestampNow(),
|
|
109
|
+
slot: BigInt(transaction.checkpoint || 0)
|
|
110
|
+
}
|
|
102
111
|
}
|
|
103
112
|
},
|
|
104
113
|
chainId: network
|
|
105
|
-
}
|
|
114
|
+
})
|
|
106
115
|
return this.server.processBinding(binding)
|
|
107
116
|
}
|
|
108
117
|
|
|
@@ -123,19 +132,22 @@ export class IotaFacet {
|
|
|
123
132
|
accountTypeString(config.contract.address) + '::' + eventFilter.type ===
|
|
124
133
|
parseMoveType(event.type).qname
|
|
125
134
|
) {
|
|
126
|
-
return {
|
|
135
|
+
return create(DataBindingSchema, {
|
|
127
136
|
data: {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
137
|
+
value: {
|
|
138
|
+
case: 'suiEvent',
|
|
139
|
+
value: {
|
|
140
|
+
rawEvent: JSON.stringify(event),
|
|
141
|
+
rawTransaction: JSON.stringify(transaction),
|
|
142
|
+
timestamp: timestampFromDate(new Date(Number(transaction.timestampMs || 0))),
|
|
143
|
+
slot: 10000n
|
|
144
|
+
}
|
|
133
145
|
}
|
|
134
146
|
},
|
|
135
147
|
handlerIds: [eventConfig.handlerId],
|
|
136
148
|
handlerType: HandlerType.SUI_EVENT,
|
|
137
149
|
chainId: network
|
|
138
|
-
}
|
|
150
|
+
})
|
|
139
151
|
}
|
|
140
152
|
}
|
|
141
153
|
}
|