@bsv/wallet-toolbox 2.1.24 → 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/CHANGELOG.md +2 -7
- 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 +2775 -243
- package/docs/v3-upgrade/index.html +911 -0
- package/docs/wallet.md +4956 -9455
- package/out/src/CWIStyleWalletManager.d.ts +33 -7
- package/out/src/CWIStyleWalletManager.d.ts.map +1 -1
- package/out/src/CWIStyleWalletManager.js +281 -313
- package/out/src/CWIStyleWalletManager.js.map +1 -1
- package/out/src/Setup.d.ts +6 -6
- package/out/src/Setup.d.ts.map +1 -1
- package/out/src/Setup.js +5 -5
- package/out/src/Setup.js.map +1 -1
- package/out/src/SetupClient.d.ts +6 -6
- package/out/src/SetupClient.d.ts.map +1 -1
- package/out/src/SetupClient.js +5 -5
- package/out/src/SetupClient.js.map +1 -1
- package/out/src/SetupWallet.d.ts.map +1 -1
- package/out/src/ShamirWalletManager.d.ts +3 -3
- package/out/src/ShamirWalletManager.d.ts.map +1 -1
- package/out/src/ShamirWalletManager.js +6 -6
- package/out/src/ShamirWalletManager.js.map +1 -1
- package/out/src/SimpleWalletManager.d.ts +12 -2
- package/out/src/SimpleWalletManager.d.ts.map +1 -1
- package/out/src/SimpleWalletManager.js +46 -30
- package/out/src/SimpleWalletManager.js.map +1 -1
- package/out/src/Wallet.d.ts +1 -1
- package/out/src/Wallet.d.ts.map +1 -1
- package/out/src/Wallet.js +102 -100
- package/out/src/Wallet.js.map +1 -1
- package/out/src/WalletAuthenticationManager.d.ts +1 -1
- package/out/src/WalletAuthenticationManager.d.ts.map +1 -1
- package/out/src/WalletAuthenticationManager.js +3 -3
- package/out/src/WalletAuthenticationManager.js.map +1 -1
- package/out/src/WalletLogger.d.ts.map +1 -1
- package/out/src/WalletLogger.js +16 -8
- package/out/src/WalletLogger.js.map +1 -1
- package/out/src/WalletPermissionsManager.d.ts +89 -18
- package/out/src/WalletPermissionsManager.d.ts.map +1 -1
- package/out/src/WalletPermissionsManager.js +656 -870
- package/out/src/WalletPermissionsManager.js.map +1 -1
- package/out/src/WalletSettingsManager.d.ts +2 -2
- package/out/src/WalletSettingsManager.d.ts.map +1 -1
- package/out/src/WalletSettingsManager.js.map +1 -1
- package/out/src/__tests/CWIStyleWalletManager.test.js +6 -6
- package/out/src/__tests/CWIStyleWalletManager.test.js.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.checks.test.js.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.encryption.test.js +8 -8
- package/out/src/__tests/WalletPermissionsManager.encryption.test.js.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.fixtures.d.ts +0 -2
- package/out/src/__tests/WalletPermissionsManager.fixtures.d.ts.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.fixtures.js +6 -18
- package/out/src/__tests/WalletPermissionsManager.fixtures.js.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.flows.test.js.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.pmodules.test.js +7 -7
- package/out/src/__tests/WalletPermissionsManager.pmodules.test.js.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.tokens.test.js +1 -1
- package/out/src/__tests/WalletPermissionsManager.tokens.test.js.map +1 -1
- package/out/src/entropy/EntropyCollector.d.ts +1 -1
- package/out/src/entropy/EntropyCollector.d.ts.map +1 -1
- package/out/src/entropy/EntropyCollector.js +3 -3
- package/out/src/entropy/EntropyCollector.js.map +1 -1
- package/out/src/fundWalletP2PKH.d.ts +2 -2
- package/out/src/fundWalletP2PKH.d.ts.map +1 -1
- package/out/src/fundWalletP2PKH.js +11 -10
- package/out/src/fundWalletP2PKH.js.map +1 -1
- package/out/src/mockchain/MockChainMigrations.d.ts +3 -3
- package/out/src/mockchain/MockChainMigrations.d.ts.map +1 -1
- package/out/src/mockchain/MockChainMigrations.js.map +1 -1
- package/out/src/mockchain/MockChainStorage.d.ts.map +1 -1
- package/out/src/mockchain/MockChainStorage.js +5 -5
- package/out/src/mockchain/MockChainStorage.js.map +1 -1
- package/out/src/mockchain/MockChainTracker.d.ts.map +1 -1
- package/out/src/mockchain/MockChainTracker.js +10 -10
- package/out/src/mockchain/MockChainTracker.js.map +1 -1
- package/out/src/mockchain/MockMiner.d.ts.map +1 -1
- package/out/src/mockchain/MockMiner.js +3 -3
- package/out/src/mockchain/MockMiner.js.map +1 -1
- package/out/src/mockchain/MockServices.d.ts +9 -0
- package/out/src/mockchain/MockServices.d.ts.map +1 -1
- package/out/src/mockchain/MockServices.js +195 -238
- package/out/src/mockchain/MockServices.js.map +1 -1
- package/out/src/mockchain/merkleTree.d.ts.map +1 -1
- package/out/src/mockchain/merkleTree.js +21 -12
- package/out/src/mockchain/merkleTree.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 +24 -0
- package/out/src/monitor/Monitor.d.ts.map +1 -1
- package/out/src/monitor/Monitor.js +63 -75
- 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 +24 -23
- 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/__test/MonitorDaemon.man.test.js.map +1 -1
- 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/TaskArcSSE.d.ts +2 -2
- package/out/src/monitor/tasks/TaskArcSSE.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskArcSSE.js +10 -23
- package/out/src/monitor/tasks/TaskArcSSE.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +4 -2
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.js +83 -16
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.d.ts +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.js +1 -2
- package/out/src/monitor/tasks/TaskCheckNoSends.js.map +1 -1
- package/out/src/monitor/tasks/TaskClock.d.ts +1 -1
- package/out/src/monitor/tasks/TaskClock.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskClock.js +0 -1
- package/out/src/monitor/tasks/TaskClock.js.map +1 -1
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts +1 -1
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -1
- package/out/src/monitor/tasks/TaskMineBlock.d.ts +1 -1
- package/out/src/monitor/tasks/TaskMineBlock.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskMineBlock.js.map +1 -1
- package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts +1 -1
- package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskMonitorCallHistory.js +1 -1
- package/out/src/monitor/tasks/TaskMonitorCallHistory.js.map +1 -1
- package/out/src/monitor/tasks/TaskNewHeader.d.ts +2 -2
- package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskNewHeader.js +7 -5
- package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -1
- package/out/src/monitor/tasks/TaskPurge.d.ts +1 -1
- package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskPurge.js.map +1 -1
- package/out/src/monitor/tasks/TaskReorg.d.ts +1 -1
- package/out/src/monitor/tasks/TaskReorg.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReorg.js +2 -2
- package/out/src/monitor/tasks/TaskReorg.js.map +1 -1
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.d.ts +1 -1
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.js +10 -10
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.js.map +1 -1
- package/out/src/monitor/tasks/TaskReviewProvenTxs.d.ts +1 -1
- package/out/src/monitor/tasks/TaskReviewProvenTxs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewProvenTxs.js +2 -2
- package/out/src/monitor/tasks/TaskReviewProvenTxs.js.map +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -1
- package/out/src/monitor/tasks/TaskReviewUtxos.d.ts +1 -1
- package/out/src/monitor/tasks/TaskReviewUtxos.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewUtxos.js.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.js +4 -5
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
- package/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts +1 -1
- package/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskSyncWhenIdle.js +1 -4
- package/out/src/monitor/tasks/TaskSyncWhenIdle.js.map +1 -1
- package/out/src/monitor/tasks/TaskUnFail.d.ts +1 -1
- package/out/src/monitor/tasks/TaskUnFail.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskUnFail.js +13 -15
- package/out/src/monitor/tasks/TaskUnFail.js.map +1 -1
- package/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +1 -1
- package/out/src/monitor/tasks/WalletMonitorTask.js +3 -1
- package/out/src/monitor/tasks/WalletMonitorTask.js.map +1 -1
- package/out/src/monitor/tasks/__tests/TaskArcSSE.test.js.map +1 -1
- package/out/src/monitor/tasks/__tests/TaskReviewDoubleSpends.test.js.map +1 -1
- package/out/src/monitor/tasks/__tests/TaskReviewProvenTxs.test.js.map +1 -1
- package/out/src/monitor/tasks/__tests/TaskReviewUtxos.test.js.map +1 -1
- package/out/src/monitor/tasks/__tests/TaskSendWaiting.test.js.map +1 -1
- package/out/src/sdk/CertOpsWallet.d.ts +3 -3
- package/out/src/sdk/CertOpsWallet.d.ts.map +1 -1
- package/out/src/sdk/PrivilegedKeyManager.d.ts +3 -3
- package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -1
- package/out/src/sdk/PrivilegedKeyManager.js +26 -21
- package/out/src/sdk/PrivilegedKeyManager.js.map +1 -1
- package/out/src/sdk/WERR_errors.d.ts.map +1 -1
- package/out/src/sdk/WERR_errors.js +5 -5
- package/out/src/sdk/WERR_errors.js.map +1 -1
- package/out/src/sdk/WalletError.d.ts +1 -1
- package/out/src/sdk/WalletError.d.ts.map +1 -1
- package/out/src/sdk/WalletError.js +10 -3
- package/out/src/sdk/WalletError.js.map +1 -1
- package/out/src/sdk/WalletErrorFromJson.d.ts.map +1 -1
- package/out/src/sdk/WalletErrorFromJson.js +1 -3
- package/out/src/sdk/WalletErrorFromJson.js.map +1 -1
- package/out/src/sdk/WalletServices.interfaces.d.ts +19 -19
- package/out/src/sdk/WalletServices.interfaces.d.ts.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/__test/CertificateLifeCycle.test.js +3 -3
- package/out/src/sdk/__test/CertificateLifeCycle.test.js.map +1 -1
- package/out/src/sdk/__test/WalletError.test.js +4 -4
- package/out/src/sdk/__test/WalletError.test.js.map +1 -1
- package/out/src/sdk/types.d.ts +36 -4
- package/out/src/sdk/types.d.ts.map +1 -1
- package/out/src/sdk/types.js +53 -4
- package/out/src/sdk/types.js.map +1 -1
- package/out/src/services/ServiceCollection.d.ts +6 -6
- package/out/src/services/ServiceCollection.d.ts.map +1 -1
- package/out/src/services/ServiceCollection.js +3 -4
- package/out/src/services/ServiceCollection.js.map +1 -1
- package/out/src/services/Services.d.ts +5 -0
- package/out/src/services/Services.d.ts.map +1 -1
- package/out/src/services/Services.js +174 -182
- package/out/src/services/Services.js.map +1 -1
- package/out/src/services/__tests/ARC.man.test.js.map +1 -1
- package/out/src/services/__tests/ARC.timeout.man.test.js +3 -3
- package/out/src/services/__tests/ARC.timeout.man.test.js.map +1 -1
- package/out/src/services/__tests/ArcGorillaPool.man.test.js.map +1 -1
- package/out/src/services/__tests/bitrails.test.js +3 -2
- package/out/src/services/__tests/bitrails.test.js.map +1 -1
- package/out/src/services/__tests/getFiatExchangeRate.test.js.map +1 -1
- package/out/src/services/__tests/postBeef.test.js.map +1 -1
- package/out/src/services/chaintracker/BHServiceClient.d.ts.map +1 -1
- package/out/src/services/chaintracker/BHServiceClient.js +7 -7
- package/out/src/services/chaintracker/BHServiceClient.js.map +1 -1
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -1
- package/out/src/services/chaintracker/ChaintracksChainTracker.js +5 -5
- package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -1
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.js +2 -2
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.js.map +1 -1
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.js +1 -1
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts +5 -3
- package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts +20 -10
- package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Chaintracks.js +228 -221
- package/out/src/services/chaintracker/chaintracks/Chaintracks.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksService.d.ts +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksService.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksService.js +5 -22
- package/out/src/services/chaintracker/chaintracks/ChaintracksService.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +9 -10
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts +1 -2
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js +3 -3
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js +3 -3
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainWs.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainWs.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorTeranodeP2P.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorTeranodeP2P.js +1 -8
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorTeranodeP2P.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 +2 -2
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainWs.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainWs.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts +2 -2
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js +6 -39
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts +3 -3
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js +8 -6
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/__tests/BulkIngestorCDNBabbage.test.js +2 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/__tests/BulkIngestorCDNBabbage.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/__tests/LiveIngestorWhatsOnChainPoll.test.js +4 -3
- package/out/src/services/chaintracker/chaintracks/Ingest/__tests/LiveIngestorWhatsOnChainPoll.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/__tests/WhatsOnChainServices.man.test.js +11 -10
- package/out/src/services/chaintracker/chaintracks/Ingest/__tests/WhatsOnChainServices.man.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js +9 -16
- package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksKnexMigrations.d.ts +3 -3
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksKnexMigrations.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksKnexMigrations.js +13 -13
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksKnexMigrations.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 +34 -22
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js +31 -30
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.d.ts +1 -2
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.js +25 -22
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageMemory.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageMemory.js +0 -21
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageMemory.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts +2 -2
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js +11 -10
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/__tests/ChaintracksStorageIdb.test.js +2 -1
- package/out/src/services/chaintracker/chaintracks/Storage/__tests/ChaintracksStorageIdb.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/__tests/Chaintracks.test.js +8 -7
- package/out/src/services/chaintracker/chaintracks/__tests/Chaintracks.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/__tests/ChaintracksCDN.man.test.js +6 -5
- package/out/src/services/chaintracker/chaintracks/__tests/ChaintracksCDN.man.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/__tests/ChaintracksClientApi.test.js +10 -9
- package/out/src/services/chaintracker/chaintracks/__tests/ChaintracksClientApi.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/__tests/LocalCdnServer.d.ts +1 -1
- package/out/src/services/chaintracker/chaintracks/__tests/LocalCdnServer.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/__tests/LocalCdnServer.js +14 -17
- package/out/src/services/chaintracker/chaintracks/__tests/LocalCdnServer.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/__tests/createIdbChaintracks.test.js +3 -2
- package/out/src/services/chaintracker/chaintracks/__tests/createIdbChaintracks.test.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 +6 -8
- 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/BulkFileDataManager.d.ts +6 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js +247 -227
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.js +8 -7
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.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 +35 -25
- package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts +5 -5
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js +13 -11
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts +0 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFs.d.ts +2 -2
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFs.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFs.js +13 -13
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFs.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.js +21 -13
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts +2 -2
- 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/BulkFileDataManager.test.js +11 -11
- package/out/src/services/chaintracker/chaintracks/util/__tests/BulkFileDataManager.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/__tests/ChaintracksFetch.test.js +1 -1
- package/out/src/services/chaintracker/chaintracks/util/__tests/ChaintracksFetch.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/__tests/SingleWriterMultiReaderLock.test.js +2 -2
- package/out/src/services/chaintracker/chaintracks/util/__tests/SingleWriterMultiReaderLock.test.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts +1 -1
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js +28 -24
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js +9 -10
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js.map +1 -1
- package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -1
- package/out/src/services/createDefaultWalletServicesOptions.js +3 -3
- package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -1
- package/out/src/services/providers/ARC.d.ts.map +1 -1
- package/out/src/services/providers/ARC.js +7 -14
- package/out/src/services/providers/ARC.js.map +1 -1
- package/out/src/services/providers/ArcSSEClient.d.ts.map +1 -1
- package/out/src/services/providers/ArcSSEClient.js +1 -1
- package/out/src/services/providers/ArcSSEClient.js.map +1 -1
- package/out/src/services/providers/Bitails.d.ts.map +1 -1
- package/out/src/services/providers/Bitails.js +17 -17
- package/out/src/services/providers/Bitails.js.map +1 -1
- package/out/src/services/providers/SdkWhatsOnChain.d.ts.map +1 -1
- package/out/src/services/providers/SdkWhatsOnChain.js.map +1 -1
- package/out/src/services/providers/WhatsOnChain.d.ts +2 -0
- package/out/src/services/providers/WhatsOnChain.d.ts.map +1 -1
- package/out/src/services/providers/WhatsOnChain.js +109 -233
- package/out/src/services/providers/WhatsOnChain.js.map +1 -1
- package/out/src/services/providers/__tests/ArcSSEClient.test.js.map +1 -1
- package/out/src/services/providers/exchangeRates.d.ts.map +1 -1
- package/out/src/services/providers/exchangeRates.js +3 -3
- package/out/src/services/providers/exchangeRates.js.map +1 -1
- package/out/src/services/providers/getBeefForTxid.d.ts +1 -1
- package/out/src/services/providers/getBeefForTxid.d.ts.map +1 -1
- package/out/src/services/providers/getBeefForTxid.js.map +1 -1
- package/out/src/services/providers/whatsOnChainHelpers.d.ts +68 -0
- package/out/src/services/providers/whatsOnChainHelpers.d.ts.map +1 -0
- package/out/src/services/providers/whatsOnChainHelpers.js +147 -0
- package/out/src/services/providers/whatsOnChainHelpers.js.map +1 -0
- package/out/src/signer/WalletSigner.d.ts.map +1 -1
- package/out/src/signer/WalletSigner.js.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.js +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
- package/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
- package/out/src/signer/methods/buildSignableTransaction.js +21 -13
- package/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
- package/out/src/signer/methods/completeSignedTransaction.d.ts.map +1 -1
- package/out/src/signer/methods/completeSignedTransaction.js +20 -21
- package/out/src/signer/methods/completeSignedTransaction.js.map +1 -1
- package/out/src/signer/methods/createAction.d.ts.map +1 -1
- package/out/src/signer/methods/createAction.js +8 -7
- package/out/src/signer/methods/createAction.js.map +1 -1
- package/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/signer/methods/internalizeAction.js +8 -6
- package/out/src/signer/methods/internalizeAction.js.map +1 -1
- package/out/src/signer/methods/proveCertificate.js +1 -1
- package/out/src/signer/methods/signAction.d.ts.map +1 -1
- package/out/src/signer/methods/signAction.js +8 -10
- package/out/src/signer/methods/signAction.js.map +1 -1
- package/out/src/storage/StorageIdb.d.ts +16 -1
- package/out/src/storage/StorageIdb.d.ts.map +1 -1
- package/out/src/storage/StorageIdb.js +544 -1224
- package/out/src/storage/StorageIdb.js.map +1 -1
- package/out/src/storage/StorageKnex.d.ts +143 -3
- package/out/src/storage/StorageKnex.d.ts.map +1 -1
- package/out/src/storage/StorageKnex.js +829 -222
- package/out/src/storage/StorageKnex.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts +124 -1
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +316 -186
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/StorageReader.d.ts.map +1 -1
- package/out/src/storage/StorageReader.js +8 -7
- package/out/src/storage/StorageReader.js.map +1 -1
- package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
- package/out/src/storage/StorageReaderWriter.js +32 -32
- package/out/src/storage/StorageReaderWriter.js.map +1 -1
- package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
- package/out/src/storage/StorageSyncReader.js +3 -3
- package/out/src/storage/StorageSyncReader.js.map +1 -1
- package/out/src/storage/WalletStorageManager.d.ts +3 -0
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.js +83 -73
- package/out/src/storage/WalletStorageManager.js.map +1 -1
- package/out/src/storage/__test/StorageIdb.test.js +1 -1
- package/out/src/storage/__test/WalletStorageManager.test.js +1 -1
- package/out/src/storage/__test/WalletStorageManager.test.js.map +1 -1
- package/out/src/storage/__test/adminStats.man.test.js +1 -1
- package/out/src/storage/__test/adminStats.man.test.js.map +1 -1
- package/out/src/storage/__test/findStaleMerkleRoots.test.js.map +1 -1
- package/out/src/storage/__test/findStaleMerkleRootsKnex.test.js.map +1 -1
- package/out/src/storage/__test/getBeefForTransaction.test.js +1 -1
- package/out/src/storage/__test/getBeefForTransaction.test.js.map +1 -1
- package/out/src/storage/adminServer/adminServer.d.ts +1 -1
- package/out/src/storage/adminServer/adminServer.d.ts.map +1 -1
- package/out/src/storage/adminServer/adminServer.js +12 -12
- package/out/src/storage/adminServer/adminServer.js.map +1 -1
- package/out/src/storage/adminServer/adminUi.d.ts.map +1 -1
- package/out/src/storage/idbHelpers.d.ts +47 -0
- package/out/src/storage/idbHelpers.d.ts.map +1 -0
- package/out/src/storage/idbHelpers.js +417 -0
- package/out/src/storage/idbHelpers.js.map +1 -0
- package/out/src/storage/methods/ListActionsSpecOp.d.ts +6 -1
- package/out/src/storage/methods/ListActionsSpecOp.d.ts.map +1 -1
- package/out/src/storage/methods/ListActionsSpecOp.js +28 -2
- package/out/src/storage/methods/ListActionsSpecOp.js.map +1 -1
- package/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +1 -1
- package/out/src/storage/methods/ListOutputsSpecOp.js +8 -11
- package/out/src/storage/methods/ListOutputsSpecOp.js.map +1 -1
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js +3 -3
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js.map +1 -1
- package/out/src/storage/methods/__test/offsetKey.test.js +1 -1
- package/out/src/storage/methods/__test/offsetKey.test.js.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +83 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +338 -63
- 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 +251 -274
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/methods/generateChange.d.ts.map +1 -1
- package/out/src/storage/methods/generateChange.js +99 -80
- package/out/src/storage/methods/generateChange.js.map +1 -1
- package/out/src/storage/methods/getBeefForTransaction.js +15 -13
- package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
- package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
- package/out/src/storage/methods/getSyncChunk.js +4 -3
- package/out/src/storage/methods/getSyncChunk.js.map +1 -1
- package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/storage/methods/internalizeAction.js +213 -56
- package/out/src/storage/methods/internalizeAction.js.map +1 -1
- package/out/src/storage/methods/listActionsIdb.d.ts.map +1 -1
- package/out/src/storage/methods/listActionsIdb.js +85 -110
- package/out/src/storage/methods/listActionsIdb.js.map +1 -1
- package/out/src/storage/methods/listActionsKnex.d.ts +50 -1
- package/out/src/storage/methods/listActionsKnex.d.ts.map +1 -1
- package/out/src/storage/methods/listActionsKnex.js +256 -169
- package/out/src/storage/methods/listActionsKnex.js.map +1 -1
- package/out/src/storage/methods/listCertificates.d.ts +1 -1
- package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
- package/out/src/storage/methods/listCertificates.js +7 -7
- package/out/src/storage/methods/listCertificates.js.map +1 -1
- package/out/src/storage/methods/listOutputsIdb.d.ts.map +1 -1
- package/out/src/storage/methods/listOutputsIdb.js +24 -27
- package/out/src/storage/methods/listOutputsIdb.js.map +1 -1
- package/out/src/storage/methods/listOutputsKnex.d.ts +1 -1
- package/out/src/storage/methods/listOutputsKnex.d.ts.map +1 -1
- package/out/src/storage/methods/listOutputsKnex.js +78 -32
- package/out/src/storage/methods/listOutputsKnex.js.map +1 -1
- package/out/src/storage/methods/offsetKey.d.ts +1 -1
- package/out/src/storage/methods/offsetKey.d.ts.map +1 -1
- package/out/src/storage/methods/offsetKey.js +3 -5
- package/out/src/storage/methods/offsetKey.js.map +1 -1
- package/out/src/storage/methods/processAction.d.ts +0 -11
- package/out/src/storage/methods/processAction.d.ts.map +1 -1
- package/out/src/storage/methods/processAction.js +168 -93
- package/out/src/storage/methods/processAction.js.map +1 -1
- package/out/src/storage/methods/purgeData.d.ts +1 -1
- package/out/src/storage/methods/purgeData.d.ts.map +1 -1
- package/out/src/storage/methods/purgeData.js +54 -27
- package/out/src/storage/methods/purgeData.js.map +1 -1
- package/out/src/storage/methods/purgeDataIdb.d.ts.map +1 -1
- package/out/src/storage/methods/purgeDataIdb.js +1 -1
- package/out/src/storage/methods/purgeDataIdb.js.map +1 -1
- package/out/src/storage/methods/reviewStatus.d.ts +1 -1
- package/out/src/storage/methods/reviewStatus.d.ts.map +1 -1
- package/out/src/storage/methods/reviewStatus.js +35 -18
- package/out/src/storage/methods/reviewStatus.js.map +1 -1
- package/out/src/storage/methods/reviewStatusIdb.d.ts +1 -1
- package/out/src/storage/methods/reviewStatusIdb.d.ts.map +1 -1
- package/out/src/storage/methods/reviewStatusIdb.js.map +1 -1
- package/out/src/storage/methods/utils.Buffer.d.ts.map +1 -1
- package/out/src/storage/methods/utils.Buffer.js.map +1 -1
- package/out/src/storage/methods/utils.d.ts.map +1 -1
- package/out/src/storage/methods/utils.js +7 -1
- package/out/src/storage/methods/utils.js.map +1 -1
- package/out/src/storage/remoting/StorageClient.d.ts +4 -270
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageClient.js +16 -423
- package/out/src/storage/remoting/StorageClient.js.map +1 -1
- package/out/src/storage/remoting/StorageClientBase.d.ts +289 -0
- package/out/src/storage/remoting/StorageClientBase.d.ts.map +1 -0
- package/out/src/storage/remoting/StorageClientBase.js +375 -0
- package/out/src/storage/remoting/StorageClientBase.js.map +1 -0
- package/out/src/storage/remoting/StorageMobile.d.ts +7 -275
- package/out/src/storage/remoting/StorageMobile.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageMobile.js +12 -421
- package/out/src/storage/remoting/StorageMobile.js.map +1 -1
- package/out/src/storage/remoting/StorageServer.d.ts +11 -8
- package/out/src/storage/remoting/StorageServer.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageServer.js +51 -102
- package/out/src/storage/remoting/StorageServer.js.map +1 -1
- package/out/src/storage/remoting/__test/StorageClient.man.test.js +6 -6
- package/out/src/storage/remoting/__test/StorageClient.man.test.js.map +1 -1
- package/out/src/storage/remoting/__test/StorageClient.test.js +8 -8
- package/out/src/storage/remoting/__test/StorageClient.test.js.map +1 -1
- package/out/src/storage/remoting/__tests__/entityValidationHelpers.test.d.ts +2 -0
- package/out/src/storage/remoting/__tests__/entityValidationHelpers.test.d.ts.map +1 -0
- package/out/src/storage/remoting/__tests__/entityValidationHelpers.test.js +268 -0
- package/out/src/storage/remoting/__tests__/entityValidationHelpers.test.js.map +1 -0
- package/out/src/storage/remoting/entityValidationHelpers.d.ts +29 -0
- package/out/src/storage/remoting/entityValidationHelpers.d.ts.map +1 -0
- package/out/src/storage/remoting/entityValidationHelpers.js +91 -0
- package/out/src/storage/remoting/entityValidationHelpers.js.map +1 -0
- package/out/src/storage/schema/KnexMigrations.d.ts +3 -3
- package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -1
- package/out/src/storage/schema/KnexMigrations.js +160 -9
- 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/v7Backfill.runner.test.d.ts +2 -0
- package/out/src/storage/schema/__tests/v7Backfill.runner.test.d.ts.map +1 -0
- package/out/src/storage/schema/__tests/v7Backfill.runner.test.js +148 -0
- package/out/src/storage/schema/__tests/v7Backfill.runner.test.js.map +1 -0
- package/out/src/storage/schema/__tests/v7Backfill.test.d.ts +2 -0
- package/out/src/storage/schema/__tests/v7Backfill.test.d.ts.map +1 -0
- package/out/src/storage/schema/__tests/v7Backfill.test.js +96 -0
- package/out/src/storage/schema/__tests/v7Backfill.test.js.map +1 -0
- package/out/src/storage/schema/__tests/v7Fsm.test.d.ts +2 -0
- package/out/src/storage/schema/__tests/v7Fsm.test.d.ts.map +1 -0
- package/out/src/storage/schema/__tests/v7Fsm.test.js +42 -0
- package/out/src/storage/schema/__tests/v7Fsm.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/__tests/v7Spendability.test.d.ts +2 -0
- package/out/src/storage/schema/__tests/v7Spendability.test.d.ts.map +1 -0
- package/out/src/storage/schema/__tests/v7Spendability.test.js +29 -0
- package/out/src/storage/schema/__tests/v7Spendability.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/entities/EntityBase.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityBase.js.map +1 -1
- package/out/src/storage/schema/entities/EntityCertificate.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityCertificate.js +5 -4
- package/out/src/storage/schema/entities/EntityCertificate.js.map +1 -1
- package/out/src/storage/schema/entities/EntityCertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityCertificateField.js +5 -7
- package/out/src/storage/schema/entities/EntityCertificateField.js.map +1 -1
- package/out/src/storage/schema/entities/EntityCommission.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityCommission.js +6 -8
- package/out/src/storage/schema/entities/EntityCommission.js.map +1 -1
- package/out/src/storage/schema/entities/EntityOutput.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityOutput.js +21 -24
- package/out/src/storage/schema/entities/EntityOutput.js.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputBasket.js +6 -6
- package/out/src/storage/schema/entities/EntityOutputBasket.js.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputTag.js +2 -2
- package/out/src/storage/schema/entities/EntityOutputTag.js.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputTagMap.js +4 -6
- package/out/src/storage/schema/entities/EntityOutputTagMap.js.map +1 -1
- package/out/src/storage/schema/entities/EntityProvenTx.d.ts +3 -3
- package/out/src/storage/schema/entities/EntityProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityProvenTx.js +22 -23
- package/out/src/storage/schema/entities/EntityProvenTx.js.map +1 -1
- package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts +9 -0
- package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityProvenTxReq.js +116 -68
- package/out/src/storage/schema/entities/EntityProvenTxReq.js.map +1 -1
- package/out/src/storage/schema/entities/EntitySyncState.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntitySyncState.js +19 -18
- package/out/src/storage/schema/entities/EntitySyncState.js.map +1 -1
- package/out/src/storage/schema/entities/EntityTransaction.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityTransaction.js +25 -26
- package/out/src/storage/schema/entities/EntityTransaction.js.map +1 -1
- package/out/src/storage/schema/entities/EntityTxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityTxLabel.js +2 -2
- package/out/src/storage/schema/entities/EntityTxLabel.js.map +1 -1
- package/out/src/storage/schema/entities/EntityTxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityTxLabelMap.js +4 -6
- package/out/src/storage/schema/entities/EntityTxLabelMap.js.map +1 -1
- package/out/src/storage/schema/entities/EntityUser.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityUser.js +3 -3
- package/out/src/storage/schema/entities/EntityUser.js.map +1 -1
- package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
- package/out/src/storage/schema/entities/MergeEntity.js +6 -6
- package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js +3 -3
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js +32 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +6 -6
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +3 -3
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.js +3 -3
- package/out/src/storage/schema/entities/__tests/usersTests.test.js +1 -1
- package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -1
- 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 +38 -0
- package/out/src/storage/schema/tables/TableAction.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableAction.js +3 -0
- package/out/src/storage/schema/tables/TableAction.js.map +1 -0
- package/out/src/storage/schema/tables/TableCertificate.d.ts +2 -1
- package/out/src/storage/schema/tables/TableCertificate.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableCertificateField.d.ts +1 -1
- package/out/src/storage/schema/tables/TableCertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableChainTip.d.ts +17 -0
- package/out/src/storage/schema/tables/TableChainTip.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableChainTip.js +3 -0
- package/out/src/storage/schema/tables/TableChainTip.js.map +1 -0
- package/out/src/storage/schema/tables/TableCommission.d.ts +1 -1
- package/out/src/storage/schema/tables/TableCommission.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableMonitorEvent.d.ts +1 -1
- package/out/src/storage/schema/tables/TableMonitorEvent.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableMonitorLease.d.ts +23 -0
- package/out/src/storage/schema/tables/TableMonitorLease.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableMonitorLease.js +3 -0
- package/out/src/storage/schema/tables/TableMonitorLease.js.map +1 -0
- package/out/src/storage/schema/tables/TableOutput.d.ts +10 -2
- package/out/src/storage/schema/tables/TableOutput.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableOutput.js +1 -1
- package/out/src/storage/schema/tables/TableOutput.js.map +1 -1
- package/out/src/storage/schema/tables/TableOutputBasket.d.ts +1 -1
- package/out/src/storage/schema/tables/TableOutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableOutputTag.d.ts +1 -1
- package/out/src/storage/schema/tables/TableOutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableOutputTagMap.d.ts +1 -1
- package/out/src/storage/schema/tables/TableOutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableProvenTx.d.ts +1 -1
- package/out/src/storage/schema/tables/TableProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableProvenTxReq.d.ts +24 -1
- package/out/src/storage/schema/tables/TableProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableSettings.d.ts +1 -1
- package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableSyncState.d.ts +1 -1
- package/out/src/storage/schema/tables/TableSyncState.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableTransaction.d.ts +1 -1
- package/out/src/storage/schema/tables/TableTransaction.d.ts.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/TableTransactionV7.d.ts +50 -0
- package/out/src/storage/schema/tables/TableTransactionV7.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableTransactionV7.js +3 -0
- package/out/src/storage/schema/tables/TableTransactionV7.js.map +1 -0
- package/out/src/storage/schema/tables/TableTxAudit.d.ts +26 -0
- package/out/src/storage/schema/tables/TableTxAudit.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableTxAudit.js +3 -0
- package/out/src/storage/schema/tables/TableTxAudit.js.map +1 -0
- package/out/src/storage/schema/tables/TableTxLabel.d.ts +1 -1
- package/out/src/storage/schema/tables/TableTxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableTxLabelMap.d.ts +1 -1
- package/out/src/storage/schema/tables/TableTxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableUser.d.ts +1 -1
- package/out/src/storage/schema/tables/TableUser.d.ts.map +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 +35 -0
- package/out/src/storage/schema/v7Backfill.d.ts.map +1 -0
- package/out/src/storage/schema/v7Backfill.idb.d.ts +32 -0
- package/out/src/storage/schema/v7Backfill.idb.d.ts.map +1 -0
- package/out/src/storage/schema/v7Backfill.idb.js +95 -0
- package/out/src/storage/schema/v7Backfill.idb.js.map +1 -0
- package/out/src/storage/schema/v7Backfill.js +150 -0
- package/out/src/storage/schema/v7Backfill.js.map +1 -0
- package/out/src/storage/schema/v7Backfill.knex.d.ts +32 -0
- package/out/src/storage/schema/v7Backfill.knex.d.ts.map +1 -0
- package/out/src/storage/schema/v7Backfill.knex.js +240 -0
- package/out/src/storage/schema/v7Backfill.knex.js.map +1 -0
- package/out/src/storage/schema/v7Backfill.runner.d.ts +63 -0
- package/out/src/storage/schema/v7Backfill.runner.d.ts.map +1 -0
- package/out/src/storage/schema/v7Backfill.runner.js +64 -0
- package/out/src/storage/schema/v7Backfill.runner.js.map +1 -0
- 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 +41 -0
- package/out/src/storage/schema/v7Crud.d.ts.map +1 -0
- package/out/src/storage/schema/v7Crud.js +205 -0
- package/out/src/storage/schema/v7Crud.js.map +1 -0
- 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 +27 -0
- package/out/src/storage/schema/v7Fsm.d.ts.map +1 -0
- package/out/src/storage/schema/v7Fsm.js +124 -0
- package/out/src/storage/schema/v7Fsm.js.map +1 -0
- package/out/src/storage/schema/v7MonitorLease.d.ts +57 -0
- package/out/src/storage/schema/v7MonitorLease.d.ts.map +1 -0
- package/out/src/storage/schema/v7MonitorLease.js +101 -0
- package/out/src/storage/schema/v7MonitorLease.js.map +1 -0
- 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/v7Spendability.d.ts +45 -0
- package/out/src/storage/schema/v7Spendability.d.ts.map +1 -0
- package/out/src/storage/schema/v7Spendability.js +52 -0
- package/out/src/storage/schema/v7Spendability.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/schema/v7TxAudit.d.ts +33 -0
- package/out/src/storage/schema/v7TxAudit.d.ts.map +1 -0
- package/out/src/storage/schema/v7TxAudit.js +64 -0
- package/out/src/storage/schema/v7TxAudit.js.map +1 -0
- package/out/src/storage/storageProviderHelpers.d.ts +34 -0
- package/out/src/storage/storageProviderHelpers.d.ts.map +1 -0
- package/out/src/storage/storageProviderHelpers.js +100 -0
- package/out/src/storage/storageProviderHelpers.js.map +1 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts +1 -2
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
- package/out/src/storage/sync/StorageMySQLDojoReader.js +37 -32
- package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -1
- package/out/src/utility/Format.d.ts.map +1 -1
- package/out/src/utility/Format.js +11 -9
- package/out/src/utility/Format.js.map +1 -1
- package/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -1
- package/out/src/utility/ScriptTemplateBRC29.js +2 -1
- package/out/src/utility/ScriptTemplateBRC29.js.map +1 -1
- package/out/src/utility/aggregateResults.d.ts +1 -1
- package/out/src/utility/aggregateResults.d.ts.map +1 -1
- package/out/src/utility/aggregateResults.js +2 -2
- package/out/src/utility/aggregateResults.js.map +1 -1
- package/out/src/utility/brc114ActionTimeLabels.d.ts +2 -2
- package/out/src/utility/brc114ActionTimeLabels.d.ts.map +1 -1
- package/out/src/utility/brc114ActionTimeLabels.js +16 -9
- package/out/src/utility/brc114ActionTimeLabels.js.map +1 -1
- package/out/src/utility/identityUtils.js +1 -1
- package/out/src/utility/identityUtils.js.map +1 -1
- package/out/src/utility/parseTxScriptOffsets.d.ts +4 -4
- package/out/src/utility/parseTxScriptOffsets.d.ts.map +1 -1
- package/out/src/utility/parseTxScriptOffsets.js.map +1 -1
- package/out/src/utility/stampLog.d.ts.map +1 -1
- package/out/src/utility/stampLog.js +7 -5
- package/out/src/utility/stampLog.js.map +1 -1
- package/out/src/utility/tscProofToMerklePath.d.ts.map +1 -1
- package/out/src/utility/tscProofToMerklePath.js +1 -1
- package/out/src/utility/tscProofToMerklePath.js.map +1 -1
- package/out/src/utility/utilityHelpers.buffer.d.ts +5 -3
- package/out/src/utility/utilityHelpers.buffer.d.ts.map +1 -1
- package/out/src/utility/utilityHelpers.buffer.js.map +1 -1
- package/out/src/utility/utilityHelpers.d.ts +1 -2
- package/out/src/utility/utilityHelpers.d.ts.map +1 -1
- package/out/src/utility/utilityHelpers.js +10 -10
- package/out/src/utility/utilityHelpers.js.map +1 -1
- package/out/src/utility/utilityHelpers.noBuffer.d.ts +7 -3
- package/out/src/utility/utilityHelpers.noBuffer.d.ts.map +1 -1
- package/out/src/utility/utilityHelpers.noBuffer.js +3 -3
- package/out/src/utility/utilityHelpers.noBuffer.js.map +1 -1
- package/out/src/wab-client/WABClient.d.ts +1 -1
- package/out/src/wab-client/WABClient.d.ts.map +1 -1
- package/out/src/wab-client/WABClient.js +12 -12
- package/out/src/wab-client/WABClient.js.map +1 -1
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +1 -1
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +3 -3
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +1 -1
- package/package.json +28 -21
|
@@ -10,17 +10,204 @@ const listOutputsKnex_1 = require("./methods/listOutputsKnex");
|
|
|
10
10
|
const reviewStatus_1 = require("./methods/reviewStatus");
|
|
11
11
|
const WERR_errors_1 = require("../sdk/WERR_errors");
|
|
12
12
|
const utilityHelpers_1 = require("../utility/utilityHelpers");
|
|
13
|
+
const types_1 = require("../sdk/types");
|
|
14
|
+
const transactionService_1 = require("./schema/transactionService");
|
|
13
15
|
class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
14
16
|
constructor(options) {
|
|
15
17
|
super(options);
|
|
18
|
+
this._postCutoverCache = undefined;
|
|
16
19
|
this._verifiedReadyForDatabaseAccess = false;
|
|
17
20
|
if (!options.knex)
|
|
18
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('options.knex',
|
|
21
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('options.knex', 'valid');
|
|
19
22
|
this.knex = options.knex;
|
|
20
23
|
}
|
|
24
|
+
getTransactionService() {
|
|
25
|
+
// The new-schema transaction service is only valid post-cutover. Pre-cutover,
|
|
26
|
+
// the `transactions` table is the legacy schema and queries via this service
|
|
27
|
+
// would return legacy ids that don't satisfy the `tx_audit.transactionId`
|
|
28
|
+
// FK (which targets `transactions_new`). Callers gate on `undefined` and
|
|
29
|
+
// fall back to the legacy storage path.
|
|
30
|
+
if (this._postCutoverCache !== true)
|
|
31
|
+
return undefined;
|
|
32
|
+
return new transactionService_1.TransactionService(this.knex);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Eagerly warm the `_postCutoverCache` so sync query builders such as
|
|
36
|
+
* `findOutputsQuery` can branch on cutover state without an extra await.
|
|
37
|
+
* Callers that have invoked `makeAvailable` are guaranteed the cache has
|
|
38
|
+
* been populated.
|
|
39
|
+
*/
|
|
40
|
+
async makeAvailable() {
|
|
41
|
+
const settings = await super.makeAvailable();
|
|
42
|
+
if (this._postCutoverCache === undefined) {
|
|
43
|
+
this._postCutoverCache = await this.knex.schema.hasTable('transactions_legacy');
|
|
44
|
+
}
|
|
45
|
+
return settings;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns true when the database has been through `runSchemaCutover` (i.e.
|
|
49
|
+
* `transactions_legacy` exists). Result is cached for the lifetime of this
|
|
50
|
+
* StorageKnex instance.
|
|
51
|
+
*/
|
|
52
|
+
async isPostCutover() {
|
|
53
|
+
if (this._postCutoverCache === undefined) {
|
|
54
|
+
this._postCutoverCache = await this.knex.schema.hasTable('transactions_legacy');
|
|
55
|
+
}
|
|
56
|
+
return this._postCutoverCache;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Maps legacy TransactionStatus values to their ProcessingStatus equivalents
|
|
60
|
+
* for use in `outputs JOIN transactions` WHERE clauses post-cutover.
|
|
61
|
+
*/
|
|
62
|
+
legacyStatiToProcessing(stati) {
|
|
63
|
+
const result = new Set();
|
|
64
|
+
for (const s of stati) {
|
|
65
|
+
result.add((0, types_1.transactionStatusToProcessing)(s));
|
|
66
|
+
if (s === 'unproven') {
|
|
67
|
+
// 'sent','seen','seen_multi','unconfirmed' all map to legacy 'unproven'
|
|
68
|
+
result.add('sent');
|
|
69
|
+
result.add('seen');
|
|
70
|
+
result.add('seen_multi');
|
|
71
|
+
result.add('unconfirmed');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return [...result];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns the canonical name of the `proven_txs` table — `proven_txs_legacy`
|
|
78
|
+
* post-cutover, `proven_txs` otherwise.
|
|
79
|
+
*
|
|
80
|
+
* Public so that helper modules (reviewStatus, purgeData) can resolve the
|
|
81
|
+
* correct table name without duplicating the post-cutover detection logic.
|
|
82
|
+
*/
|
|
83
|
+
async provenTxsTableName() {
|
|
84
|
+
return (await this.isPostCutover()) ? 'proven_txs_legacy' : 'proven_txs';
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns the canonical name of the `proven_tx_reqs` table —
|
|
88
|
+
* `proven_tx_reqs_legacy` post-cutover, `proven_tx_reqs` otherwise.
|
|
89
|
+
*
|
|
90
|
+
* Public so that helper modules (reviewStatus, purgeData) can resolve the
|
|
91
|
+
* correct table name without duplicating the post-cutover detection logic.
|
|
92
|
+
*/
|
|
93
|
+
async provenTxReqsTableName() {
|
|
94
|
+
return (await this.isPostCutover()) ? 'proven_tx_reqs_legacy' : 'proven_tx_reqs';
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Insert a legacy-shaped transaction row into the correct table:
|
|
98
|
+
* - Post-cutover: `transactions_legacy` (the renamed legacy schema table)
|
|
99
|
+
* - Pre-cutover: `transactions` (the standard table, same behaviour as `insertTransaction`)
|
|
100
|
+
*
|
|
101
|
+
* This allows `createAction` to store unsigned rows (txid unknown) without
|
|
102
|
+
* conflicting with the new `transactions` table's NOT NULL txid constraint.
|
|
103
|
+
* A new `transactions` row + `actions` row are created later by `processAction`
|
|
104
|
+
* once the real txid is known.
|
|
105
|
+
*
|
|
106
|
+
* On SQLite, foreign key enforcement is temporarily disabled while inserting
|
|
107
|
+
* into `transactions_legacy` because the referenced `proven_txs` table was
|
|
108
|
+
* renamed to `proven_txs_legacy` during the the schema cutover. Since `provenTxId`
|
|
109
|
+
* is always NULL for new unsigned transactions this is semantically safe.
|
|
110
|
+
*/
|
|
111
|
+
async insertLegacyTransaction(tx, trx) {
|
|
112
|
+
const e = await this.validateEntityForInsert(tx, trx);
|
|
113
|
+
if (e.transactionId === 0)
|
|
114
|
+
delete e.transactionId;
|
|
115
|
+
const hasLegacyTable = await this.knex.schema.hasTable('transactions_legacy');
|
|
116
|
+
const tableName = hasLegacyTable ? 'transactions_legacy' : 'transactions';
|
|
117
|
+
const isSqlite = this.dbtype === 'SQLite';
|
|
118
|
+
// On SQLite post-cutover the `transactions_legacy` FK to `proven_txs` is dangling
|
|
119
|
+
// (proven_txs was renamed to proven_txs_legacy). Temporarily disable FK checks for
|
|
120
|
+
// this insert since provenTxId is always NULL for a brand-new unsigned transaction.
|
|
121
|
+
if (isSqlite && hasLegacyTable)
|
|
122
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
123
|
+
try {
|
|
124
|
+
const [id] = await this.toDb(trx)(tableName).insert(e);
|
|
125
|
+
tx.transactionId = id;
|
|
126
|
+
return tx.transactionId;
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
if (isSqlite && hasLegacyTable)
|
|
130
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Insert a `tx_labels_map` row for a legacy transaction that does not yet
|
|
135
|
+
* have a `actions.actionId`. On post-cutover SQLite, temporarily disables
|
|
136
|
+
* FK checks so that the legacy transactionId (which is not yet an actionId)
|
|
137
|
+
* can be written. processAction will repoint it via repointLabelsToActionId.
|
|
138
|
+
*
|
|
139
|
+
* Note: bypasses `validateEntityForInsert` (and therefore `verifyReadyForDatabaseAccess`
|
|
140
|
+
* which would re-enable FK checks) to ensure the PRAGMA=OFF persists across
|
|
141
|
+
* the insert statement.
|
|
142
|
+
*/
|
|
143
|
+
async insertLegacyTxLabelMap(labelMap, trx) {
|
|
144
|
+
const isSqlite = this.dbtype === 'SQLite';
|
|
145
|
+
const hasLegacyTable = isSqlite ? await this.knex.schema.hasTable('transactions_legacy') : false;
|
|
146
|
+
if (!isSqlite || !hasLegacyTable) {
|
|
147
|
+
// Pre-cutover or non-SQLite: standard insert is safe (no dangling FK issue).
|
|
148
|
+
await this.insertTxLabelMap(labelMap, trx);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
// Post-cutover SQLite: tx_labels_map.transactionId FK now points to actions.actionId.
|
|
152
|
+
// We are writing a legacyTransactionId (no corresponding actions row yet).
|
|
153
|
+
// Temporarily disable FK checks for this single insert.
|
|
154
|
+
const now = new Date();
|
|
155
|
+
const e = {
|
|
156
|
+
created_at: now,
|
|
157
|
+
updated_at: now,
|
|
158
|
+
txLabelId: labelMap.txLabelId,
|
|
159
|
+
transactionId: labelMap.transactionId,
|
|
160
|
+
isDeleted: labelMap.isDeleted ? 1 : 0
|
|
161
|
+
};
|
|
162
|
+
// Use the raw knex handle (not toDb(trx)) to send the PRAGMA on the same connection.
|
|
163
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
164
|
+
try {
|
|
165
|
+
await this.knex('tx_labels_map').insert(e);
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
21
171
|
async readSettings() {
|
|
22
172
|
return this.validateEntity((0, utilityHelpers_1.verifyOne)(await this.toDb(undefined)('settings')));
|
|
23
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Synthesise a `ProvenOrRawTx` from a `TableTransactionNew` row.
|
|
176
|
+
*
|
|
177
|
+
* - If the new schema row carries a `merklePath` (i.e. processing is `proven`), build
|
|
178
|
+
* a `TableProvenTx`-shaped object so the BEEF assembly code can extract the
|
|
179
|
+
* merkle path and merge it into the Beef without hitting the legacy tables.
|
|
180
|
+
* - If the new schema row only has `rawTx` (broadcast/queued state), return it as the
|
|
181
|
+
* raw-tx path.
|
|
182
|
+
* - Returns `null` when the new schema row has neither rawTx nor merklePath.
|
|
183
|
+
*/
|
|
184
|
+
newTxToProvenOrRawTx(row, txid) {
|
|
185
|
+
var _a, _b, _c, _d;
|
|
186
|
+
// Only use the new-schema row as the primary source when it carries a *non-empty*
|
|
187
|
+
// merklePath and a rawTx — both are required for `handleProvenTxBranch` to assemble
|
|
188
|
+
// a valid BEEF. An empty merklePath (e.g. a backfill race or a req whose proof was
|
|
189
|
+
// never stored) must fall through to the legacy `proven_txs_legacy` path.
|
|
190
|
+
// Raw-tx-only rows (no merklePath) are likewise forwarded to the legacy path so
|
|
191
|
+
// that the legacy `inputBEEF` column is available for recursive BEEF assembly.
|
|
192
|
+
if (row.merklePath != null && row.merklePath.length > 0 && row.rawTx != null && row.rawTx.length > 0) {
|
|
193
|
+
// Full proof available — synthesise TableProvenTx shape
|
|
194
|
+
const proven = {
|
|
195
|
+
created_at: row.created_at,
|
|
196
|
+
updated_at: row.updated_at,
|
|
197
|
+
provenTxId: row.transactionId,
|
|
198
|
+
txid,
|
|
199
|
+
height: (_a = row.height) !== null && _a !== void 0 ? _a : 0,
|
|
200
|
+
index: (_b = row.merkleIndex) !== null && _b !== void 0 ? _b : 0,
|
|
201
|
+
merklePath: row.merklePath,
|
|
202
|
+
rawTx: row.rawTx,
|
|
203
|
+
blockHash: (_c = row.blockHash) !== null && _c !== void 0 ? _c : '',
|
|
204
|
+
merkleRoot: (_d = row.merkleRoot) !== null && _d !== void 0 ? _d : ''
|
|
205
|
+
};
|
|
206
|
+
return { proven, rawTx: undefined, inputBEEF: undefined };
|
|
207
|
+
}
|
|
208
|
+
// No complete proof in new-schema row — let the caller fall through to legacy tables.
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
24
211
|
async getProvenOrRawTx(txid, trx) {
|
|
25
212
|
const k = this.toDb(trx);
|
|
26
213
|
const r = {
|
|
@@ -28,9 +215,29 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
28
215
|
rawTx: undefined,
|
|
29
216
|
inputBEEF: undefined
|
|
30
217
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
218
|
+
// Post-cutover: try new `transactions` table first. The new schema row is the single
|
|
219
|
+
// source of truth for rawTx and merklePath; legacy tables are read-only
|
|
220
|
+
// archives after cutover.
|
|
221
|
+
if (await this.isPostCutover()) {
|
|
222
|
+
try {
|
|
223
|
+
const txSvc = this.getTransactionService();
|
|
224
|
+
if (txSvc != null) {
|
|
225
|
+
const newTx = await txSvc.findByTxid(txid);
|
|
226
|
+
if (newTx != null) {
|
|
227
|
+
const newTxResult = this.newTxToProvenOrRawTx(newTx, txid);
|
|
228
|
+
if (newTxResult != null)
|
|
229
|
+
return newTxResult;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch (_a) {
|
|
234
|
+
// new table lookup failed (e.g. table not yet available) — fall through to legacy
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
r.proven = (0, utilityHelpers_1.verifyOneOrNone)(await this.findProvenTxs({ partial: { txid } }));
|
|
238
|
+
if (r.proven == null) {
|
|
239
|
+
const reqTable = await this.provenTxReqsTableName();
|
|
240
|
+
const reqRawTx = (0, utilityHelpers_1.verifyOneOrNone)(await k(reqTable)
|
|
34
241
|
.where('txid', txid)
|
|
35
242
|
.whereIn('status', ['unsent', 'unmined', 'unconfirmed', 'sending', 'nosend', 'completed'])
|
|
36
243
|
.select('rawTx', 'inputBEEF'));
|
|
@@ -46,38 +253,50 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
46
253
|
return `substring(${source} from ${fromOffset} for ${forLength})`;
|
|
47
254
|
return `substr(${source}, ${fromOffset}, ${forLength})`;
|
|
48
255
|
}
|
|
256
|
+
normaliseKnexRawResult(rs) {
|
|
257
|
+
if (this.dbtype === 'MySQL')
|
|
258
|
+
return rs[0];
|
|
259
|
+
return rs;
|
|
260
|
+
}
|
|
261
|
+
async getRawTxSlice(txid, offset, length, trx) {
|
|
262
|
+
// Post-cutover: try new transactions table first — the new table is the canonical store
|
|
263
|
+
// for rawTx after the cutover. Apply the slice in JS to avoid raw SQL
|
|
264
|
+
// column naming differences between the two schemas.
|
|
265
|
+
if (await this.isPostCutover()) {
|
|
266
|
+
try {
|
|
267
|
+
const txSvc = this.getTransactionService();
|
|
268
|
+
if (txSvc != null) {
|
|
269
|
+
const newTx = await txSvc.findByTxid(txid);
|
|
270
|
+
if ((newTx === null || newTx === void 0 ? void 0 : newTx.rawTx) != null) {
|
|
271
|
+
return newTx.rawTx.slice(offset, offset + length);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
catch (_a) {
|
|
276
|
+
// new table lookup failed — fall through to legacy tables
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const sub = this.dbTypeSubstring('rawTx', offset + 1, length);
|
|
280
|
+
const provenTable = await this.provenTxsTableName();
|
|
281
|
+
const reqTable = await this.provenTxReqsTableName();
|
|
282
|
+
let rs = await this.toDb(trx).raw(`select ${sub} as rawTx from ${provenTable} where txid = '${txid}'`);
|
|
283
|
+
const proven = (0, utilityHelpers_1.verifyOneOrNone)(this.normaliseKnexRawResult(rs));
|
|
284
|
+
if ((proven === null || proven === void 0 ? void 0 : proven.rawTx) != null)
|
|
285
|
+
return Array.from(proven.rawTx);
|
|
286
|
+
rs = await this.toDb(trx).raw(`select ${sub} as rawTx from ${reqTable} where txid = '${txid}' and status in ('unsent', 'nosend', 'sending', 'unmined', 'completed', 'unfail')`);
|
|
287
|
+
const req = (0, utilityHelpers_1.verifyOneOrNone)(this.normaliseKnexRawResult(rs));
|
|
288
|
+
return (req === null || req === void 0 ? void 0 : req.rawTx) != null ? Array.from(req.rawTx) : undefined;
|
|
289
|
+
}
|
|
49
290
|
async getRawTxOfKnownValidTransaction(txid, offset, length, trx) {
|
|
50
291
|
if (!txid)
|
|
51
292
|
return undefined;
|
|
52
293
|
if (!this.isAvailable())
|
|
53
294
|
await this.makeAvailable();
|
|
54
|
-
let rawTx = undefined;
|
|
55
295
|
if (Number.isInteger(offset) && Number.isInteger(length)) {
|
|
56
|
-
|
|
57
|
-
if (this.dbtype === 'MySQL')
|
|
58
|
-
rs = rs[0];
|
|
59
|
-
const r = (0, utilityHelpers_1.verifyOneOrNone)(rs);
|
|
60
|
-
if (r && r.rawTx) {
|
|
61
|
-
rawTx = Array.from(r.rawTx);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
let rs = await this.toDb(trx).raw(`select ${this.dbTypeSubstring('rawTx', offset + 1, length)} as rawTx from proven_tx_reqs where txid = '${txid}' and status in ('unsent', 'nosend', 'sending', 'unmined', 'completed', 'unfail')`);
|
|
65
|
-
if (this.dbtype === 'MySQL')
|
|
66
|
-
rs = rs[0];
|
|
67
|
-
const r = (0, utilityHelpers_1.verifyOneOrNone)(rs);
|
|
68
|
-
if (r && r.rawTx) {
|
|
69
|
-
rawTx = Array.from(r.rawTx);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
const r = await this.getProvenOrRawTx(txid, trx);
|
|
75
|
-
if (r.proven)
|
|
76
|
-
rawTx = r.proven.rawTx;
|
|
77
|
-
else
|
|
78
|
-
rawTx = r.rawTx;
|
|
296
|
+
return await this.getRawTxSlice(txid, offset, length, trx);
|
|
79
297
|
}
|
|
80
|
-
|
|
298
|
+
const r = await this.getProvenOrRawTx(txid, trx);
|
|
299
|
+
return r.proven != null ? r.proven.rawTx : r.rawTx;
|
|
81
300
|
}
|
|
82
301
|
getProvenTxsForUserQuery(args) {
|
|
83
302
|
const k = this.toDb(args.trx);
|
|
@@ -87,15 +306,34 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
87
306
|
.from('transactions')
|
|
88
307
|
.whereRaw(`proven_txs.provenTxId = transactions.provenTxId and transactions.userId = ${args.userId}`));
|
|
89
308
|
});
|
|
90
|
-
if (args.paged) {
|
|
309
|
+
if (args.paged != null) {
|
|
91
310
|
q = q.limit(args.paged.limit);
|
|
92
311
|
q = q.offset(args.paged.offset || 0);
|
|
93
312
|
}
|
|
94
|
-
if (args.since)
|
|
313
|
+
if (args.since != null)
|
|
95
314
|
q = q.where('updated_at', '>=', this.validateDateForWhere(args.since));
|
|
96
315
|
return q;
|
|
97
316
|
}
|
|
98
317
|
async getProvenTxsForUser(args) {
|
|
318
|
+
const postCutover = await this.isPostCutover();
|
|
319
|
+
if (postCutover) {
|
|
320
|
+
// Post-cutover: proven_txs → proven_txs_legacy; transactions → transactions_legacy
|
|
321
|
+
const k = this.toDb(args.trx);
|
|
322
|
+
let q = k('proven_txs_legacy').where(function () {
|
|
323
|
+
this.whereExists(k
|
|
324
|
+
.select('*')
|
|
325
|
+
.from('transactions_legacy')
|
|
326
|
+
.whereRaw(`proven_txs_legacy.provenTxId = transactions_legacy.provenTxId and transactions_legacy.userId = ${args.userId}`));
|
|
327
|
+
});
|
|
328
|
+
if (args.paged != null) {
|
|
329
|
+
q = q.limit(args.paged.limit);
|
|
330
|
+
q = q.offset(args.paged.offset || 0);
|
|
331
|
+
}
|
|
332
|
+
if (args.since != null)
|
|
333
|
+
q = q.where('updated_at', '>=', this.validateDateForWhere(args.since));
|
|
334
|
+
const rs = await q;
|
|
335
|
+
return this.validateEntities(rs);
|
|
336
|
+
}
|
|
99
337
|
const q = this.getProvenTxsForUserQuery(args);
|
|
100
338
|
const rs = await q;
|
|
101
339
|
return this.validateEntities(rs);
|
|
@@ -108,15 +346,34 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
108
346
|
.from('transactions')
|
|
109
347
|
.whereRaw(`proven_tx_reqs.txid = transactions.txid and transactions.userId = ${args.userId}`));
|
|
110
348
|
});
|
|
111
|
-
if (args.paged) {
|
|
349
|
+
if (args.paged != null) {
|
|
112
350
|
q = q.limit(args.paged.limit);
|
|
113
351
|
q = q.offset(args.paged.offset || 0);
|
|
114
352
|
}
|
|
115
|
-
if (args.since)
|
|
353
|
+
if (args.since != null)
|
|
116
354
|
q = q.where('updated_at', '>=', this.validateDateForWhere(args.since));
|
|
117
355
|
return q;
|
|
118
356
|
}
|
|
119
357
|
async getProvenTxReqsForUser(args) {
|
|
358
|
+
const postCutover = await this.isPostCutover();
|
|
359
|
+
if (postCutover) {
|
|
360
|
+
// Post-cutover: proven_tx_reqs → proven_tx_reqs_legacy; transactions → transactions_legacy
|
|
361
|
+
const k = this.toDb(args.trx);
|
|
362
|
+
let q = k('proven_tx_reqs_legacy').where(function () {
|
|
363
|
+
this.whereExists(k
|
|
364
|
+
.select('*')
|
|
365
|
+
.from('transactions_legacy')
|
|
366
|
+
.whereRaw(`proven_tx_reqs_legacy.txid = transactions_legacy.txid and transactions_legacy.userId = ${args.userId}`));
|
|
367
|
+
});
|
|
368
|
+
if (args.paged != null) {
|
|
369
|
+
q = q.limit(args.paged.limit);
|
|
370
|
+
q = q.offset(args.paged.offset || 0);
|
|
371
|
+
}
|
|
372
|
+
if (args.since != null)
|
|
373
|
+
q = q.where('updated_at', '>=', this.validateDateForWhere(args.since));
|
|
374
|
+
const rs = await q;
|
|
375
|
+
return this.validateEntities(rs, undefined, ['notified']);
|
|
376
|
+
}
|
|
120
377
|
const q = this.getProvenTxReqsForUserQuery(args);
|
|
121
378
|
const rs = await q;
|
|
122
379
|
return this.validateEntities(rs, undefined, ['notified']);
|
|
@@ -127,9 +384,9 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
127
384
|
.select('*')
|
|
128
385
|
.from('tx_labels')
|
|
129
386
|
.whereRaw(`tx_labels.txLabelId = tx_labels_map.txLabelId and tx_labels.userId = ${args.userId}`));
|
|
130
|
-
if (args.since)
|
|
387
|
+
if (args.since != null)
|
|
131
388
|
q = q.where('updated_at', '>=', this.validateDateForWhere(args.since));
|
|
132
|
-
if (args.paged) {
|
|
389
|
+
if (args.paged != null) {
|
|
133
390
|
q = q.limit(args.paged.limit);
|
|
134
391
|
q = q.offset(args.paged.offset || 0);
|
|
135
392
|
}
|
|
@@ -146,9 +403,9 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
146
403
|
.select('*')
|
|
147
404
|
.from('output_tags')
|
|
148
405
|
.whereRaw(`output_tags.outputTagId = output_tags_map.outputTagId and output_tags.userId = ${args.userId}`));
|
|
149
|
-
if (args.since)
|
|
406
|
+
if (args.since != null)
|
|
150
407
|
q = q.where('updated_at', '>=', this.validateDateForWhere(args.since));
|
|
151
|
-
if (args.paged) {
|
|
408
|
+
if (args.paged != null) {
|
|
152
409
|
q = q.limit(args.paged.limit);
|
|
153
410
|
q = q.offset(args.paged.offset || 0);
|
|
154
411
|
}
|
|
@@ -173,7 +430,8 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
173
430
|
const e = await this.validateEntityForInsert(tx, trx);
|
|
174
431
|
if (e.provenTxId === 0)
|
|
175
432
|
delete e.provenTxId;
|
|
176
|
-
const
|
|
433
|
+
const tableName = await this.provenTxsTableName();
|
|
434
|
+
const [id] = await this.toDb(trx)(tableName).insert(e);
|
|
177
435
|
tx.provenTxId = id;
|
|
178
436
|
return tx.provenTxId;
|
|
179
437
|
}
|
|
@@ -181,7 +439,10 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
181
439
|
const e = await this.validateEntityForInsert(tx, trx);
|
|
182
440
|
if (e.provenTxReqId === 0)
|
|
183
441
|
delete e.provenTxReqId;
|
|
184
|
-
|
|
442
|
+
// Post-cutover: route to proven_tx_reqs_legacy.
|
|
443
|
+
// FK bypass is handled by the caller (disableForeignKeys before any transaction).
|
|
444
|
+
const reqTable = await this.provenTxReqsTableName();
|
|
445
|
+
const [id] = await this.toDb(trx)(reqTable).insert(e);
|
|
185
446
|
tx.provenTxReqId = id;
|
|
186
447
|
return tx.provenTxReqId;
|
|
187
448
|
}
|
|
@@ -203,7 +464,6 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
203
464
|
const e = await this.validateEntityForInsert(certificate, trx, undefined, ['isDeleted']);
|
|
204
465
|
if (e.certificateId === 0)
|
|
205
466
|
delete e.certificateId;
|
|
206
|
-
const logger = e.logger;
|
|
207
467
|
if (e.logger)
|
|
208
468
|
delete e.logger;
|
|
209
469
|
const fields = e.fields;
|
|
@@ -236,6 +496,28 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
236
496
|
const e = await this.validateEntityForInsert(tx, trx);
|
|
237
497
|
if (e.transactionId === 0)
|
|
238
498
|
delete e.transactionId;
|
|
499
|
+
// Post-cutover the canonical `transactions` table is the new schema which
|
|
500
|
+
// does not carry legacy columns (description, status, satoshis, version...).
|
|
501
|
+
// Legacy-shaped insertions belong in `transactions_legacy`. We route there
|
|
502
|
+
// automatically so existing callers that still speak the legacy shape keep
|
|
503
|
+
// working without a code change at every call site. FK enforcement is
|
|
504
|
+
// bypassed because the renamed legacy table still references the renamed
|
|
505
|
+
// `proven_txs_legacy` via its original `proven_txs` FK column name.
|
|
506
|
+
const isSqlite = this.dbtype === 'SQLite';
|
|
507
|
+
const postCutover = isSqlite ? await this.isPostCutover() : false;
|
|
508
|
+
if (postCutover) {
|
|
509
|
+
if (isSqlite)
|
|
510
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
511
|
+
try {
|
|
512
|
+
const [id] = await this.toDb(trx)('transactions_legacy').insert(e);
|
|
513
|
+
tx.transactionId = id;
|
|
514
|
+
return tx.transactionId;
|
|
515
|
+
}
|
|
516
|
+
finally {
|
|
517
|
+
if (isSqlite)
|
|
518
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
519
|
+
}
|
|
520
|
+
}
|
|
239
521
|
const [id] = await this.toDb(trx)('transactions').insert(e);
|
|
240
522
|
tx.transactionId = id;
|
|
241
523
|
return tx.transactionId;
|
|
@@ -244,21 +526,42 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
244
526
|
const e = await this.validateEntityForInsert(commission, trx);
|
|
245
527
|
if (e.commissionId === 0)
|
|
246
528
|
delete e.commissionId;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
529
|
+
// Post-cutover bridge-period: commissions.transactionId FKs new transactions.
|
|
530
|
+
// During createAction the transactionId references transactions_legacy, so bypass FK.
|
|
531
|
+
const isSqlite = this.dbtype === 'SQLite';
|
|
532
|
+
const postCutover = isSqlite ? await this.isPostCutover() : false;
|
|
533
|
+
if (postCutover)
|
|
534
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
535
|
+
try {
|
|
536
|
+
const [id] = await this.toDb(trx)('commissions').insert(e);
|
|
537
|
+
commission.commissionId = id;
|
|
538
|
+
return commission.commissionId;
|
|
539
|
+
}
|
|
540
|
+
finally {
|
|
541
|
+
if (postCutover)
|
|
542
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
543
|
+
}
|
|
250
544
|
}
|
|
251
545
|
async insertOutput(output, trx) {
|
|
546
|
+
const e = await this.validateEntityForInsert(output, trx);
|
|
547
|
+
if (e.outputId === 0)
|
|
548
|
+
delete e.outputId;
|
|
549
|
+
// Post-cutover bridge-period: outputs.transactionId FKs new transactions,
|
|
550
|
+
// but new unsigned outputs reference transactions_legacy (bridge-period rows).
|
|
551
|
+
// Temporarily disable FK checks on SQLite. Safe because once processAction
|
|
552
|
+
// runs, spentBy and transactionId are remapped to real new-schema IDs.
|
|
553
|
+
const isSqlite = this.dbtype === 'SQLite';
|
|
554
|
+
const postCutover = isSqlite ? await this.isPostCutover() : false;
|
|
555
|
+
if (postCutover)
|
|
556
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
252
557
|
try {
|
|
253
|
-
const e = await this.validateEntityForInsert(output, trx);
|
|
254
|
-
if (e.outputId === 0)
|
|
255
|
-
delete e.outputId;
|
|
256
558
|
const [id] = await this.toDb(trx)('outputs').insert(e);
|
|
257
559
|
output.outputId = id;
|
|
258
560
|
return output.outputId;
|
|
259
561
|
}
|
|
260
|
-
|
|
261
|
-
|
|
562
|
+
finally {
|
|
563
|
+
if (postCutover)
|
|
564
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
262
565
|
}
|
|
263
566
|
}
|
|
264
567
|
async insertOutputTag(tag, trx) {
|
|
@@ -271,7 +574,7 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
271
574
|
}
|
|
272
575
|
async insertOutputTagMap(tagMap, trx) {
|
|
273
576
|
const e = await this.validateEntityForInsert(tagMap, trx, undefined, ['isDeleted']);
|
|
274
|
-
|
|
577
|
+
await this.toDb(trx)('output_tags_map').insert(e);
|
|
275
578
|
}
|
|
276
579
|
async insertTxLabel(label, trx) {
|
|
277
580
|
const e = await this.validateEntityForInsert(label, trx, undefined, ['isDeleted']);
|
|
@@ -283,7 +586,23 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
283
586
|
}
|
|
284
587
|
async insertTxLabelMap(labelMap, trx) {
|
|
285
588
|
const e = await this.validateEntityForInsert(labelMap, trx, undefined, ['isDeleted']);
|
|
286
|
-
|
|
589
|
+
// Post-cutover SQLite: tx_labels_map.transactionId references actions.actionId
|
|
590
|
+
// (rebuilt during schema cutover). Sync paths that import legacy rows still
|
|
591
|
+
// carry the legacy transactionId until repointLabelsToActionId remaps them.
|
|
592
|
+
// Temporarily disable FK checks so the import does not fail.
|
|
593
|
+
const isSqlite = this.dbtype === 'SQLite';
|
|
594
|
+
const postCutover = isSqlite ? await this.isPostCutover() : false;
|
|
595
|
+
if (postCutover) {
|
|
596
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
597
|
+
try {
|
|
598
|
+
await this.toDb(trx)('tx_labels_map').insert(e);
|
|
599
|
+
}
|
|
600
|
+
finally {
|
|
601
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
602
|
+
}
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
await this.toDb(trx)('tx_labels_map').insert(e);
|
|
287
606
|
}
|
|
288
607
|
async insertMonitorEvent(event, trx) {
|
|
289
608
|
const e = await this.validateEntityForInsert(event, trx);
|
|
@@ -315,9 +634,22 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
315
634
|
}
|
|
316
635
|
async updateCommission(id, update, trx) {
|
|
317
636
|
await this.verifyReadyForDatabaseAccess(trx);
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
637
|
+
// Post-cutover SQLite: commissions.transactionId FK references the new
|
|
638
|
+
// schema `transactions` table. Legacy callers carry transactionId values
|
|
639
|
+
// that still point at transactions_legacy. Bypass FK so the update lands.
|
|
640
|
+
const isSqlite = this.dbtype === 'SQLite';
|
|
641
|
+
const postCutover = isSqlite ? await this.isPostCutover() : false;
|
|
642
|
+
if (postCutover)
|
|
643
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
644
|
+
try {
|
|
645
|
+
return await this.toDb(trx)('commissions')
|
|
646
|
+
.where({ commissionId: id })
|
|
647
|
+
.update(this.validatePartialForUpdate(update));
|
|
648
|
+
}
|
|
649
|
+
finally {
|
|
650
|
+
if (postCutover)
|
|
651
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
652
|
+
}
|
|
321
653
|
}
|
|
322
654
|
async updateOutputBasket(id, update, trx) {
|
|
323
655
|
await this.verifyReadyForDatabaseAccess(trx);
|
|
@@ -345,14 +677,15 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
345
677
|
}
|
|
346
678
|
async updateProvenTxReq(id, update, trx) {
|
|
347
679
|
await this.verifyReadyForDatabaseAccess(trx);
|
|
680
|
+
const reqTable = await this.provenTxReqsTableName();
|
|
348
681
|
let r;
|
|
349
682
|
if (Array.isArray(id)) {
|
|
350
|
-
r = await this.toDb(trx)(
|
|
683
|
+
r = await this.toDb(trx)(reqTable)
|
|
351
684
|
.whereIn('provenTxReqId', id)
|
|
352
685
|
.update(this.validatePartialForUpdate(update));
|
|
353
686
|
}
|
|
354
687
|
else if (Number.isInteger(id)) {
|
|
355
|
-
r = await this.toDb(trx)(
|
|
688
|
+
r = await this.toDb(trx)(reqTable)
|
|
356
689
|
.where({ provenTxReqId: id })
|
|
357
690
|
.update(this.validatePartialForUpdate(update));
|
|
358
691
|
}
|
|
@@ -363,7 +696,8 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
363
696
|
}
|
|
364
697
|
async updateProvenTx(id, update, trx) {
|
|
365
698
|
await this.verifyReadyForDatabaseAccess(trx);
|
|
366
|
-
|
|
699
|
+
const tableName = await this.provenTxsTableName();
|
|
700
|
+
return await this.toDb(trx)(tableName)
|
|
367
701
|
.where({ provenTxId: id })
|
|
368
702
|
.update(this.validatePartialForUpdate(update));
|
|
369
703
|
}
|
|
@@ -375,21 +709,36 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
375
709
|
}
|
|
376
710
|
async updateTransaction(id, update, trx) {
|
|
377
711
|
await this.verifyReadyForDatabaseAccess(trx);
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
712
|
+
// Post-cutover the canonical `transactions` table is the new schema which
|
|
713
|
+
// lacks legacy columns (userId, status, description, satoshis, version, ...).
|
|
714
|
+
// Legacy-shaped updates belong in `transactions_legacy`, matching the
|
|
715
|
+
// routing performed by `insertTransaction`.
|
|
716
|
+
const isSqlite = this.dbtype === 'SQLite';
|
|
717
|
+
const postCutover = isSqlite ? await this.isPostCutover() : false;
|
|
718
|
+
const tableName = postCutover ? 'transactions_legacy' : 'transactions';
|
|
719
|
+
if (postCutover && isSqlite)
|
|
720
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
721
|
+
try {
|
|
722
|
+
let r;
|
|
723
|
+
if (Array.isArray(id)) {
|
|
724
|
+
r = await this.toDb(trx)(tableName)
|
|
725
|
+
.whereIn('transactionId', id)
|
|
726
|
+
.update(this.validatePartialForUpdate(update));
|
|
727
|
+
}
|
|
728
|
+
else if (Number.isInteger(id)) {
|
|
729
|
+
r = await this.toDb(trx)(tableName)
|
|
730
|
+
.where({ transactionId: id })
|
|
731
|
+
.update(this.validatePartialForUpdate(update));
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('id', 'transactionId or array of transactionId');
|
|
735
|
+
}
|
|
736
|
+
return r;
|
|
388
737
|
}
|
|
389
|
-
|
|
390
|
-
|
|
738
|
+
finally {
|
|
739
|
+
if (postCutover && isSqlite)
|
|
740
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
391
741
|
}
|
|
392
|
-
return r;
|
|
393
742
|
}
|
|
394
743
|
async updateTxLabelMap(transactionId, txLabelId, update, trx) {
|
|
395
744
|
await this.verifyReadyForDatabaseAccess(trx);
|
|
@@ -414,10 +763,10 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
414
763
|
.update(this.validatePartialForUpdate(update));
|
|
415
764
|
}
|
|
416
765
|
setupQuery(table, args) {
|
|
417
|
-
|
|
766
|
+
const q = this.toDb(args.trx)(table);
|
|
418
767
|
if (args.partial && Object.keys(args.partial).length > 0)
|
|
419
768
|
q.where(args.partial);
|
|
420
|
-
if (args.since)
|
|
769
|
+
if (args.since != null)
|
|
421
770
|
q.where('updated_at', '>=', this.validateDateForWhere(args.since));
|
|
422
771
|
if (args.orderDescending) {
|
|
423
772
|
let sortColumn = '';
|
|
@@ -438,15 +787,18 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
438
787
|
sortColumn = 'outputTagId';
|
|
439
788
|
break;
|
|
440
789
|
case 'proven_tx_reqs':
|
|
790
|
+
case 'proven_tx_reqs_legacy':
|
|
441
791
|
sortColumn = 'provenTxReqId';
|
|
442
792
|
break;
|
|
443
793
|
case 'proven_txs':
|
|
794
|
+
case 'proven_txs_legacy':
|
|
444
795
|
sortColumn = 'provenTxId';
|
|
445
796
|
break;
|
|
446
797
|
case 'sync_states':
|
|
447
798
|
sortColumn = 'syncStateId';
|
|
448
799
|
break;
|
|
449
800
|
case 'transactions':
|
|
801
|
+
case 'transactions_legacy':
|
|
450
802
|
sortColumn = 'transactionId';
|
|
451
803
|
break;
|
|
452
804
|
case 'tx_labels':
|
|
@@ -465,7 +817,7 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
465
817
|
q.orderBy(sortColumn, 'desc');
|
|
466
818
|
}
|
|
467
819
|
}
|
|
468
|
-
if (args.paged) {
|
|
820
|
+
if (args.paged != null) {
|
|
469
821
|
q.limit(args.paged.limit);
|
|
470
822
|
q.offset(args.paged.offset || 0);
|
|
471
823
|
}
|
|
@@ -476,26 +828,40 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
476
828
|
}
|
|
477
829
|
findCertificatesQuery(args) {
|
|
478
830
|
const q = this.setupQuery('certificates', args);
|
|
479
|
-
if (args.certifiers && args.certifiers.length > 0)
|
|
831
|
+
if ((args.certifiers != null) && args.certifiers.length > 0)
|
|
480
832
|
q.whereIn('certifier', args.certifiers);
|
|
481
|
-
if (args.types && args.types.length > 0)
|
|
833
|
+
if ((args.types != null) && args.types.length > 0)
|
|
482
834
|
q.whereIn('type', args.types);
|
|
483
835
|
return q;
|
|
484
836
|
}
|
|
485
837
|
findCommissionsQuery(args) {
|
|
486
|
-
if (args.partial.lockingScript)
|
|
487
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('partial.lockingScript',
|
|
838
|
+
if (args.partial.lockingScript != null) {
|
|
839
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('partial.lockingScript', 'undefined. Commissions may not be found by lockingScript value.');
|
|
840
|
+
}
|
|
488
841
|
return this.setupQuery('commissions', args);
|
|
489
842
|
}
|
|
490
843
|
findOutputBasketsQuery(args) {
|
|
491
844
|
return this.setupQuery('output_baskets', args);
|
|
492
845
|
}
|
|
493
846
|
findOutputsQuery(args, count) {
|
|
494
|
-
if (args.partial.lockingScript)
|
|
495
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.lockingScript',
|
|
847
|
+
if (args.partial.lockingScript != null) {
|
|
848
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.lockingScript', 'undefined. Outputs may not be found by lockingScript value.');
|
|
849
|
+
}
|
|
496
850
|
const q = this.setupQuery('outputs', args);
|
|
497
|
-
if (args.txStatus && args.txStatus.length > 0) {
|
|
498
|
-
|
|
851
|
+
if ((args.txStatus != null) && args.txStatus.length > 0) {
|
|
852
|
+
// Post-cutover the `transactions` table carries `processing`
|
|
853
|
+
// (ProcessingStatus), not the legacy `status` column. We translate
|
|
854
|
+
// the requested legacy status set to its ProcessingStatus equivalents
|
|
855
|
+
// when the cutover has been applied; pre-cutover the original `status`
|
|
856
|
+
// column lookup remains correct.
|
|
857
|
+
if (this._postCutoverCache === true) {
|
|
858
|
+
const processingFilter = this.legacyStatiToProcessing(args.txStatus);
|
|
859
|
+
const filterList = processingFilter.map(s => "'" + s + "'").join(',');
|
|
860
|
+
q.whereRaw(`(select processing from transactions where transactions.transactionId = outputs.transactionId) in (${filterList})`);
|
|
861
|
+
}
|
|
862
|
+
else {
|
|
863
|
+
q.whereRaw(`(select status from transactions where transactions.transactionId = outputs.transactionId) in (${args.txStatus.map(s => "'" + s + "'").join(',')})`);
|
|
864
|
+
}
|
|
499
865
|
}
|
|
500
866
|
if (args.noScript && !count) {
|
|
501
867
|
const columns = tables_1.outputColumnsWithoutLockingScript.map(c => `outputs.${c}`);
|
|
@@ -505,37 +871,41 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
505
871
|
}
|
|
506
872
|
findOutputTagMapsQuery(args) {
|
|
507
873
|
const q = this.setupQuery('output_tags_map', args);
|
|
508
|
-
if (args.tagIds && args.tagIds.length > 0)
|
|
874
|
+
if ((args.tagIds != null) && args.tagIds.length > 0)
|
|
509
875
|
q.whereIn('outputTagId', args.tagIds);
|
|
510
876
|
return q;
|
|
511
877
|
}
|
|
512
878
|
findOutputTagsQuery(args) {
|
|
513
879
|
return this.setupQuery('output_tags', args);
|
|
514
880
|
}
|
|
515
|
-
findProvenTxReqsQuery(args) {
|
|
516
|
-
if (args.partial.rawTx)
|
|
517
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx',
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
881
|
+
findProvenTxReqsQuery(args, tableName = 'proven_tx_reqs') {
|
|
882
|
+
if (args.partial.rawTx != null) {
|
|
883
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx', 'undefined. ProvenTxReqs may not be found by rawTx value.');
|
|
884
|
+
}
|
|
885
|
+
if (args.partial.inputBEEF != null) {
|
|
886
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.inputBEEF', 'undefined. ProvenTxReqs may not be found by inputBEEF value.');
|
|
887
|
+
}
|
|
888
|
+
const q = this.setupQuery(tableName, args);
|
|
889
|
+
if ((args.status != null) && args.status.length > 0)
|
|
522
890
|
q.whereIn('status', args.status);
|
|
523
|
-
if (args.txids) {
|
|
891
|
+
if (args.txids != null) {
|
|
524
892
|
const txids = args.txids.filter(txid => txid !== undefined);
|
|
525
893
|
if (txids.length > 0)
|
|
526
894
|
q.whereIn('txid', txids);
|
|
527
895
|
}
|
|
528
896
|
return q;
|
|
529
897
|
}
|
|
530
|
-
findProvenTxsQuery(args) {
|
|
531
|
-
if (args.partial.rawTx)
|
|
532
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx',
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
898
|
+
findProvenTxsQuery(args, tableName = 'proven_txs') {
|
|
899
|
+
if (args.partial.rawTx != null) {
|
|
900
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx', 'undefined. ProvenTxs may not be found by rawTx value.');
|
|
901
|
+
}
|
|
902
|
+
if (args.partial.merklePath != null) {
|
|
903
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.merklePath', 'undefined. ProvenTxs may not be found by merklePath value.');
|
|
904
|
+
}
|
|
905
|
+
return this.setupQuery(tableName, args);
|
|
536
906
|
}
|
|
537
|
-
findStaleMerkleRootsQuery(args) {
|
|
538
|
-
|
|
907
|
+
findStaleMerkleRootsQuery(args, tableName = 'proven_txs') {
|
|
908
|
+
const q = this.toDb(args.trx)(tableName);
|
|
539
909
|
q.where('height', '=', args.height);
|
|
540
910
|
q.where('merkleRoot', '!=', args.merkleRoot);
|
|
541
911
|
q.select('merkleRoot');
|
|
@@ -546,26 +916,37 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
546
916
|
return this.setupQuery('sync_states', args);
|
|
547
917
|
}
|
|
548
918
|
findTransactionsQuery(args, count) {
|
|
549
|
-
if (args.partial.rawTx)
|
|
550
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx',
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
919
|
+
if (args.partial.rawTx != null) {
|
|
920
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx', 'undefined. Transactions may not be found by rawTx value.');
|
|
921
|
+
}
|
|
922
|
+
if (args.partial.inputBEEF != null) {
|
|
923
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.inputBEEF', 'undefined. Transactions may not be found by inputBEEF value.');
|
|
924
|
+
}
|
|
925
|
+
// Post-cutover the original per-user `transactions` table has been
|
|
926
|
+
// renamed to `transactions_legacy`. `findTransactions` returns the
|
|
927
|
+
// legacy shape (status / userId / satoshis / description / etc.) so it
|
|
928
|
+
// must route at the renamed table to preserve the legacy read surface
|
|
929
|
+
// through the bridge period. New-canonical per-txid reads go through
|
|
930
|
+
// TransactionService.
|
|
931
|
+
const tableName = this._postCutoverCache === true
|
|
932
|
+
? 'transactions_legacy'
|
|
933
|
+
: 'transactions';
|
|
934
|
+
const q = this.setupQuery(tableName, args);
|
|
935
|
+
if ((args.status != null) && args.status.length > 0)
|
|
555
936
|
q.whereIn('status', args.status);
|
|
556
|
-
if (args.from)
|
|
937
|
+
if (args.from != null)
|
|
557
938
|
q.where('created_at', '>=', this.validateDateForWhere(args.from));
|
|
558
|
-
if (args.to)
|
|
939
|
+
if (args.to != null)
|
|
559
940
|
q.where('created_at', '<', this.validateDateForWhere(args.to));
|
|
560
941
|
if (args.noRawTx && !count) {
|
|
561
|
-
const columns = tables_1.transactionColumnsWithoutRawTx.map(c =>
|
|
942
|
+
const columns = tables_1.transactionColumnsWithoutRawTx.map(c => `${tableName}.${c}`);
|
|
562
943
|
q.select(columns);
|
|
563
944
|
}
|
|
564
945
|
return q;
|
|
565
946
|
}
|
|
566
947
|
findTxLabelMapsQuery(args) {
|
|
567
948
|
const q = this.setupQuery('tx_labels_map', args);
|
|
568
|
-
if (args.labelIds && args.labelIds.length > 0)
|
|
949
|
+
if ((args.labelIds != null) && args.labelIds.length > 0)
|
|
569
950
|
q.whereIn('txLabelId', args.labelIds);
|
|
570
951
|
return q;
|
|
571
952
|
}
|
|
@@ -644,17 +1025,20 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
644
1025
|
return this.validateEntities(r, undefined, ['isDeleted']);
|
|
645
1026
|
}
|
|
646
1027
|
async findProvenTxReqs(args) {
|
|
647
|
-
const
|
|
1028
|
+
const reqTable = await this.provenTxReqsTableName();
|
|
1029
|
+
const q = this.findProvenTxReqsQuery(args, reqTable);
|
|
648
1030
|
const r = await q;
|
|
649
|
-
return this.validateEntities(r, undefined, ['notified']);
|
|
1031
|
+
return this.validateEntities(r, undefined, ['notified', 'wasBroadcast']);
|
|
650
1032
|
}
|
|
651
1033
|
async findProvenTxs(args) {
|
|
652
|
-
const
|
|
1034
|
+
const tableName = await this.provenTxsTableName();
|
|
1035
|
+
const q = this.findProvenTxsQuery(args, tableName);
|
|
653
1036
|
const r = await q;
|
|
654
1037
|
return this.validateEntities(r);
|
|
655
1038
|
}
|
|
656
1039
|
async findStaleMerkleRoots(args) {
|
|
657
|
-
const
|
|
1040
|
+
const tableName = await this.provenTxsTableName();
|
|
1041
|
+
const q = this.findStaleMerkleRootsQuery(args, tableName);
|
|
658
1042
|
const r = await q;
|
|
659
1043
|
return r.map((row) => row.merkleRoot);
|
|
660
1044
|
}
|
|
@@ -673,6 +1057,172 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
673
1057
|
}
|
|
674
1058
|
return this.validateEntities(r, undefined, ['isOutgoing']);
|
|
675
1059
|
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Post-cutover: queries `transactions_legacy` for unsigned/pending rows
|
|
1062
|
+
* created by `createAction` (which have no real txid yet and therefore have no
|
|
1063
|
+
* new-schema counterpart). Falls back to the standard `findTransactions` pre-cutover.
|
|
1064
|
+
*
|
|
1065
|
+
* Used by `processAction.validateCommitNewTxToStorageArgs` to locate the
|
|
1066
|
+
* unsigned transaction row by `{userId, reference}`.
|
|
1067
|
+
*
|
|
1068
|
+
* Mapping §2: legacy `unsigned` / `unprocessed` → these rows only exist in
|
|
1069
|
+
* `transactions_legacy` post-cutover; new `transactions` has `processing` not
|
|
1070
|
+
* `status` and no unsigned-state rows.
|
|
1071
|
+
*/
|
|
1072
|
+
async findLegacyTransactions(args) {
|
|
1073
|
+
const postCutover = await this.isPostCutover();
|
|
1074
|
+
if (!postCutover) {
|
|
1075
|
+
// Pre-cutover: standard transactions table
|
|
1076
|
+
return await this.findTransactions(args);
|
|
1077
|
+
}
|
|
1078
|
+
// Post-cutover: unsigned/unprocessed rows live in transactions_legacy
|
|
1079
|
+
const q = this.setupQuery('transactions_legacy', args);
|
|
1080
|
+
if ((args.status != null) && args.status.length > 0)
|
|
1081
|
+
q.whereIn('status', args.status);
|
|
1082
|
+
if (args.from != null)
|
|
1083
|
+
q.where('created_at', '>=', this.validateDateForWhere(args.from));
|
|
1084
|
+
if (args.to != null)
|
|
1085
|
+
q.where('created_at', '<', this.validateDateForWhere(args.to));
|
|
1086
|
+
if (args.noRawTx) {
|
|
1087
|
+
const columns = tables_1.transactionColumnsWithoutRawTx.map(c => `transactions_legacy.${c}`);
|
|
1088
|
+
q.select(columns);
|
|
1089
|
+
}
|
|
1090
|
+
const r = await q;
|
|
1091
|
+
if (!args.noRawTx) {
|
|
1092
|
+
for (const t of r) {
|
|
1093
|
+
await this.validateRawTransaction(t, args.trx);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return this.validateEntities(r, undefined, ['isOutgoing']);
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Post-cutover: updates `transactions_legacy` (where unsigned rows live).
|
|
1100
|
+
* Pre-cutover: delegates to `updateTransaction`.
|
|
1101
|
+
*
|
|
1102
|
+
* Used by `processAction.commitNewTxToStorage` to write back the real txid
|
|
1103
|
+
* and status to the legacy row that was created by `createAction`.
|
|
1104
|
+
*
|
|
1105
|
+
* Mapping §2: legacy `unsigned` → `unprocessed` transition and txid write-back
|
|
1106
|
+
* must go to `transactions_legacy` post-cutover, not new `transactions`.
|
|
1107
|
+
*/
|
|
1108
|
+
async updateLegacyTransaction(id, update, trx) {
|
|
1109
|
+
const postCutover = await this.isPostCutover();
|
|
1110
|
+
if (!postCutover) {
|
|
1111
|
+
return await this.updateTransaction(id, update, trx);
|
|
1112
|
+
}
|
|
1113
|
+
// Post-cutover: unsigned rows are in transactions_legacy
|
|
1114
|
+
await this.verifyReadyForDatabaseAccess(trx);
|
|
1115
|
+
let r;
|
|
1116
|
+
if (Array.isArray(id)) {
|
|
1117
|
+
r = await this.toDb(trx)('transactions_legacy')
|
|
1118
|
+
.whereIn('transactionId', id)
|
|
1119
|
+
.update(this.validatePartialForUpdate(update));
|
|
1120
|
+
}
|
|
1121
|
+
else if (Number.isInteger(id)) {
|
|
1122
|
+
r = await this.toDb(trx)('transactions_legacy')
|
|
1123
|
+
.where({ transactionId: id })
|
|
1124
|
+
.update(this.validatePartialForUpdate(update));
|
|
1125
|
+
}
|
|
1126
|
+
else {
|
|
1127
|
+
throw new WERR_errors_1.WERR_INVALID_PARAMETER('id', 'transactionId or array of transactionId');
|
|
1128
|
+
}
|
|
1129
|
+
return r;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Post-cutover SQLite: temporarily disable FK enforcement around the
|
|
1133
|
+
* `outputs.spentBy = legacyTransactionId` UPDATE. The `outputs.spentBy` FK
|
|
1134
|
+
* references `transactions.transactionId` after cutover, but unsigned
|
|
1135
|
+
* transactions from `createAction` live in `transactions_legacy` (their new-schema
|
|
1136
|
+
* counterpart is created later by `processAction`).
|
|
1137
|
+
*
|
|
1138
|
+
* IMPORTANT: We bypass `updateOutput` (and therefore `verifyReadyForDatabaseAccess`)
|
|
1139
|
+
* because `verifyReadyForDatabaseAccess` always re-enables FK with
|
|
1140
|
+
* `PRAGMA foreign_keys = ON`, which would undo our bypass. Instead we
|
|
1141
|
+
* directly run the UPDATE via the raw knex handle.
|
|
1142
|
+
*
|
|
1143
|
+
* Pre-cutover or MySQL: delegates to `updateOutput` unchanged.
|
|
1144
|
+
*
|
|
1145
|
+
* Mapping §2: bridge-period spentBy references transactions_legacy during
|
|
1146
|
+
* createAction; FK bypass covers this until processAction wires the new-schema.
|
|
1147
|
+
*/
|
|
1148
|
+
async markOutputAsSpentBy(outputId, update, trx) {
|
|
1149
|
+
const postCutover = await this.isPostCutover();
|
|
1150
|
+
const isSqlite = this.dbtype === 'SQLite';
|
|
1151
|
+
if (postCutover && isSqlite) {
|
|
1152
|
+
// Build the UPDATE payload the same way validatePartialForUpdate does,
|
|
1153
|
+
// but WITHOUT calling verifyReadyForDatabaseAccess (which always issues
|
|
1154
|
+
// PRAGMA foreign_keys = ON, undoing our bypass).
|
|
1155
|
+
const now = new Date().toISOString();
|
|
1156
|
+
const payload = { updated_at: now };
|
|
1157
|
+
for (const [k, v] of Object.entries(update)) {
|
|
1158
|
+
if (v === undefined) {
|
|
1159
|
+
payload[k] = null;
|
|
1160
|
+
}
|
|
1161
|
+
else if (Array.isArray(v) && (v.length === 0 || typeof v[0] === 'number')) {
|
|
1162
|
+
payload[k] = Buffer.from(v);
|
|
1163
|
+
}
|
|
1164
|
+
else {
|
|
1165
|
+
payload[k] = v;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
// Strategy: FK is a connection-level setting in SQLite. PRAGMA changes
|
|
1169
|
+
// inside a Knex transaction are no-ops (SQLite restriction), but PRAGMA
|
|
1170
|
+
// changes OUTSIDE a transaction persist.
|
|
1171
|
+
//
|
|
1172
|
+
// When called with trx (inside a transaction): the caller is expected to have
|
|
1173
|
+
// already disabled FK before opening the transaction. We run the UPDATE via
|
|
1174
|
+
// the transaction handle (no PRAGMA calls needed here — they'd be no-ops or
|
|
1175
|
+
// pool-exhausting anyway).
|
|
1176
|
+
//
|
|
1177
|
+
// When called without trx (outside a transaction): disable FK, run UPDATE,
|
|
1178
|
+
// re-enable FK.
|
|
1179
|
+
if (trx != null) {
|
|
1180
|
+
// Inside caller's transaction — FK was disabled before the transaction.
|
|
1181
|
+
// Just run the UPDATE; do NOT try to PRAGMA here (no-op or timeout).
|
|
1182
|
+
this.whenLastAccess = new Date();
|
|
1183
|
+
await (this.toDb(trx))('outputs')
|
|
1184
|
+
.where({ outputId })
|
|
1185
|
+
.update(payload);
|
|
1186
|
+
}
|
|
1187
|
+
else {
|
|
1188
|
+
// Outside any transaction — we can safely toggle FK on the bare connection.
|
|
1189
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
1190
|
+
try {
|
|
1191
|
+
this.whenLastAccess = new Date();
|
|
1192
|
+
await this.knex('outputs').where({ outputId }).update(payload);
|
|
1193
|
+
}
|
|
1194
|
+
finally {
|
|
1195
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
else {
|
|
1200
|
+
await this.updateOutput(outputId, update, trx);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Post-cutover SQLite: disable FK on the bare connection BEFORE opening a
|
|
1205
|
+
* transaction. PRAGMA foreign_keys changes inside SQLite transactions are no-ops,
|
|
1206
|
+
* so this MUST be called before `this.knex.transaction()`.
|
|
1207
|
+
*
|
|
1208
|
+
* Only acts when post-cutover AND SQLite. Pre-cutover or MySQL: no-op.
|
|
1209
|
+
*/
|
|
1210
|
+
async disableForeignKeys() {
|
|
1211
|
+
const postCutover = await this.isPostCutover();
|
|
1212
|
+
if (postCutover && this.dbtype === 'SQLite') {
|
|
1213
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Re-enable FK after the transaction opened via `disableForeignKeys()` completes.
|
|
1218
|
+
* Only acts when post-cutover AND SQLite.
|
|
1219
|
+
*/
|
|
1220
|
+
async enableForeignKeys() {
|
|
1221
|
+
const postCutover = await this.isPostCutover();
|
|
1222
|
+
if (postCutover && this.dbtype === 'SQLite') {
|
|
1223
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
676
1226
|
async findTxLabelMaps(args) {
|
|
677
1227
|
const q = this.findTxLabelMapsQuery(args);
|
|
678
1228
|
const r = await q;
|
|
@@ -734,10 +1284,12 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
734
1284
|
return await this.getCount(this.findOutputTagsQuery(args));
|
|
735
1285
|
}
|
|
736
1286
|
async countProvenTxReqs(args) {
|
|
737
|
-
|
|
1287
|
+
const reqTable = await this.provenTxReqsTableName();
|
|
1288
|
+
return await this.getCount(this.findProvenTxReqsQuery(args, reqTable));
|
|
738
1289
|
}
|
|
739
1290
|
async countProvenTxs(args) {
|
|
740
|
-
|
|
1291
|
+
const tableName = await this.provenTxsTableName();
|
|
1292
|
+
return await this.getCount(this.findProvenTxsQuery(args, tableName));
|
|
741
1293
|
}
|
|
742
1294
|
async countSyncStates(args) {
|
|
743
1295
|
return await this.getCount(this.findSyncStatesQuery(args));
|
|
@@ -810,11 +1362,14 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
810
1362
|
try {
|
|
811
1363
|
const r = await this.knex.migrate.down(config);
|
|
812
1364
|
if (!r) {
|
|
813
|
-
console.error(
|
|
1365
|
+
console.error('Migration returned falsy result await this.knex.migrate.down(config)');
|
|
814
1366
|
break;
|
|
815
1367
|
}
|
|
816
1368
|
}
|
|
817
|
-
catch (
|
|
1369
|
+
catch (migrationError) {
|
|
1370
|
+
// migrate.down throws when there are no more migrations to roll back — this is
|
|
1371
|
+
// the expected terminal condition, so we stop iterating rather than propagating.
|
|
1372
|
+
console.debug('migrate.down stopped (no more migrations or error):', migrationError);
|
|
818
1373
|
break;
|
|
819
1374
|
}
|
|
820
1375
|
}
|
|
@@ -824,7 +1379,7 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
824
1379
|
}
|
|
825
1380
|
}
|
|
826
1381
|
async transaction(scope, trx) {
|
|
827
|
-
if (trx)
|
|
1382
|
+
if (trx != null)
|
|
828
1383
|
return await scope(trx);
|
|
829
1384
|
return await this.knex.transaction(async (knextrx) => {
|
|
830
1385
|
const trx = knextrx;
|
|
@@ -837,7 +1392,7 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
837
1392
|
*/
|
|
838
1393
|
toDb(trx) {
|
|
839
1394
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
840
|
-
const db =
|
|
1395
|
+
const db = (trx == null) ? this.knex : trx;
|
|
841
1396
|
this.whenLastAccess = new Date();
|
|
842
1397
|
return db;
|
|
843
1398
|
}
|
|
@@ -847,7 +1402,7 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
847
1402
|
return;
|
|
848
1403
|
// rawTransaction is missing, see if we moved it ...
|
|
849
1404
|
const rawTx = await this.getRawTxOfKnownValidTransaction(t.txid, undefined, undefined, trx);
|
|
850
|
-
if (
|
|
1405
|
+
if (rawTx == null)
|
|
851
1406
|
return;
|
|
852
1407
|
t.rawTx = rawTx;
|
|
853
1408
|
}
|
|
@@ -860,9 +1415,8 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
860
1415
|
* @param trx
|
|
861
1416
|
*/
|
|
862
1417
|
async verifyReadyForDatabaseAccess(trx) {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
}
|
|
1418
|
+
var _a;
|
|
1419
|
+
(_a = this._settings) !== null && _a !== void 0 ? _a : (this._settings = await this.readSettings());
|
|
866
1420
|
// Always run the PRAGMA for SQLite to ensure foreign key constraints are enabled.
|
|
867
1421
|
// This is necessary because PRAGMA foreign_keys is a per-connection setting,
|
|
868
1422
|
// and connection pools may create new connections that don't have it set.
|
|
@@ -873,6 +1427,39 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
873
1427
|
this._verifiedReadyForDatabaseAccess = true;
|
|
874
1428
|
return this._settings.dbtype;
|
|
875
1429
|
}
|
|
1430
|
+
/** Convert every number-array value to a Buffer and every undefined to null on an arbitrary object. */
|
|
1431
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1432
|
+
serialiseForKnex(v) {
|
|
1433
|
+
for (const key of Object.keys(v)) {
|
|
1434
|
+
const val = v[key];
|
|
1435
|
+
if (Array.isArray(val) && (val.length === 0 || typeof val[0] === 'number')) {
|
|
1436
|
+
v[key] = Buffer.from(val);
|
|
1437
|
+
}
|
|
1438
|
+
else if (val === undefined) {
|
|
1439
|
+
v[key] = null;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
/** Apply optional date-field coercion list in-place. */
|
|
1444
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1445
|
+
coerceDateFields(v, dateFields) {
|
|
1446
|
+
if (dateFields == null)
|
|
1447
|
+
return;
|
|
1448
|
+
for (const df of dateFields) {
|
|
1449
|
+
if (v[df])
|
|
1450
|
+
v[df] = this.validateOptionalEntityDate(v[df]);
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
/** Apply optional boolean-field coercion list in-place. */
|
|
1454
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1455
|
+
coerceBooleanFields(v, booleanFields) {
|
|
1456
|
+
if (booleanFields == null)
|
|
1457
|
+
return;
|
|
1458
|
+
for (const df of booleanFields) {
|
|
1459
|
+
if (v[df] !== undefined)
|
|
1460
|
+
v[df] = v[df] ? 1 : 0;
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
876
1463
|
/**
|
|
877
1464
|
* Helper to force uniform behavior across database engines.
|
|
878
1465
|
* Use to process the update template for entities being updated.
|
|
@@ -880,6 +1467,7 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
880
1467
|
validatePartialForUpdate(update, dateFields, booleanFields) {
|
|
881
1468
|
if (!this.dbtype)
|
|
882
1469
|
throw new WERR_errors_1.WERR_INTERNAL('must call verifyReadyForDatabaseAccess first');
|
|
1470
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
883
1471
|
const v = update;
|
|
884
1472
|
if (v.created_at)
|
|
885
1473
|
v.created_at = this.validateEntityDate(v.created_at);
|
|
@@ -889,27 +1477,9 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
889
1477
|
delete v.created_at;
|
|
890
1478
|
if (!v.updated_at)
|
|
891
1479
|
v.updated_at = this.validateEntityDate(new Date());
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
v[df] = this.validateOptionalEntityDate(v[df]);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
if (booleanFields) {
|
|
899
|
-
for (const df of booleanFields) {
|
|
900
|
-
if (update[df] !== undefined)
|
|
901
|
-
update[df] = !!update[df] ? 1 : 0;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
for (const key of Object.keys(v)) {
|
|
905
|
-
const val = v[key];
|
|
906
|
-
if (Array.isArray(val) && (val.length === 0 || typeof val[0] === 'number')) {
|
|
907
|
-
v[key] = Buffer.from(val);
|
|
908
|
-
}
|
|
909
|
-
else if (val === undefined) {
|
|
910
|
-
v[key] = null;
|
|
911
|
-
}
|
|
912
|
-
}
|
|
1480
|
+
this.coerceDateFields(v, dateFields);
|
|
1481
|
+
this.coerceBooleanFields(update, booleanFields);
|
|
1482
|
+
this.serialiseForKnex(v);
|
|
913
1483
|
this.isDirty = true;
|
|
914
1484
|
return v;
|
|
915
1485
|
}
|
|
@@ -917,8 +1487,11 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
917
1487
|
* Helper to force uniform behavior across database engines.
|
|
918
1488
|
* Use to process new entities being inserted into the database.
|
|
919
1489
|
*/
|
|
920
|
-
async validateEntityForInsert(entity, trx, dateFields, booleanFields
|
|
1490
|
+
async validateEntityForInsert(entity, trx, dateFields, booleanFields
|
|
1491
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1492
|
+
) {
|
|
921
1493
|
await this.verifyReadyForDatabaseAccess(trx);
|
|
1494
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
922
1495
|
const v = { ...entity };
|
|
923
1496
|
v.created_at = this.validateOptionalEntityDate(v.created_at, true);
|
|
924
1497
|
v.updated_at = this.validateOptionalEntityDate(v.updated_at, true);
|
|
@@ -926,27 +1499,9 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
926
1499
|
delete v.created_at;
|
|
927
1500
|
if (!v.updated_at)
|
|
928
1501
|
delete v.updated_at;
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
v[df] = this.validateOptionalEntityDate(v[df]);
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
if (booleanFields) {
|
|
936
|
-
for (const df of booleanFields) {
|
|
937
|
-
if (entity[df] !== undefined)
|
|
938
|
-
entity[df] = !!entity[df] ? 1 : 0;
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
for (const key of Object.keys(v)) {
|
|
942
|
-
const val = v[key];
|
|
943
|
-
if (Array.isArray(val) && (val.length === 0 || typeof val[0] === 'number')) {
|
|
944
|
-
v[key] = Buffer.from(val);
|
|
945
|
-
}
|
|
946
|
-
else if (val === undefined) {
|
|
947
|
-
v[key] = null;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
1502
|
+
this.coerceDateFields(v, dateFields);
|
|
1503
|
+
this.coerceBooleanFields(entity, booleanFields);
|
|
1504
|
+
this.serialiseForKnex(v);
|
|
950
1505
|
this.isDirty = true;
|
|
951
1506
|
return v;
|
|
952
1507
|
}
|
|
@@ -982,13 +1537,19 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
982
1537
|
* - sending (if excludeSending is false)
|
|
983
1538
|
*/
|
|
984
1539
|
async countChangeInputs(userId, basketId, excludeSending) {
|
|
985
|
-
const
|
|
1540
|
+
const legacyStatus = ['completed', 'unproven'];
|
|
986
1541
|
if (!excludeSending)
|
|
987
|
-
|
|
1542
|
+
legacyStatus.push('sending');
|
|
1543
|
+
const postCutover = await this.isPostCutover();
|
|
988
1544
|
const q = this.knex('outputs as o')
|
|
989
1545
|
.join('transactions as t', 'o.transactionId', 't.transactionId')
|
|
990
|
-
.where({ 'o.userId': userId, 'o.spendable': true, 'o.basketId': basketId })
|
|
991
|
-
|
|
1546
|
+
.where({ 'o.userId': userId, 'o.spendable': true, 'o.basketId': basketId });
|
|
1547
|
+
if (postCutover) {
|
|
1548
|
+
q.whereIn('t.processing', this.legacyStatiToProcessing(legacyStatus));
|
|
1549
|
+
}
|
|
1550
|
+
else {
|
|
1551
|
+
q.whereIn('t.status', legacyStatus);
|
|
1552
|
+
}
|
|
992
1553
|
const count = await this.getCount(q);
|
|
993
1554
|
return count;
|
|
994
1555
|
}
|
|
@@ -1069,16 +1630,21 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
1069
1630
|
return byTag;
|
|
1070
1631
|
}
|
|
1071
1632
|
async sumSpendableSatoshisInBasket(userId, basketId, excludeSending, trx) {
|
|
1072
|
-
const
|
|
1633
|
+
const legacyStatus = ['completed', 'unproven'];
|
|
1073
1634
|
if (!excludeSending)
|
|
1074
|
-
|
|
1075
|
-
const
|
|
1635
|
+
legacyStatus.push('sending');
|
|
1636
|
+
const postCutover = await this.isPostCutover();
|
|
1637
|
+
const q = this.toDb(trx)('outputs as o')
|
|
1076
1638
|
.join('transactions as t', 'o.transactionId', 't.transactionId')
|
|
1077
|
-
.where({ 'o.userId': userId, 'o.spendable': true, 'o.basketId': basketId })
|
|
1078
|
-
|
|
1079
|
-
.
|
|
1080
|
-
|
|
1081
|
-
|
|
1639
|
+
.where({ 'o.userId': userId, 'o.spendable': true, 'o.basketId': basketId });
|
|
1640
|
+
if (postCutover) {
|
|
1641
|
+
q.whereIn('t.processing', this.legacyStatiToProcessing(legacyStatus));
|
|
1642
|
+
}
|
|
1643
|
+
else {
|
|
1644
|
+
q.whereIn('t.status', legacyStatus);
|
|
1645
|
+
}
|
|
1646
|
+
const row = await q.sum({ totalSatoshis: 'o.satoshis' }).first();
|
|
1647
|
+
return Number(((row != null) && row.totalSatoshis) || 0);
|
|
1082
1648
|
}
|
|
1083
1649
|
/**
|
|
1084
1650
|
* Finds closest matching available change output to use as input for new transaction.
|
|
@@ -1086,50 +1652,97 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
1086
1652
|
* Transactionally allocate the output such that
|
|
1087
1653
|
*/
|
|
1088
1654
|
async allocateChangeInput(userId, basketId, targetSatoshis, exactSatoshis, excludeSending, transactionId) {
|
|
1089
|
-
const
|
|
1655
|
+
const legacyStatus = ['completed', 'unproven'];
|
|
1090
1656
|
if (!excludeSending)
|
|
1091
|
-
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1657
|
+
legacyStatus.push('sending');
|
|
1658
|
+
const postCutover = await this.isPostCutover();
|
|
1659
|
+
const processingFilter = postCutover ? this.legacyStatiToProcessing(legacyStatus) : undefined;
|
|
1660
|
+
// Post-cutover bridge-period: `transactionId` here is a legacy row in
|
|
1661
|
+
// `transactions_legacy` (new unsigned tx created by createAction). The
|
|
1662
|
+
// `outputs.spentBy` FK now references `transactions.transactionId`, so
|
|
1663
|
+
// setting spentBy to a transactions_legacy ID would violate the constraint.
|
|
1664
|
+
// PRAGMA foreign_keys is silently ignored inside SQLite transactions, so
|
|
1665
|
+
// we toggle FK enforcement on the bare connection BEFORE opening the
|
|
1666
|
+
// transaction. processAction will remap spentBy to the real new transactionId
|
|
1667
|
+
// once the txid is known and the new schema row is created.
|
|
1668
|
+
const isSqlite = this.dbtype === 'SQLite';
|
|
1669
|
+
if (postCutover && isSqlite) {
|
|
1670
|
+
await this.knex.raw('PRAGMA foreign_keys = OFF');
|
|
1671
|
+
}
|
|
1672
|
+
let r;
|
|
1673
|
+
try {
|
|
1674
|
+
r = await this.knex.transaction(async (trx) => {
|
|
1675
|
+
const baseQuery = () => {
|
|
1676
|
+
const q = trx('outputs as o')
|
|
1677
|
+
.join('transactions as t', 'o.transactionId', 't.transactionId')
|
|
1678
|
+
.where('o.userId', userId)
|
|
1679
|
+
.where('o.spendable', true)
|
|
1680
|
+
.where('o.basketId', basketId)
|
|
1681
|
+
.select('o.*');
|
|
1682
|
+
if (processingFilter != null) {
|
|
1683
|
+
q.whereIn('t.processing', processingFilter);
|
|
1684
|
+
}
|
|
1685
|
+
else {
|
|
1686
|
+
q.whereIn('t.status', legacyStatus);
|
|
1687
|
+
}
|
|
1688
|
+
return q;
|
|
1689
|
+
};
|
|
1690
|
+
let output;
|
|
1691
|
+
if (exactSatoshis !== undefined) {
|
|
1692
|
+
output = await baseQuery().where('o.satoshis', exactSatoshis).orderBy('o.outputId', 'asc').first();
|
|
1693
|
+
}
|
|
1694
|
+
output !== null && output !== void 0 ? output : (output = await baseQuery()
|
|
1106
1695
|
.where('o.satoshis', '>=', targetSatoshis)
|
|
1107
1696
|
.orderBy('o.satoshis', 'asc')
|
|
1108
1697
|
.orderBy('o.outputId', 'asc')
|
|
1109
|
-
.first();
|
|
1110
|
-
|
|
1111
|
-
if (!output) {
|
|
1112
|
-
output = await baseQuery()
|
|
1698
|
+
.first());
|
|
1699
|
+
output !== null && output !== void 0 ? output : (output = await baseQuery()
|
|
1113
1700
|
.where('o.satoshis', '<', targetSatoshis)
|
|
1114
1701
|
.orderBy('o.satoshis', 'desc')
|
|
1115
1702
|
.orderBy('o.outputId', 'desc')
|
|
1116
|
-
.first();
|
|
1703
|
+
.first());
|
|
1704
|
+
if (output == null)
|
|
1705
|
+
return undefined;
|
|
1706
|
+
// Post-cutover: transactionId is in transactions_legacy; FK would fail.
|
|
1707
|
+
// markOutputAsSpentBy disables FK via raw knex handle, bypassing
|
|
1708
|
+
// verifyReadyForDatabaseAccess that would re-enable it.
|
|
1709
|
+
// Mapping §2: bridge-period spentBy → transactions_legacy during createAction.
|
|
1710
|
+
await this.markOutputAsSpentBy(output.outputId, {
|
|
1711
|
+
spendable: false,
|
|
1712
|
+
spentBy: transactionId
|
|
1713
|
+
}, trx);
|
|
1714
|
+
// Keep behavior identical to the pre-optimization path: ensure lockingScript
|
|
1715
|
+
// is present even when it was offloaded from outputs into rawTx storage.
|
|
1716
|
+
await this.validateOutputScript(output, trx);
|
|
1717
|
+
output.spendable = false;
|
|
1718
|
+
output.spentBy = transactionId;
|
|
1719
|
+
return output;
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
finally {
|
|
1723
|
+
if (postCutover && isSqlite) {
|
|
1724
|
+
await this.knex.raw('PRAGMA foreign_keys = ON');
|
|
1117
1725
|
}
|
|
1118
|
-
|
|
1119
|
-
return undefined;
|
|
1120
|
-
await this.updateOutput(output.outputId, {
|
|
1121
|
-
spendable: false,
|
|
1122
|
-
spentBy: transactionId
|
|
1123
|
-
}, trx);
|
|
1124
|
-
// Keep behavior identical to the pre-optimization path: ensure lockingScript
|
|
1125
|
-
// is present even when it was offloaded from outputs into rawTx storage.
|
|
1126
|
-
await this.validateOutputScript(output, trx);
|
|
1127
|
-
output.spendable = false;
|
|
1128
|
-
output.spentBy = transactionId;
|
|
1129
|
-
return output;
|
|
1130
|
-
});
|
|
1726
|
+
}
|
|
1131
1727
|
return r;
|
|
1132
1728
|
}
|
|
1729
|
+
/** Convert null→undefined and Buffer→number[] on a retrieved entity in-place. */
|
|
1730
|
+
deserialiseFromKnex(entity) {
|
|
1731
|
+
for (const key of Object.keys(entity)) {
|
|
1732
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1733
|
+
const val = entity[key];
|
|
1734
|
+
if (val === null) {
|
|
1735
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1736
|
+
;
|
|
1737
|
+
entity[key] = undefined;
|
|
1738
|
+
}
|
|
1739
|
+
else if (Buffer.isBuffer(val)) {
|
|
1740
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1741
|
+
;
|
|
1742
|
+
entity[key] = Array.from(val);
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1133
1746
|
/**
|
|
1134
1747
|
* Helper to force uniform behavior across database engines.
|
|
1135
1748
|
* Use to process all individual records with time stamps retreived from database.
|
|
@@ -1137,27 +1750,21 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
1137
1750
|
validateEntity(entity, dateFields, booleanFields) {
|
|
1138
1751
|
entity.created_at = this.validateDate(entity.created_at);
|
|
1139
1752
|
entity.updated_at = this.validateDate(entity.updated_at);
|
|
1140
|
-
if (dateFields) {
|
|
1753
|
+
if (dateFields != null) {
|
|
1141
1754
|
for (const df of dateFields) {
|
|
1755
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1142
1756
|
if (entity[df])
|
|
1143
1757
|
entity[df] = this.validateDate(entity[df]);
|
|
1144
1758
|
}
|
|
1145
1759
|
}
|
|
1146
|
-
if (booleanFields) {
|
|
1760
|
+
if (booleanFields != null) {
|
|
1147
1761
|
for (const df of booleanFields) {
|
|
1762
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1148
1763
|
if (entity[df] !== undefined)
|
|
1149
1764
|
entity[df] = !!entity[df];
|
|
1150
1765
|
}
|
|
1151
1766
|
}
|
|
1152
|
-
|
|
1153
|
-
const val = entity[key];
|
|
1154
|
-
if (val === null) {
|
|
1155
|
-
entity[key] = undefined;
|
|
1156
|
-
}
|
|
1157
|
-
else if (Buffer.isBuffer(val)) {
|
|
1158
|
-
entity[key] = Array.from(val);
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1767
|
+
this.deserialiseFromKnex(entity);
|
|
1161
1768
|
return entity;
|
|
1162
1769
|
}
|
|
1163
1770
|
/**
|
|
@@ -1179,7 +1786,7 @@ class StorageKnex extends StorageProvider_1.StorageProvider {
|
|
|
1179
1786
|
orderDescending: true,
|
|
1180
1787
|
paged: { limit: 1 }
|
|
1181
1788
|
}));
|
|
1182
|
-
const monitorStats = monitorEvent ? JSON.parse(monitorEvent.details) : undefined;
|
|
1789
|
+
const monitorStats = (monitorEvent != null) ? JSON.parse(monitorEvent.details) : undefined;
|
|
1183
1790
|
const servicesStats = this.getServices().getServicesCallHistory(true);
|
|
1184
1791
|
const one_day_ago = new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();
|
|
1185
1792
|
const one_week_ago = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString();
|