@sentio/sdk-bundle 3.0.0-rc.1 → 3.0.0-rc.10

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 (80) hide show
  1. package/lib/aptos/builtin/0x1.js +4 -4
  2. package/lib/aptos/builtin/0x3.js +5 -5
  3. package/lib/aptos/builtin/0x4.js +5 -5
  4. package/lib/aptos/builtin/index.js +6 -6
  5. package/lib/aptos/ext/index.js +4 -4
  6. package/lib/aptos/index.js +4 -4
  7. package/lib/{chunk-Z3OVK6QB.js → chunk-2STWNSTL.js} +6 -6
  8. package/lib/{chunk-4PWO53D6.js → chunk-3ITGIG2T.js} +2 -2
  9. package/lib/{chunk-RKLKVIKG.js → chunk-6LNXUEZ2.js} +4 -4
  10. package/lib/{chunk-QMCOMHEJ.js → chunk-A5XHFKLN.js} +3 -3
  11. package/lib/{chunk-2B3QG2PQ.js → chunk-A66R5WXL.js} +5 -5
  12. package/lib/{chunk-NLWLT7E4.js → chunk-A74JLBVG.js} +6 -6
  13. package/lib/{chunk-JICWKAWE.js → chunk-BSJMBZ47.js} +115 -90
  14. package/lib/chunk-BSJMBZ47.js.map +1 -0
  15. package/lib/{chunk-GFXWNWKV.js → chunk-F6XB3TYA.js} +2 -2
  16. package/lib/{chunk-32ZLAKLP.js → chunk-FEELEM4F.js} +30 -28
  17. package/lib/chunk-FEELEM4F.js.map +1 -0
  18. package/lib/{chunk-PYNR7P4Y.js → chunk-IJ2DRUCB.js} +5 -5
  19. package/lib/{chunk-MYCRAKGM.js → chunk-LC6AHMNQ.js} +4 -4
  20. package/lib/{chunk-CKQ65UP3.js → chunk-NXC6YEPV.js} +743 -92
  21. package/lib/chunk-NXC6YEPV.js.map +1 -0
  22. package/lib/{chunk-MWMMJFFU.js → chunk-OZUIEBIK.js} +2 -2
  23. package/lib/{chunk-B6KGL4RM.js → chunk-PCOINDOU.js} +3 -3
  24. package/lib/{chunk-CMVQTOCD.js → chunk-QZHJK3ZR.js} +3 -3
  25. package/lib/{chunk-Y43QLE6P.js → chunk-RORSIMFS.js} +54 -51
  26. package/lib/{chunk-Y43QLE6P.js.map → chunk-RORSIMFS.js.map} +1 -1
  27. package/lib/{chunk-J3EJRPMJ.js → chunk-WXR4GY67.js} +56 -46
  28. package/lib/chunk-WXR4GY67.js.map +1 -0
  29. package/lib/{chunk-WRGMCWD4.js → chunk-Y55RCY7T.js} +2 -2
  30. package/lib/{chunk-LX4GT3SV.js → chunk-YAIMQUJB.js} +3 -3
  31. package/lib/core/index.js +1 -1
  32. package/lib/eth/builtin/eacaggregatorproxy.js +2 -2
  33. package/lib/eth/builtin/erc1155.js +3 -3
  34. package/lib/eth/builtin/erc20.js +2 -2
  35. package/lib/eth/builtin/erc721.js +2 -2
  36. package/lib/eth/builtin/index.js +4 -4
  37. package/lib/eth/builtin/weth9.js +3 -3
  38. package/lib/eth/index.js +2 -2
  39. package/lib/fuel/index.js +2 -2
  40. package/lib/index.js +1 -1
  41. package/lib/iota/builtin/0x1.js +7 -7
  42. package/lib/iota/builtin/0x2.js +8 -8
  43. package/lib/iota/builtin/0x3.js +9 -9
  44. package/lib/iota/builtin/index.js +9 -9
  45. package/lib/iota/ext/index.js +4 -4
  46. package/lib/iota/index.js +6 -6
  47. package/lib/move/index.js +2 -2
  48. package/lib/solana/builtin/index.js +2 -2
  49. package/lib/solana/index.js +2 -2
  50. package/lib/stark/index.js +1 -5
  51. package/lib/stark/index.js.map +1 -1
  52. package/lib/store/index.js +1 -1
  53. package/lib/sui/builtin/0x1.js +7 -7
  54. package/lib/sui/builtin/0x2.js +8 -8
  55. package/lib/sui/builtin/0x3.js +9 -9
  56. package/lib/sui/builtin/index.js +9 -9
  57. package/lib/sui/ext/index.js +4 -4
  58. package/lib/sui/index.js +6 -6
  59. package/lib/testing/index.js +63 -16
  60. package/lib/testing/index.js.map +1 -1
  61. package/lib/utils/index.js +2 -2
  62. package/package.json +3 -3
  63. package/lib/chunk-32ZLAKLP.js.map +0 -1
  64. package/lib/chunk-CKQ65UP3.js.map +0 -1
  65. package/lib/chunk-J3EJRPMJ.js.map +0 -1
  66. package/lib/chunk-JICWKAWE.js.map +0 -1
  67. /package/lib/{chunk-Z3OVK6QB.js.map → chunk-2STWNSTL.js.map} +0 -0
  68. /package/lib/{chunk-4PWO53D6.js.map → chunk-3ITGIG2T.js.map} +0 -0
  69. /package/lib/{chunk-RKLKVIKG.js.map → chunk-6LNXUEZ2.js.map} +0 -0
  70. /package/lib/{chunk-QMCOMHEJ.js.map → chunk-A5XHFKLN.js.map} +0 -0
  71. /package/lib/{chunk-2B3QG2PQ.js.map → chunk-A66R5WXL.js.map} +0 -0
  72. /package/lib/{chunk-NLWLT7E4.js.map → chunk-A74JLBVG.js.map} +0 -0
  73. /package/lib/{chunk-GFXWNWKV.js.map → chunk-F6XB3TYA.js.map} +0 -0
  74. /package/lib/{chunk-PYNR7P4Y.js.map → chunk-IJ2DRUCB.js.map} +0 -0
  75. /package/lib/{chunk-MYCRAKGM.js.map → chunk-LC6AHMNQ.js.map} +0 -0
  76. /package/lib/{chunk-MWMMJFFU.js.map → chunk-OZUIEBIK.js.map} +0 -0
  77. /package/lib/{chunk-B6KGL4RM.js.map → chunk-PCOINDOU.js.map} +0 -0
  78. /package/lib/{chunk-CMVQTOCD.js.map → chunk-QZHJK3ZR.js.map} +0 -0
  79. /package/lib/{chunk-WRGMCWD4.js.map → chunk-Y55RCY7T.js.map} +0 -0
  80. /package/lib/{chunk-LX4GT3SV.js.map → chunk-YAIMQUJB.js.map} +0 -0
