@sentio/sdk 2.15.7-rc.1 → 2.16.0-rc.1

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 (45) hide show
  1. package/lib/aptos/aptos-plugin.js +3 -14
  2. package/lib/aptos/aptos-plugin.js.map +1 -1
  3. package/lib/core/template.d.ts +5 -0
  4. package/lib/core/template.js +6 -0
  5. package/lib/core/template.js.map +1 -0
  6. package/lib/eth/base-processor-template.d.ts +1 -4
  7. package/lib/eth/base-processor-template.js +2 -7
  8. package/lib/eth/base-processor-template.js.map +1 -1
  9. package/lib/eth/eth-plugin.js +6 -1
  10. package/lib/eth/eth-plugin.js.map +1 -1
  11. package/lib/move/abstract-move-coder.js +2 -2
  12. package/lib/move/abstract-move-coder.js.map +1 -1
  13. package/lib/move/ts-type.test.js.map +1 -1
  14. package/lib/move/types.js +4 -6
  15. package/lib/move/types.js.map +1 -1
  16. package/lib/sui/index.d.ts +3 -1
  17. package/lib/sui/index.js +5 -1
  18. package/lib/sui/index.js.map +1 -1
  19. package/lib/sui/move-types.js +1 -1
  20. package/lib/sui/move-types.js.map +1 -1
  21. package/lib/sui/sui-object-processor.d.ts +54 -0
  22. package/lib/sui/sui-object-processor.js +93 -0
  23. package/lib/sui/sui-object-processor.js.map +1 -0
  24. package/lib/sui/sui-objects-processor-template.d.ts +34 -0
  25. package/lib/sui/sui-objects-processor-template.js +88 -0
  26. package/lib/sui/sui-objects-processor-template.js.map +1 -0
  27. package/lib/sui/sui-plugin.d.ts +1 -1
  28. package/lib/sui/sui-plugin.js +21 -2
  29. package/lib/sui/sui-plugin.js.map +1 -1
  30. package/lib/sui/sui-processor.d.ts +8 -56
  31. package/lib/sui/sui-processor.js +9 -122
  32. package/lib/sui/sui-processor.js.map +1 -1
  33. package/package.json +4 -3
  34. package/src/aptos/aptos-plugin.ts +3 -15
  35. package/src/core/template.ts +6 -0
  36. package/src/eth/base-processor-template.ts +2 -7
  37. package/src/eth/eth-plugin.ts +8 -1
  38. package/src/move/abstract-move-coder.ts +2 -2
  39. package/src/move/types.ts +6 -6
  40. package/src/sui/index.ts +13 -1
  41. package/src/sui/move-types.ts +1 -1
  42. package/src/sui/sui-object-processor.ts +186 -0
  43. package/src/sui/sui-objects-processor-template.ts +153 -0
  44. package/src/sui/sui-plugin.ts +29 -2
  45. package/src/sui/sui-processor.ts +14 -196
@@ -1,34 +1,23 @@
1
- import { MoveFetchConfig, MoveOnIntervalConfig_OwnerType, } from '@sentio/protos';
1
+ import { MoveFetchConfig } from '@sentio/protos';
2
2
  import { ListStateStorage, mergeProcessResults } from '@sentio/runtime';
3
3
  import { SuiNetwork } from './network.js';
4
4
  import { ServerError, Status } from 'nice-grpc';
5
- import { SuiContext, SuiObjectsContext } from './context.js';
5
+ import { SuiContext } from './context.js';
6
6
  import { getProgrammableTransaction, getTransactionKind, } from '@mysten/sui.js';
7
7
  import { parseMoveType, SPLITTER, } from '../move/index.js';
8
8
  import { getMoveCalls } from './utils.js';
9
9
  import { defaultMoveCoder } from './move-coder.js';
10
- // import { dynamic_field } from './builtin/0x2.js'
11
10
  const DEFAULT_FETCH_CONFIG = {
12
11
  resourceChanges: false,
13
12
  allEvents: true,
14
13
  };
