@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
package/src/fuel/context.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseContext, Labels, normalizeLabels } from '../core/index.js'
|
|
2
2
|
import { FuelChainId } from '@sentio/chain'
|
|
3
|
-
import { RecordMetaData } from '@sentio/protos'
|
|
3
|
+
import { RecordMetaData, RecordMetaDataSchema } from '@sentio/protos'
|
|
4
|
+
import { create } from '@bufbuild/protobuf'
|
|
4
5
|
import type { CallResult, Contract } from 'fuels'
|
|
5
6
|
import { InvocationScopeLike } from 'fuels'
|
|
6
7
|
import { FuelBlock, FuelLog, FuelTransaction } from './types.js'
|
|
@@ -39,7 +40,7 @@ export class FuelContext extends BaseContext {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
protected getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
|
42
|
-
return {
|
|
43
|
+
return create(RecordMetaDataSchema, {
|
|
43
44
|
address: this.contractAddress,
|
|
44
45
|
contractName: this.contractName,
|
|
45
46
|
blockNumber: BigInt(this.block?.height?.toString() ?? (this.transaction?.blockNumber || 0)),
|
|
@@ -49,7 +50,7 @@ export class FuelContext extends BaseContext {
|
|
|
49
50
|
name: name,
|
|
50
51
|
logIndex: this.logIndex,
|
|
51
52
|
labels: normalizeLabels(labels)
|
|
52
|
-
}
|
|
53
|
+
})
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
|
package/src/fuel/fuel-plugin.ts
CHANGED
|
@@ -2,17 +2,22 @@ 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
|
-
|
|
5
|
+
ContractConfigSchema,
|
|
6
6
|
DataBinding,
|
|
7
|
+
FuelAssetHandlerConfigSchema,
|
|
8
|
+
FuelReceiptHandlerConfigSchema,
|
|
9
|
+
FuelTransactionHandlerConfigSchema,
|
|
7
10
|
HandlerType,
|
|
8
11
|
InitResponse,
|
|
12
|
+
OnIntervalConfigSchema,
|
|
9
13
|
ProcessConfigResponse,
|
|
10
14
|
ProcessResult,
|
|
11
15
|
ProcessStreamResponse_Partitions,
|
|
16
|
+
ProcessStreamResponse_PartitionsSchema,
|
|
12
17
|
StartRequest
|
|
13
18
|
} from '@sentio/protos'
|
|
14
|
-
|
|
15
|
-
import {
|
|
19
|
+
import { create } from '@bufbuild/protobuf'
|
|
20
|
+
import { ConnectError, Code } from '@connectrpc/connect'
|
|
16
21
|
import { FuelAssetProcessor } from './asset-processor.js'
|
|
17
22
|
import { FuelProcessorState } from './types.js'
|
|
18
23
|
import { FuelProcessor } from './fuel-processor.js'
|
|
@@ -39,7 +44,7 @@ export class FuelPlugin extends Plugin {
|
|
|
39
44
|
continue
|
|
40
45
|
}
|
|
41
46
|
const processorConfig = processor.config
|
|
42
|
-
const contractConfig =
|
|
47
|
+
const contractConfig = create(ContractConfigSchema, {
|
|
43
48
|
processorType: USER_PROCESSOR,
|
|
44
49
|
contract: {
|
|
45
50
|
name: processorConfig.name,
|
|
@@ -60,24 +65,25 @@ export class FuelPlugin extends Plugin {
|
|
|
60
65
|
const handlerName = txHandler.handlerName
|
|
61
66
|
if (processor instanceof FuelProcessor) {
|
|
62
67
|
// on transaction
|
|
63
|
-
const fetchConfig = {
|
|
68
|
+
const fetchConfig = create(FuelTransactionHandlerConfigSchema, {
|
|
64
69
|
handlerId,
|
|
65
70
|
handlerName
|
|
66
|
-
}
|
|
71
|
+
})
|
|
67
72
|
contractConfig.fuelTransactionConfigs.push(fetchConfig)
|
|
68
73
|
} else if (processor instanceof FuelAssetProcessor) {
|
|
69
74
|
const assetConfig = txHandler.assetConfig
|
|
70
|
-
contractConfig.assetConfigs.push(
|
|
71
|
-
|
|
75
|
+
contractConfig.assetConfigs.push(
|
|
76
|
+
create(FuelAssetHandlerConfigSchema, {
|
|
77
|
+
filters: assetConfig?.filters || [],
|
|
78
|
+
handlerId,
|
|
79
|
+
handlerName
|
|
80
|
+
})
|
|
81
|
+
)
|
|
82
|
+
} else if (processor instanceof FuelGlobalProcessor) {
|
|
83
|
+
const fetchConfig = create(FuelTransactionHandlerConfigSchema, {
|
|
72
84
|
handlerId,
|
|
73
85
|
handlerName
|
|
74
86
|
})
|
|
75
|
-
} else if (processor instanceof FuelGlobalProcessor) {
|
|
76
|
-
const fetchConfig = {
|
|
77
|
-
handlerId,
|
|
78
|
-
handlerName,
|
|
79
|
-
filters: []
|
|
80
|
-
}
|
|
81
87
|
contractConfig.fuelTransactionConfigs.push(fetchConfig)
|
|
82
88
|
contractConfig.contract!.address = '*'
|
|
83
89
|
}
|
|
@@ -92,39 +98,38 @@ export class FuelPlugin extends Plugin {
|
|
|
92
98
|
)
|
|
93
99
|
const handlerName = receiptHandler.handlerName
|
|
94
100
|
if (processor instanceof FuelProcessor) {
|
|
95
|
-
contractConfig.fuelReceiptConfigs.push(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
contractConfig.fuelReceiptConfigs.push(
|
|
102
|
+
create(FuelReceiptHandlerConfigSchema, {
|
|
103
|
+
...receiptHandler.receiptConfig,
|
|
104
|
+
handlerId,
|
|
105
|
+
handlerName
|
|
106
|
+
})
|
|
107
|
+
)
|
|
100
108
|
}
|
|
101
109
|
}
|
|
102
110
|
|
|
103
111
|
for (const blockHandler of processor.blockHandlers) {
|
|
104
112
|
const handlerId = this.handlerRegister.register(blockHandler.handler, chainId)
|
|
105
113
|
this.partitionManager.registerPartitionHandler(HandlerType.FUEL_BLOCK, handlerId, blockHandler.partitionHandler)
|
|
106
|
-
contractConfig.intervalConfigs.push(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
contractConfig.intervalConfigs.push(
|
|
115
|
+
create(OnIntervalConfigSchema, {
|
|
116
|
+
slot: 0,
|
|
117
|
+
slotInterval: blockHandler.blockInterval,
|
|
118
|
+
minutes: 0,
|
|
119
|
+
minutesInterval: blockHandler.timeIntervalInMinutes,
|
|
120
|
+
handlerId: handlerId,
|
|
121
|
+
handlerName: blockHandler.handlerName,
|
|
122
|
+
fetchConfig: undefined
|
|
123
|
+
// fetchConfig: blockHandler.fetchConfig
|
|
124
|
+
})
|
|
125
|
+
)
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
config.contractConfigs.push(contractConfig)
|
|
119
129
|
}
|
|
120
130
|
}
|
|
121
131
|
|
|
122
|
-
supportedHandlers = [
|
|
123
|
-
HandlerType.FUEL_TRANSACTION,
|
|
124
|
-
HandlerType.FUEL_RECEIPT,
|
|
125
|
-
HandlerType.FUEL_CALL,
|
|
126
|
-
HandlerType.FUEL_BLOCK
|
|
127
|
-
]
|
|
132
|
+
supportedHandlers = [HandlerType.FUEL_TRANSACTION, HandlerType.FUEL_RECEIPT, HandlerType.FUEL_BLOCK]
|
|
128
133
|
|
|
129
134
|
processBinding(request: DataBinding): Promise<ProcessResult> {
|
|
130
135
|
switch (request.handlerType) {
|
|
@@ -135,7 +140,7 @@ export class FuelPlugin extends Plugin {
|
|
|
135
140
|
case HandlerType.FUEL_BLOCK:
|
|
136
141
|
return this.processBlock(request)
|
|
137
142
|
default:
|
|
138
|
-
throw new
|
|
143
|
+
throw new ConnectError('No handle type registered ' + request.handlerType, Code.InvalidArgument)
|
|
139
144
|
}
|
|
140
145
|
}
|
|
141
146
|
|
|
@@ -143,41 +148,34 @@ export class FuelPlugin extends Plugin {
|
|
|
143
148
|
let data: any
|
|
144
149
|
switch (request.handlerType) {
|
|
145
150
|
case HandlerType.FUEL_TRANSACTION:
|
|
146
|
-
if (
|
|
147
|
-
throw new
|
|
151
|
+
if (request.data?.value.case !== 'fuelTransaction') {
|
|
152
|
+
throw new ConnectError("fuelTransaction can't be empty", Code.InvalidArgument)
|
|
148
153
|
}
|
|
149
|
-
data = request.data.
|
|
154
|
+
data = request.data.value.value
|
|
150
155
|
break
|
|
151
156
|
case HandlerType.FUEL_RECEIPT:
|
|
152
|
-
if (
|
|
153
|
-
throw new
|
|
157
|
+
if (request.data?.value.case !== 'fuelLog') {
|
|
158
|
+
throw new ConnectError("fuelReceipt can't be empty", Code.InvalidArgument)
|
|
154
159
|
}
|
|
155
|
-
data = request.data.
|
|
160
|
+
data = request.data.value.value
|
|
156
161
|
break
|
|
157
162
|
case HandlerType.FUEL_BLOCK:
|
|
158
|
-
if (
|
|
159
|
-
throw new
|
|
160
|
-
}
|
|
161
|
-
data = request.data.fuelBlock
|
|
162
|
-
break
|
|
163
|
-
case HandlerType.FUEL_CALL:
|
|
164
|
-
// FUEL_CALL uses the same data as FUEL_TRANSACTION
|
|
165
|
-
if (!request.data?.fuelTransaction) {
|
|
166
|
-
throw new ServerError(Status.INVALID_ARGUMENT, "fuelTransaction can't be empty for FUEL_CALL")
|
|
163
|
+
if (request.data?.value.case !== 'fuelBlock') {
|
|
164
|
+
throw new ConnectError("fuelBlock can't be empty", Code.InvalidArgument)
|
|
167
165
|
}
|
|
168
|
-
data = request.data.
|
|
166
|
+
data = request.data.value.value
|
|
169
167
|
break
|
|
170
168
|
default:
|
|
171
|
-
throw new
|
|
169
|
+
throw new ConnectError('No handle type registered ' + request.handlerType, Code.InvalidArgument)
|
|
172
170
|
}
|
|
173
171
|
const partitions = await this.partitionManager.processPartitionForHandlerType(
|
|
174
172
|
request.handlerType,
|
|
175
173
|
request.handlerIds,
|
|
176
174
|
data
|
|
177
175
|
)
|
|
178
|
-
return {
|
|
176
|
+
return create(ProcessStreamResponse_PartitionsSchema, {
|
|
179
177
|
partitions
|
|
180
|
-
}
|
|
178
|
+
})
|
|
181
179
|
}
|
|
182
180
|
|
|
183
181
|
async start(request: StartRequest) {
|
|
@@ -186,15 +184,15 @@ export class FuelPlugin extends Plugin {
|
|
|
186
184
|
await processor.configure()
|
|
187
185
|
}
|
|
188
186
|
} catch (e) {
|
|
189
|
-
throw new
|
|
187
|
+
throw new ConnectError('error starting FuelPlugin: ' + errorString(e), Code.Internal)
|
|
190
188
|
}
|
|
191
189
|
}
|
|
192
190
|
|
|
193
191
|
async processReceipt(binding: DataBinding): Promise<ProcessResult> {
|
|
194
|
-
const receipt = binding?.data?.fuelLog
|
|
192
|
+
const receipt = binding?.data?.value.case === 'fuelLog' ? binding.data.value.value : undefined
|
|
195
193
|
|
|
196
194
|
if (!receipt?.transaction) {
|
|
197
|
-
throw new
|
|
195
|
+
throw new ConnectError("transaction can't be null", Code.InvalidArgument)
|
|
198
196
|
}
|
|
199
197
|
|
|
200
198
|
const promises: Promise<ProcessResult>[] = []
|
|
@@ -206,9 +204,9 @@ export class FuelPlugin extends Plugin {
|
|
|
206
204
|
handlerId
|
|
207
205
|
)(receipt)
|
|
208
206
|
.catch((e: any) => {
|
|
209
|
-
throw new
|
|
210
|
-
|
|
211
|
-
|
|
207
|
+
throw new ConnectError(
|
|
208
|
+
'error processing transaction: ' + JSON.stringify(receipt) + '\n' + errorString(e),
|
|
209
|
+
Code.Internal
|
|
212
210
|
)
|
|
213
211
|
})
|
|
214
212
|
if (GLOBAL_CONFIG.execution.sequential) {
|
|
@@ -220,10 +218,10 @@ export class FuelPlugin extends Plugin {
|
|
|
220
218
|
}
|
|
221
219
|
|
|
222
220
|
async processTransaction(binding: DataBinding): Promise<ProcessResult> {
|
|
223
|
-
if (
|
|
224
|
-
throw new
|
|
221
|
+
if (binding.data?.value.case !== 'fuelTransaction' || !binding.data.value.value.transaction) {
|
|
222
|
+
throw new ConnectError("transaction can't be null", Code.InvalidArgument)
|
|
225
223
|
}
|
|
226
|
-
const fuelTransaction = binding.data.
|
|
224
|
+
const fuelTransaction = binding.data.value.value
|
|
227
225
|
|
|
228
226
|
const promises: Promise<ProcessResult>[] = []
|
|
229
227
|
|
|
@@ -234,9 +232,9 @@ export class FuelPlugin extends Plugin {
|
|
|
234
232
|
handlerId
|
|
235
233
|
)(fuelTransaction)
|
|
236
234
|
.catch((e: any) => {
|
|
237
|
-
throw new
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
throw new ConnectError(
|
|
236
|
+
'error processing transaction: ' + JSON.stringify(fuelTransaction.transaction) + '\n' + errorString(e),
|
|
237
|
+
Code.Internal
|
|
240
238
|
)
|
|
241
239
|
})
|
|
242
240
|
if (GLOBAL_CONFIG.execution.sequential) {
|
|
@@ -248,10 +246,10 @@ export class FuelPlugin extends Plugin {
|
|
|
248
246
|
}
|
|
249
247
|
|
|
250
248
|
async processBlock(binding: DataBinding): Promise<ProcessResult> {
|
|
251
|
-
if (
|
|
252
|
-
throw new
|
|
249
|
+
if (binding.data?.value.case !== 'fuelBlock' || !binding.data.value.value.block) {
|
|
250
|
+
throw new ConnectError("Block can't be empty", Code.InvalidArgument)
|
|
253
251
|
}
|
|
254
|
-
const ethBlock = binding.data.
|
|
252
|
+
const ethBlock = binding.data.value.value
|
|
255
253
|
|
|
256
254
|
const promises: Promise<ProcessResult>[] = []
|
|
257
255
|
for (const handlerId of binding.handlerIds) {
|
|
@@ -262,9 +260,9 @@ export class FuelPlugin extends Plugin {
|
|
|
262
260
|
)(ethBlock)
|
|
263
261
|
.catch((e: any) => {
|
|
264
262
|
console.error('error processing block: ', e)
|
|
265
|
-
throw new
|
|
266
|
-
|
|
267
|
-
|
|
263
|
+
throw new ConnectError(
|
|
264
|
+
'error processing block: ' + (ethBlock.block as any)?.height + '\n' + errorString(e),
|
|
265
|
+
Code.Internal
|
|
268
266
|
)
|
|
269
267
|
})
|
|
270
268
|
if (GLOBAL_CONFIG.execution.sequential) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FuelContext, FuelContractContext } from './context.js'
|
|
2
|
-
import { HandleInterval, TemplateInstance } from '@sentio/protos'
|
|
2
|
+
import { HandleInterval, HandleIntervalSchema, TemplateInstance, TemplateInstanceSchema } from '@sentio/protos'
|
|
3
|
+
import { create } from '@bufbuild/protobuf'
|
|
3
4
|
import { PromiseOrVoid } from '../core/promises.js'
|
|
4
5
|
import { ListStateStorage, processMetrics } from '@sentio/runtime'
|
|
5
6
|
import { Contract } from 'fuels'
|
|
@@ -53,7 +54,7 @@ export abstract class FuelBaseProcessorTemplate<TContract extends Contract> {
|
|
|
53
54
|
* @param ctx
|
|
54
55
|
*/
|
|
55
56
|
public bind(options: Omit<Omit<FuelProcessorConfig, 'chainId'>, 'abi'>, ctx: FuelContext): void {
|
|
56
|
-
const instance: TemplateInstance = {
|
|
57
|
+
const instance: TemplateInstance = create(TemplateInstanceSchema, {
|
|
57
58
|
templateId: this.id,
|
|
58
59
|
contract: {
|
|
59
60
|
address: options.address,
|
|
@@ -65,7 +66,7 @@ export abstract class FuelBaseProcessorTemplate<TContract extends Contract> {
|
|
|
65
66
|
endBlock: BigInt(options.endBlock || 0),
|
|
66
67
|
baseLabels: {}
|
|
67
68
|
// baseLabels: options.baseLabels
|
|
68
|
-
}
|
|
69
|
+
})
|
|
69
70
|
|
|
70
71
|
ctx.sendTemplateInstance(instance)
|
|
71
72
|
|
|
@@ -130,10 +131,10 @@ export abstract class FuelBaseProcessorTemplate<TContract extends Contract> {
|
|
|
130
131
|
return this.onInterval(
|
|
131
132
|
handler,
|
|
132
133
|
undefined,
|
|
133
|
-
{
|
|
134
|
+
create(HandleIntervalSchema, {
|
|
134
135
|
recentInterval: blockInterval,
|
|
135
136
|
backfillInterval: backfillBlockInterval
|
|
136
|
-
}
|
|
137
|
+
})
|
|
137
138
|
// fetchConfig
|
|
138
139
|
)
|
|
139
140
|
}
|
|
@@ -146,7 +147,7 @@ export abstract class FuelBaseProcessorTemplate<TContract extends Contract> {
|
|
|
146
147
|
) {
|
|
147
148
|
return this.onInterval(
|
|
148
149
|
handler,
|
|
149
|
-
{ recentInterval: timeIntervalInMinutes, backfillInterval: backfillBlockInterval },
|
|
150
|
+
create(HandleIntervalSchema, { recentInterval: timeIntervalInMinutes, backfillInterval: backfillBlockInterval }),
|
|
150
151
|
undefined
|
|
151
152
|
// fetchConfig
|
|
152
153
|
)
|
|
@@ -2,10 +2,12 @@ import {
|
|
|
2
2
|
Data_FuelBlock,
|
|
3
3
|
Data_FuelTransaction,
|
|
4
4
|
Data_FuelReceipt,
|
|
5
|
-
FuelCallFilter,
|
|
6
5
|
HandleInterval,
|
|
7
|
-
|
|
6
|
+
HandleIntervalSchema,
|
|
7
|
+
ProcessResultSchema,
|
|
8
|
+
timestampDate
|
|
8
9
|
} from '@sentio/protos'
|
|
10
|
+
import { create } from '@bufbuild/protobuf'
|
|
9
11
|
import { FuelCall, FuelContext, FuelContractContext } from './context.js'
|
|
10
12
|
import { bn, Contract, InputType, Interface, JsonAbi, Provider, ReceiptTransfer, ReceiptTransferOut } from 'fuels'
|
|
11
13
|
import { FuelNetwork, getProvider } from './network.js'
|
|
@@ -22,13 +24,14 @@ import {
|
|
|
22
24
|
ContractTransferFilter,
|
|
23
25
|
FuelBaseProcessor,
|
|
24
26
|
FuelBlock,
|
|
27
|
+
FuelCallFilter,
|
|
25
28
|
FuelLog,
|
|
26
29
|
FuelProcessorState,
|
|
27
30
|
FuelTransaction,
|
|
28
31
|
ReceiptHandler
|
|
29
32
|
} from './types.js'
|
|
30
33
|
import { PromiseOrVoid, HandlerOptions } from '../core/index.js'
|
|
31
|
-
import {
|
|
34
|
+
import { ConnectError, Code } from '@connectrpc/connect'
|
|
32
35
|
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
|
33
36
|
|
|
34
37
|
export class FuelProcessor<TContract extends Contract> implements FuelBaseProcessor<FuelProcessorConfig> {
|
|
@@ -106,7 +109,7 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
106
109
|
this.getContract(tx),
|
|
107
110
|
this.config.address,
|
|
108
111
|
this.config.name ?? this.config.address,
|
|
109
|
-
call.timestamp
|
|
112
|
+
call.timestamp ? timestampDate(call.timestamp) : new Date(0),
|
|
110
113
|
tx,
|
|
111
114
|
null
|
|
112
115
|
)
|
|
@@ -176,7 +179,7 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
176
179
|
this.config.chainId,
|
|
177
180
|
this.config.address,
|
|
178
181
|
this.config.name ?? this.config.address,
|
|
179
|
-
call.timestamp
|
|
182
|
+
call.timestamp ? timestampDate(call.timestamp) : new Date(0),
|
|
180
183
|
tx,
|
|
181
184
|
null
|
|
182
185
|
)
|
|
@@ -198,7 +201,7 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
198
201
|
return ctx.stopAndGetResult()
|
|
199
202
|
} catch (e) {
|
|
200
203
|
console.error(e)
|
|
201
|
-
return
|
|
204
|
+
return create(ProcessResultSchema)
|
|
202
205
|
}
|
|
203
206
|
},
|
|
204
207
|
fetchConfig: {
|
|
@@ -231,7 +234,7 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
231
234
|
this.getContract(tx),
|
|
232
235
|
this.config.address,
|
|
233
236
|
this.config.name ?? this.config.address,
|
|
234
|
-
timestamp
|
|
237
|
+
timestamp ? timestampDate(timestamp) : new Date(0),
|
|
235
238
|
tx,
|
|
236
239
|
null
|
|
237
240
|
)
|
|
@@ -245,11 +248,14 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
245
248
|
console.error(e)
|
|
246
249
|
}
|
|
247
250
|
|
|
248
|
-
return
|
|
251
|
+
return create(ProcessResultSchema)
|
|
249
252
|
},
|
|
250
253
|
receiptConfig: {
|
|
251
|
-
|
|
252
|
-
|
|
254
|
+
receiptFilter: {
|
|
255
|
+
case: 'log',
|
|
256
|
+
value: {
|
|
257
|
+
logIds: Array.from(logIds)
|
|
258
|
+
}
|
|
253
259
|
}
|
|
254
260
|
},
|
|
255
261
|
partitionHandler: async (data: Data_FuelReceipt): Promise<string | undefined> => {
|
|
@@ -297,7 +303,7 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
297
303
|
this.getContract(tx),
|
|
298
304
|
this.config.address,
|
|
299
305
|
this.config.name ?? this.config.address,
|
|
300
|
-
timestamp
|
|
306
|
+
timestamp ? timestampDate(timestamp) : new Date(0),
|
|
301
307
|
tx,
|
|
302
308
|
null
|
|
303
309
|
)
|
|
@@ -307,13 +313,16 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
307
313
|
console.error(e)
|
|
308
314
|
}
|
|
309
315
|
|
|
310
|
-
return
|
|
316
|
+
return create(ProcessResultSchema)
|
|
311
317
|
},
|
|
312
318
|
receiptConfig: {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
319
|
+
receiptFilter: {
|
|
320
|
+
case: 'transfer',
|
|
321
|
+
value: {
|
|
322
|
+
from,
|
|
323
|
+
to,
|
|
324
|
+
assetId
|
|
325
|
+
}
|
|
317
326
|
}
|
|
318
327
|
},
|
|
319
328
|
partitionHandler: async (data: Data_FuelReceipt): Promise<string | undefined> => {
|
|
@@ -357,9 +366,9 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
357
366
|
timeIntervalInMinutes: timeInterval,
|
|
358
367
|
handlerName,
|
|
359
368
|
handler: async function (data: Data_FuelBlock) {
|
|
360
|
-
const header = data.block
|
|
369
|
+
const header = data.block as any
|
|
361
370
|
if (!header) {
|
|
362
|
-
throw new
|
|
371
|
+
throw new ConnectError('Block is empty', Code.InvalidArgument)
|
|
363
372
|
}
|
|
364
373
|
|
|
365
374
|
const block: FuelBlock = {
|
|
@@ -383,7 +392,7 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
383
392
|
contract,
|
|
384
393
|
processor.config.address,
|
|
385
394
|
processor.config.name ?? processor.config.address,
|
|
386
|
-
data.timestamp
|
|
395
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
387
396
|
null,
|
|
388
397
|
block
|
|
389
398
|
)
|
|
@@ -394,7 +403,7 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
394
403
|
const p = handlerOptions?.partitionKey
|
|
395
404
|
if (!p) return undefined
|
|
396
405
|
if (typeof p === 'function') {
|
|
397
|
-
const header = data.block
|
|
406
|
+
const header = data.block as any
|
|
398
407
|
if (!header) return undefined
|
|
399
408
|
const block: FuelBlock = {
|
|
400
409
|
id: header.id,
|
|
@@ -428,10 +437,10 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
428
437
|
return this.onInterval(
|
|
429
438
|
handler,
|
|
430
439
|
undefined,
|
|
431
|
-
{
|
|
440
|
+
create(HandleIntervalSchema, {
|
|
432
441
|
recentInterval: blockInterval,
|
|
433
442
|
backfillInterval: backfillBlockInterval
|
|
434
|
-
},
|
|
443
|
+
}),
|
|
435
444
|
handlerOptions
|
|
436
445
|
)
|
|
437
446
|
}
|
|
@@ -444,7 +453,10 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
|
444
453
|
): this {
|
|
445
454
|
return this.onInterval(
|
|
446
455
|
handler,
|
|
447
|
-
|
|
456
|
+
create(HandleIntervalSchema, {
|
|
457
|
+
recentInterval: timeIntervalInMinutes,
|
|
458
|
+
backfillInterval: backfillTimeIntervalInMinutes
|
|
459
|
+
}),
|
|
448
460
|
undefined,
|
|
449
461
|
handlerOptions
|
|
450
462
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CallHandler, FuelBaseProcessor, FuelBlock, FuelProcessorState, FuelTransaction } from './types.js'
|
|
2
|
-
import { Data_FuelTransaction } from '@sentio/protos'
|
|
2
|
+
import { Data_FuelTransaction, timestampDate } from '@sentio/protos'
|
|
3
3
|
import { Provider, bn } from 'fuels'
|
|
4
4
|
import { getProvider } from './network.js'
|
|
5
5
|
import { decodeFuelTransaction, DEFAULT_FUEL_FETCH_CONFIG, FuelFetchConfig } from './transaction.js'
|
|
@@ -51,12 +51,12 @@ export class FuelGlobalProcessor implements FuelBaseProcessor<GlobalFuelProcesso
|
|
|
51
51
|
console.error('error decoding transaction', e)
|
|
52
52
|
return mergeProcessResults([])
|
|
53
53
|
}
|
|
54
|
-
const header = call.transaction?.status.block.header
|
|
54
|
+
const header = (call.transaction as any)?.status.block.header
|
|
55
55
|
const ctx = new FuelContext(
|
|
56
56
|
this.config.chainId,
|
|
57
57
|
ALL_ADDRESS,
|
|
58
58
|
this.config.name ?? '*',
|
|
59
|
-
call.timestamp
|
|
59
|
+
call.timestamp ? timestampDate(call.timestamp) : new Date(0),
|
|
60
60
|
tx,
|
|
61
61
|
header
|
|
62
62
|
? ({
|
package/src/fuel/types.ts
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
Data_FuelReceipt,
|
|
5
5
|
Data_FuelTransaction,
|
|
6
6
|
FuelAssetHandlerConfig,
|
|
7
|
-
FuelCallHandlerConfig,
|
|
8
7
|
FuelReceiptHandlerConfig,
|
|
9
8
|
HandleInterval,
|
|
10
9
|
OnIntervalConfig,
|
|
@@ -12,6 +11,13 @@ import {
|
|
|
12
11
|
} from '@sentio/protos'
|
|
13
12
|
import { Block, TransactionSummary } from 'fuels'
|
|
14
13
|
|
|
14
|
+
// Client-side only filter for `onCall`. Fuel calls are delivered as FUEL_TRANSACTION
|
|
15
|
+
// data and filtered in-handler, so this never reaches the backend.
|
|
16
|
+
export interface FuelCallFilter {
|
|
17
|
+
function: string
|
|
18
|
+
includeFailed: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
export interface FuelBaseProcessor<T> {
|
|
16
22
|
configure(): Promise<void>
|
|
17
23
|
config: T
|
|
@@ -27,15 +33,15 @@ export class FuelProcessorState extends MapStateStorage<FuelBaseProcessor<any>>
|
|
|
27
33
|
export type CallHandler<T> = {
|
|
28
34
|
handlerName: string
|
|
29
35
|
handler: (call: T) => Promise<ProcessResult>
|
|
30
|
-
fetchConfig?:
|
|
31
|
-
assetConfig?: Partial<FuelAssetHandlerConfig>
|
|
36
|
+
fetchConfig?: { filters: FuelCallFilter[] }
|
|
37
|
+
assetConfig?: Omit<Partial<FuelAssetHandlerConfig>, '$typeName' | '$unknown'>
|
|
32
38
|
partitionHandler?: (call: T) => Promise<string | undefined>
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
export type ReceiptHandler = {
|
|
36
42
|
handlerName: string
|
|
37
43
|
handler: (receipt: Data_FuelReceipt) => Promise<ProcessResult>
|
|
38
|
-
receiptConfig?: Partial<FuelReceiptHandlerConfig>
|
|
44
|
+
receiptConfig?: Omit<Partial<FuelReceiptHandlerConfig>, '$typeName' | '$unknown'>
|
|
39
45
|
partitionHandler?: (receipt: Data_FuelReceipt) => Promise<string | undefined>
|
|
40
46
|
}
|
|
41
47
|
|
package/src/iota/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 { getClient, IotaNetwork } from './network.js'
|
|
4
5
|
import {
|
|
@@ -52,7 +53,7 @@ export class IotaContext extends MoveContext<IotaNetwork, IotaMoveNormalizedModu
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
|
55
|
-
return {
|
|
56
|
+
return create(RecordMetaDataSchema, {
|
|
56
57
|
address: this.address,
|
|
57
58
|
contractName: this.moduleName,
|
|
58
59
|
blockNumber: this.checkpoint,
|
|
@@ -62,7 +63,7 @@ export class IotaContext extends MoveContext<IotaNetwork, IotaMoveNormalizedModu
|
|
|
62
63
|
chainId: this.getChainId(),
|
|
63
64
|
name: name,
|
|
64
65
|
labels: normalizeLabels(labels)
|
|
65
|
-
}
|
|
66
|
+
})
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
get client(): IotaClient {
|
|
@@ -106,7 +107,7 @@ export class IotaObjectChangeContext extends MoveContext<
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
|
109
|
-
return {
|
|
110
|
+
return create(RecordMetaDataSchema, {
|
|
110
111
|
address: this.address,
|
|
111
112
|
contractName: '*',
|
|
112
113
|
blockNumber: this.checkpoint,
|
|
@@ -116,7 +117,7 @@ export class IotaObjectChangeContext extends MoveContext<
|
|
|
116
117
|
chainId: this.getChainId(),
|
|
117
118
|
name: name,
|
|
118
119
|
labels: normalizeLabels(labels)
|
|
119
|
-
}
|
|
120
|
+
})
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
get client(): IotaClient {
|
|
@@ -158,7 +159,7 @@ export class IotaAddressContext extends MoveAccountContext<
|
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
|
161
|
-
return {
|
|
162
|
+
return create(RecordMetaDataSchema, {
|
|
162
163
|
address: this.address,
|
|
163
164
|
contractName: this.contractName,
|
|
164
165
|
blockNumber: this.checkpoint,
|
|
@@ -168,7 +169,7 @@ export class IotaAddressContext extends MoveAccountContext<
|
|
|
168
169
|
chainId: this.getChainId(),
|
|
169
170
|
name: name,
|
|
170
171
|
labels: normalizeLabels(labels)
|
|
171
|
-
}
|
|
172
|
+
})
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
get client(): IotaClient {
|