@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.
Files changed (60) hide show
  1. package/lib/aptos/aptos-plugin.d.ts +5 -11
  2. package/lib/aptos/aptos-plugin.d.ts.map +1 -1
  3. package/lib/aptos/aptos-plugin.js +38 -23
  4. package/lib/aptos/aptos-plugin.js.map +1 -1
  5. package/lib/aptos/aptos-processor.d.ts +1 -0
  6. package/lib/aptos/aptos-processor.d.ts.map +1 -1
  7. package/lib/aptos/aptos-processor.js +11 -3
  8. package/lib/aptos/aptos-processor.js.map +1 -1
  9. package/lib/btc/btc-plugin.d.ts +5 -8
  10. package/lib/btc/btc-plugin.d.ts.map +1 -1
  11. package/lib/btc/btc-plugin.js +22 -14
  12. package/lib/btc/btc-plugin.js.map +1 -1
  13. package/lib/core/core-plugin.d.ts +2 -1
  14. package/lib/core/core-plugin.d.ts.map +1 -1
  15. package/lib/core/core-plugin.js +9 -0
  16. package/lib/core/core-plugin.js.map +1 -1
  17. package/lib/core/handler-options.d.ts +6 -0
  18. package/lib/core/handler-options.d.ts.map +1 -1
  19. package/lib/core/handler-options.js.map +1 -1
  20. package/lib/core/handler-register.d.ts +18 -0
  21. package/lib/core/handler-register.d.ts.map +1 -0
  22. package/lib/core/handler-register.js +62 -0
  23. package/lib/core/handler-register.js.map +1 -0
  24. package/lib/cosmos/cosmos-plugin.d.ts +5 -7
  25. package/lib/cosmos/cosmos-plugin.d.ts.map +1 -1
  26. package/lib/cosmos/cosmos-plugin.js +18 -10
  27. package/lib/cosmos/cosmos-plugin.js.map +1 -1
  28. package/lib/eth/eth-plugin.d.ts +5 -40
  29. package/lib/eth/eth-plugin.d.ts.map +1 -1
  30. package/lib/eth/eth-plugin.js +41 -117
  31. package/lib/eth/eth-plugin.js.map +1 -1
  32. package/lib/fuel/fuel-plugin.d.ts +5 -9
  33. package/lib/fuel/fuel-plugin.d.ts.map +1 -1
  34. package/lib/fuel/fuel-plugin.js +26 -18
  35. package/lib/fuel/fuel-plugin.js.map +1 -1
  36. package/lib/solana/solana-plugin.d.ts +3 -2
  37. package/lib/solana/solana-plugin.d.ts.map +1 -1
  38. package/lib/solana/solana-plugin.js +11 -1
  39. package/lib/solana/solana-plugin.js.map +1 -1
  40. package/lib/stark/starknet-plugin.d.ts +5 -7
  41. package/lib/stark/starknet-plugin.d.ts.map +1 -1
  42. package/lib/stark/starknet-plugin.js +18 -10
  43. package/lib/stark/starknet-plugin.js.map +1 -1
  44. package/lib/sui/sui-plugin.d.ts +5 -10
  45. package/lib/sui/sui-plugin.d.ts.map +1 -1
  46. package/lib/sui/sui-plugin.js +37 -24
  47. package/lib/sui/sui-plugin.js.map +1 -1
  48. package/package.json +3 -3
  49. package/src/aptos/aptos-plugin.ts +55 -44
  50. package/src/aptos/aptos-processor.ts +15 -3
  51. package/src/btc/btc-plugin.ts +33 -32
  52. package/src/core/core-plugin.ts +11 -2
  53. package/src/core/handler-options.ts +7 -0
  54. package/src/core/handler-register.ts +79 -0
  55. package/src/cosmos/cosmos-plugin.ts +24 -20
  56. package/src/eth/eth-plugin.ts +62 -182
  57. package/src/fuel/fuel-plugin.ts +43 -44
  58. package/src/solana/solana-plugin.ts +20 -2
  59. package/src/stark/starknet-plugin.ts +24 -20
  60. package/src/sui/sui-plugin.ts +58 -52
