@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,8 +1,11 @@
1
- import { legacyVtxoFacts, serializeVtxo, createdAtToIso, assertPageRequest, pageResult, checkSaveVtxosForScript, utxoEntries, serializeUtxo, assertHistoryPageFilter, serializeAssets, scriptFromArkAddress, deserializeVtxo, deserializeUtxo, deserializeAssets, contractFilterMatchesNothing, intentMatchesFilter, isTerminalIntentState, applyWalletStateUpdate, mergeChainedTxType } from '../../chunk-ZJHLLDBP.js';
2
- export { ChainedTxType } from '../../chunk-ZJHLLDBP.js';
3
- import '../../chunk-BTRCN4JJ.js';
4
- import '../../chunk-6CUP6ZIF.js';
5
- import { isVtxoSpent } from '../../chunk-AG4TFD6F.js';
1
+ import { legacyVtxoFacts, serializeVtxo, createdAtToIso, assertPageRequest, pageResult, checkSaveVtxosForScript, utxoEntries, serializeUtxo, assertHistoryPageFilter, serializeAssets, scriptFromArkAddress, deserializeVtxo, deserializeUtxo, deserializeAssets, contractFilterMatchesNothing, scopeOf, intentMatchesFilter, isTerminalBatchRegistrationState, applyWalletStateUpdate, mergeChainedTxType } from '../../chunk-YKT4NAQG.js';
2
+ export { ChainedTxType } from '../../chunk-YKT4NAQG.js';
3
+ import '../../chunk-V3ZLL5VY.js';
4
+ import '../../chunk-C7NY6WSA.js';
5
+ import '../../chunk-47Z4LEIW.js';
6
+ import '../../chunk-DNFTHG73.js';
7
+ import { isVtxoSpent } from '../../chunk-QTMK34TP.js';
8
+ import '../../chunk-FDJ734CH.js';
6
9
 
7
10
  // src/repositories/sqlite/transaction.ts
8
11
  var executorQueues = /* @__PURE__ */ new WeakMap();
@@ -671,7 +674,7 @@ function txRowToDomain(row) {
671
674
  // src/repositories/sqlite/contractRepository.ts
672
675
  var WATCH_STATE = "IFNULL(watch, 'watched')";
673
676
  var SQLiteContractRepository = class {
674
- version = 3;
677
+ version = 4;
675
678
  db;
676
679
  initPromise = null;
677
680
  prefix;
@@ -700,10 +703,12 @@ var SQLiteContractRepository = class {
700
703
  expires_at INTEGER,
701
704
  label TEXT,
702
705
  metadata_json TEXT,
703
- watch TEXT
706
+ watch TEXT,
707
+ scope TEXT
704
708
  )
705
709
  `);
706
710
  await this.addColumnIfMissing("watch", "TEXT");
711
+ await this.addColumnIfMissing("scope", "TEXT");
707
712
  await this.db.run(
708
713
  `CREATE INDEX IF NOT EXISTS idx_${this.prefix}contracts_type ON ${this.table} (type)`
709
714
  );
@@ -742,25 +747,31 @@ var SQLiteContractRepository = class {
742
747
  this.addFilterCondition(conditions, params, "type", filter.type);
743
748
  this.addFilterCondition(conditions, params, WATCH_STATE, filter.watch);
744
749
  }
745
- if (page.after !== void 0) {
746
- conditions.push("script > ?");
747
- params.push(page.after);
750
+ const wanted = filter?.scope === void 0 ? void 0 : [filter.scope].flat();
751
+ const matches = [];
752
+ let after = page.after;
753
+ for (; ; ) {
754
+ const where = [...conditions, ...after === void 0 ? [] : ["script > ?"]];
755
+ const rows = await this.db.all(
756
+ `SELECT * FROM ${this.table}${where.length ? ` WHERE ${where.join(" AND ")}` : ""} ORDER BY script LIMIT ?`,
757
+ [...params, ...after === void 0 ? [] : [after], page.limit + 1]
758
+ );
759
+ for (const contract of rows.map(contractRowToDomain)) {
760
+ if (!wanted || wanted.includes(scopeOf(contract))) matches.push(contract);
761
+ }
762
+ if (!wanted || rows.length <= page.limit || matches.length > page.limit) break;
763
+ after = rows[rows.length - 1].script;
748
764
  }
749
- const where = conditions.length ? ` WHERE ${conditions.join(" AND ")}` : "";
750
- const rows = await this.db.all(
751
- `SELECT * FROM ${this.table}${where} ORDER BY script LIMIT ?`,
752
- [...params, page.limit + 1]
753
- );
754
- return pageResult(rows.map(contractRowToDomain), page.limit, (contract) => contract.script);
765
+ return pageResult(matches, page.limit, (contract) => contract.script);
755
766
  }
756
767
  async saveContract(contract) {
757
768
  await this.ensureInit();
758
769
  await this.db.run(
759
770
  `INSERT OR REPLACE INTO ${this.table}
760
771
  (script, address, type, state, params_json,
761
- created_at, label, metadata_json, watch)
772
+ created_at, label, metadata_json, watch, scope)
762
773
  VALUES (?, ?, ?, ?, ?,
763
- ?, ?, ?, ?)`,
774
+ ?, ?, ?, ?, ?)`,
764
775
  [
765
776
  contract.script,
766
777
  contract.address,
@@ -770,7 +781,8 @@ var SQLiteContractRepository = class {
770
781
  contract.createdAt,
771
782
  contract.label ?? null,
772
783
  contract.metadata ? JSON.stringify(contract.metadata) : null,
773
- contract.watch ?? null
784
+ contract.watch ?? null,
785
+ contract.scope ?? null
774
786
  ]
775
787
  );
776
788
  }
