@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/store/store.ts
CHANGED
|
@@ -13,14 +13,14 @@ import {
|
|
|
13
13
|
UpdateValues
|
|
14
14
|
} from './types.js'
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Entity as EntityStruct,
|
|
16
|
+
DBRequest_DBUpdateSchema,
|
|
17
|
+
type Entity as EntityStruct,
|
|
19
18
|
EntityUpdateData_Operator,
|
|
20
|
-
RichValue,
|
|
19
|
+
type RichValue,
|
|
21
20
|
DBRequest_DBOperator,
|
|
22
|
-
DBResponse
|
|
21
|
+
type DBResponse
|
|
23
22
|
} from '@sentio/protos'
|
|
23
|
+
import { type MessageInitShape } from '@bufbuild/protobuf'
|
|
24
24
|
import { IStoreContext, PluginManager } from '@sentio/runtime'
|
|
25
25
|
import { Cursor } from './cursor.js'
|
|
26
26
|
import { serializeRichValue } from './util.js'
|
|
@@ -76,15 +76,16 @@ export class Store {
|
|
|
76
76
|
const entityName = getEntityName(entity)
|
|
77
77
|
|
|
78
78
|
const promise = this.context.sendRequest({
|
|
79
|
-
|
|
79
|
+
case: 'get',
|
|
80
|
+
value: {
|
|
80
81
|
entity: entityName,
|
|
81
82
|
id: id.toString()
|
|
82
83
|
}
|
|
83
84
|
})
|
|
84
85
|
|
|
85
86
|
const data = (await promise) as DBResponse
|
|
86
|
-
if (data.entityList
|
|
87
|
-
const entityData = data.
|
|
87
|
+
if (data.value.case === 'entityList' && data.value.value.entities[0]) {
|
|
88
|
+
const entityData = data.value.value.entities[0]
|
|
88
89
|
return this.newEntity(entity, entityData)
|
|
89
90
|
}
|
|
90
91
|
|
|
@@ -116,32 +117,34 @@ export class Store {
|
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
await this.context.sendRequest({
|
|
119
|
-
|
|
120
|
+
case: 'delete',
|
|
121
|
+
value: request
|
|
120
122
|
})
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
async update<T extends Entity>(entity: EntityClass<T>, values: UpdateValues<any>): Promise<void> {
|
|
124
126
|
if (values.id) {
|
|
125
|
-
const update:
|
|
127
|
+
const update: MessageInitShape<typeof DBRequest_DBUpdateSchema> = {
|
|
126
128
|
entity: [getEntityName(entity)],
|
|
127
129
|
id: [values.id.toString()],
|
|
128
130
|
entityData: [{ fields: {} }]
|
|
129
131
|
}
|
|
132
|
+
const fields = update.entityData![0].fields!
|
|
130
133
|
for (const [key, value] of Object.entries(values)) {
|
|
131
134
|
if (key !== 'id') {
|
|
132
135
|
const field = getEntityField(entity, key)
|
|
133
136
|
if (value instanceof AddOp) {
|
|
134
|
-
|
|
137
|
+
fields[field] = {
|
|
135
138
|
op: EntityUpdateData_Operator.ADD,
|
|
136
139
|
value: serializeRichValue(value.value)
|
|
137
140
|
}
|
|
138
141
|
} else if (value instanceof MultiplyOp) {
|
|
139
|
-
|
|
142
|
+
fields[field] = {
|
|
140
143
|
op: EntityUpdateData_Operator.MULTIPLY,
|
|
141
144
|
value: serializeRichValue(value.value)
|
|
142
145
|
}
|
|
143
146
|
} else if (value !== undefined) {
|
|
144
|
-
|
|
147
|
+
fields[field] = {
|
|
145
148
|
op: EntityUpdateData_Operator.SET,
|
|
146
149
|
value: serializeRichValue(value)
|
|
147
150
|
}
|
|
@@ -149,7 +152,8 @@ export class Store {
|
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
154
|
await this.context.sendRequest({
|
|
152
|
-
update
|
|
155
|
+
case: 'update',
|
|
156
|
+
value: update
|
|
153
157
|
})
|
|
154
158
|
} else {
|
|
155
159
|
throw new Error('Update must have id field')
|
|
@@ -158,15 +162,15 @@ export class Store {
|
|
|
158
162
|
|
|
159
163
|
async upsert<T extends Entity>(entity: T | T[]): Promise<void> {
|
|
160
164
|
const entities = Array.isArray(entity) ? entity : [entity]
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
await this.context.sendRequest({
|
|
166
|
+
case: 'upsert',
|
|
167
|
+
value: {
|
|
163
168
|
entity: entities.map((e) => getEntityName(e)),
|
|
164
169
|
// data: entities.map((e) => serialize(e.data)),
|
|
165
170
|
id: entities.map((e) => e.id.toString()),
|
|
166
171
|
entityData: entities.map((e: any) => e._data)
|
|
167
172
|
}
|
|
168
|
-
}
|
|
169
|
-
await this.context.sendRequest(request)
|
|
173
|
+
})
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
async *listIterator<T extends Entity, P extends keyof T, O extends Operators<T[P]>>(
|
|
@@ -177,7 +181,8 @@ export class Store {
|
|
|
177
181
|
|
|
178
182
|
while (true) {
|
|
179
183
|
const response: DBResponse = await this.listRequest(entity, filters || [], cursor)
|
|
180
|
-
|
|
184
|
+
const entities = response.value.case === 'entityList' ? response.value.value.entities : []
|
|
185
|
+
for (const data of entities) {
|
|
181
186
|
yield this.newEntity(entity, data)
|
|
182
187
|
}
|
|
183
188
|
if (!response.nextCursor) {
|
|
@@ -196,7 +201,8 @@ export class Store {
|
|
|
196
201
|
|
|
197
202
|
while (true) {
|
|
198
203
|
const response: DBResponse = await this.listRequest(entity, filters || [], cursor, batchSize)
|
|
199
|
-
const
|
|
204
|
+
const list = response.value.case === 'entityList' ? response.value.value.entities : []
|
|
205
|
+
const entities = list.map((data) => this.newEntity(entity, data))
|
|
200
206
|
yield entities
|
|
201
207
|
if (!response.nextCursor) {
|
|
202
208
|
break
|
|
@@ -213,7 +219,8 @@ export class Store {
|
|
|
213
219
|
): Promise<DBResponse> {
|
|
214
220
|
const response = (await this.context.sendRequest(
|
|
215
221
|
{
|
|
216
|
-
|
|
222
|
+
case: 'list',
|
|
223
|
+
value: {
|
|
217
224
|
entity: getEntityName(entity),
|
|
218
225
|
cursor,
|
|
219
226
|
pageSize,
|
|
@@ -259,7 +266,8 @@ export class Store {
|
|
|
259
266
|
if (cursor) {
|
|
260
267
|
const response = await this.listRequest(entity, filters || [], cursor.cursor, cursor.pageSize)
|
|
261
268
|
cursor.cursor = response.nextCursor
|
|
262
|
-
|
|
269
|
+
const list = response.value.case === 'entityList' ? response.value.value.entities : []
|
|
270
|
+
return list.map((data) => this.newEntity(entity, data))
|
|
263
271
|
}
|
|
264
272
|
// TODO Array.fromAsync when upgrade to node 22
|
|
265
273
|
return this.fromAsync(this.listIterator(entity, filters ?? []))
|
package/src/store/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RichStruct, RichValue } from '@sentio/protos'
|
|
1
|
+
import { type RichStruct, type RichValue, timestampDate } from '@sentio/protos'
|
|
2
2
|
import { BigDecimalConverter, BigIntConverter } from './convert.js'
|
|
3
3
|
import { getEntityName, Store } from './store.js'
|
|
4
4
|
import { PluginManager } from '@sentio/runtime'
|
|
@@ -70,38 +70,29 @@ export abstract class AbstractEntity {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
function toJSValue(value: RichValue): any {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
if (value.intValue != null) {
|
|
98
|
-
return value.intValue
|
|
99
|
-
}
|
|
100
|
-
if (value.listValue != null) {
|
|
101
|
-
return value.listValue.values.map(toJSValue)
|
|
102
|
-
}
|
|
103
|
-
if (value.int64Value) {
|
|
104
|
-
return value.int64Value
|
|
73
|
+
switch (value.value.case) {
|
|
74
|
+
case 'nullValue':
|
|
75
|
+
return null
|
|
76
|
+
case 'bytesValue':
|
|
77
|
+
return value.value.value
|
|
78
|
+
case 'stringValue':
|
|
79
|
+
return value.value.value
|
|
80
|
+
case 'bigdecimalValue':
|
|
81
|
+
return BigDecimalConverter.to(value)
|
|
82
|
+
case 'bigintValue':
|
|
83
|
+
return BigIntConverter.to(value)
|
|
84
|
+
case 'boolValue':
|
|
85
|
+
return value.value.value
|
|
86
|
+
case 'timestampValue':
|
|
87
|
+
return timestampDate(value.value.value)
|
|
88
|
+
case 'floatValue':
|
|
89
|
+
return value.value.value
|
|
90
|
+
case 'intValue':
|
|
91
|
+
return value.value.value
|
|
92
|
+
case 'listValue':
|
|
93
|
+
return value.value.value.values.map(toJSValue)
|
|
94
|
+
case 'int64Value':
|
|
95
|
+
return value.value.value
|
|
105
96
|
}
|
|
106
97
|
throw new Error('Unknown value type:' + JSON.stringify(value))
|
|
107
98
|
}
|
package/src/store/util.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RichValue, RichValueSchema, RichValue_NullValue, timestampFromDate } from '@sentio/protos'
|
|
2
|
+
import { create } from '@bufbuild/protobuf'
|
|
2
3
|
import { toBigInteger, toBigDecimal } from '../core/numberish.js'
|
|
3
4
|
import { BigDecimal } from '@sentio/bigdecimal'
|
|
4
5
|
|
|
5
6
|
export function serializeRichValue(v: any): RichValue {
|
|
6
7
|
if (v == null) {
|
|
7
|
-
return { nullValue:
|
|
8
|
+
return create(RichValueSchema, { value: { case: 'nullValue', value: RichValue_NullValue.NULL_VALUE } })
|
|
8
9
|
}
|
|
9
10
|
if (typeof v == 'boolean') {
|
|
10
|
-
return { boolValue: v }
|
|
11
|
+
return create(RichValueSchema, { value: { case: 'boolValue', value: v } })
|
|
11
12
|
}
|
|
12
13
|
if (typeof v == 'string') {
|
|
13
|
-
return { stringValue: v }
|
|
14
|
+
return create(RichValueSchema, { value: { case: 'stringValue', value: v } })
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
if (typeof v == 'number') {
|
|
17
|
-
return { floatValue: v }
|
|
18
|
+
return create(RichValueSchema, { value: { case: 'floatValue', value: v } })
|
|
18
19
|
}
|
|
19
20
|
if (typeof v == 'bigint') {
|
|
20
|
-
return {
|
|
21
|
-
bigintValue: toBigInteger(v)
|
|
22
|
-
}
|
|
21
|
+
return create(RichValueSchema, { value: { case: 'bigintValue', value: toBigInteger(v) } })
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
if (BigDecimal.isBigNumber(v)) {
|
|
@@ -27,25 +26,21 @@ export function serializeRichValue(v: any): RichValue {
|
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
if (v instanceof Date) {
|
|
30
|
-
return {
|
|
31
|
-
timestampValue: v
|
|
32
|
-
}
|
|
29
|
+
return create(RichValueSchema, { value: { case: 'timestampValue', value: timestampFromDate(v) } })
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
if (v instanceof Uint8Array) {
|
|
36
|
-
return { bytesValue: v }
|
|
33
|
+
return create(RichValueSchema, { value: { case: 'bytesValue', value: v } })
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
if (Array.isArray(v)) {
|
|
40
|
-
return {
|
|
41
|
-
listValue: { values: v.map((v) => serializeRichValue(v)) }
|
|
42
|
-
}
|
|
37
|
+
return create(RichValueSchema, {
|
|
38
|
+
value: { case: 'listValue', value: { values: v.map((v) => serializeRichValue(v)) } }
|
|
39
|
+
})
|
|
43
40
|
}
|
|
44
41
|
throw new Error('Unsupported type for serialization: ' + typeof v)
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
function serializeBigDecimal(v: BigDecimal): RichValue {
|
|
48
|
-
return {
|
|
49
|
-
bigdecimalValue: toBigDecimal(v)
|
|
50
|
-
}
|
|
45
|
+
return create(RichValueSchema, { value: { case: 'bigdecimalValue', value: toBigDecimal(v) } })
|
|
51
46
|
}
|
package/src/sui/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, SuiNetwork } from './network.js'
|
|
4
5
|
import type { GrpcTypes, SuiGrpcClient } from '@mysten/sui/grpc'
|
|
@@ -47,7 +48,7 @@ export class SuiContext extends MoveContext<SuiNetwork, ModuleWithAddress, SuiEv
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
|
50
|
-
return {
|
|
51
|
+
return create(RecordMetaDataSchema, {
|
|
51
52
|
address: this.address,
|
|
52
53
|
contractName: this.moduleName,
|
|
53
54
|
blockNumber: this.checkpoint,
|
|
@@ -57,7 +58,7 @@ export class SuiContext extends MoveContext<SuiNetwork, ModuleWithAddress, SuiEv
|
|
|
57
58
|
chainId: this.getChainId(),
|
|
58
59
|
name: name,
|
|
59
60
|
labels: normalizeLabels(labels)
|
|
60
|
-
}
|
|
61
|
+
})
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
get client(): SuiGrpcClient {
|
|
@@ -101,7 +102,7 @@ export class SuiObjectChangeContext extends MoveContext<
|
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
|
104
|
-
return {
|
|
105
|
+
return create(RecordMetaDataSchema, {
|
|
105
106
|
address: this.address,
|
|
106
107
|
contractName: '*',
|
|
107
108
|
blockNumber: this.checkpoint,
|
|
@@ -111,7 +112,7 @@ export class SuiObjectChangeContext extends MoveContext<
|
|
|
111
112
|
chainId: this.getChainId(),
|
|
112
113
|
name: name,
|
|
113
114
|
labels: normalizeLabels(labels)
|
|
114
|
-
}
|
|
115
|
+
})
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
get client(): SuiGrpcClient {
|
|
@@ -153,7 +154,7 @@ export class SuiAddressContext extends MoveAccountContext<
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
getMetaDataInternal(name: string, labels: Labels): RecordMetaData {
|
|
156
|
-
return {
|
|
157
|
+
return create(RecordMetaDataSchema, {
|
|
157
158
|
address: this.address,
|
|
158
159
|
contractName: this.contractName,
|
|
159
160
|
blockNumber: this.checkpoint,
|
|
@@ -163,7 +164,7 @@ export class SuiAddressContext extends MoveAccountContext<
|
|
|
163
164
|
chainId: this.getChainId(),
|
|
164
165
|
name: name,
|
|
165
166
|
labels: normalizeLabels(labels)
|
|
166
|
-
}
|
|
167
|
+
})
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
get client(): SuiGrpcClient {
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type HandleInterval,
|
|
3
|
+
HandleIntervalSchema,
|
|
4
|
+
type MoveAccountFetchConfig,
|
|
5
|
+
type MoveFetchConfig,
|
|
6
|
+
TemplateInstanceSchema
|
|
7
|
+
} from '@sentio/protos'
|
|
8
|
+
import { create } from '@bufbuild/protobuf'
|
|
2
9
|
import { ListStateStorage, processMetrics } from '@sentio/runtime'
|
|
3
10
|
import { SuiAddressContext, SuiContext, SuiObjectContext } from './context.js'
|
|
4
11
|
import type { GrpcTypes } from '@mysten/sui/grpc'
|
|
@@ -15,7 +22,7 @@ import {
|
|
|
15
22
|
} from './sui-object-processor.js'
|
|
16
23
|
import { SuiBindOptions } from './sui-processor.js'
|
|
17
24
|
import { accountAddressString, TransactionFilter } from '../move/index.js'
|
|
18
|
-
import {
|
|
25
|
+
import { ConnectError, Code } from '@connectrpc/connect'
|
|
19
26
|
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
|
20
27
|
|
|
21
28
|
class ObjectHandler<HandlerType> {
|
|
@@ -56,11 +63,11 @@ export abstract class SuiObjectOrAddressProcessorTemplate<
|
|
|
56
63
|
let id = (options as SuiObjectBindOptions).objectId || (options as SuiBindOptions).address
|
|
57
64
|
|
|
58
65
|
if (id === '*') {
|
|
59
|
-
throw new
|
|
66
|
+
throw new ConnectError("can't bind template instance with *", Code.InvalidArgument)
|
|
60
67
|
}
|
|
61
68
|
id = accountAddressString(id)
|
|
62
69
|
|
|
63
|
-
const instance
|
|
70
|
+
const instance = create(TemplateInstanceSchema, {
|
|
64
71
|
templateId: this.id,
|
|
65
72
|
contract: {
|
|
66
73
|
name: '',
|
|
@@ -71,7 +78,7 @@ export abstract class SuiObjectOrAddressProcessorTemplate<
|
|
|
71
78
|
startBlock: options.startCheckpoint || 0n,
|
|
72
79
|
endBlock: options.endCheckpoint || 0n,
|
|
73
80
|
baseLabels: options.baseLabels
|
|
74
|
-
}
|
|
81
|
+
})
|
|
75
82
|
|
|
76
83
|
ctx.sendTemplateInstance(instance)
|
|
77
84
|
|
|
@@ -93,7 +100,7 @@ export abstract class SuiObjectOrAddressProcessorTemplate<
|
|
|
93
100
|
let id = (options as SuiObjectBindOptions).objectId || (options as SuiBindOptions).address
|
|
94
101
|
|
|
95
102
|
if (id === '*') {
|
|
96
|
-
throw new
|
|
103
|
+
throw new ConnectError("can't bind template instance with *", Code.InvalidArgument)
|
|
97
104
|
}
|
|
98
105
|
id = accountAddressString(id)
|
|
99
106
|
|
|
@@ -124,7 +131,7 @@ export abstract class SuiObjectOrAddressProcessorTemplate<
|
|
|
124
131
|
let id = (options as SuiObjectBindOptions).objectId || (options as SuiBindOptions).address
|
|
125
132
|
|
|
126
133
|
if (id === '*') {
|
|
127
|
-
throw new
|
|
134
|
+
throw new ConnectError("can't delete template instance bind with *", Code.InvalidArgument)
|
|
128
135
|
}
|
|
129
136
|
id = accountAddressString(id)
|
|
130
137
|
|
|
@@ -148,9 +155,9 @@ export abstract class SuiObjectOrAddressProcessorTemplate<
|
|
|
148
155
|
}
|
|
149
156
|
|
|
150
157
|
if (deleted !== 1) {
|
|
151
|
-
throw new
|
|
152
|
-
|
|
153
|
-
|
|
158
|
+
throw new ConnectError(
|
|
159
|
+
`Failed to delete processor for template ${this.id}, ${sig}. deleted ${deleted} times`,
|
|
160
|
+
Code.InvalidArgument
|
|
154
161
|
)
|
|
155
162
|
}
|
|
156
163
|
|
|
@@ -163,7 +170,7 @@ export abstract class SuiObjectOrAddressProcessorTemplate<
|
|
|
163
170
|
})
|
|
164
171
|
|
|
165
172
|
ctx.sendTemplateInstance(
|
|
166
|
-
{
|
|
173
|
+
create(TemplateInstanceSchema, {
|
|
167
174
|
templateId: this.id,
|
|
168
175
|
contract: {
|
|
169
176
|
name: '',
|
|
@@ -174,7 +181,7 @@ export abstract class SuiObjectOrAddressProcessorTemplate<
|
|
|
174
181
|
startBlock: options.startCheckpoint || 0n,
|
|
175
182
|
endBlock: options.endCheckpoint || 0n,
|
|
176
183
|
baseLabels: options.baseLabels
|
|
177
|
-
},
|
|
184
|
+
}),
|
|
178
185
|
true
|
|
179
186
|
)
|
|
180
187
|
}
|
|
@@ -206,10 +213,10 @@ export abstract class SuiObjectOrAddressProcessorTemplate<
|
|
|
206
213
|
): this {
|
|
207
214
|
return this.onInterval(
|
|
208
215
|
handler,
|
|
209
|
-
{
|
|
216
|
+
create(HandleIntervalSchema, {
|
|
210
217
|
recentInterval: timeIntervalInMinutes,
|
|
211
218
|
backfillInterval: backfillTimeIntervalInMinutes
|
|
212
|
-
},
|
|
219
|
+
}),
|
|
213
220
|
undefined,
|
|
214
221
|
type,
|
|
215
222
|
fetchConfig
|
|
@@ -226,7 +233,10 @@ export abstract class SuiObjectOrAddressProcessorTemplate<
|
|
|
226
233
|
return this.onInterval(
|
|
227
234
|
handler,
|
|
228
235
|
undefined,
|
|
229
|
-
|
|
236
|
+
create(HandleIntervalSchema, {
|
|
237
|
+
recentInterval: checkpointInterval,
|
|
238
|
+
backfillInterval: backfillCheckpointInterval
|
|
239
|
+
}),
|
|
230
240
|
type,
|
|
231
241
|
fetchConfig
|
|
232
242
|
)
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Data_SuiCall,
|
|
3
|
-
Data_SuiObject,
|
|
4
|
-
Data_SuiObjectChange,
|
|
5
|
-
HandleInterval,
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
type Data_SuiCall,
|
|
3
|
+
type Data_SuiObject,
|
|
4
|
+
type Data_SuiObjectChange,
|
|
5
|
+
type HandleInterval,
|
|
6
|
+
HandleIntervalSchema,
|
|
7
|
+
type MoveAccountFetchConfig,
|
|
8
|
+
MoveAccountFetchConfigSchema,
|
|
9
|
+
type MoveFetchConfig,
|
|
10
|
+
MoveFetchConfigSchema,
|
|
8
11
|
MoveOwnerType,
|
|
9
|
-
ProcessResult
|
|
12
|
+
type ProcessResult,
|
|
13
|
+
timestampDate
|
|
10
14
|
} from '@sentio/protos'
|
|
15
|
+
import { create } from '@bufbuild/protobuf'
|
|
11
16
|
import { ListStateStorage } from '@sentio/runtime'
|
|
12
17
|
import { SuiNetwork } from './network.js'
|
|
13
18
|
import { SuiAddressContext, SuiContext, SuiObjectChangeContext, SuiObjectContext } from './context.js'
|
|
@@ -17,7 +22,7 @@ import type { SuiMoveObjectInput } from '@typemove/sui'
|
|
|
17
22
|
import { ALL_ADDRESS, PromiseOrVoid } from '../core/index.js'
|
|
18
23
|
import { configure, DEFAULT_FETCH_CONFIG, IndexConfigure, SuiBindOptions } from './sui-processor.js'
|
|
19
24
|
import { CallHandler, TransactionFilter, accountTypeString, ObjectChangeHandler } from '../move/index.js'
|
|
20
|
-
import {
|
|
25
|
+
import { ConnectError, Code } from '@connectrpc/connect'
|
|
21
26
|
import { TypeDescriptor } from '@typemove/move'
|
|
22
27
|
import { TypedSuiMoveObject } from './models.js'
|
|
23
28
|
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
|
@@ -47,9 +52,9 @@ interface ObjectHandler {
|
|
|
47
52
|
handlerName: string
|
|
48
53
|
}
|
|
49
54
|
|
|
50
|
-
export const DEFAULT_ACCOUNT_FETCH_CONFIG: MoveAccountFetchConfig = {
|
|
55
|
+
export const DEFAULT_ACCOUNT_FETCH_CONFIG: MoveAccountFetchConfig = create(MoveAccountFetchConfigSchema, {
|
|
51
56
|
owned: false
|
|
52
|
-
}
|
|
57
|
+
})
|
|
53
58
|
|
|
54
59
|
export class SuiAccountProcessorState extends ListStateStorage<SuiBaseObjectOrAddressProcessor<any>> {
|
|
55
60
|
static INSTANCE = new SuiAccountProcessorState()
|
|
@@ -114,7 +119,7 @@ export abstract class SuiBaseObjectOrAddressProcessor<HandlerType> {
|
|
|
114
119
|
data.objectId,
|
|
115
120
|
data.objectVersion,
|
|
116
121
|
data.slot,
|
|
117
|
-
data.timestamp
|
|
122
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
118
123
|
processor.config.baseLabels
|
|
119
124
|
)
|
|
120
125
|
await processor.doHandle(handler, data, ctx)
|
|
@@ -141,10 +146,10 @@ abstract class SuiBaseObjectOrAddressProcessorInternal<
|
|
|
141
146
|
): this {
|
|
142
147
|
return this.onInterval(
|
|
143
148
|
handler,
|
|
144
|
-
{
|
|
149
|
+
create(HandleIntervalSchema, {
|
|
145
150
|
recentInterval: timeIntervalInMinutes,
|
|
146
151
|
backfillInterval: backfillTimeIntervalInMinutes
|
|
147
|
-
},
|
|
152
|
+
}),
|
|
148
153
|
undefined,
|
|
149
154
|
type,
|
|
150
155
|
fetchConfig
|
|
@@ -161,7 +166,10 @@ abstract class SuiBaseObjectOrAddressProcessorInternal<
|
|
|
161
166
|
return this.onInterval(
|
|
162
167
|
handler,
|
|
163
168
|
undefined,
|
|
164
|
-
|
|
169
|
+
create(HandleIntervalSchema, {
|
|
170
|
+
recentInterval: checkpointInterval,
|
|
171
|
+
backfillInterval: backfillCheckpointInterval
|
|
172
|
+
}),
|
|
165
173
|
type,
|
|
166
174
|
fetchConfig
|
|
167
175
|
)
|
|
@@ -190,7 +198,7 @@ export class SuiAddressProcessor extends SuiBaseObjectOrAddressProcessorInternal
|
|
|
190
198
|
filter?: TransactionFilter,
|
|
191
199
|
fetchConfig?: Partial<MoveFetchConfig>
|
|
192
200
|
) {
|
|
193
|
-
const _fetchConfig =
|
|
201
|
+
const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...fetchConfig })
|
|
194
202
|
const _filter: TransactionFilter = {
|
|
195
203
|
fromAndToAddress: {
|
|
196
204
|
from: '',
|
|
@@ -205,7 +213,7 @@ export class SuiAddressProcessor extends SuiBaseObjectOrAddressProcessorInternal
|
|
|
205
213
|
handlerName: getHandlerName(),
|
|
206
214
|
handler: async function (data) {
|
|
207
215
|
if (!data.rawTransaction) {
|
|
208
|
-
throw new
|
|
216
|
+
throw new ConnectError('transaction is null', Code.InvalidArgument)
|
|
209
217
|
}
|
|
210
218
|
const tx = JSON.parse(data.rawTransaction) as GrpcTypes.ExecutedTransaction
|
|
211
219
|
|
|
@@ -213,7 +221,7 @@ export class SuiAddressProcessor extends SuiBaseObjectOrAddressProcessorInternal
|
|
|
213
221
|
'object',
|
|
214
222
|
processor.config.network,
|
|
215
223
|
processor.config.address,
|
|
216
|
-
data.timestamp
|
|
224
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
217
225
|
data.slot,
|
|
218
226
|
tx,
|
|
219
227
|
0,
|
|
@@ -305,7 +313,7 @@ export class SuiObjectTypeProcessor<T> extends SuiBaseObjectOrAddressProcessor<
|
|
|
305
313
|
|
|
306
314
|
public onObjectChange(handler: (changes: SuiObjectChange[], ctx: SuiObjectChangeContext) => PromiseOrVoid): this {
|
|
307
315
|
if (this.config.network === SuiNetwork.TEST_NET) {
|
|
308
|
-
throw new
|
|
316
|
+
throw new ConnectError('object change not supported in testnet', Code.InvalidArgument)
|
|
309
317
|
}
|
|
310
318
|
const processor = this
|
|
311
319
|
this.objectChangeHandlers.push({
|
|
@@ -314,7 +322,7 @@ export class SuiObjectTypeProcessor<T> extends SuiBaseObjectOrAddressProcessor<
|
|
|
314
322
|
const ctx = new SuiObjectChangeContext(
|
|
315
323
|
processor.config.network,
|
|
316
324
|
processor.config.address,
|
|
317
|
-
data.timestamp
|
|
325
|
+
data.timestamp ? timestampDate(data.timestamp) : new Date(0),
|
|
318
326
|
data.slot,
|
|
319
327
|
data.txDigest,
|
|
320
328
|
processor.config.baseLabels
|
|
@@ -340,10 +348,10 @@ export class SuiObjectTypeProcessor<T> extends SuiBaseObjectOrAddressProcessor<
|
|
|
340
348
|
): this {
|
|
341
349
|
return this.onInterval(
|
|
342
350
|
handler,
|
|
343
|
-
{
|
|
351
|
+
create(HandleIntervalSchema, {
|
|
344
352
|
recentInterval: timeIntervalInMinutes,
|
|
345
353
|
backfillInterval: backfillTimeIntervalInMinutes
|
|
346
|
-
},
|
|
354
|
+
}),
|
|
347
355
|
undefined,
|
|
348
356
|
this.objectType.getSignature(),
|
|
349
357
|
fetchConfig
|
|
@@ -363,7 +371,10 @@ export class SuiObjectTypeProcessor<T> extends SuiBaseObjectOrAddressProcessor<
|
|
|
363
371
|
return this.onInterval(
|
|
364
372
|
handler,
|
|
365
373
|
undefined,
|
|
366
|
-
|
|
374
|
+
create(HandleIntervalSchema, {
|
|
375
|
+
recentInterval: checkpointInterval,
|
|
376
|
+
backfillInterval: backfillCheckpointInterval
|
|
377
|
+
}),
|
|
367
378
|
this.objectType.qname,
|
|
368
379
|
fetchConfig
|
|
369
380
|
)
|