@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,510 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import {
|
|
3
|
+
Beef,
|
|
4
|
+
CreateActionArgs,
|
|
5
|
+
InternalizeActionArgs,
|
|
6
|
+
KeyDeriver,
|
|
7
|
+
KeyDeriverApi,
|
|
8
|
+
PrivateKey,
|
|
9
|
+
Utils,
|
|
10
|
+
WalletInterface
|
|
11
|
+
} from '@bsv/sdk'
|
|
12
|
+
import {
|
|
13
|
+
Services,
|
|
14
|
+
asString,
|
|
15
|
+
StorageKnex,
|
|
16
|
+
sdk,
|
|
17
|
+
table,
|
|
18
|
+
verifyOne,
|
|
19
|
+
verifyId,
|
|
20
|
+
ScriptTemplateSABPPP,
|
|
21
|
+
randomBytesBase64,
|
|
22
|
+
randomBytes,
|
|
23
|
+
entity
|
|
24
|
+
} from '../../../src/index.all'
|
|
25
|
+
import {
|
|
26
|
+
_tu,
|
|
27
|
+
TestWalletNoSetup,
|
|
28
|
+
TestWalletOnly
|
|
29
|
+
} from '../../utils/TestUtilsWalletStorage'
|
|
30
|
+
|
|
31
|
+
import dotenv from 'dotenv'
|
|
32
|
+
dotenv.config()
|
|
33
|
+
|
|
34
|
+
describe('walletLive test', () => {
|
|
35
|
+
jest.setTimeout(99999999)
|
|
36
|
+
|
|
37
|
+
const env = _tu.getEnv('test')
|
|
38
|
+
const myIdentityKey = env.identityKey
|
|
39
|
+
const myRootKeyHex = env.devKeys[myIdentityKey]
|
|
40
|
+
if (!myIdentityKey || !myRootKeyHex)
|
|
41
|
+
throw new sdk.WERR_INVALID_OPERATION(
|
|
42
|
+
`Requires a .env file with MY_${env.chain.toUpperCase()}_IDENTITY and corresponding DEV_KEYS entries.`
|
|
43
|
+
)
|
|
44
|
+
const myIdentityKey2 = env.identityKey2
|
|
45
|
+
if (!myIdentityKey2)
|
|
46
|
+
throw new sdk.WERR_INVALID_OPERATION(
|
|
47
|
+
`Requires a .env file with MY_${env.chain.toUpperCase()}_IDENTITY2 and corresponding DEV_KEYS entries.`
|
|
48
|
+
)
|
|
49
|
+
const myRootKeyHex2 = env.devKeys[myIdentityKey2!]
|
|
50
|
+
if (!myRootKeyHex2)
|
|
51
|
+
throw new sdk.WERR_INVALID_OPERATION(
|
|
52
|
+
`Requires a .env file with MY_${env.chain.toUpperCase()}_IDENTITY2 and corresponding DEV_KEYS entries.`
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
let myCtx: TestWalletOnly
|
|
56
|
+
let myCtx2: TestWalletOnly
|
|
57
|
+
const ctxs: TestWalletNoSetup[] = []
|
|
58
|
+
let stagingStorage: StorageKnex
|
|
59
|
+
|
|
60
|
+
beforeAll(async () => {
|
|
61
|
+
myCtx = await _tu.createTestWalletWithStorageClient({
|
|
62
|
+
rootKeyHex: myRootKeyHex,
|
|
63
|
+
chain: env.chain
|
|
64
|
+
})
|
|
65
|
+
myCtx2 = await _tu.createTestWalletWithStorageClient({
|
|
66
|
+
rootKeyHex: myRootKeyHex2,
|
|
67
|
+
chain: env.chain
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const connection = JSON.parse(process.env.TEST_CLOUD_MYSQL_CONNECTION || '')
|
|
71
|
+
const knex = _tu.createMySQLFromConnection(connection)
|
|
72
|
+
stagingStorage = (
|
|
73
|
+
await _tu.createKnexTestWallet({
|
|
74
|
+
knex,
|
|
75
|
+
chain: 'test',
|
|
76
|
+
databaseName: 'staging_wallet_storage',
|
|
77
|
+
rootKeyHex: myRootKeyHex
|
|
78
|
+
})
|
|
79
|
+
).activeStorage
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
afterAll(async () => {
|
|
83
|
+
await stagingStorage.destroy()
|
|
84
|
+
await myCtx.storage.destroy()
|
|
85
|
+
for (const ctx of ctxs) await ctx.storage.destroy()
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test('1 set change outputs spendable false if not valid utxos', async () => {
|
|
89
|
+
// Check the list of outputs first using the debugger breakpoint, before updating spendable flags.
|
|
90
|
+
for (const { wallet, activeStorage: storage, services } of ctxs) {
|
|
91
|
+
const { invalidSpendableOutputs: notUtxos } =
|
|
92
|
+
await confirmSpendableOutputs(storage, services)
|
|
93
|
+
const outputsToUpdate = notUtxos.map(o => ({
|
|
94
|
+
id: o.outputId,
|
|
95
|
+
satoshis: o.satoshis
|
|
96
|
+
}))
|
|
97
|
+
|
|
98
|
+
const total: number = outputsToUpdate.reduce((t, o) => t + o.satoshis, 0)
|
|
99
|
+
|
|
100
|
+
debugger
|
|
101
|
+
// *** About set spendable = false for outputs ***/
|
|
102
|
+
for (const o of outputsToUpdate) {
|
|
103
|
+
await storage.updateOutput(o.id, { spendable: false })
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
test('2 review available change', async () => {
|
|
109
|
+
for (const { wallet, activeStorage: storage, services, userId } of ctxs) {
|
|
110
|
+
const { basketId } = verifyOne(
|
|
111
|
+
await storage.findOutputBaskets({
|
|
112
|
+
partial: { userId, name: 'default' }
|
|
113
|
+
})
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
const r: object = {}
|
|
117
|
+
for (const { name, txStatus } of [
|
|
118
|
+
{ name: 'completed', txStatus: <sdk.TransactionStatus[]>['completed'] },
|
|
119
|
+
{ name: 'nosend', txStatus: <sdk.TransactionStatus[]>['nosend'] },
|
|
120
|
+
{ name: 'unproven', txStatus: <sdk.TransactionStatus[]>['unproven'] },
|
|
121
|
+
{ name: 'failed', txStatus: <sdk.TransactionStatus[]>['failed'] },
|
|
122
|
+
{ name: 'sending', txStatus: <sdk.TransactionStatus[]>['sending'] },
|
|
123
|
+
{
|
|
124
|
+
name: 'unprocessed',
|
|
125
|
+
txStatus: <sdk.TransactionStatus[]>['unprocessed']
|
|
126
|
+
},
|
|
127
|
+
{ name: 'unsigned', txStatus: <sdk.TransactionStatus[]>['unsigned'] }
|
|
128
|
+
]) {
|
|
129
|
+
const or = {
|
|
130
|
+
txStatus,
|
|
131
|
+
outputs: await storage.findOutputs({
|
|
132
|
+
partial: { basketId, spendable: true },
|
|
133
|
+
txStatus
|
|
134
|
+
}),
|
|
135
|
+
outputCount: 0,
|
|
136
|
+
total: <number>0
|
|
137
|
+
}
|
|
138
|
+
or.total = or.outputs.reduce((t, o) => t + o.satoshis, 0)
|
|
139
|
+
or.outputCount = or.outputs.length
|
|
140
|
+
or.outputs = []
|
|
141
|
+
r[name] = or
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
expect(r).toBeTruthy()
|
|
145
|
+
let log = ''
|
|
146
|
+
for (const [k, v] of Object.entries(r)) {
|
|
147
|
+
if (v.outputCount > 0)
|
|
148
|
+
log += `${k} count=${v.outputCount} total=${v.total}\n`
|
|
149
|
+
}
|
|
150
|
+
console.log(log)
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
test.skip('3 abort incomplete transactions', async () => {
|
|
155
|
+
for (const { wallet, activeStorage: storage, services, userId } of ctxs) {
|
|
156
|
+
const txs = await storage.findTransactions({
|
|
157
|
+
partial: { userId },
|
|
158
|
+
status: ['unsigned']
|
|
159
|
+
})
|
|
160
|
+
const total = txs.reduce((s, t) => s + t.satoshis, 0)
|
|
161
|
+
debugger
|
|
162
|
+
for (const tx of txs) {
|
|
163
|
+
await wallet.abortAction({ reference: tx.reference })
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
test.skip('4 create a wallet payment output', async () => {
|
|
169
|
+
const r = await createWalletPaymentAction({
|
|
170
|
+
toIdentityKey:
|
|
171
|
+
'02bec52b12b8575f981cf38f3739ffbbfe4f6c6dbe4310d6384b6e97b122f0d087',
|
|
172
|
+
outputSatoshis: 100 * 1000,
|
|
173
|
+
keyDeriver: myCtx.keyDeriver,
|
|
174
|
+
wallet: myCtx.wallet,
|
|
175
|
+
logResult: true
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
test('5 pull out txid from BEEF', async () => {
|
|
180
|
+
const beefHex =
|
|
181
|
+
'010101015c574f48257202b9bff1b14baaa31cea24b9132555216900c277566d440250c50200beef01fee100190003020602f1fdbfa55c7227d2d9f93b7c2b83596a8e336ced483c1616dd98e8a32054dc6307010102009602f0b0959d085cbfda1a0958f65882b1a2829d66853582c0a530586dd00e930100002a7f27bd83b7d490f6641bbd3a8bdeff31490c14430597302ba579392be33f730201000100000001faba5977e9d7894778490ad3d3cf3ff0144da2920f6b31869dbcc026b693061b000000006a473044022050b2a300cad0e4b4c5ecaf93445937f21f6ec61d0c1726ac46bfb5bc2419af2102205d53e70fbdb0d1181a3cb1ef437ae27a73320367fdb78e8cadbfcbf82054e696412102480166f272ee9b639317c16ee60a2254ece67d0c7190fedbd26d57ac30f69d65ffffffff1da861000000000000c421029b09fdddfae493e309d3d97b919f6ab2902a789158f6f78489ad903b7a14baeaac2131546f446f44744b7265457a6248594b466a6d6f42756475466d53585855475a4735840423b7e26b5fd304a88f2ea28c9cf04d6c0a6c52a3174b69ea097039a355dbc6d95e702ac325c3f07518c9b4370796f90ad74e1c46304402206cd8228dd5102f7d8bd781e71dbf60df6559e90df9b79ed1c2b51d0316432f5502207a8713e899232190322dd4fdac6384f6b416ffa10b4196cdc7edbaf751b4a1156d7502000000000000001976a914ee8f77d351270123065a30a13e30394cbb4a6a2b88ace8030000000000001976a9147c8d0d51b07812872049e60e65a28d1041affc1f88ace8030000000000001976a914494c42ae91ebb8d4df662b0c2c98acfcbf14aff388ac93070000000000001976a9149619d3a2c3669335175d6fbd1d785719418cd69588acef030000000000001976a91435aabdafdc475012b7e2b7ab42e8f0fd9e8b665588ac59da0000000000001976a914c05b882ce290b3c19fbb0fca21e416f204d855a188acf3030000000000001976a9146ccff9f5e40844b784f1a68269afe30f5ec84c5d88accb340d00000000001976a914baf2186a8228a9581e0af744e28424343c6a464d88ace9030000000000001976a914a9c3b08f698df167c352f56aad483c907a0e64f488ac61140000000000001976a914f391b03543456ca68f3953b5ef4883f1299b4a2c88ac44c10500000000001976a914e6631bf6d96f93db48fb51daeace803ad805c09788ace9030000000000001976a9148cac2669fc696f5fb39aa59360a2cd20a6daffac88ac49b00400000000001976a9142c16b8a63604c66aa51f47f499024e327657ab5388acd7d50100000000001976a914ca5b56f03f796f55583c7cdd612c02f8d232669388ac42050000000000001976a914175a6812dbf2a550b1bf0d21594b96f9daf60d7988ac15040000000000001976a9147422a7237bb0fa77691047abf930e0274d193fe788ace9030000000000001976a9141a32c1c07dd4f9c632ce6b43dd28c8b27a37d81588ace8030000000000001976a914d9433de1883950578e9a29013aedb1e66d900bdc88ac39190000000000001976a9149fcdbc118b0114d2cc086a75eb14d880e3e25a9e88ac55390200000000001976a914cccf036ec7ae05690461c9d1be10193b6427055588ac1d010000000000001976a9148578396af7a6783824ff680315cc0a1375d9586e88acb3090000000000001976a9147c63cace8600f5400c8678cb2c843400c0c8ac2788acc55d0000000000001976a9148bf6991866b525f36dda54f7ca393c3a56cfff7188acc9100b00000000001976a914af41bf9bbf9d345f6b7cb37958d4cf43e88b17ef88acda040000000000001976a914ad818fcb671cc5b85dc22056d97a9b31aede4f3288ace8030000000000001976a91403ae9f7e41baee27ab7e66a323e73ee6801b5e1688ac59040000000000001976a9149f19356274a53ffdfb755bd81d40a97fe79b5e9b88ac10340000000000001976a914504dff507fccce4005f2d374cbdb6d5d493ceda288ac00000000000100000001f1fdbfa55c7227d2d9f93b7c2b83596a8e336ced483c1616dd98e8a32054dc63060000006b4830450221009bb61b5ec65cbcee0705cf757eba43e1716bfebf3ef976a09ffc926edee9ce6c022060606f5b5e59a6210067633a1263c23156d426feb1912cea480789beef62568741210208132e357b0d061848e779700eae5d69e5240a2503dd753a00e6cb3a8a920255ffffffff06e8030000000000001976a9149cedb88029c24f8bb9824628dfa0a023c1db5edc88acb40a0000000000001976a914da9b117c6880799eb3a0d0ccca252d7f11be240588ac35290000000000001976a914a8f814d3e2a2112bfe2f158f0596314a4379d45088ac54600000000000001976a91476f6f9a9ede3b7e496c921e6730be0af8d3fdfda88ac0e040000000000001976a91419a4615e24931e0e3b25e150fb362b56c5f4e89688ac253e0000000000001976a91435f0dcc5f8c47821a9d24d456b09995981cdb03f88ac00000000'
|
|
182
|
+
const beef = Beef.fromString(beefHex)
|
|
183
|
+
const btx = beef.findTxid(
|
|
184
|
+
'5c574f48257202b9bff1b14baaa31cea24b9132555216900c277566d440250c5'
|
|
185
|
+
)
|
|
186
|
+
console.log(`
|
|
187
|
+
tx: '${Utils.toHex(btx?.rawTx!)}'
|
|
188
|
+
|
|
189
|
+
${beef.toLogString()}
|
|
190
|
+
|
|
191
|
+
`)
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
test('6 send a wallet payment from myCtx to second wallet', async () => {
|
|
195
|
+
const r = await createWalletPaymentAction({
|
|
196
|
+
toIdentityKey: myIdentityKey2,
|
|
197
|
+
outputSatoshis: randomBytes(1)[0] + 10,
|
|
198
|
+
keyDeriver: myCtx.keyDeriver,
|
|
199
|
+
wallet: myCtx.wallet,
|
|
200
|
+
logResult: true
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
const toCtx = myCtx2
|
|
204
|
+
|
|
205
|
+
const args: InternalizeActionArgs = {
|
|
206
|
+
tx: Utils.toArray(r.atomicBEEF, 'hex'),
|
|
207
|
+
outputs: [
|
|
208
|
+
{
|
|
209
|
+
outputIndex: r.vout,
|
|
210
|
+
protocol: 'wallet payment',
|
|
211
|
+
paymentRemittance: {
|
|
212
|
+
derivationPrefix: r.derivationPrefix,
|
|
213
|
+
derivationSuffix: r.derivationSuffix,
|
|
214
|
+
senderIdentityKey: r.senderIdentityKey
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
description: 'from live wallet'
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const rw = await toCtx.wallet.internalizeAction(args)
|
|
222
|
+
|
|
223
|
+
expect(rw.accepted).toBe(true)
|
|
224
|
+
const beef = Beef.fromString(r.atomicBEEF)
|
|
225
|
+
const btx = beef.txs.slice(-1)[0]
|
|
226
|
+
const txid = btx.txid
|
|
227
|
+
const req = await entity.ProvenTxReq.fromStorageTxid(stagingStorage, txid)
|
|
228
|
+
expect(req?.notify.transactionIds?.length).toBe(2)
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
test('6a help setup my own wallet', async () => {
|
|
232
|
+
const privKey = PrivateKey.fromRandom()
|
|
233
|
+
const identityKey = privKey.toPublicKey().toString()
|
|
234
|
+
|
|
235
|
+
const log = `
|
|
236
|
+
// Add the following to .env file:
|
|
237
|
+
MY_TEST_IDENTITY = '${identityKey}'
|
|
238
|
+
DEV_KEYS = '{
|
|
239
|
+
"${identityKey}": "${privKey.toString()}"
|
|
240
|
+
}'
|
|
241
|
+
`
|
|
242
|
+
console.log(log)
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
test('6b run liveWallet Monitor once', async () => {
|
|
246
|
+
const liveCtx = ctxs[0]
|
|
247
|
+
await liveCtx.monitor.runOnce()
|
|
248
|
+
expect(1 === 1)
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
test('6c send a wallet payment from live to your own wallet', async () => {
|
|
252
|
+
const myIdentityKey = env.identityKey
|
|
253
|
+
const myRootKeyHex = env.devKeys[myIdentityKey]
|
|
254
|
+
if (!myIdentityKey || !myRootKeyHex)
|
|
255
|
+
throw new sdk.WERR_INVALID_OPERATION(
|
|
256
|
+
`Requires a .env file with MY_${env.chain.toUpperCase()}_IDENTITY and corresponding DEV_KEYS entries.`
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
const toIdentityKey: string =
|
|
260
|
+
'02947542cf31c8d91c303bba8f981ee9595c414e63c185d495a97c558aa7b2e522'
|
|
261
|
+
const r = createWalletPaymentOutput({
|
|
262
|
+
toIdentityKey,
|
|
263
|
+
fromRootKeyHex: myRootKeyHex,
|
|
264
|
+
logResult: true
|
|
265
|
+
})
|
|
266
|
+
console.log(`\n${JSON.stringify(r)}\n`)
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
test('6d make atomicBEEF for known txid', async () => {
|
|
270
|
+
const txid =
|
|
271
|
+
'6b9e8ed767ed6e6366527ddf8707637f3aaee1093085985c1dd04f347a3c25be'
|
|
272
|
+
const beef = new Beef()
|
|
273
|
+
beef.mergeTxidOnly(txid)
|
|
274
|
+
console.log(`
|
|
275
|
+
BEEF for known txid ${txid}
|
|
276
|
+
|
|
277
|
+
${Utils.toHex(beef.toBinaryAtomic(txid))}
|
|
278
|
+
|
|
279
|
+
`)
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
test('6e make atomicBEEF for txid from staging-dojo', async () => {
|
|
283
|
+
const myIdentityKey = env.identityKey
|
|
284
|
+
const myRootKeyHex = env.devKeys[myIdentityKey]
|
|
285
|
+
const txid =
|
|
286
|
+
'6b9e8ed767ed6e6366527ddf8707637f3aaee1093085985c1dd04f347a3c25be'
|
|
287
|
+
|
|
288
|
+
const beef = await stagingStorage.getBeefForTransaction(txid, {})
|
|
289
|
+
console.log(`
|
|
290
|
+
${beef.toLogString()}
|
|
291
|
+
|
|
292
|
+
AtomicBEEF for known txid ${txid}
|
|
293
|
+
|
|
294
|
+
${Utils.toHex(beef.toBinaryAtomic(txid))}
|
|
295
|
+
|
|
296
|
+
`)
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
test('7 test two client wallets', async () => {
|
|
300
|
+
if (!myIdentityKey2) return
|
|
301
|
+
if (myCtx) await myCtx.storage.destroy()
|
|
302
|
+
myCtx = await _tu.createTestWalletWithStorageClient({
|
|
303
|
+
rootKeyHex: myRootKeyHex,
|
|
304
|
+
chain: env.chain
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
{
|
|
308
|
+
const u1 = await myCtx.storage.findOrInsertUser(myIdentityKey)
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (myCtx) await myCtx.storage.destroy()
|
|
312
|
+
if (myCtx2) await myCtx2.storage.destroy()
|
|
313
|
+
myCtx2 = await _tu.createTestWalletWithStorageClient({
|
|
314
|
+
rootKeyHex: myRootKeyHex2,
|
|
315
|
+
chain: env.chain
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
{
|
|
319
|
+
const u2 = await myCtx2.storage.findOrInsertUser(myIdentityKey2)
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (myCtx) await myCtx.storage.destroy()
|
|
323
|
+
if (myCtx2) await myCtx2.storage.destroy()
|
|
324
|
+
myCtx = await _tu.createTestWalletWithStorageClient({
|
|
325
|
+
rootKeyHex: myRootKeyHex,
|
|
326
|
+
chain: env.chain
|
|
327
|
+
})
|
|
328
|
+
myCtx2 = await _tu.createTestWalletWithStorageClient({
|
|
329
|
+
rootKeyHex: myRootKeyHex2,
|
|
330
|
+
chain: env.chain
|
|
331
|
+
})
|
|
332
|
+
|
|
333
|
+
{
|
|
334
|
+
const u1 = await myCtx.storage.findOrInsertUser(myIdentityKey)
|
|
335
|
+
const u2 = await myCtx2.storage.findOrInsertUser(myIdentityKey2)
|
|
336
|
+
|
|
337
|
+
expect(u1.user.userId).not.toBe(u2.user.userId)
|
|
338
|
+
}
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
// End of describe
|
|
342
|
+
})
|
|
343
|
+
|
|
344
|
+
async function confirmSpendableOutputs(
|
|
345
|
+
storage: StorageKnex,
|
|
346
|
+
services: Services
|
|
347
|
+
): Promise<{ invalidSpendableOutputs: table.Output[] }> {
|
|
348
|
+
const invalidSpendableOutputs: table.Output[] = []
|
|
349
|
+
const users = await storage.findUsers({ partial: {} })
|
|
350
|
+
|
|
351
|
+
for (const { userId } of users) {
|
|
352
|
+
const defaultBasket = verifyOne(
|
|
353
|
+
await storage.findOutputBaskets({ partial: { userId, name: 'default' } })
|
|
354
|
+
)
|
|
355
|
+
const where: Partial<table.Output> = {
|
|
356
|
+
userId,
|
|
357
|
+
basketId: defaultBasket.basketId,
|
|
358
|
+
spendable: true
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const outputs = await storage.findOutputs({ partial: where })
|
|
362
|
+
|
|
363
|
+
for (let i = outputs.length - 1; i >= 0; i--) {
|
|
364
|
+
const o = outputs[i]
|
|
365
|
+
const oid = verifyId(o.outputId)
|
|
366
|
+
|
|
367
|
+
if (o.spendable) {
|
|
368
|
+
let ok = false
|
|
369
|
+
|
|
370
|
+
if (o.lockingScript && o.lockingScript.length > 0) {
|
|
371
|
+
const r = await services.getUtxoStatus(
|
|
372
|
+
asString(o.lockingScript),
|
|
373
|
+
'script'
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
if (r.status === 'success' && r.isUtxo && r.details?.length > 0) {
|
|
377
|
+
const tx = await storage.findTransactionById(o.transactionId)
|
|
378
|
+
|
|
379
|
+
if (
|
|
380
|
+
tx &&
|
|
381
|
+
tx.txid &&
|
|
382
|
+
r.details.some(
|
|
383
|
+
d =>
|
|
384
|
+
d.txid === tx.txid &&
|
|
385
|
+
d.satoshis === o.satoshis &&
|
|
386
|
+
d.index === o.vout
|
|
387
|
+
)
|
|
388
|
+
) {
|
|
389
|
+
ok = true
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (!ok) {
|
|
395
|
+
invalidSpendableOutputs.push(o)
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return { invalidSpendableOutputs }
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export function createWalletPaymentOutput(args: {
|
|
405
|
+
toIdentityKey: string
|
|
406
|
+
fromRootKeyHex: string
|
|
407
|
+
logResult?: boolean
|
|
408
|
+
}): {
|
|
409
|
+
senderIdentityKey: string
|
|
410
|
+
derivationPrefix: string
|
|
411
|
+
derivationSuffix: string
|
|
412
|
+
lockingScript: string
|
|
413
|
+
} {
|
|
414
|
+
const t = new ScriptTemplateSABPPP({
|
|
415
|
+
derivationPrefix: randomBytesBase64(8),
|
|
416
|
+
derivationSuffix: randomBytesBase64(8),
|
|
417
|
+
keyDeriver: new KeyDeriver(PrivateKey.fromString(args.fromRootKeyHex))
|
|
418
|
+
})
|
|
419
|
+
|
|
420
|
+
const lockingScript = t.lock(args.fromRootKeyHex, args.toIdentityKey)
|
|
421
|
+
|
|
422
|
+
const r = {
|
|
423
|
+
senderIdentityKey: t.params.keyDeriver.identityKey,
|
|
424
|
+
derivationPrefix: t.params.derivationPrefix!,
|
|
425
|
+
derivationSuffix: t.params.derivationSuffix!,
|
|
426
|
+
lockingScript: lockingScript.toHex()
|
|
427
|
+
}
|
|
428
|
+
if (args.logResult) {
|
|
429
|
+
console.log(`
|
|
430
|
+
// createWalletPaymentOutput
|
|
431
|
+
const r = {
|
|
432
|
+
senderIdentityKey: '${r.senderIdentityKey}',
|
|
433
|
+
derivationPrefix: '${r.derivationPrefix}',
|
|
434
|
+
derivationSuffix: '${r.derivationSuffix}'
|
|
435
|
+
lockingScript: '${r.lockingScript}'
|
|
436
|
+
}`)
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return r
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export async function createWalletPaymentAction(args: {
|
|
443
|
+
toIdentityKey: string
|
|
444
|
+
outputSatoshis: number
|
|
445
|
+
keyDeriver: KeyDeriverApi
|
|
446
|
+
wallet: WalletInterface
|
|
447
|
+
logResult?: boolean
|
|
448
|
+
}): Promise<{
|
|
449
|
+
senderIdentityKey: string
|
|
450
|
+
vout: number
|
|
451
|
+
txid: string
|
|
452
|
+
derivationPrefix: string
|
|
453
|
+
derivationSuffix: string
|
|
454
|
+
atomicBEEF: string
|
|
455
|
+
}> {
|
|
456
|
+
const { toIdentityKey, outputSatoshis, keyDeriver, wallet } = args
|
|
457
|
+
|
|
458
|
+
const t = new ScriptTemplateSABPPP({
|
|
459
|
+
derivationPrefix: randomBytesBase64(8),
|
|
460
|
+
derivationSuffix: randomBytesBase64(8),
|
|
461
|
+
keyDeriver
|
|
462
|
+
})
|
|
463
|
+
|
|
464
|
+
const createArgs: CreateActionArgs = {
|
|
465
|
+
description: `pay ${args.toIdentityKey}`.slice(0, 50),
|
|
466
|
+
labels: ['wallet-payment'],
|
|
467
|
+
outputs: [
|
|
468
|
+
{
|
|
469
|
+
satoshis: outputSatoshis,
|
|
470
|
+
lockingScript: t
|
|
471
|
+
.lock(keyDeriver.rootKey.toString(), toIdentityKey)
|
|
472
|
+
.toHex(),
|
|
473
|
+
outputDescription: `for ${args.toIdentityKey}`.slice(0, 50),
|
|
474
|
+
basket: 'wallet-paymnet',
|
|
475
|
+
tags: ['wp-out']
|
|
476
|
+
}
|
|
477
|
+
],
|
|
478
|
+
options: {
|
|
479
|
+
//acceptDelayedBroadcast: false,
|
|
480
|
+
randomizeOutputs: false,
|
|
481
|
+
signAndProcess: true
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const cr = await wallet.createAction(createArgs)
|
|
486
|
+
|
|
487
|
+
const r = {
|
|
488
|
+
senderIdentityKey: keyDeriver.identityKey,
|
|
489
|
+
vout: 0,
|
|
490
|
+
txid: cr.txid!,
|
|
491
|
+
derivationPrefix: t.params.derivationPrefix!,
|
|
492
|
+
derivationSuffix: t.params.derivationSuffix!,
|
|
493
|
+
atomicBEEF: Utils.toHex(cr.tx!)
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
if (args.logResult) {
|
|
497
|
+
console.log(`
|
|
498
|
+
// createWalletPaymentAction
|
|
499
|
+
const r = {
|
|
500
|
+
senderIdentityKey: '${r.senderIdentityKey}',
|
|
501
|
+
vout: 0,
|
|
502
|
+
txid: '${r.txid}',
|
|
503
|
+
derivationPrefix: '${r.derivationPrefix}',
|
|
504
|
+
derivationSuffix: '${r.derivationSuffix}'
|
|
505
|
+
atomicBEEF: '${r.atomicBEEF}'
|
|
506
|
+
}`)
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
return r
|
|
510
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { sdk, StorageSyncReader, wait } from '../../../src/index.client'
|
|
2
|
+
import { TaskCheckForProofs } from '../../../src/monitor/tasks/TaskCheckForProofs'
|
|
3
|
+
import { TaskClock } from '../../../src/monitor/tasks/TaskClock'
|
|
4
|
+
import { TaskNewHeader } from '../../../src/monitor/tasks/TaskNewHeader'
|
|
5
|
+
import { TaskPurge } from '../../../src/monitor/tasks/TaskPurge'
|
|
6
|
+
import { StorageMySQLDojoReader } from '../../../src/storage/sync'
|
|
7
|
+
import { _tu, TestSetup1Wallet } from '../../utils/TestUtilsWalletStorage'
|
|
8
|
+
|
|
9
|
+
import * as dotenv from 'dotenv'
|
|
10
|
+
|
|
11
|
+
dotenv.config()
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* NOTICE: These tests are designed to chain one after the other.
|
|
15
|
+
* Disable the "await WaitFor*()" lines to run them individually.
|
|
16
|
+
*
|
|
17
|
+
* The inital import from staging dojo takes around 100 seconds... be patient.
|
|
18
|
+
*/
|
|
19
|
+
describe('Wallet sync tests', () => {
|
|
20
|
+
jest.setTimeout(99999999)
|
|
21
|
+
|
|
22
|
+
beforeAll(async () => {})
|
|
23
|
+
|
|
24
|
+
afterAll(async () => {})
|
|
25
|
+
|
|
26
|
+
let doWait = false
|
|
27
|
+
let done0 = false
|
|
28
|
+
const waitFor0 = async () => {
|
|
29
|
+
while (doWait && !done0) await wait(100)
|
|
30
|
+
}
|
|
31
|
+
let done1 = false
|
|
32
|
+
const waitFor1 = async () => {
|
|
33
|
+
while (doWait && !done1) await wait(100)
|
|
34
|
+
}
|
|
35
|
+
let done2 = false
|
|
36
|
+
const waitFor2 = async () => {
|
|
37
|
+
while (doWait && !done2) await wait(100)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const env = _tu.getEnv('test')
|
|
41
|
+
const identityKeyTone =
|
|
42
|
+
'03ac2d10bdb0023f4145cc2eba2fcd2ad3070cb2107b0b48170c46a9440e4cc3fe'
|
|
43
|
+
const rootKeyHex = env.devKeys[identityKeyTone]
|
|
44
|
+
|
|
45
|
+
test('0 sync staging dojo to local MySQL', async () => {
|
|
46
|
+
console.log('Importing from staging dojo to local MySQL stagingdojotone')
|
|
47
|
+
const chain: sdk.Chain = 'test'
|
|
48
|
+
const connection = JSON.parse(process.env.TEST_DOJO_CONNECTION || '')
|
|
49
|
+
const readerKnex = _tu.createMySQLFromConnection(connection)
|
|
50
|
+
const reader = new StorageMySQLDojoReader({ chain, knex: readerKnex })
|
|
51
|
+
const writer = await _tu.createMySQLTestWallet({
|
|
52
|
+
databaseName: 'stagingdojotone',
|
|
53
|
+
chain: 'test',
|
|
54
|
+
rootKeyHex,
|
|
55
|
+
dropAll: true
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const identityKey = writer.identityKey
|
|
59
|
+
await writer.storage.syncFromReader(
|
|
60
|
+
identityKey,
|
|
61
|
+
new StorageSyncReader({ identityKey }, reader)
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
await reader.destroy()
|
|
65
|
+
await writer.activeStorage.destroy()
|
|
66
|
+
done0 = true
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('1 aggressively purge records from MySQL stagingdojotone', async () => {
|
|
70
|
+
await waitFor0()
|
|
71
|
+
|
|
72
|
+
const { monitor, activeStorage } = await _tu.createMySQLTestWallet({
|
|
73
|
+
databaseName: 'stagingdojotone',
|
|
74
|
+
chain: 'test',
|
|
75
|
+
rootKeyHex
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
{
|
|
79
|
+
const task = new TaskPurge(monitor, {
|
|
80
|
+
purgeCompleted: true,
|
|
81
|
+
purgeFailed: true,
|
|
82
|
+
purgeSpent: true,
|
|
83
|
+
purgeCompletedAge: 1,
|
|
84
|
+
purgeFailedAge: 1,
|
|
85
|
+
purgeSpentAge: 1
|
|
86
|
+
})
|
|
87
|
+
TaskPurge.checkNow = true
|
|
88
|
+
monitor._tasks.push(task)
|
|
89
|
+
await monitor.runTask('Purge')
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
await activeStorage.destroy()
|
|
93
|
+
|
|
94
|
+
done1 = true
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
test('2 sync pruned MySQL stagingdojotone to SQLite walletLegacyTestData', async () => {
|
|
98
|
+
await waitFor1()
|
|
99
|
+
console.log(
|
|
100
|
+
'syncing local MySQL stagingdojotone to local SQLite walletLegacyTestData in tmp folder'
|
|
101
|
+
)
|
|
102
|
+
const reader = await _tu.createMySQLTestWallet({
|
|
103
|
+
databaseName: 'stagingdojotone',
|
|
104
|
+
chain: 'test',
|
|
105
|
+
rootKeyHex
|
|
106
|
+
})
|
|
107
|
+
const writer = await _tu.createSQLiteTestWallet({
|
|
108
|
+
databaseName: 'walletLegacyTestData',
|
|
109
|
+
chain: 'test',
|
|
110
|
+
rootKeyHex,
|
|
111
|
+
dropAll: true
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const identityKey = writer.identityKey
|
|
115
|
+
await writer.storage.syncFromReader(
|
|
116
|
+
identityKey,
|
|
117
|
+
new StorageSyncReader({ identityKey }, reader.activeStorage)
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
await reader.activeStorage.destroy()
|
|
121
|
+
await writer.activeStorage.destroy()
|
|
122
|
+
|
|
123
|
+
console.log(
|
|
124
|
+
'REMEMBER: copy walletLegacyTestData.sqlite from tmp up to data!'
|
|
125
|
+
)
|
|
126
|
+
done2 = true
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
test('3 sync pruned MySQL stagingdojotone to MySQL walletLegacyTestData', async () => {
|
|
130
|
+
await waitFor2()
|
|
131
|
+
console.log(
|
|
132
|
+
'syncing local MySQL stagingdojotone to local SQLite walletLegacyTestData in tmp folder'
|
|
133
|
+
)
|
|
134
|
+
const reader = await _tu.createMySQLTestWallet({
|
|
135
|
+
databaseName: 'stagingdojotone',
|
|
136
|
+
chain: 'test',
|
|
137
|
+
rootKeyHex
|
|
138
|
+
})
|
|
139
|
+
const writer = await _tu.createMySQLTestWallet({
|
|
140
|
+
databaseName: 'walletLegacyTestData',
|
|
141
|
+
chain: 'test',
|
|
142
|
+
rootKeyHex,
|
|
143
|
+
dropAll: true
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
const identityKey = writer.identityKey
|
|
147
|
+
await writer.storage.syncFromReader(
|
|
148
|
+
identityKey,
|
|
149
|
+
new StorageSyncReader({ identityKey }, reader.activeStorage)
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
await reader.activeStorage.destroy()
|
|
153
|
+
await writer.activeStorage.destroy()
|
|
154
|
+
})
|
|
155
|
+
})
|