@sentio/sdk 2.54.0-rc.5 → 2.54.0-rc.6
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.map +1 -1
- package/lib/aptos/aptos-plugin.js +6 -2
- package/lib/aptos/aptos-plugin.js.map +1 -1
- package/lib/aptos/aptos-processor.d.ts.map +1 -1
- package/lib/aptos/aptos-processor.js +7 -0
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/btc/btc-plugin.d.ts.map +1 -1
- package/lib/btc/btc-plugin.js +5 -2
- package/lib/btc/btc-plugin.js.map +1 -1
- package/lib/btc/btc-processor.d.ts +1 -0
- package/lib/btc/btc-processor.d.ts.map +1 -1
- package/lib/btc/btc-processor.js +1 -0
- package/lib/btc/btc-processor.js.map +1 -1
- package/lib/cosmos/cosmos-plugin.d.ts.map +1 -1
- package/lib/cosmos/cosmos-plugin.js +1 -0
- package/lib/cosmos/cosmos-plugin.js.map +1 -1
- package/lib/cosmos/cosmos-processor.d.ts.map +1 -1
- package/lib/cosmos/cosmos-processor.js +3 -0
- package/lib/cosmos/cosmos-processor.js.map +1 -1
- package/lib/cosmos/types.d.ts +1 -0
- package/lib/cosmos/types.d.ts.map +1 -1
- package/lib/fuel/asset-processor.d.ts.map +1 -1
- package/lib/fuel/asset-processor.js +3 -0
- package/lib/fuel/asset-processor.js.map +1 -1
- package/lib/fuel/base-processor.d.ts.map +1 -1
- package/lib/fuel/base-processor.js +2 -0
- package/lib/fuel/base-processor.js.map +1 -1
- package/lib/fuel/fuel-plugin.d.ts.map +1 -1
- package/lib/fuel/fuel-plugin.js +7 -2
- package/lib/fuel/fuel-plugin.js.map +1 -1
- package/lib/fuel/fuel-processor.d.ts.map +1 -1
- package/lib/fuel/fuel-processor.js +3 -0
- 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 +3 -0
- package/lib/fuel/global-processor.js.map +1 -1
- package/lib/fuel/types.d.ts +1 -0
- package/lib/fuel/types.d.ts.map +1 -1
- package/lib/move/filter.d.ts +4 -0
- package/lib/move/filter.d.ts.map +1 -1
- package/lib/move/filter.js +4 -0
- package/lib/move/filter.js.map +1 -1
- package/lib/stark/starknet-plugin.d.ts.map +1 -1
- package/lib/stark/starknet-plugin.js +2 -1
- package/lib/stark/starknet-plugin.js.map +1 -1
- package/lib/stark/starknet-processor.d.ts +1 -0
- package/lib/stark/starknet-processor.d.ts.map +1 -1
- package/lib/stark/starknet-processor.js +4 -0
- package/lib/stark/starknet-processor.js.map +1 -1
- package/lib/sui/sui-object-processor.d.ts.map +1 -1
- package/lib/sui/sui-object-processor.js +2 -0
- package/lib/sui/sui-object-processor.js.map +1 -1
- package/lib/sui/sui-plugin.d.ts.map +1 -1
- package/lib/sui/sui-plugin.js +10 -5
- package/lib/sui/sui-plugin.js.map +1 -1
- package/lib/sui/sui-processor.d.ts.map +1 -1
- package/lib/sui/sui-processor.js +6 -0
- package/lib/sui/sui-processor.js.map +1 -1
- package/package.json +3 -3
- package/src/aptos/aptos-plugin.ts +6 -2
- package/src/aptos/aptos-processor.ts +8 -0
- package/src/btc/btc-plugin.ts +5 -2
- package/src/btc/btc-processor.ts +2 -0
- package/src/cosmos/cosmos-plugin.ts +1 -0
- package/src/cosmos/cosmos-processor.ts +5 -1
- package/src/cosmos/types.ts +1 -0
- package/src/fuel/asset-processor.ts +5 -1
- package/src/fuel/base-processor.ts +2 -0
- package/src/fuel/fuel-plugin.ts +7 -2
- package/src/fuel/fuel-processor.ts +3 -0
- package/src/fuel/global-processor.ts +5 -1
- package/src/fuel/types.ts +1 -0
- package/src/move/filter.ts +4 -0
- package/src/stark/starknet-plugin.ts +2 -1
- package/src/stark/starknet-processor.ts +7 -1
- package/src/sui/sui-object-processor.ts +2 -0
- package/src/sui/sui-plugin.ts +10 -5
- package/src/sui/sui-processor.ts +7 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentio/sdk",
|
3
|
-
"version": "2.54.0-rc.
|
3
|
+
"version": "2.54.0-rc.6",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -85,8 +85,8 @@
|
|
85
85
|
"typechain": "^8.3.2",
|
86
86
|
"utility-types": "^3.11.0",
|
87
87
|
"yaml": "^2.3.4",
|
88
|
-
"@sentio/protos": "2.54.0-rc.
|
89
|
-
"@sentio/runtime": "^2.54.0-rc.
|
88
|
+
"@sentio/protos": "2.54.0-rc.6",
|
89
|
+
"@sentio/runtime": "^2.54.0-rc.6"
|
90
90
|
},
|
91
91
|
"peerDependencies": {
|
92
92
|
"tsup": "npm:@sentio/tsup@^8.3.5-rc.1"
|
@@ -96,7 +96,8 @@ export class AptosPlugin extends Plugin {
|
|
96
96
|
}
|
97
97
|
}),
|
98
98
|
fetchConfig: handler.fetchConfig,
|
99
|
-
handlerId
|
99
|
+
handlerId,
|
100
|
+
handlerName: handler.handlerName
|
100
101
|
}
|
101
102
|
contractConfig.moveEventConfigs.push(eventHandlerConfig)
|
102
103
|
}
|
@@ -115,7 +116,8 @@ export class AptosPlugin extends Plugin {
|
|
115
116
|
}
|
116
117
|
}),
|
117
118
|
fetchConfig: handler.fetchConfig,
|
118
|
-
handlerId
|
119
|
+
handlerId,
|
120
|
+
handlerName: handler.handlerName
|
119
121
|
}
|
120
122
|
contractConfig.moveCallConfigs.push(functionHandlerConfig)
|
121
123
|
}
|
@@ -134,6 +136,7 @@ export class AptosPlugin extends Plugin {
|
|
134
136
|
const handlerId = handlers.aptosResourceHandlers.push(handler.handler) - 1
|
135
137
|
accountConfig.moveResourceChangeConfigs.push({
|
136
138
|
handlerId: handlerId,
|
139
|
+
handlerName: handler.handlerName,
|
137
140
|
type: handler.type
|
138
141
|
})
|
139
142
|
}
|
@@ -189,6 +192,7 @@ export class AptosPlugin extends Plugin {
|
|
189
192
|
// on resource change
|
190
193
|
accountConfig.moveResourceChangeConfigs.push({
|
191
194
|
handlerId,
|
195
|
+
handlerName: handler.handlerName,
|
192
196
|
type: handler.type
|
193
197
|
})
|
194
198
|
}
|
@@ -76,6 +76,8 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
76
76
|
AptosProcessorState.INSTANCE.addValue(this)
|
77
77
|
this.coder = defaultMoveCoder(this.config.network)
|
78
78
|
// this.loadTypes(this.coder)
|
79
|
+
|
80
|
+
return proxyProcessor(this)
|
79
81
|
}
|
80
82
|
|
81
83
|
protected onMoveEvent(
|
@@ -98,6 +100,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
98
100
|
const allEventType = new Set(_filters.map((f) => accountTypeString(processor.config.address) + '::' + f.type))
|
99
101
|
|
100
102
|
this.eventHandlers.push({
|
103
|
+
handlerName: getHandlerName(),
|
101
104
|
handler: async function (data) {
|
102
105
|
if (!data.transaction) {
|
103
106
|
throw new ServerError(Status.INVALID_ARGUMENT, 'event is null')
|
@@ -156,6 +159,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
156
159
|
const processor = this
|
157
160
|
|
158
161
|
this.callHandlers.push({
|
162
|
+
handlerName: getHandlerName(),
|
159
163
|
handler: async function (data) {
|
160
164
|
if (!data.transaction) {
|
161
165
|
throw new ServerError(Status.INVALID_ARGUMENT, 'call is null')
|
@@ -197,6 +201,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
197
201
|
|
198
202
|
const processor = this
|
199
203
|
this.callHandlers.push({
|
204
|
+
handlerName: getHandlerName(),
|
200
205
|
handler: async function (data) {
|
201
206
|
if (!data.transaction) {
|
202
207
|
throw new ServerError(Status.INVALID_ARGUMENT, 'call is null')
|
@@ -237,6 +242,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
|
|
237
242
|
|
238
243
|
const processor = this
|
239
244
|
this.resourceChangeHandlers.push({
|
245
|
+
handlerName: getHandlerName(),
|
240
246
|
handler: async function (data) {
|
241
247
|
if (!data.resources || !data.version) {
|
242
248
|
throw new ServerError(Status.INVALID_ARGUMENT, 'resource is null')
|
@@ -347,6 +353,7 @@ export class AptosModulesProcessor extends AptosTransactionProcessor<
|
|
347
353
|
> {
|
348
354
|
private constructor(options: AptosBindOptions) {
|
349
355
|
super(ALL_ADDRESS, options)
|
356
|
+
return proxyProcessor(this)
|
350
357
|
}
|
351
358
|
|
352
359
|
static bind(options: AptosBindOptions): AptosModulesProcessor {
|
@@ -358,6 +365,7 @@ export class AptosGlobalProcessor {
|
|
358
365
|
private baseProcessor
|
359
366
|
private constructor(options: AptosBindOptions) {
|
360
367
|
this.baseProcessor = new AptosTransactionProcessor('*', options)
|
368
|
+
return proxyProcessor(this)
|
361
369
|
}
|
362
370
|
|
363
371
|
static bind(options: AptosBindOptions): AptosGlobalProcessor {
|
package/src/btc/btc-plugin.ts
CHANGED
@@ -47,11 +47,13 @@ export class BTCPlugin extends Plugin {
|
|
47
47
|
})
|
48
48
|
for (const callHandler of processor.callHandlers) {
|
49
49
|
const handlerId = handlers.txHandlers.push(callHandler.handler) - 1
|
50
|
+
const handlerName = callHandler.handlerName
|
50
51
|
|
51
52
|
if (callHandler.filter) {
|
52
53
|
contractConfig.btcTransactionConfigs.push({
|
53
54
|
filters: filters2Proto(callHandler.filter),
|
54
|
-
handlerId
|
55
|
+
handlerId,
|
56
|
+
handlerName
|
55
57
|
})
|
56
58
|
} else if (contractConfig.contract?.address != '*') {
|
57
59
|
contractConfig.btcTransactionConfigs.push({
|
@@ -60,7 +62,8 @@ export class BTCPlugin extends Plugin {
|
|
60
62
|
script_address: processor.config.address
|
61
63
|
}
|
62
64
|
} as TransactionFilter),
|
63
|
-
handlerId
|
65
|
+
handlerId,
|
66
|
+
handlerName
|
64
67
|
})
|
65
68
|
}
|
66
69
|
}
|
package/src/btc/btc-processor.ts
CHANGED
@@ -29,6 +29,7 @@ export class BTCProcessor {
|
|
29
29
|
filter?: TransactionFilters
|
30
30
|
) {
|
31
31
|
const callHandler = {
|
32
|
+
handlerName: getHandlerName(),
|
32
33
|
handler: async (call: Data_BTCTransaction) => {
|
33
34
|
const tx = call.transaction as Transaction
|
34
35
|
|
@@ -133,6 +134,7 @@ interface BTCProcessorConfig {
|
|
133
134
|
}
|
134
135
|
|
135
136
|
export type CallHandler<T> = {
|
137
|
+
handlerName: string
|
136
138
|
handler: (call: T) => Promise<ProcessResult>
|
137
139
|
filter?: TransactionFilters
|
138
140
|
}
|
@@ -2,11 +2,14 @@ import { CallHandler, CosmosProcessorConfig, CosmosProcessorState } from './type
|
|
2
2
|
import { Data_CosmosCall } from '@sentio/protos'
|
3
3
|
import { CosmosContext } from './context.js'
|
4
4
|
import { CosmosEvent, CosmosTransaction, CosmosTxLog } from './transaction.js'
|
5
|
+
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
5
6
|
|
6
7
|
export class CosmosProcessor {
|
7
8
|
callHandlers: CallHandler<Data_CosmosCall>[] = []
|
8
9
|
|
9
|
-
constructor(readonly config: CosmosProcessorConfig) {
|
10
|
+
constructor(readonly config: CosmosProcessorConfig) {
|
11
|
+
return proxyProcessor(this)
|
12
|
+
}
|
10
13
|
|
11
14
|
static bind(config: CosmosProcessorConfig): CosmosProcessor {
|
12
15
|
const processor = new CosmosProcessor(config)
|
@@ -20,6 +23,7 @@ export class CosmosProcessor {
|
|
20
23
|
) {
|
21
24
|
const filter = Array.isArray(logFilters) ? logFilters : [logFilters]
|
22
25
|
const callHandler = {
|
26
|
+
handlerName: getHandlerName(),
|
23
27
|
handler: async (call: Data_CosmosCall) => {
|
24
28
|
const transaction = call.transaction as CosmosTransaction
|
25
29
|
|
package/src/cosmos/types.ts
CHANGED
@@ -5,6 +5,7 @@ import { FuelContext } from './context.js'
|
|
5
5
|
import { decodeFuelTransaction } from './transaction.js'
|
6
6
|
import { Provider, InputType, OutputType } from 'fuels'
|
7
7
|
import { getOptionsSignature } from './fuel-processor.js'
|
8
|
+
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
8
9
|
|
9
10
|
export class FuelAssetProcessor implements FuelBaseProcessor<FuelAssetProcessorConfig> {
|
10
11
|
callHandlers: CallHandler<Data_FuelCall>[] = []
|
@@ -23,7 +24,9 @@ export class FuelAssetProcessor implements FuelBaseProcessor<FuelAssetProcessorC
|
|
23
24
|
return processor
|
24
25
|
}
|
25
26
|
|
26
|
-
constructor(readonly config: FuelAssetProcessorConfig) {
|
27
|
+
constructor(readonly config: FuelAssetProcessorConfig) {
|
28
|
+
return proxyProcessor(this)
|
29
|
+
}
|
27
30
|
|
28
31
|
async configure(): Promise<void> {
|
29
32
|
this.provider = await getProvider(this.config.chainId)
|
@@ -49,6 +52,7 @@ export class FuelAssetProcessor implements FuelBaseProcessor<FuelAssetProcessorC
|
|
49
52
|
}
|
50
53
|
|
51
54
|
const callHandler = {
|
55
|
+
handlerName: getHandlerName(),
|
52
56
|
handler: async (call: Data_FuelCall) => {
|
53
57
|
const gqlTransaction = call.transaction
|
54
58
|
const tx = decodeFuelTransaction(gqlTransaction, this.provider)
|
@@ -3,6 +3,7 @@ import { Contract, JsonAbi } from 'fuels'
|
|
3
3
|
// import { FuelCall } from './context.js'
|
4
4
|
import { FuelChainId } from '@sentio/chain'
|
5
5
|
import { FuelLog } from './types.js'
|
6
|
+
import { proxyProcessor } from '../utils/metrics.js'
|
6
7
|
|
7
8
|
export abstract class FuelAbstractProcessor<TContract extends Contract> extends FuelProcessor<TContract> {
|
8
9
|
protected constructor(abi: JsonAbi, config?: Omit<FuelProcessorConfig, 'abi'>) {
|
@@ -17,6 +18,7 @@ export abstract class FuelAbstractProcessor<TContract extends Contract> extends
|
|
17
18
|
abi
|
18
19
|
})
|
19
20
|
addFuelProcessor(config, this)
|
21
|
+
return proxyProcessor(this)
|
20
22
|
}
|
21
23
|
}
|
22
24
|
|
package/src/fuel/fuel-plugin.ts
CHANGED
@@ -49,15 +49,18 @@ export class FuelPlugin extends Plugin {
|
|
49
49
|
})
|
50
50
|
for (const callHandler of processor.callHandlers) {
|
51
51
|
const handlerId = handlers.callHandlers.push(callHandler.handler) - 1
|
52
|
+
const handlerName = callHandler.handlerName
|
52
53
|
if (processor instanceof FuelProcessor) {
|
53
54
|
if (callHandler.logConfig?.logIds?.length) {
|
54
55
|
contractConfig.fuelLogConfigs.push({
|
55
56
|
logIds: callHandler.logConfig.logIds,
|
56
|
-
handlerId
|
57
|
+
handlerId,
|
58
|
+
handlerName
|
57
59
|
})
|
58
60
|
} else {
|
59
61
|
const fetchConfig = {
|
60
62
|
handlerId,
|
63
|
+
handlerName,
|
61
64
|
filters: callHandler.fetchConfig?.filters || []
|
62
65
|
}
|
63
66
|
contractConfig.fuelCallConfigs.push(fetchConfig)
|
@@ -66,11 +69,13 @@ export class FuelPlugin extends Plugin {
|
|
66
69
|
const assetConfig = callHandler.assetConfig
|
67
70
|
contractConfig.assetConfigs.push({
|
68
71
|
filters: assetConfig?.filters || [],
|
69
|
-
handlerId
|
72
|
+
handlerId,
|
73
|
+
handlerName
|
70
74
|
})
|
71
75
|
} else if (processor instanceof FuelGlobalProcessor) {
|
72
76
|
const fetchConfig = {
|
73
77
|
handlerId,
|
78
|
+
handlerName,
|
74
79
|
filters: []
|
75
80
|
}
|
76
81
|
contractConfig.fuelCallConfigs.push(fetchConfig)
|
@@ -55,6 +55,7 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
55
55
|
config: FuelFetchConfig = DEFAULT_FUEL_FETCH_CONFIG
|
56
56
|
) {
|
57
57
|
const callHandler = {
|
58
|
+
handlerName: getHandlerName(),
|
58
59
|
handler: async (call: Data_FuelCall) => {
|
59
60
|
const abiMap = this.config.abi
|
60
61
|
? {
|
@@ -113,6 +114,7 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
113
114
|
}
|
114
115
|
|
115
116
|
const callHandler = {
|
117
|
+
handlerName: getHandlerName(),
|
116
118
|
handler: async (call: Data_FuelCall) => {
|
117
119
|
try {
|
118
120
|
// const contract = new Contract(this.config.address, abi, this.provider)
|
@@ -168,6 +170,7 @@ export class FuelProcessor<TContract extends Contract> implements FuelBaseProces
|
|
168
170
|
const logIds = new Set(Array.isArray(logIdFilter) ? logIdFilter : [logIdFilter])
|
169
171
|
|
170
172
|
const callHandler = {
|
173
|
+
handlerName: getHandlerName(),
|
171
174
|
handler: async (call: Data_FuelCall) => {
|
172
175
|
try {
|
173
176
|
const gqlTransaction = call.transaction
|
@@ -7,6 +7,7 @@ import { FuelContext } from './context.js'
|
|
7
7
|
import { FuelProcessorConfig, getOptionsSignature } from './fuel-processor.js'
|
8
8
|
import { mergeProcessResults } from '@sentio/runtime'
|
9
9
|
import { ALL_ADDRESS } from '../core/index.js'
|
10
|
+
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
10
11
|
|
11
12
|
type GlobalFuelProcessorConfig = Omit<FuelProcessorConfig, 'address' | 'abi'>
|
12
13
|
|
@@ -28,7 +29,9 @@ export class FuelGlobalProcessor implements FuelBaseProcessor<GlobalFuelProcesso
|
|
28
29
|
return processor
|
29
30
|
}
|
30
31
|
|
31
|
-
constructor(readonly config: GlobalFuelProcessorConfig) {
|
32
|
+
constructor(readonly config: GlobalFuelProcessorConfig) {
|
33
|
+
return proxyProcessor(this)
|
34
|
+
}
|
32
35
|
|
33
36
|
async configure() {
|
34
37
|
this.provider = await getProvider(this.config.chainId)
|
@@ -39,6 +42,7 @@ export class FuelGlobalProcessor implements FuelBaseProcessor<GlobalFuelProcesso
|
|
39
42
|
config: FuelFetchConfig = DEFAULT_FUEL_FETCH_CONFIG
|
40
43
|
) {
|
41
44
|
const callHandler = {
|
45
|
+
handlerName: getHandlerName(),
|
42
46
|
handler: async (call: Data_FuelCall) => {
|
43
47
|
let tx: FuelTransaction
|
44
48
|
try {
|
package/src/fuel/types.ts
CHANGED
@@ -22,6 +22,7 @@ export class FuelProcessorState extends MapStateStorage<FuelBaseProcessor<any>>
|
|
22
22
|
}
|
23
23
|
|
24
24
|
export type CallHandler<T> = {
|
25
|
+
handlerName: string
|
25
26
|
handler: (call: T) => Promise<ProcessResult>
|
26
27
|
fetchConfig?: Partial<FuelCallHandlerConfig>
|
27
28
|
assetConfig?: Partial<FuelAssetHandlerConfig>
|
package/src/move/filter.ts
CHANGED
@@ -34,22 +34,26 @@ export interface ArgumentsFilter {
|
|
34
34
|
|
35
35
|
export class EventHandler<T> {
|
36
36
|
filters: EventFilter[]
|
37
|
+
handlerName: string
|
37
38
|
handler: (event: T) => Promise<ProcessResult>
|
38
39
|
fetchConfig: MoveFetchConfig
|
39
40
|
}
|
40
41
|
|
41
42
|
export class CallHandler<T> {
|
42
43
|
filters: FunctionNameAndCallFilter[]
|
44
|
+
handlerName: string
|
43
45
|
handler: (call: T) => Promise<ProcessResult>
|
44
46
|
fetchConfig: MoveFetchConfig
|
45
47
|
}
|
46
48
|
|
47
49
|
export class ObjectChangeHandler<T> {
|
50
|
+
handlerName: string
|
48
51
|
handler: (call: T) => Promise<ProcessResult>
|
49
52
|
type: string
|
50
53
|
}
|
51
54
|
|
52
55
|
export class ResourceChangeHandler<T> {
|
56
|
+
handlerName: string
|
53
57
|
handler: (call: T) => Promise<ProcessResult>
|
54
58
|
type: string
|
55
59
|
}
|
@@ -6,6 +6,7 @@ import { StarknetEvent } from './event.js'
|
|
6
6
|
import { ListStateStorage, mergeProcessResults } from '@sentio/runtime'
|
7
7
|
import { StarknetProcessorConfig } from './types.js'
|
8
8
|
import { StarknetContractView } from './contract.js'
|
9
|
+
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
9
10
|
|
10
11
|
export class StarknetProcessor {
|
11
12
|
callHandlers: CallHandler<Data_StarknetEvent>[] = []
|
@@ -20,7 +21,9 @@ export class StarknetProcessor {
|
|
20
21
|
|
21
22
|
classHash: string
|
22
23
|
|
23
|
-
constructor(readonly config: StarknetProcessorConfig) {
|
24
|
+
constructor(readonly config: StarknetProcessorConfig) {
|
25
|
+
return proxyProcessor(this)
|
26
|
+
}
|
24
27
|
|
25
28
|
async configure() {
|
26
29
|
this.provider = new RpcProvider({
|
@@ -47,6 +50,7 @@ export class StarknetProcessor {
|
|
47
50
|
}
|
48
51
|
const abi = this.config.abi
|
49
52
|
const callHandler = {
|
53
|
+
handlerName: getHandlerName(),
|
50
54
|
handler: async (call: Data_StarknetEvent) => {
|
51
55
|
try {
|
52
56
|
const eventData = [call.result] as any[]
|
@@ -98,6 +102,7 @@ export class StarknetProcessor {
|
|
98
102
|
}
|
99
103
|
|
100
104
|
export type CallHandler<T> = {
|
105
|
+
handlerName: string
|
101
106
|
handler: (call: T) => Promise<ProcessResult>
|
102
107
|
eventFilter?: string[]
|
103
108
|
}
|
@@ -123,6 +128,7 @@ export abstract class AbstractStarknetProcessor {
|
|
123
128
|
) {
|
124
129
|
this.processor = new StarknetProcessor(config)
|
125
130
|
StarknetProcessorState.INSTANCE.addValue(this.processor)
|
131
|
+
return proxyProcessor(this)
|
126
132
|
}
|
127
133
|
|
128
134
|
onEvent<T, C>(
|
@@ -196,6 +196,7 @@ export class SuiAddressProcessor extends SuiBaseObjectOrAddressProcessorInternal
|
|
196
196
|
const processor = this
|
197
197
|
|
198
198
|
this.callHandlers.push({
|
199
|
+
handlerName: getHandlerName(),
|
199
200
|
handler: async function (data) {
|
200
201
|
if (!data.transaction) {
|
201
202
|
throw new ServerError(Status.INVALID_ARGUMENT, 'transaction is null')
|
@@ -290,6 +291,7 @@ export class SuiObjectTypeProcessor<T> extends SuiBaseObjectOrAddressProcessor<
|
|
290
291
|
}
|
291
292
|
const processor = this
|
292
293
|
this.objectChangeHandlers.push({
|
294
|
+
handlerName: getHandlerName(),
|
293
295
|
handler: async function (data: Data_SuiObjectChange) {
|
294
296
|
const ctx = new SuiObjectChangeContext(
|
295
297
|
processor.config.network,
|
package/src/sui/sui-plugin.ts
CHANGED
@@ -100,7 +100,8 @@ export class SuiPlugin extends Plugin {
|
|
100
100
|
}
|
101
101
|
}),
|
102
102
|
fetchConfig: handler.fetchConfig,
|
103
|
-
handlerId
|
103
|
+
handlerId,
|
104
|
+
handlerName: handler.handlerName
|
104
105
|
}
|
105
106
|
contractConfig.moveEventConfigs.push(eventHandlerConfig)
|
106
107
|
}
|
@@ -118,7 +119,8 @@ export class SuiPlugin extends Plugin {
|
|
118
119
|
}
|
119
120
|
}),
|
120
121
|
fetchConfig: handler.fetchConfig,
|
121
|
-
handlerId
|
122
|
+
handlerId,
|
123
|
+
handlerName: handler.handlerName
|
122
124
|
}
|
123
125
|
contractConfig.moveCallConfigs.push(functionHandlerConfig)
|
124
126
|
}
|
@@ -127,7 +129,8 @@ export class SuiPlugin extends Plugin {
|
|
127
129
|
const handlerId = handlers.suiObjectChangeHandlers.push(handler.handler) - 1
|
128
130
|
const objectChangeHandler: MoveResourceChangeConfig = {
|
129
131
|
type: handler.type,
|
130
|
-
handlerId
|
132
|
+
handlerId,
|
133
|
+
handlerName: handler.handlerName
|
131
134
|
}
|
132
135
|
contractConfig.moveResourceChangeConfigs.push(objectChangeHandler)
|
133
136
|
}
|
@@ -145,7 +148,8 @@ export class SuiPlugin extends Plugin {
|
|
145
148
|
const handlerId = handlers.suiObjectChangeHandlers.push(handler.handler) - 1
|
146
149
|
const objectChangeHandler: MoveResourceChangeConfig = {
|
147
150
|
type: handler.type,
|
148
|
-
handlerId
|
151
|
+
handlerId,
|
152
|
+
handlerName: handler.handlerName
|
149
153
|
}
|
150
154
|
accountConfig.moveResourceChangeConfigs.push(objectChangeHandler)
|
151
155
|
}
|
@@ -185,7 +189,8 @@ export class SuiPlugin extends Plugin {
|
|
185
189
|
}
|
186
190
|
}),
|
187
191
|
fetchConfig: handler.fetchConfig,
|
188
|
-
handlerId
|
192
|
+
handlerId,
|
193
|
+
handlerName: handler.handlerName
|
189
194
|
}
|
190
195
|
accountConfig.moveCallConfigs.push(functionHandlerConfig)
|
191
196
|
}
|
package/src/sui/sui-processor.ts
CHANGED
@@ -19,6 +19,7 @@ import { getMoveCalls } from './utils.js'
|
|
19
19
|
import { defaultMoveCoder, MoveCoder } from './index.js'
|
20
20
|
import { ALL_ADDRESS, Labels } from '../core/index.js'
|
21
21
|
import { Required } from 'utility-types'
|
22
|
+
import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
|
22
23
|
|
23
24
|
export const DEFAULT_FETCH_CONFIG: MoveFetchConfig = {
|
24
25
|
resourceChanges: false,
|
@@ -63,6 +64,8 @@ export class SuiBaseProcessor {
|
|
63
64
|
this.config = configure(options)
|
64
65
|
SuiProcessorState.INSTANCE.addValue(this)
|
65
66
|
this.coder = defaultMoveCoder(this.config.network)
|
67
|
+
|
68
|
+
return proxyProcessor(this)
|
66
69
|
}
|
67
70
|
|
68
71
|
getChainId(): string {
|
@@ -90,6 +93,7 @@ export class SuiBaseProcessor {
|
|
90
93
|
const allEventType = new Set(_filters.map((f) => f.type))
|
91
94
|
|
92
95
|
this.eventHandlers.push({
|
96
|
+
handlerName: getHandlerName(),
|
93
97
|
handler: async function (data) {
|
94
98
|
if (!data.transaction) {
|
95
99
|
throw new ServerError(Status.INVALID_ARGUMENT, 'event is null')
|
@@ -153,6 +157,7 @@ export class SuiBaseProcessor {
|
|
153
157
|
const allFunctionType = new Set(_filters.map((f) => f.function))
|
154
158
|
|
155
159
|
this.callHandlers.push({
|
160
|
+
handlerName: getHandlerName(),
|
156
161
|
handler: async function (data) {
|
157
162
|
if (!data.transaction) {
|
158
163
|
throw new ServerError(Status.INVALID_ARGUMENT, 'call is null')
|
@@ -214,6 +219,7 @@ export class SuiBaseProcessor {
|
|
214
219
|
const processor = this
|
215
220
|
|
216
221
|
this.callHandlers.push({
|
222
|
+
handlerName: getHandlerName(),
|
217
223
|
handler: async function (data) {
|
218
224
|
if (!data.transaction) {
|
219
225
|
throw new ServerError(Status.INVALID_ARGUMENT, 'transaction is null')
|
@@ -250,6 +256,7 @@ export class SuiBaseProcessor {
|
|
250
256
|
}
|
251
257
|
const processor = this
|
252
258
|
this.objectChangeHandlers.push({
|
259
|
+
handlerName: getHandlerName(),
|
253
260
|
handler: async function (data: Data_SuiObjectChange) {
|
254
261
|
const ctx = new SuiObjectChangeContext(
|
255
262
|
processor.config.network,
|