@bsv/wallet-toolbox 1.1.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/.env.template +22 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
- package/.github/ISSUE_TEMPLATE/discussion.md +24 -0
- package/.github/pull_request_template.md +24 -0
- package/.github/workflows/push.yaml +66 -0
- package/.prettierrc +10 -0
- package/CONTRIBUTING.md +89 -0
- package/LICENSE.txt +28 -0
- package/README.md +124 -0
- package/dev.sqlite3 +0 -0
- package/docs/README.md +15 -0
- package/docs/client.md +6812 -0
- package/docs/monitor.md +648 -0
- package/docs/services.md +496 -0
- package/docs/storage.md +1884 -0
- package/docs/wallet.md +6812 -0
- package/jest.config.ts +29 -0
- package/knexfile.js +9 -0
- package/license.md +1 -0
- package/out/src/Wallet.d.ts +83 -0
- package/out/src/Wallet.d.ts.map +1 -0
- package/out/src/Wallet.js +415 -0
- package/out/src/Wallet.js.map +1 -0
- package/out/src/index.all.d.ts +9 -0
- package/out/src/index.all.d.ts.map +1 -0
- package/out/src/index.all.js +48 -0
- package/out/src/index.all.js.map +1 -0
- package/out/src/index.client.d.ts +8 -0
- package/out/src/index.client.d.ts.map +1 -0
- package/out/src/index.client.js +47 -0
- package/out/src/index.client.js.map +1 -0
- package/out/src/index.d.ts +3 -0
- package/out/src/index.d.ts.map +1 -0
- package/out/src/index.js +42 -0
- package/out/src/index.js.map +1 -0
- package/out/src/monitor/Monitor.d.ts +89 -0
- package/out/src/monitor/Monitor.d.ts.map +1 -0
- package/out/src/monitor/Monitor.js +253 -0
- package/out/src/monitor/Monitor.js.map +1 -0
- package/out/src/monitor/MonitorDaemon.d.ts +30 -0
- package/out/src/monitor/MonitorDaemon.d.ts.map +1 -0
- package/out/src/monitor/MonitorDaemon.js +135 -0
- package/out/src/monitor/MonitorDaemon.js.map +1 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.d.ts +2 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.d.ts.map +1 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.js +50 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.js.map +1 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +53 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.js +197 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -0
- package/out/src/monitor/tasks/TaskClock.d.ts +14 -0
- package/out/src/monitor/tasks/TaskClock.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskClock.js +27 -0
- package/out/src/monitor/tasks/TaskClock.js.map +1 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts +20 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.js +52 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -0
- package/out/src/monitor/tasks/TaskNewHeader.d.ts +15 -0
- package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskNewHeader.js +45 -0
- package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -0
- package/out/src/monitor/tasks/TaskPurge.d.ts +45 -0
- package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskPurge.js +35 -0
- package/out/src/monitor/tasks/TaskPurge.js.map +1 -0
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts +26 -0
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskReviewStatus.js +44 -0
- package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -0
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts +32 -0
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskSendWaiting.js +99 -0
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts +12 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.js +22 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.js.map +1 -0
- package/out/src/monitor/tasks/WalletMonitorTask.d.ts +40 -0
- package/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +1 -0
- package/out/src/monitor/tasks/WalletMonitorTask.js +37 -0
- package/out/src/monitor/tasks/WalletMonitorTask.js.map +1 -0
- package/out/src/sdk/CertOps.d.ts +66 -0
- package/out/src/sdk/CertOps.d.ts.map +1 -0
- package/out/src/sdk/CertOps.js +198 -0
- package/out/src/sdk/CertOps.js.map +1 -0
- package/out/src/sdk/PrivilegedKeyManager.d.ts +125 -0
- package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -0
- package/out/src/sdk/PrivilegedKeyManager.js +293 -0
- package/out/src/sdk/PrivilegedKeyManager.js.map +1 -0
- package/out/src/sdk/StorageSyncReader.d.ts +121 -0
- package/out/src/sdk/StorageSyncReader.d.ts.map +1 -0
- package/out/src/sdk/StorageSyncReader.js +3 -0
- package/out/src/sdk/StorageSyncReader.js.map +1 -0
- package/out/src/sdk/StorageSyncReaderWriter.d.ts +89 -0
- package/out/src/sdk/StorageSyncReaderWriter.d.ts.map +1 -0
- package/out/src/sdk/StorageSyncReaderWriter.js +3 -0
- package/out/src/sdk/StorageSyncReaderWriter.js.map +1 -0
- package/out/src/sdk/WERR_errors.d.ts +90 -0
- package/out/src/sdk/WERR_errors.d.ts.map +1 -0
- package/out/src/sdk/WERR_errors.js +128 -0
- package/out/src/sdk/WERR_errors.js.map +1 -0
- package/out/src/sdk/WalletError.d.ts +45 -0
- package/out/src/sdk/WalletError.d.ts.map +1 -0
- package/out/src/sdk/WalletError.js +122 -0
- package/out/src/sdk/WalletError.js.map +1 -0
- package/out/src/sdk/WalletServices.interfaces.d.ts +325 -0
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -0
- package/out/src/sdk/WalletServices.interfaces.js +3 -0
- package/out/src/sdk/WalletServices.interfaces.js.map +1 -0
- package/out/src/sdk/WalletSigner.interfaces.d.ts +10 -0
- package/out/src/sdk/WalletSigner.interfaces.d.ts.map +1 -0
- package/out/src/sdk/WalletSigner.interfaces.js +3 -0
- package/out/src/sdk/WalletSigner.interfaces.js.map +1 -0
- package/out/src/sdk/WalletStorage.interfaces.d.ts +299 -0
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -0
- package/out/src/sdk/WalletStorage.interfaces.js +3 -0
- package/out/src/sdk/WalletStorage.interfaces.js.map +1 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.d.ts +2 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.d.ts.map +1 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.js +125 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.js.map +1 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.d.ts +2 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.d.ts.map +1 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.js +660 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.js.map +1 -0
- package/out/src/sdk/index.d.ts +12 -0
- package/out/src/sdk/index.d.ts.map +1 -0
- package/out/src/sdk/index.js +28 -0
- package/out/src/sdk/index.js.map +1 -0
- package/out/src/sdk/types.d.ts +74 -0
- package/out/src/sdk/types.d.ts.map +1 -0
- package/out/src/sdk/types.js +20 -0
- package/out/src/sdk/types.js.map +1 -0
- package/out/src/sdk/validationHelpers.d.ts +288 -0
- package/out/src/sdk/validationHelpers.d.ts.map +1 -0
- package/out/src/sdk/validationHelpers.js +630 -0
- package/out/src/sdk/validationHelpers.js.map +1 -0
- package/out/src/services/ServiceCollection.d.ts +25 -0
- package/out/src/services/ServiceCollection.d.ts.map +1 -0
- package/out/src/services/ServiceCollection.js +43 -0
- package/out/src/services/ServiceCollection.js.map +1 -0
- package/out/src/services/Services.d.ts +60 -0
- package/out/src/services/Services.d.ts.map +1 -0
- package/out/src/services/Services.js +342 -0
- package/out/src/services/Services.js.map +1 -0
- package/out/src/services/__tests/getMerklePath.test.d.ts +2 -0
- package/out/src/services/__tests/getMerklePath.test.d.ts.map +1 -0
- package/out/src/services/__tests/getMerklePath.test.js +16 -0
- package/out/src/services/__tests/getMerklePath.test.js.map +1 -0
- package/out/src/services/__tests/getRawTx.test.d.ts +2 -0
- package/out/src/services/__tests/getRawTx.test.d.ts.map +1 -0
- package/out/src/services/__tests/getRawTx.test.js +13 -0
- package/out/src/services/__tests/getRawTx.test.js.map +1 -0
- package/out/src/services/__tests/postBeef.test.d.ts +2 -0
- package/out/src/services/__tests/postBeef.test.d.ts.map +1 -0
- package/out/src/services/__tests/postBeef.test.js +18 -0
- package/out/src/services/__tests/postBeef.test.js.map +1 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.d.ts +2 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.d.ts.map +1 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.js +479 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.js.map +1 -0
- package/out/src/services/__tests/postTxs.test.d.ts +2 -0
- package/out/src/services/__tests/postTxs.test.d.ts.map +1 -0
- package/out/src/services/__tests/postTxs.test.js +19 -0
- package/out/src/services/__tests/postTxs.test.js.map +1 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts +15 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.js +51 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.d.ts +2 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.d.ts.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.js +19 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.js.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.d.ts +2 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.d.ts.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.js +29 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.js.map +1 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts +98 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts.map +1 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js +38 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js.map +1 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts +36 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +130 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -0
- package/out/src/services/chaintracker/chaintracks/index.d.ts +3 -0
- package/out/src/services/chaintracker/chaintracks/index.d.ts.map +1 -0
- package/out/src/services/chaintracker/chaintracks/index.js +19 -0
- package/out/src/services/chaintracker/chaintracks/index.js.map +1 -0
- package/out/src/services/chaintracker/index.d.ts +3 -0
- package/out/src/services/chaintracker/index.d.ts.map +1 -0
- package/out/src/services/chaintracker/index.js +19 -0
- package/out/src/services/chaintracker/index.js.map +1 -0
- package/out/src/services/createDefaultWalletServicesOptions.d.ts +3 -0
- package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -0
- package/out/src/services/createDefaultWalletServicesOptions.js +34 -0
- package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -0
- package/out/src/services/index.d.ts +2 -0
- package/out/src/services/index.d.ts.map +1 -0
- package/out/src/services/index.js +18 -0
- package/out/src/services/index.js.map +1 -0
- package/out/src/services/providers/arcServices.d.ts +62 -0
- package/out/src/services/providers/arcServices.d.ts.map +1 -0
- package/out/src/services/providers/arcServices.js +368 -0
- package/out/src/services/providers/arcServices.js.map +1 -0
- package/out/src/services/providers/echangeRates.d.ts +12 -0
- package/out/src/services/providers/echangeRates.d.ts.map +1 -0
- package/out/src/services/providers/echangeRates.js +237 -0
- package/out/src/services/providers/echangeRates.js.map +1 -0
- package/out/src/services/providers/whatsonchain.d.ts +17 -0
- package/out/src/services/providers/whatsonchain.d.ts.map +1 -0
- package/out/src/services/providers/whatsonchain.js +130 -0
- package/out/src/services/providers/whatsonchain.js.map +1 -0
- package/out/src/signer/WalletSigner.d.ts +11 -0
- package/out/src/signer/WalletSigner.d.ts.map +1 -0
- package/out/src/signer/WalletSigner.js +13 -0
- package/out/src/signer/WalletSigner.js.map +1 -0
- package/out/src/signer/methods/acquireDirectCertificate.d.ts +4 -0
- package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -0
- package/out/src/signer/methods/acquireDirectCertificate.js +47 -0
- package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -0
- package/out/src/signer/methods/createAction.d.ts +7 -0
- package/out/src/signer/methods/createAction.d.ts.map +1 -0
- package/out/src/signer/methods/createAction.js +250 -0
- package/out/src/signer/methods/createAction.js.map +1 -0
- package/out/src/signer/methods/internalizeAction.d.ts +31 -0
- package/out/src/signer/methods/internalizeAction.d.ts.map +1 -0
- package/out/src/signer/methods/internalizeAction.js +95 -0
- package/out/src/signer/methods/internalizeAction.js.map +1 -0
- package/out/src/signer/methods/proveCertificate.d.ts +4 -0
- package/out/src/signer/methods/proveCertificate.d.ts.map +1 -0
- package/out/src/signer/methods/proveCertificate.js +45 -0
- package/out/src/signer/methods/proveCertificate.js.map +1 -0
- package/out/src/signer/methods/signAction.d.ts +6 -0
- package/out/src/signer/methods/signAction.d.ts.map +1 -0
- package/out/src/signer/methods/signAction.js +79 -0
- package/out/src/signer/methods/signAction.js.map +1 -0
- package/out/src/storage/StorageKnex.d.ts +176 -0
- package/out/src/storage/StorageKnex.d.ts.map +1 -0
- package/out/src/storage/StorageKnex.js +1035 -0
- package/out/src/storage/StorageKnex.js.map +1 -0
- package/out/src/storage/StorageProvider.d.ts +140 -0
- package/out/src/storage/StorageProvider.d.ts.map +1 -0
- package/out/src/storage/StorageProvider.js +539 -0
- package/out/src/storage/StorageProvider.js.map +1 -0
- package/out/src/storage/StorageReader.d.ts +76 -0
- package/out/src/storage/StorageReader.d.ts.map +1 -0
- package/out/src/storage/StorageReader.js +124 -0
- package/out/src/storage/StorageReader.js.map +1 -0
- package/out/src/storage/StorageReaderWriter.d.ts +87 -0
- package/out/src/storage/StorageReaderWriter.d.ts.map +1 -0
- package/out/src/storage/StorageReaderWriter.js +337 -0
- package/out/src/storage/StorageReaderWriter.js.map +1 -0
- package/out/src/storage/StorageSyncReader.d.ts +33 -0
- package/out/src/storage/StorageSyncReader.d.ts.map +1 -0
- package/out/src/storage/StorageSyncReader.js +142 -0
- package/out/src/storage/StorageSyncReader.js.map +1 -0
- package/out/src/storage/WalletStorageManager.d.ts +103 -0
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -0
- package/out/src/storage/WalletStorageManager.js +408 -0
- package/out/src/storage/WalletStorageManager.js.map +1 -0
- package/out/src/storage/__test/WalletStorageManager.test.d.ts +2 -0
- package/out/src/storage/__test/WalletStorageManager.test.d.ts.map +1 -0
- package/out/src/storage/__test/WalletStorageManager.test.js +260 -0
- package/out/src/storage/__test/WalletStorageManager.test.js.map +1 -0
- package/out/src/storage/index.all.d.ts +11 -0
- package/out/src/storage/index.all.d.ts.map +1 -0
- package/out/src/storage/index.all.js +50 -0
- package/out/src/storage/index.all.js.map +1 -0
- package/out/src/storage/index.client.d.ts +7 -0
- package/out/src/storage/index.client.d.ts.map +1 -0
- package/out/src/storage/index.client.js +46 -0
- package/out/src/storage/index.client.js.map +1 -0
- package/out/src/storage/index.db.d.ts +1 -0
- package/out/src/storage/index.db.d.ts.map +1 -0
- package/out/src/storage/index.db.js +2 -0
- package/out/src/storage/index.db.js.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.d.ts +2 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.d.ts.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js +948 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.d.ts +2 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.d.ts.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js +35 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js.map +1 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +27 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +148 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -0
- package/out/src/storage/methods/createAction.d.ts +23 -0
- package/out/src/storage/methods/createAction.d.ts.map +1 -0
- package/out/src/storage/methods/createAction.js +663 -0
- package/out/src/storage/methods/createAction.js.map +1 -0
- package/out/src/storage/methods/generateChange.d.ts +108 -0
- package/out/src/storage/methods/generateChange.d.ts.map +1 -0
- package/out/src/storage/methods/generateChange.js +422 -0
- package/out/src/storage/methods/generateChange.js.map +1 -0
- package/out/src/storage/methods/getBeefForTransaction.d.ts +22 -0
- package/out/src/storage/methods/getBeefForTransaction.d.ts.map +1 -0
- package/out/src/storage/methods/getBeefForTransaction.js +94 -0
- package/out/src/storage/methods/getBeefForTransaction.js.map +1 -0
- package/out/src/storage/methods/getSyncChunk.d.ts +10 -0
- package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -0
- package/out/src/storage/methods/getSyncChunk.js +271 -0
- package/out/src/storage/methods/getSyncChunk.js.map +1 -0
- package/out/src/storage/methods/internalizeAction.d.ts +38 -0
- package/out/src/storage/methods/internalizeAction.d.ts.map +1 -0
- package/out/src/storage/methods/internalizeAction.js +378 -0
- package/out/src/storage/methods/internalizeAction.js.map +1 -0
- package/out/src/storage/methods/listActions.d.ts +5 -0
- package/out/src/storage/methods/listActions.d.ts.map +1 -0
- package/out/src/storage/methods/listActions.js +174 -0
- package/out/src/storage/methods/listActions.js.map +1 -0
- package/out/src/storage/methods/listCertificates.d.ts +5 -0
- package/out/src/storage/methods/listCertificates.d.ts.map +1 -0
- package/out/src/storage/methods/listCertificates.js +68 -0
- package/out/src/storage/methods/listCertificates.js.map +1 -0
- package/out/src/storage/methods/listOutputs.d.ts +5 -0
- package/out/src/storage/methods/listOutputs.d.ts.map +1 -0
- package/out/src/storage/methods/listOutputs.js +189 -0
- package/out/src/storage/methods/listOutputs.js.map +1 -0
- package/out/src/storage/methods/processAction.d.ts +35 -0
- package/out/src/storage/methods/processAction.d.ts.map +1 -0
- package/out/src/storage/methods/processAction.js +271 -0
- package/out/src/storage/methods/processAction.js.map +1 -0
- package/out/src/storage/methods/purgeData.d.ts +4 -0
- package/out/src/storage/methods/purgeData.d.ts.map +1 -0
- package/out/src/storage/methods/purgeData.js +229 -0
- package/out/src/storage/methods/purgeData.js.map +1 -0
- package/out/src/storage/methods/reviewStatus.d.ts +9 -0
- package/out/src/storage/methods/reviewStatus.d.ts.map +1 -0
- package/out/src/storage/methods/reviewStatus.js +75 -0
- package/out/src/storage/methods/reviewStatus.js.map +1 -0
- package/out/src/storage/remoting/StorageClient.d.ts +56 -0
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -0
- package/out/src/storage/remoting/StorageClient.js +181 -0
- package/out/src/storage/remoting/StorageClient.js.map +1 -0
- package/out/src/storage/remoting/StorageServer.d.ts +26 -0
- package/out/src/storage/remoting/StorageServer.d.ts.map +1 -0
- package/out/src/storage/remoting/StorageServer.js +144 -0
- package/out/src/storage/remoting/StorageServer.js.map +1 -0
- package/out/src/storage/schema/KnexMigrations.d.ts +39 -0
- package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -0
- package/out/src/storage/schema/KnexMigrations.js +442 -0
- package/out/src/storage/schema/KnexMigrations.js.map +1 -0
- package/out/src/storage/schema/entities/Certificate.d.ts +43 -0
- package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Certificate.js +162 -0
- package/out/src/storage/schema/entities/Certificate.js.map +1 -0
- package/out/src/storage/schema/entities/CertificateField.d.ts +32 -0
- package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -0
- package/out/src/storage/schema/entities/CertificateField.js +114 -0
- package/out/src/storage/schema/entities/CertificateField.js.map +1 -0
- package/out/src/storage/schema/entities/Commission.d.ts +37 -0
- package/out/src/storage/schema/entities/Commission.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Commission.js +130 -0
- package/out/src/storage/schema/entities/Commission.js.map +1 -0
- package/out/src/storage/schema/entities/EntityBase.d.ts +105 -0
- package/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -0
- package/out/src/storage/schema/entities/EntityBase.js +100 -0
- package/out/src/storage/schema/entities/EntityBase.js.map +1 -0
- package/out/src/storage/schema/entities/MergeEntity.d.ts +34 -0
- package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -0
- package/out/src/storage/schema/entities/MergeEntity.js +57 -0
- package/out/src/storage/schema/entities/MergeEntity.js.map +1 -0
- package/out/src/storage/schema/entities/Output.d.ts +67 -0
- package/out/src/storage/schema/entities/Output.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Output.js +281 -0
- package/out/src/storage/schema/entities/Output.js.map +1 -0
- package/out/src/storage/schema/entities/OutputBasket.d.ts +35 -0
- package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -0
- package/out/src/storage/schema/entities/OutputBasket.js +133 -0
- package/out/src/storage/schema/entities/OutputBasket.js.map +1 -0
- package/out/src/storage/schema/entities/OutputTag.d.ts +31 -0
- package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -0
- package/out/src/storage/schema/entities/OutputTag.js +104 -0
- package/out/src/storage/schema/entities/OutputTag.js.map +1 -0
- package/out/src/storage/schema/entities/OutputTagMap.d.ts +28 -0
- package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -0
- package/out/src/storage/schema/entities/OutputTagMap.js +101 -0
- package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -0
- package/out/src/storage/schema/entities/ProvenTx.d.ts +84 -0
- package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -0
- package/out/src/storage/schema/entities/ProvenTx.js +283 -0
- package/out/src/storage/schema/entities/ProvenTx.js.map +1 -0
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts +130 -0
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -0
- package/out/src/storage/schema/entities/ProvenTxReq.js +521 -0
- package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -0
- package/out/src/storage/schema/entities/SyncState.d.ts +66 -0
- package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -0
- package/out/src/storage/schema/entities/SyncState.js +284 -0
- package/out/src/storage/schema/entities/SyncState.js.map +1 -0
- package/out/src/storage/schema/entities/Transaction.d.ts +67 -0
- package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Transaction.js +264 -0
- package/out/src/storage/schema/entities/Transaction.js.map +1 -0
- package/out/src/storage/schema/entities/TxLabel.d.ts +31 -0
- package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -0
- package/out/src/storage/schema/entities/TxLabel.js +104 -0
- package/out/src/storage/schema/entities/TxLabel.js.map +1 -0
- package/out/src/storage/schema/entities/TxLabelMap.d.ts +28 -0
- package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -0
- package/out/src/storage/schema/entities/TxLabelMap.js +103 -0
- package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -0
- package/out/src/storage/schema/entities/User.d.ts +29 -0
- package/out/src/storage/schema/entities/User.d.ts.map +1 -0
- package/out/src/storage/schema/entities/User.js +100 -0
- package/out/src/storage/schema/entities/User.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js +588 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js +449 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js +602 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js +515 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js +478 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js +440 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js +626 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js +585 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +628 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js +307 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +823 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js +442 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js +313 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.js +81 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.js +418 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/index.d.ts +17 -0
- package/out/src/storage/schema/entities/index.d.ts.map +1 -0
- package/out/src/storage/schema/entities/index.js +33 -0
- package/out/src/storage/schema/entities/index.js.map +1 -0
- package/out/src/storage/schema/tables/Certificate.d.ts +20 -0
- package/out/src/storage/schema/tables/Certificate.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Certificate.js +3 -0
- package/out/src/storage/schema/tables/Certificate.js.map +1 -0
- package/out/src/storage/schema/tables/CertificateField.d.ts +12 -0
- package/out/src/storage/schema/tables/CertificateField.d.ts.map +1 -0
- package/out/src/storage/schema/tables/CertificateField.js +3 -0
- package/out/src/storage/schema/tables/CertificateField.js.map +1 -0
- package/out/src/storage/schema/tables/Commission.d.ts +13 -0
- package/out/src/storage/schema/tables/Commission.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Commission.js +3 -0
- package/out/src/storage/schema/tables/Commission.js.map +1 -0
- package/out/src/storage/schema/tables/MonitorEvent.d.ts +9 -0
- package/out/src/storage/schema/tables/MonitorEvent.d.ts.map +1 -0
- package/out/src/storage/schema/tables/MonitorEvent.js +3 -0
- package/out/src/storage/schema/tables/MonitorEvent.js.map +1 -0
- package/out/src/storage/schema/tables/Output.d.ts +36 -0
- package/out/src/storage/schema/tables/Output.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Output.js +31 -0
- package/out/src/storage/schema/tables/Output.js.map +1 -0
- package/out/src/storage/schema/tables/OutputBasket.d.ts +12 -0
- package/out/src/storage/schema/tables/OutputBasket.d.ts.map +1 -0
- package/out/src/storage/schema/tables/OutputBasket.js +3 -0
- package/out/src/storage/schema/tables/OutputBasket.js.map +1 -0
- package/out/src/storage/schema/tables/OutputTag.d.ts +10 -0
- package/out/src/storage/schema/tables/OutputTag.d.ts.map +1 -0
- package/out/src/storage/schema/tables/OutputTag.js +3 -0
- package/out/src/storage/schema/tables/OutputTag.js.map +1 -0
- package/out/src/storage/schema/tables/OutputTagMap.d.ts +9 -0
- package/out/src/storage/schema/tables/OutputTagMap.d.ts.map +1 -0
- package/out/src/storage/schema/tables/OutputTagMap.js +3 -0
- package/out/src/storage/schema/tables/OutputTagMap.js.map +1 -0
- package/out/src/storage/schema/tables/ProvenTx.d.ts +14 -0
- package/out/src/storage/schema/tables/ProvenTx.d.ts.map +1 -0
- package/out/src/storage/schema/tables/ProvenTx.js +3 -0
- package/out/src/storage/schema/tables/ProvenTx.js.map +1 -0
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts +64 -0
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts.map +1 -0
- package/out/src/storage/schema/tables/ProvenTxReq.js +3 -0
- package/out/src/storage/schema/tables/ProvenTxReq.js.map +1 -0
- package/out/src/storage/schema/tables/Settings.d.ts +17 -0
- package/out/src/storage/schema/tables/Settings.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Settings.js +3 -0
- package/out/src/storage/schema/tables/Settings.js.map +1 -0
- package/out/src/storage/schema/tables/SyncState.d.ts +18 -0
- package/out/src/storage/schema/tables/SyncState.d.ts.map +1 -0
- package/out/src/storage/schema/tables/SyncState.js +3 -0
- package/out/src/storage/schema/tables/SyncState.js.map +1 -0
- package/out/src/storage/schema/tables/Transaction.d.ts +37 -0
- package/out/src/storage/schema/tables/Transaction.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Transaction.js +21 -0
- package/out/src/storage/schema/tables/Transaction.js.map +1 -0
- package/out/src/storage/schema/tables/TxLabel.d.ts +10 -0
- package/out/src/storage/schema/tables/TxLabel.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TxLabel.js +3 -0
- package/out/src/storage/schema/tables/TxLabel.js.map +1 -0
- package/out/src/storage/schema/tables/TxLabelMap.d.ts +9 -0
- package/out/src/storage/schema/tables/TxLabelMap.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TxLabelMap.js +3 -0
- package/out/src/storage/schema/tables/TxLabelMap.js.map +1 -0
- package/out/src/storage/schema/tables/User.d.ts +16 -0
- package/out/src/storage/schema/tables/User.d.ts.map +1 -0
- package/out/src/storage/schema/tables/User.js +3 -0
- package/out/src/storage/schema/tables/User.js.map +1 -0
- package/out/src/storage/schema/tables/index.d.ts +17 -0
- package/out/src/storage/schema/tables/index.d.ts.map +1 -0
- package/out/src/storage/schema/tables/index.js +33 -0
- package/out/src/storage/schema/tables/index.js.map +1 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts +71 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.js +612 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -0
- package/out/src/storage/sync/index.d.ts +2 -0
- package/out/src/storage/sync/index.d.ts.map +1 -0
- package/out/src/storage/sync/index.js +18 -0
- package/out/src/storage/sync/index.js.map +1 -0
- package/out/src/utility/ScriptTemplateSABPPP.d.ts +25 -0
- package/out/src/utility/ScriptTemplateSABPPP.d.ts.map +1 -0
- package/out/src/utility/ScriptTemplateSABPPP.js +46 -0
- package/out/src/utility/ScriptTemplateSABPPP.js.map +1 -0
- package/out/src/utility/index.all.d.ts +7 -0
- package/out/src/utility/index.all.d.ts.map +1 -0
- package/out/src/utility/index.all.js +23 -0
- package/out/src/utility/index.all.js.map +1 -0
- package/out/src/utility/index.client.d.ts +7 -0
- package/out/src/utility/index.client.d.ts.map +1 -0
- package/out/src/utility/index.client.js +23 -0
- package/out/src/utility/index.client.js.map +1 -0
- package/out/src/utility/parseTxScriptOffsets.d.ts +14 -0
- package/out/src/utility/parseTxScriptOffsets.d.ts.map +1 -0
- package/out/src/utility/parseTxScriptOffsets.js +26 -0
- package/out/src/utility/parseTxScriptOffsets.js.map +1 -0
- package/out/src/utility/stampLog.d.ts +18 -0
- package/out/src/utility/stampLog.d.ts.map +1 -0
- package/out/src/utility/stampLog.js +72 -0
- package/out/src/utility/stampLog.js.map +1 -0
- package/out/src/utility/tscProofToMerklePath.d.ts +8 -0
- package/out/src/utility/tscProofToMerklePath.d.ts.map +1 -0
- package/out/src/utility/tscProofToMerklePath.js +41 -0
- package/out/src/utility/tscProofToMerklePath.js.map +1 -0
- package/out/src/utility/utilityHelpers.buffer.d.ts +18 -0
- package/out/src/utility/utilityHelpers.buffer.d.ts.map +1 -0
- package/out/src/utility/utilityHelpers.buffer.js +45 -0
- package/out/src/utility/utilityHelpers.buffer.js.map +1 -0
- package/out/src/utility/utilityHelpers.d.ts +129 -0
- package/out/src/utility/utilityHelpers.d.ts.map +1 -0
- package/out/src/utility/utilityHelpers.js +268 -0
- package/out/src/utility/utilityHelpers.js.map +1 -0
- package/out/src/utility/utilityHelpers.noBuffer.d.ts +9 -0
- package/out/src/utility/utilityHelpers.noBuffer.d.ts.map +1 -0
- package/out/src/utility/utilityHelpers.noBuffer.js +23 -0
- package/out/src/utility/utilityHelpers.noBuffer.js.map +1 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.d.ts +2 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.d.ts.map +1 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.js +45 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.js.map +1 -0
- package/out/test/Wallet/action/internalizeAction.a.test.d.ts +2 -0
- package/out/test/Wallet/action/internalizeAction.a.test.d.ts.map +1 -0
- package/out/test/Wallet/action/internalizeAction.a.test.js +243 -0
- package/out/test/Wallet/action/internalizeAction.a.test.js.map +1 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.d.ts +2 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.d.ts.map +1 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.js +213 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.js.map +1 -0
- package/out/test/Wallet/certificate/listCertificates.test.d.ts +2 -0
- package/out/test/Wallet/certificate/listCertificates.test.d.ts.map +1 -0
- package/out/test/Wallet/certificate/listCertificates.test.js +305 -0
- package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.d.ts +2 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.js +68 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.js.map +1 -0
- package/out/test/Wallet/get/getHeight.test.d.ts +2 -0
- package/out/test/Wallet/get/getHeight.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getHeight.test.js +45 -0
- package/out/test/Wallet/get/getHeight.test.js.map +1 -0
- package/out/test/Wallet/get/getKnownTxids.test.d.ts +2 -0
- package/out/test/Wallet/get/getKnownTxids.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getKnownTxids.test.js +73 -0
- package/out/test/Wallet/get/getKnownTxids.test.js.map +1 -0
- package/out/test/Wallet/get/getNetwork.test.d.ts +2 -0
- package/out/test/Wallet/get/getNetwork.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getNetwork.test.js +26 -0
- package/out/test/Wallet/get/getNetwork.test.js.map +1 -0
- package/out/test/Wallet/get/getVersion.test.d.ts +2 -0
- package/out/test/Wallet/get/getVersion.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getVersion.test.js +25 -0
- package/out/test/Wallet/get/getVersion.test.js.map +1 -0
- package/out/test/Wallet/live/walletLive.man.test.d.ts +26 -0
- package/out/test/Wallet/live/walletLive.man.test.d.ts.map +1 -0
- package/out/test/Wallet/live/walletLive.man.test.js +389 -0
- package/out/test/Wallet/live/walletLive.man.test.js.map +1 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.d.ts +2 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.d.ts.map +1 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js +153 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js.map +1 -0
- package/out/test/checkDB.d.ts +4 -0
- package/out/test/checkDB.d.ts.map +1 -0
- package/out/test/checkDB.js +55 -0
- package/out/test/checkDB.js.map +1 -0
- package/out/test/examples/README.man.test.d.ts +2 -0
- package/out/test/examples/README.man.test.d.ts.map +1 -0
- package/out/test/examples/README.man.test.js +46 -0
- package/out/test/examples/README.man.test.js.map +1 -0
- package/out/test/monitor/Monitor.test.d.ts +2 -0
- package/out/test/monitor/Monitor.test.d.ts.map +1 -0
- package/out/test/monitor/Monitor.test.js +446 -0
- package/out/test/monitor/Monitor.test.js.map +1 -0
- package/out/test/services/Services.test.d.ts +2 -0
- package/out/test/services/Services.test.d.ts.map +1 -0
- package/out/test/services/Services.test.js +128 -0
- package/out/test/services/Services.test.js.map +1 -0
- package/out/test/storage/KnexMigrations.test.d.ts +2 -0
- package/out/test/storage/KnexMigrations.test.d.ts.map +1 -0
- package/out/test/storage/KnexMigrations.test.js +81 -0
- package/out/test/storage/KnexMigrations.test.js.map +1 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.d.ts +2 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.d.ts.map +1 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.js +88 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -0
- package/out/test/storage/count.test.d.ts +2 -0
- package/out/test/storage/count.test.d.ts.map +1 -0
- package/out/test/storage/count.test.js +141 -0
- package/out/test/storage/count.test.js.map +1 -0
- package/out/test/storage/find.test.d.ts +2 -0
- package/out/test/storage/find.test.d.ts.map +1 -0
- package/out/test/storage/find.test.js +148 -0
- package/out/test/storage/find.test.js.map +1 -0
- package/out/test/storage/findLegacy.test.d.ts +2 -0
- package/out/test/storage/findLegacy.test.d.ts.map +1 -0
- package/out/test/storage/findLegacy.test.js +52 -0
- package/out/test/storage/findLegacy.test.js.map +1 -0
- package/out/test/storage/insert.test.d.ts +2 -0
- package/out/test/storage/insert.test.d.ts.map +1 -0
- package/out/test/storage/insert.test.js +256 -0
- package/out/test/storage/insert.test.js.map +1 -0
- package/out/test/storage/update.test.d.ts +2 -0
- package/out/test/storage/update.test.d.ts.map +1 -0
- package/out/test/storage/update.test.js +926 -0
- package/out/test/storage/update.test.js.map +1 -0
- package/out/test/storage/update2.test.d.ts +2 -0
- package/out/test/storage/update2.test.d.ts.map +1 -0
- package/out/test/storage/update2.test.js +766 -0
- package/out/test/storage/update2.test.js.map +1 -0
- package/out/test/utils/TestUtilsWalletStorage.d.ts +399 -0
- package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -0
- package/out/test/utils/TestUtilsWalletStorage.js +1337 -0
- package/out/test/utils/TestUtilsWalletStorage.js.map +1 -0
- package/out/test/wallet/action/abortAction.test.d.ts +2 -0
- package/out/test/wallet/action/abortAction.test.d.ts.map +1 -0
- package/out/test/wallet/action/abortAction.test.js +44 -0
- package/out/test/wallet/action/abortAction.test.js.map +1 -0
- package/out/test/wallet/action/createAction.test.d.ts +2 -0
- package/out/test/wallet/action/createAction.test.d.ts.map +1 -0
- package/out/test/wallet/action/createAction.test.js +230 -0
- package/out/test/wallet/action/createAction.test.js.map +1 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.d.ts +2 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.d.ts.map +1 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js +273 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -0
- package/out/test/wallet/action/internalizeAction.test.d.ts +2 -0
- package/out/test/wallet/action/internalizeAction.test.d.ts.map +1 -0
- package/out/test/wallet/action/internalizeAction.test.js +603 -0
- package/out/test/wallet/action/internalizeAction.test.js.map +1 -0
- package/out/test/wallet/action/relinquishOutput.test.d.ts +2 -0
- package/out/test/wallet/action/relinquishOutput.test.d.ts.map +1 -0
- package/out/test/wallet/action/relinquishOutput.test.js +31 -0
- package/out/test/wallet/action/relinquishOutput.test.js.map +1 -0
- package/out/test/wallet/construct/Wallet.constructor.test.d.ts +2 -0
- package/out/test/wallet/construct/Wallet.constructor.test.d.ts.map +1 -0
- package/out/test/wallet/construct/Wallet.constructor.test.js +49 -0
- package/out/test/wallet/construct/Wallet.constructor.test.js.map +1 -0
- package/out/test/wallet/list/listActions.test.d.ts +2 -0
- package/out/test/wallet/list/listActions.test.d.ts.map +1 -0
- package/out/test/wallet/list/listActions.test.js +265 -0
- package/out/test/wallet/list/listActions.test.js.map +1 -0
- package/out/test/wallet/list/listActions2.test.d.ts +2 -0
- package/out/test/wallet/list/listActions2.test.d.ts.map +1 -0
- package/out/test/wallet/list/listActions2.test.js +423 -0
- package/out/test/wallet/list/listActions2.test.js.map +1 -0
- package/out/test/wallet/list/listCertificates.test.d.ts +2 -0
- package/out/test/wallet/list/listCertificates.test.d.ts.map +1 -0
- package/out/test/wallet/list/listCertificates.test.js +115 -0
- package/out/test/wallet/list/listCertificates.test.js.map +1 -0
- package/out/test/wallet/list/listOutputs.test.d.ts +2 -0
- package/out/test/wallet/list/listOutputs.test.d.ts.map +1 -0
- package/out/test/wallet/list/listOutputs.test.js +521 -0
- package/out/test/wallet/list/listOutputs.test.js.map +1 -0
- package/out/test/wallet/sync/Wallet.sync.test.d.ts +2 -0
- package/out/test/wallet/sync/Wallet.sync.test.d.ts.map +1 -0
- package/out/test/wallet/sync/Wallet.sync.test.js +142 -0
- package/out/test/wallet/sync/Wallet.sync.test.js.map +1 -0
- package/out/tsconfig.all.tsbuildinfo +1 -0
- package/package.json +63 -0
- package/src/Wallet.ts +771 -0
- package/src/index.all.ts +8 -0
- package/src/index.client.ts +7 -0
- package/src/index.ts +2 -0
- package/src/monitor/Monitor.ts +317 -0
- package/src/monitor/MonitorDaemon.ts +197 -0
- package/src/monitor/README.md +3 -0
- package/src/monitor/__test/MonitorDaemon.man.test.ts +17 -0
- package/src/monitor/tasks/TaskCheckForProofs.ts +235 -0
- package/src/monitor/tasks/TaskClock.ts +35 -0
- package/src/monitor/tasks/TaskFailAbandoned.ts +56 -0
- package/src/monitor/tasks/TaskNewHeader.ts +48 -0
- package/src/monitor/tasks/TaskPurge.ts +69 -0
- package/src/monitor/tasks/TaskReviewStatus.ts +51 -0
- package/src/monitor/tasks/TaskSendWaiting.ts +107 -0
- package/src/monitor/tasks/TaskSyncWhenIdle.ts +26 -0
- package/src/monitor/tasks/WalletMonitorTask.ts +47 -0
- package/src/sdk/CertOps.ts +346 -0
- package/src/sdk/PrivilegedKeyManager.ts +402 -0
- package/src/sdk/README.md +13 -0
- package/src/sdk/StorageSyncReader.ts +155 -0
- package/src/sdk/StorageSyncReaderWriter.ts +263 -0
- package/src/sdk/WERR_errors.ts +152 -0
- package/src/sdk/WalletError.ts +136 -0
- package/src/sdk/WalletServices.interfaces.ts +399 -0
- package/src/sdk/WalletSigner.interfaces.ts +38 -0
- package/src/sdk/WalletStorage.interfaces.ts +416 -0
- package/src/sdk/__test/CertificateLifeCycle.test.ts +194 -0
- package/src/sdk/__test/PrivilegedKeyManager.test.ts +775 -0
- package/src/sdk/index.ts +11 -0
- package/src/sdk/types.ts +115 -0
- package/src/sdk/validationHelpers.ts +1248 -0
- package/src/services/README.md +11 -0
- package/src/services/ServiceCollection.ts +50 -0
- package/src/services/Services.ts +461 -0
- package/src/services/__tests/getMerklePath.test.ts +16 -0
- package/src/services/__tests/getRawTx.test.ts +15 -0
- package/src/services/__tests/postBeef.test.ts +19 -0
- package/src/services/__tests/postBeefToArcTaal.test.ts +487 -0
- package/src/services/__tests/postTxs.test.ts +20 -0
- package/src/services/chaintracker/ChaintracksChainTracker.ts +78 -0
- package/src/services/chaintracker/__tests/ChaintracksChainTracker.test.ts +25 -0
- package/src/services/chaintracker/__tests/ChaintracksServiceClient.test.ts +32 -0
- package/src/services/chaintracker/chaintracks/BlockHeaderApi.ts +123 -0
- package/src/services/chaintracker/chaintracks/ChaintracksServiceClient.ts +160 -0
- package/src/services/chaintracker/chaintracks/index.ts +2 -0
- package/src/services/chaintracker/index.ts +2 -0
- package/src/services/createDefaultWalletServicesOptions.ts +38 -0
- package/src/services/index.ts +1 -0
- package/src/services/providers/arcServices.ts +570 -0
- package/src/services/providers/echangeRates.ts +276 -0
- package/src/services/providers/whatsonchain.ts +170 -0
- package/src/signer/README.md +5 -0
- package/src/signer/WalletSigner.ts +21 -0
- package/src/signer/methods/acquireDirectCertificate.ts +53 -0
- package/src/signer/methods/createAction.ts +364 -0
- package/src/signer/methods/internalizeAction.ts +142 -0
- package/src/signer/methods/proveCertificate.ts +51 -0
- package/src/signer/methods/signAction.ts +121 -0
- package/src/storage/README.md +14 -0
- package/src/storage/StorageKnex.ts +1449 -0
- package/src/storage/StorageProvider.ts +853 -0
- package/src/storage/StorageReader.ts +222 -0
- package/src/storage/StorageReaderWriter.ts +623 -0
- package/src/storage/StorageSyncReader.ts +143 -0
- package/src/storage/WalletStorageManager.ts +532 -0
- package/src/storage/__test/WalletStorageManager.test.ts +292 -0
- package/src/storage/index.all.ts +10 -0
- package/src/storage/index.client.ts +6 -0
- package/src/storage/index.db.ts +0 -0
- package/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.ts +1143 -0
- package/src/storage/methods/__test/GenerateChange/randomValsUsed1.ts +31 -0
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +185 -0
- package/src/storage/methods/createAction.ts +997 -0
- package/src/storage/methods/generateChange.ts +629 -0
- package/src/storage/methods/getBeefForTransaction.ts +143 -0
- package/src/storage/methods/getSyncChunk.ts +330 -0
- package/src/storage/methods/internalizeAction.ts +538 -0
- package/src/storage/methods/listActions.ts +203 -0
- package/src/storage/methods/listCertificates.ts +81 -0
- package/src/storage/methods/listOutputs.ts +219 -0
- package/src/storage/methods/processAction.ts +477 -0
- package/src/storage/methods/purgeData.ts +276 -0
- package/src/storage/methods/reviewStatus.ts +95 -0
- package/src/storage/remoting/StorageClient.ts +306 -0
- package/src/storage/remoting/StorageServer.ts +179 -0
- package/src/storage/schema/KnexMigrations.ts +488 -0
- package/src/storage/schema/entities/Certificate.ts +199 -0
- package/src/storage/schema/entities/CertificateField.ts +157 -0
- package/src/storage/schema/entities/Commission.ts +169 -0
- package/src/storage/schema/entities/EntityBase.ts +214 -0
- package/src/storage/schema/entities/MergeEntity.ts +79 -0
- package/src/storage/schema/entities/Output.ts +323 -0
- package/src/storage/schema/entities/OutputBasket.ts +165 -0
- package/src/storage/schema/entities/OutputTag.ts +138 -0
- package/src/storage/schema/entities/OutputTagMap.ts +146 -0
- package/src/storage/schema/entities/ProvenTx.ts +349 -0
- package/src/storage/schema/entities/ProvenTxReq.ts +646 -0
- package/src/storage/schema/entities/SyncState.ts +429 -0
- package/src/storage/schema/entities/Transaction.ts +334 -0
- package/src/storage/schema/entities/TxLabel.ts +135 -0
- package/src/storage/schema/entities/TxLabelMap.ts +148 -0
- package/src/storage/schema/entities/User.ts +138 -0
- package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +663 -0
- package/src/storage/schema/entities/__tests/CertificateTests.test.ts +527 -0
- package/src/storage/schema/entities/__tests/CommissionTests.test.ts +658 -0
- package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +567 -0
- package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +530 -0
- package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +504 -0
- package/src/storage/schema/entities/__tests/OutputTests.test.ts +689 -0
- package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +669 -0
- package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +700 -0
- package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +376 -0
- package/src/storage/schema/entities/__tests/TransactionTests.test.ts +920 -0
- package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +512 -0
- package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +350 -0
- package/src/storage/schema/entities/__tests/stampLogTests.test.ts +97 -0
- package/src/storage/schema/entities/__tests/usersTests.test.ts +485 -0
- package/src/storage/schema/entities/index.ts +16 -0
- package/src/storage/schema/tables/Certificate.ts +21 -0
- package/src/storage/schema/tables/CertificateField.ts +12 -0
- package/src/storage/schema/tables/Commission.ts +13 -0
- package/src/storage/schema/tables/MonitorEvent.ts +9 -0
- package/src/storage/schema/tables/Output.ts +64 -0
- package/src/storage/schema/tables/OutputBasket.ts +12 -0
- package/src/storage/schema/tables/OutputTag.ts +10 -0
- package/src/storage/schema/tables/OutputTagMap.ts +9 -0
- package/src/storage/schema/tables/ProvenTx.ts +14 -0
- package/src/storage/schema/tables/ProvenTxReq.ts +65 -0
- package/src/storage/schema/tables/Settings.ts +17 -0
- package/src/storage/schema/tables/SyncState.ts +18 -0
- package/src/storage/schema/tables/Transaction.ts +54 -0
- package/src/storage/schema/tables/TxLabel.ts +10 -0
- package/src/storage/schema/tables/TxLabelMap.ts +9 -0
- package/src/storage/schema/tables/User.ts +16 -0
- package/src/storage/schema/tables/index.ts +16 -0
- package/src/storage/sync/StorageMySQLDojoReader.ts +771 -0
- package/src/storage/sync/index.ts +1 -0
- package/src/utility/README.md +3 -0
- package/src/utility/ScriptTemplateSABPPP.ts +79 -0
- package/src/utility/index.all.ts +7 -0
- package/src/utility/index.client.ts +7 -0
- package/src/utility/parseTxScriptOffsets.ts +29 -0
- package/src/utility/stampLog.ts +73 -0
- package/src/utility/tscProofToMerklePath.ts +51 -0
- package/src/utility/utilityHelpers.buffer.ts +43 -0
- package/src/utility/utilityHelpers.noBuffer.ts +18 -0
- package/src/utility/utilityHelpers.ts +283 -0
- package/test/Wallet/StorageClient/storageClient.man.test.ts +55 -0
- package/test/Wallet/action/internalizeAction.a.test.ts +301 -0
- package/test/Wallet/certificate/acquireCertificate.test.ts +253 -0
- package/test/Wallet/certificate/listCertificates.test.ts +352 -0
- package/test/Wallet/get/getHeaderForHeight.test.ts +79 -0
- package/test/Wallet/get/getHeight.test.ts +52 -0
- package/test/Wallet/get/getKnownTxids.test.ts +90 -0
- package/test/Wallet/get/getNetwork.test.ts +28 -0
- package/test/Wallet/get/getVersion.test.ts +28 -0
- package/test/Wallet/live/walletLive.man.test.ts +510 -0
- package/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.ts +155 -0
- package/test/checkDB.ts +63 -0
- package/test/checkdb +0 -0
- package/test/examples/README.man.test.ts +53 -0
- package/test/monitor/Monitor.test.ts +536 -0
- package/test/services/Services.test.ts +149 -0
- package/test/storage/KnexMigrations.test.ts +100 -0
- package/test/storage/StorageMySQLDojoReader.man.test.ts +71 -0
- package/test/storage/count.test.ts +193 -0
- package/test/storage/find.test.ts +216 -0
- package/test/storage/findLegacy.test.ts +70 -0
- package/test/storage/insert.test.ts +294 -0
- package/test/storage/update.test.ts +1146 -0
- package/test/storage/update2.test.ts +1017 -0
- package/test/utils/TestUtilsWalletStorage.ts +1923 -0
- package/test/utils/removeFailedFromDatabase.sql +17 -0
- package/test/wallet/action/abortAction.test.ts +55 -0
- package/test/wallet/action/createAction.test.ts +266 -0
- package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +297 -0
- package/test/wallet/action/internalizeAction.test.ts +729 -0
- package/test/wallet/action/relinquishOutput.test.ts +43 -0
- package/test/wallet/construct/Wallet.constructor.test.ts +57 -0
- package/test/wallet/list/listActions.test.ts +282 -0
- package/test/wallet/list/listActions2.test.ts +570 -0
- package/test/wallet/list/listCertificates.test.ts +129 -0
- package/test/wallet/list/listOutputs.test.ts +573 -0
- package/test/wallet/sync/Wallet.sync.test.ts +226 -0
- package/ts2md.json +32 -0
- package/tsconfig.all.json +29 -0
- package/tsconfig.client.json +22 -0
- package/tsconfig.json +14 -0
- package/unlock-migrations.sh +41 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import {
|
|
2
|
+
asString,
|
|
3
|
+
doubleSha256BE,
|
|
4
|
+
entity,
|
|
5
|
+
sdk,
|
|
6
|
+
table
|
|
7
|
+
} from '../../index.client'
|
|
8
|
+
import { Monitor } from '../Monitor'
|
|
9
|
+
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `TaskCheckForProofs` is a WalletMonitor task that retreives merkle proofs for
|
|
13
|
+
* transactions.
|
|
14
|
+
*
|
|
15
|
+
* It is normally triggered by the Chaintracks new block header event.
|
|
16
|
+
*
|
|
17
|
+
* When a new block is found, cwi-external-services are used to obtain proofs for
|
|
18
|
+
* any transactions that are currently in the 'unmined' or 'unknown' state.
|
|
19
|
+
*
|
|
20
|
+
* If a proof is obtained and validated, a new ProvenTx record is created and
|
|
21
|
+
* the original ProvenTxReq status is advanced to 'notifying'.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export class TaskCheckForProofs extends WalletMonitorTask {
|
|
25
|
+
static taskName = 'CheckForProofs'
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* An external service such as the chaintracks new block header
|
|
29
|
+
* listener can set this true to cause
|
|
30
|
+
*/
|
|
31
|
+
static checkNow = false
|
|
32
|
+
|
|
33
|
+
constructor(
|
|
34
|
+
monitor: Monitor,
|
|
35
|
+
public triggerMsecs = 0
|
|
36
|
+
) {
|
|
37
|
+
super(monitor, TaskCheckForProofs.taskName)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Normally triggered by checkNow getting set by new block header found event from chaintracks
|
|
42
|
+
*/
|
|
43
|
+
trigger(nowMsecsSinceEpoch: number): { run: boolean } {
|
|
44
|
+
return {
|
|
45
|
+
run:
|
|
46
|
+
TaskCheckForProofs.checkNow ||
|
|
47
|
+
(this.triggerMsecs > 0 &&
|
|
48
|
+
nowMsecsSinceEpoch - this.lastRunMsecsSinceEpoch > this.triggerMsecs)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async runTask(): Promise<string> {
|
|
53
|
+
let log = ''
|
|
54
|
+
const countsAsAttempt = TaskCheckForProofs.checkNow
|
|
55
|
+
TaskCheckForProofs.checkNow = false
|
|
56
|
+
|
|
57
|
+
const limit = 100
|
|
58
|
+
let offset = 0
|
|
59
|
+
for (;;) {
|
|
60
|
+
const reqs = await this.storage.findProvenTxReqs({
|
|
61
|
+
partial: {},
|
|
62
|
+
status: [
|
|
63
|
+
'callback',
|
|
64
|
+
'unmined',
|
|
65
|
+
'nosend',
|
|
66
|
+
'sending',
|
|
67
|
+
'unknown',
|
|
68
|
+
'unconfirmed'
|
|
69
|
+
],
|
|
70
|
+
paged: { limit, offset }
|
|
71
|
+
})
|
|
72
|
+
if (reqs.length === 0) break
|
|
73
|
+
log += `${reqs.length} reqs with status 'callback', 'unmined', 'nosend', 'sending', 'unknown', or 'unconfirmed'\n`
|
|
74
|
+
const r = await this.getProofs(reqs, 2, countsAsAttempt)
|
|
75
|
+
log += `${r.log}\n`
|
|
76
|
+
//console.log(log);
|
|
77
|
+
if (reqs.length < limit) break
|
|
78
|
+
offset += limit
|
|
79
|
+
}
|
|
80
|
+
return log
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Process an array of table.ProvenTxReq (typically with status 'unmined' or 'unknown')
|
|
85
|
+
*
|
|
86
|
+
* If req is invalid, set status 'invalid'
|
|
87
|
+
*
|
|
88
|
+
* Verify the requests are valid, lookup proofs or updated transaction status using the array of getProofServices,
|
|
89
|
+
*
|
|
90
|
+
* When proofs are found, create new ProvenTxApi records and transition the requests' status to 'unconfirmed' or 'notifying',
|
|
91
|
+
* depending on chaintracks succeeding on proof verification.
|
|
92
|
+
*
|
|
93
|
+
* Increments attempts if proofs where requested.
|
|
94
|
+
*
|
|
95
|
+
* @param reqs
|
|
96
|
+
* @returns reqs partitioned by status
|
|
97
|
+
*/
|
|
98
|
+
async getProofs(
|
|
99
|
+
reqs: table.ProvenTxReq[],
|
|
100
|
+
indent = 0,
|
|
101
|
+
countsAsAttempt = false,
|
|
102
|
+
ignoreStatus = false
|
|
103
|
+
): Promise<{
|
|
104
|
+
proven: table.ProvenTxReq[]
|
|
105
|
+
invalid: table.ProvenTxReq[]
|
|
106
|
+
log: string
|
|
107
|
+
}> {
|
|
108
|
+
const proven: table.ProvenTxReq[] = []
|
|
109
|
+
const invalid: table.ProvenTxReq[] = []
|
|
110
|
+
|
|
111
|
+
let log = ''
|
|
112
|
+
for (const reqApi of reqs) {
|
|
113
|
+
log += ' '.repeat(indent)
|
|
114
|
+
log += `reqId ${reqApi.provenTxReqId} txid ${reqApi.txid}: `
|
|
115
|
+
|
|
116
|
+
if (
|
|
117
|
+
!ignoreStatus &&
|
|
118
|
+
reqApi.status !== 'callback' &&
|
|
119
|
+
reqApi.status !== 'unmined' &&
|
|
120
|
+
reqApi.status !== 'unknown' &&
|
|
121
|
+
reqApi.status !== 'unconfirmed' &&
|
|
122
|
+
reqApi.status !== 'nosend' &&
|
|
123
|
+
reqApi.status !== 'sending'
|
|
124
|
+
) {
|
|
125
|
+
log += `status of '${reqApi.status}' is not ready to be proven.\n`
|
|
126
|
+
continue
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const req = new entity.ProvenTxReq(reqApi)
|
|
130
|
+
|
|
131
|
+
if (Number.isInteger(req.provenTxId)) {
|
|
132
|
+
log += `Already linked to provenTxId ${req.provenTxId}.\n`
|
|
133
|
+
req.notified = false
|
|
134
|
+
req.status = 'completed'
|
|
135
|
+
await req.updateStorageDynamicProperties(this.storage)
|
|
136
|
+
proven.push(reqApi)
|
|
137
|
+
continue
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
log += '\n'
|
|
141
|
+
|
|
142
|
+
let reqIsValid = false
|
|
143
|
+
if (req.rawTx) {
|
|
144
|
+
const txid = asString(doubleSha256BE(req.rawTx))
|
|
145
|
+
if (txid === req.txid) reqIsValid = true
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (!reqIsValid) {
|
|
149
|
+
log += ` rawTx doesn't hash to txid. status => invalid.\n`
|
|
150
|
+
req.notified = false
|
|
151
|
+
req.status = 'invalid'
|
|
152
|
+
await req.updateStorageDynamicProperties(this.storage)
|
|
153
|
+
invalid.push(reqApi)
|
|
154
|
+
continue
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const limit =
|
|
158
|
+
this.monitor.chain === 'main'
|
|
159
|
+
? this.monitor.options.unprovenAttemptsLimitMain
|
|
160
|
+
: this.monitor.options.unprovenAttemptsLimitTest
|
|
161
|
+
if (!ignoreStatus && req.attempts > limit) {
|
|
162
|
+
log += ` too many failed attempts ${req.attempts}\n`
|
|
163
|
+
req.notified = false
|
|
164
|
+
req.status = 'invalid'
|
|
165
|
+
await req.updateStorageDynamicProperties(this.storage)
|
|
166
|
+
invalid.push(reqApi)
|
|
167
|
+
continue
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const since = new Date()
|
|
171
|
+
|
|
172
|
+
let r: sdk.GetMerklePathResult
|
|
173
|
+
let ptx: entity.ProvenTx | undefined
|
|
174
|
+
|
|
175
|
+
// External services will try multiple providers until one returns a proof,
|
|
176
|
+
// or they all fail.
|
|
177
|
+
// There may also be an array of proofs to consider when a transaction
|
|
178
|
+
// is recently mined and appears in orphan blocks in addition to active chain blocks.
|
|
179
|
+
// Since orphan blocks can end up on chain again, multiple proofs has value.
|
|
180
|
+
//
|
|
181
|
+
// On failure, there may be a mapi response, or an error.
|
|
182
|
+
//
|
|
183
|
+
// The proofs returned are considered sequentially, validating and chaintracks confirming.
|
|
184
|
+
//
|
|
185
|
+
// If a good proof is found, proceed to using it.
|
|
186
|
+
//
|
|
187
|
+
// When all received proofs fail, force a bump to the next service provider and try
|
|
188
|
+
// one more time.
|
|
189
|
+
//
|
|
190
|
+
r = await this.monitor.services.getMerklePath(req.txid)
|
|
191
|
+
ptx = await entity.ProvenTx.fromReq(
|
|
192
|
+
req,
|
|
193
|
+
r,
|
|
194
|
+
countsAsAttempt && req.status !== 'nosend'
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
if (ptx) {
|
|
198
|
+
// We have a merklePath proof for the request (and a block header)
|
|
199
|
+
const { provenTxReqId, status, txid, attempts, history } = req.toApi()
|
|
200
|
+
const { index, height, blockHash, merklePath, merkleRoot } = ptx.toApi()
|
|
201
|
+
const r = await this.storage.runAsStorageProvider(async sp => {
|
|
202
|
+
return await sp.updateProvenTxReqWithNewProvenTx({
|
|
203
|
+
provenTxReqId,
|
|
204
|
+
status,
|
|
205
|
+
txid,
|
|
206
|
+
attempts,
|
|
207
|
+
history,
|
|
208
|
+
index,
|
|
209
|
+
height,
|
|
210
|
+
blockHash,
|
|
211
|
+
merklePath,
|
|
212
|
+
merkleRoot
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
req.status = r.status
|
|
216
|
+
req.apiHistory = r.history
|
|
217
|
+
req.provenTxId = r.provenTxId
|
|
218
|
+
req.notified = true
|
|
219
|
+
} else {
|
|
220
|
+
if (countsAsAttempt && req.status !== 'nosend') {
|
|
221
|
+
req.attempts++
|
|
222
|
+
}
|
|
223
|
+
await req.updateStorageDynamicProperties(this.storage)
|
|
224
|
+
await req.refreshFromStorage(this.storage)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
log += req.historyPretty(since, indent + 2) + '\n'
|
|
228
|
+
|
|
229
|
+
if (req.status === 'completed') proven.push(req.api)
|
|
230
|
+
if (req.status === 'invalid') invalid.push(req.api)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return { proven, invalid, log }
|
|
234
|
+
}
|
|
235
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Monitor } from '../Monitor'
|
|
2
|
+
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
3
|
+
|
|
4
|
+
export class TaskClock extends WalletMonitorTask {
|
|
5
|
+
static taskName = 'Clock'
|
|
6
|
+
nextMinute: number
|
|
7
|
+
|
|
8
|
+
constructor(
|
|
9
|
+
monitor: Monitor,
|
|
10
|
+
public triggerMsecs = 1 * monitor.oneSecond
|
|
11
|
+
) {
|
|
12
|
+
super(monitor, TaskClock.taskName)
|
|
13
|
+
this.nextMinute = this.getNextMinute()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
trigger(nowMsecsSinceEpoch: number): { run: boolean } {
|
|
17
|
+
const s = this.storage
|
|
18
|
+
|
|
19
|
+
const run = Date.now() > this.nextMinute
|
|
20
|
+
|
|
21
|
+
return { run }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async runTask(): Promise<string> {
|
|
25
|
+
const log = `${new Date(this.nextMinute).toISOString()}`
|
|
26
|
+
this.nextMinute = this.getNextMinute()
|
|
27
|
+
return log
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getNextMinute(): number {
|
|
31
|
+
return (
|
|
32
|
+
Math.ceil(Date.now() / this.monitor.oneMinute) * this.monitor.oneMinute
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Monitor } from '../Monitor'
|
|
2
|
+
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Handles transactions which do not have terminal status and have not been
|
|
6
|
+
* updated for an extended time period.
|
|
7
|
+
*
|
|
8
|
+
* Calls `updateTransactionStatus` to set `status` to `failed`.
|
|
9
|
+
* This returns inputs to spendable status and verifies that any
|
|
10
|
+
* outputs are not spendable.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export class TaskFailAbandoned extends WalletMonitorTask {
|
|
14
|
+
static taskName = 'FailAbandoned'
|
|
15
|
+
|
|
16
|
+
constructor(
|
|
17
|
+
monitor: Monitor,
|
|
18
|
+
public triggerMsecs = 1000 * 60 * 5
|
|
19
|
+
) {
|
|
20
|
+
super(monitor, TaskFailAbandoned.taskName)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
trigger(nowMsecsSinceEpoch: number): { run: boolean } {
|
|
24
|
+
return {
|
|
25
|
+
run: nowMsecsSinceEpoch > this.lastRunMsecsSinceEpoch + this.triggerMsecs
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async runTask(): Promise<string> {
|
|
30
|
+
let log = ''
|
|
31
|
+
const limit = 100
|
|
32
|
+
let offset = 0
|
|
33
|
+
for (;;) {
|
|
34
|
+
const now = new Date()
|
|
35
|
+
const abandoned = new Date(
|
|
36
|
+
now.getTime() - this.monitor.options.abandonedMsecs
|
|
37
|
+
)
|
|
38
|
+
const done = await this.storage.runAsStorageProvider(async sp => {
|
|
39
|
+
const txsAll = await sp.findTransactions({
|
|
40
|
+
partial: {},
|
|
41
|
+
status: ['unprocessed', 'unsigned'],
|
|
42
|
+
paged: { limit, offset }
|
|
43
|
+
})
|
|
44
|
+
const txs = txsAll.filter(t => t.updated_at && t.updated_at < abandoned)
|
|
45
|
+
for (const tx of txs) {
|
|
46
|
+
await sp.updateTransactionStatus('failed', tx.transactionId)
|
|
47
|
+
log += `updated tx ${tx.transactionId} status to 'failed'\n`
|
|
48
|
+
}
|
|
49
|
+
return txs.length < limit
|
|
50
|
+
})
|
|
51
|
+
if (done) break
|
|
52
|
+
offset += limit
|
|
53
|
+
}
|
|
54
|
+
return log
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { sdk } from '../../index.client'
|
|
2
|
+
import { Monitor } from '../Monitor'
|
|
3
|
+
import { TaskCheckForProofs } from './TaskCheckForProofs'
|
|
4
|
+
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
5
|
+
|
|
6
|
+
export class TaskNewHeader extends WalletMonitorTask {
|
|
7
|
+
static taskName = 'NewHeader'
|
|
8
|
+
header?: sdk.BlockHeader
|
|
9
|
+
|
|
10
|
+
constructor(
|
|
11
|
+
monitor: Monitor,
|
|
12
|
+
public triggerMsecs = 1 * monitor.oneMinute
|
|
13
|
+
) {
|
|
14
|
+
super(monitor, TaskNewHeader.taskName)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async getHeader(): Promise<sdk.BlockHeader> {
|
|
18
|
+
return await this.monitor.chaintracks.findChainTipHeader()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
trigger(nowMsecsSinceEpoch: number): { run: boolean } {
|
|
22
|
+
const run = true
|
|
23
|
+
return { run }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async runTask(): Promise<string> {
|
|
27
|
+
let log = ''
|
|
28
|
+
const oldHeader = this.header
|
|
29
|
+
this.header = await this.getHeader()
|
|
30
|
+
let isNew = true
|
|
31
|
+
if (!oldHeader) {
|
|
32
|
+
log = `first header: ${this.header.height} ${this.header.hash}`
|
|
33
|
+
} else if (oldHeader.height < this.header.height) {
|
|
34
|
+
const skip = this.header.height - oldHeader.height - 1
|
|
35
|
+
const skipped = skip > 0 ? ` SKIPPED ${skip}` : ''
|
|
36
|
+
log = `new header: ${this.header.height} ${this.header.hash}${skipped}`
|
|
37
|
+
} else if (
|
|
38
|
+
oldHeader.height === this.header.height &&
|
|
39
|
+
oldHeader.hash != this.header.hash
|
|
40
|
+
) {
|
|
41
|
+
log = `reorg header: ${this.header.height} ${this.header.hash}`
|
|
42
|
+
} else {
|
|
43
|
+
isNew = false
|
|
44
|
+
}
|
|
45
|
+
if (isNew) TaskCheckForProofs.checkNow = true
|
|
46
|
+
return log
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { sdk } from '../../index.client'
|
|
2
|
+
import { Monitor } from '../Monitor'
|
|
3
|
+
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The database stores a variety of data that may be considered transient.
|
|
7
|
+
*
|
|
8
|
+
* At one extreme, the data that must be preserved:
|
|
9
|
+
* - unspent outputs (UTXOs)
|
|
10
|
+
* - in-use metadata (labels, baskets, tags...)
|
|
11
|
+
*
|
|
12
|
+
* At the other extreme, everything can be preserved to fully log all transaction creation and processing actions.
|
|
13
|
+
*
|
|
14
|
+
* The following purge actions are available to support sustained operation:
|
|
15
|
+
* - Failed transactions, delete all associated data including:
|
|
16
|
+
* + Delete tag and label mapping records
|
|
17
|
+
* + Delete output records
|
|
18
|
+
* + Delete transaction records
|
|
19
|
+
* + Delete mapi_responses records
|
|
20
|
+
* + Delete proven_tx_reqs records
|
|
21
|
+
* + Delete commissions records
|
|
22
|
+
* + Update output records marked spentBy failed transactions
|
|
23
|
+
* - Completed transactions, delete transient data including:
|
|
24
|
+
* + transactions table set truncatedExternalInputs = null
|
|
25
|
+
* + transactions table set beef = null
|
|
26
|
+
* + transactions table set rawTx = null
|
|
27
|
+
* + Delete mapi_responses records
|
|
28
|
+
* + proven_tx_reqs table delete records
|
|
29
|
+
*/
|
|
30
|
+
export interface TaskPurgeParams extends sdk.PurgeParams {}
|
|
31
|
+
|
|
32
|
+
export class TaskPurge extends WalletMonitorTask {
|
|
33
|
+
static taskName = 'Purge'
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Set to true to trigger running this task
|
|
37
|
+
*/
|
|
38
|
+
static checkNow = false
|
|
39
|
+
|
|
40
|
+
constructor(
|
|
41
|
+
monitor: Monitor,
|
|
42
|
+
public params: TaskPurgeParams,
|
|
43
|
+
public triggerMsecs = 0
|
|
44
|
+
) {
|
|
45
|
+
super(monitor, TaskPurge.taskName)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
trigger(nowMsecsSinceEpoch: number): { run: boolean } {
|
|
49
|
+
return {
|
|
50
|
+
run:
|
|
51
|
+
TaskPurge.checkNow ||
|
|
52
|
+
(this.triggerMsecs > 0 &&
|
|
53
|
+
nowMsecsSinceEpoch - this.lastRunMsecsSinceEpoch > this.triggerMsecs)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async runTask(): Promise<string> {
|
|
58
|
+
let log = ''
|
|
59
|
+
TaskPurge.checkNow = false
|
|
60
|
+
|
|
61
|
+
const r = await this.storage.runAsStorageProvider(async sp => {
|
|
62
|
+
return await sp.purgeData(this.params)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
if (r.count > 0) log = `${r.count} records updated or deleted.\n${r.log}`
|
|
66
|
+
|
|
67
|
+
return log
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { sdk } from '../../index.client'
|
|
2
|
+
import { Monitor } from '../Monitor'
|
|
3
|
+
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Notify Transaction records of changes in ProvenTxReq records they may have missed.
|
|
7
|
+
*
|
|
8
|
+
* The `notified` property flags reqs that do not need to be checked.
|
|
9
|
+
*
|
|
10
|
+
* Looks for aged Transactions with provenTxId with status != 'completed', sets status to 'completed'.
|
|
11
|
+
*
|
|
12
|
+
* Looks for reqs with 'invalid' status that
|
|
13
|
+
*/
|
|
14
|
+
export class TaskReviewStatus extends WalletMonitorTask {
|
|
15
|
+
static taskName = 'ReviewStatus'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Set to true to trigger running this task
|
|
19
|
+
*/
|
|
20
|
+
static checkNow = false
|
|
21
|
+
|
|
22
|
+
constructor(
|
|
23
|
+
monitor: Monitor,
|
|
24
|
+
public triggerMsecs = 1000 * 60 * 15,
|
|
25
|
+
public agedMsecs = 1000 * 60 * 5
|
|
26
|
+
) {
|
|
27
|
+
super(monitor, TaskReviewStatus.taskName)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
trigger(nowMsecsSinceEpoch: number): { run: boolean } {
|
|
31
|
+
return {
|
|
32
|
+
run:
|
|
33
|
+
this.triggerMsecs > 0 &&
|
|
34
|
+
nowMsecsSinceEpoch - this.lastRunMsecsSinceEpoch > this.triggerMsecs
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async runTask(): Promise<string> {
|
|
39
|
+
let log = ''
|
|
40
|
+
|
|
41
|
+
const agedLimit = new Date(Date.now() - this.agedMsecs)
|
|
42
|
+
const r = await this.storage.runAsStorageProvider(async sp => {
|
|
43
|
+
const r = await sp.reviewStatus({ agedLimit })
|
|
44
|
+
return r
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
if (r.log.length > 0) log += `${r.log}`
|
|
48
|
+
|
|
49
|
+
return log
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { entity, table } from '../../storage/index.client'
|
|
2
|
+
import { verifyTruthy } from '../../utility/index.client'
|
|
3
|
+
import { Monitor } from '../Monitor'
|
|
4
|
+
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
5
|
+
import { attemptToPostReqsToNetwork } from '../../storage/methods/attemptToPostReqsToNetwork'
|
|
6
|
+
|
|
7
|
+
export class TaskSendWaiting extends WalletMonitorTask {
|
|
8
|
+
static taskName = 'SendWaiting'
|
|
9
|
+
|
|
10
|
+
constructor(
|
|
11
|
+
monitor: Monitor,
|
|
12
|
+
public triggerMsecs = 1000 * 60 * 5,
|
|
13
|
+
public agedMsecs = 0
|
|
14
|
+
) {
|
|
15
|
+
super(monitor, TaskSendWaiting.taskName)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
trigger(nowMsecsSinceEpoch: number): { run: boolean } {
|
|
19
|
+
return {
|
|
20
|
+
run: nowMsecsSinceEpoch > this.lastRunMsecsSinceEpoch + this.triggerMsecs
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async runTask(): Promise<string> {
|
|
25
|
+
let log = ''
|
|
26
|
+
const limit = 100
|
|
27
|
+
let offset = 0
|
|
28
|
+
const agedLimit = new Date(Date.now() - this.agedMsecs)
|
|
29
|
+
for (;;) {
|
|
30
|
+
const reqs = await this.storage.findProvenTxReqs({
|
|
31
|
+
partial: {},
|
|
32
|
+
status: ['unsent'],
|
|
33
|
+
paged: { limit, offset }
|
|
34
|
+
})
|
|
35
|
+
if (reqs.length === 0) break
|
|
36
|
+
log += `${reqs.length} reqs with status 'unsent'\n`
|
|
37
|
+
const agedReqs = reqs.filter(
|
|
38
|
+
req => verifyTruthy(req.updated_at) < agedLimit
|
|
39
|
+
)
|
|
40
|
+
log += ` Of those reqs, ${agedReqs.length} where last updated before ${agedLimit.toISOString()}.\n`
|
|
41
|
+
log += await this.processUnsent(agedReqs, 2)
|
|
42
|
+
if (reqs.length < limit) break
|
|
43
|
+
offset += limit
|
|
44
|
+
}
|
|
45
|
+
return log
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Process an array of 'unsent' status table.ProvenTxReq
|
|
50
|
+
*
|
|
51
|
+
* Send rawTx to transaction processor(s), requesting proof callbacks when possible.
|
|
52
|
+
*
|
|
53
|
+
* Set status 'invalid' if req is invalid.
|
|
54
|
+
*
|
|
55
|
+
* Set status to 'callback' on successful network submission with callback service.
|
|
56
|
+
*
|
|
57
|
+
* Set status to 'unmined' on successful network submission without callback service.
|
|
58
|
+
*
|
|
59
|
+
* Add mapi responses to database table if received.
|
|
60
|
+
*
|
|
61
|
+
* Increments attempts if sending was attempted.
|
|
62
|
+
*
|
|
63
|
+
* @param reqApis
|
|
64
|
+
*/
|
|
65
|
+
async processUnsent(
|
|
66
|
+
reqApis: table.ProvenTxReq[],
|
|
67
|
+
indent = 0
|
|
68
|
+
): Promise<string> {
|
|
69
|
+
let log = ''
|
|
70
|
+
for (let i = 0; i < reqApis.length; i++) {
|
|
71
|
+
const reqApi = reqApis[i]
|
|
72
|
+
log += ' '.repeat(indent)
|
|
73
|
+
log += `${i} reqId=${reqApi.provenTxReqId} attempts=${reqApi.attempts} txid=${reqApi.txid}: \n`
|
|
74
|
+
if (reqApi.status !== 'unsent') {
|
|
75
|
+
log += ` status now ${reqApi.status}\n`
|
|
76
|
+
continue
|
|
77
|
+
}
|
|
78
|
+
const req = new entity.ProvenTxReq(reqApi)
|
|
79
|
+
const reqs: entity.ProvenTxReq[] = []
|
|
80
|
+
if (req.batch) {
|
|
81
|
+
// Make sure wew process entire batch together for efficient beef generation
|
|
82
|
+
const batchReqApis = await this.storage.findProvenTxReqs({
|
|
83
|
+
partial: { batch: req.batch, status: 'unsent' }
|
|
84
|
+
})
|
|
85
|
+
for (const bra of batchReqApis) {
|
|
86
|
+
// Remove any matching batchReqApis from reqApis
|
|
87
|
+
const index = reqApis.findIndex(
|
|
88
|
+
ra => ra.provenTxReqId === bra.provenTxReqId
|
|
89
|
+
)
|
|
90
|
+
if (index > -1) reqApis.slice(index, index + 1)
|
|
91
|
+
// And add to reqs being processed now:
|
|
92
|
+
reqs.push(new entity.ProvenTxReq(bra))
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
// Just a single non-batched req...
|
|
96
|
+
reqs.push(req)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const r = await this.storage.runAsStorageProvider(async sp => {
|
|
100
|
+
return attemptToPostReqsToNetwork(sp, reqs)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
log += r.log
|
|
104
|
+
}
|
|
105
|
+
return log
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Monitor } from '../Monitor'
|
|
2
|
+
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
3
|
+
|
|
4
|
+
export class TaskSyncWhenIdle extends WalletMonitorTask {
|
|
5
|
+
static taskName = 'SyncWhenIdle'
|
|
6
|
+
|
|
7
|
+
constructor(
|
|
8
|
+
monitor: Monitor,
|
|
9
|
+
public triggerMsecs = 1000 * 60 * 1
|
|
10
|
+
) {
|
|
11
|
+
super(monitor, TaskSyncWhenIdle.taskName)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
trigger(nowMsecsSinceEpoch: number): { run: boolean } {
|
|
15
|
+
const s = this.storage
|
|
16
|
+
|
|
17
|
+
const run = false
|
|
18
|
+
|
|
19
|
+
return { run }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async runTask(): Promise<string> {
|
|
23
|
+
// TODO...
|
|
24
|
+
return ''
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { MonitorStorage, Monitor } from '../Monitor'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A monitor task performs some periodic or state triggered maintenance function
|
|
5
|
+
* on the data managed by a wallet (Bitcoin UTXO manager, aka wallet)
|
|
6
|
+
*
|
|
7
|
+
* The monitor maintains a collection of tasks.
|
|
8
|
+
*
|
|
9
|
+
* It runs each task's non-asynchronous trigger to determine if the runTask method needs to run.
|
|
10
|
+
*
|
|
11
|
+
* Tasks that need to be run are run consecutively by awaiting their async runTask override method.
|
|
12
|
+
*
|
|
13
|
+
* The monitor then waits a fixed interval before repeating...
|
|
14
|
+
*
|
|
15
|
+
* Tasks may use the monitor_events table to persist their execution history.
|
|
16
|
+
* This is done by accessing the wathman.storage object.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export abstract class WalletMonitorTask {
|
|
20
|
+
/**
|
|
21
|
+
* Set by monitor each time runTask completes
|
|
22
|
+
*/
|
|
23
|
+
lastRunMsecsSinceEpoch = 0
|
|
24
|
+
|
|
25
|
+
storage: MonitorStorage
|
|
26
|
+
|
|
27
|
+
constructor(
|
|
28
|
+
public monitor: Monitor,
|
|
29
|
+
public name: string
|
|
30
|
+
) {
|
|
31
|
+
this.storage = monitor.storage
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Override to handle async task setup configuration.
|
|
36
|
+
*
|
|
37
|
+
* Called before first call to `trigger`
|
|
38
|
+
*/
|
|
39
|
+
async asyncSetup(): Promise<void> {}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Return true if `runTask` needs to be called now.
|
|
43
|
+
*/
|
|
44
|
+
abstract trigger(nowMsecsSinceEpoch: number): { run: boolean }
|
|
45
|
+
|
|
46
|
+
abstract runTask(): Promise<string>
|
|
47
|
+
}
|