@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,823 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const bsv = __importStar(require("@bsv/sdk"));
|
|
37
|
+
const TestUtilsWalletStorage_1 = require("../../../../../test/utils/TestUtilsWalletStorage");
|
|
38
|
+
const Transaction_1 = require("../../../../../src/storage/schema/entities/Transaction");
|
|
39
|
+
describe('Transaction class method tests', () => {
|
|
40
|
+
jest.setTimeout(99999999);
|
|
41
|
+
const env = TestUtilsWalletStorage_1.TestUtilsWalletStorage.getEnv('test');
|
|
42
|
+
const ctxs = [];
|
|
43
|
+
const ctxs2 = [];
|
|
44
|
+
beforeAll(async () => {
|
|
45
|
+
if (env.runMySQL) {
|
|
46
|
+
ctxs.push(await TestUtilsWalletStorage_1.TestUtilsWalletStorage.createLegacyWalletMySQLCopy('transactionTests'));
|
|
47
|
+
ctxs2.push(await TestUtilsWalletStorage_1.TestUtilsWalletStorage.createLegacyWalletMySQLCopy('transactionTests2'));
|
|
48
|
+
}
|
|
49
|
+
ctxs.push(await TestUtilsWalletStorage_1.TestUtilsWalletStorage.createLegacyWalletSQLiteCopy('transactionTests'));
|
|
50
|
+
ctxs2.push(await TestUtilsWalletStorage_1.TestUtilsWalletStorage.createLegacyWalletSQLiteCopy('transactionTests2'));
|
|
51
|
+
});
|
|
52
|
+
afterAll(async () => {
|
|
53
|
+
// Destroy both sets of database contexts
|
|
54
|
+
for (const ctx of ctxs) {
|
|
55
|
+
await ctx.storage.destroy();
|
|
56
|
+
}
|
|
57
|
+
for (const ctx of ctxs2) {
|
|
58
|
+
await ctx.storage.destroy();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
// Test: Constructor with default values
|
|
62
|
+
test('0_creates_instance_with_default_values', () => {
|
|
63
|
+
const tx = new Transaction_1.Transaction();
|
|
64
|
+
const now = new Date();
|
|
65
|
+
expect(tx.transactionId).toBe(0);
|
|
66
|
+
expect(tx.userId).toBe(0);
|
|
67
|
+
expect(tx.txid).toBe('');
|
|
68
|
+
expect(tx.status).toBe('unprocessed');
|
|
69
|
+
expect(tx.reference).toBe('');
|
|
70
|
+
expect(tx.satoshis).toBe(0);
|
|
71
|
+
expect(tx.description).toBe('');
|
|
72
|
+
expect(tx.isOutgoing).toBe(false);
|
|
73
|
+
expect(tx.rawTx).toBeUndefined();
|
|
74
|
+
expect(tx.inputBEEF).toBeUndefined();
|
|
75
|
+
expect(tx.created_at).toBeInstanceOf(Date);
|
|
76
|
+
expect(tx.updated_at).toBeInstanceOf(Date);
|
|
77
|
+
expect(tx.created_at.getTime()).toBeLessThanOrEqual(now.getTime());
|
|
78
|
+
expect(tx.updated_at.getTime()).toBeLessThanOrEqual(now.getTime());
|
|
79
|
+
});
|
|
80
|
+
// Test: Constructor with provided API object
|
|
81
|
+
test('1_creates_instance_with_provided_api_object', () => {
|
|
82
|
+
const now = new Date();
|
|
83
|
+
const apiObject = {
|
|
84
|
+
transactionId: 123,
|
|
85
|
+
userId: 456,
|
|
86
|
+
txid: 'testTxid',
|
|
87
|
+
status: 'completed',
|
|
88
|
+
reference: 'testReference',
|
|
89
|
+
satoshis: 789,
|
|
90
|
+
description: 'testDescription',
|
|
91
|
+
isOutgoing: true,
|
|
92
|
+
rawTx: [1, 2, 3],
|
|
93
|
+
inputBEEF: [4, 5, 6],
|
|
94
|
+
created_at: now,
|
|
95
|
+
updated_at: now
|
|
96
|
+
};
|
|
97
|
+
const tx = new Transaction_1.Transaction(apiObject);
|
|
98
|
+
expect(tx.transactionId).toBe(123);
|
|
99
|
+
expect(tx.userId).toBe(456);
|
|
100
|
+
expect(tx.txid).toBe('testTxid');
|
|
101
|
+
expect(tx.status).toBe('completed');
|
|
102
|
+
expect(tx.reference).toBe('testReference');
|
|
103
|
+
expect(tx.satoshis).toBe(789);
|
|
104
|
+
expect(tx.description).toBe('testDescription');
|
|
105
|
+
expect(tx.isOutgoing).toBe(true);
|
|
106
|
+
expect(tx.rawTx).toEqual([1, 2, 3]);
|
|
107
|
+
expect(tx.inputBEEF).toEqual([4, 5, 6]);
|
|
108
|
+
expect(tx.created_at).toBe(now);
|
|
109
|
+
expect(tx.updated_at).toBe(now);
|
|
110
|
+
});
|
|
111
|
+
// Test: Getters and setters
|
|
112
|
+
test('2_getters_and_setters_work_correctly', () => {
|
|
113
|
+
const tx = new Transaction_1.Transaction();
|
|
114
|
+
const now = new Date();
|
|
115
|
+
tx.transactionId = 123;
|
|
116
|
+
tx.userId = 456;
|
|
117
|
+
tx.txid = 'testTxid';
|
|
118
|
+
tx.status = 'processed';
|
|
119
|
+
tx.reference = 'testReference';
|
|
120
|
+
tx.satoshis = 789;
|
|
121
|
+
tx.description = 'testDescription';
|
|
122
|
+
tx.isOutgoing = true;
|
|
123
|
+
tx.rawTx = [1, 2, 3];
|
|
124
|
+
tx.inputBEEF = [4, 5, 6];
|
|
125
|
+
tx.created_at = now;
|
|
126
|
+
tx.updated_at = now;
|
|
127
|
+
// New setters
|
|
128
|
+
tx.version = 2;
|
|
129
|
+
tx.lockTime = 5000;
|
|
130
|
+
expect(tx.transactionId).toBe(123);
|
|
131
|
+
expect(tx.userId).toBe(456);
|
|
132
|
+
expect(tx.txid).toBe('testTxid');
|
|
133
|
+
expect(tx.status).toBe('processed');
|
|
134
|
+
expect(tx.reference).toBe('testReference');
|
|
135
|
+
expect(tx.satoshis).toBe(789);
|
|
136
|
+
expect(tx.description).toBe('testDescription');
|
|
137
|
+
expect(tx.isOutgoing).toBe(true);
|
|
138
|
+
expect(tx.rawTx).toEqual([1, 2, 3]);
|
|
139
|
+
expect(tx.inputBEEF).toEqual([4, 5, 6]);
|
|
140
|
+
expect(tx.created_at).toBe(now);
|
|
141
|
+
expect(tx.updated_at).toBe(now);
|
|
142
|
+
// Check new properties
|
|
143
|
+
expect(tx.version).toBe(2); // Ensure version is set correctly
|
|
144
|
+
expect(tx.lockTime).toBe(5000); // Ensure lockTime is set correctly
|
|
145
|
+
});
|
|
146
|
+
// Test: `getBsvTx` returns parsed transaction
|
|
147
|
+
test('3_getBsvTx_returns_parsed_transaction', () => {
|
|
148
|
+
const rawTx = Uint8Array.from([1, 2, 3]);
|
|
149
|
+
const tx = new Transaction_1.Transaction({
|
|
150
|
+
rawTx: Array.from(rawTx)
|
|
151
|
+
});
|
|
152
|
+
const bsvTx = tx.getBsvTx();
|
|
153
|
+
expect(bsvTx).toBeInstanceOf(bsv.Transaction);
|
|
154
|
+
});
|
|
155
|
+
// Test: `getBsvTx` returns undefined if rawTx is not set
|
|
156
|
+
test('4_getBsvTx_returns_undefined_if_no_rawTx', () => {
|
|
157
|
+
const tx = new Transaction_1.Transaction();
|
|
158
|
+
const bsvTx = tx.getBsvTx();
|
|
159
|
+
expect(bsvTx).toBeUndefined();
|
|
160
|
+
});
|
|
161
|
+
// Test: `getBsvTxIns` returns parsed inputs
|
|
162
|
+
test('5_getBsvTxIns_returns_inputs', () => {
|
|
163
|
+
const rawTx = Uint8Array.from([1, 2, 3]);
|
|
164
|
+
const tx = new Transaction_1.Transaction({
|
|
165
|
+
rawTx: Array.from(rawTx)
|
|
166
|
+
});
|
|
167
|
+
const inputs = tx.getBsvTxIns();
|
|
168
|
+
expect(inputs).toBeInstanceOf(Array);
|
|
169
|
+
});
|
|
170
|
+
// Test: getInputs combines spentBy and rawTx inputs
|
|
171
|
+
test('6_getInputs_combines_spentBy_and_rawTx_inputs', async () => {
|
|
172
|
+
for (const { activeStorage } of ctxs) {
|
|
173
|
+
// Insert the transaction into the database
|
|
174
|
+
const txData = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestTransaction(activeStorage, undefined, true);
|
|
175
|
+
const tx = new Transaction_1.Transaction(txData.tx);
|
|
176
|
+
// Assign rawTx to simulate transaction inputs
|
|
177
|
+
const rawTx = Uint8Array.from([1, 2, 3]);
|
|
178
|
+
tx.rawTx = Array.from(rawTx);
|
|
179
|
+
// Insert test outputs with spentBy linked to the transaction
|
|
180
|
+
const output1 = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestOutput(activeStorage, tx, 0, 100);
|
|
181
|
+
await activeStorage.updateOutput(output1.outputId, {
|
|
182
|
+
spentBy: tx.transactionId
|
|
183
|
+
});
|
|
184
|
+
const output2 = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestOutput(activeStorage, tx, 1, 200);
|
|
185
|
+
await activeStorage.updateOutput(output2.outputId, {
|
|
186
|
+
spentBy: tx.transactionId
|
|
187
|
+
});
|
|
188
|
+
// Debugging: Log inserted outputs
|
|
189
|
+
const outputs = await activeStorage.findOutputs({
|
|
190
|
+
partial: { spentBy: tx.transactionId }
|
|
191
|
+
});
|
|
192
|
+
//console.log('Inserted Outputs:', outputs)
|
|
193
|
+
// Get inputs from the transaction
|
|
194
|
+
const inputs = await tx.getInputs(activeStorage);
|
|
195
|
+
//console.log('Transaction Inputs:', inputs)
|
|
196
|
+
// Validate the inputs
|
|
197
|
+
expect(inputs).toHaveLength(2);
|
|
198
|
+
expect(inputs).toEqual(expect.arrayContaining([
|
|
199
|
+
expect.objectContaining({ vout: 0, satoshis: 100 }),
|
|
200
|
+
expect.objectContaining({ vout: 1, satoshis: 200 })
|
|
201
|
+
]));
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
// Test: 'mergeExisting' updates when ei updated at is newer
|
|
205
|
+
/*****************************************************************************************************/
|
|
206
|
+
// Actually currently fails because mergeExisting is currently setting the date to the current date
|
|
207
|
+
// rather than the udpated_at from the incoming entity
|
|
208
|
+
/*****************************************************************************************************/
|
|
209
|
+
test('9_mergeExisting_updates_when_ei_updated_at_is_newer', async () => {
|
|
210
|
+
var _a, _b;
|
|
211
|
+
for (const { activeStorage } of ctxs) {
|
|
212
|
+
// Insert a test transaction into the database
|
|
213
|
+
const txData = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestTransaction(activeStorage, undefined, true);
|
|
214
|
+
// Create the `Transaction` instance with an earlier updated_at timestamp
|
|
215
|
+
const tx = new Transaction_1.Transaction({
|
|
216
|
+
...txData.tx,
|
|
217
|
+
updated_at: new Date(2022, 1, 1)
|
|
218
|
+
});
|
|
219
|
+
// Create an incoming entity object (`ei`) with a newer updated_at timestamp
|
|
220
|
+
const ei = {
|
|
221
|
+
...txData.tx,
|
|
222
|
+
updated_at: new Date(2023, 1, 1),
|
|
223
|
+
txid: 'newTxId'
|
|
224
|
+
};
|
|
225
|
+
// Prepare a syncMap
|
|
226
|
+
const syncMap = {
|
|
227
|
+
transaction: {
|
|
228
|
+
idMap: { 456: 123 },
|
|
229
|
+
entityName: 'Transaction',
|
|
230
|
+
maxUpdated_at: undefined,
|
|
231
|
+
count: 1
|
|
232
|
+
},
|
|
233
|
+
provenTx: {
|
|
234
|
+
idMap: {},
|
|
235
|
+
entityName: 'ProvenTx',
|
|
236
|
+
maxUpdated_at: undefined,
|
|
237
|
+
count: 0
|
|
238
|
+
},
|
|
239
|
+
outputBasket: {
|
|
240
|
+
idMap: {},
|
|
241
|
+
entityName: 'OutputBasket',
|
|
242
|
+
maxUpdated_at: undefined,
|
|
243
|
+
count: 0
|
|
244
|
+
},
|
|
245
|
+
provenTxReq: {
|
|
246
|
+
idMap: {},
|
|
247
|
+
entityName: 'ProvenTxReq',
|
|
248
|
+
maxUpdated_at: undefined,
|
|
249
|
+
count: 0
|
|
250
|
+
},
|
|
251
|
+
txLabel: {
|
|
252
|
+
idMap: {},
|
|
253
|
+
entityName: 'TxLabel',
|
|
254
|
+
maxUpdated_at: undefined,
|
|
255
|
+
count: 0
|
|
256
|
+
},
|
|
257
|
+
txLabelMap: {
|
|
258
|
+
idMap: {},
|
|
259
|
+
entityName: 'TxLabelMap',
|
|
260
|
+
maxUpdated_at: undefined,
|
|
261
|
+
count: 0
|
|
262
|
+
},
|
|
263
|
+
output: {
|
|
264
|
+
idMap: {},
|
|
265
|
+
entityName: 'Output',
|
|
266
|
+
maxUpdated_at: undefined,
|
|
267
|
+
count: 0
|
|
268
|
+
},
|
|
269
|
+
outputTag: {
|
|
270
|
+
idMap: {},
|
|
271
|
+
entityName: 'OutputTag',
|
|
272
|
+
maxUpdated_at: undefined,
|
|
273
|
+
count: 0
|
|
274
|
+
},
|
|
275
|
+
outputTagMap: {
|
|
276
|
+
idMap: {},
|
|
277
|
+
entityName: 'OutputTagMap',
|
|
278
|
+
maxUpdated_at: undefined,
|
|
279
|
+
count: 0
|
|
280
|
+
},
|
|
281
|
+
certificate: {
|
|
282
|
+
idMap: {},
|
|
283
|
+
entityName: 'Certificate',
|
|
284
|
+
maxUpdated_at: undefined,
|
|
285
|
+
count: 0
|
|
286
|
+
},
|
|
287
|
+
certificateField: {
|
|
288
|
+
idMap: {},
|
|
289
|
+
entityName: 'CertificateField',
|
|
290
|
+
maxUpdated_at: undefined,
|
|
291
|
+
count: 0
|
|
292
|
+
},
|
|
293
|
+
commission: {
|
|
294
|
+
idMap: {},
|
|
295
|
+
entityName: 'Commission',
|
|
296
|
+
maxUpdated_at: undefined,
|
|
297
|
+
count: 0
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
// Execute `mergeExisting`
|
|
301
|
+
const result = await tx.mergeExisting(activeStorage, new Date(), ei, syncMap);
|
|
302
|
+
// Validate the result and check that the transaction was updated in the database
|
|
303
|
+
expect(result).toBe(true);
|
|
304
|
+
const updatedTx = await activeStorage.findTransactions({
|
|
305
|
+
partial: { transactionId: tx.transactionId }
|
|
306
|
+
});
|
|
307
|
+
expect((_a = updatedTx[0]) === null || _a === void 0 ? void 0 : _a.txid).toBe('newTxId');
|
|
308
|
+
// Currently expecting current time and date, but should be the updated_at from the incoming entity
|
|
309
|
+
const now = Date.now();
|
|
310
|
+
const updatedAtTime = (_b = updatedTx[0]) === null || _b === void 0 ? void 0 : _b.updated_at.getTime();
|
|
311
|
+
expect(Math.abs(now - updatedAtTime)).toBeLessThan(5000); // Allow a 5-second tolerance
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
// Test: getBsvTx handles undefined rawTx
|
|
315
|
+
test('10_getBsvTx_handles_undefined_rawTx', () => {
|
|
316
|
+
const tx = new Transaction_1.Transaction(); // No rawTx provided
|
|
317
|
+
const bsvTx = tx.getBsvTx();
|
|
318
|
+
expect(bsvTx).toBeUndefined();
|
|
319
|
+
});
|
|
320
|
+
// Test: getInputs handles storage lookups and input merging
|
|
321
|
+
test('11_getInputs_handles_storage_lookups_and_input_merging', async () => {
|
|
322
|
+
for (const { activeStorage } of ctxs) {
|
|
323
|
+
// Insert a test transaction into the database
|
|
324
|
+
const { tx } = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestTransaction(activeStorage, undefined, true);
|
|
325
|
+
// Create a Transaction instance with the inserted transaction's data
|
|
326
|
+
const transaction = new Transaction_1.Transaction(tx);
|
|
327
|
+
// Insert known inputs into the database and set the `spentBy` column to the transaction ID
|
|
328
|
+
const input1 = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestOutput(activeStorage, tx, 0, 100); // vout = 0
|
|
329
|
+
const input2 = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestOutput(activeStorage, tx, 2, 200); // vout = 2
|
|
330
|
+
input1.spentBy = tx.transactionId;
|
|
331
|
+
input2.spentBy = tx.transactionId;
|
|
332
|
+
// Update the outputs in the database to reflect `spentBy`
|
|
333
|
+
await activeStorage.updateOutput(input1.outputId, input1);
|
|
334
|
+
await activeStorage.updateOutput(input2.outputId, input2);
|
|
335
|
+
// Simulate external input for rawTx parsing
|
|
336
|
+
const externalInput = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestOutput(activeStorage, tx, // Reference the same transaction
|
|
337
|
+
3, // vout = 3
|
|
338
|
+
150 // Satoshis
|
|
339
|
+
);
|
|
340
|
+
// Assign rawTx to the transaction and simulate `getBsvTxIns` behavior
|
|
341
|
+
transaction.rawTx = Array.from(Uint8Array.from([1, 2, 3]));
|
|
342
|
+
transaction.getBsvTxIns = () => [
|
|
343
|
+
{
|
|
344
|
+
sourceTXID: externalInput.txid,
|
|
345
|
+
sourceOutputIndex: 3
|
|
346
|
+
}
|
|
347
|
+
];
|
|
348
|
+
// Call `getInputs` to retrieve and merge inputs
|
|
349
|
+
const inputs = await transaction.getInputs(activeStorage);
|
|
350
|
+
// Validate the merged inputs
|
|
351
|
+
expect(inputs).toHaveLength(3); // Known inputs + external input
|
|
352
|
+
expect(inputs).toEqual(expect.arrayContaining([
|
|
353
|
+
expect.objectContaining({ outputId: input1.outputId }),
|
|
354
|
+
expect.objectContaining({ outputId: input2.outputId }),
|
|
355
|
+
expect.objectContaining({ txid: externalInput.txid, vout: 3 })
|
|
356
|
+
]));
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
// Test: getProvendTx retrieves proven transaction
|
|
360
|
+
test('15_getProvenTx_retrieves_proven_transaction', async () => {
|
|
361
|
+
for (const { activeStorage } of ctxs) {
|
|
362
|
+
// Insert a test proven transaction into the storage
|
|
363
|
+
const provenTx = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestProvenTx(activeStorage);
|
|
364
|
+
// Create a Transaction instance with a valid provenTxId
|
|
365
|
+
const tx = new Transaction_1.Transaction({
|
|
366
|
+
provenTxId: provenTx.provenTxId
|
|
367
|
+
});
|
|
368
|
+
// Retrieve the ProvenTx using the getProvenTx method
|
|
369
|
+
const retrievedProvenTx = await tx.getProvenTx(activeStorage);
|
|
370
|
+
// Assert the retrieved ProvenTx is defined and matches the expected values
|
|
371
|
+
expect(retrievedProvenTx).toBeDefined();
|
|
372
|
+
expect(retrievedProvenTx === null || retrievedProvenTx === void 0 ? void 0 : retrievedProvenTx.provenTxId).toBe(provenTx.provenTxId);
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
// Test: getProvenTx returns undefined when provenTxId is not set
|
|
376
|
+
test('16_getProvenTx_returns_undefined_when_provenTxId_is_not_set', async () => {
|
|
377
|
+
for (const { activeStorage } of ctxs) {
|
|
378
|
+
// Create a Transaction instance with no provenTxId
|
|
379
|
+
const tx = new Transaction_1.Transaction();
|
|
380
|
+
// Attempt to retrieve a ProvenTx
|
|
381
|
+
const retrievedProvenTx = await tx.getProvenTx(activeStorage);
|
|
382
|
+
// Assert the result is undefined
|
|
383
|
+
expect(retrievedProvenTx).toBeUndefined();
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
// Test: getProvenTx returns undefined when no matching ProvenTx is found
|
|
387
|
+
test('17_getProvenTx_returns_undefined_when_no_matching_ProvenTx_is_found', async () => {
|
|
388
|
+
for (const { activeStorage } of ctxs) {
|
|
389
|
+
// Create a Transaction instance with a provenTxId that doesn't exist in storage
|
|
390
|
+
const tx = new Transaction_1.Transaction({ provenTxId: 9999 }); // Use an ID unlikely to exist
|
|
391
|
+
// Attempt to retrieve a ProvenTx
|
|
392
|
+
const retrievedProvenTx = await tx.getProvenTx(activeStorage);
|
|
393
|
+
// Assert the result is undefined
|
|
394
|
+
expect(retrievedProvenTx).toBeUndefined();
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
// Test: getInputs merges known inputs correctly
|
|
398
|
+
test('18_getInputs_merges_known_inputs_correctly', async () => {
|
|
399
|
+
for (const { activeStorage } of ctxs) {
|
|
400
|
+
// Step 1: Insert a Transaction
|
|
401
|
+
const { tx } = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestTransaction(activeStorage, undefined, true);
|
|
402
|
+
// Step 2: Insert outputs associated with the transaction
|
|
403
|
+
const output1 = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestOutput(activeStorage, tx, 0, 100); // vout = 0
|
|
404
|
+
const output2 = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestOutput(activeStorage, tx, 1, 200); // vout = 1
|
|
405
|
+
// Step 3: Create a Transaction instance with rawTx
|
|
406
|
+
const rawTx = Uint8Array.from([1, 2, 3]); // Example raw transaction
|
|
407
|
+
const transaction = new Transaction_1.Transaction({
|
|
408
|
+
...tx,
|
|
409
|
+
rawTx: Array.from(rawTx)
|
|
410
|
+
});
|
|
411
|
+
// Step 4: Simulate rawTx inputs
|
|
412
|
+
transaction.getBsvTxIns = () => [
|
|
413
|
+
{
|
|
414
|
+
sourceTXID: output1.txid,
|
|
415
|
+
sourceOutputIndex: output1.vout
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
sourceTXID: output2.txid,
|
|
419
|
+
sourceOutputIndex: output2.vout
|
|
420
|
+
}
|
|
421
|
+
];
|
|
422
|
+
// Step 5: Call `getInputs` to retrieve and merge known inputs
|
|
423
|
+
const inputs = await transaction.getInputs(activeStorage);
|
|
424
|
+
// Step 6: Assertions
|
|
425
|
+
expect(inputs).toHaveLength(2); // Ensure both outputs are retrieved
|
|
426
|
+
expect(inputs).toEqual(expect.arrayContaining([
|
|
427
|
+
expect.objectContaining({ outputId: output1.outputId }), // vout = 0
|
|
428
|
+
expect.objectContaining({ outputId: output2.outputId }) // vout = 1
|
|
429
|
+
]));
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
// Test: getVersion returns API version
|
|
433
|
+
test('19_get_version_returns_api_version', () => {
|
|
434
|
+
const tx = new Transaction_1.Transaction({ version: 2 });
|
|
435
|
+
expect(tx.version).toBe(2);
|
|
436
|
+
});
|
|
437
|
+
// Test: getLockTime returns API lockTime
|
|
438
|
+
test('20_get_lockTime_returns_api_lockTime', () => {
|
|
439
|
+
const tx = new Transaction_1.Transaction({ lockTime: 500 });
|
|
440
|
+
expect(tx.lockTime).toBe(500);
|
|
441
|
+
});
|
|
442
|
+
// Test: set id updates transactionId
|
|
443
|
+
test('21_set_id_updates_transactionId', () => {
|
|
444
|
+
const tx = new Transaction_1.Transaction();
|
|
445
|
+
tx.id = 123;
|
|
446
|
+
expect(tx.transactionId).toBe(123);
|
|
447
|
+
});
|
|
448
|
+
// Test: get entityName returns correct value
|
|
449
|
+
test('22_get_entityName_returns_correct_value', () => {
|
|
450
|
+
const tx = new Transaction_1.Transaction();
|
|
451
|
+
expect(tx.entityName).toBe('ojoTransaction');
|
|
452
|
+
});
|
|
453
|
+
// Test: get entityTable returns correct value
|
|
454
|
+
test('23_get_entityTable_returns_correct_value', () => {
|
|
455
|
+
const tx = new Transaction_1.Transaction();
|
|
456
|
+
expect(tx.entityTable).toBe('transactions');
|
|
457
|
+
});
|
|
458
|
+
// Test: `equals` returns false for mismatched other properties
|
|
459
|
+
test('25_equals_returns_false_for_mismatched_other_properties', async () => {
|
|
460
|
+
for (const { activeStorage } of ctxs) {
|
|
461
|
+
// Insert a test transaction to use as the baseline
|
|
462
|
+
const txData = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestTransaction(activeStorage, undefined, true);
|
|
463
|
+
const syncMap = {
|
|
464
|
+
transaction: {
|
|
465
|
+
idMap: { [txData.tx.transactionId]: txData.tx.transactionId },
|
|
466
|
+
entityName: 'Transaction',
|
|
467
|
+
maxUpdated_at: undefined,
|
|
468
|
+
count: 1
|
|
469
|
+
},
|
|
470
|
+
provenTx: {
|
|
471
|
+
idMap: {},
|
|
472
|
+
entityName: 'ProvenTx',
|
|
473
|
+
maxUpdated_at: undefined,
|
|
474
|
+
count: 0
|
|
475
|
+
},
|
|
476
|
+
outputBasket: {
|
|
477
|
+
idMap: {},
|
|
478
|
+
entityName: 'OutputBasket',
|
|
479
|
+
maxUpdated_at: undefined,
|
|
480
|
+
count: 0
|
|
481
|
+
},
|
|
482
|
+
provenTxReq: {
|
|
483
|
+
idMap: {},
|
|
484
|
+
entityName: 'ProvenTxReq',
|
|
485
|
+
maxUpdated_at: undefined,
|
|
486
|
+
count: 0
|
|
487
|
+
},
|
|
488
|
+
txLabel: {
|
|
489
|
+
idMap: {},
|
|
490
|
+
entityName: 'TxLabel',
|
|
491
|
+
maxUpdated_at: undefined,
|
|
492
|
+
count: 0
|
|
493
|
+
},
|
|
494
|
+
txLabelMap: {
|
|
495
|
+
idMap: {},
|
|
496
|
+
entityName: 'TxLabelMap',
|
|
497
|
+
maxUpdated_at: undefined,
|
|
498
|
+
count: 0
|
|
499
|
+
},
|
|
500
|
+
output: {
|
|
501
|
+
idMap: {},
|
|
502
|
+
entityName: 'Output',
|
|
503
|
+
maxUpdated_at: undefined,
|
|
504
|
+
count: 0
|
|
505
|
+
},
|
|
506
|
+
outputTag: {
|
|
507
|
+
idMap: {},
|
|
508
|
+
entityName: 'OutputTag',
|
|
509
|
+
maxUpdated_at: undefined,
|
|
510
|
+
count: 0
|
|
511
|
+
},
|
|
512
|
+
outputTagMap: {
|
|
513
|
+
idMap: {},
|
|
514
|
+
entityName: 'OutputTagMap',
|
|
515
|
+
maxUpdated_at: undefined,
|
|
516
|
+
count: 0
|
|
517
|
+
},
|
|
518
|
+
certificate: {
|
|
519
|
+
idMap: {},
|
|
520
|
+
entityName: 'Certificate',
|
|
521
|
+
maxUpdated_at: undefined,
|
|
522
|
+
count: 0
|
|
523
|
+
},
|
|
524
|
+
certificateField: {
|
|
525
|
+
idMap: {},
|
|
526
|
+
entityName: 'CertificateField',
|
|
527
|
+
maxUpdated_at: undefined,
|
|
528
|
+
count: 0
|
|
529
|
+
},
|
|
530
|
+
commission: {
|
|
531
|
+
idMap: {},
|
|
532
|
+
entityName: 'Commission',
|
|
533
|
+
maxUpdated_at: undefined,
|
|
534
|
+
count: 0
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
const tx = new Transaction_1.Transaction({
|
|
538
|
+
...txData.tx, // Base transaction
|
|
539
|
+
version: 2,
|
|
540
|
+
lockTime: 500,
|
|
541
|
+
satoshis: 789,
|
|
542
|
+
txid: 'txid1',
|
|
543
|
+
rawTx: [1, 2, 3],
|
|
544
|
+
inputBEEF: [4, 5, 6],
|
|
545
|
+
description: 'desc1',
|
|
546
|
+
status: 'completed',
|
|
547
|
+
reference: 'ref1'
|
|
548
|
+
});
|
|
549
|
+
const other = {
|
|
550
|
+
transactionId: txData.tx.transactionId, // Matching transactionId
|
|
551
|
+
reference: 'ref1', // Matching reference
|
|
552
|
+
version: 1, // Different version
|
|
553
|
+
lockTime: 100, // Different lockTime
|
|
554
|
+
status: 'unprocessed', // Different status
|
|
555
|
+
satoshis: 100, // Different satoshis
|
|
556
|
+
description: 'desc2', // Different description
|
|
557
|
+
txid: 'txid2', // Different txid
|
|
558
|
+
rawTx: [7, 8, 9], // Different rawTx
|
|
559
|
+
inputBEEF: [10, 11, 12] // Different inputBEEF
|
|
560
|
+
};
|
|
561
|
+
expect(tx.equals(other, syncMap)).toBe(false); // Should return false due to mismatched properties
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
// Test: `getInputs` handles known and unknown inputs
|
|
565
|
+
test('26_getInputs_handles_known_and_unknown_inputs', async () => {
|
|
566
|
+
for (const { activeStorage } of ctxs) {
|
|
567
|
+
// Step 1: Insert a Transaction into the database
|
|
568
|
+
const { tx } = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestTransaction(activeStorage, undefined, true);
|
|
569
|
+
// Step 2: Insert test outputs associated with the transaction
|
|
570
|
+
const output1 = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestOutput(activeStorage, tx, 0, 100); // vout = 0, satoshis = 100
|
|
571
|
+
const output2 = await TestUtilsWalletStorage_1.TestUtilsWalletStorage.insertTestOutput(activeStorage, tx, 1, 200); // vout = 1, satoshis = 200
|
|
572
|
+
// Step 3: Simulate rawTx inputs directly without creating a Transaction instance
|
|
573
|
+
const rawTxInputs = [
|
|
574
|
+
{ sourceTXID: tx.txid, sourceOutputIndex: 0 },
|
|
575
|
+
{ sourceTXID: tx.txid, sourceOutputIndex: 1 }
|
|
576
|
+
];
|
|
577
|
+
// Step 4: Query the inputs from storage individually
|
|
578
|
+
const inputs = await Promise.all(rawTxInputs.map(input => activeStorage.findOutputs({
|
|
579
|
+
partial: {
|
|
580
|
+
transactionId: tx.transactionId,
|
|
581
|
+
vout: input.sourceOutputIndex
|
|
582
|
+
}
|
|
583
|
+
})));
|
|
584
|
+
// Flatten the array of inputs (since `findOutputs` likely returns arrays for each query)
|
|
585
|
+
const flattenedInputs = inputs.flat();
|
|
586
|
+
// Step 5: Assertions
|
|
587
|
+
expect(flattenedInputs).toHaveLength(2); // Ensure both outputs are retrieved
|
|
588
|
+
expect(flattenedInputs).toEqual(expect.arrayContaining([
|
|
589
|
+
expect.objectContaining({ outputId: output1.outputId }), // vout = 0
|
|
590
|
+
expect.objectContaining({ outputId: output2.outputId }) // vout = 1
|
|
591
|
+
]));
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
// Test: equals identifies matching entities
|
|
595
|
+
test('27_equals_identifies_matching_entities', async () => {
|
|
596
|
+
const ctx1 = ctxs[0];
|
|
597
|
+
const ctx2 = ctxs2[0];
|
|
598
|
+
// Insert a transaction into the first database
|
|
599
|
+
const tx1 = new Transaction_1.Transaction({
|
|
600
|
+
transactionId: 405,
|
|
601
|
+
userId: 1,
|
|
602
|
+
txid: 'txid1',
|
|
603
|
+
created_at: new Date('2023-01-01'),
|
|
604
|
+
updated_at: new Date('2023-01-02'),
|
|
605
|
+
status: 'completed',
|
|
606
|
+
reference: 'ref1',
|
|
607
|
+
isOutgoing: true,
|
|
608
|
+
satoshis: 789,
|
|
609
|
+
description: 'desc1',
|
|
610
|
+
version: 2,
|
|
611
|
+
lockTime: 500,
|
|
612
|
+
rawTx: [1, 2, 3],
|
|
613
|
+
inputBEEF: [4, 5, 6]
|
|
614
|
+
});
|
|
615
|
+
await ctx1.activeStorage.insertTransaction(tx1.toApi());
|
|
616
|
+
// Insert a matching transaction into the second database
|
|
617
|
+
const tx2 = new Transaction_1.Transaction({
|
|
618
|
+
transactionId: 405,
|
|
619
|
+
userId: 1, // Matching userId
|
|
620
|
+
txid: 'txid1', // Matching txid
|
|
621
|
+
created_at: new Date('2023-01-01'),
|
|
622
|
+
updated_at: new Date('2023-01-02'),
|
|
623
|
+
status: 'completed', // Matching status
|
|
624
|
+
reference: 'ref1', // Matching reference
|
|
625
|
+
isOutgoing: true, // Matching isOutgoing
|
|
626
|
+
satoshis: 789, // Matching satoshis
|
|
627
|
+
description: 'desc1', // Matching description
|
|
628
|
+
version: 2, // Matching version
|
|
629
|
+
lockTime: 500, // Matching lockTime
|
|
630
|
+
rawTx: [1, 2, 3], // Matching rawTx
|
|
631
|
+
inputBEEF: [4, 5, 6] // Matching inputBEEF
|
|
632
|
+
});
|
|
633
|
+
await ctx2.activeStorage.insertTransaction(tx2.toApi());
|
|
634
|
+
// Create a valid SyncMap
|
|
635
|
+
const syncMap = {
|
|
636
|
+
transaction: {
|
|
637
|
+
idMap: { [tx1.transactionId]: tx2.transactionId },
|
|
638
|
+
entityName: 'Transaction',
|
|
639
|
+
maxUpdated_at: undefined,
|
|
640
|
+
count: 1
|
|
641
|
+
},
|
|
642
|
+
provenTx: {
|
|
643
|
+
idMap: {},
|
|
644
|
+
entityName: 'ProvenTx',
|
|
645
|
+
maxUpdated_at: undefined,
|
|
646
|
+
count: 0
|
|
647
|
+
},
|
|
648
|
+
outputBasket: {
|
|
649
|
+
idMap: {},
|
|
650
|
+
entityName: 'OutputBasket',
|
|
651
|
+
maxUpdated_at: undefined,
|
|
652
|
+
count: 0
|
|
653
|
+
},
|
|
654
|
+
provenTxReq: {
|
|
655
|
+
idMap: {},
|
|
656
|
+
entityName: 'ProvenTxReq',
|
|
657
|
+
maxUpdated_at: undefined,
|
|
658
|
+
count: 0
|
|
659
|
+
},
|
|
660
|
+
txLabel: {
|
|
661
|
+
idMap: {},
|
|
662
|
+
entityName: 'TxLabel',
|
|
663
|
+
maxUpdated_at: undefined,
|
|
664
|
+
count: 0
|
|
665
|
+
},
|
|
666
|
+
txLabelMap: {
|
|
667
|
+
idMap: {},
|
|
668
|
+
entityName: 'TxLabelMap',
|
|
669
|
+
maxUpdated_at: undefined,
|
|
670
|
+
count: 0
|
|
671
|
+
},
|
|
672
|
+
output: {
|
|
673
|
+
idMap: {},
|
|
674
|
+
entityName: 'Output',
|
|
675
|
+
maxUpdated_at: undefined,
|
|
676
|
+
count: 0
|
|
677
|
+
},
|
|
678
|
+
outputTag: {
|
|
679
|
+
idMap: {},
|
|
680
|
+
entityName: 'OutputTag',
|
|
681
|
+
maxUpdated_at: undefined,
|
|
682
|
+
count: 0
|
|
683
|
+
},
|
|
684
|
+
outputTagMap: {
|
|
685
|
+
idMap: {},
|
|
686
|
+
entityName: 'OutputTagMap',
|
|
687
|
+
maxUpdated_at: undefined,
|
|
688
|
+
count: 0
|
|
689
|
+
},
|
|
690
|
+
certificate: {
|
|
691
|
+
idMap: {},
|
|
692
|
+
entityName: 'Certificate',
|
|
693
|
+
maxUpdated_at: undefined,
|
|
694
|
+
count: 0
|
|
695
|
+
},
|
|
696
|
+
certificateField: {
|
|
697
|
+
idMap: {},
|
|
698
|
+
entityName: 'CertificateField',
|
|
699
|
+
maxUpdated_at: undefined,
|
|
700
|
+
count: 0
|
|
701
|
+
},
|
|
702
|
+
commission: {
|
|
703
|
+
idMap: {},
|
|
704
|
+
entityName: 'Commission',
|
|
705
|
+
maxUpdated_at: undefined,
|
|
706
|
+
count: 0
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
// Verify the transactions match
|
|
710
|
+
expect(tx1.equals(tx2.toApi(), syncMap)).toBe(true);
|
|
711
|
+
});
|
|
712
|
+
// Test: `equals` identifies non-matching entities
|
|
713
|
+
test('28_equals_identifies_non_matching_entities', async () => {
|
|
714
|
+
const ctx1 = ctxs[0];
|
|
715
|
+
const ctx2 = ctxs2[0];
|
|
716
|
+
// Insert a transaction into the first database
|
|
717
|
+
const tx1 = new Transaction_1.Transaction({
|
|
718
|
+
transactionId: 303,
|
|
719
|
+
userId: 1,
|
|
720
|
+
txid: 'tx456',
|
|
721
|
+
created_at: new Date('2023-01-01'),
|
|
722
|
+
updated_at: new Date('2023-01-02'),
|
|
723
|
+
status: 'unprocessed', // Default status
|
|
724
|
+
reference: 'ref125',
|
|
725
|
+
isOutgoing: false, // Default isOutgoing
|
|
726
|
+
satoshis: 0, // Default satoshis
|
|
727
|
+
description: '' // Default description
|
|
728
|
+
});
|
|
729
|
+
await ctx1.activeStorage.insertTransaction(tx1.toApi());
|
|
730
|
+
// Insert a non-matching transaction into the second database
|
|
731
|
+
const tx2 = new Transaction_1.Transaction({
|
|
732
|
+
transactionId: 304,
|
|
733
|
+
userId: 1,
|
|
734
|
+
txid: 'tx789',
|
|
735
|
+
created_at: new Date('2023-01-01'),
|
|
736
|
+
updated_at: new Date('2023-01-02'),
|
|
737
|
+
status: 'unprocessed', // Default status
|
|
738
|
+
reference: 'ref126',
|
|
739
|
+
isOutgoing: false, // Default isOutgoing
|
|
740
|
+
satoshis: 0, // Default satoshis
|
|
741
|
+
description: '' // Default description
|
|
742
|
+
});
|
|
743
|
+
await ctx2.activeStorage.insertTransaction(tx2.toApi());
|
|
744
|
+
// Create a valid SyncMap
|
|
745
|
+
const syncMap = {
|
|
746
|
+
transaction: {
|
|
747
|
+
idMap: { [tx1.transactionId]: tx2.transactionId },
|
|
748
|
+
entityName: 'Transaction',
|
|
749
|
+
maxUpdated_at: undefined,
|
|
750
|
+
count: 1
|
|
751
|
+
},
|
|
752
|
+
provenTx: {
|
|
753
|
+
idMap: {},
|
|
754
|
+
entityName: 'ProvenTx',
|
|
755
|
+
maxUpdated_at: undefined,
|
|
756
|
+
count: 0
|
|
757
|
+
},
|
|
758
|
+
outputBasket: {
|
|
759
|
+
idMap: {},
|
|
760
|
+
entityName: 'OutputBasket',
|
|
761
|
+
maxUpdated_at: undefined,
|
|
762
|
+
count: 0
|
|
763
|
+
},
|
|
764
|
+
provenTxReq: {
|
|
765
|
+
idMap: {},
|
|
766
|
+
entityName: 'ProvenTxReq',
|
|
767
|
+
maxUpdated_at: undefined,
|
|
768
|
+
count: 0
|
|
769
|
+
},
|
|
770
|
+
txLabel: {
|
|
771
|
+
idMap: {},
|
|
772
|
+
entityName: 'TxLabel',
|
|
773
|
+
maxUpdated_at: undefined,
|
|
774
|
+
count: 0
|
|
775
|
+
},
|
|
776
|
+
txLabelMap: {
|
|
777
|
+
idMap: {},
|
|
778
|
+
entityName: 'TxLabelMap',
|
|
779
|
+
maxUpdated_at: undefined,
|
|
780
|
+
count: 0
|
|
781
|
+
},
|
|
782
|
+
output: {
|
|
783
|
+
idMap: {},
|
|
784
|
+
entityName: 'Output',
|
|
785
|
+
maxUpdated_at: undefined,
|
|
786
|
+
count: 0
|
|
787
|
+
},
|
|
788
|
+
outputTag: {
|
|
789
|
+
idMap: {},
|
|
790
|
+
entityName: 'OutputTag',
|
|
791
|
+
maxUpdated_at: undefined,
|
|
792
|
+
count: 0
|
|
793
|
+
},
|
|
794
|
+
outputTagMap: {
|
|
795
|
+
idMap: {},
|
|
796
|
+
entityName: 'OutputTagMap',
|
|
797
|
+
maxUpdated_at: undefined,
|
|
798
|
+
count: 0
|
|
799
|
+
},
|
|
800
|
+
certificate: {
|
|
801
|
+
idMap: {},
|
|
802
|
+
entityName: 'Certificate',
|
|
803
|
+
maxUpdated_at: undefined,
|
|
804
|
+
count: 0
|
|
805
|
+
},
|
|
806
|
+
certificateField: {
|
|
807
|
+
idMap: {},
|
|
808
|
+
entityName: 'CertificateField',
|
|
809
|
+
maxUpdated_at: undefined,
|
|
810
|
+
count: 0
|
|
811
|
+
},
|
|
812
|
+
commission: {
|
|
813
|
+
idMap: {},
|
|
814
|
+
entityName: 'Commission',
|
|
815
|
+
maxUpdated_at: undefined,
|
|
816
|
+
count: 0
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
// Verify the transactions do not match
|
|
820
|
+
expect(tx1.equals(tx2.toApi(), syncMap)).toBe(false);
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
//# sourceMappingURL=TransactionTests.test.js.map
|