@sentio/sdk-bundle 4.0.0-rc.2 → 4.0.0-rc.4

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 (63) hide show
  1. package/lib/aptos/builtin/0x1.js +3 -3
  2. package/lib/aptos/builtin/0x3.js +4 -4
  3. package/lib/aptos/builtin/0x4.js +4 -4
  4. package/lib/aptos/builtin/index.js +5 -5
  5. package/lib/aptos/ext/index.js +3 -3
  6. package/lib/aptos/index.js +3 -3
  7. package/lib/{chunk-VNXUTEH5.js → chunk-64VJOTAV.js} +3 -3
  8. package/lib/{chunk-JDDNTNMW.js → chunk-73XDTOXQ.js} +3 -3
  9. package/lib/{chunk-WNJOB743.js → chunk-BY3BQT7D.js} +5 -5
  10. package/lib/{chunk-DYJ5DRUM.js → chunk-CMAMXSG5.js} +4 -4
  11. package/lib/{chunk-XNXYRKKC.js → chunk-GEI3YMIY.js} +14 -12
  12. package/lib/{chunk-XNXYRKKC.js.map → chunk-GEI3YMIY.js.map} +1 -1
  13. package/lib/{chunk-3NOM4R2H.js → chunk-HJFLTWNH.js} +3 -3
  14. package/lib/{chunk-WPRZGK7B.js → chunk-ICMARO4X.js} +2 -2
  15. package/lib/{chunk-OO6XHT6W.js → chunk-IEDFDBJU.js} +3 -3
  16. package/lib/{chunk-3R7FPM4I.js → chunk-IQNHEJLA.js} +3 -3
  17. package/lib/{chunk-3DZXW5BS.js → chunk-KO6HMGBS.js} +5 -5
  18. package/lib/{chunk-TNDQS25D.js → chunk-ODKKD6SE.js} +2 -2
  19. package/lib/{chunk-KHLBFU74.js → chunk-QWAHDWYI.js} +4 -4
  20. package/lib/{chunk-4NGWL7IU.js → chunk-TWK53OHY.js} +2 -2
  21. package/lib/{chunk-37EAJXVT.js → chunk-X6UU7BKN.js} +7 -3
  22. package/lib/chunk-X6UU7BKN.js.map +1 -0
  23. package/lib/{chunk-YSP7DBWI.js → chunk-ZB3ENFMP.js} +2 -2
  24. package/lib/{chunk-BQAB4LZL.js → chunk-ZXKOL2ZE.js} +2 -2
  25. package/lib/eth/abi-decoder/decode-worker.js +1 -1
  26. package/lib/eth/builtin/eacaggregatorproxy.js +2 -2
  27. package/lib/eth/builtin/erc1155.js +3 -3
  28. package/lib/eth/builtin/erc20.js +2 -2
  29. package/lib/eth/builtin/erc721.js +2 -2
  30. package/lib/eth/builtin/index.js +4 -4
  31. package/lib/eth/builtin/weth9.js +3 -3
  32. package/lib/eth/index.js +2 -2
  33. package/lib/iota/builtin/0x1.js +6 -6
  34. package/lib/iota/builtin/0x2.js +7 -7
  35. package/lib/iota/builtin/0x3.js +8 -8
  36. package/lib/iota/builtin/index.js +8 -8
  37. package/lib/iota/ext/index.js +3 -3
  38. package/lib/iota/index.js +5 -5
  39. package/lib/sui/builtin/0x1.js +6 -6
  40. package/lib/sui/builtin/0x2.js +7 -7
  41. package/lib/sui/builtin/0x3.js +8 -8
  42. package/lib/sui/builtin/index.js +8 -8
  43. package/lib/sui/ext/index.js +3 -3
  44. package/lib/sui/index.js +5 -5
  45. package/lib/testing/index.js +109 -43
  46. package/lib/testing/index.js.map +1 -1
  47. package/lib/utils/index.js +2 -2
  48. package/package.json +2 -2
  49. package/lib/chunk-37EAJXVT.js.map +0 -1
  50. /package/lib/{chunk-VNXUTEH5.js.map → chunk-64VJOTAV.js.map} +0 -0
  51. /package/lib/{chunk-JDDNTNMW.js.map → chunk-73XDTOXQ.js.map} +0 -0
  52. /package/lib/{chunk-WNJOB743.js.map → chunk-BY3BQT7D.js.map} +0 -0
  53. /package/lib/{chunk-DYJ5DRUM.js.map → chunk-CMAMXSG5.js.map} +0 -0
  54. /package/lib/{chunk-3NOM4R2H.js.map → chunk-HJFLTWNH.js.map} +0 -0
  55. /package/lib/{chunk-WPRZGK7B.js.map → chunk-ICMARO4X.js.map} +0 -0
  56. /package/lib/{chunk-OO6XHT6W.js.map → chunk-IEDFDBJU.js.map} +0 -0
  57. /package/lib/{chunk-3R7FPM4I.js.map → chunk-IQNHEJLA.js.map} +0 -0
  58. /package/lib/{chunk-3DZXW5BS.js.map → chunk-KO6HMGBS.js.map} +0 -0
  59. /package/lib/{chunk-TNDQS25D.js.map → chunk-ODKKD6SE.js.map} +0 -0
  60. /package/lib/{chunk-KHLBFU74.js.map → chunk-QWAHDWYI.js.map} +0 -0
  61. /package/lib/{chunk-4NGWL7IU.js.map → chunk-TWK53OHY.js.map} +0 -0
  62. /package/lib/{chunk-YSP7DBWI.js.map → chunk-ZB3ENFMP.js.map} +0 -0
  63. /package/lib/{chunk-BQAB4LZL.js.map → chunk-ZXKOL2ZE.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
2
  import {
3
3
  AptosNetwork
4
- } from "../chunk-TNDQS25D.js";
4
+ } from "../chunk-ODKKD6SE.js";
5
5
  import "../chunk-EEZNVYCZ.js";
