@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
package/docs/monitor.md
CHANGED
|
@@ -23,6 +23,10 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
23
23
|
| --- |
|
|
24
24
|
| [DeactivedHeader](#interface-deactivedheader) |
|
|
25
25
|
| [MonitorDaemonSetup](#interface-monitordaemonsetup) |
|
|
26
|
+
| [MonitorLeaseClaim](#interface-monitorleaseclaim) |
|
|
27
|
+
| [MonitorLeaseRelease](#interface-monitorleaserelease) |
|
|
28
|
+
| [MonitorLeaseRenew](#interface-monitorleaserenew) |
|
|
29
|
+
| [MonitorLeaseResult](#interface-monitorleaseresult) |
|
|
26
30
|
| [MonitorOptions](#interface-monitoroptions) |
|
|
27
31
|
| [ReviewHeightRangeResult](#interface-reviewheightrangeresult) |
|
|
28
32
|
| [TaskPurgeParams](#interface-taskpurgeparams) |
|
|
@@ -96,6 +100,72 @@ See also: [Chain](./client.md#type-chain), [Chaintracks](./services.md#class-cha
|
|
|
96
100
|
|
|
97
101
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
98
102
|
|
|
103
|
+
---
|
|
104
|
+
##### Interface: MonitorLeaseClaim
|
|
105
|
+
|
|
106
|
+
monitor lease primitive.
|
|
107
|
+
|
|
108
|
+
A `monitor_lease` row records the owner that may currently execute a named
|
|
109
|
+
task. Acquisition is opportunistic: a Monitor calls `tryClaimLease()` to
|
|
110
|
+
insert or take over a stale row; if it succeeds it owns the task until
|
|
111
|
+
`expiresAt`. While running it calls `renewLease()` to extend the deadline.
|
|
112
|
+
On clean shutdown it calls `releaseLease()`.
|
|
113
|
+
|
|
114
|
+
The Knex driver expresses claim + takeover as a single conditional UPDATE
|
|
115
|
+
so that two contending Monitors cannot both believe they own the task — at
|
|
116
|
+
most one row write will succeed per (task, expiry) pair.
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
export interface MonitorLeaseClaim {
|
|
120
|
+
taskName: string;
|
|
121
|
+
ownerId: string;
|
|
122
|
+
ttlMs: number;
|
|
123
|
+
note?: string;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
##### Interface: MonitorLeaseRelease
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
export interface MonitorLeaseRelease {
|
|
134
|
+
taskName: string;
|
|
135
|
+
ownerId: string;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
##### Interface: MonitorLeaseRenew
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
export interface MonitorLeaseRenew {
|
|
146
|
+
taskName: string;
|
|
147
|
+
ownerId: string;
|
|
148
|
+
ttlMs: number;
|
|
149
|
+
note?: string;
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
##### Interface: MonitorLeaseResult
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
export interface MonitorLeaseResult {
|
|
160
|
+
acquired: boolean;
|
|
161
|
+
lease?: TableMonitorLease;
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
See also: [TableMonitorLease](./storage.md#interface-tablemonitorlease)
|
|
166
|
+
|
|
167
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
168
|
+
|
|
99
169
|
---
|
|
100
170
|
##### Interface: MonitorOptions
|
|
101
171
|
|
|
@@ -112,6 +182,7 @@ export interface MonitorOptions {
|
|
|
112
182
|
abandonedMsecs: number;
|
|
113
183
|
unprovenAttemptsLimitTest: number;
|
|
114
184
|
unprovenAttemptsLimitMain: number;
|
|
185
|
+
maxRebroadcastAttempts: number;
|
|
115
186
|
callbackToken?: string;
|
|
116
187
|
loadLastSSEEventId?: () => Promise<string | undefined>;
|
|
117
188
|
saveLastSSEEventId?: (lastEventId: string) => Promise<void>;
|
|
@@ -151,6 +222,19 @@ Load persisted SSE lastEventId (e.g. from SQLite) for catchup on startup
|
|
|
151
222
|
loadLastSSEEventId?: () => Promise<string | undefined>
|
|
152
223
|
```
|
|
153
224
|
|
|
225
|
+
###### Property maxRebroadcastAttempts
|
|
226
|
+
|
|
227
|
+
Maximum number of times a broadcast transaction may be reset to 'unsent' for
|
|
228
|
+
rebroadcast after proof check timeout (circuit breaker).
|
|
229
|
+
|
|
230
|
+
Default 0 means unlimited — the tx is rebroadcast indefinitely until a proof
|
|
231
|
+
is found. Set to a positive integer to cap rebroadcast cycles; once the limit
|
|
232
|
+
is reached the req is marked 'invalid'.
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
maxRebroadcastAttempts: number
|
|
236
|
+
```
|
|
237
|
+
|
|
154
238
|
###### Property msecsWaitPerMerkleProofServiceReq
|
|
155
239
|
|
|
156
240
|
How many msecs to wait after each getMerkleProof service request.
|
|
@@ -234,21 +318,86 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
234
318
|
|
|
235
319
|
| | |
|
|
236
320
|
| --- | --- |
|
|
237
|
-
| [
|
|
238
|
-
| [
|
|
239
|
-
| [
|
|
240
|
-
| [
|
|
241
|
-
| [
|
|
242
|
-
| [
|
|
243
|
-
| [
|
|
244
|
-
| [
|
|
245
|
-
| [
|
|
246
|
-
| [
|
|
321
|
+
| [LeasedMonitorTask](#class-leasedmonitortask) | [TaskPurge](#class-taskpurge) |
|
|
322
|
+
| [Monitor](#class-monitor) | [TaskReorg](#class-taskreorg) |
|
|
323
|
+
| [MonitorDaemon](#class-monitordaemon) | [TaskReviewDoubleSpends](#class-taskreviewdoublespends) |
|
|
324
|
+
| [TaskArcadeSSE](#class-taskarcadesse) | [TaskReviewProvenTxs](#class-taskreviewproventxs) |
|
|
325
|
+
| [TaskCheckForProofs](#class-taskcheckforproofs) | [TaskReviewStatus](#class-taskreviewstatus) |
|
|
326
|
+
| [TaskCheckNoSends](#class-taskchecknosends) | [TaskReviewUtxos](#class-taskreviewutxos) |
|
|
327
|
+
| [TaskClock](#class-taskclock) | [TaskSendWaiting](#class-tasksendwaiting) |
|
|
328
|
+
| [TaskFailAbandoned](#class-taskfailabandoned) | [TaskSyncWhenIdle](#class-tasksyncwhenidle) |
|
|
329
|
+
| [TaskMineBlock](#class-taskmineblock) | [TaskUnFail](#class-taskunfail) |
|
|
330
|
+
| [TaskMonitorCallHistory](#class-taskmonitorcallhistory) | [WalletMonitorTask](#class-walletmonitortask) |
|
|
331
|
+
| [TaskNewHeader](#class-tasknewheader) | |
|
|
247
332
|
|
|
248
333
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
249
334
|
|
|
250
335
|
---
|
|
251
336
|
|
|
337
|
+
##### Class: LeasedMonitorTask
|
|
338
|
+
|
|
339
|
+
Helper that wraps a long-running monitor task body in `monitor_lease`
|
|
340
|
+
acquire / renew / release semantics.
|
|
341
|
+
|
|
342
|
+
Usage:
|
|
343
|
+
```typescript
|
|
344
|
+
const helper = new LeasedMonitorTask(txSvc)
|
|
345
|
+
const { ran } = await helper.run('proof-acquisition', ownerId, 30_000, async () => {
|
|
346
|
+
// task body runs only when lease is acquired
|
|
347
|
+
})
|
|
348
|
+
if (!ran) {
|
|
349
|
+
console.log('lease held by another instance – skipping')
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Lease renewal is driven by a `setInterval` firing at `ttlMs * 0.4` so the
|
|
354
|
+
lease is always refreshed well before it would expire (40 % window). The
|
|
355
|
+
interval is cleared in the `finally` block before `releaseLease` is called.
|
|
356
|
+
|
|
357
|
+
Logging writes to `console.log` so that lease activity is visible in the
|
|
358
|
+
same stream as other Monitor diagnostics.
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
export class LeasedMonitorTask {
|
|
362
|
+
constructor(private readonly svc: TransactionService)
|
|
363
|
+
async run(taskName: string, ownerId: string, ttlMs: number, body: () => Promise<void>): Promise<{
|
|
364
|
+
ran: boolean;
|
|
365
|
+
}>
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
See also: [TransactionService](./storage.md#class-transactionservice)
|
|
370
|
+
|
|
371
|
+
###### Method run
|
|
372
|
+
|
|
373
|
+
Attempt to claim the named lease and, if successful, execute `body`.
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
async run(taskName: string, ownerId: string, ttlMs: number, body: () => Promise<void>): Promise<{
|
|
377
|
+
ran: boolean;
|
|
378
|
+
}>
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Returns
|
|
382
|
+
|
|
383
|
+
`{ ran: true }` when the lease was acquired and `body` completed
|
|
384
|
+
(even if `body` threw — the error is re-thrown after cleanup).
|
|
385
|
+
`{ ran: false }` when another owner holds a live lease.
|
|
386
|
+
|
|
387
|
+
Argument Details
|
|
388
|
+
|
|
389
|
+
+ **taskName**
|
|
390
|
+
+ Logical task identifier stored in `monitor_lease.task_name`.
|
|
391
|
+
+ **ownerId**
|
|
392
|
+
+ Stable identifier for this Monitor instance.
|
|
393
|
+
+ **ttlMs**
|
|
394
|
+
+ Lease TTL in milliseconds. Renewal fires at `ttlMs * 0.4`.
|
|
395
|
+
+ **body**
|
|
396
|
+
+ Async work to perform while holding the lease.
|
|
397
|
+
|
|
398
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
399
|
+
|
|
400
|
+
---
|
|
252
401
|
##### Class: Monitor
|
|
253
402
|
|
|
254
403
|
Background task to make sure transactions are processed, transaction proofs are received and propagated,
|
|
@@ -257,6 +406,7 @@ and potentially that reorgs update proofs that were already received.
|
|
|
257
406
|
```ts
|
|
258
407
|
export class Monitor {
|
|
259
408
|
static createDefaultWalletMonitorOptions(chain: Chain, storage: MonitorStorage, services?: Services, chaintracks?: Chaintracks, startupTaskMode: MonitorStartupTaskMode = "none"): MonitorOptions
|
|
409
|
+
instanceId: string = randomBytesHex(8);
|
|
260
410
|
options: MonitorOptions;
|
|
261
411
|
services: Services | WalletServices;
|
|
262
412
|
chain: Chain;
|
|
@@ -268,6 +418,7 @@ export class Monitor {
|
|
|
268
418
|
onTransactionBroadcasted?: (broadcastResult: ReviewActionResult) => Promise<void>;
|
|
269
419
|
onTransactionProven?: (txStatus: ProvenTransactionStatus) => Promise<void>;
|
|
270
420
|
onTransactionStatusChanged?: (txid: string, newStatus: string) => Promise<void>;
|
|
421
|
+
get ready(): Promise<void>
|
|
271
422
|
constructor(options: MonitorOptions)
|
|
272
423
|
async destroy(): Promise<void>
|
|
273
424
|
static readonly oneSecond = 1000;
|
|
@@ -293,7 +444,7 @@ export class Monitor {
|
|
|
293
444
|
removeTask(name: string): void
|
|
294
445
|
async runTask(name: string): Promise<string>
|
|
295
446
|
async runOnce(): Promise<void>
|
|
296
|
-
_runAsyncSetup
|
|
447
|
+
_runAsyncSetup = true;
|
|
297
448
|
_tasksRunningPromise?: PromiseLike<void>;
|
|
298
449
|
resolveCompletion: ((value: void | PromiseLike<void>) => void) | undefined = undefined;
|
|
299
450
|
async startTasks(): Promise<void>
|
|
@@ -312,7 +463,7 @@ export class Monitor {
|
|
|
312
463
|
}
|
|
313
464
|
```
|
|
314
465
|
|
|
315
|
-
See also: [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [Chaintracks](./services.md#class-chaintracks), [ChaintracksClientApi](./services.md#interface-chaintracksclientapi), [DeactivedHeader](./monitor.md#interface-deactivedheader), [MonitorOptions](./monitor.md#interface-monitoroptions), [MonitorStartupTaskMode](./monitor.md#type-monitorstartuptaskmode), [MonitorStorage](./monitor.md#type-monitorstorage), [ProvenTransactionStatus](./client.md#interface-proventransactionstatus), [ReviewActionResult](./client.md#interface-reviewactionresult), [Services](./services.md#class-services), [TaskPurgeParams](./monitor.md#interface-taskpurgeparams), [WalletMonitorTask](./monitor.md#class-walletmonitortask), [WalletServices](./client.md#interface-walletservices)
|
|
466
|
+
See also: [BlockHeader](./client.md#interface-blockheader), [Chain](./client.md#type-chain), [Chaintracks](./services.md#class-chaintracks), [ChaintracksClientApi](./services.md#interface-chaintracksclientapi), [DeactivedHeader](./monitor.md#interface-deactivedheader), [MonitorOptions](./monitor.md#interface-monitoroptions), [MonitorStartupTaskMode](./monitor.md#type-monitorstartuptaskmode), [MonitorStorage](./monitor.md#type-monitorstorage), [ProvenTransactionStatus](./client.md#interface-proventransactionstatus), [ReviewActionResult](./client.md#interface-reviewactionresult), [Services](./services.md#class-services), [TaskPurgeParams](./monitor.md#interface-taskpurgeparams), [WalletMonitorTask](./monitor.md#class-walletmonitortask), [WalletServices](./client.md#interface-walletservices), [randomBytesHex](./client.md#function-randombyteshex)
|
|
316
467
|
|
|
317
468
|
###### Property _otherTasks
|
|
318
469
|
|
|
@@ -332,6 +483,18 @@ _tasks: WalletMonitorTask[] = []
|
|
|
332
483
|
```
|
|
333
484
|
See also: [WalletMonitorTask](./monitor.md#class-walletmonitortask)
|
|
334
485
|
|
|
486
|
+
###### Property instanceId
|
|
487
|
+
|
|
488
|
+
Stable identifier for this Monitor instance, used as the `ownerId` when
|
|
489
|
+
acquiring monitor_lease rows. Generated once at construction time via
|
|
490
|
+
8 cryptographically random bytes (16 hex chars). Callers may override this
|
|
491
|
+
after construction if a deterministic / persisted id is preferred.
|
|
492
|
+
|
|
493
|
+
```ts
|
|
494
|
+
instanceId: string = randomBytesHex(8)
|
|
495
|
+
```
|
|
496
|
+
See also: [randomBytesHex](./client.md#function-randombyteshex)
|
|
497
|
+
|
|
335
498
|
###### Method addDefaultTasks
|
|
336
499
|
|
|
337
500
|
Default tasks with settings appropriate for a single user storage
|
|
@@ -436,7 +599,7 @@ export class MonitorDaemon {
|
|
|
436
599
|
setup?: MonitorDaemonSetup;
|
|
437
600
|
doneListening?: Promise<void>;
|
|
438
601
|
doneTasks?: Promise<void>;
|
|
439
|
-
stopDaemon
|
|
602
|
+
stopDaemon = false;
|
|
440
603
|
constructor(public args: MonitorDaemonSetup, public noRunTasks?: boolean)
|
|
441
604
|
async createSetup(): Promise<void>
|
|
442
605
|
async start(): Promise<void>
|
|
@@ -459,7 +622,7 @@ when transactions are MINED.
|
|
|
459
622
|
|
|
460
623
|
```ts
|
|
461
624
|
export class TaskArcadeSSE extends WalletMonitorTask {
|
|
462
|
-
static taskName = "ArcadeSSE";
|
|
625
|
+
static readonly taskName = "ArcadeSSE";
|
|
463
626
|
sseClient: ArcSSEClient | null = null;
|
|
464
627
|
constructor(monitor: Monitor)
|
|
465
628
|
override async asyncSetup(): Promise<void>
|
|
@@ -491,7 +654,7 @@ the original ProvenTxReq status is advanced to 'notifying'.
|
|
|
491
654
|
|
|
492
655
|
```ts
|
|
493
656
|
export class TaskCheckForProofs extends WalletMonitorTask {
|
|
494
|
-
static taskName = "CheckForProofs";
|
|
657
|
+
static readonly taskName = "CheckForProofs";
|
|
495
658
|
static checkNow = false;
|
|
496
659
|
constructor(monitor: Monitor, public triggerMsecs = 0)
|
|
497
660
|
trigger(nowMsecsSinceEpoch: number): {
|
|
@@ -541,7 +704,7 @@ the original ProvenTxReq status is advanced to 'notifying'.
|
|
|
541
704
|
|
|
542
705
|
```ts
|
|
543
706
|
export class TaskCheckNoSends extends WalletMonitorTask {
|
|
544
|
-
static taskName = "CheckNoSends";
|
|
707
|
+
static readonly taskName = "CheckNoSends";
|
|
545
708
|
static checkNow = false;
|
|
546
709
|
constructor(monitor: Monitor, public triggerMsecs = Monitor.oneDay * 1)
|
|
547
710
|
trigger(nowMsecsSinceEpoch: number): {
|
|
@@ -579,7 +742,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
579
742
|
|
|
580
743
|
```ts
|
|
581
744
|
export class TaskClock extends WalletMonitorTask {
|
|
582
|
-
static taskName = "Clock";
|
|
745
|
+
static readonly taskName = "Clock";
|
|
583
746
|
nextMinute: number;
|
|
584
747
|
constructor(monitor: Monitor, public triggerMsecs = 1 * Monitor.oneSecond)
|
|
585
748
|
trigger(nowMsecsSinceEpoch: number): {
|
|
@@ -606,7 +769,7 @@ outputs are not spendable.
|
|
|
606
769
|
|
|
607
770
|
```ts
|
|
608
771
|
export class TaskFailAbandoned extends WalletMonitorTask {
|
|
609
|
-
static taskName = "FailAbandoned";
|
|
772
|
+
static readonly taskName = "FailAbandoned";
|
|
610
773
|
constructor(monitor: Monitor, public triggerMsecs = 1000 * 60 * 5)
|
|
611
774
|
trigger(nowMsecsSinceEpoch: number): {
|
|
612
775
|
run: boolean;
|
|
@@ -624,7 +787,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
624
787
|
|
|
625
788
|
```ts
|
|
626
789
|
export class TaskMineBlock extends WalletMonitorTask {
|
|
627
|
-
static taskName = "MineBlock";
|
|
790
|
+
static readonly taskName = "MineBlock";
|
|
628
791
|
static mineNow = false;
|
|
629
792
|
constructor(monitor: Monitor, public triggerMsecs = 10 * Monitor.oneMinute)
|
|
630
793
|
trigger(nowMsecsSinceEpoch: number): {
|
|
@@ -643,7 +806,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
643
806
|
|
|
644
807
|
```ts
|
|
645
808
|
export class TaskMonitorCallHistory extends WalletMonitorTask {
|
|
646
|
-
static taskName = "MonitorCallHistory";
|
|
809
|
+
static readonly taskName = "MonitorCallHistory";
|
|
647
810
|
constructor(monitor: Monitor, public triggerMsecs = Monitor.oneMinute * 12)
|
|
648
811
|
trigger(nowMsecsSinceEpoch: number): {
|
|
649
812
|
run: boolean;
|
|
@@ -672,7 +835,7 @@ with that header height as the limit for which proofs are accepted.
|
|
|
672
835
|
|
|
673
836
|
```ts
|
|
674
837
|
export class TaskNewHeader extends WalletMonitorTask {
|
|
675
|
-
static taskName = "NewHeader";
|
|
838
|
+
static readonly taskName = "NewHeader";
|
|
676
839
|
header?: BlockHeader;
|
|
677
840
|
queuedHeader?: BlockHeader;
|
|
678
841
|
queuedHeaderWhen?: Date;
|
|
@@ -709,7 +872,7 @@ See also: [BlockHeader](./client.md#interface-blockheader)
|
|
|
709
872
|
|
|
710
873
|
###### Method asyncSetup
|
|
711
874
|
|
|
712
|
-
|
|
875
|
+
This is a temporary incomplete solution for which a full chaintracker
|
|
713
876
|
with new header and reorg event notification is required.
|
|
714
877
|
|
|
715
878
|
New header events drive retrieving merklePaths for newly mined transactions.
|
|
@@ -732,7 +895,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
732
895
|
|
|
733
896
|
```ts
|
|
734
897
|
export class TaskPurge extends WalletMonitorTask {
|
|
735
|
-
static taskName = "Purge";
|
|
898
|
+
static readonly taskName = "Purge";
|
|
736
899
|
static checkNow = false;
|
|
737
900
|
constructor(monitor: Monitor, public params: TaskPurgeParams, public triggerMsecs = 0)
|
|
738
901
|
trigger(nowMsecsSinceEpoch: number): {
|
|
@@ -782,7 +945,7 @@ createAction fails to verify a generated beef against the chaintracker.
|
|
|
782
945
|
|
|
783
946
|
```ts
|
|
784
947
|
export class TaskReorg extends WalletMonitorTask {
|
|
785
|
-
static taskName = "Reorg";
|
|
948
|
+
static readonly taskName = "Reorg";
|
|
786
949
|
process: DeactivedHeader[] = [];
|
|
787
950
|
constructor(monitor: Monitor, public agedMsecs = Monitor.oneMinute * 10, public maxRetries = 3)
|
|
788
951
|
trigger(nowMsecsSinceEpoch: number): {
|
|
@@ -823,7 +986,7 @@ back to 'unfail' so existing recovery handling can re-process them.
|
|
|
823
986
|
|
|
824
987
|
```ts
|
|
825
988
|
export class TaskReviewDoubleSpends extends WalletMonitorTask {
|
|
826
|
-
static taskName = "ReviewDoubleSpends";
|
|
989
|
+
static readonly taskName = "ReviewDoubleSpends";
|
|
827
990
|
static checkNow = false;
|
|
828
991
|
triggerNextMsecs: number;
|
|
829
992
|
constructor(monitor: Monitor, public triggerMsecs = Monitor.oneMinute * 12, public reviewLimit = 100, public minAgeMinutes = 60, public triggerQuickMsecs = Monitor.oneMinute * 1)
|
|
@@ -853,7 +1016,7 @@ the currently canonical merkleRoot at a height no longer matches stored proven_t
|
|
|
853
1016
|
|
|
854
1017
|
```ts
|
|
855
1018
|
export class TaskReviewProvenTxs extends WalletMonitorTask {
|
|
856
|
-
static taskName = "ReviewProvenTxs";
|
|
1019
|
+
static readonly taskName = "ReviewProvenTxs";
|
|
857
1020
|
static checkNow = false;
|
|
858
1021
|
triggerNextMsecs: number;
|
|
859
1022
|
constructor(monitor: Monitor, public triggerMsecs = Monitor.oneMinute * 10, public maxHeightsPerRun = 100, public minBlockAge = 100, public triggerQuickMsecs = Monitor.oneMinute * 1)
|
|
@@ -883,7 +1046,7 @@ Looks for reqs with 'invalid' status that have corresonding transactions with st
|
|
|
883
1046
|
|
|
884
1047
|
```ts
|
|
885
1048
|
export class TaskReviewStatus extends WalletMonitorTask {
|
|
886
|
-
static taskName = "ReviewStatus";
|
|
1049
|
+
static readonly taskName = "ReviewStatus";
|
|
887
1050
|
static checkNow = false;
|
|
888
1051
|
constructor(monitor: Monitor, public triggerMsecs = 1000 * 60 * 15, public agedMsecs = 1000 * 60 * 5)
|
|
889
1052
|
trigger(nowMsecsSinceEpoch: number): {
|
|
@@ -914,7 +1077,7 @@ The task itself is disabled and will not run on a schedule; review must be trigg
|
|
|
914
1077
|
|
|
915
1078
|
```ts
|
|
916
1079
|
export class TaskReviewUtxos extends WalletMonitorTask {
|
|
917
|
-
static taskName = "ReviewUtxos";
|
|
1080
|
+
static readonly taskName = "ReviewUtxos";
|
|
918
1081
|
static checkNow = false;
|
|
919
1082
|
constructor(monitor: Monitor, public triggerMsecs = 0, public userLimit = 10, public userOffset = 0, public tags: string[] = ["release", "all"])
|
|
920
1083
|
trigger(_nowMsecsSinceEpoch: number): {
|
|
@@ -934,9 +1097,9 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
934
1097
|
|
|
935
1098
|
```ts
|
|
936
1099
|
export class TaskSendWaiting extends WalletMonitorTask {
|
|
937
|
-
static taskName = "SendWaiting";
|
|
1100
|
+
static readonly taskName = "SendWaiting";
|
|
938
1101
|
lastSendingRunMsecsSinceEpoch: number | undefined;
|
|
939
|
-
includeSending
|
|
1102
|
+
includeSending = true;
|
|
940
1103
|
triggerNextMsecs: number;
|
|
941
1104
|
constructor(monitor: Monitor, public triggerMsecs = Monitor.oneSecond * 8, public agedMsecs = Monitor.oneSecond * 7, public sendingMsecs = Monitor.oneMinute * 5, public triggerQuickMsecs = Monitor.oneSecond * 1, public chunkLimit = 100)
|
|
942
1105
|
trigger(nowMsecsSinceEpoch: number): {
|
|
@@ -999,7 +1162,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
999
1162
|
|
|
1000
1163
|
```ts
|
|
1001
1164
|
export class TaskSyncWhenIdle extends WalletMonitorTask {
|
|
1002
|
-
static taskName = "SyncWhenIdle";
|
|
1165
|
+
static readonly taskName = "SyncWhenIdle";
|
|
1003
1166
|
constructor(monitor: Monitor, public triggerMsecs = 1000 * 60 * 1)
|
|
1004
1167
|
trigger(nowMsecsSinceEpoch: number): {
|
|
1005
1168
|
run: boolean;
|
|
@@ -1026,7 +1189,7 @@ If it fails (to find a merklePath), returns the req status to 'invalid'.
|
|
|
1026
1189
|
|
|
1027
1190
|
```ts
|
|
1028
1191
|
export class TaskUnFail extends WalletMonitorTask {
|
|
1029
|
-
static taskName = "UnFail";
|
|
1192
|
+
static readonly taskName = "UnFail";
|
|
1030
1193
|
static checkNow = false;
|
|
1031
1194
|
constructor(monitor: Monitor, public triggerMsecs = Monitor.oneMinute * 10)
|
|
1032
1195
|
trigger(nowMsecsSinceEpoch: number): {
|
|
@@ -1128,6 +1291,17 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
1128
1291
|
---
|
|
1129
1292
|
#### Functions
|
|
1130
1293
|
|
|
1294
|
+
| |
|
|
1295
|
+
| --- |
|
|
1296
|
+
| [getProofs](#function-getproofs) |
|
|
1297
|
+
| [releaseLease](#function-releaselease) |
|
|
1298
|
+
| [renewLease](#function-renewlease) |
|
|
1299
|
+
| [tryClaimLease](#function-tryclaimlease) |
|
|
1300
|
+
|
|
1301
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1302
|
+
|
|
1303
|
+
---
|
|
1304
|
+
|
|
1131
1305
|
##### Function: getProofs
|
|
1132
1306
|
|
|
1133
1307
|
Process an array of table.ProvenTxReq (typically with status 'unmined' or 'unknown')
|
|
@@ -1142,7 +1316,7 @@ depending on chaintracks succeeding on proof verification.
|
|
|
1142
1316
|
Increments attempts if proofs where requested.
|
|
1143
1317
|
|
|
1144
1318
|
```ts
|
|
1145
|
-
export async function getProofs(task: WalletMonitorTask, reqs: TableProvenTxReq[], indent = 0, countsAsAttempt = false, ignoreStatus = false
|
|
1319
|
+
export async function getProofs(task: WalletMonitorTask, reqs: TableProvenTxReq[], maxAcceptableHeight: number, indent = 0, countsAsAttempt = false, ignoreStatus = false): Promise<{
|
|
1146
1320
|
proven: TableProvenTxReq[];
|
|
1147
1321
|
invalid: TableProvenTxReq[];
|
|
1148
1322
|
log: string;
|
|
@@ -1157,6 +1331,54 @@ reqs partitioned by status
|
|
|
1157
1331
|
|
|
1158
1332
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1159
1333
|
|
|
1334
|
+
---
|
|
1335
|
+
##### Function: releaseLease
|
|
1336
|
+
|
|
1337
|
+
Release the lease (no-op when not owned by the caller).
|
|
1338
|
+
The row is deleted so subsequent claimants do not see an inherited
|
|
1339
|
+
`renew_count`.
|
|
1340
|
+
|
|
1341
|
+
```ts
|
|
1342
|
+
export async function releaseLease(knex: Knex, release: MonitorLeaseRelease): Promise<boolean>
|
|
1343
|
+
```
|
|
1344
|
+
|
|
1345
|
+
See also: [MonitorLeaseRelease](./monitor.md#interface-monitorleaserelease)
|
|
1346
|
+
|
|
1347
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1348
|
+
|
|
1349
|
+
---
|
|
1350
|
+
##### Function: renewLease
|
|
1351
|
+
|
|
1352
|
+
Extend the current owner's lease. Fails (returns `acquired: false`) when the
|
|
1353
|
+
row does not exist, is owned by someone else, or has already expired.
|
|
1354
|
+
|
|
1355
|
+
```ts
|
|
1356
|
+
export async function renewLease(knex: Knex, renew: MonitorLeaseRenew, now: Date = new Date()): Promise<MonitorLeaseResult>
|
|
1357
|
+
```
|
|
1358
|
+
|
|
1359
|
+
See also: [MonitorLeaseRenew](./monitor.md#interface-monitorleaserenew), [MonitorLeaseResult](./monitor.md#interface-monitorleaseresult)
|
|
1360
|
+
|
|
1361
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1362
|
+
|
|
1363
|
+
---
|
|
1364
|
+
##### Function: tryClaimLease
|
|
1365
|
+
|
|
1366
|
+
Try to claim a lease on `taskName`. Succeeds iff:
|
|
1367
|
+
- no row exists for the task, OR
|
|
1368
|
+
- the existing row has `expiresAt <= now`, OR
|
|
1369
|
+
- the existing row's `ownerId` already equals the requested owner.
|
|
1370
|
+
|
|
1371
|
+
On success the row is upserted with `expiresAt = now + ttlMs` and
|
|
1372
|
+
`renewCount = renewCount + 1` (0 for fresh rows).
|
|
1373
|
+
|
|
1374
|
+
```ts
|
|
1375
|
+
export async function tryClaimLease(knex: Knex, claim: MonitorLeaseClaim, now: Date = new Date()): Promise<MonitorLeaseResult>
|
|
1376
|
+
```
|
|
1377
|
+
|
|
1378
|
+
See also: [MonitorLeaseClaim](./monitor.md#interface-monitorleaseclaim), [MonitorLeaseResult](./monitor.md#interface-monitorleaseresult)
|
|
1379
|
+
|
|
1380
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1381
|
+
|
|
1160
1382
|
---
|
|
1161
1383
|
#### Types
|
|
1162
1384
|
|