@sentio/sdk 2.59.5-rc.1 → 2.60.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 +5 -11
- package/lib/aptos/aptos-plugin.d.ts.map +1 -1
- package/lib/aptos/aptos-plugin.js +38 -23
- package/lib/aptos/aptos-plugin.js.map +1 -1
- package/lib/aptos/aptos-processor.d.ts +1 -0
- package/lib/aptos/aptos-processor.d.ts.map +1 -1
- package/lib/aptos/aptos-processor.js +11 -3
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/btc/btc-plugin.d.ts +5 -8
- package/lib/btc/btc-plugin.d.ts.map +1 -1
- package/lib/btc/btc-plugin.js +22 -14
- package/lib/btc/btc-plugin.js.map +1 -1
- package/lib/core/core-plugin.d.ts +2 -1
- package/lib/core/core-plugin.d.ts.map +1 -1
- package/lib/core/core-plugin.js +9 -0
- package/lib/core/core-plugin.js.map +1 -1
- package/lib/core/handler-options.d.ts +6 -0
- package/lib/core/handler-options.d.ts.map +1 -1
- package/lib/core/handler-options.js.map +1 -1
- package/lib/core/handler-register.d.ts +18 -0
- package/lib/core/handler-register.d.ts.map +1 -0
- package/lib/core/handler-register.js +62 -0
- package/lib/core/handler-register.js.map +1 -0
- package/lib/cosmos/cosmos-plugin.d.ts +5 -7
- package/lib/cosmos/cosmos-plugin.d.ts.map +1 -1
- package/lib/cosmos/cosmos-plugin.js +18 -10
- package/lib/cosmos/cosmos-plugin.js.map +1 -1
- package/lib/eth/eth-plugin.d.ts +5 -40
- package/lib/eth/eth-plugin.d.ts.map +1 -1
- package/lib/eth/eth-plugin.js +41 -117
- package/lib/eth/eth-plugin.js.map +1 -1
- package/lib/fuel/fuel-plugin.d.ts +5 -9
- package/lib/fuel/fuel-plugin.d.ts.map +1 -1
- package/lib/fuel/fuel-plugin.js +26 -18
- package/lib/fuel/fuel-plugin.js.map +1 -1
- package/lib/solana/solana-plugin.d.ts +3 -2
- package/lib/solana/solana-plugin.d.ts.map +1 -1
- package/lib/solana/solana-plugin.js +11 -1
- package/lib/solana/solana-plugin.js.map +1 -1
- package/lib/stark/starknet-plugin.d.ts +5 -7
- package/lib/stark/starknet-plugin.d.ts.map +1 -1
- package/lib/stark/starknet-plugin.js +18 -10
- package/lib/stark/starknet-plugin.js.map +1 -1
- package/lib/sui/sui-plugin.d.ts +5 -10
- package/lib/sui/sui-plugin.d.ts.map +1 -1
- package/lib/sui/sui-plugin.js +37 -24
- package/lib/sui/sui-plugin.js.map +1 -1
- package/package.json +3 -3
- package/src/aptos/aptos-plugin.ts +55 -44
- package/src/aptos/aptos-processor.ts +15 -3
- package/src/btc/btc-plugin.ts +33 -32
- package/src/core/core-plugin.ts +11 -2
- package/src/core/handler-options.ts +7 -0
- package/src/core/handler-register.ts +79 -0
- package/src/cosmos/cosmos-plugin.ts +24 -20
- package/src/eth/eth-plugin.ts +62 -182
- package/src/fuel/fuel-plugin.ts +43 -44
- package/src/solana/solana-plugin.ts +20 -2
- package/src/stark/starknet-plugin.ts +24 -20
- package/src/sui/sui-plugin.ts +58 -52
package/src/fuel/fuel-plugin.ts
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
import { errorString, GLOBAL_CONFIG, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime'
|
2
2
|
import { PartitionHandlerManager } from '../core/index.js'
|
3
|
+
import { HandlerRegister } from '../core/handler-register.js'
|
3
4
|
import {
|
4
5
|
ContractConfig,
|
5
|
-
Data_FuelBlock,
|
6
|
-
Data_FuelReceipt,
|
7
|
-
Data_FuelTransaction,
|
8
6
|
DataBinding,
|
9
7
|
HandlerType,
|
8
|
+
InitResponse,
|
10
9
|
ProcessConfigResponse,
|
11
10
|
ProcessResult,
|
12
11
|
ProcessStreamResponse_Partitions,
|
@@ -20,30 +19,26 @@ import { FuelProcessorState } from './types.js'
|
|
20
19
|
import { FuelProcessor } from './fuel-processor.js'
|
21
20
|
import { FuelGlobalProcessor } from './global-processor.js'
|
22
21
|
|
23
|
-
interface Handlers {
|
24
|
-
transactionHandlers: ((trace: Data_FuelTransaction) => Promise<ProcessResult>)[]
|
25
|
-
blockHandlers: ((block: Data_FuelBlock) => Promise<ProcessResult>)[]
|
26
|
-
receiptHandlers: ((log: Data_FuelReceipt) => Promise<ProcessResult>)[]
|
27
|
-
}
|
28
|
-
|
29
22
|
export class FuelPlugin extends Plugin {
|
30
23
|
name: string = 'FuelPlugin'
|
31
|
-
|
32
|
-
transactionHandlers: [],
|
33
|
-
blockHandlers: [],
|
34
|
-
receiptHandlers: []
|
35
|
-
}
|
36
|
-
|
24
|
+
handlerRegister = new HandlerRegister()
|
37
25
|
partitionManager = new PartitionHandlerManager()
|
38
26
|
|
39
|
-
async
|
40
|
-
const
|
41
|
-
|
42
|
-
|
43
|
-
receiptHandlers: []
|
27
|
+
async init(config: InitResponse) {
|
28
|
+
for (const fuelProcessor of FuelProcessorState.INSTANCE.getValues()) {
|
29
|
+
const chainId = fuelProcessor.config.chainId
|
30
|
+
config.chainIds.push(chainId)
|
44
31
|
}
|
32
|
+
}
|
33
|
+
|
34
|
+
async configure(config: ProcessConfigResponse, forChainId?: string) {
|
35
|
+
this.handlerRegister.clear(forChainId as any)
|
45
36
|
|
46
37
|
for (const processor of FuelProcessorState.INSTANCE.getValues()) {
|
38
|
+
const chainId = processor.config.chainId
|
39
|
+
if (forChainId !== undefined && forChainId !== chainId.toString()) {
|
40
|
+
continue
|
41
|
+
}
|
47
42
|
const processorConfig = processor.config
|
48
43
|
const contractConfig = ContractConfig.fromPartial({
|
49
44
|
processorType: USER_PROCESSOR,
|
@@ -57,7 +52,7 @@ export class FuelPlugin extends Plugin {
|
|
57
52
|
endBlock: processorConfig.endBlock
|
58
53
|
})
|
59
54
|
for (const txHandler of processor.txHandlers) {
|
60
|
-
const handlerId =
|
55
|
+
const handlerId = this.handlerRegister.register(txHandler.handler, chainId)
|
61
56
|
this.partitionManager.registerPartitionHandler(
|
62
57
|
HandlerType.FUEL_TRANSACTION,
|
63
58
|
handlerId,
|
@@ -90,7 +85,7 @@ export class FuelPlugin extends Plugin {
|
|
90
85
|
}
|
91
86
|
|
92
87
|
for (const receiptHandler of processor.receiptHandlers ?? []) {
|
93
|
-
const handlerId =
|
88
|
+
const handlerId = this.handlerRegister.register(receiptHandler.handler, chainId)
|
94
89
|
this.partitionManager.registerPartitionHandler(
|
95
90
|
HandlerType.FUEL_RECEIPT,
|
96
91
|
handlerId,
|
@@ -107,7 +102,7 @@ export class FuelPlugin extends Plugin {
|
|
107
102
|
}
|
108
103
|
|
109
104
|
for (const blockHandler of processor.blockHandlers) {
|
110
|
-
const handlerId =
|
105
|
+
const handlerId = this.handlerRegister.register(blockHandler.handler, chainId)
|
111
106
|
this.partitionManager.registerPartitionHandler(HandlerType.FUEL_BLOCK, handlerId, blockHandler.partitionHandler)
|
112
107
|
contractConfig.intervalConfigs.push({
|
113
108
|
slot: 0,
|
@@ -123,8 +118,6 @@ export class FuelPlugin extends Plugin {
|
|
123
118
|
|
124
119
|
config.contractConfigs.push(contractConfig)
|
125
120
|
}
|
126
|
-
|
127
|
-
this.handlers = handlers
|
128
121
|
}
|
129
122
|
|
130
123
|
supportedHandlers = [
|
@@ -212,12 +205,14 @@ export class FuelPlugin extends Plugin {
|
|
212
205
|
const promises: Promise<ProcessResult>[] = []
|
213
206
|
|
214
207
|
for (const handlerId of binding.handlerIds) {
|
215
|
-
const promise = this.
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
208
|
+
const promise = this.handlerRegister
|
209
|
+
.getHandlerById(handlerId)(receipt)
|
210
|
+
.catch((e: any) => {
|
211
|
+
throw new ServerError(
|
212
|
+
Status.INTERNAL,
|
213
|
+
'error processing transaction: ' + JSON.stringify(receipt) + '\n' + errorString(e)
|
214
|
+
)
|
215
|
+
})
|
221
216
|
if (GLOBAL_CONFIG.execution.sequential) {
|
222
217
|
await promise
|
223
218
|
}
|
@@ -235,12 +230,14 @@ export class FuelPlugin extends Plugin {
|
|
235
230
|
const promises: Promise<ProcessResult>[] = []
|
236
231
|
|
237
232
|
for (const handlerId of binding.handlerIds) {
|
238
|
-
const promise = this.
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
233
|
+
const promise = this.handlerRegister
|
234
|
+
.getHandlerById(handlerId)(fuelTransaction)
|
235
|
+
.catch((e: any) => {
|
236
|
+
throw new ServerError(
|
237
|
+
Status.INTERNAL,
|
238
|
+
'error processing transaction: ' + JSON.stringify(fuelTransaction.transaction) + '\n' + errorString(e)
|
239
|
+
)
|
240
|
+
})
|
244
241
|
if (GLOBAL_CONFIG.execution.sequential) {
|
245
242
|
await promise
|
246
243
|
}
|
@@ -257,13 +254,15 @@ export class FuelPlugin extends Plugin {
|
|
257
254
|
|
258
255
|
const promises: Promise<ProcessResult>[] = []
|
259
256
|
for (const handlerId of binding.handlerIds) {
|
260
|
-
const promise = this.
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
257
|
+
const promise = this.handlerRegister
|
258
|
+
.getHandlerById(handlerId)(ethBlock)
|
259
|
+
.catch((e: any) => {
|
260
|
+
console.error('error processing block: ', e)
|
261
|
+
throw new ServerError(
|
262
|
+
Status.INTERNAL,
|
263
|
+
'error processing block: ' + ethBlock.block?.height + '\n' + errorString(e)
|
264
|
+
)
|
265
|
+
})
|
267
266
|
if (GLOBAL_CONFIG.execution.sequential) {
|
268
267
|
await promise
|
269
268
|
}
|
@@ -1,5 +1,12 @@
|
|
1
1
|
import { errorString, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime'
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
ContractConfig,
|
4
|
+
DataBinding,
|
5
|
+
HandlerType,
|
6
|
+
InitResponse,
|
7
|
+
ProcessConfigResponse,
|
8
|
+
ProcessResult
|
9
|
+
} from '@sentio/protos'
|
3
10
|
|
4
11
|
import { ServerError, Status } from 'nice-grpc'
|
5
12
|
|
@@ -9,9 +16,20 @@ import { Instruction as SolInstruction } from '@coral-xyz/anchor'
|
|
9
16
|
export class SolanaPlugin extends Plugin {
|
10
17
|
name: string = 'SolanaPlugin'
|
11
18
|
|
12
|
-
async
|
19
|
+
async init(config: InitResponse) {
|
20
|
+
for (const solanaProcessor of SolanaProcessorState.INSTANCE.getValues()) {
|
21
|
+
const chainId = solanaProcessor.network
|
22
|
+
config.chainIds.push(chainId)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
async configure(config: ProcessConfigResponse, forChainId?: string) {
|
13
27
|
// Part 2, prepare solana constractors
|
14
28
|
for (const solanaProcessor of SolanaProcessorState.INSTANCE.getValues()) {
|
29
|
+
const chainId = solanaProcessor.network
|
30
|
+
if (forChainId !== undefined && forChainId !== chainId.toString()) {
|
31
|
+
continue
|
32
|
+
}
|
15
33
|
const contractConfig = ContractConfig.fromPartial({
|
16
34
|
processorType: USER_PROCESSOR,
|
17
35
|
contract: {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { errorString, GLOBAL_CONFIG, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime'
|
2
2
|
import {
|
3
3
|
ContractConfig,
|
4
|
-
Data_StarknetEvent,
|
5
4
|
DataBinding,
|
6
5
|
HandlerType,
|
6
|
+
InitResponse,
|
7
7
|
ProcessConfigResponse,
|
8
8
|
ProcessResult,
|
9
9
|
StartRequest
|
@@ -11,25 +11,29 @@ import {
|
|
11
11
|
|
12
12
|
import { ServerError, Status } from 'nice-grpc'
|
13
13
|
import { TemplateInstanceState } from '../core/template.js'
|
14
|
+
import { HandlerRegister } from '../core/handler-register.js'
|
14
15
|
import { StarknetProcessorState } from './starknet-processor.js'
|
15
16
|
import { hash } from 'starknet'
|
16
17
|
|
17
|
-
interface Handlers {
|
18
|
-
callHandlers: ((trace: Data_StarknetEvent) => Promise<ProcessResult>)[]
|
19
|
-
}
|
20
|
-
|
21
18
|
export class StarknetPlugin extends Plugin {
|
22
19
|
name: string = 'StarknetPlugin'
|
23
|
-
|
24
|
-
callHandlers: []
|
25
|
-
}
|
20
|
+
handlerRegister = new HandlerRegister()
|
26
21
|
|
27
|
-
async
|
28
|
-
const
|
29
|
-
|
22
|
+
async init(config: InitResponse) {
|
23
|
+
for (const solanaProcessor of StarknetProcessorState.INSTANCE.getValues()) {
|
24
|
+
const chainId = solanaProcessor.config.chainId
|
25
|
+
config.chainIds.push(chainId)
|
30
26
|
}
|
27
|
+
}
|
28
|
+
|
29
|
+
async configure(config: ProcessConfigResponse, forChainId?: string) {
|
30
|
+
this.handlerRegister.clear(forChainId as any)
|
31
31
|
|
32
32
|
for (const processor of StarknetProcessorState.INSTANCE.getValues()) {
|
33
|
+
const chainId = processor.config.chainId
|
34
|
+
if (forChainId !== undefined && forChainId !== chainId.toString()) {
|
35
|
+
continue
|
36
|
+
}
|
33
37
|
await processor.configure()
|
34
38
|
const contractConfig = ContractConfig.fromPartial({
|
35
39
|
processorType: USER_PROCESSOR,
|
@@ -43,7 +47,7 @@ export class StarknetPlugin extends Plugin {
|
|
43
47
|
endBlock: processor.config.endBlock
|
44
48
|
})
|
45
49
|
for (const callHandler of processor.callHandlers) {
|
46
|
-
const handlerId =
|
50
|
+
const handlerId = this.handlerRegister.register(callHandler.handler, chainId)
|
47
51
|
|
48
52
|
if (callHandler.eventFilter) {
|
49
53
|
contractConfig.starknetEventConfigs.push({
|
@@ -60,8 +64,6 @@ export class StarknetPlugin extends Plugin {
|
|
60
64
|
// Finish up a contract
|
61
65
|
config.contractConfigs.push(contractConfig)
|
62
66
|
}
|
63
|
-
|
64
|
-
this.handlers = handlers
|
65
67
|
}
|
66
68
|
|
67
69
|
supportedHandlers = [HandlerType.STARKNET_EVENT]
|
@@ -91,12 +93,14 @@ export class StarknetPlugin extends Plugin {
|
|
91
93
|
const result = binding.data?.starknetEvents?.result
|
92
94
|
|
93
95
|
for (const handlerId of binding.handlerIds) {
|
94
|
-
const promise = this.
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
const promise = this.handlerRegister
|
97
|
+
.getHandlerById(handlerId)(binding.data?.starknetEvents)
|
98
|
+
.catch((e: any) => {
|
99
|
+
throw new ServerError(
|
100
|
+
Status.INTERNAL,
|
101
|
+
'error processing transaction: ' + JSON.stringify(result) + '\n' + errorString(e)
|
102
|
+
)
|
103
|
+
})
|
100
104
|
if (GLOBAL_CONFIG.execution.sequential) {
|
101
105
|
await promise
|
102
106
|
}
|
package/src/sui/sui-plugin.ts
CHANGED
@@ -2,12 +2,9 @@ import { errorString, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR
|
|
2
2
|
import {
|
3
3
|
AccountConfig,
|
4
4
|
ContractConfig,
|
5
|
-
Data_SuiCall,
|
6
|
-
Data_SuiEvent,
|
7
|
-
Data_SuiObject,
|
8
|
-
Data_SuiObjectChange,
|
9
5
|
DataBinding,
|
10
6
|
HandlerType,
|
7
|
+
InitResponse,
|
11
8
|
MoveCallHandlerConfig,
|
12
9
|
MoveEventHandlerConfig,
|
13
10
|
MoveResourceChangeConfig,
|
@@ -19,6 +16,7 @@ import {
|
|
19
16
|
|
20
17
|
import { ServerError, Status } from 'nice-grpc'
|
21
18
|
import { PartitionHandlerManager } from '../core/index.js'
|
19
|
+
import { HandlerRegister } from '../core/handler-register.js'
|
22
20
|
|
23
21
|
import { SuiProcessorState } from './sui-processor.js'
|
24
22
|
import { SuiAccountProcessorState, SuiAddressProcessor } from './sui-object-processor.js'
|
@@ -31,22 +29,9 @@ import {
|
|
31
29
|
import { SuiNetwork } from './network.js'
|
32
30
|
import { SuiContext } from './context.js'
|
33
31
|
|
34
|
-
interface Handlers {
|
35
|
-
suiEventHandlers: ((event: Data_SuiEvent) => Promise<ProcessResult>)[]
|
36
|
-
suiCallHandlers: ((func: Data_SuiCall) => Promise<ProcessResult>)[]
|
37
|
-
suiObjectHandlers: ((object: Data_SuiObject) => Promise<ProcessResult>)[]
|
38
|
-
suiObjectChangeHandlers: ((object: Data_SuiObjectChange) => Promise<ProcessResult>)[]
|
39
|
-
}
|
40
|
-
|
41
32
|
export class SuiPlugin extends Plugin {
|
42
33
|
name: string = 'SuiPlugin'
|
43
|
-
|
44
|
-
suiCallHandlers: [],
|
45
|
-
suiEventHandlers: [],
|
46
|
-
suiObjectHandlers: [],
|
47
|
-
suiObjectChangeHandlers: []
|
48
|
-
}
|
49
|
-
|
34
|
+
handlerRegister = new HandlerRegister()
|
50
35
|
partitionManager = new PartitionHandlerManager()
|
51
36
|
async start(request: StartRequest): Promise<void> {
|
52
37
|
await initCoinList()
|
@@ -76,14 +61,21 @@ export class SuiPlugin extends Plugin {
|
|
76
61
|
}
|
77
62
|
}
|
78
63
|
|
79
|
-
async
|
80
|
-
const
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
suiObjectChangeHandlers: []
|
64
|
+
async init(config: InitResponse) {
|
65
|
+
for (const state of [SuiProcessorState.INSTANCE, SuiAccountProcessorState.INSTANCE]) {
|
66
|
+
for (const suiProcessor of state.getValues()) {
|
67
|
+
config.chainIds.push(suiProcessor.config.network)
|
68
|
+
}
|
85
69
|
}
|
70
|
+
}
|
71
|
+
|
72
|
+
async configure(config: ProcessConfigResponse, forChainId?: string) {
|
73
|
+
this.handlerRegister.clear(forChainId as any)
|
86
74
|
for (const suiProcessor of SuiProcessorState.INSTANCE.getValues()) {
|
75
|
+
const chainId = suiProcessor.config.network
|
76
|
+
if (forChainId !== undefined && forChainId !== chainId.toString()) {
|
77
|
+
continue
|
78
|
+
}
|
87
79
|
const contractConfig = ContractConfig.fromPartial({
|
88
80
|
transactionConfig: [],
|
89
81
|
processorType: USER_PROCESSOR,
|
@@ -97,7 +89,7 @@ export class SuiPlugin extends Plugin {
|
|
97
89
|
endBlock: suiProcessor.config.endCheckpoint
|
98
90
|
})
|
99
91
|
for (const handler of suiProcessor.eventHandlers) {
|
100
|
-
const handlerId =
|
92
|
+
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
101
93
|
this.partitionManager.registerPartitionHandler(HandlerType.SUI_EVENT, handlerId, handler.partitionHandler)
|
102
94
|
const eventHandlerConfig: MoveEventHandlerConfig = {
|
103
95
|
filters: handler.filters.map((f) => {
|
@@ -114,7 +106,7 @@ export class SuiPlugin extends Plugin {
|
|
114
106
|
contractConfig.moveEventConfigs.push(eventHandlerConfig)
|
115
107
|
}
|
116
108
|
for (const handler of suiProcessor.callHandlers) {
|
117
|
-
const handlerId =
|
109
|
+
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
118
110
|
this.partitionManager.registerPartitionHandler(HandlerType.SUI_CALL, handlerId, handler.partitionHandler)
|
119
111
|
const functionHandlerConfig: MoveCallHandlerConfig = {
|
120
112
|
filters: handler.filters.map((filter) => {
|
@@ -135,7 +127,7 @@ export class SuiPlugin extends Plugin {
|
|
135
127
|
}
|
136
128
|
// deprecated, use objectType processor instead
|
137
129
|
for (const handler of suiProcessor.objectChangeHandlers) {
|
138
|
-
const handlerId =
|
130
|
+
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
139
131
|
const objectChangeHandler: MoveResourceChangeConfig = {
|
140
132
|
type: handler.type,
|
141
133
|
handlerId,
|
@@ -148,6 +140,10 @@ export class SuiPlugin extends Plugin {
|
|
148
140
|
}
|
149
141
|
|
150
142
|
for (const processor of SuiAccountProcessorState.INSTANCE.getValues()) {
|
143
|
+
const chainId = processor.getChainId()
|
144
|
+
if (forChainId !== undefined && forChainId !== chainId.toString()) {
|
145
|
+
continue
|
146
|
+
}
|
151
147
|
const accountConfig = AccountConfig.fromPartial({
|
152
148
|
address: processor.config.address,
|
153
149
|
chainId: processor.getChainId(),
|
@@ -156,7 +152,7 @@ export class SuiPlugin extends Plugin {
|
|
156
152
|
})
|
157
153
|
|
158
154
|
for (const handler of processor.objectChangeHandlers) {
|
159
|
-
const handlerId =
|
155
|
+
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
160
156
|
const objectChangeHandler: MoveResourceChangeConfig = {
|
161
157
|
type: handler.type,
|
162
158
|
handlerId,
|
@@ -167,7 +163,7 @@ export class SuiPlugin extends Plugin {
|
|
167
163
|
}
|
168
164
|
|
169
165
|
for (const handler of processor.objectHandlers) {
|
170
|
-
const handlerId =
|
166
|
+
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
171
167
|
|
172
168
|
accountConfig.moveIntervalConfigs.push({
|
173
169
|
intervalConfig: {
|
@@ -188,7 +184,7 @@ export class SuiPlugin extends Plugin {
|
|
188
184
|
|
189
185
|
if (processor instanceof SuiAddressProcessor) {
|
190
186
|
for (const handler of processor.callHandlers) {
|
191
|
-
const handlerId =
|
187
|
+
const handlerId = this.handlerRegister.register(handler.handler, chainId)
|
192
188
|
const functionHandlerConfig: MoveCallHandlerConfig = {
|
193
189
|
filters: handler.filters.map((filter) => {
|
194
190
|
return {
|
@@ -210,7 +206,6 @@ export class SuiPlugin extends Plugin {
|
|
210
206
|
|
211
207
|
config.accountConfigs.push(accountConfig)
|
212
208
|
}
|
213
|
-
this.handlers = handlers
|
214
209
|
}
|
215
210
|
|
216
211
|
supportedHandlers = [
|
@@ -284,12 +279,14 @@ export class SuiPlugin extends Plugin {
|
|
284
279
|
|
285
280
|
for (const handlerId of binding.handlerIds) {
|
286
281
|
promises.push(
|
287
|
-
this.
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
282
|
+
this.handlerRegister
|
283
|
+
.getHandlerById(handlerId)(event)
|
284
|
+
.catch((e: any) => {
|
285
|
+
throw new ServerError(
|
286
|
+
Status.INTERNAL,
|
287
|
+
'error processing event: ' + JSON.stringify(event) + '\n' + errorString(e)
|
288
|
+
)
|
289
|
+
})
|
293
290
|
)
|
294
291
|
}
|
295
292
|
return mergeProcessResults(await Promise.all(promises))
|
@@ -303,9 +300,14 @@ export class SuiPlugin extends Plugin {
|
|
303
300
|
|
304
301
|
const promises: Promise<ProcessResult>[] = []
|
305
302
|
for (const handlerId of binding.handlerIds) {
|
306
|
-
const promise = this.
|
307
|
-
|
308
|
-
|
303
|
+
const promise = this.handlerRegister
|
304
|
+
.getHandlerById(handlerId)(call)
|
305
|
+
.catch((e: any) => {
|
306
|
+
throw new ServerError(
|
307
|
+
Status.INTERNAL,
|
308
|
+
'error processing call: ' + JSON.stringify(call) + '\n' + errorString(e)
|
309
|
+
)
|
310
|
+
})
|
309
311
|
promises.push(promise)
|
310
312
|
}
|
311
313
|
return mergeProcessResults(await Promise.all(promises))
|
@@ -320,12 +322,14 @@ export class SuiPlugin extends Plugin {
|
|
320
322
|
const promises: Promise<ProcessResult>[] = []
|
321
323
|
for (const handlerId of binding.handlerIds) {
|
322
324
|
promises.push(
|
323
|
-
this.
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
325
|
+
this.handlerRegister
|
326
|
+
.getHandlerById(handlerId)(object)
|
327
|
+
.catch((e: any) => {
|
328
|
+
throw new ServerError(
|
329
|
+
Status.INTERNAL,
|
330
|
+
'error processing object: ' + JSON.stringify(object) + '\n' + errorString(e)
|
331
|
+
)
|
332
|
+
})
|
329
333
|
)
|
330
334
|
}
|
331
335
|
return mergeProcessResults(await Promise.all(promises))
|
@@ -340,12 +344,14 @@ export class SuiPlugin extends Plugin {
|
|
340
344
|
const promises: Promise<ProcessResult>[] = []
|
341
345
|
for (const handlerId of binding.handlerIds) {
|
342
346
|
promises.push(
|
343
|
-
this.
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
347
|
+
this.handlerRegister
|
348
|
+
.getHandlerById(handlerId)(objectChange)
|
349
|
+
.catch((e: any) => {
|
350
|
+
throw new ServerError(
|
351
|
+
Status.INTERNAL,
|
352
|
+
'error processing object change: ' + JSON.stringify(objectChange) + '\n' + errorString(e)
|
353
|
+
)
|
354
|
+
})
|
349
355
|
)
|
350
356
|
}
|
351
357
|
return mergeProcessResults(await Promise.all(promises))
|