@arkade-os/sdk 0.5.4 → 0.5.6

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 (112) hide show
  1. package/README.md +103 -17
  2. package/dist/adapters/expo.cjs +7 -6
  3. package/dist/adapters/expo.d.cts +4 -3
  4. package/dist/adapters/expo.d.ts +4 -3
  5. package/dist/adapters/expo.js +4 -3
  6. package/dist/{asyncStorageTaskQueue-DTBa8EH7.d.cts → asyncStorageTaskQueue-Bh2n0msM.d.cts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-DHMIxY04.d.ts → asyncStorageTaskQueue-CpkstKZ5.d.ts} +2 -2
  8. package/dist/base-C-Y5t_0F.d.cts +359 -0
  9. package/dist/base-C-Y5t_0F.d.ts +359 -0
  10. package/dist/{chunk-6CUP6ZIF.js → chunk-47Z4LEIW.js} +17 -841
  11. package/dist/chunk-47Z4LEIW.js.map +1 -0
  12. package/dist/{chunk-DNITZVNG.cjs → chunk-4X67IB2V.cjs} +18 -17
  13. package/dist/chunk-4X67IB2V.cjs.map +1 -0
  14. package/dist/{chunk-BTRCN4JJ.js → chunk-C7NY6WSA.js} +64 -4
  15. package/dist/chunk-C7NY6WSA.js.map +1 -0
  16. package/dist/{chunk-TUOLZBNC.js → chunk-DJYX73W2.js} +5 -4
  17. package/dist/chunk-DJYX73W2.js.map +1 -0
  18. package/dist/chunk-DNFTHG73.js +829 -0
  19. package/dist/chunk-DNFTHG73.js.map +1 -0
  20. package/dist/chunk-FDJ734CH.js +882 -0
  21. package/dist/chunk-FDJ734CH.js.map +1 -0
  22. package/dist/chunk-FLPWNMX3.cjs +930 -0
  23. package/dist/chunk-FLPWNMX3.cjs.map +1 -0
  24. package/dist/{chunk-WXNSISXK.cjs → chunk-HKEPJBTY.cjs} +79 -18
  25. package/dist/chunk-HKEPJBTY.cjs.map +1 -0
  26. package/dist/chunk-JFJNB7ZH.cjs +884 -0
  27. package/dist/chunk-JFJNB7ZH.cjs.map +1 -0
  28. package/dist/{chunk-GHUUT54D.cjs → chunk-LZAINCGU.cjs} +89 -933
  29. package/dist/chunk-LZAINCGU.cjs.map +1 -0
  30. package/dist/{chunk-E6OOJEHL.cjs → chunk-NDQ4LB4X.cjs} +60 -934
  31. package/dist/chunk-NDQ4LB4X.cjs.map +1 -0
  32. package/dist/{chunk-AG4TFD6F.js → chunk-QTMK34TP.js} +79 -884
  33. package/dist/chunk-QTMK34TP.js.map +1 -0
  34. package/dist/chunk-V3ZLL5VY.js +380 -0
  35. package/dist/chunk-V3ZLL5VY.js.map +1 -0
  36. package/dist/{chunk-MWVAWFX6.js → chunk-VWW2ZBPI.js} +4 -4
  37. package/dist/{chunk-MWVAWFX6.js.map → chunk-VWW2ZBPI.js.map} +1 -1
  38. package/dist/chunk-X6ZI53DZ.cjs +383 -0
  39. package/dist/chunk-X6ZI53DZ.cjs.map +1 -0
  40. package/dist/{chunk-F3FAE7VJ.cjs → chunk-Y3CDDPWI.cjs} +3138 -1764
  41. package/dist/chunk-Y3CDDPWI.cjs.map +1 -0
  42. package/dist/{chunk-ZJHLLDBP.js → chunk-YKT4NAQG.js} +2653 -1295
  43. package/dist/chunk-YKT4NAQG.js.map +1 -0
  44. package/dist/{chunk-B6VNKGIH.cjs → chunk-YS76JSGP.cjs} +10 -10
  45. package/dist/{chunk-B6VNKGIH.cjs.map → chunk-YS76JSGP.cjs.map} +1 -1
  46. package/dist/compiler.cjs +50 -0
  47. package/dist/compiler.cjs.map +1 -0
  48. package/dist/compiler.d.cts +38 -0
  49. package/dist/compiler.d.ts +38 -0
  50. package/dist/compiler.js +47 -0
  51. package/dist/compiler.js.map +1 -0
  52. package/dist/contracts/handlers/index.cjs +11 -9
  53. package/dist/contracts/handlers/index.d.cts +6 -4
  54. package/dist/contracts/handlers/index.d.ts +6 -4
  55. package/dist/contracts/handlers/index.js +4 -2
  56. package/dist/{delegate-xrSBNybC.d.ts → delegate-gGkUnYpi.d.cts} +1 -1
  57. package/dist/{delegate-f4_t864Z.d.cts → delegate-iyDum4fw.d.ts} +1 -1
  58. package/dist/{index-BJDz15ms.d.ts → index-2wKMrT0a.d.ts} +5 -270
  59. package/dist/{index-BjiVGtp8.d.cts → index-46g577Ka.d.cts} +5 -270
  60. package/dist/{index-DRwe0UDN.d.cts → index-C66rjxz2.d.ts} +1603 -1721
  61. package/dist/{index-DRwe0UDN.d.ts → index-Dqk07NwJ.d.cts} +1603 -1721
  62. package/dist/index.cjs +457 -378
  63. package/dist/index.d.cts +640 -385
  64. package/dist/index.d.ts +640 -385
  65. package/dist/index.js +7 -4
  66. package/dist/{wallet-jVBDQl6R.d.cts → keyringDescriptorProvider-DiBM4GmB.d.ts} +417 -366
  67. package/dist/{wallet-Oc3Wd5gv.d.ts → keyringDescriptorProvider-DnaLUC7v.d.cts} +417 -366
  68. package/dist/program-BARSNg3X.d.ts +286 -0
  69. package/dist/program-znrWkxE4.d.cts +286 -0
  70. package/dist/repositories/realm/index.cjs +71 -51
  71. package/dist/repositories/realm/index.cjs.map +1 -1
  72. package/dist/repositories/realm/index.d.cts +20 -9
  73. package/dist/repositories/realm/index.d.ts +20 -9
  74. package/dist/repositories/realm/index.js +42 -23
  75. package/dist/repositories/realm/index.js.map +1 -1
  76. package/dist/repositories/sqlite/index.cjs +81 -56
  77. package/dist/repositories/sqlite/index.cjs.map +1 -1
  78. package/dist/repositories/sqlite/index.d.cts +17 -8
  79. package/dist/repositories/sqlite/index.d.ts +17 -8
  80. package/dist/repositories/sqlite/index.js +55 -31
  81. package/dist/repositories/sqlite/index.js.map +1 -1
  82. package/dist/{taskRunner-CDlNeth0.d.ts → taskRunner-BM6IAKlS.d.ts} +2 -2
  83. package/dist/{taskRunner-BPPU-YHG.d.cts → taskRunner-BmDIZiSl.d.cts} +2 -2
  84. package/dist/wallet/expo/background.cjs +17 -14
  85. package/dist/wallet/expo/background.cjs.map +1 -1
  86. package/dist/wallet/expo/background.d.cts +5 -4
  87. package/dist/wallet/expo/background.d.ts +5 -4
  88. package/dist/wallet/expo/background.js +9 -6
  89. package/dist/wallet/expo/background.js.map +1 -1
  90. package/dist/wallet/expo/index.cjs +29 -16
  91. package/dist/wallet/expo/index.cjs.map +1 -1
  92. package/dist/wallet/expo/index.d.cts +12 -7
  93. package/dist/wallet/expo/index.d.ts +12 -7
  94. package/dist/wallet/expo/index.js +19 -6
  95. package/dist/wallet/expo/index.js.map +1 -1
  96. package/dist/worker/expo/index.cjs +12 -9
  97. package/dist/worker/expo/index.cjs.map +1 -1
  98. package/dist/worker/expo/index.d.cts +6 -5
  99. package/dist/worker/expo/index.d.ts +6 -5
  100. package/dist/worker/expo/index.js +8 -5
  101. package/dist/worker/expo/index.js.map +1 -1
  102. package/package.json +16 -1
  103. package/dist/chunk-6CUP6ZIF.js.map +0 -1
  104. package/dist/chunk-AG4TFD6F.js.map +0 -1
  105. package/dist/chunk-BTRCN4JJ.js.map +0 -1
  106. package/dist/chunk-DNITZVNG.cjs.map +0 -1
  107. package/dist/chunk-E6OOJEHL.cjs.map +0 -1
  108. package/dist/chunk-F3FAE7VJ.cjs.map +0 -1
  109. package/dist/chunk-GHUUT54D.cjs.map +0 -1
  110. package/dist/chunk-TUOLZBNC.js.map +0 -1
  111. package/dist/chunk-WXNSISXK.cjs.map +0 -1
  112. package/dist/chunk-ZJHLLDBP.js.map +0 -1