@@ -2,6 +2,7 @@ import { errorString, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR
2
2
  import { AccountConfig, ContractConfig, HandlerType } from '@sentio/protos';
3
3
  import { ServerError, Status } from 'nice-grpc';
4
4
  import { PartitionHandlerManager } from '../core/index.js';
5
+ import { HandlerRegister } from '../core/handler-register.js';
5
6
  import { SuiProcessorState } from './sui-processor.js';
6
7
  import { SuiAccountProcessorState, SuiAddressProcessor } from './sui-object-processor.js';
7
8
  import { initCoinList } from './ext/coin.js';
@@ -11,12 +12,7 @@ import { SuiNetwork } from './network.js';
11
12
  import { SuiContext } from './context.js';
12
13
  export class SuiPlugin extends Plugin {
13
14
  name = 'SuiPlugin';
14
- handlers = {
15
- suiCallHandlers: [],
16
- suiEventHandlers: [],
17
- suiObjectHandlers: [],
18
- suiObjectChangeHandlers: []
19
- };
15
+ handlerRegister = new HandlerRegister();
20
16
  partitionManager = new PartitionHandlerManager();
21
17
  async start(request) {
22
18
  await initCoinList();
@@ -38,14 +34,20 @@ export class SuiPlugin extends Plugin {
38
34
  }, NoopContext);
39
35
  }
40
36
  }