6
6
  import "../chunk-3CHN7BVE.js";
7
7
  import "../chunk-YNDNYJUQ.js";
@@ -13,21 +13,21 @@ import {
13
13
  import {
14
14
  getMoveCalls,
15
15
  getMoveCalls2
16
- } from "../chunk-3R7FPM4I.js";
16
+ } from "../chunk-IQNHEJLA.js";
17
17
  import {
18
18
  SuiNetwork
19
- } from "../chunk-4NGWL7IU.js";
19
+ } from "../chunk-TWK53OHY.js";
20
20
  import {
21
21
  IotaNetwork
22
- } from "../chunk-YSP7DBWI.js";
22
+ } from "../chunk-ZB3ENFMP.js";
23
23
  import "../chunk-QUAXYDJ7.js";
24
24
  import "../chunk-ZJYIROIV.js";
25
25
  import "../chunk-742S42NO.js";
26
26
  import "../chunk-7IDGS56O.js";
27
27
  import {
28
28
  bytesToBigInt
29
- } from "../chunk-37EAJXVT.js";
30
- import "../chunk-XNXYRKKC.js";
29
+ } from "../chunk-X6UU7BKN.js";
30
+ import "../chunk-GEI3YMIY.js";
31
31
  import "../chunk-5TTNJF6G.js";
