@pafi-dev/issuer 0.22.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1357,14 +1357,28 @@ function createPafiEstimatorClient(config) {
1357
1357
  }
1358
1358
 
1359
1359
  // src/indexer/types.ts
1360
- var InMemoryCursorStore = class {
1360
+ var InMemoryCursorStore = class _InMemoryCursorStore {
1361
1361
  cursor;
1362
+ /**
1363
+ * Child stores keyed by `forKey()`. Each child has its own cursor
1364
+ * (the H-05 fix), so a single InMemoryCursorStore can back N
1365
+ * PointIndexers in tests / single-process callers.
1366
+ */
1367
+ children = /* @__PURE__ */ new Map();
1362
1368
  async load() {
1363
1369
  return this.cursor;
1364
1370
  }
1365
1371
  async save(blockNumber) {
1366
1372
  this.cursor = blockNumber;
1367
1373
  }
1374
+ forKey(key) {
1375
+ let child = this.children.get(key);
1376
+ if (!child) {
1377
+ child = new _InMemoryCursorStore();
1378
+ this.children.set(key, child);
1379
+ }
1380
+ return child;
1381
+ }
1368
1382
  };
1369
1383
 
1370
1384
  // src/indexer/pointIndexer.ts
@@ -1628,7 +1642,7 @@ var BurnIndexer = class {
1628
1642
  provider;
1629
1643
  /**
1630
1644
  * The PointToken this indexer watches. Exposed so callers can key
1631
- * leader-election locks / cursor stores by token (audit H-04 fix).
1645
+ * leader-election locks / cursor stores by token
1632
1646
  */
1633
1647
  pointTokenAddress;
1634
1648
  ledger;
@@ -4757,6 +4771,13 @@ async function createIssuerService(config) {
4757
4771
  const sdkWrapperAddress = (0, import_core18.getContractAddresses)(config.chainId).mintFeeWrapper;
4758
4772
  const wrapperOverride = config.indexer?.mintFeeWrapperAddress;
4759
4773
  const resolvedWrapperAddress = wrapperOverride !== void 0 ? wrapperOverride : sdkWrapperAddress;
4774
+ const baseCursorStore = config.indexer?.cursorStore;
4775
+ const sharedCursorWithMultipleTokens = baseCursorStore !== void 0 && typeof baseCursorStore.forKey !== "function" && tokenAddresses.length > 1;
4776
+ if (sharedCursorWithMultipleTokens) {
4777
+ console.warn(
4778
+ `[@pafi-dev/issuer] cursorStore lacks forKey() and ${tokenAddresses.length} PointTokens are configured. All PointIndexers will share one cursor row, causing token-skipping (audit finding H-05). Implement IIndexerCursorStore.forKey to return per-token derived stores. This permissive path will be removed in a future major release.`
4779
+ );
4780
+ }
4760
4781
  const indexers = /* @__PURE__ */ new Map();
4761
4782
  for (const tokenAddress of tokenAddresses) {
4762
4783
  const indexerConfig = {
@@ -4770,8 +4791,10 @@ async function createIssuerService(config) {
4770
4791
  if (config.indexer?.fromBlock !== void 0) {
4771
4792
  indexerConfig.fromBlock = config.indexer.fromBlock;
4772
4793
  }
4773
- if (config.indexer?.cursorStore) {
4774
- indexerConfig.cursorStore = config.indexer.cursorStore;
4794
+ if (baseCursorStore) {
4795
+ indexerConfig.cursorStore = typeof baseCursorStore.forKey === "function" ? baseCursorStore.forKey(
4796
+ `point-indexer:${tokenAddress.toLowerCase()}`
4797
+ ) : baseCursorStore;
4775
4798
  }
4776
4799
  if (config.indexer?.confirmations !== void 0) {
4777
4800
  indexerConfig.confirmations = config.indexer.confirmations;
@@ -5067,7 +5090,7 @@ var MemoryRedemptionHistoryStore = class {
5067
5090
  };
5068
5091
 
5069
5092
  // src/index.ts
5070
- var PAFI_ISSUER_SDK_VERSION = true ? "0.22.1" : "dev";
5093
+ var PAFI_ISSUER_SDK_VERSION = true ? "0.23.0" : "dev";
5071
5094
  // Annotate the CommonJS export names for ESM import in node:
5072
5095
  0 && (module.exports = {
5073
5096
  AdapterMisconfiguredError,