@arkade-os/sdk 0.5.0-rc.2 → 0.5.0-rc.4
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 +12 -67
- package/dist/adapters/expo.cjs +5 -6
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -4
- package/dist/{asyncStorageTaskQueue-C5rBYlru.d.ts → asyncStorageTaskQueue-BCiOgs5x.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-BuDvgWh6.d.cts → asyncStorageTaskQueue-CTIwKrt5.d.cts} +2 -2
- package/dist/{chunk-3R476TDV.js → chunk-4EZOMPAO.js} +14 -38
- package/dist/chunk-4EZOMPAO.js.map +1 -0
- package/dist/{chunk-D25O4EGY.cjs → chunk-5NLJUXXQ.cjs} +10 -10
- package/dist/{chunk-D25O4EGY.cjs.map → chunk-5NLJUXXQ.cjs.map} +1 -1
- package/dist/{chunk-JZWLXNHV.cjs → chunk-C5Y2R63Z.cjs} +25 -71
- package/dist/chunk-C5Y2R63Z.cjs.map +1 -0
- package/dist/{chunk-6DNR46C7.js → chunk-CIBGIZUW.js} +4 -4
- package/dist/{chunk-6DNR46C7.js.map → chunk-CIBGIZUW.js.map} +1 -1
- package/dist/{chunk-43FKNLX4.cjs → chunk-F7HJO5GT.cjs} +61 -85
- package/dist/chunk-F7HJO5GT.cjs.map +1 -0
- package/dist/{chunk-ISO4TI5J.js → chunk-GLZNJFAT.js} +25 -67
- package/dist/chunk-GLZNJFAT.js.map +1 -0
- package/dist/{chunk-HLCGYOIH.cjs → chunk-GPJSGLWM.cjs} +17 -17
- package/dist/{chunk-HLCGYOIH.cjs.map → chunk-GPJSGLWM.cjs.map} +1 -1
- package/dist/{chunk-ZOTXDOS5.js → chunk-MOWSLXGO.js} +4 -4
- package/dist/{chunk-ZOTXDOS5.js.map → chunk-MOWSLXGO.js.map} +1 -1
- package/dist/{chunk-ZRNQV6HV.js → chunk-PYTAH2NY.js} +167 -703
- package/dist/chunk-PYTAH2NY.js.map +1 -0
- package/dist/{chunk-NVZJSKZS.cjs → chunk-SYRQJS5N.cjs} +18 -19
- package/dist/chunk-SYRQJS5N.cjs.map +1 -0
- package/dist/{chunk-4PKLULWT.js → chunk-XHASFSDU.js} +3 -4
- package/dist/chunk-XHASFSDU.js.map +1 -0
- package/dist/{chunk-GMZZQXV5.cjs → chunk-ZHLYFRYY.cjs} +583 -1128
- package/dist/chunk-ZHLYFRYY.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -10
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -3
- package/dist/{delegate-1yp1HyP7.d.cts → delegate-CpQIgTs7.d.cts} +1 -1
- package/dist/{delegate-BAX5QftB.d.ts → delegate-Dv-us16c.d.ts} +1 -1
- package/dist/{hdWalletCapable-CmEU0NP1.d.ts → hdWalletCapable-BC4Fmmht.d.ts} +7 -25
- package/dist/{hdWalletCapable-eJgaT-ec.d.cts → hdWalletCapable-DotEa5rZ.d.cts} +7 -25
- package/dist/{index-DUxufw76.d.ts → index-Czz9HSqE.d.cts} +21 -220
- package/dist/{index-DUxufw76.d.cts → index-Czz9HSqE.d.ts} +21 -220
- package/dist/{index-Bem5vKzX.d.ts → index-DUkvXxpt.d.ts} +3 -3
- package/dist/{index-W_oMcOmG.d.cts → index-DdJt5fRc.d.cts} +3 -3
- package/dist/index.cjs +291 -340
- package/dist/index.d.cts +58 -223
- package/dist/index.d.ts +58 -223
- package/dist/index.js +4 -5
- package/dist/repositories/realm/index.cjs +57 -24
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +12 -4
- package/dist/repositories/realm/index.d.ts +12 -4
- package/dist/repositories/realm/index.js +43 -10
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +103 -33
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +12 -2
- package/dist/repositories/sqlite/index.d.ts +12 -2
- package/dist/repositories/sqlite/index.js +90 -20
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-Dr3NStc0.d.cts → taskRunner-7E_Rx8bD.d.cts} +2 -2
- package/dist/{taskRunner-D_iPiZIi.d.ts → taskRunner-DUId1UJ8.d.ts} +2 -2
- package/dist/wallet/expo/background.cjs +14 -15
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +6 -7
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +15 -23
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +4 -7
- package/dist/wallet/expo/index.d.ts +4 -7
- package/dist/wallet/expo/index.js +7 -15
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/worker/expo/index.cjs +9 -10
- package/dist/worker/expo/index.cjs.map +1 -1
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -6
- package/dist/worker/expo/index.js.map +1 -1
- package/package.json +4 -42
- package/dist/adapters/asyncStorage.cjs +0 -48
- package/dist/adapters/asyncStorage.cjs.map +0 -1
- package/dist/adapters/asyncStorage.d.cts +0 -16
- package/dist/adapters/asyncStorage.d.ts +0 -16
- package/dist/adapters/asyncStorage.js +0 -46
- package/dist/adapters/asyncStorage.js.map +0 -1
- package/dist/adapters/fileSystem.cjs +0 -116
- package/dist/adapters/fileSystem.cjs.map +0 -1
- package/dist/adapters/fileSystem.d.cts +0 -17
- package/dist/adapters/fileSystem.d.ts +0 -17
- package/dist/adapters/fileSystem.js +0 -93
- package/dist/adapters/fileSystem.js.map +0 -1
- package/dist/adapters/indexedDB.cjs +0 -103
- package/dist/adapters/indexedDB.cjs.map +0 -1
- package/dist/adapters/indexedDB.d.cts +0 -18
- package/dist/adapters/indexedDB.d.ts +0 -18
- package/dist/adapters/indexedDB.js +0 -101
- package/dist/adapters/indexedDB.js.map +0 -1
- package/dist/adapters/localStorage.cjs +0 -50
- package/dist/adapters/localStorage.cjs.map +0 -1
- package/dist/adapters/localStorage.d.cts +0 -14
- package/dist/adapters/localStorage.d.ts +0 -14
- package/dist/adapters/localStorage.js +0 -48
- package/dist/adapters/localStorage.js.map +0 -1
- package/dist/chunk-3R476TDV.js.map +0 -1
- package/dist/chunk-43FKNLX4.cjs.map +0 -1
- package/dist/chunk-4PKLULWT.js.map +0 -1
- package/dist/chunk-5BLDMQED.cjs +0 -18
- package/dist/chunk-5BLDMQED.cjs.map +0 -1
- package/dist/chunk-GMZZQXV5.cjs.map +0 -1
- package/dist/chunk-ISO4TI5J.js.map +0 -1
- package/dist/chunk-JZWLXNHV.cjs.map +0 -1
- package/dist/chunk-NSBPE2FW.js +0 -15
- package/dist/chunk-NSBPE2FW.js.map +0 -1
- package/dist/chunk-NVZJSKZS.cjs.map +0 -1
- package/dist/chunk-ZRNQV6HV.js.map +0 -1
- package/dist/index-C0IanN1m.d.cts +0 -11
- package/dist/index-C0IanN1m.d.ts +0 -11
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
require('../../chunk-
|
|
7
|
-
require('../../chunk-5BLDMQED.cjs');
|
|
3
|
+
var chunkZHLYFRYY_cjs = require('../../chunk-ZHLYFRYY.cjs');
|
|
4
|
+
require('../../chunk-SYRQJS5N.cjs');
|
|
5
|
+
require('../../chunk-F7HJO5GT.cjs');
|
|
6
|
+
require('../../chunk-C5Y2R63Z.cjs');
|
|
8
7
|
|
|
9
8
|
// src/repositories/sqlite/transaction.ts
|
|
10
9
|
var writeChains = /* @__PURE__ */ new WeakMap();
|
|
@@ -144,6 +143,25 @@ var SQLiteWalletRepository = class {
|
|
|
144
143
|
`PRAGMA table_info(${this.tables.vtxos})`
|
|
145
144
|
);
|
|
146
145
|
const scriptCol = cols.find((c) => c.name === "script");
|
|
146
|
+
const nullableCanonicalColumns = [
|
|
147
|
+
["is_swept", "INTEGER"],
|
|
148
|
+
["is_preconfirmed", "INTEGER"],
|
|
149
|
+
["commitment_txids_json", "TEXT"],
|
|
150
|
+
["expires_at", "TEXT"],
|
|
151
|
+
["expires_at_height", "INTEGER"]
|
|
152
|
+
];
|
|
153
|
+
let addedCanonicalColumns = false;
|
|
154
|
+
for (const [name, type] of nullableCanonicalColumns) {
|
|
155
|
+
if (!cols.some((c) => c.name === name)) {
|
|
156
|
+
await this.db.run(
|
|
157
|
+
`ALTER TABLE ${this.tables.vtxos} ADD COLUMN ${name} ${type}`
|
|
158
|
+
);
|
|
159
|
+
addedCanonicalColumns = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (addedCanonicalColumns && cols.some((c) => c.name === "virtual_status_json")) {
|
|
163
|
+
await this.backfillCanonicalVtxoColumns();
|
|
164
|
+
}
|
|
147
165
|
if (scriptCol && scriptCol.notnull === 1) {
|
|
148
166
|
return;
|
|
149
167
|
}
|
|
@@ -154,7 +172,7 @@ var SQLiteWalletRepository = class {
|
|
|
154
172
|
for (const row of nullRows) {
|
|
155
173
|
await this.db.run(
|
|
156
174
|
`UPDATE ${this.tables.vtxos} SET script = ? WHERE txid = ? AND vout = ?`,
|
|
157
|
-
[
|
|
175
|
+
[chunkZHLYFRYY_cjs.scriptFromArkAddress(row.address), row.txid, row.vout]
|
|
158
176
|
);
|
|
159
177
|
}
|
|
160
178
|
const tempName = `${this.tables.vtxos}__migrate_tmp`;
|
|
@@ -164,20 +182,58 @@ var SQLiteWalletRepository = class {
|
|
|
164
182
|
INSERT INTO ${tempName}
|
|
165
183
|
(txid, vout, value, address, tap_tree,
|
|
166
184
|
forfeit_cb, forfeit_s, intent_cb, intent_s,
|
|
167
|
-
status_json,
|
|
168
|
-
|
|
169
|
-
|
|
185
|
+
status_json, created_at, is_unrolled, is_spent,
|
|
186
|
+
is_swept, is_preconfirmed, commitment_txids_json,
|
|
187
|
+
expires_at, expires_at_height,
|
|
188
|
+
spent_by, settled_by, ark_tx_id, extra_witness_json, assets_json, script)
|
|
170
189
|
SELECT txid, vout, value, address, tap_tree,
|
|
171
190
|
forfeit_cb, forfeit_s, intent_cb, intent_s,
|
|
172
|
-
status_json,
|
|
173
|
-
|
|
174
|
-
|
|
191
|
+
status_json, created_at, is_unrolled, is_spent,
|
|
192
|
+
is_swept, is_preconfirmed, commitment_txids_json,
|
|
193
|
+
expires_at, expires_at_height,
|
|
194
|
+
spent_by, settled_by, ark_tx_id, extra_witness_json, assets_json, script
|
|
175
195
|
FROM ${this.tables.vtxos}
|
|
176
196
|
`);
|
|
177
197
|
await this.db.run(`DROP TABLE ${this.tables.vtxos}`);
|
|
178
198
|
await this.db.run(`ALTER TABLE ${tempName} RENAME TO ${this.tables.vtxos}`);
|
|
179
199
|
});
|
|
180
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Copy the canonical VTXO facts out of the legacy `virtual_status_json` blob.
|
|
203
|
+
*
|
|
204
|
+
* Scoped to rows that still have `is_swept` NULL, which is what "never backfilled" looks
|
|
205
|
+
* like: the copy writes 0 or 1 to every row it touches, so a second pass — a later column
|
|
206
|
+
* addition, say — cannot overwrite what an indexer sync has since corrected. Rows whose blob
|
|
207
|
+
* is missing or corrupt are left alone: a migration must not be stopped by one bad row, and
|
|
208
|
+
* the next sync repairs it.
|
|
209
|
+
*/
|
|
210
|
+
async backfillCanonicalVtxoColumns() {
|
|
211
|
+
const rows = await this.db.all(
|
|
212
|
+
`SELECT txid, vout, virtual_status_json FROM ${this.tables.vtxos}
|
|
213
|
+
WHERE virtual_status_json IS NOT NULL AND is_swept IS NULL`
|
|
214
|
+
);
|
|
215
|
+
for (const row of rows) {
|
|
216
|
+
const facts = chunkZHLYFRYY_cjs.legacyVtxoFacts(row.virtual_status_json);
|
|
217
|
+
if (!facts) continue;
|
|
218
|
+
await this.db.run(
|
|
219
|
+
`UPDATE ${this.tables.vtxos}
|
|
220
|
+
SET is_swept = ?, is_preconfirmed = ?, commitment_txids_json = ?,
|
|
221
|
+
expires_at = ?, expires_at_height = ?,
|
|
222
|
+
is_spent = COALESCE(is_spent, ?)
|
|
223
|
+
WHERE txid = ? AND vout = ?`,
|
|
224
|
+
[
|
|
225
|
+
facts.isSwept ? 1 : 0,
|
|
226
|
+
facts.isPreconfirmed ? 1 : 0,
|
|
227
|
+
facts.commitmentTxIds ? JSON.stringify(facts.commitmentTxIds) : null,
|
|
228
|
+
facts.expiresAt ? facts.expiresAt.toISOString() : null,
|
|
229
|
+
facts.expiresAtHeight ?? null,
|
|
230
|
+
facts.isSpent ? 1 : 0,
|
|
231
|
+
row.txid,
|
|
232
|
+
row.vout
|
|
233
|
+
]
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
181
237
|
vtxosCreateSql(tableName) {
|
|
182
238
|
return `CREATE TABLE ${tableName} (
|
|
183
239
|
txid TEXT NOT NULL,
|
|
@@ -190,10 +246,14 @@ var SQLiteWalletRepository = class {
|
|
|
190
246
|
intent_cb TEXT NOT NULL,
|
|
191
247
|
intent_s TEXT NOT NULL,
|
|
192
248
|
status_json TEXT NOT NULL,
|
|
193
|
-
virtual_status_json TEXT NOT NULL,
|
|
194
249
|
created_at TEXT NOT NULL,
|
|
195
250
|
is_unrolled INTEGER NOT NULL DEFAULT 0,
|
|
196
251
|
is_spent INTEGER,
|
|
252
|
+
is_swept INTEGER,
|
|
253
|
+
is_preconfirmed INTEGER,
|
|
254
|
+
commitment_txids_json TEXT,
|
|
255
|
+
expires_at TEXT,
|
|
256
|
+
expires_at_height INTEGER,
|
|
197
257
|
spent_by TEXT,
|
|
198
258
|
settled_by TEXT,
|
|
199
259
|
ark_tx_id TEXT,
|
|
@@ -225,19 +285,21 @@ var SQLiteWalletRepository = class {
|
|
|
225
285
|
async saveVtxos(address, vtxos) {
|
|
226
286
|
await this.ensureInit();
|
|
227
287
|
for (const vtxo of vtxos) {
|
|
228
|
-
const s =
|
|
288
|
+
const s = chunkZHLYFRYY_cjs.serializeVtxo(vtxo);
|
|
229
289
|
await this.db.run(
|
|
230
290
|
`INSERT OR REPLACE INTO ${this.tables.vtxos}
|
|
231
291
|
(txid, vout, value, address,
|
|
232
292
|
tap_tree, forfeit_cb, forfeit_s, intent_cb, intent_s,
|
|
233
|
-
status_json,
|
|
234
|
-
|
|
235
|
-
|
|
293
|
+
status_json, created_at, is_unrolled, is_spent,
|
|
294
|
+
is_swept, is_preconfirmed, commitment_txids_json,
|
|
295
|
+
expires_at, expires_at_height,
|
|
296
|
+
spent_by, settled_by, ark_tx_id, extra_witness_json, assets_json, script)
|
|
236
297
|
VALUES (?, ?, ?, ?,
|
|
237
298
|
?, ?, ?, ?, ?,
|
|
299
|
+
?, ?, ?, ?,
|
|
238
300
|
?, ?, ?,
|
|
239
|
-
?, ?,
|
|
240
|
-
?, ?, ?)`,
|
|
301
|
+
?, ?,
|
|
302
|
+
?, ?, ?, ?, ?, ?)`,
|
|
241
303
|
[
|
|
242
304
|
s.txid,
|
|
243
305
|
s.vout,
|
|
@@ -249,10 +311,14 @@ var SQLiteWalletRepository = class {
|
|
|
249
311
|
s.intentTapLeafScript.cb,
|
|
250
312
|
s.intentTapLeafScript.s,
|
|
251
313
|
JSON.stringify(s.status),
|
|
252
|
-
JSON.stringify(s.virtualStatus),
|
|
253
314
|
typeof s.createdAt === "string" ? s.createdAt : s.createdAt instanceof Date ? s.createdAt.toISOString() : new Date(s.createdAt).toISOString(),
|
|
254
315
|
s.isUnrolled ? 1 : 0,
|
|
255
316
|
s.isSpent === void 0 ? null : s.isSpent ? 1 : 0,
|
|
317
|
+
s.isSwept === void 0 ? null : s.isSwept ? 1 : 0,
|
|
318
|
+
s.isPreconfirmed === void 0 ? null : s.isPreconfirmed ? 1 : 0,
|
|
319
|
+
s.commitmentTxIds ? JSON.stringify(s.commitmentTxIds) : null,
|
|
320
|
+
s.expiresAt === void 0 ? null : s.expiresAt instanceof Date ? s.expiresAt.toISOString() : new Date(s.expiresAt).toISOString(),
|
|
321
|
+
s.expiresAtHeight ?? null,
|
|
256
322
|
s.spentBy ?? null,
|
|
257
323
|
s.settledBy ?? null,
|
|
258
324
|
s.arkTxId ?? null,
|
|
@@ -280,7 +346,7 @@ var SQLiteWalletRepository = class {
|
|
|
280
346
|
throw new Error("SQLiteWalletRepository requires an address");
|
|
281
347
|
}
|
|
282
348
|
for (const vtxo of vtxos) {
|
|
283
|
-
if (!
|
|
349
|
+
if (!chunkZHLYFRYY_cjs.isVtxoForScript(vtxo, key.script)) {
|
|
284
350
|
throw new Error(
|
|
285
351
|
`VTXO ${vtxo.txid}:${vtxo.vout} script mismatch: expected ${key.script}, got ${vtxo.script}`
|
|
286
352
|
);
|
|
@@ -304,7 +370,7 @@ var SQLiteWalletRepository = class {
|
|
|
304
370
|
async saveUtxos(address, utxos) {
|
|
305
371
|
await this.ensureInit();
|
|
306
372
|
for (const utxo of utxos) {
|
|
307
|
-
const s =
|
|
373
|
+
const s = chunkZHLYFRYY_cjs.serializeUtxo(utxo);
|
|
308
374
|
await this.db.run(
|
|
309
375
|
`INSERT OR REPLACE INTO ${this.tables.utxos}
|
|
310
376
|
(txid, vout, value, address,
|
|
@@ -360,7 +426,7 @@ var SQLiteWalletRepository = class {
|
|
|
360
426
|
tx.amount,
|
|
361
427
|
tx.settled ? 1 : 0,
|
|
362
428
|
tx.createdAt,
|
|
363
|
-
tx.assets ? JSON.stringify(
|
|
429
|
+
tx.assets ? JSON.stringify(chunkZHLYFRYY_cjs.serializeAssets(tx.assets)) : null
|
|
364
430
|
]
|
|
365
431
|
);
|
|
366
432
|
}
|
|
@@ -422,10 +488,14 @@ function vtxoRowToDomain(row) {
|
|
|
422
488
|
s: row.intent_s
|
|
423
489
|
},
|
|
424
490
|
status: JSON.parse(row.status_json),
|
|
425
|
-
virtualStatus: JSON.parse(row.virtual_status_json),
|
|
426
491
|
createdAt: new Date(row.created_at),
|
|
427
492
|
isUnrolled: row.is_unrolled === 1,
|
|
428
493
|
isSpent: row.is_spent === null ? void 0 : row.is_spent === 1,
|
|
494
|
+
isSwept: row.is_swept == null ? void 0 : row.is_swept === 1,
|
|
495
|
+
isPreconfirmed: row.is_preconfirmed == null ? void 0 : row.is_preconfirmed === 1,
|
|
496
|
+
commitmentTxIds: row.commitment_txids_json ? JSON.parse(row.commitment_txids_json) : void 0,
|
|
497
|
+
expiresAt: row.expires_at ? new Date(row.expires_at) : void 0,
|
|
498
|
+
expiresAtHeight: row.expires_at_height ?? void 0,
|
|
429
499
|
spentBy: row.spent_by ?? void 0,
|
|
430
500
|
settledBy: row.settled_by ?? void 0,
|
|
431
501
|
arkTxId: row.ark_tx_id ?? void 0,
|
|
@@ -434,9 +504,9 @@ function vtxoRowToDomain(row) {
|
|
|
434
504
|
// Post-migration every row has `script`, but the backfill is
|
|
435
505
|
// idempotent: derive from `address` if the legacy column is still
|
|
436
506
|
// null (e.g. the migration hasn't run yet on this handle).
|
|
437
|
-
script: row.script ??
|
|
507
|
+
script: row.script ?? chunkZHLYFRYY_cjs.scriptFromArkAddress(row.address)
|
|
438
508
|
};
|
|
439
|
-
return
|
|
509
|
+
return chunkZHLYFRYY_cjs.deserializeVtxo(serialized);
|
|
440
510
|
}
|
|
441
511
|
function utxoRowToDomain(row) {
|
|
442
512
|
const serialized = {
|
|
@@ -455,7 +525,7 @@ function utxoRowToDomain(row) {
|
|
|
455
525
|
status: JSON.parse(row.status_json),
|
|
456
526
|
extraWitness: row.extra_witness_json ? JSON.parse(row.extra_witness_json) : void 0
|
|
457
527
|
};
|
|
458
|
-
return
|
|
528
|
+
return chunkZHLYFRYY_cjs.deserializeUtxo(serialized);
|
|
459
529
|
}
|
|
460
530
|
function txRowToDomain(row) {
|
|
461
531
|
const tx = {
|
|
@@ -470,7 +540,7 @@ function txRowToDomain(row) {
|
|
|
470
540
|
createdAt: row.created_at
|
|
471
541
|
};
|
|
472
542
|
if (row.assets_json) {
|
|
473
|
-
tx.assets =
|
|
543
|
+
tx.assets = chunkZHLYFRYY_cjs.deserializeAssets(JSON.parse(row.assets_json));
|
|
474
544
|
}
|
|
475
545
|
return tx;
|
|
476
546
|
}
|
|
@@ -743,8 +813,8 @@ var SQLiteIntentRepository = class {
|
|
|
743
813
|
`SELECT * FROM ${this.t} ORDER BY created_at ASC, intent_tx_id ASC`
|
|
744
814
|
);
|
|
745
815
|
let out = rows.map(rowToIntent);
|
|
746
|
-
if (filter) out = out.filter((i) =>
|
|
747
|
-
const { skip, end } =
|
|
816
|
+
if (filter) out = out.filter((i) => chunkZHLYFRYY_cjs.intentMatchesFilter(i, filter));
|
|
817
|
+
const { skip, end } = chunkZHLYFRYY_cjs.intentPageBounds(filter, out.length);
|
|
748
818
|
return out.slice(skip, end);
|
|
749
819
|
}
|
|
750
820
|
async getLockedVtxoOutpoints() {
|
|
@@ -752,7 +822,7 @@ var SQLiteIntentRepository = class {
|
|
|
752
822
|
const rows = await this.db.all(`SELECT * FROM ${this.t}`);
|
|
753
823
|
const out = [];
|
|
754
824
|
for (const r of rows) {
|
|
755
|
-
if (
|
|
825
|
+
if (chunkZHLYFRYY_cjs.isTerminalIntentState(r.state)) continue;
|
|
756
826
|
for (const o of JSON.parse(r.intent_vtxos_json)) out.push(o);
|
|
757
827
|
}
|
|
758
828
|
return out;
|
|
@@ -847,7 +917,7 @@ var SQLiteVirtualTxRepository = class {
|
|
|
847
917
|
const prev = prevByTxid.get(t.txid);
|
|
848
918
|
const psbt = t.psbt ?? prev?.psbt ?? null;
|
|
849
919
|
const expires = t.expiresAt ?? prev?.expires_at ?? null;
|
|
850
|
-
const type =
|
|
920
|
+
const type = chunkZHLYFRYY_cjs.mergeChainedTxType(t.type, prev?.type);
|
|
851
921
|
await this.db.run(
|
|
852
922
|
`INSERT OR REPLACE INTO ${this.tTx} (txid, psbt, expires_at, type) VALUES (?, ?, ?, ?)`,
|
|
853
923
|
[t.txid, psbt, expires, type]
|
|
@@ -940,7 +1010,7 @@ function sanitizeTablePrefix(p) {
|
|
|
940
1010
|
|
|
941
1011
|
Object.defineProperty(exports, "ChainedTxType", {
|
|
942
1012
|
enumerable: true,
|
|
943
|
-
get: function () { return
|
|
1013
|
+
get: function () { return chunkZHLYFRYY_cjs.ChainedTxType; }
|
|
944
1014
|
});
|
|
945
1015
|
exports.SQLiteContractRepository = SQLiteContractRepository;
|
|
946
1016
|
exports.SQLiteIntentRepository = SQLiteIntentRepository;
|