@@ -1,9 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkF3FAE7VJ_cjs = require('../../chunk-F3FAE7VJ.cjs');
4
- require('../../chunk-WXNSISXK.cjs');
5
- require('../../chunk-E6OOJEHL.cjs');
6
- var chunkGHUUT54D_cjs = require('../../chunk-GHUUT54D.cjs');
3
+ var chunkY3CDDPWI_cjs = require('../../chunk-Y3CDDPWI.cjs');
4
+ require('../../chunk-X6ZI53DZ.cjs');
5
+ require('../../chunk-HKEPJBTY.cjs');
6
+ require('../../chunk-NDQ4LB4X.cjs');
7
+ require('../../chunk-JFJNB7ZH.cjs');
8
+ var chunkLZAINCGU_cjs = require('../../chunk-LZAINCGU.cjs');
9
+ require('../../chunk-FLPWNMX3.cjs');
7
10
 
8
11
  // src/repositories/sqlite/transaction.ts
9
12
  var executorQueues = /* @__PURE__ */ new WeakMap();
@@ -239,7 +242,7 @@ var SQLiteWalletRepository = class {
239
242
  for (const row of nullRows) {
240
243
  await tx.run(
241
244
  `UPDATE ${this.tables.vtxos} SET script = ? WHERE txid = ? AND vout = ?`,
242
- [chunkF3FAE7VJ_cjs.scriptFromArkAddress(row.address), row.txid, row.vout]
245
+ [chunkY3CDDPWI_cjs.scriptFromArkAddress(row.address), row.txid, row.vout]
243
246
  );
244
247
  }
245
248
  const tempName = `${this.tables.vtxos}__migrate_tmp`;
@@ -280,7 +283,7 @@ var SQLiteWalletRepository = class {
280
283
  WHERE virtual_status_json IS NOT NULL AND is_swept IS NULL`
281
284
  );
282
285
  for (const row of rows) {
283
- const facts = chunkF3FAE7VJ_cjs.legacyVtxoFacts(row.virtual_status_json);
286
+ const facts = chunkY3CDDPWI_cjs.legacyVtxoFacts(row.virtual_status_json);
284
287
  if (!facts) continue;
285
288
  await tx.run(
286
289
  `UPDATE ${this.tables.vtxos}
@@ -372,7 +375,7 @@ var SQLiteWalletRepository = class {
372
375
  expires_at, expires_at_height,
373
376
  spent_by, settled_by, ark_tx_id, extra_witness_json, assets_json, script`,
374
377
  vtxos.map((vtxo) => {
375
- const s = chunkF3FAE7VJ_cjs.serializeVtxo(vtxo);
378
+ const s = chunkY3CDDPWI_cjs.serializeVtxo(vtxo);
376
379
  return [
377
380
  s.txid,
378
381
  s.vout,
@@ -384,7 +387,7 @@ var SQLiteWalletRepository = class {
384
387
  s.intentTapLeafScript.cb,
385
388
  s.intentTapLeafScript.s,
386
389
  JSON.stringify(s.status),
387
- chunkF3FAE7VJ_cjs.createdAtToIso(s.createdAt),
390
+ chunkY3CDDPWI_cjs.createdAtToIso(s.createdAt),
388
391
  s.isUnrolled ? 1 : 0,
389
392
  s.isSpent === void 0 ? null : s.isSpent ? 1 : 0,
390
393
  s.isSwept === void 0 ? null : s.isSwept ? 1 : 0,
@@ -407,7 +410,7 @@ var SQLiteWalletRepository = class {
407
410
  await this.db.run(`DELETE FROM ${this.tables.vtxos} WHERE address = ?`, [address]);
408
411
  }
409
412
  async getVtxosForScriptPage(script, page, options) {
410
- chunkF3FAE7VJ_cjs.assertPageRequest(page);
413
+ chunkY3CDDPWI_cjs.assertPageRequest(page);
411
414
  await this.ensureInit();
412
415
  const after = page.after;
413
416
  const rows = await this.db.all(
@@ -425,15 +428,15 @@ var SQLiteWalletRepository = class {
425
428
  page.limit + 1
426
429
  ] : [script, page.limit + 1]
427
430
  );
428
- const result = chunkF3FAE7VJ_cjs.pageResult(
431
+ const result = chunkY3CDDPWI_cjs.pageResult(
429
432
  rows.map((row) => ({ address: row.address, vtxo: vtxoRowToDomain(row) })),
430
433
  page.limit,
431
434
  (row) => ({ address: row.address, txid: row.vtxo.txid, vout: row.vtxo.vout })
432
435
  );
433
- return options?.unspentOnly ? { ...result, items: result.items.filter((row) => !chunkGHUUT54D_cjs.isVtxoSpent(row.vtxo)) } : result;
436
+ return options?.unspentOnly ? { ...result, items: result.items.filter((row) => !chunkLZAINCGU_cjs.isVtxoSpent(row.vtxo)) } : result;
434
437
  }
435
438
  async saveVtxosForScript(key, vtxos) {
436
- return this.saveVtxos(chunkF3FAE7VJ_cjs.checkSaveVtxosForScript("SQLiteWalletRepository", key, vtxos), vtxos);
439
+ return this.saveVtxos(chunkY3CDDPWI_cjs.checkSaveVtxosForScript("SQLiteWalletRepository", key, vtxos), vtxos);
437
440
  }
438
441
  async deleteVtxosForScript(script) {
439
442
  await this.ensureInit();
@@ -444,21 +447,21 @@ var SQLiteWalletRepository = class {
444
447
  return this.pageByAddress(this.tables.utxos, address, page, utxoRowToDomain);
445
448
  }
446
449
  async pageByAddress(table, address, page, deserialize) {
447
- chunkF3FAE7VJ_cjs.assertPageRequest(page);
450
+ chunkY3CDDPWI_cjs.assertPageRequest(page);
448
451
  await this.ensureInit();
449
452
  const rows = await this.db.all(
450
453
  `SELECT * FROM ${table} WHERE address = ? AND (txid, vout) > (?, ?)
451
454
  ORDER BY txid, vout LIMIT ?`,
452
455
  [address, page.after?.txid ?? "", page.after?.vout ?? -1, page.limit + 1]
453
456
  );
454
- const result = chunkF3FAE7VJ_cjs.pageResult(rows, page.limit, ({ txid, vout }) => ({ txid, vout }));
457
+ const result = chunkY3CDDPWI_cjs.pageResult(rows, page.limit, ({ txid, vout }) => ({ txid, vout }));
455
458
  return { items: result.items.map(deserialize), nextCursor: result.nextCursor };
456
459
  }
457
460
  async saveUtxos(addressOrBatch, utxos) {
458
461
  await this.ensureInit();
459
- const rows = chunkF3FAE7VJ_cjs.utxoEntries(addressOrBatch, utxos).flatMap(
462
+ const rows = chunkY3CDDPWI_cjs.utxoEntries(addressOrBatch, utxos).flatMap(
460
463
  ([address, list]) => list.map((utxo) => {
461
- const s = chunkF3FAE7VJ_cjs.serializeUtxo(utxo);
464
+ const s = chunkY3CDDPWI_cjs.serializeUtxo(utxo);
462
465
  return [
463
466
  s.txid,
464
467
  s.vout,
@@ -488,8 +491,8 @@ var SQLiteWalletRepository = class {
488
491
  }
489
492
  // ── Transaction history ────────────────────────────────────────────
490
493
  async getTransactionHistoryPage(filter, page) {
491
- chunkF3FAE7VJ_cjs.assertPageRequest(page);
492
- chunkF3FAE7VJ_cjs.assertHistoryPageFilter(filter);
494
+ chunkY3CDDPWI_cjs.assertPageRequest(page);
495
+ chunkY3CDDPWI_cjs.assertHistoryPageFilter(filter);
493
496
  await this.ensureInit();
494
497
  const conditions = ["address = ?"];
495
498
  const params = [filter.address];
@@ -513,7 +516,7 @@ var SQLiteWalletRepository = class {
513
516
  ORDER BY created_at, boarding_txid, commitment_txid, ark_txid LIMIT ?`,
514
517
  [...params, page.limit + 1]
515
518
  );
516
- return chunkF3FAE7VJ_cjs.pageResult(rows.map(txRowToDomain), page.limit, (tx) => ({
519
+ return chunkY3CDDPWI_cjs.pageResult(rows.map(txRowToDomain), page.limit, (tx) => ({
517
520
  createdAt: tx.createdAt,
518
521
  key: tx.key
519
522
  }));
@@ -533,7 +536,7 @@ var SQLiteWalletRepository = class {
533
536
  tx.amount,
534
537
  tx.settled ? 1 : 0,
535
538
  tx.createdAt,
536
- tx.assets ? JSON.stringify(chunkF3FAE7VJ_cjs.serializeAssets(tx.assets)) : null
539
+ tx.assets ? JSON.stringify(chunkY3CDDPWI_cjs.serializeAssets(tx.assets)) : null
537
540
  ])
538
541
  );
539
542
  }
@@ -555,7 +558,7 @@ var SQLiteWalletRepository = class {
555
558
  settings: row.settings_json ? JSON.parse(row.settings_json) : void 0,
556
559
  lastSyncTime: row.last_sync_time ?? void 0
557
560
  } : {};
558
- const state = chunkF3FAE7VJ_cjs.applyWalletStateUpdate(current, updater);
561
+ const state = chunkY3CDDPWI_cjs.applyWalletStateUpdate(current, updater);
559
562
  await tx.run(
560
563
  `INSERT OR REPLACE INTO ${this.tables.walletState}
561
564
  (key, settings_json, last_sync_time) VALUES (?, ?, ?)`,
@@ -628,9 +631,9 @@ function vtxoRowToDomain(row) {
628
631
  // Post-migration every row has `script`, but the backfill is
629
632
  // idempotent: derive from `address` if the legacy column is still
630
633
  // null (e.g. the migration hasn't run yet on this handle).
631
- script: row.script ?? chunkF3FAE7VJ_cjs.scriptFromArkAddress(row.address)
634
+ script: row.script ?? chunkY3CDDPWI_cjs.scriptFromArkAddress(row.address)
632
635
  };
633
- return chunkF3FAE7VJ_cjs.deserializeVtxo(serialized);
636
+ return chunkY3CDDPWI_cjs.deserializeVtxo(serialized);
634
637
  }
635
638
  function utxoRowToDomain(row) {
636
639
  const serialized = {
@@ -649,7 +652,7 @@ function utxoRowToDomain(row) {
649
652
  status: JSON.parse(row.status_json),
650
653
  extraWitness: row.extra_witness_json ? JSON.parse(row.extra_witness_json) : void 0
651
654
  };
652
- return chunkF3FAE7VJ_cjs.deserializeUtxo(serialized);
655
+ return chunkY3CDDPWI_cjs.deserializeUtxo(serialized);
653
656
  }
654
657
  function txRowToDomain(row) {
655
658
  const tx = {
@@ -664,7 +667,7 @@ function txRowToDomain(row) {
664
667
  createdAt: row.created_at
665
668
  };
666
669
  if (row.assets_json) {
667
- tx.assets = chunkF3FAE7VJ_cjs.deserializeAssets(JSON.parse(row.assets_json));
670
+ tx.assets = chunkY3CDDPWI_cjs.deserializeAssets(JSON.parse(row.assets_json));
668
671
  }
669
672
  return tx;
670
673
  }
@@ -672,7 +675,7 @@ function txRowToDomain(row) {
672
675
  // src/repositories/sqlite/contractRepository.ts
673
676
  var WATCH_STATE = "IFNULL(watch, 'watched')";
674
677
  var SQLiteContractRepository = class {
675
- version = 3;
678
+ version = 4;
676
679
  db;
677
680
  initPromise = null;
678
681
  prefix;
@@ -701,10 +704,12 @@ var SQLiteContractRepository = class {
701
704
  expires_at INTEGER,
702
705
  label TEXT,
703
706
  metadata_json TEXT,
704
- watch TEXT
707
+ watch TEXT,
708
+ scope TEXT
705
709
  )
706
710
  `);
707
711
  await this.addColumnIfMissing("watch", "TEXT");
712
+ await this.addColumnIfMissing("scope", "TEXT");
708
713
  await this.db.run(
709
714
  `CREATE INDEX IF NOT EXISTS idx_${this.prefix}contracts_type ON ${this.table} (type)`
710
715
  );
@@ -732,9 +737,9 @@ var SQLiteContractRepository = class {
732
737
  }
733
738
  // ── Contract management ────────────────────────────────────────────
734
739
  async getContractsPage(filter, page) {
735
- chunkF3FAE7VJ_cjs.assertPageRequest(page);
740
+ chunkY3CDDPWI_cjs.assertPageRequest(page);
736
741
  await this.ensureInit();
737
- if (chunkF3FAE7VJ_cjs.contractFilterMatchesNothing(filter)) return { items: [] };
742
+ if (chunkY3CDDPWI_cjs.contractFilterMatchesNothing(filter)) return { items: [] };
738
743
  const conditions = [];
739
744
  const params = [];
740
745
  if (filter) {
@@ -743,25 +748,31 @@ var SQLiteContractRepository = class {
743
748
  this.addFilterCondition(conditions, params, "type", filter.type);
744
749
  this.addFilterCondition(conditions, params, WATCH_STATE, filter.watch);
745
750
  }
746
- if (page.after !== void 0) {
747
- conditions.push("script > ?");
748
- params.push(page.after);
751
+ const wanted = filter?.scope === void 0 ? void 0 : [filter.scope].flat();
752
+ const matches = [];
753
+ let after = page.after;
754
+ for (; ; ) {
755
+ const where = [...conditions, ...after === void 0 ? [] : ["script > ?"]];
756
+ const rows = await this.db.all(
757
+ `SELECT * FROM ${this.table}${where.length ? ` WHERE ${where.join(" AND ")}` : ""} ORDER BY script LIMIT ?`,
758
+ [...params, ...after === void 0 ? [] : [after], page.limit + 1]
759
+ );
760
+ for (const contract of rows.map(contractRowToDomain)) {
761
+ if (!wanted || wanted.includes(chunkY3CDDPWI_cjs.scopeOf(contract))) matches.push(contract);
762
+ }
763
+ if (!wanted || rows.length <= page.limit || matches.length > page.limit) break;
764
+ after = rows[rows.length - 1].script;
749
765
  }
750
- const where = conditions.length ? ` WHERE ${conditions.join(" AND ")}` : "";
751
- const rows = await this.db.all(
752
- `SELECT * FROM ${this.table}${where} ORDER BY script LIMIT ?`,
753
- [...params, page.limit + 1]
754
- );
755
- return chunkF3FAE7VJ_cjs.pageResult(rows.map(contractRowToDomain), page.limit, (contract) => contract.script);
766
+ return chunkY3CDDPWI_cjs.pageResult(matches, page.limit, (contract) => contract.script);
756
767
  }
757
768
  async saveContract(contract) {
758
769
  await this.ensureInit();
759
770
  await this.db.run(
760
771
  `INSERT OR REPLACE INTO ${this.table}
761
772
  (script, address, type, state, params_json,
762
- created_at, label, metadata_json, watch)
773
+ created_at, label, metadata_json, watch, scope)
763
774
  VALUES (?, ?, ?, ?, ?,
764
- ?, ?, ?, ?)`,
775
+ ?, ?, ?, ?, ?)`,
765
776
  [
766
777
  contract.script,
767
778
  contract.address,
@@ -771,7 +782,8 @@ var SQLiteContractRepository = class {
771
782
  contract.createdAt,
772
783
  contract.label ?? null,
773
784
  contract.metadata ? JSON.stringify(contract.metadata) : null,
774
- contract.watch ?? null
785
+ contract.watch ?? null,
786
+ contract.scope ?? null
775
787
  ]
776
788
  );
777
789
  }
@@ -811,11 +823,14 @@ function contractRowToDomain(row) {
811
823
  if (row.watch !== null && row.watch !== void 0) {
812
824
  contract.watch = row.watch;
813
825
  }
826
+ if (row.scope !== null && row.scope !== void 0) {
827
+ contract.scope = row.scope;
828
+ }
814
829
  return contract;
815
830
  }
816
831
 
817
832
  // src/repositories/sqlite/intentRepository.ts
818
- var SQLiteIntentRepository = class {
833
+ var SQLiteBatchRegistrationRepository = class {
819
834
  version = 1;
820
835
  db;
821
836
  initPromise = null;
@@ -863,7 +878,7 @@ var SQLiteIntentRepository = class {
863
878
  await tx.run(`DELETE FROM ${this.t}`);
864
879
  });
865
880
  }
866
- async saveIntent(intent) {
881
+ async saveBatchRegistration(intent) {
867
882
  await this.ensureInit();
868
883
  const now = Date.now();
869
884
  await runInTransaction(this.db, async (tx) => {
@@ -893,8 +908,8 @@ var SQLiteIntentRepository = class {
893
908
  signer_descriptor = excluded.signer_descriptor,
894
909
  intent_vtxos_json = excluded.intent_vtxos_json`,
895
910
  [
896
- intent.intentTxId,
897
- intent.intentId ?? null,
911
+ intent.proofTxId,
912
+ intent.registrationId ?? null,
898
913
  intent.state,
899
914
  intent.validFrom ?? null,
900
915
  intent.validUntil ?? null,
@@ -909,13 +924,13 @@ var SQLiteIntentRepository = class {
909
924
  intent.cancellationReason ?? null,
910
925
  JSON.stringify(intent.partialForfeits),
911
926
  intent.signerDescriptor ?? null,
912
- JSON.stringify(intent.intentVtxos)
927
+ JSON.stringify(intent.proofInputs)
913
928
  ]
914
929
  );
915
930
  });
916
931
  }
917
- async getIntentsPage(filter, page) {
918
- chunkF3FAE7VJ_cjs.assertPageRequest(page);
932
+ async getBatchRegistrationsPage(filter, page) {
933
+ chunkY3CDDPWI_cjs.assertPageRequest(page);
919
934
  await this.ensureInit();
920
935
  if (filter?.states?.length === 0) return { items: [] };
921
936
  const stateSql = filter?.states ? ` AND state IN (${filter.states.map(() => "?").join(", ")})` : "";
@@ -932,30 +947,38 @@ var SQLiteIntentRepository = class {
932
947
  for (const row of batch) {
933
948
  after = row.intent_tx_id;
934
949
  const intent = rowToIntent(row);
935
- if (!filter || chunkF3FAE7VJ_cjs.intentMatchesFilter(intent, filter)) rows.push(intent);
950
+ if (!filter || chunkY3CDDPWI_cjs.intentMatchesFilter(intent, filter)) rows.push(intent);
936
951
  if (rows.length > page.limit) break;
937
952
  }
938
953
  if (batch.length < batchSize) break;
939
954
  }
940
- return chunkF3FAE7VJ_cjs.pageResult(rows, page.limit, (intent) => intent.intentTxId);
955
+ return chunkY3CDDPWI_cjs.pageResult(rows, page.limit, (intent) => intent.proofTxId);
941
956
  }
942
957
  async getLockedVtxoOutpoints() {
943
958
  await this.ensureInit();
944
959
  const rows = await this.db.all(`SELECT * FROM ${this.t}`);
945
960
  const out = [];
946
961
  for (const r of rows) {
947
- if (chunkF3FAE7VJ_cjs.isTerminalIntentState(r.state)) continue;
962
+ if (chunkY3CDDPWI_cjs.isTerminalBatchRegistrationState(r.state)) continue;
948
963
  for (const o of JSON.parse(r.intent_vtxos_json)) out.push(o);
949
964
  }
950
965
  return out;
951
966
  }
967
+ /** @deprecated Use {@link saveBatchRegistration}. */
968
+ saveIntent(intent) {
969
+ return this.saveBatchRegistration(intent);
970
+ }
971
+ /** @deprecated Use {@link getBatchRegistrationsPage}. */
972
+ getIntentsPage(filter, page) {
973
+ return this.getBatchRegistrationsPage(filter, page);
974
+ }
952
975
  async [Symbol.asyncDispose]() {
953
976
  }
954
977
  };
955
978
  function rowToIntent(r) {
956
979
  return {
957
- intentTxId: r.intent_tx_id,
958
- intentId: r.intent_id ?? void 0,
980
+ proofTxId: r.intent_tx_id,
981
+ registrationId: r.intent_id ?? void 0,
959
982
  state: r.state,
960
983
  validFrom: r.valid_from ?? void 0,
961
984
  validUntil: r.valid_until ?? void 0,
@@ -970,9 +993,10 @@ function rowToIntent(r) {
970
993
  cancellationReason: r.cancellation_reason ?? void 0,
971
994
  partialForfeits: JSON.parse(r.partial_forfeits_json),
972
995
  signerDescriptor: r.signer_descriptor ?? void 0,
973
- intentVtxos: JSON.parse(r.intent_vtxos_json)
996
+ proofInputs: JSON.parse(r.intent_vtxos_json)
974
997
  };
975
998
  }
999
+ var SQLiteIntentRepository = SQLiteBatchRegistrationRepository;
976
1000
 
977
1001
  // src/repositories/sqlite/virtualTxRepository.ts
978
1002
  var SQLiteVirtualTxRepository = class {
@@ -1031,7 +1055,7 @@ var SQLiteVirtualTxRepository = class {
1031
1055
  const prev = prevByTxid.get(t.txid);
1032
1056
  const psbt = t.psbt ?? prev?.psbt ?? null;
1033
1057
  const expires = t.expiresAt ?? prev?.expires_at ?? null;
1034
- const type = chunkF3FAE7VJ_cjs.mergeChainedTxType(t.type, prev?.type);
1058
+ const type = chunkY3CDDPWI_cjs.mergeChainedTxType(t.type, prev?.type);
1035
1059
  await tx.run(
1036
1060
  `INSERT OR REPLACE INTO ${this.tTx} (txid, psbt, expires_at, type) VALUES (?, ?, ?, ?)`,
1037
1061
  [t.txid, psbt, expires, type]
@@ -1117,8 +1141,9 @@ function rowToTx(r) {
1117
1141
 
1118
1142
  Object.defineProperty(exports, "ChainedTxType", {
1119
1143
  enumerable: true,
1120
- get: function () { return chunkF3FAE7VJ_cjs.ChainedTxType; }
1144
+ get: function () { return chunkY3CDDPWI_cjs.ChainedTxType; }
1121
1145
  });
1146
+ exports.SQLiteBatchRegistrationRepository = SQLiteBatchRegistrationRepository;
1122
1147
  exports.SQLiteContractRepository = SQLiteContractRepository;
1123
1148
  exports.SQLiteIntentRepository = SQLiteIntentRepository;
1124
1149
  exports.SQLiteVirtualTxRepository = SQLiteVirtualTxRepository;