@@ -810,11 +822,14 @@ function contractRowToDomain(row) {
810
822
  if (row.watch !== null && row.watch !== void 0) {
811
823
  contract.watch = row.watch;
812
824
  }
825
+ if (row.scope !== null && row.scope !== void 0) {
826
+ contract.scope = row.scope;
827
+ }
813
828
  return contract;
814
829
  }
815
830
 
816
831
  // src/repositories/sqlite/intentRepository.ts
817
- var SQLiteIntentRepository = class {
832
+ var SQLiteBatchRegistrationRepository = class {
818
833
  version = 1;
819
834
  db;
820
835
  initPromise = null;
@@ -862,7 +877,7 @@ var SQLiteIntentRepository = class {
862
877
  await tx.run(`DELETE FROM ${this.t}`);
863
878
  });
864
879
  }
865
- async saveIntent(intent) {
880
+ async saveBatchRegistration(intent) {
866
881
  await this.ensureInit();
867
882
  const now = Date.now();
868
883
  await runInTransaction(this.db, async (tx) => {
@@ -892,8 +907,8 @@ var SQLiteIntentRepository = class {
892
907
  signer_descriptor = excluded.signer_descriptor,
893
908
  intent_vtxos_json = excluded.intent_vtxos_json`,
894
909
  [
895
- intent.intentTxId,
896
- intent.intentId ?? null,
910
+ intent.proofTxId,
911
+ intent.registrationId ?? null,
897
912
  intent.state,
898
913
  intent.validFrom ?? null,
899
914
  intent.validUntil ?? null,
@@ -908,12 +923,12 @@ var SQLiteIntentRepository = class {
908
923
  intent.cancellationReason ?? null,
909
924
  JSON.stringify(intent.partialForfeits),
910
925
  intent.signerDescriptor ?? null,
911
- JSON.stringify(intent.intentVtxos)
926
+ JSON.stringify(intent.proofInputs)
912
927
  ]
913
928
  );
914
929
  });
915
930
  }
916
- async getIntentsPage(filter, page) {
931
+ async getBatchRegistrationsPage(filter, page) {
917
932
  assertPageRequest(page);
918
933
  await this.ensureInit();
919
934
  if (filter?.states?.length === 0) return { items: [] };
@@ -936,25 +951,33 @@ var SQLiteIntentRepository = class {
936
951
  }
937
952
  if (batch.length < batchSize) break;
938
953
  }
939
- return pageResult(rows, page.limit, (intent) => intent.intentTxId);
954
+ return pageResult(rows, page.limit, (intent) => intent.proofTxId);
940
955
  }
941
956
  async getLockedVtxoOutpoints() {
942
957
  await this.ensureInit();
943
958
  const rows = await this.db.all(`SELECT * FROM ${this.t}`);
944
959
  const out = [];
945
960
  for (const r of rows) {
946
- if (isTerminalIntentState(r.state)) continue;
961
+ if (isTerminalBatchRegistrationState(r.state)) continue;
947
962
  for (const o of JSON.parse(r.intent_vtxos_json)) out.push(o);
948
963
  }
949
964
  return out;
950
965
  }
966
+ /** @deprecated Use {@link saveBatchRegistration}. */
967
+ saveIntent(intent) {
968
+ return this.saveBatchRegistration(intent);
969
+ }
970
+ /** @deprecated Use {@link getBatchRegistrationsPage}. */
971
+ getIntentsPage(filter, page) {
972
+ return this.getBatchRegistrationsPage(filter, page);
973
+ }
951
974
  async [Symbol.asyncDispose]() {
952
975
  }
953
976
  };
954
977
  function rowToIntent(r) {
955
978
  return {
956
- intentTxId: r.intent_tx_id,
957
- intentId: r.intent_id ?? void 0,
979
+ proofTxId: r.intent_tx_id,
980
+ registrationId: r.intent_id ?? void 0,
958
981
  state: r.state,
959
982
  validFrom: r.valid_from ?? void 0,
960
983
  validUntil: r.valid_until ?? void 0,
@@ -969,9 +992,10 @@ function rowToIntent(r) {
969
992
  cancellationReason: r.cancellation_reason ?? void 0,
970
993
  partialForfeits: JSON.parse(r.partial_forfeits_json),
971
994
  signerDescriptor: r.signer_descriptor ?? void 0,
972
- intentVtxos: JSON.parse(r.intent_vtxos_json)
995
+ proofInputs: JSON.parse(r.intent_vtxos_json)
973
996
  };
974
997
  }
998
+ var SQLiteIntentRepository = SQLiteBatchRegistrationRepository;
975
999
 
976
1000
  // src/repositories/sqlite/virtualTxRepository.ts
977
1001
  var SQLiteVirtualTxRepository = class {
@@ -1114,6 +1138,6 @@ function rowToTx(r) {
1114
1138
  };
1115
1139
  }
1116
1140
 
1117
- export { SQLiteContractRepository, SQLiteIntentRepository, SQLiteVirtualTxRepository, SQLiteWalletRepository, getSerializedExecutor, runInTransaction, sanitizeTablePrefix };
1141
+ export { SQLiteBatchRegistrationRepository, SQLiteContractRepository, SQLiteIntentRepository, SQLiteVirtualTxRepository, SQLiteWalletRepository, getSerializedExecutor, runInTransaction, sanitizeTablePrefix };
1118
1142
  //# sourceMappingURL=index.js.map
1119
1143
  //# sourceMappingURL=index.js.map