41
- async configure(config) {
42
- const handlers = {
43
- suiCallHandlers: [],
44
- suiEventHandlers: [],
45
- suiObjectHandlers: [],
46
- suiObjectChangeHandlers: []
47
- };
37
+ async init(config) {
38
+ for (const state of [SuiProcessorState.INSTANCE, SuiAccountProcessorState.INSTANCE]) {
39
+ for (const suiProcessor of state.getValues()) {
40
+ config.chainIds.push(suiProcessor.config.network);
41
+ }
42
+ }
43
+ }
44
+ async configure(config, forChainId) {
45
+ this.handlerRegister.clear(forChainId);
48
46
  for (const suiProcessor of SuiProcessorState.INSTANCE.getValues()) {
47
+ const chainId = suiProcessor.config.network;
48
+ if (forChainId !== undefined && forChainId !== chainId.toString()) {
49
+ continue;
50
+ }
49
51
  const contractConfig = ContractConfig.fromPartial({
50
52
  transactionConfig: [],
51
53
  processorType: USER_PROCESSOR,
@@ -59,7 +61,7 @@ export class SuiPlugin extends Plugin {
59
61
  endBlock: suiProcessor.config.endCheckpoint
60
62
  });
61
63
  for (const handler of suiProcessor.eventHandlers) {
62
- const handlerId = handlers.suiEventHandlers.push(handler.handler) - 1;
64
+ const handlerId = this.handlerRegister.register(handler.handler, chainId);
63
65
  this.partitionManager.registerPartitionHandler(HandlerType.SUI_EVENT, handlerId, handler.partitionHandler);
64
66
  const eventHandlerConfig = {
65
67
  filters: handler.filters.map((f) => {
@@ -76,7 +78,7 @@ export class SuiPlugin extends Plugin {
76
78
  contractConfig.moveEventConfigs.push(eventHandlerConfig);
77
79
  }
78
80
  for (const handler of suiProcessor.callHandlers) {
79
- const handlerId = handlers.suiCallHandlers.push(handler.handler) - 1;
81
+ const handlerId = this.handlerRegister.register(handler.handler, chainId);
80
82
  this.partitionManager.registerPartitionHandler(HandlerType.SUI_CALL, handlerId, handler.partitionHandler);
81
83
  const functionHandlerConfig = {
82
84
  filters: handler.filters.map((filter) => {
@@ -97,7 +99,7 @@ export class SuiPlugin extends Plugin {
97
99
  }
98
100
  // deprecated, use objectType processor instead
99
101
  for (const handler of suiProcessor.objectChangeHandlers) {
100
- const handlerId = handlers.suiObjectChangeHandlers.push(handler.handler) - 1;
102
+ const handlerId = this.handlerRegister.register(handler.handler, chainId);
101
103
  const objectChangeHandler = {
102
104
  type: handler.type,
103
105
  handlerId,
@@ -109,6 +111,10 @@ export class SuiPlugin extends Plugin {
109
111
  config.contractConfigs.push(contractConfig);
110
112
  }
111
113
  for (const processor of SuiAccountProcessorState.INSTANCE.getValues()) {
114
+ const chainId = processor.getChainId();
115
+ if (forChainId !== undefined && forChainId !== chainId.toString()) {
116
+ continue;
117
+ }
112
118
  const accountConfig = AccountConfig.fromPartial({
113
119
  address: processor.config.address,
114
120
  chainId: processor.getChainId(),
@@ -116,7 +122,7 @@ export class SuiPlugin extends Plugin {
116
122
  endBlock: processor.config.endCheckpoint
117
123
  });
118
124
  for (const handler of processor.objectChangeHandlers) {
119
- const handlerId = handlers.suiObjectChangeHandlers.push(handler.handler) - 1;
125
+ const handlerId = this.handlerRegister.register(handler.handler, chainId);
120
126
  const objectChangeHandler = {
121
127
  type: handler.type,
122
128
  handlerId,
@@ -126,7 +132,7 @@ export class SuiPlugin extends Plugin {
126
132
  accountConfig.moveResourceChangeConfigs.push(objectChangeHandler);
127
133
  }
128
134
  for (const handler of processor.objectHandlers) {
129
- const handlerId = handlers.suiObjectHandlers.push(handler.handler) - 1;
135
+ const handlerId = this.handlerRegister.register(handler.handler, chainId);
130
136
  accountConfig.moveIntervalConfigs.push({
131
137
  intervalConfig: {
132
138
  handlerId: handlerId,
@@ -145,7 +151,7 @@ export class SuiPlugin extends Plugin {
145
151
  }
146
152
  if (processor instanceof SuiAddressProcessor) {
147
153
  for (const handler of processor.callHandlers) {
148
- const handlerId = handlers.suiCallHandlers.push(handler.handler) - 1;
154
+ const handlerId = this.handlerRegister.register(handler.handler, chainId);
149
155
  const functionHandlerConfig = {
150
156
  filters: handler.filters.map((filter) => {
151
157
  return {
@@ -166,7 +172,6 @@ export class SuiPlugin extends Plugin {
166
172
  }
167
173
  config.accountConfigs.push(accountConfig);
168
174
  }
169
- this.handlers = handlers;
170
175
  }
171
176
  supportedHandlers = [
172
177
  HandlerType.SUI_EVENT,
@@ -230,7 +235,9 @@ export class SuiPlugin extends Plugin {
230
235
  const promises = [];
231
236
  const event = binding.data.suiEvent;
232
237
  for (const handlerId of binding.handlerIds) {
233
- promises.push(this.handlers.suiEventHandlers[handlerId](event).catch((e) => {
238
+ promises.push(this.handlerRegister
239
+ .getHandlerById(handlerId)(event)
240
+ .catch((e) => {
234
241
  throw new ServerError(Status.INTERNAL, 'error processing event: ' + JSON.stringify(event) + '\n' + errorString(e));
235
242
  }));
236
243
  }
@@ -243,7 +250,9 @@ export class SuiPlugin extends Plugin {
243
250
  const call = binding.data.suiCall;
244
251
  const promises = [];
245
252
  for (const handlerId of binding.handlerIds) {
246
- const promise = this.handlers.suiCallHandlers[handlerId](call).catch((e) => {
253
+ const promise = this.handlerRegister
254
+ .getHandlerById(handlerId)(call)
255
+ .catch((e) => {
247
256
  throw new ServerError(Status.INTERNAL, 'error processing call: ' + JSON.stringify(call) + '\n' + errorString(e));
248
257
  });
249
258
  promises.push(promise);
@@ -257,7 +266,9 @@ export class SuiPlugin extends Plugin {
257
266
  const object = binding.data.suiObject;
258
267
  const promises = [];
259
268
  for (const handlerId of binding.handlerIds) {
260
- promises.push(this.handlers.suiObjectHandlers[handlerId](object).catch((e) => {
269
+ promises.push(this.handlerRegister
270
+ .getHandlerById(handlerId)(object)
271
+ .catch((e) => {
261
272
  throw new ServerError(Status.INTERNAL, 'error processing object: ' + JSON.stringify(object) + '\n' + errorString(e));
262
273
  }));
263
274
  }
@@ -270,7 +281,9 @@ export class SuiPlugin extends Plugin {
270
281
  const objectChange = binding.data.suiObjectChange;
271
282
  const promises = [];
272
283
  for (const handlerId of binding.handlerIds) {
273
- promises.push(this.handlers.suiObjectChangeHandlers[handlerId](objectChange).catch((e) => {
284
+ promises.push(this.handlerRegister
285
+ .getHandlerById(handlerId)(objectChange)
286
+ .catch((e) => {
274
287
  throw new ServerError(Status.INTERNAL, 'error processing object change: ' + JSON.stringify(objectChange) + '\n' + errorString(e));
275
288
  }));
276
289
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sui-plugin.js","sourceRoot":"","sources":["../../src/sui/sui-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACzG,OAAO,EACL,aAAa,EACb,cAAc,EAMd,WAAW,EAQZ,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EACL,gCAAgC,EAEjC,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AASzC,MAAM,OAAO,SAAU,SAAQ,MAAM;IACnC,IAAI,GAAW,WAAW,CAAA;IAC1B,QAAQ,GAAa;QACnB,eAA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G,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,CAC1F,CAAA;YACH,CAAC,CAAC,CACL,CAAA;QACH,CAAC;QACD,OAAO,mBAAmB,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA;IACzD,CAAC;CACF;AAED,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,SAAS,EAAE,CAAC,CAAA;AAEhD,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,WAAW,EAAE,EAAE,EAAE,IAAI,IAAI,EAAE,EAAE,EAAE,EAAE,EAAS,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/sdk",
3
- "version": "2.59.5-rc.1",
3
+ "version": "2.60.0-rc.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -88,8 +88,8 @@
88
88
  "typechain": "^8.3.2",
89
89
  "utility-types": "^3.11.0",
90
90
  "yaml": "^2.3.4",
91
- "@sentio/protos": "2.59.5-rc.1",
92
- "@sentio/runtime": "^2.59.5-rc.1"
91
+ "@sentio/protos": "2.60.0-rc.2",
92
+ "@sentio/runtime": "^2.60.0-rc.2"
93
93
  },
94
94
  "peerDependencies": {
95
95
  "@sentio/tsup": "^8.3.5-rc.1"
@@ -1,11 +1,12 @@
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
  AccountConfig,
5
6
  ContractConfig,
6
- Data_AptCall,
7
7
  DataBinding,
8
8
  HandlerType,
9
+ InitResponse,
9
10
  MoveCallHandlerConfig,
10
11
  MoveEventHandlerConfig,
11
12
  MoveOwnerType,
@@ -27,26 +28,21 @@ import {
27
28
  AptosResourceProcessorTemplateState
28
29
  } from './aptos-resource-processor-template.js'
29
30
  import { AptosNetwork } from './network.js'
30
- import { AptEvent, AptCall, AptResource } from './data.js'
31
-
32
- interface Handlers {
33
- aptosEventHandlers: ((event: AptEvent) => Promise<ProcessResult>)[]
34
- aptosCallHandlers: ((func: AptCall) => Promise<ProcessResult>)[]
35
- aptosResourceHandlers: ((resourceWithVersion: AptResource) => Promise<ProcessResult>)[]
36
- aptosTransactionIntervalHandlers: ((txn: Data_AptCall) => Promise<ProcessResult>)[]
37
- }
31
+ import { AptCall, AptEvent, AptResource } from './data.js'
38
32
 
39
33
  export class AptosPlugin extends Plugin {
40
34
  name: string = 'AptosPlugin'
41
- handlers: Handlers = {
42
- aptosEventHandlers: [],
43
- aptosCallHandlers: [],
44
- aptosResourceHandlers: [],
45
- aptosTransactionIntervalHandlers: []
46
- }
47
-
35
+ handlerRegister = new HandlerRegister()
48
36
  partitionManager = new PartitionHandlerManager()
49
37
 
38
+ async init(config: InitResponse) {
39
+ for (const state of [AptosProcessorState.INSTANCE, AptosResourceProcessorState.INSTANCE]) {
40
+ for (const aptosProcessor of state.getValues()) {
41
+ config.chainIds.push(aptosProcessor.getChainId())
42
+ }
43
+ }
44
+ }
45
+
50
46
  async start(request: StartRequest) {
51
47
  await initTokenList()
52
48
 
@@ -72,14 +68,13 @@ export class AptosPlugin extends Plugin {
72
68
  }
73
69
  }
74
70
 
75
- async configure(config: ProcessConfigResponse) {
76
- const handlers: Handlers = {
77
- aptosTransactionIntervalHandlers: [],
78
- aptosEventHandlers: [],
79
- aptosCallHandlers: [],
80
- aptosResourceHandlers: []
81
- }
71
+ async configure(config: ProcessConfigResponse, forChainId?: string) {
72
+ this.handlerRegister.clear(forChainId as any)
82
73
  for (const aptosProcessor of AptosProcessorState.INSTANCE.getValues()) {
74
+ const chainId = aptosProcessor.getChainId()
75
+ if (forChainId !== undefined && forChainId !== chainId.toString()) {
76
+ continue
77
+ }
83
78
  const contractConfig = ContractConfig.fromPartial({
84
79
  processorType: USER_PROCESSOR,
85
80
  contract: {
@@ -93,7 +88,7 @@ export class AptosPlugin extends Plugin {
93
88
  })
94
89
  // 1. Prepare event handlers
95
90
  for (const handler of aptosProcessor.eventHandlers) {
96
- const handlerId = handlers.aptosEventHandlers.push(handler.handler) - 1
91
+ const handlerId = this.handlerRegister.register(handler.handler, chainId)
97
92
  this.partitionManager.registerPartitionHandler(HandlerType.APT_EVENT, handlerId, handler.partitionHandler)
98
93
  const eventHandlerConfig: MoveEventHandlerConfig = {
99
94
  filters: handler.filters.map((f) => {
@@ -112,7 +107,7 @@ export class AptosPlugin extends Plugin {
112
107
 
113
108
  // 2. Prepare function handlers
114
109
  for (const handler of aptosProcessor.callHandlers) {
115
- const handlerId = handlers.aptosCallHandlers.push(handler.handler) - 1
110
+ const handlerId = this.handlerRegister.register(handler.handler, chainId)
116
111
  this.partitionManager.registerPartitionHandler(HandlerType.APT_CALL, handlerId, handler.partitionHandler)
117
112
  const functionHandlerConfig: MoveCallHandlerConfig = {
118
113
  filters: handler.filters.map((filter) => {
@@ -137,6 +132,10 @@ export class AptosPlugin extends Plugin {
137
132
 
138
133
  // Prepare resource handlers
139
134
  for (const aptosProcessor of AptosProcessorState.INSTANCE.getValues()) {
135
+ const chainId = aptosProcessor.getChainId()
136
+ if (forChainId !== undefined && forChainId !== chainId.toString()) {
137
+ continue
138
+ }
140
139
  const accountConfig = AccountConfig.fromPartial({
141
140
  address: aptosProcessor.config.address,
142
141
  chainId: aptosProcessor.getChainId(),
@@ -144,7 +143,7 @@ export class AptosPlugin extends Plugin {
144
143
  endBlock: aptosProcessor.config.endVersion
145
144
  })
146
145
  for (const handler of aptosProcessor.resourceChangeHandlers) {
147
- const handlerId = handlers.aptosResourceHandlers.push(handler.handler) - 1
146
+ const handlerId = this.handlerRegister.register(handler.handler, chainId)
148
147
  this.partitionManager.registerPartitionHandler(HandlerType.APT_RESOURCE, handlerId, handler.partitionHandler)
149
148
  accountConfig.moveResourceChangeConfigs.push({
150
149
  handlerId: handlerId,
@@ -156,7 +155,7 @@ export class AptosPlugin extends Plugin {
156
155
 
157
156
  // Prepare interval handlers
158
157
  for (const handler of aptosProcessor.transactionIntervalHandlers) {
159
- const handlerId = handlers.aptosTransactionIntervalHandlers.push(handler.handler) - 1
158
+ const handlerId = this.handlerRegister.register(handler.handler, chainId)
160
159
  this.partitionManager.registerPartitionHandler(HandlerType.APT_CALL, handlerId, handler.partitionHandler)
161
160
  accountConfig.moveIntervalConfigs.push({
162
161
  intervalConfig: {
@@ -179,6 +178,10 @@ export class AptosPlugin extends Plugin {
179
178
  }
180
179
 
181
180
  for (const aptosProcessor of AptosResourceProcessorState.INSTANCE.getValues()) {
181
+ const chainId = aptosProcessor.getChainId()
182
+ if (forChainId !== undefined && forChainId !== chainId.toString()) {
183
+ continue
184
+ }
182
185
  const accountConfig = AccountConfig.fromPartial({
183
186
  address: aptosProcessor.config.address,
184
187
  chainId: aptosProcessor.getChainId(),
@@ -186,7 +189,7 @@ export class AptosPlugin extends Plugin {
186
189
  endBlock: aptosProcessor.config.endVersion
187
190
  })
188
191
  for (const handler of aptosProcessor.resourceIntervalHandlers) {
189
- const handlerId = handlers.aptosResourceHandlers.push(handler.handler) - 1
192
+ const handlerId = this.handlerRegister.register(handler.handler, chainId)
190
193
  this.partitionManager.registerPartitionHandler(HandlerType.APT_RESOURCE, handlerId, handler.partitionHandler)
191
194
  if (handler.timeIntervalInMinutes || handler.versionInterval) {
192
195
  accountConfig.moveIntervalConfigs.push({
@@ -216,7 +219,6 @@ export class AptosPlugin extends Plugin {
216
219
  }
217
220
  config.accountConfigs.push(accountConfig)
218
221
  }
219
- this.handlers = handlers
220
222
  }
221
223
 
222
224
  supportedHandlers = [HandlerType.APT_CALL, HandlerType.APT_RESOURCE, HandlerType.APT_EVENT]
@@ -276,12 +278,14 @@ export class AptosPlugin extends Plugin {
276
278
  const event = new AptEvent(binding.data.aptEvent)
277
279
 
278
280
  for (const handlerId of binding.handlerIds) {
279
- const promise = this.handlers.aptosEventHandlers[handlerId](event).catch((e) => {
280
- throw new ServerError(
281
- Status.INTERNAL,
282
- 'error processing event: ' + JSON.stringify(event) + '\n' + errorString(e)
283
- )
284
- })
281
+ const promise = this.handlerRegister
282
+ .getHandlerById(handlerId)(event)
283
+ .catch((e: any) => {
284
+ throw new ServerError(
285
+ Status.INTERNAL,
286
+ 'error processing event: ' + JSON.stringify(event) + '\n' + errorString(e)
287
+ )
288
+ })
285
289
  if (GLOBAL_CONFIG.execution.sequential) {
286
290
  await promise
287
291
  }
@@ -298,12 +302,14 @@ export class AptosPlugin extends Plugin {
298
302
 
299
303
  const promises: Promise<ProcessResult>[] = []
300
304
  for (const handlerId of binding.handlerIds) {
301
- const promise = this.handlers.aptosResourceHandlers[handlerId](resource).catch((e) => {
302
- throw new ServerError(
303
- Status.INTERNAL,
304
- 'error processing resource: ' + JSON.stringify(resource) + '\n' + errorString(e)
305
- )
306
- })
305
+ const promise = this.handlerRegister
306
+ .getHandlerById(handlerId)(resource)
307
+ .catch((e: any) => {
308
+ throw new ServerError(
309
+ Status.INTERNAL,
310
+ 'error processing resource: ' + JSON.stringify(resource) + '\n' + errorString(e)
311
+ )
312
+ })
307
313
  if (GLOBAL_CONFIG.execution.sequential) {
308
314
  await promise
309
315
  }
@@ -321,9 +327,14 @@ export class AptosPlugin extends Plugin {
321
327
  const promises: Promise<ProcessResult>[] = []
322
328
  for (const handlerId of binding.handlerIds) {
323
329
  // only support aptos call for now
324
- const promise = this.handlers.aptosCallHandlers[handlerId](call).catch((e) => {
325
- throw new ServerError(Status.INTERNAL, 'error processing call: ' + JSON.stringify(call) + '\n' + errorString(e))
326
- })
330
+ const promise = this.handlerRegister
331
+ .getHandlerById(handlerId)(call)
332
+ .catch((e: any) => {
333
+ throw new ServerError(
334
+ Status.INTERNAL,
335
+ 'error processing call: ' + JSON.stringify(call) + '\n' + errorString(e)
336
+ )
337
+ })
327
338
  if (GLOBAL_CONFIG.execution.sequential) {
328
339
  await promise
329
340
  }
@@ -111,8 +111,12 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
111
111
  processor.config.baseLabels
112
112
  )
113
113
 
114
- const decoded = await data.decodeEvent(processor.coder)
115
- await handler(decoded || data.event, ctx)
114
+ if (!handlerOptions?.skipDecoding) {
115
+ const decoded = await data.decodeEvent(processor.coder)
116
+ await handler(decoded || data.event, ctx)
117
+ } else {
118
+ await handler(data.event, ctx)
119
+ }
116
120
  return ctx.stopAndGetResult()
117
121
  },
118
122
  filters: _filters,
@@ -242,7 +246,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
242
246
  handler: (event: Event, ctx: AptosContext) => void,
243
247
  handlerOptions?: HandlerOptions<MoveFetchConfig, Event>
244
248
  ): this {
245
- this.onMoveEvent(handler, { type: '' }, handlerOptions)
249
+ this.onMoveEvent(handler, { type: '' }, { ...handlerOptions, skipDecoding: true })
246
250
  return this
247
251
  }
248
252
 
@@ -398,6 +402,14 @@ export class AptosModulesProcessor extends AptosTransactionProcessor<
398
402
  static bind(options: AptosBindOptions): AptosModulesProcessor {
399
403
  return new AptosModulesProcessor(options)
400
404
  }
405
+
406
+ public onMoveEvent(
407
+ handler: (event: Event, ctx: AptosContext) => PromiseOrVoid,
408
+ filter: EventFilter | EventFilter[],
409
+ handlerOptions?: HandlerOptions<MoveFetchConfig, Event>
410
+ ) {
411
+ return super.onMoveEvent(handler, filter, handlerOptions)
412
+ }
401
413
  }
402
414
 
403
415
  export class AptosGlobalProcessor {
@@ -1,10 +1,9 @@
1
1
  import { errorString, GLOBAL_CONFIG, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime'
2
2
  import {
3
3
  ContractConfig,
4
- Data_BTCBlock,
5
- Data_BTCTransaction,
6
4
  DataBinding,
7
5
  HandlerType,
6
+ InitResponse,
8
7
  ProcessConfigResponse,
9
8
  ProcessResult,
10
9
  ProcessStreamResponse_Partitions,
@@ -13,31 +12,31 @@ import {
13
12
 
14
13
  import { ServerError, Status } from 'nice-grpc'
15
14
  import { PartitionHandlerManager } from '../core/index.js'
15
+ import { HandlerRegister } from '../core/handler-register.js'
16
16
  import { TemplateInstanceState } from '../core/template.js'
17
17
  import { BTCProcessorState } from './btc-processor.js'
18
18
  import { filters2Proto, TransactionFilter } from './filter.js'
19
19
 
20
- interface Handlers {
21
- txHandlers: ((trace: Data_BTCTransaction) => Promise<ProcessResult>)[]
22
- blockHandlers: ((trace: Data_BTCBlock) => Promise<ProcessResult>)[]
23
- }
24
-
25
20
  export class BTCPlugin extends Plugin {
26
21
  name: string = 'BTCPlugin'
27
- handlers: Handlers = {
28
- txHandlers: [],
29
- blockHandlers: []
30
- }
31
-
22
+ handlerRegister = new HandlerRegister()
32
23
  partitionManager = new PartitionHandlerManager()
33
24
 
34
- async configure(config: ProcessConfigResponse) {
35
- const handlers: Handlers = {
36
- txHandlers: [],
37
- blockHandlers: []
25
+ async init(config: InitResponse) {
26
+ for (const aptosProcessor of BTCProcessorState.INSTANCE.getValues()) {
27
+ const chainId = aptosProcessor.config.chainId
28
+ config.chainIds.push(chainId)
38
29
  }
30
+ }
31
+
32
+ async configure(config: ProcessConfigResponse, forChainId?: string) {
33
+ this.handlerRegister.clear(forChainId as any)
39
34
 
40
35
  for (const processor of BTCProcessorState.INSTANCE.getValues()) {
36
+ const chainId = processor.config.chainId
37
+ if (forChainId !== undefined && forChainId !== chainId.toString()) {
38
+ continue
39
+ }
41
40
  const contractConfig = ContractConfig.fromPartial({
42
41
  processorType: USER_PROCESSOR,
43
42
  contract: {
@@ -50,7 +49,7 @@ export class BTCPlugin extends Plugin {
50
49
  endBlock: processor.config.endBlock
51
50
  })
52
51
  for (const callHandler of processor.callHandlers) {
53
- const handlerId = handlers.txHandlers.push(callHandler.handler) - 1
52
+ const handlerId = this.handlerRegister.register(callHandler.handler, chainId)
54
53
  this.partitionManager.registerPartitionHandler(
55
54
  HandlerType.BTC_TRANSACTION,
56
55
  handlerId,
@@ -78,7 +77,7 @@ export class BTCPlugin extends Plugin {
78
77
  }
79
78
 
80
79
  for (const blockHandler of processor.blockHandlers) {
81
- const handlerId = handlers.blockHandlers.push(blockHandler.handler) - 1
80
+ const handlerId = this.handlerRegister.register(blockHandler.handler, chainId)
82
81
  this.partitionManager.registerPartitionHandler(HandlerType.BTC_BLOCK, handlerId, blockHandler.partitionHandler)
83
82
  contractConfig.intervalConfigs.push({
84
83
  slot: 0,
@@ -100,8 +99,6 @@ export class BTCPlugin extends Plugin {
100
99
  // Finish up a contract
101
100
  config.contractConfigs.push(contractConfig)
102
101
  }
103
-
104
- this.handlers = handlers
105
102
  }
106
103
 
107
104
  supportedHandlers = [HandlerType.BTC_TRANSACTION, HandlerType.BTC_BLOCK]
@@ -161,12 +158,14 @@ export class BTCPlugin extends Plugin {
161
158
  const result = binding.data?.btcTransaction
162
159
 
163
160
  for (const handlerId of binding.handlerIds) {
164
- const promise = this.handlers.txHandlers[handlerId](binding.data?.btcTransaction).catch((e) => {
165
- throw new ServerError(
166
- Status.INTERNAL,
167
- 'error processing transaction: ' + JSON.stringify(result) + '\n' + errorString(e)
168
- )
169
- })
161
+ const promise = this.handlerRegister
162
+ .getHandlerById(handlerId)(binding.data?.btcTransaction)
163
+ .catch((e: any) => {
164
+ throw new ServerError(
165
+ Status.INTERNAL,
166
+ 'error processing transaction: ' + JSON.stringify(result) + '\n' + errorString(e)
167
+ )
168
+ })
170
169
  if (GLOBAL_CONFIG.execution.sequential) {
171
170
  await promise
172
171
  }
@@ -184,12 +183,14 @@ export class BTCPlugin extends Plugin {
184
183
 
185
184
  const promises: Promise<ProcessResult>[] = []
186
185
  for (const handlerId of request.handlerIds) {
187
- const promise = this.handlers.blockHandlers[handlerId](block).catch((e) => {
188
- throw new ServerError(
189
- Status.INTERNAL,
190
- 'error processing block: ' + JSON.stringify(block) + '\n' + errorString(e)
191
- )
192
- })
186
+ const promise = this.handlerRegister
187
+ .getHandlerById(handlerId)(block)
188
+ .catch((e: any) => {
189
+ throw new ServerError(
190
+ Status.INTERNAL,
191
+ 'error processing block: ' + JSON.stringify(block) + '\n' + errorString(e)
192
+ )
193
+ })
193
194
  if (GLOBAL_CONFIG.execution.sequential) {
194
195
  await promise
195
196
  }
@@ -1,5 +1,5 @@
1
1
  import { Plugin, PluginManager } from '@sentio/runtime'
2
- import { ProcessConfigResponse } from '@sentio/protos'
2
+ import { InitResponse, ProcessConfigResponse } from '@sentio/protos'
3
3
 
4
4
  import { MetricState, MetricStateNew } from './meter.js'
5
5
  import { ExporterState } from './exporter.js'
@@ -24,7 +24,6 @@ export class CorePlugin extends Plugin {
24
24
  ...metric.config
25
25
  })
26
26
  }
27
-
28
27
  for (const event of EventLoggerState.INSTANCE.getValues()) {
29
28
  config.eventLogConfigs.push({
30
29
  ...event.config
@@ -46,6 +45,16 @@ export class CorePlugin extends Plugin {
46
45
  }
47
46
  }
48
47
  }
48
+
49
+ async init(config: InitResponse): Promise<void> {
50
+ if (DatabaseSchemaState.INSTANCE.getValues().length > 0) {
51
+ config.dbSchema = {
52
+ gqlSchema: DatabaseSchemaState.INSTANCE.getValues()
53
+ .map((e) => e.source)
54
+ .join('\n\n')
55
+ }
56
+ }
57
+ }
49
58
  }
50
59
 
51
60
  PluginManager.INSTANCE.register(new CorePlugin())
@@ -15,6 +15,13 @@ export type HandlerOptions<F, D> = Partial<F> & {
15
15
  * Can be a static string or a function that computes the key from the data.
16
16
  */
17
17
  partitionKey?: string | PartitionHandler<D>
18
+
19
+ /**
20
+ * Optional whether to skip decoding
21
+ * By default the processor will do decoding (e.g. replace string number to bigint, byte array to base64, etc),
22
+ * however in some case you might skip the decoding (meaning no data_decoded field) and only access the raw data field
23
+ */
24
+ skipDecoding?: boolean
18
25
  }
19
26
 
20
27
  /**