@@ -36,10 +36,9 @@ import {
36
36
  PartitionHandlerManager,
37
37
  PreprocessResult,
38
38
  ProcessResult,
39
- TemplateInstanceState,
40
39
  normalizeLabels,
41
40
  scaleDown
42
- } from "./chunk-CKQ65UP3.js";
41
+ } from "./chunk-NXC6YEPV.js";
43
42
  import {
44
43
  require_lib
45
44
  } from "./chunk-6B74I6XD.js";
@@ -3438,6 +3437,23 @@ var BaseProcessor = class {
3438
3437
  if (processor.config.address === "*") {
3439
3438
  contractView.address = log.address;
3440
3439
  }
3440
+ const ctx = new ContractContext(
3441
+ contractName,
3442
+ contractView,
3443
+ chainId,
3444
+ data.timestamp,
3445
+ block,
3446
+ log,
3447
+ void 0,
3448
+ transaction,
3449
+ transactionReceipt,
3450
+ processor.config.baseLabels,
3451
+ preparedData
3452
+ );
3453
+ if (handlerOptions?.skipDecoding) {
3454
+ await handler(log, ctx);
3455
+ return ctx.stopAndGetResult();
3456
+ }
3441
3457
  let parsed = null;
3442
3458
  try {
3443
3459
  parsed = await getCachedParsedLog(data, processor, log);
@@ -3451,19 +3467,6 @@ var BaseProcessor = class {
3451
3467
  throw e;
3452
3468
  }
3453
3469
  if (parsed) {
3454
- const ctx = new ContractContext(
3455
- contractName,
3456
- contractView,
3457
- chainId,
3458
- data.timestamp,
3459
- block,
3460
- log,
3461
- void 0,
3462
- transaction,
3463
- transactionReceipt,
3464
- processor.config.baseLabels,
3465
- preparedData
3466
- );
3467
3470
  const event = { ...log, name: parsed.name, args: fixEmptyKey(parsed) };
3468
3471
  await handler(event, ctx);
3469
3472
  return ctx.stopAndGetResult();
@@ -3905,10 +3908,10 @@ var BaseProcessorTemplate = class {
3905
3908
  __name(this, "BaseProcessorTemplate");
3906
3909
  }
3907
3910
  id;
3908
- binds = /* @__PURE__ */ new Set();
3909
3911
  blockHandlers = [];
3910
3912
  traceHandlers = [];
3911
3913
  eventHandlers = [];
3914
+ instances = /* @__PURE__ */ new Set();
3912
3915
  constructor() {
3913
3916
  this.id = ProcessorTemplateProcessorState.INSTANCE.getValues().length;
3914
3917
  ProcessorTemplateProcessorState.INSTANCE.addValue(this);
@@ -3920,16 +3923,37 @@ var BaseProcessorTemplate = class {
3920
3923
  * @param ctx
3921
3924
  */
3922
3925
  bind(options, ctx) {
3926
+ options = { ...options, address: validateAndNormalizeAddress(options.address) };
3927
+ const instance = {
3928
+ templateId: this.id,
3929
+ contract: {
3930
+ address: options.address,
3931
+ name: options.name || "",
3932
+ chainId: ctx.chainId,
3933
+ abi: ""
3934
+ },
3935
+ startBlock: BigInt(options.startBlock || 0),
3936
+ endBlock: BigInt(options.endBlock || 0),
3937
+ baseLabels: options.baseLabels
3938
+ };
3939
+ ctx.sendTemplateInstance(instance);
3940
+ ctx.update({
3941
+ states: {
3942
+ configUpdated: true
3943
+ }
3944
+ });
3945
+ processMetrics2.processor_template_instance_count.add(1, { chain_id: ctx.chainId, template: this.constructor.name });
3946
+ }
3947
+ startInstance(options, ctx) {
3923
3948
  options = { ...options, address: validateAndNormalizeAddress(options.address) };
3924
3949
  const sig = getOptionsSignature({
3925
3950
  address: options.address,
3926
3951
  network: ctx.chainId
3927
3952
  });
3928
- if (this.binds.has(sig)) {
3929
- console.log(`Same address can be bind to one template only once, ignore duplicate bind: ${sig}`);
3953
+ if (this.instances.has(sig)) {
3954
+ console.debug(`Same address can be bind to one template only once, ignore duplicate bind: ${sig}`);
3930
3955
  return;
3931
3956
  }
3932
- this.binds.add(sig);
3933
3957
  const processor = this.bindInternal({ ...options, network: ctx.chainId });
3934
3958
  for (const eh of this.eventHandlers) {
3935
3959
  processor.onEthEvent(eh.handler, eh.filter, eh.fetchConfig, eh.preprocessHandler, eh.handlerName);
@@ -3947,25 +3971,7 @@ var BaseProcessorTemplate = class {
3947
3971
  bh.handlerName
3948
3972
  );
3949
3973
  }
3950
- const instance = {
3951
- templateId: this.id,
3952
- contract: {
3953
- address: options.address,
3954
- name: options.name || "",
3955
- chainId: ctx.chainId,
3956
- abi: ""
3957
- },
3958
- startBlock: BigInt(options.startBlock || 0),
3959
- endBlock: BigInt(options.endBlock || 0),
3960
- baseLabels: options.baseLabels
3961
- };
3962
- TemplateInstanceState.INSTANCE.addValue(instance);
3963
- ctx.update({
3964
- states: {
3965
- configUpdated: true
3966
- }
3967
- });
3968
- processMetrics2.processor_template_instance_count.add(1, { chain_id: ctx.chainId, template: this.constructor.name });
3974
+ this.instances.add(sig);
3969
3975
  }
3970
3976
  onEthEvent(handler, filter, fetchConfig, preprocessHandler = defaultPreprocessHandler) {
3971
3977
  this.eventHandlers.push({
@@ -12743,9 +12749,16 @@ var EthPlugin = class extends Plugin {
12743
12749
  if (forChainId !== void 0 && forChainId !== chainId.toString()) {
12744
12750
  continue;
12745
12751
  }
12746
- const provider = getProvider3(chainId);
12747
- const startBlock = await timeOrBlockToBlockNumber(provider, processor.config.start);
12748
- const endBlock = processor.config.end ? await timeOrBlockToBlockNumber(provider, processor.config.end) : void 0;
12752
+ let startBlock, endBlock;
12753
+ try {
12754
+ const provider = getProvider3(chainId);
12755
+ startBlock = await timeOrBlockToBlockNumber(provider, processor.config.start);
12756
+ endBlock = processor.config.end ? await timeOrBlockToBlockNumber(provider, processor.config.end) : void 0;
12757
+ } catch (e) {
12758
+ console.error("failed to get start/end block", e);
12759
+ startBlock = processor.config.start?.block != void 0 ? BigInt(processor.config.start.block) : void 0;
12760
+ endBlock = processor.config.end?.block != void 0 ? BigInt(processor.config.end.block) : void 0;
12761
+ }
12749
12762
  const contractConfig = ContractConfig.fromPartial({
12750
12763
  processorType: USER_PROCESSOR,
12751
12764
  contract: {
@@ -12946,7 +12959,7 @@ var EthPlugin = class extends Plugin {
12946
12959
  throw new import_nice_grpc3.ServerError(import_nice_grpc3.Status.INVALID_ARGUMENT, "Contract Empty from:" + instance);
12947
12960
  }
12948
12961
  const ctx = new NoopContext(instance.contract.chainId);
12949
- template.bind(
12962
+ template.startInstance(
12950
12963
  {
12951
12964
  name: instance.contract.name,
12952
12965
  address: validateAndNormalizeAddress(instance.contract.address),
@@ -12958,9 +12971,6 @@ var EthPlugin = class extends Plugin {
12958
12971
  );
12959
12972
  }
12960
12973
  }
12961
- stateDiff(config) {
12962
- return TemplateInstanceState.INSTANCE.getValues().length !== config.templateInstances.length;
12963
- }
12964
12974
  async processLog(request, preparedData) {
12965
12975
  if (!request.data?.ethLog?.log) {
12966
12976
  throw new import_nice_grpc3.ServerError(import_nice_grpc3.Status.INVALID_ARGUMENT, "Log can't be null");
@@ -14044,4 +14054,4 @@ js-sha3/src/sha3.js:
14044
14054
  * @license MIT
14045
14055
  *)
14046
14056
  */
14047
- //# sourceMappingURL=chunk-J3EJRPMJ.js.map
14057
+ //# sourceMappingURL=chunk-WXR4GY67.js.map