@bsv/wallet-toolbox 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.template +22 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
- package/.github/ISSUE_TEMPLATE/discussion.md +24 -0
- package/.github/pull_request_template.md +24 -0
- package/.github/workflows/push.yaml +66 -0
- package/.prettierrc +10 -0
- package/CONTRIBUTING.md +89 -0
- package/LICENSE.txt +28 -0
- package/README.md +124 -0
- package/dev.sqlite3 +0 -0
- package/docs/README.md +15 -0
- package/docs/client.md +6812 -0
- package/docs/monitor.md +648 -0
- package/docs/services.md +496 -0
- package/docs/storage.md +1884 -0
- package/docs/wallet.md +6812 -0
- package/jest.config.ts +29 -0
- package/knexfile.js +9 -0
- package/license.md +1 -0
- package/out/src/Wallet.d.ts +83 -0
- package/out/src/Wallet.d.ts.map +1 -0
- package/out/src/Wallet.js +415 -0
- package/out/src/Wallet.js.map +1 -0
- package/out/src/index.all.d.ts +9 -0
- package/out/src/index.all.d.ts.map +1 -0
- package/out/src/index.all.js +48 -0
- package/out/src/index.all.js.map +1 -0
- package/out/src/index.client.d.ts +8 -0
- package/out/src/index.client.d.ts.map +1 -0
- package/out/src/index.client.js +47 -0
- package/out/src/index.client.js.map +1 -0
- package/out/src/index.d.ts +3 -0
- package/out/src/index.d.ts.map +1 -0
- package/out/src/index.js +42 -0
- package/out/src/index.js.map +1 -0
- package/out/src/monitor/Monitor.d.ts +89 -0
- package/out/src/monitor/Monitor.d.ts.map +1 -0
- package/out/src/monitor/Monitor.js +253 -0
- package/out/src/monitor/Monitor.js.map +1 -0
- package/out/src/monitor/MonitorDaemon.d.ts +30 -0
- package/out/src/monitor/MonitorDaemon.d.ts.map +1 -0
- package/out/src/monitor/MonitorDaemon.js +135 -0
- package/out/src/monitor/MonitorDaemon.js.map +1 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.d.ts +2 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.d.ts.map +1 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.js +50 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.js.map +1 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +53 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.js +197 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -0
- package/out/src/monitor/tasks/TaskClock.d.ts +14 -0
- package/out/src/monitor/tasks/TaskClock.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskClock.js +27 -0
- package/out/src/monitor/tasks/TaskClock.js.map +1 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts +20 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.js +52 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -0
- package/out/src/monitor/tasks/TaskNewHeader.d.ts +15 -0
- package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskNewHeader.js +45 -0
- package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -0
- package/out/src/monitor/tasks/TaskPurge.d.ts +45 -0
- package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskPurge.js +35 -0
- package/out/src/monitor/tasks/TaskPurge.js.map +1 -0
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts +26 -0
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskReviewStatus.js +44 -0
- package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -0
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts +32 -0
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskSendWaiting.js +99 -0
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts +12 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.js +22 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.js.map +1 -0
- package/out/src/monitor/tasks/WalletMonitorTask.d.ts +40 -0
- package/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +1 -0
- package/out/src/monitor/tasks/WalletMonitorTask.js +37 -0
- package/out/src/monitor/tasks/WalletMonitorTask.js.map +1 -0
- package/out/src/sdk/CertOps.d.ts +66 -0
- package/out/src/sdk/CertOps.d.ts.map +1 -0
- package/out/src/sdk/CertOps.js +198 -0
- package/out/src/sdk/CertOps.js.map +1 -0
- package/out/src/sdk/PrivilegedKeyManager.d.ts +125 -0
- package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -0
- package/out/src/sdk/PrivilegedKeyManager.js +293 -0
- package/out/src/sdk/PrivilegedKeyManager.js.map +1 -0
- package/out/src/sdk/StorageSyncReader.d.ts +121 -0
- package/out/src/sdk/StorageSyncReader.d.ts.map +1 -0
- package/out/src/sdk/StorageSyncReader.js +3 -0
- package/out/src/sdk/StorageSyncReader.js.map +1 -0
- package/out/src/sdk/StorageSyncReaderWriter.d.ts +89 -0
- package/out/src/sdk/StorageSyncReaderWriter.d.ts.map +1 -0
- package/out/src/sdk/StorageSyncReaderWriter.js +3 -0
- package/out/src/sdk/StorageSyncReaderWriter.js.map +1 -0
- package/out/src/sdk/WERR_errors.d.ts +90 -0
- package/out/src/sdk/WERR_errors.d.ts.map +1 -0
- package/out/src/sdk/WERR_errors.js +128 -0
- package/out/src/sdk/WERR_errors.js.map +1 -0
- package/out/src/sdk/WalletError.d.ts +45 -0
- package/out/src/sdk/WalletError.d.ts.map +1 -0
- package/out/src/sdk/WalletError.js +122 -0
- package/out/src/sdk/WalletError.js.map +1 -0
- package/out/src/sdk/WalletServices.interfaces.d.ts +325 -0
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -0
- package/out/src/sdk/WalletServices.interfaces.js +3 -0
- package/out/src/sdk/WalletServices.interfaces.js.map +1 -0
- package/out/src/sdk/WalletSigner.interfaces.d.ts +10 -0
- package/out/src/sdk/WalletSigner.interfaces.d.ts.map +1 -0
- package/out/src/sdk/WalletSigner.interfaces.js +3 -0
- package/out/src/sdk/WalletSigner.interfaces.js.map +1 -0
- package/out/src/sdk/WalletStorage.interfaces.d.ts +299 -0
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -0
- package/out/src/sdk/WalletStorage.interfaces.js +3 -0
- package/out/src/sdk/WalletStorage.interfaces.js.map +1 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.d.ts +2 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.d.ts.map +1 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.js +125 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.js.map +1 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.d.ts +2 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.d.ts.map +1 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.js +660 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.js.map +1 -0
- package/out/src/sdk/index.d.ts +12 -0
- package/out/src/sdk/index.d.ts.map +1 -0
- package/out/src/sdk/index.js +28 -0
- package/out/src/sdk/index.js.map +1 -0
- package/out/src/sdk/types.d.ts +74 -0
- package/out/src/sdk/types.d.ts.map +1 -0
- package/out/src/sdk/types.js +20 -0
- package/out/src/sdk/types.js.map +1 -0
- package/out/src/sdk/validationHelpers.d.ts +288 -0
- package/out/src/sdk/validationHelpers.d.ts.map +1 -0
- package/out/src/sdk/validationHelpers.js +630 -0
- package/out/src/sdk/validationHelpers.js.map +1 -0
- package/out/src/services/ServiceCollection.d.ts +25 -0
- package/out/src/services/ServiceCollection.d.ts.map +1 -0
- package/out/src/services/ServiceCollection.js +43 -0
- package/out/src/services/ServiceCollection.js.map +1 -0
- package/out/src/services/Services.d.ts +60 -0
- package/out/src/services/Services.d.ts.map +1 -0
- package/out/src/services/Services.js +342 -0
- package/out/src/services/Services.js.map +1 -0
- package/out/src/services/__tests/getMerklePath.test.d.ts +2 -0
- package/out/src/services/__tests/getMerklePath.test.d.ts.map +1 -0
- package/out/src/services/__tests/getMerklePath.test.js +16 -0
- package/out/src/services/__tests/getMerklePath.test.js.map +1 -0
- package/out/src/services/__tests/getRawTx.test.d.ts +2 -0
- package/out/src/services/__tests/getRawTx.test.d.ts.map +1 -0
- package/out/src/services/__tests/getRawTx.test.js +13 -0
- package/out/src/services/__tests/getRawTx.test.js.map +1 -0
- package/out/src/services/__tests/postBeef.test.d.ts +2 -0
- package/out/src/services/__tests/postBeef.test.d.ts.map +1 -0
- package/out/src/services/__tests/postBeef.test.js +18 -0
- package/out/src/services/__tests/postBeef.test.js.map +1 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.d.ts +2 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.d.ts.map +1 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.js +479 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.js.map +1 -0
- package/out/src/services/__tests/postTxs.test.d.ts +2 -0
- package/out/src/services/__tests/postTxs.test.d.ts.map +1 -0
- package/out/src/services/__tests/postTxs.test.js +19 -0
- package/out/src/services/__tests/postTxs.test.js.map +1 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts +15 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.js +51 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.d.ts +2 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.d.ts.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.js +19 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.js.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.d.ts +2 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.d.ts.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.js +29 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.js.map +1 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts +98 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts.map +1 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js +38 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js.map +1 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts +36 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +130 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -0
- package/out/src/services/chaintracker/chaintracks/index.d.ts +3 -0
- package/out/src/services/chaintracker/chaintracks/index.d.ts.map +1 -0
- package/out/src/services/chaintracker/chaintracks/index.js +19 -0
- package/out/src/services/chaintracker/chaintracks/index.js.map +1 -0
- package/out/src/services/chaintracker/index.d.ts +3 -0
- package/out/src/services/chaintracker/index.d.ts.map +1 -0
- package/out/src/services/chaintracker/index.js +19 -0
- package/out/src/services/chaintracker/index.js.map +1 -0
- package/out/src/services/createDefaultWalletServicesOptions.d.ts +3 -0
- package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -0
- package/out/src/services/createDefaultWalletServicesOptions.js +34 -0
- package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -0
- package/out/src/services/index.d.ts +2 -0
- package/out/src/services/index.d.ts.map +1 -0
- package/out/src/services/index.js +18 -0
- package/out/src/services/index.js.map +1 -0
- package/out/src/services/providers/arcServices.d.ts +62 -0
- package/out/src/services/providers/arcServices.d.ts.map +1 -0
- package/out/src/services/providers/arcServices.js +368 -0
- package/out/src/services/providers/arcServices.js.map +1 -0
- package/out/src/services/providers/echangeRates.d.ts +12 -0
- package/out/src/services/providers/echangeRates.d.ts.map +1 -0
- package/out/src/services/providers/echangeRates.js +237 -0
- package/out/src/services/providers/echangeRates.js.map +1 -0
- package/out/src/services/providers/whatsonchain.d.ts +17 -0
- package/out/src/services/providers/whatsonchain.d.ts.map +1 -0
- package/out/src/services/providers/whatsonchain.js +130 -0
- package/out/src/services/providers/whatsonchain.js.map +1 -0
- package/out/src/signer/WalletSigner.d.ts +11 -0
- package/out/src/signer/WalletSigner.d.ts.map +1 -0
- package/out/src/signer/WalletSigner.js +13 -0
- package/out/src/signer/WalletSigner.js.map +1 -0
- package/out/src/signer/methods/acquireDirectCertificate.d.ts +4 -0
- package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -0
- package/out/src/signer/methods/acquireDirectCertificate.js +47 -0
- package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -0
- package/out/src/signer/methods/createAction.d.ts +7 -0
- package/out/src/signer/methods/createAction.d.ts.map +1 -0
- package/out/src/signer/methods/createAction.js +250 -0
- package/out/src/signer/methods/createAction.js.map +1 -0
- package/out/src/signer/methods/internalizeAction.d.ts +31 -0
- package/out/src/signer/methods/internalizeAction.d.ts.map +1 -0
- package/out/src/signer/methods/internalizeAction.js +95 -0
- package/out/src/signer/methods/internalizeAction.js.map +1 -0
- package/out/src/signer/methods/proveCertificate.d.ts +4 -0
- package/out/src/signer/methods/proveCertificate.d.ts.map +1 -0
- package/out/src/signer/methods/proveCertificate.js +45 -0
- package/out/src/signer/methods/proveCertificate.js.map +1 -0
- package/out/src/signer/methods/signAction.d.ts +6 -0
- package/out/src/signer/methods/signAction.d.ts.map +1 -0
- package/out/src/signer/methods/signAction.js +79 -0
- package/out/src/signer/methods/signAction.js.map +1 -0
- package/out/src/storage/StorageKnex.d.ts +176 -0
- package/out/src/storage/StorageKnex.d.ts.map +1 -0
- package/out/src/storage/StorageKnex.js +1035 -0
- package/out/src/storage/StorageKnex.js.map +1 -0
- package/out/src/storage/StorageProvider.d.ts +140 -0
- package/out/src/storage/StorageProvider.d.ts.map +1 -0
- package/out/src/storage/StorageProvider.js +539 -0
- package/out/src/storage/StorageProvider.js.map +1 -0
- package/out/src/storage/StorageReader.d.ts +76 -0
- package/out/src/storage/StorageReader.d.ts.map +1 -0
- package/out/src/storage/StorageReader.js +124 -0
- package/out/src/storage/StorageReader.js.map +1 -0
- package/out/src/storage/StorageReaderWriter.d.ts +87 -0
- package/out/src/storage/StorageReaderWriter.d.ts.map +1 -0
- package/out/src/storage/StorageReaderWriter.js +337 -0
- package/out/src/storage/StorageReaderWriter.js.map +1 -0
- package/out/src/storage/StorageSyncReader.d.ts +33 -0
- package/out/src/storage/StorageSyncReader.d.ts.map +1 -0
- package/out/src/storage/StorageSyncReader.js +142 -0
- package/out/src/storage/StorageSyncReader.js.map +1 -0
- package/out/src/storage/WalletStorageManager.d.ts +103 -0
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -0
- package/out/src/storage/WalletStorageManager.js +408 -0
- package/out/src/storage/WalletStorageManager.js.map +1 -0
- package/out/src/storage/__test/WalletStorageManager.test.d.ts +2 -0
- package/out/src/storage/__test/WalletStorageManager.test.d.ts.map +1 -0
- package/out/src/storage/__test/WalletStorageManager.test.js +260 -0
- package/out/src/storage/__test/WalletStorageManager.test.js.map +1 -0
- package/out/src/storage/index.all.d.ts +11 -0
- package/out/src/storage/index.all.d.ts.map +1 -0
- package/out/src/storage/index.all.js +50 -0
- package/out/src/storage/index.all.js.map +1 -0
- package/out/src/storage/index.client.d.ts +7 -0
- package/out/src/storage/index.client.d.ts.map +1 -0
- package/out/src/storage/index.client.js +46 -0
- package/out/src/storage/index.client.js.map +1 -0
- package/out/src/storage/index.db.d.ts +1 -0
- package/out/src/storage/index.db.d.ts.map +1 -0
- package/out/src/storage/index.db.js +2 -0
- package/out/src/storage/index.db.js.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.d.ts +2 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.d.ts.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js +948 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.d.ts +2 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.d.ts.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js +35 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js.map +1 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +27 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +148 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -0
- package/out/src/storage/methods/createAction.d.ts +23 -0
- package/out/src/storage/methods/createAction.d.ts.map +1 -0
- package/out/src/storage/methods/createAction.js +663 -0
- package/out/src/storage/methods/createAction.js.map +1 -0
- package/out/src/storage/methods/generateChange.d.ts +108 -0
- package/out/src/storage/methods/generateChange.d.ts.map +1 -0
- package/out/src/storage/methods/generateChange.js +422 -0
- package/out/src/storage/methods/generateChange.js.map +1 -0
- package/out/src/storage/methods/getBeefForTransaction.d.ts +22 -0
- package/out/src/storage/methods/getBeefForTransaction.d.ts.map +1 -0
- package/out/src/storage/methods/getBeefForTransaction.js +94 -0
- package/out/src/storage/methods/getBeefForTransaction.js.map +1 -0
- package/out/src/storage/methods/getSyncChunk.d.ts +10 -0
- package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -0
- package/out/src/storage/methods/getSyncChunk.js +271 -0
- package/out/src/storage/methods/getSyncChunk.js.map +1 -0
- package/out/src/storage/methods/internalizeAction.d.ts +38 -0
- package/out/src/storage/methods/internalizeAction.d.ts.map +1 -0
- package/out/src/storage/methods/internalizeAction.js +378 -0
- package/out/src/storage/methods/internalizeAction.js.map +1 -0
- package/out/src/storage/methods/listActions.d.ts +5 -0
- package/out/src/storage/methods/listActions.d.ts.map +1 -0
- package/out/src/storage/methods/listActions.js +174 -0
- package/out/src/storage/methods/listActions.js.map +1 -0
- package/out/src/storage/methods/listCertificates.d.ts +5 -0
- package/out/src/storage/methods/listCertificates.d.ts.map +1 -0
- package/out/src/storage/methods/listCertificates.js +68 -0
- package/out/src/storage/methods/listCertificates.js.map +1 -0
- package/out/src/storage/methods/listOutputs.d.ts +5 -0
- package/out/src/storage/methods/listOutputs.d.ts.map +1 -0
- package/out/src/storage/methods/listOutputs.js +189 -0
- package/out/src/storage/methods/listOutputs.js.map +1 -0
- package/out/src/storage/methods/processAction.d.ts +35 -0
- package/out/src/storage/methods/processAction.d.ts.map +1 -0
- package/out/src/storage/methods/processAction.js +271 -0
- package/out/src/storage/methods/processAction.js.map +1 -0
- package/out/src/storage/methods/purgeData.d.ts +4 -0
- package/out/src/storage/methods/purgeData.d.ts.map +1 -0
- package/out/src/storage/methods/purgeData.js +229 -0
- package/out/src/storage/methods/purgeData.js.map +1 -0
- package/out/src/storage/methods/reviewStatus.d.ts +9 -0
- package/out/src/storage/methods/reviewStatus.d.ts.map +1 -0
- package/out/src/storage/methods/reviewStatus.js +75 -0
- package/out/src/storage/methods/reviewStatus.js.map +1 -0
- package/out/src/storage/remoting/StorageClient.d.ts +56 -0
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -0
- package/out/src/storage/remoting/StorageClient.js +181 -0
- package/out/src/storage/remoting/StorageClient.js.map +1 -0
- package/out/src/storage/remoting/StorageServer.d.ts +26 -0
- package/out/src/storage/remoting/StorageServer.d.ts.map +1 -0
- package/out/src/storage/remoting/StorageServer.js +144 -0
- package/out/src/storage/remoting/StorageServer.js.map +1 -0
- package/out/src/storage/schema/KnexMigrations.d.ts +39 -0
- package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -0
- package/out/src/storage/schema/KnexMigrations.js +442 -0
- package/out/src/storage/schema/KnexMigrations.js.map +1 -0
- package/out/src/storage/schema/entities/Certificate.d.ts +43 -0
- package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Certificate.js +162 -0
- package/out/src/storage/schema/entities/Certificate.js.map +1 -0
- package/out/src/storage/schema/entities/CertificateField.d.ts +32 -0
- package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -0
- package/out/src/storage/schema/entities/CertificateField.js +114 -0
- package/out/src/storage/schema/entities/CertificateField.js.map +1 -0
- package/out/src/storage/schema/entities/Commission.d.ts +37 -0
- package/out/src/storage/schema/entities/Commission.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Commission.js +130 -0
- package/out/src/storage/schema/entities/Commission.js.map +1 -0
- package/out/src/storage/schema/entities/EntityBase.d.ts +105 -0
- package/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -0
- package/out/src/storage/schema/entities/EntityBase.js +100 -0
- package/out/src/storage/schema/entities/EntityBase.js.map +1 -0
- package/out/src/storage/schema/entities/MergeEntity.d.ts +34 -0
- package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -0
- package/out/src/storage/schema/entities/MergeEntity.js +57 -0
- package/out/src/storage/schema/entities/MergeEntity.js.map +1 -0
- package/out/src/storage/schema/entities/Output.d.ts +67 -0
- package/out/src/storage/schema/entities/Output.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Output.js +281 -0
- package/out/src/storage/schema/entities/Output.js.map +1 -0
- package/out/src/storage/schema/entities/OutputBasket.d.ts +35 -0
- package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -0
- package/out/src/storage/schema/entities/OutputBasket.js +133 -0
- package/out/src/storage/schema/entities/OutputBasket.js.map +1 -0
- package/out/src/storage/schema/entities/OutputTag.d.ts +31 -0
- package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -0
- package/out/src/storage/schema/entities/OutputTag.js +104 -0
- package/out/src/storage/schema/entities/OutputTag.js.map +1 -0
- package/out/src/storage/schema/entities/OutputTagMap.d.ts +28 -0
- package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -0
- package/out/src/storage/schema/entities/OutputTagMap.js +101 -0
- package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -0
- package/out/src/storage/schema/entities/ProvenTx.d.ts +84 -0
- package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -0
- package/out/src/storage/schema/entities/ProvenTx.js +283 -0
- package/out/src/storage/schema/entities/ProvenTx.js.map +1 -0
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts +130 -0
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -0
- package/out/src/storage/schema/entities/ProvenTxReq.js +521 -0
- package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -0
- package/out/src/storage/schema/entities/SyncState.d.ts +66 -0
- package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -0
- package/out/src/storage/schema/entities/SyncState.js +284 -0
- package/out/src/storage/schema/entities/SyncState.js.map +1 -0
- package/out/src/storage/schema/entities/Transaction.d.ts +67 -0
- package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Transaction.js +264 -0
- package/out/src/storage/schema/entities/Transaction.js.map +1 -0
- package/out/src/storage/schema/entities/TxLabel.d.ts +31 -0
- package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -0
- package/out/src/storage/schema/entities/TxLabel.js +104 -0
- package/out/src/storage/schema/entities/TxLabel.js.map +1 -0
- package/out/src/storage/schema/entities/TxLabelMap.d.ts +28 -0
- package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -0
- package/out/src/storage/schema/entities/TxLabelMap.js +103 -0
- package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -0
- package/out/src/storage/schema/entities/User.d.ts +29 -0
- package/out/src/storage/schema/entities/User.d.ts.map +1 -0
- package/out/src/storage/schema/entities/User.js +100 -0
- package/out/src/storage/schema/entities/User.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js +588 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js +449 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js +602 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js +515 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js +478 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js +440 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js +626 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js +585 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +628 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js +307 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +823 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js +442 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js +313 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.js +81 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.js +418 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/index.d.ts +17 -0
- package/out/src/storage/schema/entities/index.d.ts.map +1 -0
- package/out/src/storage/schema/entities/index.js +33 -0
- package/out/src/storage/schema/entities/index.js.map +1 -0
- package/out/src/storage/schema/tables/Certificate.d.ts +20 -0
- package/out/src/storage/schema/tables/Certificate.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Certificate.js +3 -0
- package/out/src/storage/schema/tables/Certificate.js.map +1 -0
- package/out/src/storage/schema/tables/CertificateField.d.ts +12 -0
- package/out/src/storage/schema/tables/CertificateField.d.ts.map +1 -0
- package/out/src/storage/schema/tables/CertificateField.js +3 -0
- package/out/src/storage/schema/tables/CertificateField.js.map +1 -0
- package/out/src/storage/schema/tables/Commission.d.ts +13 -0
- package/out/src/storage/schema/tables/Commission.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Commission.js +3 -0
- package/out/src/storage/schema/tables/Commission.js.map +1 -0
- package/out/src/storage/schema/tables/MonitorEvent.d.ts +9 -0
- package/out/src/storage/schema/tables/MonitorEvent.d.ts.map +1 -0
- package/out/src/storage/schema/tables/MonitorEvent.js +3 -0
- package/out/src/storage/schema/tables/MonitorEvent.js.map +1 -0
- package/out/src/storage/schema/tables/Output.d.ts +36 -0
- package/out/src/storage/schema/tables/Output.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Output.js +31 -0
- package/out/src/storage/schema/tables/Output.js.map +1 -0
- package/out/src/storage/schema/tables/OutputBasket.d.ts +12 -0
- package/out/src/storage/schema/tables/OutputBasket.d.ts.map +1 -0
- package/out/src/storage/schema/tables/OutputBasket.js +3 -0
- package/out/src/storage/schema/tables/OutputBasket.js.map +1 -0
- package/out/src/storage/schema/tables/OutputTag.d.ts +10 -0
- package/out/src/storage/schema/tables/OutputTag.d.ts.map +1 -0
- package/out/src/storage/schema/tables/OutputTag.js +3 -0
- package/out/src/storage/schema/tables/OutputTag.js.map +1 -0
- package/out/src/storage/schema/tables/OutputTagMap.d.ts +9 -0
- package/out/src/storage/schema/tables/OutputTagMap.d.ts.map +1 -0
- package/out/src/storage/schema/tables/OutputTagMap.js +3 -0
- package/out/src/storage/schema/tables/OutputTagMap.js.map +1 -0
- package/out/src/storage/schema/tables/ProvenTx.d.ts +14 -0
- package/out/src/storage/schema/tables/ProvenTx.d.ts.map +1 -0
- package/out/src/storage/schema/tables/ProvenTx.js +3 -0
- package/out/src/storage/schema/tables/ProvenTx.js.map +1 -0
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts +64 -0
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts.map +1 -0
- package/out/src/storage/schema/tables/ProvenTxReq.js +3 -0
- package/out/src/storage/schema/tables/ProvenTxReq.js.map +1 -0
- package/out/src/storage/schema/tables/Settings.d.ts +17 -0
- package/out/src/storage/schema/tables/Settings.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Settings.js +3 -0
- package/out/src/storage/schema/tables/Settings.js.map +1 -0
- package/out/src/storage/schema/tables/SyncState.d.ts +18 -0
- package/out/src/storage/schema/tables/SyncState.d.ts.map +1 -0
- package/out/src/storage/schema/tables/SyncState.js +3 -0
- package/out/src/storage/schema/tables/SyncState.js.map +1 -0
- package/out/src/storage/schema/tables/Transaction.d.ts +37 -0
- package/out/src/storage/schema/tables/Transaction.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Transaction.js +21 -0
- package/out/src/storage/schema/tables/Transaction.js.map +1 -0
- package/out/src/storage/schema/tables/TxLabel.d.ts +10 -0
- package/out/src/storage/schema/tables/TxLabel.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TxLabel.js +3 -0
- package/out/src/storage/schema/tables/TxLabel.js.map +1 -0
- package/out/src/storage/schema/tables/TxLabelMap.d.ts +9 -0
- package/out/src/storage/schema/tables/TxLabelMap.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TxLabelMap.js +3 -0
- package/out/src/storage/schema/tables/TxLabelMap.js.map +1 -0
- package/out/src/storage/schema/tables/User.d.ts +16 -0
- package/out/src/storage/schema/tables/User.d.ts.map +1 -0
- package/out/src/storage/schema/tables/User.js +3 -0
- package/out/src/storage/schema/tables/User.js.map +1 -0
- package/out/src/storage/schema/tables/index.d.ts +17 -0
- package/out/src/storage/schema/tables/index.d.ts.map +1 -0
- package/out/src/storage/schema/tables/index.js +33 -0
- package/out/src/storage/schema/tables/index.js.map +1 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts +71 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.js +612 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -0
- package/out/src/storage/sync/index.d.ts +2 -0
- package/out/src/storage/sync/index.d.ts.map +1 -0
- package/out/src/storage/sync/index.js +18 -0
- package/out/src/storage/sync/index.js.map +1 -0
- package/out/src/utility/ScriptTemplateSABPPP.d.ts +25 -0
- package/out/src/utility/ScriptTemplateSABPPP.d.ts.map +1 -0
- package/out/src/utility/ScriptTemplateSABPPP.js +46 -0
- package/out/src/utility/ScriptTemplateSABPPP.js.map +1 -0
- package/out/src/utility/index.all.d.ts +7 -0
- package/out/src/utility/index.all.d.ts.map +1 -0
- package/out/src/utility/index.all.js +23 -0
- package/out/src/utility/index.all.js.map +1 -0
- package/out/src/utility/index.client.d.ts +7 -0
- package/out/src/utility/index.client.d.ts.map +1 -0
- package/out/src/utility/index.client.js +23 -0
- package/out/src/utility/index.client.js.map +1 -0
- package/out/src/utility/parseTxScriptOffsets.d.ts +14 -0
- package/out/src/utility/parseTxScriptOffsets.d.ts.map +1 -0
- package/out/src/utility/parseTxScriptOffsets.js +26 -0
- package/out/src/utility/parseTxScriptOffsets.js.map +1 -0
- package/out/src/utility/stampLog.d.ts +18 -0
- package/out/src/utility/stampLog.d.ts.map +1 -0
- package/out/src/utility/stampLog.js +72 -0
- package/out/src/utility/stampLog.js.map +1 -0
- package/out/src/utility/tscProofToMerklePath.d.ts +8 -0
- package/out/src/utility/tscProofToMerklePath.d.ts.map +1 -0
- package/out/src/utility/tscProofToMerklePath.js +41 -0
- package/out/src/utility/tscProofToMerklePath.js.map +1 -0
- package/out/src/utility/utilityHelpers.buffer.d.ts +18 -0
- package/out/src/utility/utilityHelpers.buffer.d.ts.map +1 -0
- package/out/src/utility/utilityHelpers.buffer.js +45 -0
- package/out/src/utility/utilityHelpers.buffer.js.map +1 -0
- package/out/src/utility/utilityHelpers.d.ts +129 -0
- package/out/src/utility/utilityHelpers.d.ts.map +1 -0
- package/out/src/utility/utilityHelpers.js +268 -0
- package/out/src/utility/utilityHelpers.js.map +1 -0
- package/out/src/utility/utilityHelpers.noBuffer.d.ts +9 -0
- package/out/src/utility/utilityHelpers.noBuffer.d.ts.map +1 -0
- package/out/src/utility/utilityHelpers.noBuffer.js +23 -0
- package/out/src/utility/utilityHelpers.noBuffer.js.map +1 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.d.ts +2 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.d.ts.map +1 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.js +45 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.js.map +1 -0
- package/out/test/Wallet/action/internalizeAction.a.test.d.ts +2 -0
- package/out/test/Wallet/action/internalizeAction.a.test.d.ts.map +1 -0
- package/out/test/Wallet/action/internalizeAction.a.test.js +243 -0
- package/out/test/Wallet/action/internalizeAction.a.test.js.map +1 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.d.ts +2 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.d.ts.map +1 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.js +213 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.js.map +1 -0
- package/out/test/Wallet/certificate/listCertificates.test.d.ts +2 -0
- package/out/test/Wallet/certificate/listCertificates.test.d.ts.map +1 -0
- package/out/test/Wallet/certificate/listCertificates.test.js +305 -0
- package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.d.ts +2 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.js +68 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.js.map +1 -0
- package/out/test/Wallet/get/getHeight.test.d.ts +2 -0
- package/out/test/Wallet/get/getHeight.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getHeight.test.js +45 -0
- package/out/test/Wallet/get/getHeight.test.js.map +1 -0
- package/out/test/Wallet/get/getKnownTxids.test.d.ts +2 -0
- package/out/test/Wallet/get/getKnownTxids.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getKnownTxids.test.js +73 -0
- package/out/test/Wallet/get/getKnownTxids.test.js.map +1 -0
- package/out/test/Wallet/get/getNetwork.test.d.ts +2 -0
- package/out/test/Wallet/get/getNetwork.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getNetwork.test.js +26 -0
- package/out/test/Wallet/get/getNetwork.test.js.map +1 -0
- package/out/test/Wallet/get/getVersion.test.d.ts +2 -0
- package/out/test/Wallet/get/getVersion.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getVersion.test.js +25 -0
- package/out/test/Wallet/get/getVersion.test.js.map +1 -0
- package/out/test/Wallet/live/walletLive.man.test.d.ts +26 -0
- package/out/test/Wallet/live/walletLive.man.test.d.ts.map +1 -0
- package/out/test/Wallet/live/walletLive.man.test.js +389 -0
- package/out/test/Wallet/live/walletLive.man.test.js.map +1 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.d.ts +2 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.d.ts.map +1 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js +153 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js.map +1 -0
- package/out/test/checkDB.d.ts +4 -0
- package/out/test/checkDB.d.ts.map +1 -0
- package/out/test/checkDB.js +55 -0
- package/out/test/checkDB.js.map +1 -0
- package/out/test/examples/README.man.test.d.ts +2 -0
- package/out/test/examples/README.man.test.d.ts.map +1 -0
- package/out/test/examples/README.man.test.js +46 -0
- package/out/test/examples/README.man.test.js.map +1 -0
- package/out/test/monitor/Monitor.test.d.ts +2 -0
- package/out/test/monitor/Monitor.test.d.ts.map +1 -0
- package/out/test/monitor/Monitor.test.js +446 -0
- package/out/test/monitor/Monitor.test.js.map +1 -0
- package/out/test/services/Services.test.d.ts +2 -0
- package/out/test/services/Services.test.d.ts.map +1 -0
- package/out/test/services/Services.test.js +128 -0
- package/out/test/services/Services.test.js.map +1 -0
- package/out/test/storage/KnexMigrations.test.d.ts +2 -0
- package/out/test/storage/KnexMigrations.test.d.ts.map +1 -0
- package/out/test/storage/KnexMigrations.test.js +81 -0
- package/out/test/storage/KnexMigrations.test.js.map +1 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.d.ts +2 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.d.ts.map +1 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.js +88 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -0
- package/out/test/storage/count.test.d.ts +2 -0
- package/out/test/storage/count.test.d.ts.map +1 -0
- package/out/test/storage/count.test.js +141 -0
- package/out/test/storage/count.test.js.map +1 -0
- package/out/test/storage/find.test.d.ts +2 -0
- package/out/test/storage/find.test.d.ts.map +1 -0
- package/out/test/storage/find.test.js +148 -0
- package/out/test/storage/find.test.js.map +1 -0
- package/out/test/storage/findLegacy.test.d.ts +2 -0
- package/out/test/storage/findLegacy.test.d.ts.map +1 -0
- package/out/test/storage/findLegacy.test.js +52 -0
- package/out/test/storage/findLegacy.test.js.map +1 -0
- package/out/test/storage/insert.test.d.ts +2 -0
- package/out/test/storage/insert.test.d.ts.map +1 -0
- package/out/test/storage/insert.test.js +256 -0
- package/out/test/storage/insert.test.js.map +1 -0
- package/out/test/storage/update.test.d.ts +2 -0
- package/out/test/storage/update.test.d.ts.map +1 -0
- package/out/test/storage/update.test.js +926 -0
- package/out/test/storage/update.test.js.map +1 -0
- package/out/test/storage/update2.test.d.ts +2 -0
- package/out/test/storage/update2.test.d.ts.map +1 -0
- package/out/test/storage/update2.test.js +766 -0
- package/out/test/storage/update2.test.js.map +1 -0
- package/out/test/utils/TestUtilsWalletStorage.d.ts +399 -0
- package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -0
- package/out/test/utils/TestUtilsWalletStorage.js +1337 -0
- package/out/test/utils/TestUtilsWalletStorage.js.map +1 -0
- package/out/test/wallet/action/abortAction.test.d.ts +2 -0
- package/out/test/wallet/action/abortAction.test.d.ts.map +1 -0
- package/out/test/wallet/action/abortAction.test.js +44 -0
- package/out/test/wallet/action/abortAction.test.js.map +1 -0
- package/out/test/wallet/action/createAction.test.d.ts +2 -0
- package/out/test/wallet/action/createAction.test.d.ts.map +1 -0
- package/out/test/wallet/action/createAction.test.js +230 -0
- package/out/test/wallet/action/createAction.test.js.map +1 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.d.ts +2 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.d.ts.map +1 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js +273 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -0
- package/out/test/wallet/action/internalizeAction.test.d.ts +2 -0
- package/out/test/wallet/action/internalizeAction.test.d.ts.map +1 -0
- package/out/test/wallet/action/internalizeAction.test.js +603 -0
- package/out/test/wallet/action/internalizeAction.test.js.map +1 -0
- package/out/test/wallet/action/relinquishOutput.test.d.ts +2 -0
- package/out/test/wallet/action/relinquishOutput.test.d.ts.map +1 -0
- package/out/test/wallet/action/relinquishOutput.test.js +31 -0
- package/out/test/wallet/action/relinquishOutput.test.js.map +1 -0
- package/out/test/wallet/construct/Wallet.constructor.test.d.ts +2 -0
- package/out/test/wallet/construct/Wallet.constructor.test.d.ts.map +1 -0
- package/out/test/wallet/construct/Wallet.constructor.test.js +49 -0
- package/out/test/wallet/construct/Wallet.constructor.test.js.map +1 -0
- package/out/test/wallet/list/listActions.test.d.ts +2 -0
- package/out/test/wallet/list/listActions.test.d.ts.map +1 -0
- package/out/test/wallet/list/listActions.test.js +265 -0
- package/out/test/wallet/list/listActions.test.js.map +1 -0
- package/out/test/wallet/list/listActions2.test.d.ts +2 -0
- package/out/test/wallet/list/listActions2.test.d.ts.map +1 -0
- package/out/test/wallet/list/listActions2.test.js +423 -0
- package/out/test/wallet/list/listActions2.test.js.map +1 -0
- package/out/test/wallet/list/listCertificates.test.d.ts +2 -0
- package/out/test/wallet/list/listCertificates.test.d.ts.map +1 -0
- package/out/test/wallet/list/listCertificates.test.js +115 -0
- package/out/test/wallet/list/listCertificates.test.js.map +1 -0
- package/out/test/wallet/list/listOutputs.test.d.ts +2 -0
- package/out/test/wallet/list/listOutputs.test.d.ts.map +1 -0
- package/out/test/wallet/list/listOutputs.test.js +521 -0
- package/out/test/wallet/list/listOutputs.test.js.map +1 -0
- package/out/test/wallet/sync/Wallet.sync.test.d.ts +2 -0
- package/out/test/wallet/sync/Wallet.sync.test.d.ts.map +1 -0
- package/out/test/wallet/sync/Wallet.sync.test.js +142 -0
- package/out/test/wallet/sync/Wallet.sync.test.js.map +1 -0
- package/out/tsconfig.all.tsbuildinfo +1 -0
- package/package.json +63 -0
- package/src/Wallet.ts +771 -0
- package/src/index.all.ts +8 -0
- package/src/index.client.ts +7 -0
- package/src/index.ts +2 -0
- package/src/monitor/Monitor.ts +317 -0
- package/src/monitor/MonitorDaemon.ts +197 -0
- package/src/monitor/README.md +3 -0
- package/src/monitor/__test/MonitorDaemon.man.test.ts +17 -0
- package/src/monitor/tasks/TaskCheckForProofs.ts +235 -0
- package/src/monitor/tasks/TaskClock.ts +35 -0
- package/src/monitor/tasks/TaskFailAbandoned.ts +56 -0
- package/src/monitor/tasks/TaskNewHeader.ts +48 -0
- package/src/monitor/tasks/TaskPurge.ts +69 -0
- package/src/monitor/tasks/TaskReviewStatus.ts +51 -0
- package/src/monitor/tasks/TaskSendWaiting.ts +107 -0
- package/src/monitor/tasks/TaskSyncWhenIdle.ts +26 -0
- package/src/monitor/tasks/WalletMonitorTask.ts +47 -0
- package/src/sdk/CertOps.ts +346 -0
- package/src/sdk/PrivilegedKeyManager.ts +402 -0
- package/src/sdk/README.md +13 -0
- package/src/sdk/StorageSyncReader.ts +155 -0
- package/src/sdk/StorageSyncReaderWriter.ts +263 -0
- package/src/sdk/WERR_errors.ts +152 -0
- package/src/sdk/WalletError.ts +136 -0
- package/src/sdk/WalletServices.interfaces.ts +399 -0
- package/src/sdk/WalletSigner.interfaces.ts +38 -0
- package/src/sdk/WalletStorage.interfaces.ts +416 -0
- package/src/sdk/__test/CertificateLifeCycle.test.ts +194 -0
- package/src/sdk/__test/PrivilegedKeyManager.test.ts +775 -0
- package/src/sdk/index.ts +11 -0
- package/src/sdk/types.ts +115 -0
- package/src/sdk/validationHelpers.ts +1248 -0
- package/src/services/README.md +11 -0
- package/src/services/ServiceCollection.ts +50 -0
- package/src/services/Services.ts +461 -0
- package/src/services/__tests/getMerklePath.test.ts +16 -0
- package/src/services/__tests/getRawTx.test.ts +15 -0
- package/src/services/__tests/postBeef.test.ts +19 -0
- package/src/services/__tests/postBeefToArcTaal.test.ts +487 -0
- package/src/services/__tests/postTxs.test.ts +20 -0
- package/src/services/chaintracker/ChaintracksChainTracker.ts +78 -0
- package/src/services/chaintracker/__tests/ChaintracksChainTracker.test.ts +25 -0
- package/src/services/chaintracker/__tests/ChaintracksServiceClient.test.ts +32 -0
- package/src/services/chaintracker/chaintracks/BlockHeaderApi.ts +123 -0
- package/src/services/chaintracker/chaintracks/ChaintracksServiceClient.ts +160 -0
- package/src/services/chaintracker/chaintracks/index.ts +2 -0
- package/src/services/chaintracker/index.ts +2 -0
- package/src/services/createDefaultWalletServicesOptions.ts +38 -0
- package/src/services/index.ts +1 -0
- package/src/services/providers/arcServices.ts +570 -0
- package/src/services/providers/echangeRates.ts +276 -0
- package/src/services/providers/whatsonchain.ts +170 -0
- package/src/signer/README.md +5 -0
- package/src/signer/WalletSigner.ts +21 -0
- package/src/signer/methods/acquireDirectCertificate.ts +53 -0
- package/src/signer/methods/createAction.ts +364 -0
- package/src/signer/methods/internalizeAction.ts +142 -0
- package/src/signer/methods/proveCertificate.ts +51 -0
- package/src/signer/methods/signAction.ts +121 -0
- package/src/storage/README.md +14 -0
- package/src/storage/StorageKnex.ts +1449 -0
- package/src/storage/StorageProvider.ts +853 -0
- package/src/storage/StorageReader.ts +222 -0
- package/src/storage/StorageReaderWriter.ts +623 -0
- package/src/storage/StorageSyncReader.ts +143 -0
- package/src/storage/WalletStorageManager.ts +532 -0
- package/src/storage/__test/WalletStorageManager.test.ts +292 -0
- package/src/storage/index.all.ts +10 -0
- package/src/storage/index.client.ts +6 -0
- package/src/storage/index.db.ts +0 -0
- package/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.ts +1143 -0
- package/src/storage/methods/__test/GenerateChange/randomValsUsed1.ts +31 -0
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +185 -0
- package/src/storage/methods/createAction.ts +997 -0
- package/src/storage/methods/generateChange.ts +629 -0
- package/src/storage/methods/getBeefForTransaction.ts +143 -0
- package/src/storage/methods/getSyncChunk.ts +330 -0
- package/src/storage/methods/internalizeAction.ts +538 -0
- package/src/storage/methods/listActions.ts +203 -0
- package/src/storage/methods/listCertificates.ts +81 -0
- package/src/storage/methods/listOutputs.ts +219 -0
- package/src/storage/methods/processAction.ts +477 -0
- package/src/storage/methods/purgeData.ts +276 -0
- package/src/storage/methods/reviewStatus.ts +95 -0
- package/src/storage/remoting/StorageClient.ts +306 -0
- package/src/storage/remoting/StorageServer.ts +179 -0
- package/src/storage/schema/KnexMigrations.ts +488 -0
- package/src/storage/schema/entities/Certificate.ts +199 -0
- package/src/storage/schema/entities/CertificateField.ts +157 -0
- package/src/storage/schema/entities/Commission.ts +169 -0
- package/src/storage/schema/entities/EntityBase.ts +214 -0
- package/src/storage/schema/entities/MergeEntity.ts +79 -0
- package/src/storage/schema/entities/Output.ts +323 -0
- package/src/storage/schema/entities/OutputBasket.ts +165 -0
- package/src/storage/schema/entities/OutputTag.ts +138 -0
- package/src/storage/schema/entities/OutputTagMap.ts +146 -0
- package/src/storage/schema/entities/ProvenTx.ts +349 -0
- package/src/storage/schema/entities/ProvenTxReq.ts +646 -0
- package/src/storage/schema/entities/SyncState.ts +429 -0
- package/src/storage/schema/entities/Transaction.ts +334 -0
- package/src/storage/schema/entities/TxLabel.ts +135 -0
- package/src/storage/schema/entities/TxLabelMap.ts +148 -0
- package/src/storage/schema/entities/User.ts +138 -0
- package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +663 -0
- package/src/storage/schema/entities/__tests/CertificateTests.test.ts +527 -0
- package/src/storage/schema/entities/__tests/CommissionTests.test.ts +658 -0
- package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +567 -0
- package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +530 -0
- package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +504 -0
- package/src/storage/schema/entities/__tests/OutputTests.test.ts +689 -0
- package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +669 -0
- package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +700 -0
- package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +376 -0
- package/src/storage/schema/entities/__tests/TransactionTests.test.ts +920 -0
- package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +512 -0
- package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +350 -0
- package/src/storage/schema/entities/__tests/stampLogTests.test.ts +97 -0
- package/src/storage/schema/entities/__tests/usersTests.test.ts +485 -0
- package/src/storage/schema/entities/index.ts +16 -0
- package/src/storage/schema/tables/Certificate.ts +21 -0
- package/src/storage/schema/tables/CertificateField.ts +12 -0
- package/src/storage/schema/tables/Commission.ts +13 -0
- package/src/storage/schema/tables/MonitorEvent.ts +9 -0
- package/src/storage/schema/tables/Output.ts +64 -0
- package/src/storage/schema/tables/OutputBasket.ts +12 -0
- package/src/storage/schema/tables/OutputTag.ts +10 -0
- package/src/storage/schema/tables/OutputTagMap.ts +9 -0
- package/src/storage/schema/tables/ProvenTx.ts +14 -0
- package/src/storage/schema/tables/ProvenTxReq.ts +65 -0
- package/src/storage/schema/tables/Settings.ts +17 -0
- package/src/storage/schema/tables/SyncState.ts +18 -0
- package/src/storage/schema/tables/Transaction.ts +54 -0
- package/src/storage/schema/tables/TxLabel.ts +10 -0
- package/src/storage/schema/tables/TxLabelMap.ts +9 -0
- package/src/storage/schema/tables/User.ts +16 -0
- package/src/storage/schema/tables/index.ts +16 -0
- package/src/storage/sync/StorageMySQLDojoReader.ts +771 -0
- package/src/storage/sync/index.ts +1 -0
- package/src/utility/README.md +3 -0
- package/src/utility/ScriptTemplateSABPPP.ts +79 -0
- package/src/utility/index.all.ts +7 -0
- package/src/utility/index.client.ts +7 -0
- package/src/utility/parseTxScriptOffsets.ts +29 -0
- package/src/utility/stampLog.ts +73 -0
- package/src/utility/tscProofToMerklePath.ts +51 -0
- package/src/utility/utilityHelpers.buffer.ts +43 -0
- package/src/utility/utilityHelpers.noBuffer.ts +18 -0
- package/src/utility/utilityHelpers.ts +283 -0
- package/test/Wallet/StorageClient/storageClient.man.test.ts +55 -0
- package/test/Wallet/action/internalizeAction.a.test.ts +301 -0
- package/test/Wallet/certificate/acquireCertificate.test.ts +253 -0
- package/test/Wallet/certificate/listCertificates.test.ts +352 -0
- package/test/Wallet/get/getHeaderForHeight.test.ts +79 -0
- package/test/Wallet/get/getHeight.test.ts +52 -0
- package/test/Wallet/get/getKnownTxids.test.ts +90 -0
- package/test/Wallet/get/getNetwork.test.ts +28 -0
- package/test/Wallet/get/getVersion.test.ts +28 -0
- package/test/Wallet/live/walletLive.man.test.ts +510 -0
- package/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.ts +155 -0
- package/test/checkDB.ts +63 -0
- package/test/checkdb +0 -0
- package/test/examples/README.man.test.ts +53 -0
- package/test/monitor/Monitor.test.ts +536 -0
- package/test/services/Services.test.ts +149 -0
- package/test/storage/KnexMigrations.test.ts +100 -0
- package/test/storage/StorageMySQLDojoReader.man.test.ts +71 -0
- package/test/storage/count.test.ts +193 -0
- package/test/storage/find.test.ts +216 -0
- package/test/storage/findLegacy.test.ts +70 -0
- package/test/storage/insert.test.ts +294 -0
- package/test/storage/update.test.ts +1146 -0
- package/test/storage/update2.test.ts +1017 -0
- package/test/utils/TestUtilsWalletStorage.ts +1923 -0
- package/test/utils/removeFailedFromDatabase.sql +17 -0
- package/test/wallet/action/abortAction.test.ts +55 -0
- package/test/wallet/action/createAction.test.ts +266 -0
- package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +297 -0
- package/test/wallet/action/internalizeAction.test.ts +729 -0
- package/test/wallet/action/relinquishOutput.test.ts +43 -0
- package/test/wallet/construct/Wallet.constructor.test.ts +57 -0
- package/test/wallet/list/listActions.test.ts +282 -0
- package/test/wallet/list/listActions2.test.ts +570 -0
- package/test/wallet/list/listCertificates.test.ts +129 -0
- package/test/wallet/list/listOutputs.test.ts +573 -0
- package/test/wallet/sync/Wallet.sync.test.ts +226 -0
- package/ts2md.json +32 -0
- package/tsconfig.all.json +29 -0
- package/tsconfig.client.json +22 -0
- package/tsconfig.json +14 -0
- package/unlock-migrations.sh +41 -0
|
@@ -0,0 +1,1146 @@
|
|
|
1
|
+
import { _tu, TestSetup1 } from '../utils/TestUtilsWalletStorage'
|
|
2
|
+
import {
|
|
3
|
+
sdk,
|
|
4
|
+
StorageProvider,
|
|
5
|
+
StorageKnex,
|
|
6
|
+
verifyOne
|
|
7
|
+
} from '../../src/index.all'
|
|
8
|
+
import {
|
|
9
|
+
normalizeDate,
|
|
10
|
+
setLogging,
|
|
11
|
+
updateTable,
|
|
12
|
+
verifyValues
|
|
13
|
+
} from '../utils/TestUtilsWalletStorage'
|
|
14
|
+
import {
|
|
15
|
+
ProvenTx,
|
|
16
|
+
ProvenTxReq,
|
|
17
|
+
User,
|
|
18
|
+
Certificate,
|
|
19
|
+
CertificateField,
|
|
20
|
+
OutputBasket,
|
|
21
|
+
Transaction,
|
|
22
|
+
Commission,
|
|
23
|
+
Output,
|
|
24
|
+
OutputTag,
|
|
25
|
+
OutputTagMap,
|
|
26
|
+
TxLabel,
|
|
27
|
+
TxLabelMap,
|
|
28
|
+
MonitorEvent,
|
|
29
|
+
SyncState
|
|
30
|
+
} from '../../src/storage/schema/tables'
|
|
31
|
+
|
|
32
|
+
setLogging(false)
|
|
33
|
+
|
|
34
|
+
describe('update tests', () => {
|
|
35
|
+
jest.setTimeout(99999999)
|
|
36
|
+
|
|
37
|
+
const storages: StorageProvider[] = []
|
|
38
|
+
const chain: sdk.Chain = 'test'
|
|
39
|
+
const setups: { setup: TestSetup1; storage: StorageProvider }[] = []
|
|
40
|
+
const env = _tu.getEnv(chain)
|
|
41
|
+
const databaseName = 'updateTest'
|
|
42
|
+
|
|
43
|
+
beforeAll(async () => {
|
|
44
|
+
const localSQLiteFile = await _tu.newTmpFile(
|
|
45
|
+
`${databaseName}.sqlite`,
|
|
46
|
+
false,
|
|
47
|
+
false,
|
|
48
|
+
true
|
|
49
|
+
)
|
|
50
|
+
const knexSQLite = _tu.createLocalSQLite(localSQLiteFile)
|
|
51
|
+
storages.push(
|
|
52
|
+
new StorageKnex({
|
|
53
|
+
...StorageKnex.defaultOptions(),
|
|
54
|
+
chain,
|
|
55
|
+
knex: knexSQLite
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
if (env.runMySQL) {
|
|
59
|
+
const knexMySQL = _tu.createLocalMySQL(`${databaseName}.mysql`)
|
|
60
|
+
storages.push(
|
|
61
|
+
new StorageKnex({
|
|
62
|
+
...StorageKnex.defaultOptions(),
|
|
63
|
+
chain,
|
|
64
|
+
knex: knexMySQL
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
for (const storage of storages) {
|
|
69
|
+
await storage.dropAllData()
|
|
70
|
+
await storage.migrate('insert tests', '1'.repeat(64))
|
|
71
|
+
setups.push({ storage, setup: await _tu.createTestSetup1(storage) })
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
afterAll(async () => {
|
|
76
|
+
for (const storage of storages) {
|
|
77
|
+
await storage.destroy()
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
test('0_update ProvenTx', async () => {
|
|
82
|
+
for (const { storage } of setups) {
|
|
83
|
+
const records = await storage.findProvenTxs({ partial: {} })
|
|
84
|
+
const time = new Date('2001-01-02T12:00:00.000Z')
|
|
85
|
+
for (const record of records) {
|
|
86
|
+
await storage.updateProvenTx(record.provenTxId, {
|
|
87
|
+
blockHash: 'fred',
|
|
88
|
+
updated_at: time
|
|
89
|
+
})
|
|
90
|
+
const t = verifyOne(
|
|
91
|
+
await storage.findProvenTxs({
|
|
92
|
+
partial: { provenTxId: record.provenTxId }
|
|
93
|
+
})
|
|
94
|
+
)
|
|
95
|
+
expect(t.provenTxId).toBe(record.provenTxId)
|
|
96
|
+
expect(t.blockHash).toBe('fred')
|
|
97
|
+
expect(t.updated_at.getTime()).toBe(time.getTime())
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
test('1_update ProvenTx', async () => {
|
|
103
|
+
const primaryKey = 'provenTxId'
|
|
104
|
+
for (const { storage } of setups) {
|
|
105
|
+
const referenceTime = new Date()
|
|
106
|
+
const records = await storage.findProvenTxs({ partial: {} })
|
|
107
|
+
for (const record of records) {
|
|
108
|
+
try {
|
|
109
|
+
const testValues: ProvenTx = {
|
|
110
|
+
provenTxId: record.provenTxId,
|
|
111
|
+
txid: 'mockTxid',
|
|
112
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
113
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
114
|
+
blockHash: 'mockBlockHash',
|
|
115
|
+
height: 12345,
|
|
116
|
+
index: 1,
|
|
117
|
+
merklePath: [1, 2, 3, 4],
|
|
118
|
+
merkleRoot: '1234',
|
|
119
|
+
rawTx: [4, 3, 2, 1]
|
|
120
|
+
}
|
|
121
|
+
await updateTable(
|
|
122
|
+
storage.updateProvenTx.bind(storage),
|
|
123
|
+
record[primaryKey],
|
|
124
|
+
testValues
|
|
125
|
+
)
|
|
126
|
+
const updatedTx = verifyOne(
|
|
127
|
+
await storage.findProvenTxs({
|
|
128
|
+
partial: { [primaryKey]: record[primaryKey] }
|
|
129
|
+
})
|
|
130
|
+
)
|
|
131
|
+
verifyValues(updatedTx, testValues, referenceTime)
|
|
132
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
133
|
+
if (key === primaryKey) {
|
|
134
|
+
continue
|
|
135
|
+
}
|
|
136
|
+
if (typeof value === 'string') {
|
|
137
|
+
const validString = `valid${key}`
|
|
138
|
+
const r1 = await storage.updateProvenTx(record[primaryKey], {
|
|
139
|
+
[key]: validString
|
|
140
|
+
})
|
|
141
|
+
expect(r1).toBe(1)
|
|
142
|
+
const updatedRow = verifyOne(
|
|
143
|
+
await storage.findProvenTxs({
|
|
144
|
+
partial: { [primaryKey]: record[primaryKey] }
|
|
145
|
+
})
|
|
146
|
+
)
|
|
147
|
+
expect(updatedRow[key]).toBe(validString)
|
|
148
|
+
}
|
|
149
|
+
if (typeof value === 'number') {
|
|
150
|
+
const validNumber = value + 1
|
|
151
|
+
const r1 = await storage.updateProvenTx(record[primaryKey], {
|
|
152
|
+
[key]: validNumber
|
|
153
|
+
})
|
|
154
|
+
expect(r1).toBe(1)
|
|
155
|
+
const updatedRow = verifyOne(
|
|
156
|
+
await storage.findProvenTxs({
|
|
157
|
+
partial: { [primaryKey]: record[primaryKey] }
|
|
158
|
+
})
|
|
159
|
+
)
|
|
160
|
+
expect(updatedRow[key]).toBe(validNumber)
|
|
161
|
+
}
|
|
162
|
+
if (value instanceof Date) {
|
|
163
|
+
const validDate = new Date('2024-12-31T00:00:00Z')
|
|
164
|
+
const r1 = await storage.updateProvenTx(record[primaryKey], {
|
|
165
|
+
[key]: validDate
|
|
166
|
+
})
|
|
167
|
+
expect(r1).toBe(1)
|
|
168
|
+
const updatedRow = verifyOne(
|
|
169
|
+
await storage.findProvenTxs({
|
|
170
|
+
partial: { [primaryKey]: record[primaryKey] }
|
|
171
|
+
})
|
|
172
|
+
)
|
|
173
|
+
expect(new Date(updatedRow[key]).toISOString()).toBe(
|
|
174
|
+
validDate.toISOString()
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
if (Array.isArray(value)) {
|
|
178
|
+
const validArray = value.map(v => v + 1)
|
|
179
|
+
const r1 = await storage.updateProvenTx(record[primaryKey], {
|
|
180
|
+
[key]: validArray
|
|
181
|
+
})
|
|
182
|
+
expect(r1).toBe(1)
|
|
183
|
+
const updatedRow = verifyOne(
|
|
184
|
+
await storage.findProvenTxs({
|
|
185
|
+
partial: { [primaryKey]: record[primaryKey] }
|
|
186
|
+
})
|
|
187
|
+
)
|
|
188
|
+
expect(updatedRow[key]).toEqual(validArray)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
} catch (error: any) {
|
|
192
|
+
console.error(
|
|
193
|
+
`Error updating or verifying ProvenTx record with ${primaryKey}=${record[primaryKey]}:`,
|
|
194
|
+
error.message
|
|
195
|
+
)
|
|
196
|
+
throw error
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
test('2_update ProvenTxReq', async () => {
|
|
203
|
+
const primaryKey = 'provenTxReqId'
|
|
204
|
+
for (const { storage } of setups) {
|
|
205
|
+
const records = await storage.findProvenTxReqs({ partial: {} })
|
|
206
|
+
for (const record of records) {
|
|
207
|
+
try {
|
|
208
|
+
const testValues: ProvenTxReq = {
|
|
209
|
+
provenTxReqId: record.provenTxReqId,
|
|
210
|
+
provenTxId: 1,
|
|
211
|
+
batch: `batch-001`,
|
|
212
|
+
status: 'completed',
|
|
213
|
+
txid: `mockTxid-${Date.now()}`,
|
|
214
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
215
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
216
|
+
attempts: 3,
|
|
217
|
+
history: JSON.stringify({ validated: true, timestamp: Date.now() }),
|
|
218
|
+
inputBEEF: [5, 6, 7, 8],
|
|
219
|
+
notified: true,
|
|
220
|
+
notify: JSON.stringify({ email: 'test@example.com', sent: true }),
|
|
221
|
+
rawTx: [1, 2, 3, 4]
|
|
222
|
+
}
|
|
223
|
+
const r1 = await storage.updateProvenTxReq(
|
|
224
|
+
record[primaryKey],
|
|
225
|
+
testValues
|
|
226
|
+
)
|
|
227
|
+
expect(r1).toBe(1)
|
|
228
|
+
const updatedRow = verifyOne(
|
|
229
|
+
await storage.findProvenTxReqs({
|
|
230
|
+
partial: { [primaryKey]: record[primaryKey] }
|
|
231
|
+
})
|
|
232
|
+
)
|
|
233
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
234
|
+
const actualValue = updatedRow[key]
|
|
235
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
236
|
+
const normalizedExpected = normalizeDate(value)
|
|
237
|
+
if (normalizedActual && normalizedExpected) {
|
|
238
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
239
|
+
continue
|
|
240
|
+
}
|
|
241
|
+
if (
|
|
242
|
+
typeof value === 'string' &&
|
|
243
|
+
value.startsWith('{') &&
|
|
244
|
+
value.endsWith('}')
|
|
245
|
+
) {
|
|
246
|
+
expect(JSON.parse(actualValue)).toStrictEqual(JSON.parse(value))
|
|
247
|
+
continue
|
|
248
|
+
}
|
|
249
|
+
if (
|
|
250
|
+
typeof value === 'string' ||
|
|
251
|
+
typeof value === 'number' ||
|
|
252
|
+
typeof value === 'boolean'
|
|
253
|
+
) {
|
|
254
|
+
expect(actualValue).toBe(value)
|
|
255
|
+
continue
|
|
256
|
+
}
|
|
257
|
+
if (
|
|
258
|
+
typeof actualValue === 'object' &&
|
|
259
|
+
actualValue?.type === 'Buffer'
|
|
260
|
+
) {
|
|
261
|
+
const actualArray = actualValue.data || actualValue
|
|
262
|
+
const expectedArray =
|
|
263
|
+
Buffer.isBuffer(value) || Array.isArray(value)
|
|
264
|
+
? Array.from(value as ArrayLike<number>)
|
|
265
|
+
: value
|
|
266
|
+
expect(actualArray).toStrictEqual(expectedArray)
|
|
267
|
+
continue
|
|
268
|
+
}
|
|
269
|
+
expect(
|
|
270
|
+
JSON.stringify({ type: 'Buffer', data: actualValue })
|
|
271
|
+
).toStrictEqual(JSON.stringify(value))
|
|
272
|
+
}
|
|
273
|
+
} catch (error: any) {
|
|
274
|
+
console.error(
|
|
275
|
+
`Error updating or verifying ProvenTxReq record with ${primaryKey}=${record[primaryKey]}:`,
|
|
276
|
+
error.message
|
|
277
|
+
)
|
|
278
|
+
throw error
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
test('3_update User', async () => {
|
|
285
|
+
const primaryKey = 'userId'
|
|
286
|
+
for (const { storage } of setups) {
|
|
287
|
+
const records = await storage.findUsers({ partial: {} })
|
|
288
|
+
for (const record of records) {
|
|
289
|
+
try {
|
|
290
|
+
const testValues: User = {
|
|
291
|
+
userId: record.userId,
|
|
292
|
+
identityKey: `mockUpdatedIdentityKey-${record[primaryKey]}`,
|
|
293
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
294
|
+
updated_at: new Date('2024-12-30T23:05:00Z')
|
|
295
|
+
}
|
|
296
|
+
const updateResult = await storage.updateUser(
|
|
297
|
+
record[primaryKey],
|
|
298
|
+
testValues
|
|
299
|
+
)
|
|
300
|
+
expect(updateResult).toBe(1)
|
|
301
|
+
const updatedRow = verifyOne(
|
|
302
|
+
await storage.findUsers({
|
|
303
|
+
partial: { [primaryKey]: record[primaryKey] }
|
|
304
|
+
})
|
|
305
|
+
)
|
|
306
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
307
|
+
const actualValue = updatedRow[key]
|
|
308
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
309
|
+
const normalizedExpected = normalizeDate(value)
|
|
310
|
+
if (normalizedActual && normalizedExpected) {
|
|
311
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
312
|
+
continue
|
|
313
|
+
}
|
|
314
|
+
expect(actualValue).toBe(value)
|
|
315
|
+
}
|
|
316
|
+
} catch (error: any) {
|
|
317
|
+
console.error(
|
|
318
|
+
`Error updating or verifying User record with ${primaryKey}=${record[primaryKey]}:`,
|
|
319
|
+
error.message
|
|
320
|
+
)
|
|
321
|
+
throw error
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
})
|
|
326
|
+
|
|
327
|
+
test('4_update Certificate', async () => {
|
|
328
|
+
for (const { storage } of setups) {
|
|
329
|
+
const primaryKey = 'certificateId'
|
|
330
|
+
const records = await storage.findCertificates({ partial: {} })
|
|
331
|
+
for (const record of records) {
|
|
332
|
+
try {
|
|
333
|
+
const testValues: Certificate = {
|
|
334
|
+
certificateId: record.certificateId,
|
|
335
|
+
userId: 1,
|
|
336
|
+
certifier: `mockCertifier${record.certificateId}`,
|
|
337
|
+
serialNumber: `mockSerialNumber${record.certificateId}`,
|
|
338
|
+
type: `mockType${record.certificateId}`,
|
|
339
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
340
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
341
|
+
isDeleted: false,
|
|
342
|
+
revocationOutpoint: 'mockRevocationOutpoint',
|
|
343
|
+
signature: 'mockSignature',
|
|
344
|
+
subject: 'mockSubject'
|
|
345
|
+
}
|
|
346
|
+
const r1 = await storage.updateCertificate(
|
|
347
|
+
record[primaryKey],
|
|
348
|
+
testValues
|
|
349
|
+
)
|
|
350
|
+
expect(r1).toBe(1)
|
|
351
|
+
const updatedRow = verifyOne(
|
|
352
|
+
await storage.findCertificates({
|
|
353
|
+
partial: { [primaryKey]: record[primaryKey] }
|
|
354
|
+
})
|
|
355
|
+
)
|
|
356
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
357
|
+
const actualValue = updatedRow[key]
|
|
358
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
359
|
+
const normalizedExpected = normalizeDate(value)
|
|
360
|
+
if (normalizedActual && normalizedExpected) {
|
|
361
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
362
|
+
continue
|
|
363
|
+
}
|
|
364
|
+
if (
|
|
365
|
+
typeof value === 'string' &&
|
|
366
|
+
value.startsWith('{') &&
|
|
367
|
+
value.endsWith('}')
|
|
368
|
+
) {
|
|
369
|
+
expect(JSON.parse(actualValue)).toStrictEqual(JSON.parse(value))
|
|
370
|
+
continue
|
|
371
|
+
}
|
|
372
|
+
if (typeof actualValue === 'boolean') {
|
|
373
|
+
if (value === 1) {
|
|
374
|
+
expect(actualValue).toBe(true)
|
|
375
|
+
} else if (value === 0) {
|
|
376
|
+
expect(actualValue).toBe(false)
|
|
377
|
+
} else {
|
|
378
|
+
throw new Error(
|
|
379
|
+
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
380
|
+
)
|
|
381
|
+
}
|
|
382
|
+
continue
|
|
383
|
+
}
|
|
384
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
385
|
+
expect(actualValue).toBe(value)
|
|
386
|
+
continue
|
|
387
|
+
}
|
|
388
|
+
if (
|
|
389
|
+
typeof actualValue === 'object' &&
|
|
390
|
+
actualValue?.type === 'Buffer'
|
|
391
|
+
) {
|
|
392
|
+
const actualArray = actualValue.data || actualValue
|
|
393
|
+
const expectedArray =
|
|
394
|
+
Buffer.isBuffer(value) || Array.isArray(value)
|
|
395
|
+
? Array.from(value as ArrayLike<number>)
|
|
396
|
+
: value
|
|
397
|
+
expect(actualArray).toStrictEqual(expectedArray)
|
|
398
|
+
continue
|
|
399
|
+
}
|
|
400
|
+
expect(
|
|
401
|
+
JSON.stringify({ type: 'Buffer', data: actualValue })
|
|
402
|
+
).toStrictEqual(JSON.stringify(value))
|
|
403
|
+
}
|
|
404
|
+
} catch (error: any) {
|
|
405
|
+
console.error(
|
|
406
|
+
`Error updating or verifying Certificate record with ${primaryKey}=${record[primaryKey]}:`,
|
|
407
|
+
error.message
|
|
408
|
+
)
|
|
409
|
+
throw error
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
})
|
|
414
|
+
|
|
415
|
+
test('5_update CertificateField', async () => {
|
|
416
|
+
const primaryKey = 'certificateId'
|
|
417
|
+
for (const { storage } of setups) {
|
|
418
|
+
const records = await storage.findCertificateFields({
|
|
419
|
+
partial: { fieldName: 'bob' }
|
|
420
|
+
})
|
|
421
|
+
for (const record of records) {
|
|
422
|
+
try {
|
|
423
|
+
const testValues: CertificateField = {
|
|
424
|
+
certificateId: record.certificateId,
|
|
425
|
+
userId: record.userId ?? 1,
|
|
426
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
427
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
428
|
+
fieldName: record.fieldName || 'defaultFieldName',
|
|
429
|
+
fieldValue: 'your uncle',
|
|
430
|
+
masterKey: 'key'
|
|
431
|
+
}
|
|
432
|
+
const updateResult = await storage.updateCertificateField(
|
|
433
|
+
record.certificateId,
|
|
434
|
+
testValues.fieldName,
|
|
435
|
+
testValues
|
|
436
|
+
)
|
|
437
|
+
expect(updateResult).toBe(1)
|
|
438
|
+
const updatedRecords = await storage.findCertificateFields({
|
|
439
|
+
partial: {
|
|
440
|
+
certificateId: record.certificateId,
|
|
441
|
+
fieldName: testValues.fieldName
|
|
442
|
+
}
|
|
443
|
+
})
|
|
444
|
+
const updatedRow = verifyOne(
|
|
445
|
+
updatedRecords,
|
|
446
|
+
`Updated CertificateField with certificateId=${record.certificateId}, fieldName=${testValues.fieldName} was not unique or missing.`
|
|
447
|
+
)
|
|
448
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
449
|
+
const actualValue = updatedRow[key]
|
|
450
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
451
|
+
const normalizedExpected = normalizeDate(value)
|
|
452
|
+
if (normalizedActual && normalizedExpected) {
|
|
453
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
454
|
+
continue
|
|
455
|
+
}
|
|
456
|
+
expect(actualValue).toBe(value)
|
|
457
|
+
}
|
|
458
|
+
} catch (error: any) {
|
|
459
|
+
console.error(
|
|
460
|
+
`Error updating or verifying CertificateField record with certificateId=${record[primaryKey]}:`,
|
|
461
|
+
error.message
|
|
462
|
+
)
|
|
463
|
+
throw error
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
test('6_update OutputBasket', async () => {
|
|
470
|
+
const primaryKey = 'basketId'
|
|
471
|
+
for (const { storage } of setups) {
|
|
472
|
+
const records = await storage.findOutputBaskets({ partial: {} })
|
|
473
|
+
for (const record of records) {
|
|
474
|
+
try {
|
|
475
|
+
const testValues: OutputBasket = {
|
|
476
|
+
basketId: record.basketId,
|
|
477
|
+
userId: record.userId ?? 1,
|
|
478
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
479
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
480
|
+
name: record.name || 'defaultName',
|
|
481
|
+
numberOfDesiredUTXOs: 99,
|
|
482
|
+
minimumDesiredUTXOValue: 5000,
|
|
483
|
+
isDeleted: false
|
|
484
|
+
}
|
|
485
|
+
const updateResult = await storage.updateOutputBasket(
|
|
486
|
+
record.basketId,
|
|
487
|
+
testValues
|
|
488
|
+
)
|
|
489
|
+
expect(updateResult).toBe(1)
|
|
490
|
+
const updatedRecords = await storage.findOutputBaskets({
|
|
491
|
+
partial: { basketId: record.basketId, name: testValues.name }
|
|
492
|
+
})
|
|
493
|
+
const updatedRow = verifyOne(
|
|
494
|
+
updatedRecords,
|
|
495
|
+
`Updated OutputBasket with basketId=${record.basketId}, name=${testValues.name} was not unique or missing.`
|
|
496
|
+
)
|
|
497
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
498
|
+
const actualValue = updatedRow[key]
|
|
499
|
+
if (typeof actualValue === 'boolean') {
|
|
500
|
+
if (value === 1) {
|
|
501
|
+
expect(actualValue).toBe(true)
|
|
502
|
+
} else if (value === 0) {
|
|
503
|
+
expect(actualValue).toBe(false)
|
|
504
|
+
} else {
|
|
505
|
+
throw new Error(
|
|
506
|
+
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
507
|
+
)
|
|
508
|
+
}
|
|
509
|
+
continue
|
|
510
|
+
}
|
|
511
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
512
|
+
const normalizedExpected = normalizeDate(value)
|
|
513
|
+
if (normalizedActual && normalizedExpected) {
|
|
514
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
515
|
+
continue
|
|
516
|
+
}
|
|
517
|
+
expect(actualValue).toBe(value)
|
|
518
|
+
}
|
|
519
|
+
} catch (error: any) {
|
|
520
|
+
console.error(
|
|
521
|
+
`Error updating or verifying OutputBasket record with basketId=${record[primaryKey]}:`,
|
|
522
|
+
error.message
|
|
523
|
+
)
|
|
524
|
+
throw error
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
})
|
|
529
|
+
|
|
530
|
+
test('7_update Transaction', async () => {
|
|
531
|
+
const primaryKey = 'transactionId'
|
|
532
|
+
for (const { storage } of setups) {
|
|
533
|
+
const records = await storage.findTransactions({ partial: {} })
|
|
534
|
+
for (const record of records) {
|
|
535
|
+
try {
|
|
536
|
+
const testValues: Transaction = {
|
|
537
|
+
transactionId: record.transactionId,
|
|
538
|
+
userId: record.userId ?? 1,
|
|
539
|
+
provenTxId: 1,
|
|
540
|
+
reference: `updated_reference_string_${record.transactionId}==`,
|
|
541
|
+
status: 'confirmed' as sdk.TransactionStatus,
|
|
542
|
+
txid: `updated_txid_example_${record.transactionId}`,
|
|
543
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
544
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
545
|
+
description: 'Updated transaction description',
|
|
546
|
+
isOutgoing: false,
|
|
547
|
+
lockTime: 600000000,
|
|
548
|
+
satoshis: 20000,
|
|
549
|
+
version: 2
|
|
550
|
+
}
|
|
551
|
+
const updateResult = await storage.updateTransaction(
|
|
552
|
+
record.transactionId,
|
|
553
|
+
testValues
|
|
554
|
+
)
|
|
555
|
+
expect(updateResult).toBe(1)
|
|
556
|
+
const updatedRecords = await storage.findTransactions({
|
|
557
|
+
partial: { transactionId: record.transactionId }
|
|
558
|
+
})
|
|
559
|
+
const updatedRow = verifyOne(
|
|
560
|
+
updatedRecords,
|
|
561
|
+
`Updated Transaction with transactionId=${record.transactionId} was not unique or missing.`
|
|
562
|
+
)
|
|
563
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
564
|
+
const actualValue = updatedRow[key]
|
|
565
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
566
|
+
const normalizedExpected = normalizeDate(value)
|
|
567
|
+
if (normalizedActual && normalizedExpected) {
|
|
568
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
569
|
+
continue
|
|
570
|
+
}
|
|
571
|
+
expect(actualValue).toBe(value)
|
|
572
|
+
}
|
|
573
|
+
} catch (error: any) {
|
|
574
|
+
console.error(
|
|
575
|
+
`Error updating or verifying Transaction record with transactionId=${record[primaryKey]}:`,
|
|
576
|
+
error.message
|
|
577
|
+
)
|
|
578
|
+
throw error
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
})
|
|
583
|
+
|
|
584
|
+
test('7a updateTransactionStatus', async () => {
|
|
585
|
+
const { activeStorage: storage } = await _tu.createLegacyWalletSQLiteCopy(
|
|
586
|
+
'updateTransactionStatus6a'
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
let tx = verifyOne(
|
|
590
|
+
await storage.findTransactions({
|
|
591
|
+
partial: { status: 'unproven' },
|
|
592
|
+
paged: { limit: 1 }
|
|
593
|
+
})
|
|
594
|
+
)
|
|
595
|
+
expect(tx.status).toBe('unproven')
|
|
596
|
+
await storage.updateTransactionStatus('completed', tx.transactionId)
|
|
597
|
+
tx = verifyOne(
|
|
598
|
+
await storage.findTransactions({
|
|
599
|
+
partial: { transactionId: tx.transactionId }
|
|
600
|
+
})
|
|
601
|
+
)
|
|
602
|
+
expect(tx.status).toBe('completed')
|
|
603
|
+
|
|
604
|
+
await storage.destroy()
|
|
605
|
+
})
|
|
606
|
+
|
|
607
|
+
test('8_update Commission', async () => {
|
|
608
|
+
const primaryKey = 'commissionId'
|
|
609
|
+
for (const { storage } of setups) {
|
|
610
|
+
const records = await storage.findCommissions({ partial: {} })
|
|
611
|
+
for (const record of records) {
|
|
612
|
+
try {
|
|
613
|
+
const testValues: Commission = {
|
|
614
|
+
commissionId: record.commissionId,
|
|
615
|
+
userId: record.userId ?? 1,
|
|
616
|
+
transactionId: record.transactionId ?? 1,
|
|
617
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
618
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
619
|
+
satoshis: 300,
|
|
620
|
+
keyOffset: `updated_key_offset_${record.commissionId}`,
|
|
621
|
+
isRedeemed: true,
|
|
622
|
+
lockingScript: [1, 2, 3, 4]
|
|
623
|
+
}
|
|
624
|
+
const updateResult = await storage.updateCommission(
|
|
625
|
+
record.commissionId,
|
|
626
|
+
testValues
|
|
627
|
+
)
|
|
628
|
+
expect(updateResult).toBe(1)
|
|
629
|
+
const updatedRecords = await storage.findCommissions({
|
|
630
|
+
partial: { commissionId: record.commissionId }
|
|
631
|
+
})
|
|
632
|
+
const updatedRow = verifyOne(
|
|
633
|
+
updatedRecords,
|
|
634
|
+
`Updated Commission with commissionId=${record.commissionId} was not unique or missing.`
|
|
635
|
+
)
|
|
636
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
637
|
+
const actualValue = updatedRow[key]
|
|
638
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
639
|
+
const normalizedExpected = normalizeDate(value)
|
|
640
|
+
if (normalizedActual && normalizedExpected) {
|
|
641
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
642
|
+
continue
|
|
643
|
+
}
|
|
644
|
+
if (Buffer.isBuffer(actualValue) || Array.isArray(actualValue)) {
|
|
645
|
+
expect(
|
|
646
|
+
JSON.stringify({ type: 'Buffer', data: actualValue })
|
|
647
|
+
).toStrictEqual(JSON.stringify(value))
|
|
648
|
+
continue
|
|
649
|
+
}
|
|
650
|
+
expect(actualValue).toBe(value)
|
|
651
|
+
}
|
|
652
|
+
} catch (error: any) {
|
|
653
|
+
console.error(
|
|
654
|
+
`Error updating or verifying Commission record with commissionId=${record[primaryKey]}:`,
|
|
655
|
+
error.message
|
|
656
|
+
)
|
|
657
|
+
throw error
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
})
|
|
662
|
+
|
|
663
|
+
test('9_update Output', async () => {
|
|
664
|
+
const primaryKey = 'outputId'
|
|
665
|
+
for (const { storage } of setups) {
|
|
666
|
+
const records = await storage.findOutputs({ partial: {} })
|
|
667
|
+
for (const record of records) {
|
|
668
|
+
if (!record.transactionId) record.transactionId = 1
|
|
669
|
+
if (!record.basketId) record.basketId = 1
|
|
670
|
+
if (!record.userId || !record.transactionId || !record.basketId) {
|
|
671
|
+
throw new Error(
|
|
672
|
+
`Missing required foreign keys for record ${JSON.stringify(record)}`
|
|
673
|
+
)
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
for (const record of records) {
|
|
677
|
+
const existingRecords = await storage.findOutputs({ partial: {} })
|
|
678
|
+
const usedCombinations = new Set(
|
|
679
|
+
existingRecords.map(r => `${r.transactionId}-${r.vout}-${r.userId}`)
|
|
680
|
+
)
|
|
681
|
+
let testTransactionId = record.transactionId
|
|
682
|
+
let testVout = record.vout + 1
|
|
683
|
+
let testUserId = record.userId
|
|
684
|
+
while (
|
|
685
|
+
usedCombinations.has(`${testTransactionId}-${testVout}-${testUserId}`)
|
|
686
|
+
) {
|
|
687
|
+
testVout += 1
|
|
688
|
+
}
|
|
689
|
+
try {
|
|
690
|
+
const testValues: Output = {
|
|
691
|
+
outputId: record.outputId,
|
|
692
|
+
basketId: record.basketId ?? 1,
|
|
693
|
+
transactionId: testTransactionId,
|
|
694
|
+
userId: testUserId,
|
|
695
|
+
vout: testVout,
|
|
696
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
697
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
698
|
+
change: true,
|
|
699
|
+
customInstructions: 'Updated instructions',
|
|
700
|
+
derivationPrefix: 'updated_prefix==',
|
|
701
|
+
derivationSuffix: 'updated_suffix==',
|
|
702
|
+
lockingScript: [0x01, 0x02, 0x03, 0x04],
|
|
703
|
+
providedBy: 'you',
|
|
704
|
+
purpose: 'updated_purpose',
|
|
705
|
+
satoshis: 3000,
|
|
706
|
+
scriptLength: 150,
|
|
707
|
+
scriptOffset: 5,
|
|
708
|
+
senderIdentityKey: 'updated_sender_key',
|
|
709
|
+
sequenceNumber: 10,
|
|
710
|
+
spendingDescription: 'Updated spending description',
|
|
711
|
+
spendable: false,
|
|
712
|
+
spentBy: 3,
|
|
713
|
+
txid: 'updated_txid',
|
|
714
|
+
type: 'updated_type',
|
|
715
|
+
outputDescription: 'outputDescription'
|
|
716
|
+
}
|
|
717
|
+
const updateResult = await storage.updateOutput(
|
|
718
|
+
record.outputId,
|
|
719
|
+
testValues
|
|
720
|
+
)
|
|
721
|
+
expect(updateResult).toBe(1)
|
|
722
|
+
const updatedRecords = await storage.findOutputs({
|
|
723
|
+
partial: { outputId: record.outputId }
|
|
724
|
+
})
|
|
725
|
+
const updatedRow = verifyOne(
|
|
726
|
+
updatedRecords,
|
|
727
|
+
`Updated Output with outputId=${record.outputId} was not unique or missing.`
|
|
728
|
+
)
|
|
729
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
730
|
+
const actualValue = updatedRow[key]
|
|
731
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
732
|
+
const normalizedExpected = normalizeDate(value)
|
|
733
|
+
if (normalizedActual && normalizedExpected) {
|
|
734
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
735
|
+
continue
|
|
736
|
+
}
|
|
737
|
+
if (Buffer.isBuffer(actualValue) || Array.isArray(actualValue)) {
|
|
738
|
+
expect(
|
|
739
|
+
JSON.stringify({ type: 'Buffer', data: actualValue })
|
|
740
|
+
).toStrictEqual(JSON.stringify(value))
|
|
741
|
+
continue
|
|
742
|
+
}
|
|
743
|
+
expect(actualValue).toBe(value)
|
|
744
|
+
}
|
|
745
|
+
} catch (error: any) {
|
|
746
|
+
console.error(
|
|
747
|
+
`Error updating or verifying Output record with outputId=${record[primaryKey]}:`,
|
|
748
|
+
error.message
|
|
749
|
+
)
|
|
750
|
+
throw error
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
})
|
|
755
|
+
|
|
756
|
+
test('10_update OutputTag', async () => {
|
|
757
|
+
const primaryKey = 'outputTagId'
|
|
758
|
+
for (const { storage } of setups) {
|
|
759
|
+
const records = await storage.findOutputTags({ partial: {} })
|
|
760
|
+
for (const record of records) {
|
|
761
|
+
if (!record.userId) record.userId = 1
|
|
762
|
+
if (!record.tag) record.tag = `default_tag_${record.outputTagId}`
|
|
763
|
+
if (!record.userId || !record.tag) {
|
|
764
|
+
throw new Error(
|
|
765
|
+
`Missing required fields for record ${JSON.stringify(record)}`
|
|
766
|
+
)
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
for (const record of records) {
|
|
770
|
+
const uniqueTag = `updated_tag_${record.outputTagId}`
|
|
771
|
+
const testValues: OutputTag = {
|
|
772
|
+
outputTagId: record.outputTagId,
|
|
773
|
+
userId: record.userId,
|
|
774
|
+
tag: uniqueTag,
|
|
775
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
776
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
777
|
+
isDeleted: false
|
|
778
|
+
}
|
|
779
|
+
try {
|
|
780
|
+
const updateResult = await storage.updateOutputTag(
|
|
781
|
+
record.outputTagId,
|
|
782
|
+
testValues
|
|
783
|
+
)
|
|
784
|
+
expect(updateResult).toBe(1)
|
|
785
|
+
const updatedRecords = await storage.findOutputTags({
|
|
786
|
+
partial: { outputTagId: record.outputTagId }
|
|
787
|
+
})
|
|
788
|
+
const updatedRow = verifyOne(
|
|
789
|
+
updatedRecords,
|
|
790
|
+
`Updated OutputTag with outputTagId=${record.outputTagId} was not unique or missing.`
|
|
791
|
+
)
|
|
792
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
793
|
+
const actualValue = updatedRow[key]
|
|
794
|
+
if (typeof actualValue === 'boolean') {
|
|
795
|
+
if (value === 1) {
|
|
796
|
+
expect(actualValue).toBe(true)
|
|
797
|
+
} else if (value === 0) {
|
|
798
|
+
expect(actualValue).toBe(false)
|
|
799
|
+
} else {
|
|
800
|
+
throw new Error(
|
|
801
|
+
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
802
|
+
)
|
|
803
|
+
}
|
|
804
|
+
continue
|
|
805
|
+
}
|
|
806
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
807
|
+
const normalizedExpected = normalizeDate(value)
|
|
808
|
+
if (normalizedActual && normalizedExpected) {
|
|
809
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
810
|
+
continue
|
|
811
|
+
}
|
|
812
|
+
expect(actualValue).toBe(value)
|
|
813
|
+
}
|
|
814
|
+
} catch (error: any) {
|
|
815
|
+
console.error(
|
|
816
|
+
`Error updating or verifying OutputTag record with outputTagId=${record[primaryKey]}:`,
|
|
817
|
+
error.message
|
|
818
|
+
)
|
|
819
|
+
throw error
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
})
|
|
824
|
+
|
|
825
|
+
test('11_update OutputTagMap', async () => {
|
|
826
|
+
const primaryKey = ['outputTagId', 'outputId']
|
|
827
|
+
for (const { storage } of setups) {
|
|
828
|
+
const records = await storage.findOutputTagMaps({ partial: {} })
|
|
829
|
+
for (const record of records) {
|
|
830
|
+
if (!record.outputTagId)
|
|
831
|
+
throw new Error(
|
|
832
|
+
`Missing outputTagId for record: ${JSON.stringify(record)}`
|
|
833
|
+
)
|
|
834
|
+
if (!record.outputId)
|
|
835
|
+
throw new Error(
|
|
836
|
+
`Missing outputId for record: ${JSON.stringify(record)}`
|
|
837
|
+
)
|
|
838
|
+
try {
|
|
839
|
+
const testValues: OutputTagMap = {
|
|
840
|
+
outputTagId: record.outputTagId,
|
|
841
|
+
outputId: record.outputId,
|
|
842
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
843
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
844
|
+
isDeleted: false
|
|
845
|
+
}
|
|
846
|
+
const updateResult = await storage.updateOutputTagMap(
|
|
847
|
+
record.outputId,
|
|
848
|
+
record.outputTagId,
|
|
849
|
+
testValues
|
|
850
|
+
)
|
|
851
|
+
expect(updateResult).toBe(1)
|
|
852
|
+
const updatedRecords = await storage.findOutputTagMaps({
|
|
853
|
+
partial: {
|
|
854
|
+
outputTagId: record.outputTagId,
|
|
855
|
+
outputId: record.outputId
|
|
856
|
+
}
|
|
857
|
+
})
|
|
858
|
+
const updatedRow = verifyOne(
|
|
859
|
+
updatedRecords,
|
|
860
|
+
`Updated OutputTagMap with outputTagId=${record.outputTagId} and outputId=${record.outputId} was not unique or missing.`
|
|
861
|
+
)
|
|
862
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
863
|
+
const actualValue = updatedRow[key]
|
|
864
|
+
if (typeof actualValue === 'boolean') {
|
|
865
|
+
if (value === 1) {
|
|
866
|
+
expect(actualValue).toBe(true)
|
|
867
|
+
} else if (value === 0) {
|
|
868
|
+
expect(actualValue).toBe(false)
|
|
869
|
+
} else {
|
|
870
|
+
throw new Error(
|
|
871
|
+
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
872
|
+
)
|
|
873
|
+
}
|
|
874
|
+
continue
|
|
875
|
+
}
|
|
876
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
877
|
+
const normalizedExpected = normalizeDate(value)
|
|
878
|
+
if (normalizedActual && normalizedExpected) {
|
|
879
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
880
|
+
continue
|
|
881
|
+
}
|
|
882
|
+
expect(actualValue).toBe(value)
|
|
883
|
+
}
|
|
884
|
+
} catch (error: any) {
|
|
885
|
+
console.error(
|
|
886
|
+
`Error updating or verifying OutputTagMap record with outputTagId=${record.outputTagId} and outputId=${record.outputId}:`,
|
|
887
|
+
error.message
|
|
888
|
+
)
|
|
889
|
+
throw error
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
})
|
|
894
|
+
|
|
895
|
+
test('12_update TxLabel', async () => {
|
|
896
|
+
const primaryKey = 'txLabelId'
|
|
897
|
+
for (const { storage } of setups) {
|
|
898
|
+
const records = await storage.findTxLabels({ partial: {} })
|
|
899
|
+
for (const record of records) {
|
|
900
|
+
if (!record.userId) {
|
|
901
|
+
throw new Error(
|
|
902
|
+
`Missing required foreign key userId for record ${JSON.stringify(record)}`
|
|
903
|
+
)
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
for (const record of records) {
|
|
907
|
+
const uniqueLabel = `unique_label_${record.txLabelId}`
|
|
908
|
+
const testValues: TxLabel = {
|
|
909
|
+
txLabelId: record.txLabelId,
|
|
910
|
+
userId: record.userId,
|
|
911
|
+
label: uniqueLabel,
|
|
912
|
+
isDeleted: false,
|
|
913
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
914
|
+
updated_at: new Date('2024-12-30T23:05:00Z')
|
|
915
|
+
}
|
|
916
|
+
const existingLabel = await storage.findTxLabels({
|
|
917
|
+
partial: { label: testValues.label, userId: testValues.userId }
|
|
918
|
+
})
|
|
919
|
+
if (existingLabel.length > 0) {
|
|
920
|
+
continue
|
|
921
|
+
}
|
|
922
|
+
const updateResult = await storage.updateTxLabel(
|
|
923
|
+
record.txLabelId,
|
|
924
|
+
testValues
|
|
925
|
+
)
|
|
926
|
+
expect(updateResult).toBe(1)
|
|
927
|
+
const updatedRecords = await storage.findTxLabels({
|
|
928
|
+
partial: { txLabelId: record.txLabelId }
|
|
929
|
+
})
|
|
930
|
+
const updatedRow = verifyOne(
|
|
931
|
+
updatedRecords,
|
|
932
|
+
`Updated TxLabel with txLabelId=${record.txLabelId} was not unique or missing.`
|
|
933
|
+
)
|
|
934
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
935
|
+
const actualValue = updatedRow[key]
|
|
936
|
+
if (typeof actualValue === 'boolean') {
|
|
937
|
+
if (value === 1) {
|
|
938
|
+
expect(actualValue).toBe(true)
|
|
939
|
+
} else if (value === 0) {
|
|
940
|
+
expect(actualValue).toBe(false)
|
|
941
|
+
} else {
|
|
942
|
+
throw new Error(
|
|
943
|
+
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
944
|
+
)
|
|
945
|
+
}
|
|
946
|
+
continue
|
|
947
|
+
}
|
|
948
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
949
|
+
const normalizedExpected = normalizeDate(value)
|
|
950
|
+
if (normalizedActual && normalizedExpected) {
|
|
951
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
952
|
+
continue
|
|
953
|
+
}
|
|
954
|
+
expect(actualValue).toBe(value)
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
})
|
|
959
|
+
|
|
960
|
+
test('13_update TxLabelMap', async () => {
|
|
961
|
+
const primaryKeyTransaction = 'transactionId'
|
|
962
|
+
const primaryKeyLabel = 'txLabelId'
|
|
963
|
+
for (const { storage, setup } of setups) {
|
|
964
|
+
const records = await storage.findTxLabelMaps({ partial: {} })
|
|
965
|
+
for (const record of records) {
|
|
966
|
+
if (!record.transactionId || !record.txLabelId) {
|
|
967
|
+
throw new Error(
|
|
968
|
+
`Missing required foreign keys for record ${JSON.stringify(record)}`
|
|
969
|
+
)
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
for (const record of records) {
|
|
973
|
+
const testValues: TxLabelMap = {
|
|
974
|
+
transactionId: record.transactionId,
|
|
975
|
+
txLabelId: record.txLabelId,
|
|
976
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
977
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
978
|
+
isDeleted: false
|
|
979
|
+
}
|
|
980
|
+
const existingRecord = await storage.findTxLabelMaps({
|
|
981
|
+
partial: {
|
|
982
|
+
transactionId: testValues.transactionId,
|
|
983
|
+
txLabelId: testValues.txLabelId
|
|
984
|
+
}
|
|
985
|
+
})
|
|
986
|
+
if (existingRecord.length > 0) {
|
|
987
|
+
continue
|
|
988
|
+
}
|
|
989
|
+
try {
|
|
990
|
+
const updateResult = await storage.updateTxLabelMap(
|
|
991
|
+
record.transactionId,
|
|
992
|
+
record.txLabelId,
|
|
993
|
+
testValues
|
|
994
|
+
)
|
|
995
|
+
expect(updateResult).toBe(1)
|
|
996
|
+
const updatedRecords = await storage.findTxLabelMaps({
|
|
997
|
+
partial: {
|
|
998
|
+
transactionId: record.transactionId,
|
|
999
|
+
txLabelId: record.txLabelId
|
|
1000
|
+
}
|
|
1001
|
+
})
|
|
1002
|
+
const updatedRow = verifyOne(
|
|
1003
|
+
updatedRecords,
|
|
1004
|
+
`Updated TxLabelMap with transactionId=${record[primaryKeyTransaction]} and txLabelId=${record[primaryKeyLabel]} was not unique or missing.`
|
|
1005
|
+
)
|
|
1006
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
1007
|
+
const actualValue = updatedRow[key]
|
|
1008
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
1009
|
+
const normalizedExpected = normalizeDate(value)
|
|
1010
|
+
if (normalizedActual && normalizedExpected) {
|
|
1011
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
1012
|
+
continue
|
|
1013
|
+
}
|
|
1014
|
+
expect(actualValue).toBe(value)
|
|
1015
|
+
}
|
|
1016
|
+
} catch (error: any) {
|
|
1017
|
+
console.error(
|
|
1018
|
+
`Error updating or verifying TxLabelMap record with transactionId=${record[primaryKeyTransaction]} and txLabelId=${record[primaryKeyLabel]}:`,
|
|
1019
|
+
error.message
|
|
1020
|
+
)
|
|
1021
|
+
throw error
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
})
|
|
1026
|
+
|
|
1027
|
+
test('14_update MonitorEvent', async () => {
|
|
1028
|
+
const primaryKey = 'id'
|
|
1029
|
+
for (const { storage, setup } of setups) {
|
|
1030
|
+
const records = await storage.findMonitorEvents({ partial: {} })
|
|
1031
|
+
for (const record of records) {
|
|
1032
|
+
try {
|
|
1033
|
+
const testValues: MonitorEvent = {
|
|
1034
|
+
id: record.id,
|
|
1035
|
+
created_at: new Date('2024-12-30T23:00:00Z'),
|
|
1036
|
+
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
1037
|
+
event: 'updated_event',
|
|
1038
|
+
details: 'Updated details'
|
|
1039
|
+
}
|
|
1040
|
+
const updateResult = await storage.updateMonitorEvent(
|
|
1041
|
+
record.id,
|
|
1042
|
+
testValues
|
|
1043
|
+
)
|
|
1044
|
+
expect(updateResult).toBe(1)
|
|
1045
|
+
const updatedRecords = await storage.findMonitorEvents({
|
|
1046
|
+
partial: { id: record.id }
|
|
1047
|
+
})
|
|
1048
|
+
const updatedRow = verifyOne(
|
|
1049
|
+
updatedRecords,
|
|
1050
|
+
`Updated MonitorEvent with id=${record.id} was not unique or missing.`
|
|
1051
|
+
)
|
|
1052
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
1053
|
+
const actualValue = updatedRow[key]
|
|
1054
|
+
const normalizedActual = normalizeDate(actualValue)
|
|
1055
|
+
const normalizedExpected = normalizeDate(value)
|
|
1056
|
+
if (normalizedActual && normalizedExpected) {
|
|
1057
|
+
expect(normalizedActual).toBe(normalizedExpected)
|
|
1058
|
+
continue
|
|
1059
|
+
}
|
|
1060
|
+
expect(actualValue).toBe(value)
|
|
1061
|
+
}
|
|
1062
|
+
} catch (error: any) {
|
|
1063
|
+
console.error(
|
|
1064
|
+
`Error updating or verifying MonitorEvent record with id=${record[primaryKey]}:`,
|
|
1065
|
+
error.message
|
|
1066
|
+
)
|
|
1067
|
+
throw error
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
})
|
|
1072
|
+
|
|
1073
|
+
test('15_update SyncState', async () => {
|
|
1074
|
+
const primaryKey = 'syncStateId'
|
|
1075
|
+
for (const { storage } of setups) {
|
|
1076
|
+
const records = await storage.findSyncStates({ partial: {} })
|
|
1077
|
+
for (const record of records) {
|
|
1078
|
+
if (!record.userId) {
|
|
1079
|
+
throw new Error(
|
|
1080
|
+
`Missing required foreign key userId for record ${JSON.stringify(record)}`
|
|
1081
|
+
)
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
for (const record of records) {
|
|
1085
|
+
const testValues: SyncState = {
|
|
1086
|
+
syncStateId: record.syncStateId,
|
|
1087
|
+
userId: record.userId,
|
|
1088
|
+
refNum: 'test_refNum',
|
|
1089
|
+
created_at: new Date('2025-01-01T00:00:00.000Z'),
|
|
1090
|
+
updated_at: new Date('2025-01-01T00:00:00.000Z'),
|
|
1091
|
+
errorLocal: 'Example local error',
|
|
1092
|
+
errorOther: 'Example other error',
|
|
1093
|
+
init: false,
|
|
1094
|
+
satoshis: 1000,
|
|
1095
|
+
status: 'success',
|
|
1096
|
+
storageIdentityKey: 'test_identity_key',
|
|
1097
|
+
storageName: 'test_storage',
|
|
1098
|
+
syncMap: '{}',
|
|
1099
|
+
when: new Date('2025-01-01T02:00:00.000Z')
|
|
1100
|
+
}
|
|
1101
|
+
const updateResult = await storage.updateSyncState(
|
|
1102
|
+
record.syncStateId,
|
|
1103
|
+
testValues
|
|
1104
|
+
)
|
|
1105
|
+
expect(updateResult).toBe(1)
|
|
1106
|
+
const updatedRecords = await storage.findSyncStates({
|
|
1107
|
+
partial: { syncStateId: record.syncStateId }
|
|
1108
|
+
})
|
|
1109
|
+
const updatedRow = verifyOne(
|
|
1110
|
+
updatedRecords,
|
|
1111
|
+
`Updated SyncState with syncStateId=${record.syncStateId} was not unique or missing.`
|
|
1112
|
+
)
|
|
1113
|
+
for (const [key, value] of Object.entries(testValues)) {
|
|
1114
|
+
const actualValue = updatedRow[key]
|
|
1115
|
+
if (typeof actualValue === 'boolean') {
|
|
1116
|
+
if (value === 1) {
|
|
1117
|
+
expect(actualValue).toBe(true)
|
|
1118
|
+
} else if (value === 0) {
|
|
1119
|
+
expect(actualValue).toBe(false)
|
|
1120
|
+
} else {
|
|
1121
|
+
throw new Error(
|
|
1122
|
+
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
1123
|
+
)
|
|
1124
|
+
}
|
|
1125
|
+
continue
|
|
1126
|
+
}
|
|
1127
|
+
if (actualValue instanceof Date) {
|
|
1128
|
+
const actualDate = new Date(actualValue)
|
|
1129
|
+
const expectedDate = new Date(value)
|
|
1130
|
+
expect(actualDate.getTime()).toBe(expectedDate.getTime())
|
|
1131
|
+
continue
|
|
1132
|
+
}
|
|
1133
|
+
if (value === undefined || value === null) {
|
|
1134
|
+
expect(actualValue).toBeNull()
|
|
1135
|
+
continue
|
|
1136
|
+
}
|
|
1137
|
+
if (key === 'refNum') {
|
|
1138
|
+
expect(actualValue).toBe('test_refNum')
|
|
1139
|
+
continue
|
|
1140
|
+
}
|
|
1141
|
+
expect(actualValue).toStrictEqual(value)
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
})
|
|
1146
|
+
})
|