15
- class IndexConfigure {
16
- address;
17
- network;
18
- startCheckpoint;
19
- baseLabels;
20
- }
21
- export class SuiBindOptions {
22
- address;
23
- network;
24
- startCheckpoint;
25
- baseLabels;
26
- }
27
- export class SuiObjectBindOptions {
28
- objectId;
29
- network;
30
- startCheckpoint;
31
- baseLabels;
14
+ export function configure(options) {
15
+ return {
16
+ startCheckpoint: options.startCheckpoint || 0n,
17
+ address: options.address,
18
+ network: options.network || SuiNetwork.MAIN_NET,
19
+ baseLabels: options.baseLabels,
20
+ };
32
21
  }
33
22
  class SuiProcessorState extends ListStateStorage {
34
23
  static INSTANCE = new SuiProcessorState();
@@ -135,106 +124,4 @@ export class SuiBaseProcessor {
135
124
  return this;
136
125
  }
137
126
  }
138
- class ObjectHandler {
139
- type;
140
- versionInterval;
141
- timeIntervalInMinutes;
142
- handler;
143
- }
144
- class SuiAccountProcessorState extends ListStateStorage {
145
- static INSTANCE = new SuiAccountProcessorState();
146
- }
147
- export { SuiAccountProcessorState };
148
- class SuiObjectsBindOptions extends SuiBindOptions {
149
- ownerType;
150
- }
151
- class SuiBaseObjectsProcessor {
152
- config;
153
- ownerType;
154
- objectHandlers = [];
155
- // static bind(options: SuiObjectsBindOptions): SuiBaseObjectsProcessor<any> {
156
- // return new SuiBaseObjectsProcessor(options)
157
- // }
158
- constructor(options) {
159
- this.config = configure(options);
160
- this.ownerType = options.ownerType;
161
- SuiAccountProcessorState.INSTANCE.addValue(this);
162
- }
163
- getChainId() {
164
- return this.config.network;
165
- }
166
- onInterval(handler, //(resources: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid,
167
- timeInterval, versionInterval, type) {
168
- const processor = this;
169
- this.objectHandlers.push({
170
- handler: async function (data) {
171
- const ctx = new SuiObjectsContext(processor.config.network, processor.config.address, data.slot, data.timestamp || new Date(0), processor.config.baseLabels);
172
- await processor.doHandle(handler, data, ctx);
173
- return ctx.getProcessResult();
174
- },
175
- timeIntervalInMinutes: timeInterval,
176
- versionInterval: versionInterval,
177
- type,
178
- });
179
- return this;
180
- }
181
- onTimeInterval(handler, timeIntervalInMinutes = 60, backfillTimeIntervalInMinutes = 240, type) {
182
- return this.onInterval(handler, {
183
- recentInterval: timeIntervalInMinutes,
184
- backfillInterval: backfillTimeIntervalInMinutes,
185
- }, undefined, type);
186
- }
187
- onSlotInterval(handler, slotInterval = 100000, backfillSlotInterval = 400000, type) {
188
- return this.onInterval(handler, undefined, { recentInterval: slotInterval, backfillInterval: backfillSlotInterval }, type);
189
- }
190
- }
191
- function configure(options) {
192
- return {
193
- startCheckpoint: options.startCheckpoint || 0n,
194
- address: options.address,
195
- network: options.network || SuiNetwork.MAIN_NET,
196
- baseLabels: options.baseLabels,
197
- };
198
- }
199
- export class SuiAddressProcessor extends SuiBaseObjectsProcessor {
200
- static bind(options) {
201
- return new SuiAddressProcessor({ ...options, ownerType: MoveOnIntervalConfig_OwnerType.ADDRESS });
202
- }
203
- doHandle(handler, data, ctx) {
204
- return handler(data.objects, ctx);
205
- }
206
- }
207
- // export class SuiDynamicFieldObjectsProcessor extends SuiBaseObjectsProcessor<dynamic_field.Field<any, any>> {
208
- export class SuiObjectProcessor extends SuiBaseObjectsProcessor {
209
- static bind(options) {
210
- return new SuiObjectProcessor({
211
- address: options.objectId,
212
- network: options.network,
213
- startCheckpoint: options.startCheckpoint,
214
- ownerType: MoveOnIntervalConfig_OwnerType.OBJECT,
215
- baseLabels: options.baseLabels,
216
- });
217
- }
218
- doHandle(handler, data, ctx) {
219
- if (!data.self) {
220
- console.log(`Sui object not existed in ${ctx.slot}, please specific a start time`);
221
- return;
222
- }
223
- return handler(data.self, data.objects, ctx);
224
- }
225
- }
226
- export class SuiWrappedObjectProcessor extends SuiBaseObjectsProcessor {
227
- static bind(options) {
228
- return new SuiWrappedObjectProcessor({
229
- address: options.objectId,
230
- network: options.network,
231
- startCheckpoint: options.startCheckpoint,
232
- ownerType: MoveOnIntervalConfig_OwnerType.WRAPPED_OBJECT,
233
- baseLabels: options.baseLabels,
234
- });
235
- }
236
- doHandle(handler, data, ctx) {
237
- return handler(data.objects, ctx);
238
- }
239
- }
240
127
  //# sourceMappingURL=sui-processor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sui-processor.js","sourceRoot":"","sources":["../../src/sui/sui-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,eAAe,EACf,8BAA8B,GAE/B,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAA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EAAE,OAAO,CAAC,QAAQ;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,SAAS,EAAE,8BAA8B,CAAC,cAAc;YACxD,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAC,CAAA;IACJ,CAAC;IAES,QAAQ,CAChB,OAAwF,EACxF,IAAoB,EACpB,GAAsB;QAEtB,OAAO,OAAO,CAAC,IAAI,CAAC,OAA0B,EAAE,GAAG,CAAC,CAAA;IACtD,CAAC;CACF","sourcesContent":["import {\n Data_SuiCall,\n Data_SuiEvent,\n Data_SuiObject,\n HandleInterval,\n MoveFetchConfig,\n MoveOnIntervalConfig_OwnerType,\n ProcessResult,\n} from '@sentio/protos'\nimport { ListStateStorage, mergeProcessResults } from '@sentio/runtime'\nimport { SuiNetwork } from './network.js'\nimport { ServerError, Status } from 'nice-grpc'\nimport { SuiContext, SuiObjectsContext } from './context.js'\nimport {\n getProgrammableTransaction,\n getTransactionKind,\n MoveCallSuiTransaction,\n SuiEvent,\n SuiMoveObject,\n SuiTransactionBlockResponse,\n} from '@mysten/sui.js'\nimport {\n CallHandler,\n EventFilter,\n EventHandler,\n FunctionNameAndCallFilter,\n parseMoveType,\n SPLITTER,\n} from '../move/index.js'\nimport { getMoveCalls } from './utils.js'\nimport { defaultMoveCoder, MoveCoder } from './move-coder.js'\nimport { Labels, PromiseOrVoid } from '../core/index.js'\n// import { dynamic_field } from './builtin/0x2.js'\n\nconst DEFAULT_FETCH_CONFIG: MoveFetchConfig = {\n resourceChanges: false,\n allEvents: true,\n}\n\nclass IndexConfigure {\n address: string\n network: SuiNetwork\n startCheckpoint: bigint\n baseLabels?: Labels\n}\n\nexport class SuiBindOptions {\n address: string\n network?: SuiNetwork\n startCheckpoint?: bigint\n baseLabels?: Labels\n}\n\nexport class SuiObjectBindOptions {\n objectId: string\n network?: SuiNetwork\n startCheckpoint?: bigint\n baseLabels?: { [key: string]: string }\n}\n\nexport class SuiProcessorState extends ListStateStorage<SuiBaseProcessor> {\n static INSTANCE = new SuiProcessorState()\n}\n\nexport class SuiBaseProcessor {\n readonly moduleName: string\n config: IndexConfigure\n\n eventHandlers: EventHandler<Data_SuiEvent>[] = []\n callHandlers: CallHandler<Data_SuiCall>[] = []\n coder: MoveCoder\n\n constructor(name: string, options: SuiBindOptions) {\n this.moduleName = name\n this.config = configure(options)\n SuiProcessorState.INSTANCE.addValue(this)\n this.coder = defaultMoveCoder(this.config.network)\n }\n\n getChainId(): string {\n return this.config.network\n }\n\n public onMoveEvent(\n handler: (event: SuiEvent, ctx: SuiContext) => void,\n filter: EventFilter | EventFilter[],\n fetchConfig?: Partial<MoveFetchConfig>\n ): SuiBaseProcessor {\n let _filters: EventFilter[] = []\n const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })\n\n if (Array.isArray(filter)) {\n _filters = filter\n } else {\n _filters.push(filter)\n }\n\n // const address = this.config.address\n // const moduleName = this.moduleName\n\n const processor = this\n const allEventType = new Set(_filters.map((f) => processor.config.address + '::' + f.type))\n\n this.eventHandlers.push({\n handler: async function (data) {\n if (!data.transaction) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'event is null')\n }\n const txn = data.transaction as SuiTransactionBlockResponse\n if (!txn.events || !txn.events.length) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'no event in the transactions')\n }\n\n const processResults = []\n for (const [idx, evt] of (txn.events as SuiEvent[]).entries()) {\n const typeQname = parseMoveType(evt.type).qname\n if (!allEventType.has(typeQname)) {\n continue\n }\n\n const ctx = new SuiContext(\n processor.moduleName,\n processor.config.network,\n processor.config.address,\n data.timestamp || new Date(0),\n data.slot,\n txn,\n idx,\n processor.config.baseLabels\n )\n\n const decoded = await processor.coder.decodeEvent<any>(evt)\n await handler(decoded || evt, ctx)\n processResults.push(ctx.getProcessResult())\n }\n\n return mergeProcessResults(processResults)\n },\n filters: _filters,\n fetchConfig: _fetchConfig,\n })\n return this\n }\n\n public onEntryFunctionCall(\n handler: (call: MoveCallSuiTransaction, ctx: SuiContext) => void,\n filter: FunctionNameAndCallFilter | FunctionNameAndCallFilter[],\n fetchConfig?: Partial<MoveFetchConfig>\n ): SuiBaseProcessor {\n let _filters: FunctionNameAndCallFilter[] = []\n const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })\n\n if (Array.isArray(filter)) {\n _filters = filter\n } else {\n _filters.push(filter)\n }\n\n // const address = this.config.address\n // const moduleName = this.moduleName\n const processor = this\n const allFunctionType = new Set(_filters.map((f) => processor.config.address + '::' + f.function))\n\n this.callHandlers.push({\n handler: async function (data) {\n if (!data.transaction) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'call is null')\n }\n const tx = data.transaction as SuiTransactionBlockResponse\n\n const ctx = new SuiContext(\n processor.moduleName,\n processor.config.network,\n processor.config.address,\n data.timestamp || new Date(0),\n data.slot,\n tx,\n 0,\n processor.config.baseLabels\n )\n if (tx) {\n const calls: MoveCallSuiTransaction[] = getMoveCalls(tx)\n const txKind = getTransactionKind(tx)\n if (!txKind) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Unexpected getTransactionKind get empty')\n }\n const programmableTx = getProgrammableTransaction(txKind)\n\n // TODO potential pass index\n for (const call of calls) {\n const functionType = [call.package, call.module, call.function].join(SPLITTER)\n if (!allFunctionType.has(functionType)) {\n continue\n }\n\n // TODO maybe do in parallel\n const decoded = await processor.coder.decodeFunctionPayload(call, programmableTx?.inputs || [])\n await handler(decoded, ctx)\n }\n }\n return ctx.getProcessResult()\n },\n filters: _filters,\n fetchConfig: _fetchConfig,\n })\n return this\n }\n}\n\nclass ObjectHandler {\n type?: string\n versionInterval?: HandleInterval\n timeIntervalInMinutes?: HandleInterval\n handler: (resource: Data_SuiObject) => Promise<ProcessResult>\n}\n\nexport class SuiAccountProcessorState extends ListStateStorage<SuiBaseObjectsProcessor<any>> {\n static INSTANCE = new SuiAccountProcessorState()\n}\n\nclass SuiObjectsBindOptions extends SuiBindOptions {\n ownerType: MoveOnIntervalConfig_OwnerType\n}\n\nabstract class SuiBaseObjectsProcessor<HandlerType> {\n config: IndexConfigure\n ownerType: MoveOnIntervalConfig_OwnerType\n\n objectHandlers: ObjectHandler[] = []\n\n // static bind(options: SuiObjectsBindOptions): SuiBaseObjectsProcessor<any> {\n // return new SuiBaseObjectsProcessor(options)\n // }\n\n protected constructor(options: SuiObjectsBindOptions) {\n this.config = configure(options)\n this.ownerType = options.ownerType\n SuiAccountProcessorState.INSTANCE.addValue(this)\n }\n\n getChainId(): string {\n return this.config.network\n }\n\n // protected abstract transformObjects(objects: SuiMoveObject[]): SuiMoveObject[]\n\n protected abstract doHandle(handler: HandlerType, data: Data_SuiObject, ctx: SuiObjectsContext): PromiseOrVoid\n\n protected onInterval(\n handler: HandlerType, //(resources: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid,\n timeInterval: HandleInterval | undefined,\n versionInterval: HandleInterval | undefined,\n type: string | undefined\n ): this {\n const processor = this\n this.objectHandlers.push({\n handler: async function (data) {\n const ctx = new SuiObjectsContext(\n processor.config.network,\n processor.config.address,\n data.slot,\n data.timestamp || new Date(0),\n processor.config.baseLabels\n )\n await processor.doHandle(handler, data, ctx)\n return ctx.getProcessResult()\n },\n timeIntervalInMinutes: timeInterval,\n versionInterval: versionInterval,\n type,\n })\n return this\n }\n\n public onTimeInterval(\n handler: HandlerType,\n timeIntervalInMinutes = 60,\n backfillTimeIntervalInMinutes = 240,\n type?: string\n ): this {\n return this.onInterval(\n handler,\n {\n recentInterval: timeIntervalInMinutes,\n backfillInterval: backfillTimeIntervalInMinutes,\n },\n undefined,\n type\n )\n }\n\n public onSlotInterval(\n handler: HandlerType,\n slotInterval = 100000,\n backfillSlotInterval = 400000,\n type?: string\n ): this {\n return this.onInterval(\n handler,\n undefined,\n { recentInterval: slotInterval, backfillInterval: backfillSlotInterval },\n type\n )\n }\n}\n\nfunction configure(options: SuiBindOptions): IndexConfigure {\n return {\n startCheckpoint: options.startCheckpoint || 0n,\n address: options.address,\n network: options.network || SuiNetwork.MAIN_NET,\n baseLabels: options.baseLabels,\n }\n}\n\nexport class SuiAddressProcessor extends SuiBaseObjectsProcessor<\n (objects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid\n> {\n static bind(options: SuiBindOptions): SuiAddressProcessor {\n return new SuiAddressProcessor({ ...options, ownerType: MoveOnIntervalConfig_OwnerType.ADDRESS })\n }\n\n protected doHandle(\n handler: (objects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid,\n data: Data_SuiObject,\n ctx: SuiObjectsContext\n ): PromiseOrVoid {\n return handler(data.objects as SuiMoveObject[], ctx)\n }\n}\n// export class SuiDynamicFieldObjectsProcessor extends SuiBaseObjectsProcessor<dynamic_field.Field<any, any>> {\nexport class SuiObjectProcessor extends SuiBaseObjectsProcessor<\n (self: SuiMoveObject, dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid\n> {\n static bind(options: SuiObjectBindOptions): SuiObjectProcessor {\n return new SuiObjectProcessor({\n address: options.objectId,\n network: options.network,\n startCheckpoint: options.startCheckpoint,\n ownerType: MoveOnIntervalConfig_OwnerType.OBJECT,\n baseLabels: options.baseLabels,\n })\n }\n\n protected doHandle(\n handler: (self: SuiMoveObject, dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid,\n data: Data_SuiObject,\n ctx: SuiObjectsContext\n ): PromiseOrVoid {\n if (!data.self) {\n console.log(`Sui object not existed in ${ctx.slot}, please specific a start time`)\n return\n }\n return handler(data.self as SuiMoveObject, data.objects as SuiMoveObject[], ctx)\n }\n}\n\nexport class SuiWrappedObjectProcessor extends SuiBaseObjectsProcessor<\n (dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid\n> {\n static bind(options: SuiObjectBindOptions): SuiWrappedObjectProcessor {\n return new SuiWrappedObjectProcessor({\n address: options.objectId,\n network: options.network,\n startCheckpoint: options.startCheckpoint,\n ownerType: MoveOnIntervalConfig_OwnerType.WRAPPED_OBJECT,\n baseLabels: options.baseLabels,\n })\n }\n\n protected doHandle(\n handler: (dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid,\n data: Data_SuiObject,\n ctx: SuiObjectsContext\n ): PromiseOrVoid {\n return handler(data.objects as SuiMoveObject[], ctx)\n }\n}\n"]}
1
+ {"version":3,"file":"sui-processor.js","sourceRoot":"","sources":["../../src/sui/sui-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,GAInB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAKL,aAAa,EACb,QAAQ,GACT,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAa,MAAM,iBAAiB,CAAA;AAI7D,MAAM,oBAAoB,GAAoB;IAC5C,eAAe,EAAE,KAAK;IACtB,SAAS,EAAE,IAAI;CAChB,CAAA;AAID,MAAM,UAAU,SAAS,CAAC,OAAuB;IAC/C,OAAO;QACL,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,EAAE;QAC9C,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,UAAU,CAAC,QAAQ;QAC/C,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAA;AACH,CAAC;AASD,MAAa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,EACT,EAAE,EACF,CAAC,EACD,SAAS,CAAC,MAAM,CAAC,UAAU,CAC5B,CAAA;gBACD,IAAI,EAAE,EAAE;oBACN,MAAM,KAAK,GAA6B,YAAY,CAAC,EAAE,CAAC,CAAA;oBACxD,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAA;oBACrC,IAAI,CAAC,MAAM,EAAE;wBACX,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,gBAAgB,EAAE,yCAAyC,CAAC,CAAA;qBAC1F;oBACD,MAAM,cAAc,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAA;oBAEzD,4BAA4B;oBAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;wBACxB,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;wBAC9E,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;4BACtC,SAAQ;yBACT;wBAED,4BAA4B;wBAC5B,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,IAAI,EAAE,CAAC,CAAA;wBAC/F,MAAM,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;qBAC5B;iBACF;gBACD,OAAO,GAAG,CAAC,gBAAgB,EAAE,CAAA;YAC/B,CAAC;YACD,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,YAAY;SAC1B,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["import { Data_SuiCall, Data_SuiEvent, MoveFetchConfig } from '@sentio/protos'\nimport { ListStateStorage, mergeProcessResults } from '@sentio/runtime'\nimport { SuiNetwork } from './network.js'\nimport { ServerError, Status } from 'nice-grpc'\nimport { SuiContext } from './context.js'\nimport {\n getProgrammableTransaction,\n getTransactionKind,\n MoveCallSuiTransaction,\n SuiEvent,\n SuiTransactionBlockResponse,\n} from '@mysten/sui.js'\nimport {\n CallHandler,\n EventFilter,\n EventHandler,\n FunctionNameAndCallFilter,\n parseMoveType,\n SPLITTER,\n} from '../move/index.js'\nimport { getMoveCalls } from './utils.js'\nimport { defaultMoveCoder, MoveCoder } from './move-coder.js'\nimport { Labels } from '../core/index.js'\nimport { Required } from 'utility-types'\n\nconst DEFAULT_FETCH_CONFIG: MoveFetchConfig = {\n resourceChanges: false,\n allEvents: true,\n}\n\nexport type IndexConfigure = Required<SuiBindOptions, 'startCheckpoint' | 'network'>\n\nexport function configure(options: SuiBindOptions): IndexConfigure {\n return {\n startCheckpoint: options.startCheckpoint || 0n,\n address: options.address,\n network: options.network || SuiNetwork.MAIN_NET,\n baseLabels: options.baseLabels,\n }\n}\n\nexport interface SuiBindOptions {\n address: string\n network?: SuiNetwork\n startCheckpoint?: bigint\n baseLabels?: Labels\n}\n\nexport class SuiProcessorState extends ListStateStorage<SuiBaseProcessor> {\n static INSTANCE = new SuiProcessorState()\n}\n\nexport class SuiBaseProcessor {\n readonly moduleName: string\n config: IndexConfigure\n\n eventHandlers: EventHandler<Data_SuiEvent>[] = []\n callHandlers: CallHandler<Data_SuiCall>[] = []\n coder: MoveCoder\n\n constructor(name: string, options: SuiBindOptions) {\n this.moduleName = name\n this.config = configure(options)\n SuiProcessorState.INSTANCE.addValue(this)\n this.coder = defaultMoveCoder(this.config.network)\n }\n\n getChainId(): string {\n return this.config.network\n }\n\n public onMoveEvent(\n handler: (event: SuiEvent, ctx: SuiContext) => void,\n filter: EventFilter | EventFilter[],\n fetchConfig?: Partial<MoveFetchConfig>\n ): SuiBaseProcessor {\n let _filters: EventFilter[] = []\n const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })\n\n if (Array.isArray(filter)) {\n _filters = filter\n } else {\n _filters.push(filter)\n }\n\n // const address = this.config.address\n // const moduleName = this.moduleName\n\n const processor = this\n const allEventType = new Set(_filters.map((f) => processor.config.address + '::' + f.type))\n\n this.eventHandlers.push({\n handler: async function (data) {\n if (!data.transaction) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'event is null')\n }\n const txn = data.transaction as SuiTransactionBlockResponse\n if (!txn.events || !txn.events.length) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'no event in the transactions')\n }\n\n const processResults = []\n for (const [idx, evt] of (txn.events as SuiEvent[]).entries()) {\n const typeQname = parseMoveType(evt.type).qname\n if (!allEventType.has(typeQname)) {\n continue\n }\n\n const ctx = new SuiContext(\n processor.moduleName,\n processor.config.network,\n processor.config.address,\n data.timestamp || new Date(0),\n data.slot,\n txn,\n idx,\n processor.config.baseLabels\n )\n\n const decoded = await processor.coder.decodeEvent<any>(evt)\n await handler(decoded || evt, ctx)\n processResults.push(ctx.getProcessResult())\n }\n\n return mergeProcessResults(processResults)\n },\n filters: _filters,\n fetchConfig: _fetchConfig,\n })\n return this\n }\n\n public onEntryFunctionCall(\n handler: (call: MoveCallSuiTransaction, ctx: SuiContext) => void,\n filter: FunctionNameAndCallFilter | FunctionNameAndCallFilter[],\n fetchConfig?: Partial<MoveFetchConfig>\n ): SuiBaseProcessor {\n let _filters: FunctionNameAndCallFilter[] = []\n const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })\n\n if (Array.isArray(filter)) {\n _filters = filter\n } else {\n _filters.push(filter)\n }\n\n // const address = this.config.address\n // const moduleName = this.moduleName\n const processor = this\n const allFunctionType = new Set(_filters.map((f) => processor.config.address + '::' + f.function))\n\n this.callHandlers.push({\n handler: async function (data) {\n if (!data.transaction) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'call is null')\n }\n const tx = data.transaction as SuiTransactionBlockResponse\n\n const ctx = new SuiContext(\n processor.moduleName,\n processor.config.network,\n processor.config.address,\n data.timestamp || new Date(0),\n data.slot,\n tx,\n 0,\n processor.config.baseLabels\n )\n if (tx) {\n const calls: MoveCallSuiTransaction[] = getMoveCalls(tx)\n const txKind = getTransactionKind(tx)\n if (!txKind) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Unexpected getTransactionKind get empty')\n }\n const programmableTx = getProgrammableTransaction(txKind)\n\n // TODO potential pass index\n for (const call of calls) {\n const functionType = [call.package, call.module, call.function].join(SPLITTER)\n if (!allFunctionType.has(functionType)) {\n continue\n }\n\n // TODO maybe do in parallel\n const decoded = await processor.coder.decodeFunctionPayload(call, programmableTx?.inputs || [])\n await handler(decoded, ctx)\n }\n }\n return ctx.getProcessResult()\n },\n filters: _filters,\n fetchConfig: _fetchConfig,\n })\n return this\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/sdk",
3
- "version": "2.15.7-rc.1",
3
+ "version": "2.16.0-rc.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -69,9 +69,10 @@
69
69
  "superstruct_solana": "npm:superstruct@^0.14.2",
70
70
  "typechain": "^8.0.0",
71
71
  "typedoc": "^0.24.1",
72
+ "utility-types": "^3.10.0",
72
73
  "yaml": "^2.2.1",
73
- "@sentio/protos": "^2.15.7-rc.1",
74
- "@sentio/runtime": "^2.15.7-rc.1"
74
+ "@sentio/protos": "^2.16.0-rc.1",
75
+ "@sentio/runtime": "^2.16.0-rc.1"
75
76
  },
76
77
  "peerDependencies": {
77
78
  "tsup": "npm:@sentio/tsup@^6.7.0"
@@ -9,10 +9,10 @@ import {
9
9
  HandlerType,
10
10
  MoveCallHandlerConfig,
11
11
  MoveEventHandlerConfig,
12
+ MoveOwnerType,
12
13
  ProcessConfigResponse,
13
14
  ProcessResult,
14
15
  StartRequest,
15
- MoveOnIntervalConfig_OwnerType,
16
16
  } from '@sentio/protos'
17
17
 
18
18
  import { ServerError, Status } from 'nice-grpc'
@@ -100,19 +100,6 @@ export class AptosPlugin extends Plugin {
100
100
  })
101
101
  for (const handler of aptosProcessor.resourcesHandlers) {
102
102
  const handlerId = handlers.aptosResourceHandlers.push(handler.handler) - 1
103
- // TODO move to only use moveIntervalConfigs
104
- accountConfig.aptosIntervalConfigs.push({
105
- intervalConfig: {
106
- handlerId: handlerId,
107
- minutes: 0,
108
- minutesInterval: handler.timeIntervalInMinutes,
109
- slot: 0,
110
- slotInterval: handler.versionInterval,
111
- fetchConfig: undefined,
112
- },
113
- type: handler.type || '',
114
- })
115
-
116
103
  accountConfig.moveIntervalConfigs.push({
117
104
  intervalConfig: {
118
105
  handlerId: handlerId,
@@ -123,7 +110,8 @@ export class AptosPlugin extends Plugin {
123
110
  fetchConfig: undefined,
124
111
  },
125
112
  type: handler.type || '',
126
- ownerType: MoveOnIntervalConfig_OwnerType.ADDRESS,
113
+ ownerType: MoveOwnerType.ADDRESS,
114
+ fetchConfig: undefined,
127
115
  })
128
116
  }
129
117
  config.accountConfigs.push(accountConfig)
@@ -0,0 +1,6 @@
1
+ import { ListStateStorage } from '@sentio/runtime'
2
+ import { TemplateInstance } from '@sentio/protos'
3
+
4
+ export class TemplateInstanceState extends ListStateStorage<TemplateInstance> {
5
+ static INSTANCE = new TemplateInstanceState()
6
+ }
@@ -8,6 +8,7 @@ import { ListStateStorage } from '@sentio/runtime'
8
8
  import { BlockParams } from 'ethers/providers'
9
9
  import { DeferredTopicFilter } from 'ethers/contract'
10
10
  import { TypedEvent, TypedCallTrace } from './eth.js'
11
+ import { TemplateInstanceState } from '../core/template.js'
11
12
 
12
13
  export class ProcessorTemplateProcessorState extends ListStateStorage<
13
14
  BaseProcessorTemplate<BaseContract, BoundContractView<BaseContract, any>>
@@ -15,10 +16,6 @@ export class ProcessorTemplateProcessorState extends ListStateStorage<
15
16
  static INSTANCE = new ProcessorTemplateProcessorState()
16
17
  }
17
18
 
18
- export class TemplateInstanceState extends ListStateStorage<TemplateInstance> {
19
- static INSTANCE = new TemplateInstanceState()
20
- }
21
-
22
19
  export abstract class BaseProcessorTemplate<
23
20
  TContract extends BaseContract,
24
21
  TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>
@@ -53,9 +50,7 @@ export abstract class BaseProcessorTemplate<
53
50
  * @param ctx
54
51
  */
55
52
  public bind(options: BindOptions, ctx: EthContext): void {
56
- if (!options.network) {
57
- options.network = ctx.getChainId()
58
- }
53
+ options.network = options.network || ctx.chainId
59
54
  const sig = getOptionsSignature({
60
55
  address: options.address,
61
56
  network: options.network,
@@ -18,11 +18,12 @@ import {
18
18
  import { ServerError, Status } from 'nice-grpc'
19
19
  import { ProcessorState } from './binds.js'
20
20
  import { AccountProcessorState } from './account-processor-state.js'
21
- import { ProcessorTemplateProcessorState, TemplateInstanceState } from './base-processor-template.js'
21
+ import { ProcessorTemplateProcessorState } from './base-processor-template.js'
22
22
  import { GlobalProcessorState } from './base-processor.js'
23
23
  import { validateAndNormalizeAddress } from './eth.js'
24
24
  import { EthChainId } from '../core/chain.js'
25
25
  import { EthContext } from './context.js'
26
+ import { TemplateInstanceState } from '../core/template.js'
26
27
 
27
28
  interface Handlers {
28
29
  eventHandlers: ((event: Data_EthLog) => Promise<ProcessResult>)[]
@@ -244,7 +245,13 @@ export class EthPlugin extends Plugin {
244
245
 
245
246
  async start(request: StartRequest) {
246
247
  const ctx = new NoopContext()
248
+ const allowedChainIds = new Set<string>(Object.values(EthChainId))
249
+
247
250
  for (const instance of request.templateInstances) {
251
+ if (!allowedChainIds.has(instance.contract?.chainId || '')) {
252
+ continue
253
+ }
254
+
248
255
  const template = ProcessorTemplateProcessorState.INSTANCE.getValues()[instance.templateId]
249
256
  if (!template) {
250
257
  throw new ServerError(Status.INVALID_ARGUMENT, 'Invalid template contract:' + instance)
@@ -136,7 +136,7 @@ export abstract class AbstractMoveCoder<Network, ModuleType, StructType> {
136
136
  }
137
137
 
138
138
  // process vector
139
- if (type.qname === VECTOR_STR) {
139
+ if (type.qname.toLowerCase() === VECTOR_STR) {
140
140
  // vector<u8> as hex string
141
141
  if (type.typeArgs[0].qname === 'u8' || type.typeArgs[0].qname === 'U8') {
142
142
  return data
@@ -200,7 +200,7 @@ export abstract class AbstractMoveCoder<Network, ModuleType, StructType> {
200
200
  }
201
201
 
202
202
  // process vector
203
- if (type.qname === VECTOR_STR) {
203
+ if (type.qname.toLowerCase() === VECTOR_STR) {
204
204
  // vector<u8> as hex string
205
205
  if (type.typeArgs[0].qname === 'u8' || type.typeArgs[0].qname === 'U8') {
206
206
  return data
package/src/move/types.ts CHANGED
@@ -82,9 +82,11 @@ export class TypeDescriptor<T = any> {
82
82
  console.error('Not expected &')
83
83
  return []
84
84
  }
85
- // if (this.reference) {
86
- // return []
87
- // }
85
+
86
+ if (this.qname.toLowerCase() === VECTOR_STR) {
87
+ return this.typeArgs[0].dependedTypes()
88
+ }
89
+
88
90
  if (BUILTIN_TYPES_SET.has(this.qname.toLowerCase())) {
89
91
  return []
90
92
  }
@@ -106,9 +108,7 @@ export class TypeDescriptor<T = any> {
106
108
  param.dependedTypes().forEach((t) => types.add(t))
107
109
  }
108
110
 
109
- if (this.qname !== VECTOR_STR) {
110
- types.add(this.qname)
111
- }
111
+ types.add(this.qname)
112
112
 
113
113
  return Array.from(types)
114
114
  }
package/src/sui/index.ts CHANGED
@@ -1,4 +1,16 @@
1
- export * from './sui-processor.js'
1
+ export { SuiBaseProcessor, type SuiBindOptions } from './sui-processor.js'
2
+ export {
3
+ SuiAddressProcessor,
4
+ SuiObjectProcessor,
5
+ SuiWrappedObjectProcessor,
6
+ type SuiObjectBindOptions,
7
+ } from './sui-object-processor.js'
8
+
9
+ export {
10
+ // SuiAddressProcessorTemplate,
11
+ SuiObjectsProcessorTemplate,
12
+ SuiWrappedObjectProcessorTemplate,
13
+ } from './sui-objects-processor-template.js'
2
14
 
3
15
  export * from './network.js'
4
16
  export * from './context.js'
@@ -87,7 +87,7 @@ export function toTypeDescriptor(normalizedType: SuiMoveNormalizedType): TypeDes
87
87
  }
88
88
 
89
89
  if ('Vector' in normalizedType) {
90
- return new TypeDescriptor('vector', [toTypeDescriptor(normalizedType.Vector)])
90
+ return new TypeDescriptor('Vector', [toTypeDescriptor(normalizedType.Vector)])
91
91
  }
92
92
  if ('TypeParameter' in normalizedType) {
93
93
  return new TypeDescriptor('T' + normalizedType.TypeParameter)
@@ -0,0 +1,186 @@
1
+ import { Data_SuiObject, HandleInterval, MoveAccountFetchConfig, MoveOwnerType, ProcessResult } from '@sentio/protos'
2
+ import { ListStateStorage } from '@sentio/runtime'
3
+ import { SuiNetwork } from './network.js'
4
+ import { SuiObjectsContext } from './context.js'
5
+ import { SuiMoveObject } from '@mysten/sui.js'
6
+ import { PromiseOrVoid } from '../core/index.js'
7
+ import { configure, IndexConfigure, SuiBindOptions } from './sui-processor.js'
8
+
9
+ export interface SuiObjectBindOptions {
10
+ objectId: string
11
+ network?: SuiNetwork
12
+ startCheckpoint?: bigint
13
+ baseLabels?: { [key: string]: string }
14
+ }
15
+
16
+ interface ObjectHandler {
17
+ type?: string
18
+ versionInterval?: HandleInterval
19
+ timeIntervalInMinutes?: HandleInterval
20
+ fetchConfig: MoveAccountFetchConfig
21
+ handler: (resource: Data_SuiObject) => Promise<ProcessResult>
22
+ }
23
+
24
+ export const DEFAULT_FETCH_CONFIG: MoveAccountFetchConfig = {
25
+ owned: true,
26
+ }
27
+
28
+ export class SuiAccountProcessorState extends ListStateStorage<SuiBaseObjectsProcessor<any>> {
29
+ static INSTANCE = new SuiAccountProcessorState()
30
+ }
31
+
32
+ export interface SuiInternalObjectsBindOptions extends SuiBindOptions {
33
+ ownerType: MoveOwnerType
34
+ }
35
+
36
+ export abstract class SuiBaseObjectsProcessor<HandlerType> {
37
+ config: IndexConfigure
38
+ ownerType: MoveOwnerType
39
+
40
+ objectHandlers: ObjectHandler[] = []
41
+
42
+ // static bind(options: SuiObjectsBindOptions): SuiBaseObjectsProcessor<any> {
43
+ // return new SuiBaseObjectsProcessor(options)
44
+ // }
45
+
46
+ protected constructor(options: SuiInternalObjectsBindOptions) {
47
+ this.config = configure(options)
48
+ this.ownerType = options.ownerType
49
+ SuiAccountProcessorState.INSTANCE.addValue(this)
50
+ }
51
+
52
+ getChainId(): string {
53
+ return this.config.network
54
+ }
55
+
56
+ // protected abstract transformObjects(objects: SuiMoveObject[]): SuiMoveObject[]
57
+
58
+ protected abstract doHandle(handler: HandlerType, data: Data_SuiObject, ctx: SuiObjectsContext): PromiseOrVoid
59
+
60
+ public onInterval(
61
+ handler: HandlerType, //(resources: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid,
62
+ timeInterval: HandleInterval | undefined,
63
+ versionInterval: HandleInterval | undefined,
64
+ type: string | undefined,
65
+ fetchConfig: Partial<MoveAccountFetchConfig> | undefined
66
+ ): this {
67
+ const processor = this
68
+ this.objectHandlers.push({
69
+ handler: async function (data) {
70
+ const ctx = new SuiObjectsContext(
71
+ processor.config.network,
72
+ processor.config.address,
73
+ data.slot,
74
+ data.timestamp || new Date(0),
75
+ processor.config.baseLabels
76
+ )
77
+ await processor.doHandle(handler, data, ctx)
78
+ return ctx.getProcessResult()
79
+ },
80
+ timeIntervalInMinutes: timeInterval,
81
+ versionInterval: versionInterval,
82
+ type,
83
+ fetchConfig: { ...DEFAULT_FETCH_CONFIG, ...fetchConfig },
84
+ })
85
+ return this
86
+ }
87
+
88
+ public onTimeInterval(
89
+ handler: HandlerType,
90
+ timeIntervalInMinutes = 60,
91
+ backfillTimeIntervalInMinutes = 240,
92
+ type?: string,
93
+ fetchConfig?: Partial<MoveAccountFetchConfig>
94
+ ): this {
95
+ return this.onInterval(
96
+ handler,
97
+ {
98
+ recentInterval: timeIntervalInMinutes,
99
+ backfillInterval: backfillTimeIntervalInMinutes,
100
+ },
101
+ undefined,
102
+ type,
103
+ fetchConfig
104
+ )
105
+ }
106
+
107
+ public onSlotInterval(
108
+ handler: HandlerType,
109
+ slotInterval = 100000,
110
+ backfillSlotInterval = 400000,
111
+ type?: string,
112
+ fetchConfig?: Partial<MoveAccountFetchConfig>
113
+ ): this {
114
+ return this.onInterval(
115
+ handler,
116
+ undefined,
117
+ { recentInterval: slotInterval, backfillInterval: backfillSlotInterval },
118
+ type,
119
+ fetchConfig
120
+ )
121
+ }
122
+ }
123
+
124
+ export class SuiAddressProcessor extends SuiBaseObjectsProcessor<
125
+ (objects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid
126
+ > {
127
+ static bind(options: SuiBindOptions): SuiAddressProcessor {
128
+ return new SuiAddressProcessor({ ...options, ownerType: MoveOwnerType.ADDRESS })
129
+ }
130
+
131
+ protected doHandle(
132
+ handler: (objects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid,
133
+ data: Data_SuiObject,
134
+ ctx: SuiObjectsContext
135
+ ): PromiseOrVoid {
136
+ return handler(data.objects as SuiMoveObject[], ctx)
137
+ }
138
+ }
139
+
140
+ export class SuiObjectProcessor extends SuiBaseObjectsProcessor<
141
+ (self: SuiMoveObject, dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid
142
+ > {
143
+ static bind(options: SuiObjectBindOptions): SuiObjectProcessor {
144
+ return new SuiObjectProcessor({
145
+ address: options.objectId,
146
+ network: options.network,
147
+ startCheckpoint: options.startCheckpoint,
148
+ ownerType: MoveOwnerType.OBJECT,
149
+ baseLabels: options.baseLabels,
150
+ })
151
+ }
152
+
153
+ protected doHandle(
154
+ handler: (self: SuiMoveObject, dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid,
155
+ data: Data_SuiObject,
156
+ ctx: SuiObjectsContext
157
+ ): PromiseOrVoid {
158
+ if (!data.self) {
159
+ console.log(`Sui object not existed in ${ctx.slot}, please specific a start time`)
160
+ return
161
+ }
162
+ return handler(data.self as SuiMoveObject, data.objects as SuiMoveObject[], ctx)
163
+ }
164
+ }
165
+
166
+ export class SuiWrappedObjectProcessor extends SuiBaseObjectsProcessor<
167
+ (dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid
168
+ > {
169
+ static bind(options: SuiObjectBindOptions): SuiWrappedObjectProcessor {
170
+ return new SuiWrappedObjectProcessor({
171
+ address: options.objectId,
172
+ network: options.network,
173
+ startCheckpoint: options.startCheckpoint,
174
+ ownerType: MoveOwnerType.WRAPPED_OBJECT,
175
+ baseLabels: options.baseLabels,
176
+ })
177
+ }
178
+
179
+ protected doHandle(
180
+ handler: (dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid,
181
+ data: Data_SuiObject,
182
+ ctx: SuiObjectsContext
183
+ ): PromiseOrVoid {
184
+ return handler(data.objects as SuiMoveObject[], ctx)
185
+ }
186
+ }