@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,17 @@
|
|
|
1
|
+
-- Create a temporary table to hold the record IDs
|
|
2
|
+
CREATE TEMPORARY TABLE #BadTxIds (
|
|
3
|
+
transactionId INT
|
|
4
|
+
txid VARCHAR(64)
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
-- Insert IDs from an example table into the temporary table
|
|
8
|
+
INSERT INTO #BadTxIds (transactionId, txid)
|
|
9
|
+
SELECT transactionId, txid
|
|
10
|
+
FROM transactions
|
|
11
|
+
WHERE status != 'completed' and status != 'unproven';
|
|
12
|
+
|
|
13
|
+
-- Example of further processing or querying the temporary table
|
|
14
|
+
SELECT * FROM #TempIDs; -- You might process these IDs in subsequent queries
|
|
15
|
+
|
|
16
|
+
-- Clean up: Drop the temporary table when done
|
|
17
|
+
DROP TABLE #TempIDs;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AbortActionArgs } from '@bsv/sdk'
|
|
2
|
+
import { sdk } from '../../../src/index.client'
|
|
3
|
+
import {
|
|
4
|
+
_tu,
|
|
5
|
+
expectToThrowWERR,
|
|
6
|
+
TestWalletNoSetup
|
|
7
|
+
} from '../../utils/TestUtilsWalletStorage'
|
|
8
|
+
|
|
9
|
+
describe('abortAction tests', () => {
|
|
10
|
+
jest.setTimeout(99999999)
|
|
11
|
+
|
|
12
|
+
const env = _tu.getEnv('test')
|
|
13
|
+
|
|
14
|
+
beforeAll(async () => {})
|
|
15
|
+
|
|
16
|
+
afterAll(async () => {})
|
|
17
|
+
|
|
18
|
+
test('0 invalid params', async () => {
|
|
19
|
+
const ctxs: TestWalletNoSetup[] = []
|
|
20
|
+
if (env.runMySQL)
|
|
21
|
+
ctxs.push(await _tu.createLegacyWalletMySQLCopy('abortActionTests'))
|
|
22
|
+
ctxs.push(await _tu.createLegacyWalletSQLiteCopy('abortActionTests'))
|
|
23
|
+
for (const { wallet } of ctxs) {
|
|
24
|
+
const invalidArgs: AbortActionArgs[] = [
|
|
25
|
+
{ reference: '' },
|
|
26
|
+
{ reference: '====' },
|
|
27
|
+
{ reference: 'a'.repeat(301) },
|
|
28
|
+
{ reference: 'a'.repeat(300) }
|
|
29
|
+
// Oh so many things to test...
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
for (const args of invalidArgs) {
|
|
33
|
+
await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () =>
|
|
34
|
+
wallet.abortAction(args)
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
for (const ctx of ctxs) {
|
|
39
|
+
await ctx.storage.destroy()
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test('1_abort reference 49f878d8405589', async () => {
|
|
44
|
+
const ctxs: TestWalletNoSetup[] = []
|
|
45
|
+
if (env.runMySQL)
|
|
46
|
+
ctxs.push(await _tu.createLegacyWalletMySQLCopy('abortActionTests'))
|
|
47
|
+
ctxs.push(await _tu.createLegacyWalletSQLiteCopy('abortActionTests'))
|
|
48
|
+
for (const { wallet } of ctxs) {
|
|
49
|
+
await wallet.abortAction({ reference: 'Sfh42EBViQ==' })
|
|
50
|
+
}
|
|
51
|
+
for (const ctx of ctxs) {
|
|
52
|
+
await ctx.storage.destroy()
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
})
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import { AtomicBEEF, Beef, CreateActionArgs, SignActionArgs } from '@bsv/sdk'
|
|
3
|
+
import { sdk, StorageKnex } from '../../../src/index.all'
|
|
4
|
+
import {
|
|
5
|
+
_tu,
|
|
6
|
+
expectToThrowWERR,
|
|
7
|
+
TestWalletNoSetup
|
|
8
|
+
} from '../../utils/TestUtilsWalletStorage'
|
|
9
|
+
|
|
10
|
+
const noLog = true
|
|
11
|
+
|
|
12
|
+
describe('createAction test', () => {
|
|
13
|
+
jest.setTimeout(99999999)
|
|
14
|
+
|
|
15
|
+
const amount = 1319
|
|
16
|
+
const env = _tu.getEnv('test')
|
|
17
|
+
const testName = () => expect.getState().currentTestName || 'test'
|
|
18
|
+
|
|
19
|
+
const ctxs: TestWalletNoSetup[] = []
|
|
20
|
+
|
|
21
|
+
beforeAll(async () => {
|
|
22
|
+
if (env.runMySQL)
|
|
23
|
+
ctxs.push(await _tu.createLegacyWalletMySQLCopy('createActionTests'))
|
|
24
|
+
ctxs.push(await _tu.createLegacyWalletSQLiteCopy('createActionTests'))
|
|
25
|
+
_tu.mockPostServicesAsSuccess(ctxs)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
afterAll(async () => {
|
|
29
|
+
for (const ctx of ctxs) {
|
|
30
|
+
await ctx.storage.destroy()
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
test('1_invalid_params', async () => {
|
|
34
|
+
for (const { wallet } of ctxs) {
|
|
35
|
+
{
|
|
36
|
+
const log = `\n${testName()}\n`
|
|
37
|
+
const args: CreateActionArgs = {
|
|
38
|
+
description: ''
|
|
39
|
+
}
|
|
40
|
+
// description is too short...
|
|
41
|
+
await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () =>
|
|
42
|
+
wallet.createAction(args)
|
|
43
|
+
)
|
|
44
|
+
args.description = 'five.'
|
|
45
|
+
// no outputs, inputs or sendWith
|
|
46
|
+
await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () =>
|
|
47
|
+
wallet.createAction(args)
|
|
48
|
+
)
|
|
49
|
+
args.options = { signAndProcess: false }
|
|
50
|
+
args.outputs = [
|
|
51
|
+
{ satoshis: 42, lockingScript: 'fred', outputDescription: 'pay fred' }
|
|
52
|
+
]
|
|
53
|
+
// lockingScript must be hexadecimal
|
|
54
|
+
await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () =>
|
|
55
|
+
wallet.createAction(args)
|
|
56
|
+
)
|
|
57
|
+
args.outputs[0].lockingScript = 'fre'
|
|
58
|
+
// lockingScript must be even length
|
|
59
|
+
await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () =>
|
|
60
|
+
wallet.createAction(args)
|
|
61
|
+
)
|
|
62
|
+
if (!noLog) console.log(log)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('2_signableTransaction', async () => {
|
|
68
|
+
for (const { wallet } of ctxs) {
|
|
69
|
+
const root = '02135476'
|
|
70
|
+
const kp = _tu.getKeyPair(root.repeat(8))
|
|
71
|
+
|
|
72
|
+
let txid1: string
|
|
73
|
+
let txid2: string
|
|
74
|
+
const outputSatoshis = 42
|
|
75
|
+
let noSendChange: string[] | undefined
|
|
76
|
+
let inputBEEF: AtomicBEEF | undefined
|
|
77
|
+
|
|
78
|
+
{
|
|
79
|
+
const createArgs: CreateActionArgs = {
|
|
80
|
+
description: `${kp.address} of ${root}`,
|
|
81
|
+
outputs: [
|
|
82
|
+
{
|
|
83
|
+
satoshis: outputSatoshis,
|
|
84
|
+
lockingScript: _tu.getLockP2PKH(kp.address).toHex(),
|
|
85
|
+
outputDescription: 'pay fred'
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
options: {
|
|
89
|
+
randomizeOutputs: false,
|
|
90
|
+
signAndProcess: false,
|
|
91
|
+
noSend: true
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const cr = await wallet.createAction(createArgs)
|
|
96
|
+
|
|
97
|
+
noSendChange = cr.noSendChange
|
|
98
|
+
|
|
99
|
+
expect(cr.noSendChange).toBeTruthy()
|
|
100
|
+
expect(cr.sendWithResults).toBeUndefined()
|
|
101
|
+
expect(cr.tx).toBeUndefined()
|
|
102
|
+
expect(cr.txid).toBeUndefined()
|
|
103
|
+
|
|
104
|
+
expect(cr.signableTransaction).toBeTruthy()
|
|
105
|
+
const st = cr.signableTransaction!
|
|
106
|
+
expect(st.reference).toBeTruthy()
|
|
107
|
+
// const tx = Transaction.fromAtomicBEEF(st.tx) // Transaction doesn't support V2 Beef yet.
|
|
108
|
+
const atomicBeef = Beef.fromBinary(st.tx)
|
|
109
|
+
const tx = atomicBeef.txs[atomicBeef.txs.length - 1].tx
|
|
110
|
+
for (const input of tx.inputs) {
|
|
111
|
+
expect(atomicBeef.findTxid(input.sourceTXID!)).toBeTruthy()
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Spending authorization check happens here...
|
|
115
|
+
//expect(st.amount > 242 && st.amount < 300).toBe(true)
|
|
116
|
+
|
|
117
|
+
// sign and complete
|
|
118
|
+
const signArgs: SignActionArgs = {
|
|
119
|
+
reference: st.reference,
|
|
120
|
+
spends: {},
|
|
121
|
+
options: {
|
|
122
|
+
returnTXIDOnly: false,
|
|
123
|
+
noSend: true
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const sr = await wallet.signAction(signArgs)
|
|
128
|
+
inputBEEF = sr.tx
|
|
129
|
+
|
|
130
|
+
txid1 = sr.txid!
|
|
131
|
+
// Update the noSendChange txid to final signed value.
|
|
132
|
+
noSendChange = noSendChange!.map(op => `${txid1}.${op.split('.')[1]}`)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
{
|
|
136
|
+
const unlock = _tu.getUnlockP2PKH(kp.privateKey, outputSatoshis)
|
|
137
|
+
const unlockingScriptLength = await unlock.estimateLength()
|
|
138
|
+
|
|
139
|
+
const createArgs: CreateActionArgs = {
|
|
140
|
+
description: `${kp.address} of ${root}`,
|
|
141
|
+
inputs: [
|
|
142
|
+
{
|
|
143
|
+
outpoint: `${txid1}.0`,
|
|
144
|
+
inputDescription: 'spend ${kp.address} of ${root}',
|
|
145
|
+
unlockingScriptLength
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
inputBEEF,
|
|
149
|
+
options: {
|
|
150
|
+
noSendChange,
|
|
151
|
+
// signAndProcess: false, // Not required as an input lacks unlock script...
|
|
152
|
+
noSend: true
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const cr = await wallet.createAction(createArgs)
|
|
157
|
+
|
|
158
|
+
expect(cr.noSendChange).toBeTruthy()
|
|
159
|
+
expect(cr.sendWithResults).toBeUndefined()
|
|
160
|
+
expect(cr.tx).toBeUndefined()
|
|
161
|
+
expect(cr.txid).toBeUndefined()
|
|
162
|
+
expect(cr.signableTransaction).toBeTruthy()
|
|
163
|
+
const st = cr.signableTransaction!
|
|
164
|
+
expect(st.reference).toBeTruthy()
|
|
165
|
+
const atomicBeef = Beef.fromBinary(st.tx)
|
|
166
|
+
const tx = atomicBeef.txs[atomicBeef.txs.length - 1].tx
|
|
167
|
+
|
|
168
|
+
tx.inputs[0].unlockingScriptTemplate = unlock
|
|
169
|
+
await tx.sign()
|
|
170
|
+
const unlockingScript = tx.inputs[0].unlockingScript!.toHex()
|
|
171
|
+
|
|
172
|
+
const signArgs: SignActionArgs = {
|
|
173
|
+
reference: st.reference,
|
|
174
|
+
spends: { 0: { unlockingScript } },
|
|
175
|
+
options: {
|
|
176
|
+
returnTXIDOnly: true,
|
|
177
|
+
noSend: true
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const sr = await wallet.signAction(signArgs)
|
|
182
|
+
|
|
183
|
+
txid2 = sr.txid!
|
|
184
|
+
}
|
|
185
|
+
{
|
|
186
|
+
const createArgs: CreateActionArgs = {
|
|
187
|
+
description: `${kp.address} of ${root}`,
|
|
188
|
+
options: {
|
|
189
|
+
acceptDelayedBroadcast: false,
|
|
190
|
+
sendWith: [txid1, txid2]
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const cr = await wallet.createAction(createArgs)
|
|
195
|
+
|
|
196
|
+
expect(cr.noSendChange).not.toBeTruthy()
|
|
197
|
+
expect(cr.sendWithResults?.length).toBe(2)
|
|
198
|
+
const [swr1, swr2] = cr.sendWithResults!
|
|
199
|
+
expect(swr1.status !== 'failed').toBe(true)
|
|
200
|
+
expect(swr2.status !== 'failed').toBe(true)
|
|
201
|
+
expect(swr1.txid).toBe(txid1)
|
|
202
|
+
expect(swr2.txid).toBe(txid2)
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
test('3_Transaction with multiple outputs()', async () => {
|
|
208
|
+
const root = '02135476'
|
|
209
|
+
const kp = _tu.getKeyPair(root.repeat(8))
|
|
210
|
+
for (const { wallet } of ctxs) {
|
|
211
|
+
const args: CreateActionArgs = {
|
|
212
|
+
description: 'Multiple outputs',
|
|
213
|
+
outputs: [
|
|
214
|
+
{
|
|
215
|
+
satoshis: 10,
|
|
216
|
+
lockingScript: _tu.getLockP2PKH(kp.address).toHex(),
|
|
217
|
+
outputDescription: 'Output 1'
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
satoshis: 20,
|
|
221
|
+
lockingScript: _tu.getLockP2PKH(kp.address).toHex(),
|
|
222
|
+
outputDescription: 'Output 2'
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
options: {
|
|
226
|
+
signAndProcess: false,
|
|
227
|
+
noSend: true
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const r = await wallet.createAction(args)
|
|
231
|
+
expect(r.signableTransaction?.reference).toBeTruthy()
|
|
232
|
+
expect(r.noSendChange?.length).toBe(1)
|
|
233
|
+
expect(r.signableTransaction?.reference).toBeTruthy()
|
|
234
|
+
expect(Array.isArray(r.signableTransaction?.tx)).toBe(true)
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
test('4_Transaction with large number of outputs(50) and randomized', async () => {
|
|
239
|
+
const root = '02135476'
|
|
240
|
+
const kp = _tu.getKeyPair(root.repeat(8))
|
|
241
|
+
|
|
242
|
+
for (const { wallet } of ctxs) {
|
|
243
|
+
const outputs = Array.from({ length: 50 }, (_, i) => ({
|
|
244
|
+
satoshis: i + 1, // Increment amounts
|
|
245
|
+
lockingScript: _tu.getLockP2PKH(kp.address).toHex(),
|
|
246
|
+
outputDescription: `Output ${i}`
|
|
247
|
+
}))
|
|
248
|
+
|
|
249
|
+
const args: CreateActionArgs = {
|
|
250
|
+
description: 'Randomized Outputs',
|
|
251
|
+
lockTime: 500000,
|
|
252
|
+
outputs,
|
|
253
|
+
options: {
|
|
254
|
+
signAndProcess: false,
|
|
255
|
+
noSend: true,
|
|
256
|
+
randomizeOutputs: true
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const r = await wallet.createAction(args)
|
|
260
|
+
expect(r.signableTransaction?.reference).toBeTruthy()
|
|
261
|
+
expect(r.noSendChange?.length).toBe(1)
|
|
262
|
+
expect(r.signableTransaction?.reference).toBeTruthy()
|
|
263
|
+
expect(Array.isArray(r.signableTransaction?.tx)).toBe(true)
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
})
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import * as bsv from '@bsv/sdk'
|
|
3
|
+
import { sdk, StorageKnex, table, Wallet } from '../../../src/index.all'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
_tu,
|
|
7
|
+
expectToThrowWERR,
|
|
8
|
+
logTransaction,
|
|
9
|
+
TestKeyPair,
|
|
10
|
+
TestWalletNoSetup,
|
|
11
|
+
cleanUnsentTransactionsUsingAbort,
|
|
12
|
+
cleanUnsignedTransactionsUsingAbort,
|
|
13
|
+
cleanUnprocessedTransactionsUsingAbort
|
|
14
|
+
} from '../../utils/TestUtilsWalletStorage'
|
|
15
|
+
|
|
16
|
+
describe('createActionToGenerateBeefs test', () => {
|
|
17
|
+
jest.setTimeout(99999999)
|
|
18
|
+
|
|
19
|
+
const ctxs: TestWalletNoSetup[] = []
|
|
20
|
+
|
|
21
|
+
beforeAll(async () => {
|
|
22
|
+
ctxs.push(await _tu.createLiveWalletSQLiteWARNING())
|
|
23
|
+
for (const { services } of ctxs) {
|
|
24
|
+
// Mock the services postBeef to avoid actually broadcasting new transactions and collect beef data.
|
|
25
|
+
services.postBeef = jest
|
|
26
|
+
.fn()
|
|
27
|
+
.mockImplementation(
|
|
28
|
+
(beef: bsv.Beef, txids: string[]): Promise<sdk.PostBeefResult[]> => {
|
|
29
|
+
const r: sdk.PostBeefResult = {
|
|
30
|
+
name: 'mock',
|
|
31
|
+
status: 'success',
|
|
32
|
+
txidResults: txids.map(txid => ({ txid, status: 'success' }))
|
|
33
|
+
}
|
|
34
|
+
return Promise.resolve([r])
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
afterAll(async () => {
|
|
41
|
+
for (const ctx of ctxs) {
|
|
42
|
+
await ctx.storage.destroy()
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('1_send 2 txs in a beef', async () => {
|
|
47
|
+
const root = '02135476'
|
|
48
|
+
const kp = _tu.getKeyPair(root.repeat(8))
|
|
49
|
+
|
|
50
|
+
for (const { wallet, activeStorage: storage } of ctxs) {
|
|
51
|
+
const {
|
|
52
|
+
txidPair: [txid1, txid2],
|
|
53
|
+
Beef: beef1
|
|
54
|
+
} = await createAndConsume(wallet, root, kp)
|
|
55
|
+
|
|
56
|
+
{
|
|
57
|
+
const createArgs: bsv.CreateActionArgs = {
|
|
58
|
+
description: `${kp.address} of ${root}`,
|
|
59
|
+
options: {
|
|
60
|
+
acceptDelayedBroadcast: false,
|
|
61
|
+
sendWith: [txid1, txid2]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const cr = await wallet.createAction(createArgs)
|
|
66
|
+
|
|
67
|
+
expect(cr.noSendChange).not.toBeTruthy()
|
|
68
|
+
expect(cr.sendWithResults?.length).toBe(2)
|
|
69
|
+
const [swr1, swr2] = cr.sendWithResults!
|
|
70
|
+
expect(swr1.status !== 'failed').toBe(true)
|
|
71
|
+
expect(swr2.status !== 'failed').toBe(true)
|
|
72
|
+
expect(swr1.txid).toBe(txid1)
|
|
73
|
+
expect(swr2.txid).toBe(txid2)
|
|
74
|
+
const r1 = await cleanUnsentTransactionsUsingAbort(wallet, storage)
|
|
75
|
+
await expect(Promise.resolve(r1)).resolves.toBe(true)
|
|
76
|
+
const r2 = await cleanUnsignedTransactionsUsingAbort(wallet, storage)
|
|
77
|
+
await expect(Promise.resolve(r2)).resolves.toBe(true)
|
|
78
|
+
const r3 = await cleanUnprocessedTransactionsUsingAbort(wallet, storage)
|
|
79
|
+
await expect(Promise.resolve(r3)).resolves.toBe(true)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
test('2_send 4 txs in a single beef ', async () => {
|
|
85
|
+
const root1 = '02135476'
|
|
86
|
+
const kp1 = _tu.getKeyPair(root1.repeat(8))
|
|
87
|
+
const root2 = '02135478'
|
|
88
|
+
const kp2 = _tu.getKeyPair(root2.repeat(8))
|
|
89
|
+
|
|
90
|
+
for (const { wallet, activeStorage: storage } of ctxs) {
|
|
91
|
+
const {
|
|
92
|
+
txidPair: [txid1, txid2],
|
|
93
|
+
Beef: beef1
|
|
94
|
+
} = await createAndConsume(wallet, root1, kp1)
|
|
95
|
+
expect(txid1).toBeTruthy()
|
|
96
|
+
expect(txid2).toBeTruthy()
|
|
97
|
+
|
|
98
|
+
const {
|
|
99
|
+
txidPair: [txid3, txid4],
|
|
100
|
+
Beef: beef2
|
|
101
|
+
} = await createAndConsume(wallet, root2, kp2)
|
|
102
|
+
expect(txid3).toBeTruthy()
|
|
103
|
+
expect(txid4).toBeTruthy()
|
|
104
|
+
|
|
105
|
+
{
|
|
106
|
+
const createArgs: bsv.CreateActionArgs = {
|
|
107
|
+
description: `${root1} & ${root2}`,
|
|
108
|
+
options: {
|
|
109
|
+
acceptDelayedBroadcast: false,
|
|
110
|
+
sendWith: [txid1, txid2, txid3, txid4]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const cr = await wallet.createAction(createArgs)
|
|
115
|
+
|
|
116
|
+
expect(cr.noSendChange).not.toBeTruthy()
|
|
117
|
+
expect(cr.sendWithResults?.length).toBe(2)
|
|
118
|
+
const [swr1, swr2, swr3, swr4] = cr.sendWithResults!
|
|
119
|
+
expect(swr1.status !== 'failed').toBe(true)
|
|
120
|
+
expect(swr2.status !== 'failed').toBe(true)
|
|
121
|
+
expect(swr3.status !== 'failed').toBe(true)
|
|
122
|
+
expect(swr4.status !== 'failed').toBe(true)
|
|
123
|
+
expect(swr1.txid).toBe(txid1)
|
|
124
|
+
expect(swr2.txid).toBe(txid2)
|
|
125
|
+
expect(swr3.txid).toBe(txid3)
|
|
126
|
+
expect(swr4.txid).toBe(txid4)
|
|
127
|
+
const r1 = await cleanUnsentTransactionsUsingAbort(wallet, storage)
|
|
128
|
+
await expect(Promise.resolve(r1)).resolves.toBe(true)
|
|
129
|
+
const r2 = await cleanUnsignedTransactionsUsingAbort(wallet, storage)
|
|
130
|
+
await expect(Promise.resolve(r2)).resolves.toBe(true)
|
|
131
|
+
const r3 = await cleanUnprocessedTransactionsUsingAbort(wallet, storage)
|
|
132
|
+
await expect(Promise.resolve(r3)).resolves.toBe(true)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
test('3_test tranaction log', async () => {
|
|
138
|
+
for (const { activeStorage: storage } of ctxs) {
|
|
139
|
+
const txid: bsv.HexString =
|
|
140
|
+
'ed11e4b7402e38bac0ec7431063ae7c14ee82370e5f1963d48ae27a70527f784'
|
|
141
|
+
const rl = await logTransaction(storage, txid)
|
|
142
|
+
console.log(rl)
|
|
143
|
+
break
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
test('4_abort set of nosend transactions', async () => {
|
|
147
|
+
for (const { wallet, activeStorage: storage } of ctxs) {
|
|
148
|
+
const r = await cleanUnsentTransactionsUsingAbort(wallet, storage)
|
|
149
|
+
await expect(Promise.resolve(r)).resolves.toBe(true)
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
test('5_abort a set of unsigned transactions', async () => {
|
|
154
|
+
for (const { wallet, activeStorage: storage } of ctxs) {
|
|
155
|
+
const r = await cleanUnsignedTransactionsUsingAbort(wallet, storage)
|
|
156
|
+
await expect(Promise.resolve(r)).resolves.toBe(true)
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
test('6_abort a set of unprocessed transactions', async () => {
|
|
161
|
+
for (const { wallet, activeStorage: storage } of ctxs) {
|
|
162
|
+
const r = await cleanUnprocessedTransactionsUsingAbort(wallet, storage)
|
|
163
|
+
await expect(Promise.resolve(r)).resolves.toBe(true)
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
test('7_abort all transactions', async () => {
|
|
168
|
+
for (const { wallet, activeStorage: storage } of ctxs) {
|
|
169
|
+
const r1 = await cleanUnsentTransactionsUsingAbort(wallet, storage)
|
|
170
|
+
await expect(Promise.resolve(r1)).resolves.toBe(true)
|
|
171
|
+
const r2 = await cleanUnsignedTransactionsUsingAbort(wallet, storage)
|
|
172
|
+
await expect(Promise.resolve(r2)).resolves.toBe(true)
|
|
173
|
+
const r3 = await cleanUnprocessedTransactionsUsingAbort(wallet, storage)
|
|
174
|
+
await expect(Promise.resolve(r3)).resolves.toBe(true)
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
async function createAndConsume(
|
|
180
|
+
wallet: Wallet,
|
|
181
|
+
root: string,
|
|
182
|
+
kp: TestKeyPair
|
|
183
|
+
): Promise<{ txidPair: bsv.TXIDHexString[]; Beef: bsv.Beef }> {
|
|
184
|
+
let txid1: bsv.TXIDHexString
|
|
185
|
+
let txid2: bsv.TXIDHexString
|
|
186
|
+
const outputSatoshis = 42
|
|
187
|
+
let noSendChange: string[] | undefined
|
|
188
|
+
let inputBEEF: bsv.AtomicBEEF | undefined
|
|
189
|
+
|
|
190
|
+
{
|
|
191
|
+
const createArgs: bsv.CreateActionArgs = {
|
|
192
|
+
description: `${kp.address} of ${root}`,
|
|
193
|
+
outputs: [
|
|
194
|
+
{
|
|
195
|
+
satoshis: outputSatoshis,
|
|
196
|
+
lockingScript: _tu.getLockP2PKH(kp.address).toHex(),
|
|
197
|
+
outputDescription: 'pay fred'
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
options: {
|
|
201
|
+
randomizeOutputs: false,
|
|
202
|
+
signAndProcess: false,
|
|
203
|
+
noSend: true
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const cr = await wallet.createAction(createArgs)
|
|
208
|
+
|
|
209
|
+
noSendChange = cr.noSendChange
|
|
210
|
+
|
|
211
|
+
expect(cr.noSendChange).toBeTruthy()
|
|
212
|
+
expect(cr.sendWithResults).toBeUndefined()
|
|
213
|
+
expect(cr.tx).toBeUndefined()
|
|
214
|
+
expect(cr.txid).toBeUndefined()
|
|
215
|
+
|
|
216
|
+
expect(cr.signableTransaction).toBeTruthy()
|
|
217
|
+
const st = cr.signableTransaction!
|
|
218
|
+
expect(st.reference).toBeTruthy()
|
|
219
|
+
// const tx = Transaction.fromAtomicBEEF(st.tx) // Transaction doesn't support V2 Beef yet.
|
|
220
|
+
const atomicBeef = bsv.Beef.fromBinary(st.tx)
|
|
221
|
+
const tx = atomicBeef.txs[atomicBeef.txs.length - 1].tx
|
|
222
|
+
for (const input of tx.inputs) {
|
|
223
|
+
expect(atomicBeef.findTxid(input.sourceTXID!)).toBeTruthy()
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Spending authorization check happens here...
|
|
227
|
+
//expect(st.amount > 242 && st.amount < 300).toBe(true)
|
|
228
|
+
|
|
229
|
+
// sign and complete
|
|
230
|
+
const signArgs: bsv.SignActionArgs = {
|
|
231
|
+
reference: st.reference,
|
|
232
|
+
spends: {},
|
|
233
|
+
options: {
|
|
234
|
+
returnTXIDOnly: false,
|
|
235
|
+
noSend: true
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const sr = await wallet.signAction(signArgs)
|
|
240
|
+
inputBEEF = sr.tx
|
|
241
|
+
|
|
242
|
+
txid1 = sr.txid!
|
|
243
|
+
// Update the noSendChange txid to final signed value.
|
|
244
|
+
noSendChange = noSendChange!.map(op => `${txid1}.${op.split('.')[1]}`)
|
|
245
|
+
}
|
|
246
|
+
{
|
|
247
|
+
const unlock = _tu.getUnlockP2PKH(kp.privateKey, outputSatoshis)
|
|
248
|
+
const unlockingScriptLength = await unlock.estimateLength()
|
|
249
|
+
|
|
250
|
+
const createArgs: bsv.CreateActionArgs = {
|
|
251
|
+
description: `${kp.address} of ${root}`,
|
|
252
|
+
inputs: [
|
|
253
|
+
{
|
|
254
|
+
outpoint: `${txid1}.0`,
|
|
255
|
+
inputDescription: 'spend ${kp.address} of ${root}',
|
|
256
|
+
unlockingScriptLength
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
inputBEEF,
|
|
260
|
+
options: {
|
|
261
|
+
noSendChange,
|
|
262
|
+
// signAndProcess: false, // Not required as an input lacks unlock script...
|
|
263
|
+
noSend: true
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const cr = await wallet.createAction(createArgs)
|
|
268
|
+
|
|
269
|
+
expect(cr.noSendChange).toBeTruthy()
|
|
270
|
+
expect(cr.sendWithResults).toBeUndefined()
|
|
271
|
+
expect(cr.tx).toBeUndefined()
|
|
272
|
+
expect(cr.txid).toBeUndefined()
|
|
273
|
+
expect(cr.signableTransaction).toBeTruthy()
|
|
274
|
+
const st = cr.signableTransaction!
|
|
275
|
+
expect(st.reference).toBeTruthy()
|
|
276
|
+
const atomicBeef: bsv.Beef = bsv.Beef.fromBinary(st.tx)
|
|
277
|
+
const tx = atomicBeef.txs[atomicBeef.txs.length - 1].tx
|
|
278
|
+
|
|
279
|
+
tx.inputs[0].unlockingScriptTemplate = unlock
|
|
280
|
+
await tx.sign()
|
|
281
|
+
const unlockingScript = tx.inputs[0].unlockingScript!.toHex()
|
|
282
|
+
|
|
283
|
+
const signArgs: bsv.SignActionArgs = {
|
|
284
|
+
reference: st.reference,
|
|
285
|
+
spends: { 0: { unlockingScript } },
|
|
286
|
+
options: {
|
|
287
|
+
returnTXIDOnly: true,
|
|
288
|
+
noSend: true
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
const sr = await wallet.signAction(signArgs)
|
|
292
|
+
|
|
293
|
+
txid2 = sr.txid!
|
|
294
|
+
//expect(atomicBeef.isValid()).toBe(true)
|
|
295
|
+
return { txidPair: [txid1, txid2], Beef: atomicBeef }
|
|
296
|
+
}
|
|
297
|
+
}
|