@bsv/wallet-toolbox 2.1.25 → 3.0.0-alpha.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/docs/CREATEACTION_BLOCKERS.md +391 -0
- package/docs/CUTOVER_RUNBOOK.md +95 -0
- package/docs/REQUIREMENTS_COMPLIANCE.md +157 -0
- package/docs/ROLLOUT_PLAN.md +273 -0
- package/docs/SESSION_HANDOFF.md +298 -0
- package/docs/STORAGE_METHOD_WIRING.md +176 -0
- package/docs/client.md +3765 -1325
- package/docs/monitor.md +255 -33
- package/docs/services.md +304 -280
- package/docs/setup.md +24 -24
- package/docs/storage.md +2783 -251
- package/docs/v3-upgrade/index.html +911 -0
- package/docs/wallet.md +4956 -9455
- package/out/src/Wallet.d.ts.map +1 -1
- package/out/src/Wallet.js.map +1 -1
- package/out/src/WalletLogger.d.ts.map +1 -1
- package/out/src/WalletLogger.js.map +1 -1
- package/out/src/__tests/CWIStyleWalletManager.test.js.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.fixtures.d.ts.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.fixtures.js.map +1 -1
- package/out/src/entropy/EntropyCollector.d.ts.map +1 -1
- package/out/src/entropy/EntropyCollector.js.map +1 -1
- package/out/src/monitor/LeasedMonitorTask.d.ts +43 -0
- package/out/src/monitor/LeasedMonitorTask.d.ts.map +1 -0
- package/out/src/monitor/LeasedMonitorTask.js +89 -0
- package/out/src/monitor/LeasedMonitorTask.js.map +1 -0
- package/out/src/monitor/Monitor.d.ts +7 -0
- package/out/src/monitor/Monitor.d.ts.map +1 -1
- package/out/src/monitor/Monitor.js +7 -0
- package/out/src/monitor/Monitor.js.map +1 -1
- package/out/src/monitor/MonitorDaemon.d.ts.map +1 -1
- package/out/src/monitor/MonitorDaemon.js.map +1 -1
- package/out/src/monitor/V7LeasedTask.d.ts +43 -0
- package/out/src/monitor/V7LeasedTask.d.ts.map +1 -0
- package/out/src/monitor/V7LeasedTask.js +89 -0
- package/out/src/monitor/V7LeasedTask.js.map +1 -0
- package/out/src/monitor/index.all.d.ts +1 -0
- package/out/src/monitor/index.all.d.ts.map +1 -1
- package/out/src/monitor/index.all.js +1 -0
- package/out/src/monitor/index.all.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +2 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.js +55 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
- package/out/src/sdk/WalletStorage.interfaces.d.ts +59 -59
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/out/src/sdk/types.d.ts +32 -0
- package/out/src/sdk/types.d.ts.map +1 -1
- package/out/src/sdk/types.js +50 -1
- package/out/src/sdk/types.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createDefaultKnexChaintracksOptions.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createDefaultKnexChaintracksOptions.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createKnexChaintracks.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createKnexChaintracks.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFs.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFs.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/__tests/SingleWriterMultiReaderLock.test.js.map +1 -1
- package/out/src/storage/StorageIdb.d.ts.map +1 -1
- package/out/src/storage/StorageIdb.js +10 -5
- package/out/src/storage/StorageIdb.js.map +1 -1
- package/out/src/storage/StorageKnex.d.ts +133 -3
- package/out/src/storage/StorageKnex.d.ts.map +1 -1
- package/out/src/storage/StorageKnex.js +691 -94
- package/out/src/storage/StorageKnex.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts +114 -1
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +164 -4
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.js.map +1 -1
- package/out/src/storage/idbHelpers.d.ts +5 -0
- package/out/src/storage/idbHelpers.d.ts.map +1 -1
- package/out/src/storage/idbHelpers.js +42 -0
- package/out/src/storage/idbHelpers.js.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +116 -4
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
- package/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/out/src/storage/methods/createAction.js +22 -5
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/storage/methods/internalizeAction.js +172 -5
- package/out/src/storage/methods/internalizeAction.js.map +1 -1
- package/out/src/storage/methods/listActionsKnex.d.ts +49 -0
- package/out/src/storage/methods/listActionsKnex.d.ts.map +1 -1
- package/out/src/storage/methods/listActionsKnex.js +179 -69
- package/out/src/storage/methods/listActionsKnex.js.map +1 -1
- package/out/src/storage/methods/listOutputsKnex.d.ts.map +1 -1
- package/out/src/storage/methods/listOutputsKnex.js +51 -4
- package/out/src/storage/methods/listOutputsKnex.js.map +1 -1
- package/out/src/storage/methods/processAction.d.ts.map +1 -1
- package/out/src/storage/methods/processAction.js +82 -14
- package/out/src/storage/methods/processAction.js.map +1 -1
- package/out/src/storage/methods/purgeData.d.ts.map +1 -1
- package/out/src/storage/methods/purgeData.js +22 -14
- package/out/src/storage/methods/purgeData.js.map +1 -1
- package/out/src/storage/methods/reviewStatus.d.ts.map +1 -1
- package/out/src/storage/methods/reviewStatus.js +18 -9
- package/out/src/storage/methods/reviewStatus.js.map +1 -1
- package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -1
- package/out/src/storage/schema/KnexMigrations.js +134 -0
- package/out/src/storage/schema/KnexMigrations.js.map +1 -1
- package/out/src/storage/schema/StorageIdbSchema.d.ts +43 -2
- package/out/src/storage/schema/StorageIdbSchema.d.ts.map +1 -1
- package/out/src/storage/schema/__tests/backfill.runner.test.d.ts +2 -0
- package/out/src/storage/schema/__tests/backfill.runner.test.d.ts.map +1 -0
- package/out/src/storage/schema/__tests/backfill.runner.test.js +148 -0
- package/out/src/storage/schema/__tests/backfill.runner.test.js.map +1 -0
- package/out/src/storage/schema/__tests/backfill.test.d.ts +2 -0
- package/out/src/storage/schema/__tests/backfill.test.d.ts.map +1 -0
- package/out/src/storage/schema/__tests/backfill.test.js +96 -0
- package/out/src/storage/schema/__tests/backfill.test.js.map +1 -0
- package/out/src/storage/schema/__tests/processingFsm.test.d.ts +2 -0
- package/out/src/storage/schema/__tests/processingFsm.test.d.ts.map +1 -0
- package/out/src/storage/schema/__tests/processingFsm.test.js +42 -0
- package/out/src/storage/schema/__tests/processingFsm.test.js.map +1 -0
- package/out/src/storage/schema/__tests/processingFsmLegacyMapping.test.d.ts +2 -0
- package/out/src/storage/schema/__tests/processingFsmLegacyMapping.test.d.ts.map +1 -0
- package/out/src/storage/schema/__tests/processingFsmLegacyMapping.test.js +82 -0
- package/out/src/storage/schema/__tests/processingFsmLegacyMapping.test.js.map +1 -0
- package/out/src/storage/schema/__tests/spendabilityRule.test.d.ts +2 -0
- package/out/src/storage/schema/__tests/spendabilityRule.test.d.ts.map +1 -0
- package/out/src/storage/schema/__tests/spendabilityRule.test.js +29 -0
- package/out/src/storage/schema/__tests/spendabilityRule.test.js.map +1 -0
- package/out/src/storage/schema/__tests/v7FsmLegacyMapping.test.d.ts +2 -0
- package/out/src/storage/schema/__tests/v7FsmLegacyMapping.test.d.ts.map +1 -0
- package/out/src/storage/schema/__tests/v7FsmLegacyMapping.test.js +77 -0
- package/out/src/storage/schema/__tests/v7FsmLegacyMapping.test.js.map +1 -0
- package/out/src/storage/schema/backfill.d.ts +35 -0
- package/out/src/storage/schema/backfill.d.ts.map +1 -0
- package/out/src/storage/schema/backfill.idb.d.ts +32 -0
- package/out/src/storage/schema/backfill.idb.d.ts.map +1 -0
- package/out/src/storage/schema/backfill.idb.js +95 -0
- package/out/src/storage/schema/backfill.idb.js.map +1 -0
- package/out/src/storage/schema/backfill.js +150 -0
- package/out/src/storage/schema/backfill.js.map +1 -0
- package/out/src/storage/schema/backfill.knex.d.ts +32 -0
- package/out/src/storage/schema/backfill.knex.d.ts.map +1 -0
- package/out/src/storage/schema/backfill.knex.js +240 -0
- package/out/src/storage/schema/backfill.knex.js.map +1 -0
- package/out/src/storage/schema/backfill.runner.d.ts +63 -0
- package/out/src/storage/schema/backfill.runner.d.ts.map +1 -0
- package/out/src/storage/schema/backfill.runner.js +64 -0
- package/out/src/storage/schema/backfill.runner.js.map +1 -0
- package/out/src/storage/schema/coinbaseMaturityBackfill.d.ts +25 -0
- package/out/src/storage/schema/coinbaseMaturityBackfill.d.ts.map +1 -0
- package/out/src/storage/schema/coinbaseMaturityBackfill.js +75 -0
- package/out/src/storage/schema/coinbaseMaturityBackfill.js.map +1 -0
- package/out/src/storage/schema/monitorLease.d.ts +57 -0
- package/out/src/storage/schema/monitorLease.d.ts.map +1 -0
- package/out/src/storage/schema/monitorLease.js +101 -0
- package/out/src/storage/schema/monitorLease.js.map +1 -0
- package/out/src/storage/schema/processingFsm.d.ts +27 -0
- package/out/src/storage/schema/processingFsm.d.ts.map +1 -0
- package/out/src/storage/schema/processingFsm.js +132 -0
- package/out/src/storage/schema/processingFsm.js.map +1 -0
- package/out/src/storage/schema/schemaCutover.d.ts +34 -0
- package/out/src/storage/schema/schemaCutover.d.ts.map +1 -0
- package/out/src/storage/schema/schemaCutover.js +230 -0
- package/out/src/storage/schema/schemaCutover.js.map +1 -0
- package/out/src/storage/schema/schemaCutoverIdb.d.ts +26 -0
- package/out/src/storage/schema/schemaCutoverIdb.d.ts.map +1 -0
- package/out/src/storage/schema/schemaCutoverIdb.js +90 -0
- package/out/src/storage/schema/schemaCutoverIdb.js.map +1 -0
- package/out/src/storage/schema/spendabilityRefresh.d.ts +49 -0
- package/out/src/storage/schema/spendabilityRefresh.d.ts.map +1 -0
- package/out/src/storage/schema/spendabilityRefresh.js +120 -0
- package/out/src/storage/schema/spendabilityRefresh.js.map +1 -0
- package/out/src/storage/schema/spendabilityRule.d.ts +45 -0
- package/out/src/storage/schema/spendabilityRule.d.ts.map +1 -0
- package/out/src/storage/schema/spendabilityRule.js +52 -0
- package/out/src/storage/schema/spendabilityRule.js.map +1 -0
- package/out/src/storage/schema/tables/TableAction.d.ts +3 -3
- package/out/src/storage/schema/tables/TableAction.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableChainTip.d.ts +1 -1
- package/out/src/storage/schema/tables/TableMonitorLease.d.ts +1 -1
- package/out/src/storage/schema/tables/TableOutput.d.ts +7 -0
- package/out/src/storage/schema/tables/TableOutput.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableOutput.js.map +1 -1
- package/out/src/storage/schema/tables/TableTransactionNew.d.ts +50 -0
- package/out/src/storage/schema/tables/TableTransactionNew.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableTransactionNew.js +3 -0
- package/out/src/storage/schema/tables/TableTransactionNew.js.map +1 -0
- package/out/src/storage/schema/tables/TableTxAudit.d.ts +1 -1
- package/out/src/storage/schema/tables/index.d.ts +5 -0
- package/out/src/storage/schema/tables/index.d.ts.map +1 -1
- package/out/src/storage/schema/tables/index.js +5 -0
- package/out/src/storage/schema/tables/index.js.map +1 -1
- package/out/src/storage/schema/transactionCrud.d.ts +41 -0
- package/out/src/storage/schema/transactionCrud.d.ts.map +1 -0
- package/out/src/storage/schema/transactionCrud.js +205 -0
- package/out/src/storage/schema/transactionCrud.js.map +1 -0
- package/out/src/storage/schema/transactionService.d.ts +315 -0
- package/out/src/storage/schema/transactionService.d.ts.map +1 -0
- package/out/src/storage/schema/transactionService.js +783 -0
- package/out/src/storage/schema/transactionService.js.map +1 -0
- package/out/src/storage/schema/txAudit.d.ts +33 -0
- package/out/src/storage/schema/txAudit.d.ts.map +1 -0
- package/out/src/storage/schema/txAudit.js +64 -0
- package/out/src/storage/schema/txAudit.js.map +1 -0
- package/out/src/storage/schema/v7Backfill.d.ts.map +1 -1
- package/out/src/storage/schema/v7Backfill.js +4 -1
- package/out/src/storage/schema/v7Backfill.js.map +1 -1
- package/out/src/storage/schema/v7Backfill.runner.d.ts.map +1 -1
- package/out/src/storage/schema/v7Backfill.runner.js +3 -1
- package/out/src/storage/schema/v7Backfill.runner.js.map +1 -1
- package/out/src/storage/schema/v7CoinbaseMaturityBackfill.d.ts +25 -0
- package/out/src/storage/schema/v7CoinbaseMaturityBackfill.d.ts.map +1 -0
- package/out/src/storage/schema/v7CoinbaseMaturityBackfill.js +75 -0
- package/out/src/storage/schema/v7CoinbaseMaturityBackfill.js.map +1 -0
- package/out/src/storage/schema/v7Crud.d.ts +5 -3
- package/out/src/storage/schema/v7Crud.d.ts.map +1 -1
- package/out/src/storage/schema/v7Crud.js +11 -9
- package/out/src/storage/schema/v7Crud.js.map +1 -1
- package/out/src/storage/schema/v7Cutover.d.ts +34 -0
- package/out/src/storage/schema/v7Cutover.d.ts.map +1 -0
- package/out/src/storage/schema/v7Cutover.js +223 -0
- package/out/src/storage/schema/v7Cutover.js.map +1 -0
- package/out/src/storage/schema/v7CutoverIdb.d.ts +26 -0
- package/out/src/storage/schema/v7CutoverIdb.d.ts.map +1 -0
- package/out/src/storage/schema/v7CutoverIdb.js +90 -0
- package/out/src/storage/schema/v7CutoverIdb.js.map +1 -0
- package/out/src/storage/schema/v7Fsm.d.ts.map +1 -1
- package/out/src/storage/schema/v7Fsm.js +22 -6
- package/out/src/storage/schema/v7Fsm.js.map +1 -1
- package/out/src/storage/schema/v7Service.d.ts +305 -0
- package/out/src/storage/schema/v7Service.d.ts.map +1 -0
- package/out/src/storage/schema/v7Service.js +757 -0
- package/out/src/storage/schema/v7Service.js.map +1 -0
- package/out/src/storage/schema/v7SpendabilityRefresh.d.ts +49 -0
- package/out/src/storage/schema/v7SpendabilityRefresh.d.ts.map +1 -0
- package/out/src/storage/schema/v7SpendabilityRefresh.js +111 -0
- package/out/src/storage/schema/v7SpendabilityRefresh.js.map +1 -0
- package/out/src/storage/storageProviderHelpers.js +1 -1
- package/out/src/storage/storageProviderHelpers.js.map +1 -1
- package/out/src/utility/Format.js.map +1 -1
- package/package.json +7 -4
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findTransactionNewByTxid = findTransactionNewByTxid;
|
|
4
|
+
exports.findTransactionNew = findTransactionNew;
|
|
5
|
+
exports.insertTransactionNew = insertTransactionNew;
|
|
6
|
+
exports.transitionProcessing = transitionProcessing;
|
|
7
|
+
exports.findAction = findAction;
|
|
8
|
+
exports.insertAction = insertAction;
|
|
9
|
+
exports.getChainTip = getChainTip;
|
|
10
|
+
exports.setChainTip = setChainTip;
|
|
11
|
+
exports.mapTransactionRow = mapTransactionRow;
|
|
12
|
+
exports.mapActionRow = mapActionRow;
|
|
13
|
+
const txAudit_1 = require("./txAudit");
|
|
14
|
+
/** Read a single `transactions` (new canonical) row by txid, returning `undefined` if absent. */
|
|
15
|
+
async function findTransactionNewByTxid(knex, txid) {
|
|
16
|
+
const row = await knex('transactions').where({ txid }).first();
|
|
17
|
+
return row != null ? mapTransactionRow(row) : undefined;
|
|
18
|
+
}
|
|
19
|
+
/** Read a single `transactions` (new canonical) row by PK. */
|
|
20
|
+
async function findTransactionNew(knex, transactionId) {
|
|
21
|
+
const row = await knex('transactions').where({ transactionId }).first();
|
|
22
|
+
return row != null ? mapTransactionRow(row) : undefined;
|
|
23
|
+
}
|
|
24
|
+
/** Insert a new `transactions` (new canonical) row. Caller supplies the full body. */
|
|
25
|
+
async function insertTransactionNew(knex, row, now = new Date()) {
|
|
26
|
+
const [id] = await knex('transactions').insert(unmapTransactionRow(row, now));
|
|
27
|
+
if (typeof id === 'number' && id > 0)
|
|
28
|
+
return id;
|
|
29
|
+
const r = await knex('transactions').where({ txid: row.txid }).first('transactionId');
|
|
30
|
+
return r.transactionId;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Transition the processing column atomically and append a `tx_audit` row.
|
|
34
|
+
* Returns the new `TableTransactionNew` on success and `undefined` when the
|
|
35
|
+
* source state did not match the row (CAS failed) or the transition was
|
|
36
|
+
* rejected by the FSM.
|
|
37
|
+
*
|
|
38
|
+
* Optimistic concurrency: the caller passes the `expectedFromState` they
|
|
39
|
+
* read in the same logical operation; the update only fires when the row's
|
|
40
|
+
* current `processing` still equals that value.
|
|
41
|
+
*/
|
|
42
|
+
async function transitionProcessing(knex, args, now = new Date()) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const ok = await (0, txAudit_1.auditProcessingTransition)(knex, args.transactionId, args.expectedFromState, args.toState, args.details, now);
|
|
45
|
+
if (!ok)
|
|
46
|
+
return undefined;
|
|
47
|
+
const updated = await knex('transactions')
|
|
48
|
+
.where({ transactionId: args.transactionId, processing: args.expectedFromState })
|
|
49
|
+
.update({
|
|
50
|
+
processing: args.toState,
|
|
51
|
+
processing_changed_at: now,
|
|
52
|
+
last_provider: (_a = args.provider) !== null && _a !== void 0 ? _a : null,
|
|
53
|
+
last_provider_status: (_b = args.providerStatus) !== null && _b !== void 0 ? _b : null,
|
|
54
|
+
updated_at: now
|
|
55
|
+
});
|
|
56
|
+
if (updated === 0)
|
|
57
|
+
return undefined;
|
|
58
|
+
const row = await knex('transactions').where({ transactionId: args.transactionId }).first();
|
|
59
|
+
return mapTransactionRow(row);
|
|
60
|
+
}
|
|
61
|
+
/** Find an action row by `(userId, transactionId)`. */
|
|
62
|
+
async function findAction(knex, userId, transactionId) {
|
|
63
|
+
const row = await knex('actions').where({ userId, transactionId }).first();
|
|
64
|
+
return row != null ? mapActionRow(row) : undefined;
|
|
65
|
+
}
|
|
66
|
+
async function insertAction(knex, row, now = new Date()) {
|
|
67
|
+
var _a;
|
|
68
|
+
const [id] = await knex('actions').insert({
|
|
69
|
+
userId: row.userId,
|
|
70
|
+
transactionId: row.transactionId,
|
|
71
|
+
reference: row.reference,
|
|
72
|
+
description: row.description,
|
|
73
|
+
isOutgoing: row.isOutgoing,
|
|
74
|
+
satoshis_delta: row.satoshisDelta,
|
|
75
|
+
user_nosend: row.userNosend,
|
|
76
|
+
hidden: row.hidden,
|
|
77
|
+
user_aborted: row.userAborted,
|
|
78
|
+
notify_json: (_a = row.notifyJson) !== null && _a !== void 0 ? _a : null,
|
|
79
|
+
row_version: row.rowVersion,
|
|
80
|
+
created_at: now,
|
|
81
|
+
updated_at: now
|
|
82
|
+
});
|
|
83
|
+
if (typeof id === 'number' && id > 0)
|
|
84
|
+
return id;
|
|
85
|
+
const r = await knex('actions').where({ userId: row.userId, transactionId: row.transactionId }).first('actionId');
|
|
86
|
+
return r.actionId;
|
|
87
|
+
}
|
|
88
|
+
/** Get the singleton chain tip row (`id = 1`). */
|
|
89
|
+
async function getChainTip(knex) {
|
|
90
|
+
const row = await knex('chain_tip').where({ id: 1 }).first();
|
|
91
|
+
return row != null ? mapChainTipRow(row) : undefined;
|
|
92
|
+
}
|
|
93
|
+
/** Upsert the singleton chain tip. Always uses `id = 1`. */
|
|
94
|
+
async function setChainTip(knex, args, now = new Date()) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
const existing = await knex('chain_tip').where({ id: 1 }).first('id');
|
|
97
|
+
if (existing == null) {
|
|
98
|
+
await knex('chain_tip').insert({
|
|
99
|
+
id: 1,
|
|
100
|
+
height: args.height,
|
|
101
|
+
block_hash: args.blockHash,
|
|
102
|
+
merkle_root: (_a = args.merkleRoot) !== null && _a !== void 0 ? _a : null,
|
|
103
|
+
observed_at: now,
|
|
104
|
+
created_at: now,
|
|
105
|
+
updated_at: now
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
await knex('chain_tip').where({ id: 1 }).update({
|
|
110
|
+
height: args.height,
|
|
111
|
+
block_hash: args.blockHash,
|
|
112
|
+
merkle_root: (_b = args.merkleRoot) !== null && _b !== void 0 ? _b : null,
|
|
113
|
+
observed_at: now,
|
|
114
|
+
updated_at: now
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function mapTransactionRow(row) {
|
|
118
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
119
|
+
return {
|
|
120
|
+
created_at: new Date(row.created_at),
|
|
121
|
+
updated_at: new Date(row.updated_at),
|
|
122
|
+
transactionId: row.transactionId,
|
|
123
|
+
txid: row.txid,
|
|
124
|
+
processing: row.processing,
|
|
125
|
+
processingChangedAt: new Date(row.processing_changed_at),
|
|
126
|
+
nextActionAt: row.next_action_at != null ? new Date(row.next_action_at) : undefined,
|
|
127
|
+
attempts: row.attempts,
|
|
128
|
+
rebroadcastCycles: row.rebroadcast_cycles,
|
|
129
|
+
wasBroadcast: !!row.was_broadcast,
|
|
130
|
+
idempotencyKey: (_a = row.idempotency_key) !== null && _a !== void 0 ? _a : undefined,
|
|
131
|
+
batch: (_b = row.batch) !== null && _b !== void 0 ? _b : undefined,
|
|
132
|
+
rawTx: row.raw_tx != null ? Array.from(row.raw_tx.values()) : undefined,
|
|
133
|
+
inputBeef: row.input_beef != null ? Array.from(row.input_beef.values()) : undefined,
|
|
134
|
+
height: (_c = row.height) !== null && _c !== void 0 ? _c : undefined,
|
|
135
|
+
merkleIndex: (_d = row.merkle_index) !== null && _d !== void 0 ? _d : undefined,
|
|
136
|
+
merklePath: row.merkle_path != null ? Array.from(row.merkle_path.values()) : undefined,
|
|
137
|
+
merkleRoot: (_e = row.merkle_root) !== null && _e !== void 0 ? _e : undefined,
|
|
138
|
+
blockHash: (_f = row.block_hash) !== null && _f !== void 0 ? _f : undefined,
|
|
139
|
+
isCoinbase: !!row.is_coinbase,
|
|
140
|
+
lastProvider: (_g = row.last_provider) !== null && _g !== void 0 ? _g : undefined,
|
|
141
|
+
lastProviderStatus: (_h = row.last_provider_status) !== null && _h !== void 0 ? _h : undefined,
|
|
142
|
+
frozenReason: (_j = row.frozen_reason) !== null && _j !== void 0 ? _j : undefined,
|
|
143
|
+
rowVersion: row.row_version
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function unmapTransactionRow(row, now) {
|
|
147
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
148
|
+
return {
|
|
149
|
+
txid: row.txid,
|
|
150
|
+
processing: row.processing,
|
|
151
|
+
processing_changed_at: row.processingChangedAt,
|
|
152
|
+
next_action_at: (_a = row.nextActionAt) !== null && _a !== void 0 ? _a : null,
|
|
153
|
+
attempts: row.attempts,
|
|
154
|
+
rebroadcast_cycles: row.rebroadcastCycles,
|
|
155
|
+
was_broadcast: row.wasBroadcast,
|
|
156
|
+
idempotency_key: (_b = row.idempotencyKey) !== null && _b !== void 0 ? _b : null,
|
|
157
|
+
batch: (_c = row.batch) !== null && _c !== void 0 ? _c : null,
|
|
158
|
+
raw_tx: row.rawTx != null ? Buffer.from(row.rawTx) : null,
|
|
159
|
+
input_beef: row.inputBeef != null ? Buffer.from(row.inputBeef) : null,
|
|
160
|
+
height: (_d = row.height) !== null && _d !== void 0 ? _d : null,
|
|
161
|
+
merkle_index: (_e = row.merkleIndex) !== null && _e !== void 0 ? _e : null,
|
|
162
|
+
merkle_path: row.merklePath != null ? Buffer.from(row.merklePath) : null,
|
|
163
|
+
merkle_root: (_f = row.merkleRoot) !== null && _f !== void 0 ? _f : null,
|
|
164
|
+
block_hash: (_g = row.blockHash) !== null && _g !== void 0 ? _g : null,
|
|
165
|
+
is_coinbase: row.isCoinbase,
|
|
166
|
+
last_provider: (_h = row.lastProvider) !== null && _h !== void 0 ? _h : null,
|
|
167
|
+
last_provider_status: (_j = row.lastProviderStatus) !== null && _j !== void 0 ? _j : null,
|
|
168
|
+
frozen_reason: (_k = row.frozenReason) !== null && _k !== void 0 ? _k : null,
|
|
169
|
+
row_version: row.rowVersion,
|
|
170
|
+
created_at: now,
|
|
171
|
+
updated_at: now
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function mapActionRow(row) {
|
|
175
|
+
var _a;
|
|
176
|
+
return {
|
|
177
|
+
created_at: new Date(row.created_at),
|
|
178
|
+
updated_at: new Date(row.updated_at),
|
|
179
|
+
actionId: row.actionId,
|
|
180
|
+
userId: row.userId,
|
|
181
|
+
transactionId: row.transactionId,
|
|
182
|
+
reference: row.reference,
|
|
183
|
+
description: row.description,
|
|
184
|
+
isOutgoing: !!row.isOutgoing,
|
|
185
|
+
satoshisDelta: row.satoshis_delta,
|
|
186
|
+
userNosend: !!row.user_nosend,
|
|
187
|
+
hidden: !!row.hidden,
|
|
188
|
+
userAborted: !!row.user_aborted,
|
|
189
|
+
notifyJson: (_a = row.notify_json) !== null && _a !== void 0 ? _a : undefined,
|
|
190
|
+
rowVersion: row.row_version
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function mapChainTipRow(row) {
|
|
194
|
+
var _a;
|
|
195
|
+
return {
|
|
196
|
+
created_at: new Date(row.created_at),
|
|
197
|
+
updated_at: new Date(row.updated_at),
|
|
198
|
+
id: row.id,
|
|
199
|
+
height: row.height,
|
|
200
|
+
blockHash: row.block_hash,
|
|
201
|
+
merkleRoot: (_a = row.merkle_root) !== null && _a !== void 0 ? _a : undefined,
|
|
202
|
+
observedAt: new Date(row.observed_at)
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=transactionCrud.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionCrud.js","sourceRoot":"","sources":["../../../../src/storage/schema/transactionCrud.ts"],"names":[],"mappings":";;AAUA,4DAGC;AAGD,gDAGC;AAGD,oDASC;AAYD,oDAiCC;AAGD,gCAOC;AAED,oCAuBC;AAGD,kCAGC;AAGD,kCAyBC;AAED,8CA2BC;AAiCD,oCAiBC;AAzND,uCAAqD;AAErD,iGAAiG;AAC1F,KAAK,UAAU,wBAAwB,CAAE,IAAU,EAAE,IAAY;IACtE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAA;IAC9D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AA;AACH,CAAC"}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { Beef } from '@bsv/sdk';
|
|
2
|
+
import { Knex } from 'knex';
|
|
3
|
+
import * as sdk from '../../sdk';
|
|
4
|
+
import { TableAction, TableOutput, TableTransactionNew } from './tables';
|
|
5
|
+
import { MonitorLeaseClaim, MonitorLeaseRelease, MonitorLeaseRenew, MonitorLeaseResult } from './monitorLease';
|
|
6
|
+
/**
|
|
7
|
+
* High-level service over the new-schema storage primitives.
|
|
8
|
+
*
|
|
9
|
+
* Storage methods and the Monitor call into this surface rather than the
|
|
10
|
+
* lower-level CRUD/FSM/audit/lease modules so that:
|
|
11
|
+
* - Every processing transition is audited.
|
|
12
|
+
* - Optimistic concurrency is uniformly enforced.
|
|
13
|
+
* - Chain tip + monitor lease access have one canonical entry point.
|
|
14
|
+
*
|
|
15
|
+
* Construction takes a Knex handle; instances are stateless and cheap to
|
|
16
|
+
* create — typically one per request or per Monitor task tick.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Extract the merkle leaf index for `txid` from a BUMP-encoded merkle path.
|
|
20
|
+
*
|
|
21
|
+
* The BUMP format encodes level 0 leaves with `txid: true` and an `offset`
|
|
22
|
+
* equal to the position of the transaction in its block. For a single-tx
|
|
23
|
+
* proof exactly one leaf is flagged; for trimmed compound proofs the leaf
|
|
24
|
+
* matching `txid` is selected.
|
|
25
|
+
*/
|
|
26
|
+
export declare function indexFromMerklePath(merklePath: number[], txid: string): number;
|
|
27
|
+
export declare class TransactionService {
|
|
28
|
+
private readonly knex;
|
|
29
|
+
constructor(knex: Knex);
|
|
30
|
+
findByTxid(txid: string): Promise<TableTransactionNew | undefined>;
|
|
31
|
+
findById(transactionId: number): Promise<TableTransactionNew | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* Insert a new new transaction row. The row is created in `queued` state
|
|
34
|
+
* unless the caller overrides `processing`.
|
|
35
|
+
*/
|
|
36
|
+
create(args: {
|
|
37
|
+
txid: string;
|
|
38
|
+
processing?: sdk.ProcessingStatus;
|
|
39
|
+
rawTx?: number[];
|
|
40
|
+
inputBeef?: number[];
|
|
41
|
+
batch?: string;
|
|
42
|
+
idempotencyKey?: string;
|
|
43
|
+
isCoinbase?: boolean;
|
|
44
|
+
now?: Date;
|
|
45
|
+
}): Promise<TableTransactionNew>;
|
|
46
|
+
/**
|
|
47
|
+
* Transition processing state with optimistic concurrency. Returns
|
|
48
|
+
* `undefined` when the FSM rejects the move OR the row's current state no
|
|
49
|
+
* longer matches `expectedFrom`.
|
|
50
|
+
*/
|
|
51
|
+
transition(args: {
|
|
52
|
+
transactionId: number;
|
|
53
|
+
expectedFrom: sdk.ProcessingStatus;
|
|
54
|
+
to: sdk.ProcessingStatus;
|
|
55
|
+
provider?: string;
|
|
56
|
+
providerStatus?: string;
|
|
57
|
+
details?: Record<string, unknown>;
|
|
58
|
+
now?: Date;
|
|
59
|
+
}): Promise<TableTransactionNew | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* Record acquisition of a Merkle proof for a transaction. Atomically:
|
|
62
|
+
* - Updates proof columns (height, index, merkle_path, merkle_root, block_hash)
|
|
63
|
+
* - Transitions processing to `confirmed` from any spendable-class state.
|
|
64
|
+
* - Writes a `proof.acquired` audit row.
|
|
65
|
+
*
|
|
66
|
+
* The merkle leaf index is derived from `merklePath` (BUMP) using the row's
|
|
67
|
+
* `txid`; callers do not pass it.
|
|
68
|
+
*/
|
|
69
|
+
recordProof(args: {
|
|
70
|
+
transactionId: number;
|
|
71
|
+
height: number;
|
|
72
|
+
merklePath: number[];
|
|
73
|
+
merkleRoot: string;
|
|
74
|
+
blockHash: string;
|
|
75
|
+
expectedFrom: sdk.ProcessingStatus;
|
|
76
|
+
now?: Date;
|
|
77
|
+
}): Promise<TableTransactionNew | undefined>;
|
|
78
|
+
findActionForUser(userId: number, transactionId: number): Promise<TableAction | undefined>;
|
|
79
|
+
createAction(args: {
|
|
80
|
+
userId: number;
|
|
81
|
+
transactionId: number;
|
|
82
|
+
reference: string;
|
|
83
|
+
description: string;
|
|
84
|
+
isOutgoing: boolean;
|
|
85
|
+
satoshisDelta: number;
|
|
86
|
+
userNosend?: boolean;
|
|
87
|
+
notifyJson?: string;
|
|
88
|
+
now?: Date;
|
|
89
|
+
}): Promise<number>;
|
|
90
|
+
getChainTip(): Promise<{
|
|
91
|
+
height: number;
|
|
92
|
+
blockHash: string;
|
|
93
|
+
} | undefined>;
|
|
94
|
+
setChainTip(args: {
|
|
95
|
+
height: number;
|
|
96
|
+
blockHash: string;
|
|
97
|
+
merkleRoot?: string;
|
|
98
|
+
now?: Date;
|
|
99
|
+
}): Promise<void>;
|
|
100
|
+
tryClaimLease(claim: MonitorLeaseClaim, now?: Date): Promise<MonitorLeaseResult>;
|
|
101
|
+
renewLease(renew: MonitorLeaseRenew, now?: Date): Promise<MonitorLeaseResult>;
|
|
102
|
+
releaseLease(release: MonitorLeaseRelease): Promise<boolean>;
|
|
103
|
+
/**
|
|
104
|
+
* #1 — Look up an action + its backing transaction by (userId, reference).
|
|
105
|
+
*/
|
|
106
|
+
findActionByReference(userId: number, reference: string): Promise<{
|
|
107
|
+
action: TableAction;
|
|
108
|
+
transaction: TableTransactionNew;
|
|
109
|
+
} | undefined>;
|
|
110
|
+
/**
|
|
111
|
+
* #2 — Look up an action + its backing transaction by (userId, txid).
|
|
112
|
+
*/
|
|
113
|
+
findActionByUserTxid(userId: number, txid: string): Promise<{
|
|
114
|
+
action: TableAction;
|
|
115
|
+
transaction: TableTransactionNew;
|
|
116
|
+
} | undefined>;
|
|
117
|
+
/**
|
|
118
|
+
* #3 — Upsert: find existing action for (userId, txid) or create both the new
|
|
119
|
+
* transaction row and the action row.
|
|
120
|
+
*/
|
|
121
|
+
findOrCreateActionForTxid(args: {
|
|
122
|
+
userId: number;
|
|
123
|
+
txid: string;
|
|
124
|
+
isOutgoing: boolean;
|
|
125
|
+
description: string;
|
|
126
|
+
satoshisDelta: number;
|
|
127
|
+
reference: string;
|
|
128
|
+
rawTx?: number[];
|
|
129
|
+
inputBeef?: number[];
|
|
130
|
+
processing?: sdk.ProcessingStatus;
|
|
131
|
+
now?: Date;
|
|
132
|
+
}): Promise<{
|
|
133
|
+
action: TableAction;
|
|
134
|
+
transaction: TableTransactionNew;
|
|
135
|
+
isNew: boolean;
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* #4 — Atomically update the satoshisDelta column on an action row.
|
|
139
|
+
*/
|
|
140
|
+
updateActionSatoshisDelta(actionId: number, delta: number, now?: Date): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* #5 — Create a new transaction row already in `confirmed` state with all proof
|
|
143
|
+
* columns populated. Useful for internalised transactions that arrive with a
|
|
144
|
+
* Merkle proof (bump) already attached.
|
|
145
|
+
*/
|
|
146
|
+
createWithProof(args: {
|
|
147
|
+
txid: string;
|
|
148
|
+
rawTx?: number[];
|
|
149
|
+
inputBeef?: number[];
|
|
150
|
+
height: number;
|
|
151
|
+
merklePath: number[];
|
|
152
|
+
merkleRoot: string;
|
|
153
|
+
blockHash: string;
|
|
154
|
+
isCoinbase?: boolean;
|
|
155
|
+
now?: Date;
|
|
156
|
+
}): Promise<TableTransactionNew>;
|
|
157
|
+
/**
|
|
158
|
+
* #6 — Find an existing new transaction row for the given txid (suitable for
|
|
159
|
+
* the broadcast queue) or create a new one in `queued` state.
|
|
160
|
+
*/
|
|
161
|
+
findOrCreateForBroadcast(args: {
|
|
162
|
+
txid: string;
|
|
163
|
+
rawTx: number[];
|
|
164
|
+
inputBeef?: number[];
|
|
165
|
+
batch?: string;
|
|
166
|
+
processing?: sdk.ProcessingStatus;
|
|
167
|
+
now?: Date;
|
|
168
|
+
}): Promise<{
|
|
169
|
+
transaction: TableTransactionNew;
|
|
170
|
+
isNew: boolean;
|
|
171
|
+
}>;
|
|
172
|
+
/**
|
|
173
|
+
* #7 — Bulk transition: attempt `transition` for each id; collect results.
|
|
174
|
+
* When `expectedFrom` is omitted the current state of each row is used as
|
|
175
|
+
* the expected source (lenient mode — only the FSM is checked).
|
|
176
|
+
*/
|
|
177
|
+
transitionMany(args: {
|
|
178
|
+
transactionIds: number[];
|
|
179
|
+
expectedFrom?: sdk.ProcessingStatus;
|
|
180
|
+
to: sdk.ProcessingStatus;
|
|
181
|
+
provider?: string;
|
|
182
|
+
providerStatus?: string;
|
|
183
|
+
details?: Record<string, unknown>;
|
|
184
|
+
now?: Date;
|
|
185
|
+
}): Promise<{
|
|
186
|
+
updated: number[];
|
|
187
|
+
skipped: number[];
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* #8 — Bulk-set the `batch` column for a list of transaction ids.
|
|
191
|
+
* Pass `undefined` to clear the batch tag.
|
|
192
|
+
*/
|
|
193
|
+
setBatch(transactionIds: number[], batch: string | undefined, now?: Date): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* #9 — Atomically increment the `attempts` counter for one transaction and
|
|
196
|
+
* write an `attempts.incremented` audit entry.
|
|
197
|
+
*/
|
|
198
|
+
incrementAttempts(transactionId: number, now?: Date): Promise<TableTransactionNew | undefined>;
|
|
199
|
+
/**
|
|
200
|
+
* #10 — Record the outcome of a broadcast attempt. Transitions processing
|
|
201
|
+
* state, updates `wasBroadcast` and `lastProvider*` columns, and writes an
|
|
202
|
+
* audit row.
|
|
203
|
+
*/
|
|
204
|
+
recordBroadcastResult(args: {
|
|
205
|
+
transactionId: number;
|
|
206
|
+
txid: string;
|
|
207
|
+
status: sdk.ProcessingStatus;
|
|
208
|
+
provider: string;
|
|
209
|
+
providerStatus?: string;
|
|
210
|
+
wasBroadcast?: boolean;
|
|
211
|
+
details?: Record<string, unknown>;
|
|
212
|
+
now?: Date;
|
|
213
|
+
}): Promise<TableTransactionNew | undefined>;
|
|
214
|
+
/**
|
|
215
|
+
* #11 — Append a free-form history note to the audit log for a transaction.
|
|
216
|
+
*/
|
|
217
|
+
recordHistoryNote(transactionId: number, note: {
|
|
218
|
+
what: string;
|
|
219
|
+
[k: string]: unknown;
|
|
220
|
+
}, now?: Date): Promise<void>;
|
|
221
|
+
/**
|
|
222
|
+
* #12 — For each txid that exists in the new transactions table, merge the
|
|
223
|
+
* raw transaction bytes and (where available) the Merkle path into `beef`.
|
|
224
|
+
* Txids not present in new-schema are silently skipped.
|
|
225
|
+
*/
|
|
226
|
+
mergeBeefForTxids(beef: Beef, txids: string[]): Promise<void>;
|
|
227
|
+
/**
|
|
228
|
+
* #13 — Collect broadcast-readiness info and a populated Beef for a list of
|
|
229
|
+
* txids. Each entry is classified as:
|
|
230
|
+
* - `readyToSend` — queued/sending → still needs broadcast
|
|
231
|
+
* - `alreadySent` — sent/seen/seen_multi/unconfirmed/confirmed → already on network
|
|
232
|
+
* - `error` — invalid/doubleSpend → terminal failure
|
|
233
|
+
* - `unknown` — not found in new-schema
|
|
234
|
+
*/
|
|
235
|
+
collectReqsAndBeef(txids: string[], extraTxids?: string[]): Promise<{
|
|
236
|
+
beef: Beef;
|
|
237
|
+
details: Array<{
|
|
238
|
+
txid: string;
|
|
239
|
+
status: 'readyToSend' | 'alreadySent' | 'error' | 'unknown';
|
|
240
|
+
reason?: string;
|
|
241
|
+
}>;
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* #14 — Paginated list of actions (per-user transaction views) with optional
|
|
245
|
+
* status and label filters.
|
|
246
|
+
*
|
|
247
|
+
* After the the schema cutover `tx_labels_map.transactionId` references `actions.actionId`
|
|
248
|
+
* (not `transactions.transactionId`).
|
|
249
|
+
*/
|
|
250
|
+
listActionsForUser(args: {
|
|
251
|
+
userId: number;
|
|
252
|
+
statusFilter?: sdk.ProcessingStatus[];
|
|
253
|
+
labelIds?: number[];
|
|
254
|
+
labelQueryMode?: 'all' | 'any';
|
|
255
|
+
createdAtFrom?: Date;
|
|
256
|
+
createdAtTo?: Date;
|
|
257
|
+
limit: number;
|
|
258
|
+
offset: number;
|
|
259
|
+
}): Promise<{
|
|
260
|
+
rows: Array<TableAction & {
|
|
261
|
+
txid: string;
|
|
262
|
+
processing: sdk.ProcessingStatus;
|
|
263
|
+
height?: number;
|
|
264
|
+
}>;
|
|
265
|
+
total?: number;
|
|
266
|
+
}>;
|
|
267
|
+
/**
|
|
268
|
+
* #15 — Paginated list of outputs with their backing transaction processing
|
|
269
|
+
* state. Optional filters: basket, tag set, processing state, spent flag.
|
|
270
|
+
*/
|
|
271
|
+
listOutputsForUser(args: {
|
|
272
|
+
userId: number;
|
|
273
|
+
basketId?: number;
|
|
274
|
+
tagIds?: number[];
|
|
275
|
+
tagQueryMode?: 'all' | 'any';
|
|
276
|
+
processingFilter: sdk.ProcessingStatus[];
|
|
277
|
+
includeSpent: boolean;
|
|
278
|
+
limit: number;
|
|
279
|
+
offset: number;
|
|
280
|
+
includeLockingScripts?: boolean;
|
|
281
|
+
}): Promise<{
|
|
282
|
+
rows: Array<TableOutput & {
|
|
283
|
+
processing: sdk.ProcessingStatus;
|
|
284
|
+
}>;
|
|
285
|
+
total?: number;
|
|
286
|
+
}>;
|
|
287
|
+
/**
|
|
288
|
+
* Post-cutover helper: rewrite `tx_labels_map.transactionId` rows that were
|
|
289
|
+
* written with the legacy transactionId (before the real txid + actionId were
|
|
290
|
+
* known) so that they now point at the new-schema `actions.actionId`.
|
|
291
|
+
*
|
|
292
|
+
* Call this once per new outgoing transaction immediately after
|
|
293
|
+
* `findOrCreateActionForTxid` resolves the actionId.
|
|
294
|
+
*
|
|
295
|
+
* This is a no-op when:
|
|
296
|
+
* - `legacyTransactionId` has no rows in `tx_labels_map` (no labels on the tx)
|
|
297
|
+
* - `legacyTransactionId === actionId` (should not happen in practice but
|
|
298
|
+
* is safe to call anyway)
|
|
299
|
+
*/
|
|
300
|
+
repointLabelsToActionId(legacyTransactionId: number, actionId: number, now?: Date): Promise<void>;
|
|
301
|
+
/**
|
|
302
|
+
* After `processAction` creates the new `transactions` row, remap
|
|
303
|
+
* `outputs.transactionId` and `outputs.spentBy` from the bridge-period
|
|
304
|
+
* `transactions_legacy.transactionId` to the real `transactions.transactionId`.
|
|
305
|
+
*
|
|
306
|
+
* During `createAction`, new outputs are inserted with `transactionId =
|
|
307
|
+
* legacyTransactionId` (bypassing FK constraints). `listActionsKnex` queries
|
|
308
|
+
* outputs by new transactionId, so without this remap the outputs would be
|
|
309
|
+
* invisible to `listActions`.
|
|
310
|
+
*
|
|
311
|
+
* This is a no-op when `legacyTransactionId === newTransactionId`.
|
|
312
|
+
*/
|
|
313
|
+
repointOutputsToNewTransactionId(legacyTransactionId: number, newTransactionId: number, now?: Date): Promise<void>;
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=transactionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionService.d.ts","sourceRoot":"","sources":["../../../../src/storage/schema/transactionService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,KAAK,GAAG,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAexE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,gBAAgB,CAAA;AAEvB;;;;;;;;;;;GAWG;AACH;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAE,UAAU,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/E;AAED,qBAAa,kBAAkB;IAChB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;IAMlC,UAAU,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAInE,QAAQ,CAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAIhF;;;OAGG;IACG,MAAM,CAAE,IAAI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