@arkade-os/sdk 0.5.4 → 0.5.5
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-BbH-THYJ.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-DHMIxY04.d.ts → asyncStorageTaskQueue-BlvkJyTa.d.ts} +1 -1
- package/dist/base-C-Y5t_0F.d.cts +359 -0
- package/dist/base-C-Y5t_0F.d.ts +359 -0
- package/dist/{chunk-AG4TFD6F.js → chunk-4I53THL6.js} +79 -884
- package/dist/chunk-4I53THL6.js.map +1 -0
- package/dist/{chunk-B6VNKGIH.cjs → chunk-5SYUEVJH.cjs} +10 -10
- package/dist/{chunk-B6VNKGIH.cjs.map → chunk-5SYUEVJH.cjs.map} +1 -1
- package/dist/{chunk-BTRCN4JJ.js → chunk-7GIKLFHC.js} +64 -4
- package/dist/chunk-7GIKLFHC.js.map +1 -0
- package/dist/{chunk-E6OOJEHL.cjs → chunk-AMH7Q3DF.cjs} +60 -934
- package/dist/chunk-AMH7Q3DF.cjs.map +1 -0
- package/dist/{chunk-6CUP6ZIF.js → chunk-BCA6D255.js} +17 -841
- package/dist/chunk-BCA6D255.js.map +1 -0
- package/dist/{chunk-TUOLZBNC.js → chunk-CE46RS6L.js} +5 -4
- package/dist/chunk-CE46RS6L.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-MWVAWFX6.js → chunk-FVVXCDNE.js} +4 -4
- package/dist/{chunk-MWVAWFX6.js.map → chunk-FVVXCDNE.js.map} +1 -1
- package/dist/{chunk-DNITZVNG.cjs → chunk-HQQ4NRXI.cjs} +18 -17
- package/dist/chunk-HQQ4NRXI.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-KCL5AVML.cjs} +89 -933
- package/dist/chunk-KCL5AVML.cjs.map +1 -0
- package/dist/{chunk-ZJHLLDBP.js → chunk-OO2KEK64.js} +2624 -1277
- package/dist/chunk-OO2KEK64.js.map +1 -0
- package/dist/{chunk-F3FAE7VJ.cjs → chunk-T254PXSN.cjs} +3115 -1752
- package/dist/chunk-T254PXSN.cjs.map +1 -0
- package/dist/chunk-V3ZLL5VY.js +380 -0
- package/dist/chunk-V3ZLL5VY.js.map +1 -0
- package/dist/chunk-X6ZI53DZ.cjs +383 -0
- package/dist/chunk-X6ZI53DZ.cjs.map +1 -0
- package/dist/{chunk-WXNSISXK.cjs → chunk-XWUCNMPN.cjs} +79 -18
- package/dist/chunk-XWUCNMPN.cjs.map +1 -0
- 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-BWwVnJhU.d.cts} +5 -270
- package/dist/{index-BjiVGtp8.d.cts → index-Bx-iArDs.d.ts} +5 -270
- package/dist/{index-DRwe0UDN.d.ts → index-DCml4QJn.d.ts} +1593 -1711
- package/dist/{index-DRwe0UDN.d.cts → index-DkyzIzKL.d.cts} +1593 -1711
- package/dist/index.cjs +457 -378
- package/dist/index.d.cts +633 -378
- package/dist/index.d.ts +633 -378
- package/dist/index.js +7 -4
- package/dist/{wallet-jVBDQl6R.d.cts → keyringDescriptorProvider-CS4w4PWd.d.ts} +412 -361
- package/dist/{wallet-Oc3Wd5gv.d.ts → keyringDescriptorProvider-CmHXrIXd.d.cts} +412 -361
- 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-DgMLSk_O.d.ts} +1 -1
- package/dist/{taskRunner-BPPU-YHG.d.cts → taskRunner-buh6aFpG.d.cts} +1 -1
- 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,9 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
|
|
3
|
+
var chunkT254PXSN_cjs = require('../../chunk-T254PXSN.cjs');
|
|
4
|
+
require('../../chunk-X6ZI53DZ.cjs');
|
|
5
|
+
require('../../chunk-XWUCNMPN.cjs');
|
|
6
|
+
require('../../chunk-AMH7Q3DF.cjs');
|
|
7
|
+
require('../../chunk-JFJNB7ZH.cjs');
|
|
8
|
+
var chunkKCL5AVML_cjs = require('../../chunk-KCL5AVML.cjs');
|
|
9
|
+
require('../../chunk-FLPWNMX3.cjs');
|
|
7
10
|
|
|
8
11
|
// src/repositories/realm/walletRepository.ts
|
|
9
12
|
var RealmWalletRepository = class {
|
|
@@ -39,7 +42,7 @@ var RealmWalletRepository = class {
|
|
|
39
42
|
await this.ensureInit();
|
|
40
43
|
this.realm.write(() => {
|
|
41
44
|
for (const vtxo of vtxos) {
|
|
42
|
-
const s =
|
|
45
|
+
const s = chunkT254PXSN_cjs.serializeVtxo(vtxo);
|
|
43
46
|
this.realm.create(
|
|
44
47
|
"ArkVtxo",
|
|
45
48
|
{
|
|
@@ -54,7 +57,7 @@ var RealmWalletRepository = class {
|
|
|
54
57
|
intentCb: s.intentTapLeafScript.cb,
|
|
55
58
|
intentS: s.intentTapLeafScript.s,
|
|
56
59
|
statusJson: JSON.stringify(s.status),
|
|
57
|
-
createdAt:
|
|
60
|
+
createdAt: chunkT254PXSN_cjs.createdAtToIso(s.createdAt),
|
|
58
61
|
isUnrolled: s.isUnrolled ?? false,
|
|
59
62
|
isSpent: s.isSpent === void 0 ? null : s.isSpent,
|
|
60
63
|
isSwept: s.isSwept === void 0 ? null : s.isSwept,
|
|
@@ -78,7 +81,7 @@ var RealmWalletRepository = class {
|
|
|
78
81
|
return this.deleteWhere("ArkVtxo", "address", address);
|
|
79
82
|
}
|
|
80
83
|
async getVtxosForScriptPage(script, page, options) {
|
|
81
|
-
|
|
84
|
+
chunkT254PXSN_cjs.assertPageRequest(page);
|
|
82
85
|
await this.ensureInit();
|
|
83
86
|
let results = this.realm.objects("ArkVtxo").filtered("script == $0", script);
|
|
84
87
|
if (options?.unspentOnly) {
|
|
@@ -105,15 +108,15 @@ var RealmWalletRepository = class {
|
|
|
105
108
|
rows.push({ address: row.address, vtxo: vtxoObjectToDomain(row) });
|
|
106
109
|
if (rows.length > page.limit) break;
|
|
107
110
|
}
|
|
108
|
-
const result =
|
|
111
|
+
const result = chunkT254PXSN_cjs.pageResult(rows, page.limit, (row) => ({
|
|
109
112
|
address: row.address,
|
|
110
113
|
txid: row.vtxo.txid,
|
|
111
114
|
vout: row.vtxo.vout
|
|
112
115
|
}));
|
|
113
|
-
return options?.unspentOnly ? { ...result, items: result.items.filter((row) => !
|
|
116
|
+
return options?.unspentOnly ? { ...result, items: result.items.filter((row) => !chunkKCL5AVML_cjs.isVtxoSpent(row.vtxo)) } : result;
|
|
114
117
|
}
|
|
115
118
|
async saveVtxosForScript(key, vtxos) {
|
|
116
|
-
return this.saveVtxos(
|
|
119
|
+
return this.saveVtxos(chunkT254PXSN_cjs.checkSaveVtxosForScript("RealmWalletRepository", key, vtxos), vtxos);
|
|
117
120
|
}
|
|
118
121
|
async deleteVtxosForScript(script) {
|
|
119
122
|
return this.deleteWhere("ArkVtxo", "script", script);
|
|
@@ -123,7 +126,7 @@ var RealmWalletRepository = class {
|
|
|
123
126
|
return this.pageByAddress("ArkUtxo", address, page, utxoObjectToDomain);
|
|
124
127
|
}
|
|
125
128
|
async pageByAddress(schema, address, page, deserialize) {
|
|
126
|
-
|
|
129
|
+
chunkT254PXSN_cjs.assertPageRequest(page);
|
|
127
130
|
await this.ensureInit();
|
|
128
131
|
let results = this.realm.objects(schema).filtered("address == $0", address);
|
|
129
132
|
if (page.after) {
|
|
@@ -141,18 +144,18 @@ var RealmWalletRepository = class {
|
|
|
141
144
|
rows.push({ key: { txid: row.txid, vout: row.vout }, item: deserialize(row) });
|
|
142
145
|
if (rows.length > page.limit) break;
|
|
143
146
|
}
|
|
144
|
-
const result =
|
|
147
|
+
const result = chunkT254PXSN_cjs.pageResult(rows, page.limit, (row) => row.key);
|
|
145
148
|
return { items: result.items.map((row) => row.item), nextCursor: result.nextCursor };
|
|
146
149
|
}
|
|
147
150
|
async saveUtxos(addressOrBatch, utxos) {
|
|
148
151
|
await this.ensureInit();
|
|
149
|
-
const rows =
|
|
152
|
+
const rows = chunkT254PXSN_cjs.utxoEntries(addressOrBatch, utxos).flatMap(
|
|
150
153
|
([address, list]) => list.map((utxo) => ({ address, utxo }))
|
|
151
154
|
);
|
|
152
155
|
if (rows.length === 0) return;
|
|
153
156
|
this.realm.write(() => {
|
|
154
157
|
for (const { address, utxo } of rows) {
|
|
155
|
-
const s =
|
|
158
|
+
const s = chunkT254PXSN_cjs.serializeUtxo(utxo);
|
|
156
159
|
this.realm.create(
|
|
157
160
|
"ArkUtxo",
|
|
158
161
|
{
|
|
@@ -179,8 +182,8 @@ var RealmWalletRepository = class {
|
|
|
179
182
|
}
|
|
180
183
|
// ── Transaction history ────────────────────────────────────────────
|
|
181
184
|
async getTransactionHistoryPage(filter, page) {
|
|
182
|
-
|
|
183
|
-
|
|
185
|
+
chunkT254PXSN_cjs.assertPageRequest(page);
|
|
186
|
+
chunkT254PXSN_cjs.assertHistoryPageFilter(filter);
|
|
184
187
|
let results = this.realm.objects("ArkTransaction").filtered("address == $0", filter.address);
|
|
185
188
|
results = results.filtered(
|
|
186
189
|
"createdAt >= $0",
|
|
@@ -194,12 +197,12 @@ var RealmWalletRepository = class {
|
|
|
194
197
|
["arkTxid", false]
|
|
195
198
|
])) {
|
|
196
199
|
const tx = txObjectToDomain(row);
|
|
197
|
-
if (page.after !== void 0 &&
|
|
200
|
+
if (page.after !== void 0 && chunkT254PXSN_cjs.compareHistoryCursors({ createdAt: tx.createdAt, key: tx.key }, page.after) <= 0)
|
|
198
201
|
continue;
|
|
199
202
|
rows.push(tx);
|
|
200
203
|
if (rows.length > page.limit) break;
|
|
201
204
|
}
|
|
202
|
-
return
|
|
205
|
+
return chunkT254PXSN_cjs.pageResult(rows, page.limit, (tx) => ({ createdAt: tx.createdAt, key: tx.key }));
|
|
203
206
|
}
|
|
204
207
|
async saveTransactions(address, txs) {
|
|
205
208
|
await this.ensureInit();
|
|
@@ -217,7 +220,7 @@ var RealmWalletRepository = class {
|
|
|
217
220
|
amount: tx.amount,
|
|
218
221
|
settled: tx.settled,
|
|
219
222
|
createdAt: tx.createdAt,
|
|
220
|
-
assetsJson: tx.assets ? JSON.stringify(
|
|
223
|
+
assetsJson: tx.assets ? JSON.stringify(chunkT254PXSN_cjs.serializeAssets(tx.assets)) : null
|
|
221
224
|
},
|
|
222
225
|
"modified"
|
|
223
226
|
);
|
|
@@ -247,7 +250,7 @@ var RealmWalletRepository = class {
|
|
|
247
250
|
settings: row.settingsJson ? JSON.parse(row.settingsJson) : void 0,
|
|
248
251
|
lastSyncTime: row.lastSyncTime ?? void 0
|
|
249
252
|
} : {};
|
|
250
|
-
const state =
|
|
253
|
+
const state = chunkT254PXSN_cjs.applyWalletStateUpdate(current, updater);
|
|
251
254
|
this.realm.create(
|
|
252
255
|
"ArkWalletState",
|
|
253
256
|
{
|
|
@@ -319,9 +322,9 @@ function vtxoObjectToDomain(obj) {
|
|
|
319
322
|
// Post-migration every row has `script`, but the backfill is
|
|
320
323
|
// idempotent: derive from `address` if the legacy column is still
|
|
321
324
|
// null (e.g. the migration hasn't run yet on this handle).
|
|
322
|
-
script: obj.script ??
|
|
325
|
+
script: obj.script ?? chunkT254PXSN_cjs.scriptFromArkAddress(obj.address)
|
|
323
326
|
};
|
|
324
|
-
return
|
|
327
|
+
return chunkT254PXSN_cjs.deserializeVtxo(serialized);
|
|
325
328
|
}
|
|
326
329
|
function utxoObjectToDomain(obj) {
|
|
327
330
|
const serialized = {
|
|
@@ -340,7 +343,7 @@ function utxoObjectToDomain(obj) {
|
|
|
340
343
|
status: JSON.parse(obj.statusJson),
|
|
341
344
|
extraWitness: obj.extraWitnessJson ? JSON.parse(obj.extraWitnessJson) : void 0
|
|
342
345
|
};
|
|
343
|
-
return
|
|
346
|
+
return chunkT254PXSN_cjs.deserializeUtxo(serialized);
|
|
344
347
|
}
|
|
345
348
|
function txObjectToDomain(obj) {
|
|
346
349
|
const tx = {
|
|
@@ -355,7 +358,7 @@ function txObjectToDomain(obj) {
|
|
|
355
358
|
createdAt: obj.createdAt
|
|
356
359
|
};
|
|
357
360
|
if (obj.assetsJson) {
|
|
358
|
-
tx.assets =
|
|
361
|
+
tx.assets = chunkT254PXSN_cjs.deserializeAssets(JSON.parse(obj.assetsJson));
|
|
359
362
|
}
|
|
360
363
|
return tx;
|
|
361
364
|
}
|
|
@@ -366,7 +369,7 @@ var RealmContractRepository = class {
|
|
|
366
369
|
this.realm = realm;
|
|
367
370
|
}
|
|
368
371
|
realm;
|
|
369
|
-
version =
|
|
372
|
+
version = 4;
|
|
370
373
|
// ── Lifecycle ──────────────────────────────────────────────────────
|
|
371
374
|
async ensureInit() {
|
|
372
375
|
}
|
|
@@ -381,9 +384,9 @@ var RealmContractRepository = class {
|
|
|
381
384
|
}
|
|
382
385
|
// ── Contract management ────────────────────────────────────────────
|
|
383
386
|
async getContractsPage(filter, page) {
|
|
384
|
-
|
|
385
|
-
if (
|
|
386
|
-
const toPage = (rows) =>
|
|
387
|
+
chunkT254PXSN_cjs.assertPageRequest(page);
|
|
388
|
+
if (chunkT254PXSN_cjs.contractFilterMatchesNothing(filter)) return { items: [] };
|
|
389
|
+
const toPage = (rows) => chunkT254PXSN_cjs.pageResult(rows.map(contractObjectToDomain), page.limit, (contract) => contract.script);
|
|
387
390
|
if (filter?.watch === void 0 || filter.script !== void 0) {
|
|
388
391
|
return toPage(this.readRows(filter, page));
|
|
389
392
|
}
|
|
@@ -417,6 +420,8 @@ var RealmContractRepository = class {
|
|
|
417
420
|
if (query) results = results.filtered(query, ...args);
|
|
418
421
|
const rows = [];
|
|
419
422
|
for (const row of results.sorted("script")) {
|
|
423
|
+
if (filter?.scope !== void 0 && ![filter.scope].flat().includes(chunkT254PXSN_cjs.scopeOf(contractObjectToDomain(row))))
|
|
424
|
+
continue;
|
|
420
425
|
rows.push(row);
|
|
421
426
|
if (rows.length > page.limit) break;
|
|
422
427
|
}
|
|
@@ -436,7 +441,8 @@ var RealmContractRepository = class {
|
|
|
436
441
|
createdAt: contract.createdAt,
|
|
437
442
|
label: contract.label ?? null,
|
|
438
443
|
metadataJson: contract.metadata ? JSON.stringify(contract.metadata) : null,
|
|
439
|
-
watch: contract.watch ?? null
|
|
444
|
+
watch: contract.watch ?? null,
|
|
445
|
+
scope: contract.scope ?? null
|
|
440
446
|
},
|
|
441
447
|
"modified"
|
|
442
448
|
);
|
|
@@ -499,14 +505,17 @@ function contractObjectToDomain(obj) {
|
|
|
499
505
|
if (obj.watch !== null && obj.watch !== void 0) {
|
|
500
506
|
contract.watch = obj.watch;
|
|
501
507
|
}
|
|
508
|
+
if (obj.scope !== null && obj.scope !== void 0) {
|
|
509
|
+
contract.scope = obj.scope;
|
|
510
|
+
}
|
|
502
511
|
return contract;
|
|
503
512
|
}
|
|
504
513
|
|
|
505
514
|
// src/repositories/realm/intentRepository.ts
|
|
506
515
|
function toIntent(o) {
|
|
507
516
|
return {
|
|
508
|
-
|
|
509
|
-
|
|
517
|
+
proofTxId: o.intentTxId,
|
|
518
|
+
registrationId: o.intentId ?? void 0,
|
|
510
519
|
state: o.state,
|
|
511
520
|
validFrom: o.validFrom ?? void 0,
|
|
512
521
|
validUntil: o.validUntil ?? void 0,
|
|
@@ -521,10 +530,10 @@ function toIntent(o) {
|
|
|
521
530
|
cancellationReason: o.cancellationReason ?? void 0,
|
|
522
531
|
partialForfeits: JSON.parse(o.partialForfeitsJson),
|
|
523
532
|
signerDescriptor: o.signerDescriptor ?? void 0,
|
|
524
|
-
|
|
533
|
+
proofInputs: JSON.parse(o.intentVtxosJson)
|
|
525
534
|
};
|
|
526
535
|
}
|
|
527
|
-
var
|
|
536
|
+
var RealmBatchRegistrationRepository = class {
|
|
528
537
|
constructor(realm) {
|
|
529
538
|
this.realm = realm;
|
|
530
539
|
}
|
|
@@ -535,19 +544,19 @@ var RealmIntentRepository = class {
|
|
|
535
544
|
this.realm.delete(this.realm.objects("ArkIntent"));
|
|
536
545
|
});
|
|
537
546
|
}
|
|
538
|
-
async
|
|
547
|
+
async saveBatchRegistration(intent) {
|
|
539
548
|
this.realm.write(() => {
|
|
540
|
-
if (intent.
|
|
549
|
+
if (intent.registrationId != null) {
|
|
541
550
|
const clashes = [
|
|
542
|
-
...this.realm.objects("ArkIntent").filtered("intentId == $0", intent.
|
|
551
|
+
...this.realm.objects("ArkIntent").filtered("intentId == $0", intent.registrationId)
|
|
543
552
|
].map(toIntent);
|
|
544
|
-
|
|
553
|
+
chunkT254PXSN_cjs.assertIntentIdUnique(intent, clashes);
|
|
545
554
|
}
|
|
546
555
|
this.realm.create(
|
|
547
556
|
"ArkIntent",
|
|
548
557
|
{
|
|
549
|
-
intentTxId: intent.
|
|
550
|
-
intentId: intent.
|
|
558
|
+
intentTxId: intent.proofTxId,
|
|
559
|
+
intentId: intent.registrationId ?? null,
|
|
551
560
|
state: intent.state,
|
|
552
561
|
validFrom: intent.validFrom ?? null,
|
|
553
562
|
validUntil: intent.validUntil ?? null,
|
|
@@ -562,34 +571,43 @@ var RealmIntentRepository = class {
|
|
|
562
571
|
cancellationReason: intent.cancellationReason ?? null,
|
|
563
572
|
partialForfeitsJson: JSON.stringify(intent.partialForfeits),
|
|
564
573
|
signerDescriptor: intent.signerDescriptor ?? null,
|
|
565
|
-
intentVtxosJson: JSON.stringify(intent.
|
|
574
|
+
intentVtxosJson: JSON.stringify(intent.proofInputs)
|
|
566
575
|
},
|
|
567
576
|
"modified"
|
|
568
577
|
);
|
|
569
578
|
});
|
|
570
579
|
}
|
|
571
|
-
async
|
|
572
|
-
|
|
580
|
+
async getBatchRegistrationsPage(filter, page) {
|
|
581
|
+
chunkT254PXSN_cjs.assertPageRequest(page);
|
|
573
582
|
let results = this.realm.objects("ArkIntent");
|
|
574
583
|
if (page.after !== void 0) results = results.filtered("intentTxId > $0", page.after);
|
|
575
584
|
const rows = [];
|
|
576
585
|
for (const row of results.sorted("intentTxId")) {
|
|
577
586
|
const intent = toIntent(row);
|
|
578
|
-
if (filter && !
|
|
587
|
+
if (filter && !chunkT254PXSN_cjs.intentMatchesFilter(intent, filter)) continue;
|
|
579
588
|
rows.push(intent);
|
|
580
589
|
if (rows.length > page.limit) break;
|
|
581
590
|
}
|
|
582
|
-
return
|
|
591
|
+
return chunkT254PXSN_cjs.pageResult(rows, page.limit, (intent) => intent.proofTxId);
|
|
583
592
|
}
|
|
584
593
|
async getLockedVtxoOutpoints() {
|
|
585
594
|
const out = [];
|
|
586
595
|
for (const o of [...this.realm.objects("ArkIntent")].map(toIntent))
|
|
587
|
-
if (!
|
|
596
|
+
if (!chunkT254PXSN_cjs.isTerminalIntentState(o.state)) out.push(...o.proofInputs);
|
|
588
597
|
return out;
|
|
589
598
|
}
|
|
599
|
+
/** @deprecated Use {@link saveBatchRegistration}. */
|
|
600
|
+
saveIntent(intent) {
|
|
601
|
+
return this.saveBatchRegistration(intent);
|
|
602
|
+
}
|
|
603
|
+
/** @deprecated Use {@link getBatchRegistrationsPage}. */
|
|
604
|
+
getIntentsPage(filter, page) {
|
|
605
|
+
return this.getBatchRegistrationsPage(filter, page);
|
|
606
|
+
}
|
|
590
607
|
async [Symbol.asyncDispose]() {
|
|
591
608
|
}
|
|
592
609
|
};
|
|
610
|
+
var RealmIntentRepository = RealmBatchRegistrationRepository;
|
|
593
611
|
|
|
594
612
|
// src/repositories/realm/virtualTxRepository.ts
|
|
595
613
|
var vtxoKey = (o) => `${o.txid}:${o.vout}`;
|
|
@@ -626,7 +644,7 @@ var RealmVirtualTxRepository = class {
|
|
|
626
644
|
txid: t.txid,
|
|
627
645
|
psbt: t.psbt ?? prev?.psbt ?? null,
|
|
628
646
|
expiresAt: t.expiresAt ?? prev?.expiresAt ?? null,
|
|
629
|
-
type:
|
|
647
|
+
type: chunkT254PXSN_cjs.mergeChainedTxType(t.type, prev?.type)
|
|
630
648
|
},
|
|
631
649
|
"modified"
|
|
632
650
|
);
|
|
@@ -797,7 +815,8 @@ var ArkContractSchema = {
|
|
|
797
815
|
expiresAt: "int?",
|
|
798
816
|
label: "string?",
|
|
799
817
|
metadataJson: "string?",
|
|
800
|
-
watch: { type: "string", optional: true, indexed: true }
|
|
818
|
+
watch: { type: "string", optional: true, indexed: true },
|
|
819
|
+
scope: "string?"
|
|
801
820
|
}
|
|
802
821
|
};
|
|
803
822
|
var ArkIntentSchema = {
|
|
@@ -859,7 +878,7 @@ var ArkExperimentalRealmSchemas = [
|
|
|
859
878
|
ArkVirtualTxSchema,
|
|
860
879
|
ArkVtxoBranchSchema
|
|
861
880
|
];
|
|
862
|
-
var ARK_REALM_SCHEMA_VERSION =
|
|
881
|
+
var ARK_REALM_SCHEMA_VERSION = 6;
|
|
863
882
|
function runArkRealmMigrations(oldRealm, newRealm) {
|
|
864
883
|
const legacyByPk = /* @__PURE__ */ new Map();
|
|
865
884
|
const oldVtxos = oldRealm?.objects?.("ArkVtxo") ?? [];
|
|
@@ -871,9 +890,9 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
871
890
|
for (let i = 0; i < newVtxos.length; i++) {
|
|
872
891
|
const newVtxo = newVtxos[i];
|
|
873
892
|
if (!newVtxo.script) {
|
|
874
|
-
newVtxo.script =
|
|
893
|
+
newVtxo.script = chunkT254PXSN_cjs.scriptFromArkAddress(newVtxo.address);
|
|
875
894
|
}
|
|
876
|
-
const facts =
|
|
895
|
+
const facts = chunkT254PXSN_cjs.legacyVtxoFacts(legacyByPk.get(newVtxo.pk));
|
|
877
896
|
if (facts) {
|
|
878
897
|
if (newVtxo.isSpent == null) newVtxo.isSpent = facts.isSpent;
|
|
879
898
|
if (newVtxo.isSwept == null) newVtxo.isSwept = facts.isSwept;
|
|
@@ -903,11 +922,12 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
903
922
|
|
|
904
923
|
Object.defineProperty(exports, "ChainedTxType", {
|
|
905
924
|
enumerable: true,
|
|
906
|
-
get: function () { return
|
|
925
|
+
get: function () { return chunkT254PXSN_cjs.ChainedTxType; }
|
|
907
926
|
});
|
|
908
927
|
exports.ARK_REALM_SCHEMA_VERSION = ARK_REALM_SCHEMA_VERSION;
|
|
909
928
|
exports.ArkExperimentalRealmSchemas = ArkExperimentalRealmSchemas;
|
|
910
929
|
exports.ArkRealmSchemas = ArkRealmSchemas;
|
|
930
|
+
exports.RealmBatchRegistrationRepository = RealmBatchRegistrationRepository;
|
|
911
931
|
exports.RealmContractRepository = RealmContractRepository;
|
|
912
932
|
exports.RealmIntentRepository = RealmIntentRepository;
|
|
913
933
|
exports.RealmVirtualTxRepository = RealmVirtualTxRepository;
|