@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.
- package/README.md +103 -17
- package/dist/adapters/expo.cjs +7 -6
- package/dist/adapters/expo.d.cts +4 -3
- package/dist/adapters/expo.d.ts +4 -3
- package/dist/adapters/expo.js +4 -3
- package/dist/{asyncStorageTaskQueue-DTBa8EH7.d.cts → asyncStorageTaskQueue-Bh2n0msM.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-DHMIxY04.d.ts → asyncStorageTaskQueue-CpkstKZ5.d.ts} +2 -2
- package/dist/base-C-Y5t_0F.d.cts +359 -0
- package/dist/base-C-Y5t_0F.d.ts +359 -0
- package/dist/{chunk-6CUP6ZIF.js → chunk-47Z4LEIW.js} +17 -841
- package/dist/chunk-47Z4LEIW.js.map +1 -0
- package/dist/{chunk-DNITZVNG.cjs → chunk-4X67IB2V.cjs} +18 -17
- package/dist/chunk-4X67IB2V.cjs.map +1 -0
- package/dist/{chunk-BTRCN4JJ.js → chunk-C7NY6WSA.js} +64 -4
- package/dist/chunk-C7NY6WSA.js.map +1 -0
- package/dist/{chunk-TUOLZBNC.js → chunk-DJYX73W2.js} +5 -4
- package/dist/chunk-DJYX73W2.js.map +1 -0
- package/dist/chunk-DNFTHG73.js +829 -0
- package/dist/chunk-DNFTHG73.js.map +1 -0
- package/dist/chunk-FDJ734CH.js +882 -0
- package/dist/chunk-FDJ734CH.js.map +1 -0
- package/dist/chunk-FLPWNMX3.cjs +930 -0
- package/dist/chunk-FLPWNMX3.cjs.map +1 -0
- package/dist/{chunk-WXNSISXK.cjs → chunk-HKEPJBTY.cjs} +79 -18
- package/dist/chunk-HKEPJBTY.cjs.map +1 -0
- package/dist/chunk-JFJNB7ZH.cjs +884 -0
- package/dist/chunk-JFJNB7ZH.cjs.map +1 -0
- package/dist/{chunk-GHUUT54D.cjs → chunk-LZAINCGU.cjs} +89 -933
- package/dist/chunk-LZAINCGU.cjs.map +1 -0
- package/dist/{chunk-E6OOJEHL.cjs → chunk-NDQ4LB4X.cjs} +60 -934
- package/dist/chunk-NDQ4LB4X.cjs.map +1 -0
- package/dist/{chunk-AG4TFD6F.js → chunk-QTMK34TP.js} +79 -884
- package/dist/chunk-QTMK34TP.js.map +1 -0
- package/dist/chunk-V3ZLL5VY.js +380 -0
- package/dist/chunk-V3ZLL5VY.js.map +1 -0
- package/dist/{chunk-MWVAWFX6.js → chunk-VWW2ZBPI.js} +4 -4
- package/dist/{chunk-MWVAWFX6.js.map → chunk-VWW2ZBPI.js.map} +1 -1
- package/dist/chunk-X6ZI53DZ.cjs +383 -0
- package/dist/chunk-X6ZI53DZ.cjs.map +1 -0
- package/dist/{chunk-F3FAE7VJ.cjs → chunk-Y3CDDPWI.cjs} +3138 -1764
- package/dist/chunk-Y3CDDPWI.cjs.map +1 -0
- package/dist/{chunk-ZJHLLDBP.js → chunk-YKT4NAQG.js} +2653 -1295
- package/dist/chunk-YKT4NAQG.js.map +1 -0
- package/dist/{chunk-B6VNKGIH.cjs → chunk-YS76JSGP.cjs} +10 -10
- package/dist/{chunk-B6VNKGIH.cjs.map → chunk-YS76JSGP.cjs.map} +1 -1
- package/dist/compiler.cjs +50 -0
- package/dist/compiler.cjs.map +1 -0
- package/dist/compiler.d.cts +38 -0
- package/dist/compiler.d.ts +38 -0
- package/dist/compiler.js +47 -0
- package/dist/compiler.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +11 -9
- package/dist/contracts/handlers/index.d.cts +6 -4
- package/dist/contracts/handlers/index.d.ts +6 -4
- package/dist/contracts/handlers/index.js +4 -2
- package/dist/{delegate-xrSBNybC.d.ts → delegate-gGkUnYpi.d.cts} +1 -1
- package/dist/{delegate-f4_t864Z.d.cts → delegate-iyDum4fw.d.ts} +1 -1
- package/dist/{index-BJDz15ms.d.ts → index-2wKMrT0a.d.ts} +5 -270
- package/dist/{index-BjiVGtp8.d.cts → index-46g577Ka.d.cts} +5 -270
- package/dist/{index-DRwe0UDN.d.cts → index-C66rjxz2.d.ts} +1603 -1721
- package/dist/{index-DRwe0UDN.d.ts → index-Dqk07NwJ.d.cts} +1603 -1721
- package/dist/index.cjs +457 -378
- package/dist/index.d.cts +640 -385
- package/dist/index.d.ts +640 -385
- package/dist/index.js +7 -4
- package/dist/{wallet-jVBDQl6R.d.cts → keyringDescriptorProvider-DiBM4GmB.d.ts} +417 -366
- package/dist/{wallet-Oc3Wd5gv.d.ts → keyringDescriptorProvider-DnaLUC7v.d.cts} +417 -366
- package/dist/program-BARSNg3X.d.ts +286 -0
- package/dist/program-znrWkxE4.d.cts +286 -0
- package/dist/repositories/realm/index.cjs +71 -51
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +20 -9
- package/dist/repositories/realm/index.d.ts +20 -9
- package/dist/repositories/realm/index.js +42 -23
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +81 -56
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +17 -8
- package/dist/repositories/sqlite/index.d.ts +17 -8
- package/dist/repositories/sqlite/index.js +55 -31
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-CDlNeth0.d.ts → taskRunner-BM6IAKlS.d.ts} +2 -2
- package/dist/{taskRunner-BPPU-YHG.d.cts → taskRunner-BmDIZiSl.d.cts} +2 -2
- package/dist/wallet/expo/background.cjs +17 -14
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +5 -4
- package/dist/wallet/expo/background.d.ts +5 -4
- package/dist/wallet/expo/background.js +9 -6
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +29 -16
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +12 -7
- package/dist/wallet/expo/index.d.ts +12 -7
- package/dist/wallet/expo/index.js +19 -6
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/worker/expo/index.cjs +12 -9
- package/dist/worker/expo/index.cjs.map +1 -1
- package/dist/worker/expo/index.d.cts +6 -5
- package/dist/worker/expo/index.d.ts +6 -5
- package/dist/worker/expo/index.js +8 -5
- package/dist/worker/expo/index.js.map +1 -1
- package/package.json +16 -1
- package/dist/chunk-6CUP6ZIF.js.map +0 -1
- package/dist/chunk-AG4TFD6F.js.map +0 -1
- package/dist/chunk-BTRCN4JJ.js.map +0 -1
- package/dist/chunk-DNITZVNG.cjs.map +0 -1
- package/dist/chunk-E6OOJEHL.cjs.map +0 -1
- package/dist/chunk-F3FAE7VJ.cjs.map +0 -1
- package/dist/chunk-GHUUT54D.cjs.map +0 -1
- package/dist/chunk-TUOLZBNC.js.map +0 -1
- package/dist/chunk-WXNSISXK.cjs.map +0 -1
- 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,
|
|
2
|
-
export { ChainedTxType } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import
|
|
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 =
|
|
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
|
-
|
|
746
|
-
|
|
747
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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.
|
|
896
|
-
intent.
|
|
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.
|
|
926
|
+
JSON.stringify(intent.proofInputs)
|
|
912
927
|
]
|
|
913
928
|
);
|
|
914
929
|
});
|
|
915
930
|
}
|
|
916
|
-
async
|
|
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.
|
|
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 (
|
|
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
|
-
|
|
957
|
-
|
|
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
|
-
|
|
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
|