@arkade-os/sdk 0.5.0-rc.8 → 0.5.0
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 +231 -50
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +5 -5
- package/dist/adapters/expo.d.ts +5 -5
- package/dist/adapters/expo.js +3 -3
- package/dist/{asyncStorageTaskQueue-CeYTmuGU.d.ts → asyncStorageTaskQueue-BFv2O1y1.d.ts} +1 -1
- package/dist/{asyncStorageTaskQueue-Bn3FoNkc.d.cts → asyncStorageTaskQueue-qRRQUOE8.d.cts} +1 -1
- package/dist/{chunk-ZTCDT7KB.cjs → chunk-AU77RYOC.cjs} +6304 -4613
- package/dist/chunk-AU77RYOC.cjs.map +1 -0
- package/dist/{chunk-K5RED5VE.cjs → chunk-GN2K4WBP.cjs} +494 -1122
- package/dist/chunk-GN2K4WBP.cjs.map +1 -0
- package/dist/{chunk-BMPGUGYZ.cjs → chunk-GOM26K6H.cjs} +12 -10
- package/dist/chunk-GOM26K6H.cjs.map +1 -0
- package/dist/{chunk-LN4ZJZK4.js → chunk-GWJWXVUB.js} +5906 -4235
- package/dist/chunk-GWJWXVUB.js.map +1 -0
- package/dist/{chunk-G6S4XSFI.js → chunk-HABGVRLF.js} +112 -243
- package/dist/chunk-HABGVRLF.js.map +1 -0
- package/dist/{chunk-2AWDPVZI.cjs → chunk-IQWLFYT2.cjs} +124 -254
- package/dist/chunk-IQWLFYT2.cjs.map +1 -0
- package/dist/{chunk-56RCBKNF.cjs → chunk-JT5YVMCJ.cjs} +39 -46
- package/dist/chunk-JT5YVMCJ.cjs.map +1 -0
- package/dist/{chunk-INTEA7D3.js → chunk-K2E6X6JT.js} +32 -39
- package/dist/chunk-K2E6X6JT.js.map +1 -0
- package/dist/{chunk-XCNAGBFR.js → chunk-K352GMVL.js} +427 -1078
- package/dist/chunk-K352GMVL.js.map +1 -0
- package/dist/{chunk-BIRUBLP3.js → chunk-TZSKLERU.js} +7 -5
- package/dist/chunk-TZSKLERU.js.map +1 -0
- package/dist/{chunk-NY5FN4VV.cjs → chunk-UUSKJOSX.cjs} +548 -399
- package/dist/chunk-UUSKJOSX.cjs.map +1 -0
- package/dist/{chunk-MTYQXZ2T.js → chunk-ZOEB53NQ.js} +541 -400
- package/dist/chunk-ZOEB53NQ.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +5 -5
- package/dist/contracts/handlers/index.d.ts +5 -5
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-Cyv2suFd.d.cts → delegate-B5BmYkEY.d.cts} +1 -1
- package/dist/{delegate-CyBnNY9v.d.ts → delegate-DNbiUgy8.d.ts} +1 -1
- package/dist/index-B4QuO9sH.d.cts +645 -0
- package/dist/index-CYeyT3kn.d.ts +645 -0
- package/dist/{index-BIL9boGL.d.cts → index-CZw-MMfY.d.cts} +1644 -2291
- package/dist/{index-BIL9boGL.d.ts → index-CZw-MMfY.d.ts} +1644 -2291
- package/dist/index.cjs +399 -311
- package/dist/index.d.cts +953 -1124
- package/dist/index.d.ts +953 -1124
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +165 -103
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +18 -14
- package/dist/repositories/realm/index.d.ts +18 -14
- package/dist/repositories/realm/index.js +153 -91
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +226 -184
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +22 -21
- package/dist/repositories/sqlite/index.d.ts +22 -21
- package/dist/repositories/sqlite/index.js +218 -176
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-z_BGID85.d.cts → taskRunner-B3SLvUfL.d.cts} +1 -1
- package/dist/{taskRunner-CRbuzUXR.d.ts → taskRunner-wm1bhmtP.d.ts} +1 -1
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +10 -16
- package/dist/wallet/expo/background.d.ts +10 -16
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +19 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +8 -6
- package/dist/wallet/expo/index.d.ts +8 -6
- package/dist/wallet/expo/index.js +10 -5
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/wallet-DCZ2-Bea.d.cts +1874 -0
- package/dist/wallet-DGLXuwXT.d.ts +1874 -0
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +6 -6
- package/dist/worker/expo/index.d.ts +6 -6
- package/dist/worker/expo/index.js +5 -5
- package/package.json +10 -11
- package/dist/chunk-2AWDPVZI.cjs.map +0 -1
- package/dist/chunk-56RCBKNF.cjs.map +0 -1
- package/dist/chunk-BIRUBLP3.js.map +0 -1
- package/dist/chunk-BMPGUGYZ.cjs.map +0 -1
- package/dist/chunk-G6S4XSFI.js.map +0 -1
- package/dist/chunk-INTEA7D3.js.map +0 -1
- package/dist/chunk-K5RED5VE.cjs.map +0 -1
- package/dist/chunk-LN4ZJZK4.js.map +0 -1
- package/dist/chunk-MTYQXZ2T.js.map +0 -1
- package/dist/chunk-NY5FN4VV.cjs.map +0 -1
- package/dist/chunk-XCNAGBFR.js.map +0 -1
- package/dist/chunk-ZTCDT7KB.cjs.map +0 -1
- package/dist/hdWalletCapable-D1ImQqlu.d.cts +0 -2214
- package/dist/hdWalletCapable-DvumVrKW.d.ts +0 -2214
- package/dist/index-DleNQcz5.d.cts +0 -850
- package/dist/index-QVhQgYvU.d.ts +0 -850
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { serializeVtxo,
|
|
2
|
-
export { ChainedTxType } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
1
|
+
import { serializeVtxo, createdAtToIso, assertPageRequest, pageResult, checkSaveVtxosForScript, utxoEntries, serializeUtxo, assertHistoryPageFilter, compareHistoryCursors, serializeAssets, scriptFromArkAddress, deserializeVtxo, deserializeUtxo, deserializeAssets, contractFilterMatchesNothing, assertIntentIdUnique, intentMatchesFilter, isTerminalIntentState, mergeChainedTxType, legacyVtxoFacts } from '../../chunk-GWJWXVUB.js';
|
|
2
|
+
export { ChainedTxType } from '../../chunk-GWJWXVUB.js';
|
|
3
|
+
import '../../chunk-HABGVRLF.js';
|
|
4
|
+
import '../../chunk-K352GMVL.js';
|
|
5
|
+
import { isVtxoSpent } from '../../chunk-ZOEB53NQ.js';
|
|
6
6
|
|
|
7
7
|
// src/repositories/realm/walletRepository.ts
|
|
8
8
|
var RealmWalletRepository = class {
|
|
@@ -10,7 +10,7 @@ var RealmWalletRepository = class {
|
|
|
10
10
|
this.realm = realm;
|
|
11
11
|
}
|
|
12
12
|
realm;
|
|
13
|
-
version =
|
|
13
|
+
version = 2;
|
|
14
14
|
// ── Lifecycle ──────────────────────────────────────────────────────
|
|
15
15
|
async ensureInit() {
|
|
16
16
|
}
|
|
@@ -27,10 +27,8 @@ var RealmWalletRepository = class {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
// ── VTXO management ────────────────────────────────────────────────
|
|
30
|
-
async
|
|
31
|
-
|
|
32
|
-
const results = this.realm.objects("ArkVtxo").filtered("address == $0", address);
|
|
33
|
-
return [...results].map(vtxoObjectToDomain);
|
|
30
|
+
async getVtxosPage(address, page) {
|
|
31
|
+
return this.pageByAddress("ArkVtxo", address, page, vtxoObjectToDomain);
|
|
34
32
|
}
|
|
35
33
|
async saveVtxos(address, vtxos) {
|
|
36
34
|
await this.ensureInit();
|
|
@@ -51,13 +49,13 @@ var RealmWalletRepository = class {
|
|
|
51
49
|
intentCb: s.intentTapLeafScript.cb,
|
|
52
50
|
intentS: s.intentTapLeafScript.s,
|
|
53
51
|
statusJson: JSON.stringify(s.status),
|
|
54
|
-
createdAt:
|
|
52
|
+
createdAt: createdAtToIso(s.createdAt),
|
|
55
53
|
isUnrolled: s.isUnrolled ?? false,
|
|
56
54
|
isSpent: s.isSpent === void 0 ? null : s.isSpent,
|
|
57
55
|
isSwept: s.isSwept === void 0 ? null : s.isSwept,
|
|
58
56
|
isPreconfirmed: s.isPreconfirmed === void 0 ? null : s.isPreconfirmed,
|
|
59
57
|
commitmentTxIdsJson: s.commitmentTxIds ? JSON.stringify(s.commitmentTxIds) : null,
|
|
60
|
-
expiresAt: s.expiresAt === void 0 ? null :
|
|
58
|
+
expiresAt: s.expiresAt === void 0 ? null : new Date(s.expiresAt).toISOString(),
|
|
61
59
|
expiresAtHeight: s.expiresAtHeight ?? null,
|
|
62
60
|
spentBy: s.spentBy ?? null,
|
|
63
61
|
settledBy: s.settledBy ?? null,
|
|
@@ -72,47 +70,83 @@ var RealmWalletRepository = class {
|
|
|
72
70
|
});
|
|
73
71
|
}
|
|
74
72
|
async deleteVtxos(address) {
|
|
75
|
-
|
|
76
|
-
this.realm.write(() => {
|
|
77
|
-
const toDelete = this.realm.objects("ArkVtxo").filtered("address == $0", address);
|
|
78
|
-
this.realm.delete(toDelete);
|
|
79
|
-
});
|
|
73
|
+
return this.deleteWhere("ArkVtxo", "address", address);
|
|
80
74
|
}
|
|
81
|
-
async
|
|
75
|
+
async getVtxosForScriptPage(script, page, options) {
|
|
76
|
+
assertPageRequest(page);
|
|
82
77
|
await this.ensureInit();
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
let results = this.realm.objects("ArkVtxo").filtered("script == $0", script);
|
|
79
|
+
if (options?.unspentOnly) {
|
|
80
|
+
results = results.filtered(
|
|
81
|
+
"(isSpent == null OR isSpent == $0) AND (spentBy == null OR spentBy == $1) AND (settledBy == null OR settledBy == $1)",
|
|
82
|
+
false,
|
|
83
|
+
""
|
|
84
|
+
);
|
|
89
85
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
if (page.after) {
|
|
87
|
+
results = results.filtered(
|
|
88
|
+
"address > $0 OR (address == $0 AND (txid > $1 OR (txid == $1 AND vout > $2)))",
|
|
89
|
+
page.after.address,
|
|
90
|
+
page.after.txid,
|
|
91
|
+
page.after.vout
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
const rows = [];
|
|
95
|
+
for (const row of results.sorted([
|
|
96
|
+
["address", false],
|
|
97
|
+
["txid", false],
|
|
98
|
+
["vout", false]
|
|
99
|
+
])) {
|
|
100
|
+
rows.push({ address: row.address, vtxo: vtxoObjectToDomain(row) });
|
|
101
|
+
if (rows.length > page.limit) break;
|
|
96
102
|
}
|
|
97
|
-
|
|
103
|
+
const result = pageResult(rows, page.limit, (row) => ({
|
|
104
|
+
address: row.address,
|
|
105
|
+
txid: row.vtxo.txid,
|
|
106
|
+
vout: row.vtxo.vout
|
|
107
|
+
}));
|
|
108
|
+
return options?.unspentOnly ? { ...result, items: result.items.filter((row) => !isVtxoSpent(row.vtxo)) } : result;
|
|
109
|
+
}
|
|
110
|
+
async saveVtxosForScript(key, vtxos) {
|
|
111
|
+
return this.saveVtxos(checkSaveVtxosForScript("RealmWalletRepository", key, vtxos), vtxos);
|
|
98
112
|
}
|
|
99
113
|
async deleteVtxosForScript(script) {
|
|
100
|
-
|
|
101
|
-
this.realm.write(() => {
|
|
102
|
-
const toDelete = this.realm.objects("ArkVtxo").filtered("script == $0", script);
|
|
103
|
-
this.realm.delete(toDelete);
|
|
104
|
-
});
|
|
114
|
+
return this.deleteWhere("ArkVtxo", "script", script);
|
|
105
115
|
}
|
|
106
116
|
// ── UTXO management ────────────────────────────────────────────────
|
|
107
|
-
async
|
|
117
|
+
async getUtxosPage(address, page) {
|
|
118
|
+
return this.pageByAddress("ArkUtxo", address, page, utxoObjectToDomain);
|
|
119
|
+
}
|
|
120
|
+
async pageByAddress(schema, address, page, deserialize) {
|
|
121
|
+
assertPageRequest(page);
|
|
108
122
|
await this.ensureInit();
|
|
109
|
-
|
|
110
|
-
|
|
123
|
+
let results = this.realm.objects(schema).filtered("address == $0", address);
|
|
124
|
+
if (page.after) {
|
|
125
|
+
results = results.filtered(
|
|
126
|
+
"txid > $0 OR (txid == $0 AND vout > $1)",
|
|
127
|
+
page.after.txid,
|
|
128
|
+
page.after.vout
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
const rows = [];
|
|
132
|
+
for (const row of results.sorted([
|
|
133
|
+
["txid", false],
|
|
134
|
+
["vout", false]
|
|
135
|
+
])) {
|
|
136
|
+
rows.push({ key: { txid: row.txid, vout: row.vout }, item: deserialize(row) });
|
|
137
|
+
if (rows.length > page.limit) break;
|
|
138
|
+
}
|
|
139
|
+
const result = pageResult(rows, page.limit, (row) => row.key);
|
|
140
|
+
return { items: result.items.map((row) => row.item), nextCursor: result.nextCursor };
|
|
111
141
|
}
|
|
112
|
-
async saveUtxos(
|
|
142
|
+
async saveUtxos(addressOrBatch, utxos) {
|
|
113
143
|
await this.ensureInit();
|
|
144
|
+
const rows = utxoEntries(addressOrBatch, utxos).flatMap(
|
|
145
|
+
([address, list]) => list.map((utxo) => ({ address, utxo }))
|
|
146
|
+
);
|
|
147
|
+
if (rows.length === 0) return;
|
|
114
148
|
this.realm.write(() => {
|
|
115
|
-
for (const utxo of
|
|
149
|
+
for (const { address, utxo } of rows) {
|
|
116
150
|
const s = serializeUtxo(utxo);
|
|
117
151
|
this.realm.create(
|
|
118
152
|
"ArkUtxo",
|
|
@@ -136,19 +170,31 @@ var RealmWalletRepository = class {
|
|
|
136
170
|
});
|
|
137
171
|
}
|
|
138
172
|
async deleteUtxos(address) {
|
|
139
|
-
|
|
140
|
-
this.realm.write(() => {
|
|
141
|
-
const toDelete = this.realm.objects("ArkUtxo").filtered("address == $0", address);
|
|
142
|
-
this.realm.delete(toDelete);
|
|
143
|
-
});
|
|
173
|
+
return this.deleteWhere("ArkUtxo", "address", address);
|
|
144
174
|
}
|
|
145
175
|
// ── Transaction history ────────────────────────────────────────────
|
|
146
|
-
async
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
176
|
+
async getTransactionHistoryPage(filter, page) {
|
|
177
|
+
assertPageRequest(page);
|
|
178
|
+
assertHistoryPageFilter(filter);
|
|
179
|
+
let results = this.realm.objects("ArkTransaction").filtered("address == $0", filter.address);
|
|
180
|
+
results = results.filtered(
|
|
181
|
+
"createdAt >= $0",
|
|
182
|
+
Math.max(filter.since ?? 0, page.after?.createdAt ?? 0)
|
|
183
|
+
);
|
|
184
|
+
const rows = [];
|
|
185
|
+
for (const row of results.sorted([
|
|
186
|
+
["createdAt", false],
|
|
187
|
+
["boardingTxid", false],
|
|
188
|
+
["commitmentTxid", false],
|
|
189
|
+
["arkTxid", false]
|
|
190
|
+
])) {
|
|
191
|
+
const tx = txObjectToDomain(row);
|
|
192
|
+
if (page.after !== void 0 && compareHistoryCursors({ createdAt: tx.createdAt, key: tx.key }, page.after) <= 0)
|
|
193
|
+
continue;
|
|
194
|
+
rows.push(tx);
|
|
195
|
+
if (rows.length > page.limit) break;
|
|
196
|
+
}
|
|
197
|
+
return pageResult(rows, page.limit, (tx) => ({ createdAt: tx.createdAt, key: tx.key }));
|
|
152
198
|
}
|
|
153
199
|
async saveTransactions(address, txs) {
|
|
154
200
|
await this.ensureInit();
|
|
@@ -174,9 +220,12 @@ var RealmWalletRepository = class {
|
|
|
174
220
|
});
|
|
175
221
|
}
|
|
176
222
|
async deleteTransactions(address) {
|
|
223
|
+
return this.deleteWhere("ArkTransaction", "address", address);
|
|
224
|
+
}
|
|
225
|
+
async deleteWhere(objectType, field, value) {
|
|
177
226
|
await this.ensureInit();
|
|
178
227
|
this.realm.write(() => {
|
|
179
|
-
const toDelete = this.realm.objects(
|
|
228
|
+
const toDelete = this.realm.objects(objectType).filtered(`${field} == $0`, value);
|
|
180
229
|
this.realm.delete(toDelete);
|
|
181
230
|
});
|
|
182
231
|
}
|
|
@@ -287,7 +336,7 @@ var RealmContractRepository = class {
|
|
|
287
336
|
this.realm = realm;
|
|
288
337
|
}
|
|
289
338
|
realm;
|
|
290
|
-
version =
|
|
339
|
+
version = 3;
|
|
291
340
|
// ── Lifecycle ──────────────────────────────────────────────────────
|
|
292
341
|
async ensureInit() {
|
|
293
342
|
}
|
|
@@ -301,41 +350,47 @@ var RealmContractRepository = class {
|
|
|
301
350
|
});
|
|
302
351
|
}
|
|
303
352
|
// ── Contract management ────────────────────────────────────────────
|
|
304
|
-
async
|
|
305
|
-
|
|
353
|
+
async getContractsPage(filter, page) {
|
|
354
|
+
assertPageRequest(page);
|
|
355
|
+
if (contractFilterMatchesNothing(filter)) return { items: [] };
|
|
356
|
+
const toPage = (rows) => pageResult(rows.map(contractObjectToDomain), page.limit, (contract) => contract.script);
|
|
357
|
+
if (filter?.watch === void 0 || filter.script !== void 0) {
|
|
358
|
+
return toPage(this.readRows(filter, page));
|
|
359
|
+
}
|
|
360
|
+
const merged = [...new Set([filter.watch].flat())].flatMap((state) => state === "watched" ? [state, null] : [state]).flatMap(
|
|
361
|
+
(state) => state === "retained" ? this.readRows({ ...filter, watch: state }, page) : this.readRows({ ...filter, watch: void 0 }, page, state)
|
|
362
|
+
).map((row) => ({ script: row.script, row })).sort((a, b) => a.script < b.script ? -1 : a.script > b.script ? 1 : 0);
|
|
363
|
+
return toPage(merged.slice(0, page.limit + 1).map(({ row }) => row));
|
|
364
|
+
}
|
|
365
|
+
/** Up to `limit + 1` rows in script order, led by `watch == leadingWatch` when one is given. */
|
|
366
|
+
readRows(filter, page, leadingWatch) {
|
|
306
367
|
let results = this.realm.objects("ArkContract");
|
|
368
|
+
const parts = [];
|
|
369
|
+
const args = [];
|
|
370
|
+
let argIndex = 0;
|
|
307
371
|
if (filter) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
argIndex = this.
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
filter.state,
|
|
323
|
-
argIndex
|
|
324
|
-
);
|
|
325
|
-
argIndex = this.addFilterCondition(
|
|
326
|
-
filterParts,
|
|
327
|
-
filterArgs,
|
|
328
|
-
"type",
|
|
329
|
-
filter.type,
|
|
330
|
-
argIndex
|
|
331
|
-
);
|
|
332
|
-
argIndex = this.addWatchCondition(filterParts, filterArgs, filter.watch, argIndex);
|
|
333
|
-
if (filterParts.length > 0) {
|
|
334
|
-
const query = filterParts.join(" AND ");
|
|
335
|
-
results = results.filtered(query, ...filterArgs);
|
|
336
|
-
}
|
|
372
|
+
argIndex = this.addFilterCondition(parts, args, "script", filter.script, argIndex);
|
|
373
|
+
argIndex = this.addFilterCondition(parts, args, "state", filter.state, argIndex);
|
|
374
|
+
argIndex = this.addFilterCondition(parts, args, "type", filter.type, argIndex);
|
|
375
|
+
argIndex = this.addWatchCondition(parts, args, filter.watch, argIndex);
|
|
376
|
+
}
|
|
377
|
+
if (page.after !== void 0) {
|
|
378
|
+
parts.push(`script > $${argIndex}`);
|
|
379
|
+
args.push(page.after);
|
|
380
|
+
}
|
|
381
|
+
let query = parts.join(" AND ");
|
|
382
|
+
if (leadingWatch !== void 0) {
|
|
383
|
+
const lead = leadingWatch === null ? "watch == null" : `watch == $${args.length}`;
|
|
384
|
+
if (leadingWatch !== null) args.push(leadingWatch);
|
|
385
|
+
query = query ? `${lead} AND (${query})` : lead;
|
|
337
386
|
}
|
|
338
|
-
|
|
387
|
+
if (query) results = results.filtered(query, ...args);
|
|
388
|
+
const rows = [];
|
|
389
|
+
for (const row of results.sorted("script")) {
|
|
390
|
+
rows.push(row);
|
|
391
|
+
if (rows.length > page.limit) break;
|
|
392
|
+
}
|
|
393
|
+
return rows;
|
|
339
394
|
}
|
|
340
395
|
async saveContract(contract) {
|
|
341
396
|
await this.ensureInit();
|
|
@@ -483,11 +538,18 @@ var RealmIntentRepository = class {
|
|
|
483
538
|
);
|
|
484
539
|
});
|
|
485
540
|
}
|
|
486
|
-
async
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
541
|
+
async getIntentsPage(filter, page) {
|
|
542
|
+
assertPageRequest(page);
|
|
543
|
+
let results = this.realm.objects("ArkIntent");
|
|
544
|
+
if (page.after !== void 0) results = results.filtered("intentTxId > $0", page.after);
|
|
545
|
+
const rows = [];
|
|
546
|
+
for (const row of results.sorted("intentTxId")) {
|
|
547
|
+
const intent = toIntent(row);
|
|
548
|
+
if (filter && !intentMatchesFilter(intent, filter)) continue;
|
|
549
|
+
rows.push(intent);
|
|
550
|
+
if (rows.length > page.limit) break;
|
|
551
|
+
}
|
|
552
|
+
return pageResult(rows, page.limit, (intent) => intent.intentTxId);
|
|
491
553
|
}
|
|
492
554
|
async getLockedVtxoOutpoints() {
|
|
493
555
|
const out = [];
|