32
32
  import {
33
33
  SPLITTER,
@@ -51,10 +51,12 @@ import {
51
51
  ProcessBindingResponseSchema,
52
52
  ProcessBindingsRequestSchema,
53
53
  ProcessConfigRequestSchema,
54
+ ProcessStreamRequestSchema,
54
55
  RichValueListSchema,
55
56
  RichValueSchema,
56
57
  StartRequestSchema,
57
58
  Store,
59
+ TemplateInstanceSchema,
58
60
  UpdateTemplatesRequestSchema,
59
61
  buildSchema,
60
62
  create,
@@ -9753,11 +9755,12 @@ var require_cjs = __commonJS({
9753
9755
 
9754
9756
  // src/testing/test-processor-server.ts
9755
9757
  import {
9758
+ DataBindingContext,
9756
9759
  Endpoints,
9760
+ mergeProcessResults,
9757
9761
  PluginManager as PluginManager2,
9758
- ProcessorServiceImpl,
9759
9762
  State,
9760
- StoreContext
9763
+ ProcessorServiceImplV3
9761
9764
  } from "@sentio/runtime";
9762
9765
 
9763
9766
  // src/testing/aptos-facet.ts
@@ -10731,7 +10734,7 @@ var MemoryDatabase = class {
10731
10734
  const entityName = entity[i];
10732
10735
  this.upsert(entityName, id, d);
10733
10736
  });
10734
- this.dbContext.result(create(DBResponseSchema, { opId: req.opId }));
10737
+ this.sendResult(request, create(DBResponseSchema, { opId: req.opId }));
10735
10738
  }
10736
10739
  if (req.op.case === "delete") {
10737
10740
  const { id, entity } = req.op.value;
@@ -10739,12 +10742,13 @@ var MemoryDatabase = class {
10739
10742
  const entityName = entity[idx];
10740
10743
  this.delete(entityName, i);
10741
10744
  });
10742
- this.dbContext.result(create(DBResponseSchema, { opId: req.opId }));
10745
+ this.sendResult(request, create(DBResponseSchema, { opId: req.opId }));
10743
10746
  }
10744
10747
  if (req.op.case === "get") {
10745
10748
  const { entity, id } = req.op.value;
10746
10749
  const data = this.getById(entity, id);
10747
- this.dbContext.result(
10750
+ this.sendResult(
10751
+ request,
10748
10752
  create(DBResponseSchema, {
10749
10753
  opId: req.opId,
10750
10754
  value: {
@@ -10761,7 +10765,8 @@ var MemoryDatabase = class {
10761
10765
  const list = this.listEntities(entity, filters);
10762
10766
  if (cursor) {
10763
10767
  const idx = parseInt(cursor);
10764
- this.dbContext.result(
10768
+ this.sendResult(
10769
+ request,
10765
10770
  create(DBResponseSchema, {
10766
10771
  opId: req.opId,
10767
10772
  value: { case: "entityList", value: { entities: list.slice(idx, idx + 1).map((d) => toEntity(d)) } },
@@ -10769,7 +10774,8 @@ var MemoryDatabase = class {
10769
10774
  })
10770
10775
  );
10771
10776
  } else {
10772
- this.dbContext.result(
10777
+ this.sendResult(
10778
+ request,
10773
10779
  create(DBResponseSchema, {
10774
10780
  opId: req.opId,
10775
10781
  value: { case: "entityList", value: { entities: list.length ? [toEntity(list[0])] : [] } },
@@ -10780,6 +10786,9 @@ var MemoryDatabase = class {
10780
10786
  }
10781
10787
  }
10782
10788
  }
10789
+ sendResult(request, response) {
10790
+ this.dbContext.result(response, request.processId);
10791
+ }
10783
10792
  reset() {
10784
10793
  this.db.clear();
10785
10794
  }
@@ -11118,6 +11127,7 @@ var TestProcessorServer = class {
11118
11127
  contractConfigs;
11119
11128
  accountConfigs;
11120
11129
  storeContext;
11130
+ nextProcessId = 1;
11121
11131
  aptos;
11122
11132
  eth;
11123
11133
  solana;
@@ -11128,7 +11138,7 @@ var TestProcessorServer = class {
11128
11138
  _db;
11129
11139
  constructor(loader, httpEndpoints = {}) {
11130
11140
  cleanTest();
11131
- this.service = new ProcessorServiceImpl(loader);
11141
+ this.service = new ProcessorServiceImplV3(loader);
11132
11142
  this.aptos = new AptosFacet(this);
11133
11143
  this.solana = new SolanaFacet(this);
11134
11144
  this.eth = new EthFacet(this);
@@ -11141,7 +11151,7 @@ var TestProcessorServer = class {
11141
11151
  Endpoints.INSTANCE.chainServer.set(k, http);
11142
11152
  }
11143
11153
  const subject = new import_rxjs.Subject();
11144
- this.storeContext = new TestStoreContext(subject, 1);
11154
+ this.storeContext = new TestStoreContext(subject, 1, this.service);
11145
11155
  this._db = new MemoryDatabase(this.storeContext);
11146
11156
  }
11147
11157
  async start(request = { templateInstances: [] }, context = TEST_CONTEXT) {
@@ -11155,7 +11165,8 @@ var TestProcessorServer = class {
11155
11165
  return res;
11156
11166
  }
11157
11167
  stop(request = create(EmptySchema), context = TEST_CONTEXT) {
11158
- return this.service.stop(request, context);
11168
+ this._db.stop();
11169
+ return request;
11159
11170
  }
11160
11171
  async getConfig(request = {}, context = TEST_CONTEXT) {
11161
11172
  const config = await this.service.getConfig(create(ProcessConfigRequestSchema, request), context);
@@ -11164,38 +11175,77 @@ var TestProcessorServer = class {
11164
11175
  }
11165
11176
  processBindings(request, context = TEST_CONTEXT) {
11166
11177
  const req = create(ProcessBindingsRequestSchema, request);
11167
- return PluginManager2.INSTANCE.dbContextLocalStorage.run(this.storeContext, async () => {
11168
- const ret = await this.service.processBindings(req, context);
11169
- if (ret.result?.states?.configUpdated) {
11178
+ return this.processBindingList(req.bindings, context);
11179
+ }
11180
+ async processBinding(request, context = TEST_CONTEXT) {
11181
+ return this.processBindingList([request], context);
11182
+ }
11183
+ async processBindingList(bindings, context = TEST_CONTEXT) {
11184
+ const results = [];
11185
+ for (const binding of bindings) {
11186
+ const result = await this.processBindingV3(binding, context);
11187
+ results.push(result);
11188
+ if (result.states?.configUpdated) {
11170
11189
  await PluginManager2.INSTANCE.updateTemplates(
11171
11190
  create(UpdateTemplatesRequestSchema, {
11172
- chainId: req.bindings[0].chainId,
11191
+ chainId: binding.chainId,
11173
11192
  templateInstances: this.storeContext.templateInstances
11174
11193
  })
11175
11194
  );
11176
11195
  }
11177
- return create(ProcessBindingResponseSchema, ret);
11196
+ }
11197
+ return create(ProcessBindingResponseSchema, {
11198
+ result: mergeProcessResults(results)
11178
11199
  });
11179
11200
  }
11180
- async processBinding(request, context = TEST_CONTEXT) {
11181
- const ret = await PluginManager2.INSTANCE.dbContextLocalStorage.run(this.storeContext, () => {
11182
- return this.service.processBindings(create(ProcessBindingsRequestSchema, { bindings: [request] }), context);
11201
+ processBindingV3(request, context) {
11202
+ const processId = this.nextProcessId++;
11203
+ const subject = this.storeContext.subject;
11204
+ return new Promise((resolve, reject) => {
11205
+ const subscription = subject.subscribe({
11206
+ next: /* @__PURE__ */ __name((response) => {
11207
+ if (response.processId !== processId) {
11208
+ return;
11209
+ }
11210
+ if (response.value?.case === "tplRequest") {
11211
+ this.storeContext.applyTemplateRequest(
11212
+ (response.value.value.templates ?? []).map((template) => create(TemplateInstanceSchema, template)),
11213
+ response.value.value.remove ?? false
11214
+ );
11215
+ }
11216
+ if (response.value?.case === "result") {
11217
+ subscription.unsubscribe();
11218
+ const result = response.value.value;
11219
+ if (result.states?.error) {
11220
+ reject(new Error(result.states.error));
11221
+ } else {
11222
+ resolve(result);
11223
+ }
11224
+ }
11225
+ }, "next"),
11226
+ error: /* @__PURE__ */ __name((e) => {
11227
+ subscription.unsubscribe();
11228
+ reject(e);
11229
+ }, "error")
11230
+ });
11231
+ this.service.handleRequest(
11232
+ create(ProcessStreamRequestSchema, {
11233
+ processId,
11234
+ value: {
11235
+ case: "binding",
11236
+ value: request
11237
+ }
11238
+ }),
11239
+ void 0,
11240
+ subject
11241
+ ).catch((e) => {
11242
+ subscription.unsubscribe();
11243
+ reject(e);
11244
+ });
11183
11245
  });
11184
- if (ret.result?.states?.configUpdated) {
11185
- await PluginManager2.INSTANCE.updateTemplates(
11186
- create(UpdateTemplatesRequestSchema, {
11187
- chainId: request.chainId,
11188
- templateInstances: this.storeContext.templateInstances
11189
- })
11190
- );
11191
- }
11192
- return create(ProcessBindingResponseSchema, ret);
11193
11246
  }
11194
11247
  processBindingsStream(requests, context) {
11195
- throw new Error("Method not implemented.");
11196
- }
11197
- preprocessBindingsStream(requests, context) {
11198
- throw new Error("Method not implemented.");
11248
+ return this.service.processBindingsStream(requests, context);
11199
11249
  }
11200
11250
  // processBindingsStream(request: AsyncIterable<ProcessStreamRequest>, context: HandlerContext) {
11201
11251
  // return this.service.processBindingsStream(request, context)
@@ -11207,16 +11257,30 @@ var TestProcessorServer = class {
11207
11257
  return this._db.store;
11208
11258
  }
11209
11259
  };
11210
- var TestStoreContext = class extends StoreContext {
11211
- constructor(subject, processId) {
11212
- super(subject, processId);
11213
- this.subject = subject;
11260
+ var TestStoreContext = class extends DataBindingContext {
11261
+ constructor(subject, processId, service) {
11262
+ super(processId, subject);
11263
+ this.service = service;
11214
11264
  }
11215
11265
  static {
11216
11266
  __name(this, "TestStoreContext");
11217
11267
  }
11218
11268
  templateInstances = [];
11219
- sendTemplateRequest(templates, remove) {
11269
+ result(dbResult, processId = this.processId) {
11270
+ super.result(dbResult);
11271
+ void this.service.handleRequest(
11272
+ create(ProcessStreamRequestSchema, {
11273
+ processId,
11274
+ value: {
11275
+ case: "dbResult",
11276
+ value: dbResult
11277
+ }
11278
+ }),
11279
+ void 0,
11280
+ this.subject
11281
+ );
11282
+ }
11283
+ applyTemplateRequest(templates, remove) {
11220
11284
  if (remove) {
11221
11285
  this.templateInstances = this.templateInstances.filter(
11222
11286
  (i) => !templates.find((t) => t.templateId === i.templateId && t.contract?.address === i.contract?.address)
@@ -11225,8 +11289,10 @@ var TestStoreContext = class extends StoreContext {
11225
11289
  this.templateInstances.push(...templates);
11226
11290
  }
11227
11291
  }
11292
+ sendTemplateRequest(templates, remove) {
11293
+ this.applyTemplateRequest(templates, remove);
11294
+ }
11228
11295
  sendTimeseriesRequest(timeseries) {
11229
- throw new Error("Method not implemented.");
11230
11296
  }
11231
11297
  };
11232
11298
  import("node:process").then((p) => p.stdout.write(""));