@bsv/wallet-toolbox 1.1.60 → 1.1.62
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/.prettierrc +1 -1
- package/docs/client.md +39 -5
- package/docs/services.md +1 -0
- package/docs/setup.md +9 -26
- package/docs/storage.md +35 -0
- package/docs/wallet.md +39 -5
- package/out/src/Setup.d.ts.map +1 -1
- package/out/src/Setup.js +6 -16
- package/out/src/Setup.js.map +1 -1
- package/out/src/Wallet.d.ts.map +1 -1
- package/out/src/Wallet.js +4 -11
- package/out/src/Wallet.js.map +1 -1
- package/out/src/monitor/Monitor.d.ts.map +1 -1
- package/out/src/monitor/Monitor.js.map +1 -1
- package/out/src/monitor/MonitorDaemon.d.ts.map +1 -1
- package/out/src/monitor/MonitorDaemon.js +1 -3
- package/out/src/monitor/MonitorDaemon.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.js +2 -10
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
- package/out/src/monitor/tasks/TaskClock.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskClock.js +1 -1
- package/out/src/monitor/tasks/TaskClock.js.map +1 -1
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -1
- package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskNewHeader.js +1 -2
- package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -1
- package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskPurge.js +1 -2
- package/out/src/monitor/tasks/TaskPurge.js.map +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.js +1 -2
- package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
- package/out/src/sdk/CertOps.d.ts.map +1 -1
- package/out/src/sdk/CertOps.js +4 -12
- package/out/src/sdk/CertOps.js.map +1 -1
- package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -1
- package/out/src/sdk/PrivilegedKeyManager.js.map +1 -1
- package/out/src/sdk/WERR_errors.d.ts.map +1 -1
- package/out/src/sdk/WERR_errors.js.map +1 -1
- package/out/src/sdk/WalletError.d.ts.map +1 -1
- package/out/src/sdk/WalletError.js +1 -4
- package/out/src/sdk/WalletError.js.map +1 -1
- package/out/src/sdk/WalletServices.interfaces.d.ts +2 -0
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/out/src/sdk/__test/CertificateLifeCycle.test.js +1 -3
- package/out/src/sdk/__test/CertificateLifeCycle.test.js.map +1 -1
- package/out/src/sdk/__test/PrivilegedKeyManager.test.js +13 -26
- package/out/src/sdk/__test/PrivilegedKeyManager.test.js.map +1 -1
- package/out/src/sdk/types.d.ts.map +1 -1
- package/out/src/sdk/types.js +2 -10
- package/out/src/sdk/types.js.map +1 -1
- package/out/src/sdk/validationHelpers.d.ts.map +1 -1
- package/out/src/sdk/validationHelpers.js +5 -12
- package/out/src/sdk/validationHelpers.js.map +1 -1
- package/out/src/services/Services.d.ts +1 -0
- package/out/src/services/Services.d.ts.map +1 -1
- package/out/src/services/Services.js +29 -38
- package/out/src/services/Services.js.map +1 -1
- package/out/src/services/__tests/ARC.test.js +9 -0
- package/out/src/services/__tests/ARC.test.js.map +1 -1
- package/out/src/services/__tests/bitrails.test.js.map +1 -1
- package/out/src/services/__tests/getMerklePath.test.js.map +1 -1
- package/out/src/services/__tests/getRawTx.test.js.map +1 -1
- package/out/src/services/__tests/verifyBeef.test.js +2 -1
- package/out/src/services/__tests/verifyBeef.test.js.map +1 -1
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -1
- package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +1 -3
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -1
- package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -1
- package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -1
- package/out/src/services/providers/ARC.d.ts.map +1 -1
- package/out/src/services/providers/ARC.js +2 -3
- package/out/src/services/providers/ARC.js.map +1 -1
- package/out/src/services/providers/Bitails.d.ts.map +1 -1
- package/out/src/services/providers/Bitails.js +62 -134
- package/out/src/services/providers/Bitails.js.map +1 -1
- package/out/src/services/providers/SdkWhatsOnChain.d.ts.map +1 -1
- package/out/src/services/providers/SdkWhatsOnChain.js.map +1 -1
- package/out/src/services/providers/WhatsOnChain.d.ts.map +1 -1
- package/out/src/services/providers/WhatsOnChain.js +6 -21
- package/out/src/services/providers/WhatsOnChain.js.map +1 -1
- package/out/src/services/providers/__tests/WhatsOnChain.test.js +1 -2
- package/out/src/services/providers/__tests/WhatsOnChain.test.js.map +1 -1
- package/out/src/services/providers/echangeRates.d.ts.map +1 -1
- package/out/src/services/providers/echangeRates.js.map +1 -1
- package/out/src/signer/WalletSigner.d.ts.map +1 -1
- package/out/src/signer/WalletSigner.js.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.js +1 -3
- package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
- package/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
- package/out/src/signer/methods/buildSignableTransaction.js +3 -11
- package/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
- package/out/src/signer/methods/createAction.d.ts.map +1 -1
- package/out/src/signer/methods/createAction.js +3 -10
- package/out/src/signer/methods/createAction.js.map +1 -1
- package/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/signer/methods/internalizeAction.js.map +1 -1
- package/out/src/signer/methods/proveCertificate.d.ts.map +1 -1
- package/out/src/signer/methods/proveCertificate.js.map +1 -1
- package/out/src/signer/methods/signAction.d.ts.map +1 -1
- package/out/src/signer/methods/signAction.js +2 -7
- package/out/src/signer/methods/signAction.js.map +1 -1
- package/out/src/storage/StorageKnex.d.ts.map +1 -1
- package/out/src/storage/StorageKnex.js +15 -44
- package/out/src/storage/StorageKnex.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +9 -34
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/StorageReader.d.ts.map +1 -1
- package/out/src/storage/StorageReader.js.map +1 -1
- package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
- package/out/src/storage/StorageReaderWriter.js.map +1 -1
- package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
- package/out/src/storage/StorageSyncReader.js.map +1 -1
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.js +5 -10
- package/out/src/storage/WalletStorageManager.js.map +1 -1
- package/out/src/storage/__test/WalletStorageManager.test.js +2 -8
- package/out/src/storage/__test/WalletStorageManager.test.js.map +1 -1
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js +10 -30
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js.map +1 -1
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.d.ts.map +1 -1
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js +17 -28
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +6 -20
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
- package/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/out/src/storage/methods/createAction.js +4 -9
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/methods/generateChange.d.ts.map +1 -1
- package/out/src/storage/methods/generateChange.js +7 -18
- package/out/src/storage/methods/generateChange.js.map +1 -1
- package/out/src/storage/methods/getBeefForTransaction.d.ts.map +1 -1
- package/out/src/storage/methods/getBeefForTransaction.js +1 -3
- package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
- package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
- package/out/src/storage/methods/getSyncChunk.js.map +1 -1
- package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/storage/methods/internalizeAction.js +2 -9
- package/out/src/storage/methods/internalizeAction.js.map +1 -1
- package/out/src/storage/methods/listActions.d.ts.map +1 -1
- package/out/src/storage/methods/listActions.js +3 -15
- package/out/src/storage/methods/listActions.js.map +1 -1
- package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
- package/out/src/storage/methods/listCertificates.js.map +1 -1
- package/out/src/storage/methods/listOutputs.d.ts.map +1 -1
- package/out/src/storage/methods/listOutputs.js +5 -12
- package/out/src/storage/methods/listOutputs.js.map +1 -1
- package/out/src/storage/methods/processAction.d.ts.map +1 -1
- package/out/src/storage/methods/processAction.js +4 -10
- package/out/src/storage/methods/processAction.js.map +1 -1
- package/out/src/storage/methods/purgeData.d.ts.map +1 -1
- package/out/src/storage/methods/purgeData.js +8 -32
- package/out/src/storage/methods/purgeData.js.map +1 -1
- package/out/src/storage/methods/reviewStatus.d.ts.map +1 -1
- package/out/src/storage/methods/reviewStatus.js +1 -3
- package/out/src/storage/methods/reviewStatus.js.map +1 -1
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageClient.js +15 -41
- package/out/src/storage/remoting/StorageClient.js.map +1 -1
- package/out/src/storage/remoting/StorageServer.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageServer.js +2 -5
- package/out/src/storage/remoting/StorageServer.js.map +1 -1
- package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -1
- package/out/src/storage/schema/KnexMigrations.js +24 -130
- package/out/src/storage/schema/KnexMigrations.js.map +1 -1
- package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Certificate.js +1 -1
- package/out/src/storage/schema/entities/Certificate.js.map +1 -1
- package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/entities/CertificateField.js +2 -5
- package/out/src/storage/schema/entities/CertificateField.js.map +1 -1
- package/out/src/storage/schema/entities/Commission.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Commission.js +2 -5
- package/out/src/storage/schema/entities/Commission.js.map +1 -1
- package/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityBase.js.map +1 -1
- package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
- package/out/src/storage/schema/entities/MergeEntity.js +14 -9
- package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
- package/out/src/storage/schema/entities/Output.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Output.js +8 -25
- package/out/src/storage/schema/entities/Output.js.map +1 -1
- package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputBasket.js +1 -1
- package/out/src/storage/schema/entities/OutputBasket.js.map +1 -1
- package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputTag.js +1 -1
- package/out/src/storage/schema/entities/OutputTag.js.map +1 -1
- package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputTagMap.js +3 -7
- package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -1
- package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/entities/ProvenTx.js +10 -20
- package/out/src/storage/schema/entities/ProvenTx.js.map +1 -1
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/entities/ProvenTxReq.js +8 -18
- package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -1
- package/out/src/storage/schema/entities/SyncState.d.ts +1 -0
- package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -1
- package/out/src/storage/schema/entities/SyncState.js +41 -6
- package/out/src/storage/schema/entities/SyncState.js.map +1 -1
- package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Transaction.js +4 -13
- package/out/src/storage/schema/entities/Transaction.js.map +1 -1
- package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/entities/TxLabel.js +1 -1
- package/out/src/storage/schema/entities/TxLabel.js.map +1 -1
- package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/TxLabelMap.js +3 -9
- package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -1
- package/out/src/storage/schema/entities/User.d.ts.map +1 -1
- package/out/src/storage/schema/entities/User.js +3 -5
- package/out/src/storage/schema/entities/User.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +1 -2
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +2 -2
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -1
- package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -1
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
- package/out/src/storage/sync/StorageMySQLDojoReader.js +1 -3
- package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -1
- package/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -1
- package/out/src/utility/ScriptTemplateBRC29.js +1 -2
- package/out/src/utility/ScriptTemplateBRC29.js.map +1 -1
- package/out/src/utility/stampLog.d.ts.map +1 -1
- package/out/src/utility/stampLog.js.map +1 -1
- package/out/src/utility/tscProofToMerklePath.d.ts.map +1 -1
- package/out/src/utility/tscProofToMerklePath.js.map +1 -1
- package/out/src/utility/utilityHelpers.buffer.d.ts.map +1 -1
- package/out/src/utility/utilityHelpers.buffer.js.map +1 -1
- package/out/src/utility/utilityHelpers.d.ts.map +1 -1
- package/out/src/utility/utilityHelpers.js +1 -3
- package/out/src/utility/utilityHelpers.js.map +1 -1
- package/out/test/Wallet/StorageClient/storageClient.man.test.js.map +1 -1
- package/out/test/Wallet/action/internalizeAction.a.test.js.map +1 -1
- package/out/test/Wallet/certificate/acquireCertificate.test.js.map +1 -1
- package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -1
- package/out/test/Wallet/get/getHeaderForHeight.test.js +2 -6
- package/out/test/Wallet/get/getHeaderForHeight.test.js.map +1 -1
- package/out/test/Wallet/get/getHeight.test.js.map +1 -1
- package/out/test/Wallet/get/getKnownTxids.test.js.map +1 -1
- package/out/test/Wallet/get/getNetwork.test.js.map +1 -1
- package/out/test/Wallet/get/getVersion.test.js.map +1 -1
- package/out/test/Wallet/live/walletLive.man.test.d.ts.map +1 -1
- package/out/test/Wallet/live/walletLive.man.test.js +3 -9
- package/out/test/Wallet/live/walletLive.man.test.js.map +1 -1
- package/out/test/Wallet/local/localWallet.man.test.d.ts.map +1 -1
- package/out/test/Wallet/local/localWallet.man.test.js +39 -31
- package/out/test/Wallet/local/localWallet.man.test.js.map +1 -1
- package/out/test/Wallet/specOps/specOps.man.test.js +1 -4
- package/out/test/Wallet/specOps/specOps.man.test.js.map +1 -1
- package/out/test/Wallet/support/janitor.man.test.js.map +1 -1
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js.map +1 -1
- package/out/test/Wallet/sync/setActive.test.js +73 -50
- package/out/test/Wallet/sync/setActive.test.js.map +1 -1
- package/out/test/checkDB.d.ts.map +1 -1
- package/out/test/checkDB.js.map +1 -1
- package/out/test/examples/backup.man.test.d.ts.map +1 -1
- package/out/test/examples/backup.man.test.js.map +1 -1
- package/out/test/examples/pushdrop.test.d.ts.map +1 -1
- package/out/test/examples/pushdrop.test.js +5 -4
- package/out/test/examples/pushdrop.test.js.map +1 -1
- package/out/test/monitor/Monitor.test.js.map +1 -1
- package/out/test/services/Services.test.js.map +1 -1
- package/out/test/storage/KnexMigrations.test.js.map +1 -1
- package/out/test/storage/StorageMySQLDojoReader.man.test.js +1 -3
- package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -1
- package/out/test/storage/count.test.js.map +1 -1
- package/out/test/storage/find.test.js +5 -10
- package/out/test/storage/find.test.js.map +1 -1
- package/out/test/storage/findLegacy.test.js.map +1 -1
- package/out/test/storage/insert.test.js.map +1 -1
- package/out/test/storage/update.test.js +7 -19
- package/out/test/storage/update.test.js.map +1 -1
- package/out/test/storage/update2.test.js +22 -24
- package/out/test/storage/update2.test.js.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.d.ts +3 -1
- package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.js +52 -76
- package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
- package/out/test/wallet/action/abortAction.test.js.map +1 -1
- package/out/test/wallet/action/createAction.test.js +1 -2
- package/out/test/wallet/action/createAction.test.js.map +1 -1
- package/out/test/wallet/action/createAction2.test.d.ts.map +1 -1
- package/out/test/wallet/action/createAction2.test.js +6 -16
- package/out/test/wallet/action/createAction2.test.js.map +1 -1
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -1
- package/out/test/wallet/action/internalizeAction.test.js.map +1 -1
- package/out/test/wallet/action/relinquishOutput.test.js.map +1 -1
- package/out/test/wallet/list/listActions.test.js.map +1 -1
- package/out/test/wallet/list/listActions2.test.js.map +1 -1
- package/out/test/wallet/list/listCertificates.test.js +2 -6
- package/out/test/wallet/list/listCertificates.test.js.map +1 -1
- package/out/test/wallet/list/listOutputs.test.js +2 -10
- package/out/test/wallet/list/listOutputs.test.js.map +1 -1
- package/out/test/wallet/sync/Wallet.sync.test.js +4 -6
- package/out/test/wallet/sync/Wallet.sync.test.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Setup.ts +15 -52
- package/src/Wallet.ts +58 -161
- package/src/monitor/Monitor.ts +7 -22
- package/src/monitor/MonitorDaemon.ts +6 -23
- package/src/monitor/tasks/TaskCheckForProofs.ts +4 -23
- package/src/monitor/tasks/TaskClock.ts +1 -3
- package/src/monitor/tasks/TaskFailAbandoned.ts +1 -3
- package/src/monitor/tasks/TaskNewHeader.ts +1 -4
- package/src/monitor/tasks/TaskPurge.ts +1 -2
- package/src/monitor/tasks/TaskReviewStatus.ts +1 -3
- package/src/monitor/tasks/TaskSendWaiting.ts +3 -10
- package/src/sdk/CertOps.ts +31 -103
- package/src/sdk/PrivilegedKeyManager.ts +18 -48
- package/src/sdk/WERR_errors.ts +6 -25
- package/src/sdk/WalletError.ts +5 -21
- package/src/sdk/WalletServices.interfaces.ts +11 -33
- package/src/sdk/WalletStorage.interfaces.ts +25 -91
- package/src/sdk/__test/CertificateLifeCycle.test.ts +9 -27
- package/src/sdk/__test/PrivilegedKeyManager.test.ts +29 -66
- package/src/sdk/types.ts +6 -26
- package/src/sdk/validationHelpers.ts +111 -402
- package/src/services/Services.ts +51 -114
- package/src/services/__tests/ARC.test.ts +14 -1
- package/src/services/__tests/bitrails.test.ts +4 -15
- package/src/services/__tests/getMerklePath.test.ts +1 -2
- package/src/services/__tests/getRawTx.test.ts +1 -3
- package/src/services/__tests/verifyBeef.test.ts +2 -1
- package/src/services/chaintracker/ChaintracksChainTracker.ts +3 -13
- package/src/services/chaintracker/chaintracks/BlockHeaderApi.ts +4 -12
- package/src/services/chaintracker/chaintracks/ChaintracksServiceClient.ts +9 -27
- package/src/services/createDefaultWalletServicesOptions.ts +2 -5
- package/src/services/processingErrors/arcSuccessError.json +76 -0
- package/src/services/providers/ARC.ts +6 -25
- package/src/services/providers/Bitails.ts +61 -159
- package/src/services/providers/SdkWhatsOnChain.ts +4 -17
- package/src/services/providers/WhatsOnChain.ts +31 -100
- package/src/services/providers/__tests/WhatsOnChain.test.ts +5 -15
- package/src/services/providers/echangeRates.ts +7 -22
- package/src/signer/WalletSigner.ts +1 -5
- package/src/signer/methods/acquireDirectCertificate.ts +1 -4
- package/src/signer/methods/buildSignableTransaction.ts +5 -20
- package/src/signer/methods/createAction.ts +15 -54
- package/src/signer/methods/internalizeAction.ts +10 -39
- package/src/signer/methods/proveCertificate.ts +2 -5
- package/src/signer/methods/signAction.ts +9 -39
- package/src/storage/StorageKnex.ts +166 -499
- package/src/storage/StorageProvider.ts +75 -291
- package/src/storage/StorageReader.ts +20 -65
- package/src/storage/StorageReaderWriter.ts +67 -264
- package/src/storage/StorageSyncReader.ts +2 -5
- package/src/storage/WalletStorageManager.ts +33 -108
- package/src/storage/__test/WalletStorageManager.test.ts +6 -23
- package/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.ts +53 -171
- package/src/storage/methods/__test/GenerateChange/randomValsUsed1.ts +17 -28
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +9 -37
- package/src/storage/methods/createAction.ts +45 -181
- package/src/storage/methods/generateChange.ts +33 -114
- package/src/storage/methods/getBeefForTransaction.ts +7 -37
- package/src/storage/methods/getSyncChunk.ts +18 -69
- package/src/storage/methods/internalizeAction.ts +18 -70
- package/src/storage/methods/listActions.ts +6 -23
- package/src/storage/methods/listCertificates.ts +5 -14
- package/src/storage/methods/listOutputs.ts +15 -69
- package/src/storage/methods/processAction.ts +29 -104
- package/src/storage/methods/purgeData.ts +11 -45
- package/src/storage/methods/reviewStatus.ts +3 -9
- package/src/storage/remoting/StorageClient.ts +43 -146
- package/src/storage/remoting/StorageServer.ts +21 -59
- package/src/storage/schema/KnexMigrations.ts +34 -165
- package/src/storage/schema/entities/Certificate.ts +3 -14
- package/src/storage/schema/entities/CertificateField.ts +6 -28
- package/src/storage/schema/entities/Commission.ts +6 -23
- package/src/storage/schema/entities/EntityBase.ts +1 -6
- package/src/storage/schema/entities/MergeEntity.ts +14 -21
- package/src/storage/schema/entities/Output.ts +10 -39
- package/src/storage/schema/entities/OutputBasket.ts +4 -16
- package/src/storage/schema/entities/OutputTag.ts +4 -17
- package/src/storage/schema/entities/OutputTagMap.ts +7 -30
- package/src/storage/schema/entities/ProvenTx.ts +16 -57
- package/src/storage/schema/entities/ProvenTxReq.ts +29 -93
- package/src/storage/schema/entities/SyncState.ts +64 -116
- package/src/storage/schema/entities/Transaction.ts +10 -35
- package/src/storage/schema/entities/TxLabel.ts +4 -17
- package/src/storage/schema/entities/TxLabelMap.ts +6 -28
- package/src/storage/schema/entities/User.ts +8 -31
- package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +23 -54
- package/src/storage/schema/entities/__tests/CertificateTests.test.ts +26 -59
- package/src/storage/schema/entities/__tests/CommissionTests.test.ts +2 -11
- package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +2 -10
- package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +2 -10
- package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +1 -4
- package/src/storage/schema/entities/__tests/OutputTests.test.ts +3 -14
- package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +4 -16
- package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +5 -18
- package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +5 -26
- package/src/storage/schema/entities/__tests/TransactionTests.test.ts +12 -48
- package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +4 -22
- package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +2 -10
- package/src/storage/schema/entities/__tests/stampLogTests.test.ts +3 -10
- package/src/storage/schema/entities/__tests/usersTests.test.ts +4 -7
- package/src/storage/schema/tables/TableSettings.ts +1 -3
- package/src/storage/sync/StorageMySQLDojoReader.ts +47 -148
- package/src/utility/ScriptTemplateBRC29.ts +2 -11
- package/src/utility/stampLog.ts +2 -6
- package/src/utility/tscProofToMerklePath.ts +1 -4
- package/src/utility/utilityHelpers.buffer.ts +3 -12
- package/src/utility/utilityHelpers.ts +14 -49
- package/test/Wallet/StorageClient/storageClient.man.test.ts +2 -8
- package/test/Wallet/action/internalizeAction.a.test.ts +8 -23
- package/test/Wallet/certificate/acquireCertificate.test.ts +10 -24
- package/test/Wallet/certificate/listCertificates.test.ts +8 -18
- package/test/Wallet/get/getHeaderForHeight.test.ts +4 -15
- package/test/Wallet/get/getHeight.test.ts +2 -6
- package/test/Wallet/get/getKnownTxids.test.ts +1 -5
- package/test/Wallet/get/getNetwork.test.ts +1 -2
- package/test/Wallet/get/getVersion.test.ts +1 -2
- package/test/Wallet/live/walletLive.man.test.ts +14 -41
- package/test/Wallet/local/localWallet.man.test.ts +45 -102
- package/test/Wallet/specOps/specOps.man.test.ts +4 -13
- package/test/Wallet/support/janitor.man.test.ts +2 -7
- package/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.ts +11 -34
- package/test/Wallet/sync/setActive.test.ts +75 -61
- package/test/checkDB.ts +2 -8
- package/test/examples/backup.man.test.ts +2 -9
- package/test/examples/pushdrop.test.ts +7 -20
- package/test/monitor/Monitor.test.ts +33 -87
- package/test/services/Services.test.ts +8 -19
- package/test/storage/KnexMigrations.test.ts +3 -18
- package/test/storage/StorageMySQLDojoReader.man.test.ts +4 -15
- package/test/storage/count.test.ts +7 -24
- package/test/storage/find.test.ts +7 -29
- package/test/storage/findLegacy.test.ts +2 -5
- package/test/storage/insert.test.ts +3 -19
- package/test/storage/update.test.ts +47 -179
- package/test/storage/update2.test.ts +54 -176
- package/test/utils/TestUtilsWalletStorage.ts +139 -372
- package/test/wallet/action/abortAction.test.ts +4 -12
- package/test/wallet/action/createAction.test.ts +4 -14
- package/test/wallet/action/createAction2.test.ts +74 -208
- package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +8 -11
- package/test/wallet/action/internalizeAction.test.ts +20 -72
- package/test/wallet/action/relinquishOutput.test.ts +3 -9
- package/test/wallet/list/listActions.test.ts +2 -9
- package/test/wallet/list/listActions2.test.ts +8 -34
- package/test/wallet/list/listCertificates.test.ts +5 -16
- package/test/wallet/list/listOutputs.test.ts +15 -54
- package/test/wallet/sync/Wallet.sync.test.ts +18 -49
|
@@ -30,10 +30,7 @@ describe('walletStorageClient test', () => {
|
|
|
30
30
|
const { wallet, storage } = ctx
|
|
31
31
|
|
|
32
32
|
{
|
|
33
|
-
const client = new StorageClient(
|
|
34
|
-
wallet,
|
|
35
|
-
'https://staging-storage.babbage.systems'
|
|
36
|
-
)
|
|
33
|
+
const client = new StorageClient(wallet, 'https://staging-storage.babbage.systems')
|
|
37
34
|
await storage.addWalletStorageProvider(client)
|
|
38
35
|
await storage.updateBackups()
|
|
39
36
|
}
|
|
@@ -70,10 +67,7 @@ describe('walletStorageClient test', () => {
|
|
|
70
67
|
ctxs.push(main)
|
|
71
68
|
|
|
72
69
|
{
|
|
73
|
-
const client = new StorageClient(
|
|
74
|
-
main.wallet,
|
|
75
|
-
'https://storage.babbage.systems'
|
|
76
|
-
)
|
|
70
|
+
const client = new StorageClient(main.wallet, 'https://storage.babbage.systems')
|
|
77
71
|
await main.storage.addWalletStorageProvider(client)
|
|
78
72
|
await main.storage.updateBackups()
|
|
79
73
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Beef, InternalizeOutput } from '@bsv/sdk'
|
|
2
2
|
import { sdk, StorageKnex } from '../../../src/index.all'
|
|
3
|
-
import {
|
|
4
|
-
_tu,
|
|
5
|
-
expectToThrowWERR,
|
|
6
|
-
TestWalletNoSetup
|
|
7
|
-
} from '../../utils/TestUtilsWalletStorage'
|
|
3
|
+
import { _tu, expectToThrowWERR, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
|
|
8
4
|
import { getBeefForTransaction } from '../../../src/storage/methods/getBeefForTransaction'
|
|
9
5
|
|
|
10
6
|
/**
|
|
@@ -17,8 +13,7 @@ describe.skip('internalizeAction tests', () => {
|
|
|
17
13
|
const ctxs: TestWalletNoSetup[] = []
|
|
18
14
|
|
|
19
15
|
beforeAll(async () => {
|
|
20
|
-
if (env.runMySQL)
|
|
21
|
-
ctxs.push(await _tu.createLegacyWalletMySQLCopy('internalizeActionTests'))
|
|
16
|
+
if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('internalizeActionTests'))
|
|
22
17
|
ctxs.push(await _tu.createLegacyWalletSQLiteCopy('internalizeActionTests'))
|
|
23
18
|
})
|
|
24
19
|
|
|
@@ -86,9 +81,7 @@ describe.skip('internalizeAction tests', () => {
|
|
|
86
81
|
expect(beef.atomicTxid).toBeUndefined()
|
|
87
82
|
|
|
88
83
|
// Convert to AtomicBEEF transaction
|
|
89
|
-
const atomicTx = beef.toBinaryAtomic(
|
|
90
|
-
'2795b293c698b2244147aaba745db887a632d21990c474df46d842ec3e52f122'
|
|
91
|
-
)
|
|
84
|
+
const atomicTx = beef.toBinaryAtomic('2795b293c698b2244147aaba745db887a632d21990c474df46d842ec3e52f122')
|
|
92
85
|
//console.log('Atomic Transaction:', atomicTx)
|
|
93
86
|
|
|
94
87
|
// {
|
|
@@ -105,8 +98,7 @@ describe.skip('internalizeAction tests', () => {
|
|
|
105
98
|
paymentRemittance: {
|
|
106
99
|
derivationPrefix: 'y0tgyMJbVWKhds2/MWkDBA==',
|
|
107
100
|
derivationSuffix: 'J1Q1E8re2RbvKONkEiEHDA==',
|
|
108
|
-
senderIdentityKey:
|
|
109
|
-
'03ac2d10bdb0023f4145cc2eba2fcd2ad3070cb2107b0b48170c46a9440e4cc3fe'
|
|
101
|
+
senderIdentityKey: '03ac2d10bdb0023f4145cc2eba2fcd2ad3070cb2107b0b48170c46a9440e4cc3fe'
|
|
110
102
|
}
|
|
111
103
|
}
|
|
112
104
|
|
|
@@ -182,16 +174,12 @@ describe.skip('internalizeAction tests', () => {
|
|
|
182
174
|
expect(beef.atomicTxid).toBeUndefined()
|
|
183
175
|
|
|
184
176
|
// Convert to AtomicBEEF transaction
|
|
185
|
-
const atomicTx = beef.toBinaryAtomic(
|
|
186
|
-
'a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7'
|
|
187
|
-
)
|
|
177
|
+
const atomicTx = beef.toBinaryAtomic('a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7')
|
|
188
178
|
//console.log('Atomic Transaction:', atomicTx)
|
|
189
179
|
|
|
190
180
|
{
|
|
191
181
|
const abeef = Beef.fromBinary(atomicTx)
|
|
192
|
-
expect(abeef.atomicTxid).toBe(
|
|
193
|
-
'a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7'
|
|
194
|
-
)
|
|
182
|
+
expect(abeef.atomicTxid).toBe('a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7')
|
|
195
183
|
}
|
|
196
184
|
|
|
197
185
|
// This needs to be a real output (the locking script and derivation bits / key need to work with each other)
|
|
@@ -265,9 +253,7 @@ describe.skip('internalizeAction tests', () => {
|
|
|
265
253
|
expect(beef.atomicTxid).toBeDefined()
|
|
266
254
|
|
|
267
255
|
// Convert to AtomicBEEF transaction
|
|
268
|
-
const atomicTx = beef.toBinaryAtomic(
|
|
269
|
-
'2795b293c698b2244147aaba745db887a632d21990c474df46d842ec3e52f122'
|
|
270
|
-
)
|
|
256
|
+
const atomicTx = beef.toBinaryAtomic('2795b293c698b2244147aaba745db887a632d21990c474df46d842ec3e52f122')
|
|
271
257
|
//console.log('Atomic Transaction:', atomicTx)
|
|
272
258
|
|
|
273
259
|
// Prepare output for internalization
|
|
@@ -277,8 +263,7 @@ describe.skip('internalizeAction tests', () => {
|
|
|
277
263
|
paymentRemittance: {
|
|
278
264
|
derivationPrefix: 'y0tgyMJbVWKhds2/MWkDBA==',
|
|
279
265
|
derivationSuffix: 'J1Q1E8re2RbvKONkEiEHDA==',
|
|
280
|
-
senderIdentityKey:
|
|
281
|
-
'03ac2d10bdb0023f4145cc2eba2fcd2ad3070cb2107b0b48170c46a9440e4cc3fe'
|
|
266
|
+
senderIdentityKey: '03ac2d10bdb0023f4145cc2eba2fcd2ad3070cb2107b0b48170c46a9440e4cc3fe'
|
|
282
267
|
}
|
|
283
268
|
}
|
|
284
269
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AcquireCertificateArgs,
|
|
3
|
-
ProtoWallet,
|
|
4
|
-
ProveCertificateArgs
|
|
5
|
-
} from '@bsv/sdk'
|
|
1
|
+
import { AcquireCertificateArgs, ProtoWallet, ProveCertificateArgs } from '@bsv/sdk'
|
|
6
2
|
import { _tu, expectToThrowWERR } from '../../utils/TestUtilsWalletStorage'
|
|
7
3
|
import { sdk, Wallet } from '../../../src/index.all'
|
|
8
4
|
|
|
@@ -16,9 +12,7 @@ describe('acquireCertificate tests', () => {
|
|
|
16
12
|
afterAll(async () => {})
|
|
17
13
|
|
|
18
14
|
test('1 invalid params', async () => {
|
|
19
|
-
const { wallet, storage } = await _tu.createLegacyWalletSQLiteCopy(
|
|
20
|
-
'acquireCertificate1'
|
|
21
|
-
)
|
|
15
|
+
const { wallet, storage } = await _tu.createLegacyWalletSQLiteCopy('acquireCertificate1')
|
|
22
16
|
|
|
23
17
|
const invalidArgs: AcquireCertificateArgs[] = [
|
|
24
18
|
{
|
|
@@ -31,9 +25,7 @@ describe('acquireCertificate tests', () => {
|
|
|
31
25
|
]
|
|
32
26
|
|
|
33
27
|
for (const args of invalidArgs) {
|
|
34
|
-
await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () =>
|
|
35
|
-
wallet.acquireCertificate(args)
|
|
36
|
-
)
|
|
28
|
+
await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () => wallet.acquireCertificate(args))
|
|
37
29
|
}
|
|
38
30
|
|
|
39
31
|
await storage.destroy()
|
|
@@ -125,9 +117,7 @@ describe('acquireCertificate tests', () => {
|
|
|
125
117
|
// Make a test certificate from a random certifier for the wallet's identityKey
|
|
126
118
|
|
|
127
119
|
// Certificate issued to the privileged key must use the privilegedKeyManager's identityKey
|
|
128
|
-
const subject = (
|
|
129
|
-
await wallet.privilegedKeyManager!.getPublicKey({ identityKey: true })
|
|
130
|
-
).publicKey
|
|
120
|
+
const subject = (await wallet.privilegedKeyManager!.getPublicKey({ identityKey: true })).publicKey
|
|
131
121
|
const { cert, certifier } = _tu.makeSampleCert(subject)
|
|
132
122
|
|
|
133
123
|
// Act as the certifier: create a wallet for them...
|
|
@@ -177,14 +167,11 @@ describe('acquireCertificate tests', () => {
|
|
|
177
167
|
verifier: subject
|
|
178
168
|
}
|
|
179
169
|
const pkr = await wallet.proveCertificate(pkrArgs)
|
|
180
|
-
const co2 = await sdk.CertOps.fromCounterparty(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
counterparty: pkrArgs.verifier
|
|
186
|
-
}
|
|
187
|
-
)
|
|
170
|
+
const co2 = await sdk.CertOps.fromCounterparty(wallet.privilegedKeyManager!, {
|
|
171
|
+
certificate: lc,
|
|
172
|
+
keyring: pkr.keyringForVerifier,
|
|
173
|
+
counterparty: pkrArgs.verifier
|
|
174
|
+
})
|
|
188
175
|
expect(co2._decryptedFields!['name']).toBe('Alice')
|
|
189
176
|
|
|
190
177
|
const certs = await wallet.listCertificates({ types: [], certifiers: [] })
|
|
@@ -222,8 +209,7 @@ describe('acquireCertificate tests', () => {
|
|
|
222
209
|
// args object to create a new certificate via 'issuance' protocol.
|
|
223
210
|
const args: AcquireCertificateArgs = {
|
|
224
211
|
type: 'h53Tvo8w3nqeF2cPyuRUc/B+gjPXJ3gPS2PKFBZfpDw=',
|
|
225
|
-
certifier:
|
|
226
|
-
'02be1093d98689b5a5bb49cefff5d98a390213cc5b0a5cd57459407f86a963325f',
|
|
212
|
+
certifier: '02be1093d98689b5a5bb49cefff5d98a390213cc5b0a5cd57459407f86a963325f',
|
|
227
213
|
certifierUrl: 'http://localhost:3998',
|
|
228
214
|
acquisitionProtocol: 'issuance',
|
|
229
215
|
fields: fields
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { OriginatorDomainNameStringUnder250Bytes } from '@bsv/sdk'
|
|
2
2
|
import { listCertificates } from '../../../src/storage/methods/listCertificates'
|
|
3
3
|
import { StorageProvider } from '../../../src/storage/StorageProvider'
|
|
4
|
-
import {
|
|
5
|
-
sdk,
|
|
6
|
-
TableCertificate,
|
|
7
|
-
TableCertificateField
|
|
8
|
-
} from '../../../src/index.all'
|
|
4
|
+
import { sdk, TableCertificate, TableCertificateField } from '../../../src/index.all'
|
|
9
5
|
import { TrxToken } from '../../../src/sdk'
|
|
10
6
|
|
|
11
7
|
jest.mock('../../../src/storage/StorageProvider')
|
|
@@ -19,9 +15,7 @@ describe('listCertificates', () => {
|
|
|
19
15
|
let originator: OriginatorDomainNameStringUnder250Bytes | undefined
|
|
20
16
|
|
|
21
17
|
// Helper so we can easily mock the transaction call
|
|
22
|
-
const mockTransaction = async <T>(
|
|
23
|
-
callback: (trx: TrxToken) => Promise<T>
|
|
24
|
-
): Promise<T> => {
|
|
18
|
+
const mockTransaction = async <T>(callback: (trx: TrxToken) => Promise<T>): Promise<T> => {
|
|
25
19
|
// We simulate the transaction by simply calling back immediately
|
|
26
20
|
// with an empty object as trx token.
|
|
27
21
|
return callback({} as unknown as TrxToken)
|
|
@@ -140,13 +134,11 @@ describe('listCertificates', () => {
|
|
|
140
134
|
|
|
141
135
|
mockStorage.findCertificates.mockResolvedValueOnce(fakeCerts)
|
|
142
136
|
// Make sure we return correct fields for each certificate
|
|
143
|
-
mockStorage.findCertificateFields.mockImplementation(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
)
|
|
137
|
+
mockStorage.findCertificateFields.mockImplementation(async (args: sdk.FindCertificateFieldsArgs) => {
|
|
138
|
+
if (args.partial?.certificateId === 1) return fakeFieldsForCert1
|
|
139
|
+
if (args.partial?.certificateId === 2) return fakeFieldsForCert2
|
|
140
|
+
return []
|
|
141
|
+
})
|
|
150
142
|
|
|
151
143
|
// The returned certs are length=2, which is < limit(10). So we do not call countCertificates
|
|
152
144
|
// Setup a spied or mocked value just in case
|
|
@@ -250,9 +242,7 @@ describe('listCertificates', () => {
|
|
|
250
242
|
const error = new Error('Database error')
|
|
251
243
|
mockStorage.transaction.mockRejectedValueOnce(error)
|
|
252
244
|
|
|
253
|
-
await expect(listCertificates(mockStorage, auth, vargs)).rejects.toThrow(
|
|
254
|
-
'Database error'
|
|
255
|
-
)
|
|
245
|
+
await expect(listCertificates(mockStorage, auth, vargs)).rejects.toThrow('Database error')
|
|
256
246
|
|
|
257
247
|
// Verify mocks
|
|
258
248
|
expect(mockStorage.transaction).toHaveBeenCalledTimes(1)
|
|
@@ -7,10 +7,7 @@ describe('getHeaderForHeight tests', () => {
|
|
|
7
7
|
const ctxs: TestWalletNoSetup[] = []
|
|
8
8
|
|
|
9
9
|
beforeAll(async () => {
|
|
10
|
-
if (env.runMySQL)
|
|
11
|
-
ctxs.push(
|
|
12
|
-
await _tu.createLegacyWalletMySQLCopy('getHeaderForHeightTests')
|
|
13
|
-
)
|
|
10
|
+
if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('getHeaderForHeightTests'))
|
|
14
11
|
ctxs.push(await _tu.createLegacyWalletSQLiteCopy('getHeaderForHeightTests'))
|
|
15
12
|
})
|
|
16
13
|
|
|
@@ -26,13 +23,8 @@ describe('getHeaderForHeight tests', () => {
|
|
|
26
23
|
await wallet.getHeaderForHeight({ height: -1 })
|
|
27
24
|
throw new Error('Expected error was not thrown')
|
|
28
25
|
} catch (e) {
|
|
29
|
-
const errorMessage =
|
|
30
|
-
|
|
31
|
-
? (e as Error).message
|
|
32
|
-
: String(e)
|
|
33
|
-
expect(errorMessage).toMatch(
|
|
34
|
-
/Height -1 must be a non-negative integer/i
|
|
35
|
-
)
|
|
26
|
+
const errorMessage = typeof e === 'object' && e !== null && 'message' in e ? (e as Error).message : String(e)
|
|
27
|
+
expect(errorMessage).toMatch(/Height -1 must be a non-negative integer/i)
|
|
36
28
|
}
|
|
37
29
|
}
|
|
38
30
|
})
|
|
@@ -57,10 +49,7 @@ describe('getHeaderForHeight tests', () => {
|
|
|
57
49
|
await wallet.getHeaderForHeight({ height: invalidHeight })
|
|
58
50
|
throw new Error('Expected error was not thrown')
|
|
59
51
|
} catch (e) {
|
|
60
|
-
const errorMessage =
|
|
61
|
-
typeof e === 'object' && e !== null && 'message' in e
|
|
62
|
-
? (e as Error).message
|
|
63
|
-
: String(e)
|
|
52
|
+
const errorMessage = typeof e === 'object' && e !== null && 'message' in e ? (e as Error).message : String(e)
|
|
64
53
|
expect(errorMessage).toMatch(/error|not found/i)
|
|
65
54
|
}
|
|
66
55
|
}
|
|
@@ -8,13 +8,9 @@ describe('getHeight tests', () => {
|
|
|
8
8
|
const env = _tu.getEnv('test')
|
|
9
9
|
|
|
10
10
|
beforeAll(async () => {
|
|
11
|
-
ctxs.push(
|
|
12
|
-
await _tu.createSQLiteTestWallet({ databaseName: 'getHeightTestsSQLite' })
|
|
13
|
-
)
|
|
11
|
+
ctxs.push(await _tu.createSQLiteTestWallet({ databaseName: 'getHeightTestsSQLite' }))
|
|
14
12
|
if (env.runMySQL) {
|
|
15
|
-
ctxs.push(
|
|
16
|
-
await _tu.createMySQLTestWallet({ databaseName: 'getHeightTestsMySQL' })
|
|
17
|
-
)
|
|
13
|
+
ctxs.push(await _tu.createMySQLTestWallet({ databaseName: 'getHeightTestsMySQL' }))
|
|
18
14
|
}
|
|
19
15
|
})
|
|
20
16
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
_tu,
|
|
3
|
-
expectToThrowWERR,
|
|
4
|
-
TestWalletNoSetup
|
|
5
|
-
} from '../../utils/TestUtilsWalletStorage'
|
|
1
|
+
import { _tu, expectToThrowWERR, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
|
|
6
2
|
import * as bsv from '@bsv/sdk'
|
|
7
3
|
|
|
8
4
|
describe('getKnownTxids Tests', () => {
|
|
@@ -7,8 +7,7 @@ describe('Wallet getNetwork Tests', () => {
|
|
|
7
7
|
const ctxs: TestWalletNoSetup[] = []
|
|
8
8
|
|
|
9
9
|
beforeAll(async () => {
|
|
10
|
-
if (env.runMySQL)
|
|
11
|
-
ctxs.push(await _tu.createLegacyWalletMySQLCopy('getNetworkTests'))
|
|
10
|
+
if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('getNetworkTests'))
|
|
12
11
|
ctxs.push(await _tu.createLegacyWalletSQLiteCopy('getNetworkTests'))
|
|
13
12
|
})
|
|
14
13
|
|
|
@@ -8,8 +8,7 @@ describe('Wallet getVersion Tests', () => {
|
|
|
8
8
|
const ctxs: TestWalletNoSetup[] = []
|
|
9
9
|
|
|
10
10
|
beforeAll(async () => {
|
|
11
|
-
if (env.runMySQL)
|
|
12
|
-
ctxs.push(await _tu.createLegacyWalletMySQLCopy('getVersionTests'))
|
|
11
|
+
if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('getVersionTests'))
|
|
13
12
|
ctxs.push(await _tu.createLegacyWalletSQLiteCopy('getVersionTests'))
|
|
14
13
|
})
|
|
15
14
|
|
|
@@ -22,11 +22,7 @@ import {
|
|
|
22
22
|
EntityProvenTxReq,
|
|
23
23
|
TableOutput
|
|
24
24
|
} from '../../../src/index.all'
|
|
25
|
-
import {
|
|
26
|
-
_tu,
|
|
27
|
-
TestWalletNoSetup,
|
|
28
|
-
TestWalletOnly
|
|
29
|
-
} from '../../utils/TestUtilsWalletStorage'
|
|
25
|
+
import { _tu, TestWalletNoSetup, TestWalletOnly } from '../../utils/TestUtilsWalletStorage'
|
|
30
26
|
|
|
31
27
|
import dotenv from 'dotenv'
|
|
32
28
|
dotenv.config()
|
|
@@ -88,8 +84,7 @@ describe('walletLive test', () => {
|
|
|
88
84
|
test('1 set change outputs spendable false if not valid utxos', async () => {
|
|
89
85
|
// Check the list of outputs first using the debugger breakpoint, before updating spendable flags.
|
|
90
86
|
for (const { wallet, activeStorage: storage, services } of ctxs) {
|
|
91
|
-
const { invalidSpendableOutputs: notUtxos } =
|
|
92
|
-
await confirmSpendableOutputs(storage, services)
|
|
87
|
+
const { invalidSpendableOutputs: notUtxos } = await confirmSpendableOutputs(storage, services)
|
|
93
88
|
const outputsToUpdate = notUtxos.map(o => ({
|
|
94
89
|
id: o.outputId,
|
|
95
90
|
satoshis: o.satoshis
|
|
@@ -144,8 +139,7 @@ describe('walletLive test', () => {
|
|
|
144
139
|
expect(r).toBeTruthy()
|
|
145
140
|
let log = ''
|
|
146
141
|
for (const [k, v] of Object.entries(r)) {
|
|
147
|
-
if (v.outputCount > 0)
|
|
148
|
-
log += `${k} count=${v.outputCount} total=${v.total}\n`
|
|
142
|
+
if (v.outputCount > 0) log += `${k} count=${v.outputCount} total=${v.total}\n`
|
|
149
143
|
}
|
|
150
144
|
console.log(log)
|
|
151
145
|
}
|
|
@@ -167,8 +161,7 @@ describe('walletLive test', () => {
|
|
|
167
161
|
|
|
168
162
|
test.skip('4 create a wallet payment output', async () => {
|
|
169
163
|
const r = await createWalletPaymentAction({
|
|
170
|
-
toIdentityKey:
|
|
171
|
-
'02bec52b12b8575f981cf38f3739ffbbfe4f6c6dbe4310d6384b6e97b122f0d087',
|
|
164
|
+
toIdentityKey: '02bec52b12b8575f981cf38f3739ffbbfe4f6c6dbe4310d6384b6e97b122f0d087',
|
|
172
165
|
outputSatoshis: 100 * 1000,
|
|
173
166
|
keyDeriver: myCtx.keyDeriver,
|
|
174
167
|
wallet: myCtx.wallet,
|
|
@@ -180,9 +173,7 @@ describe('walletLive test', () => {
|
|
|
180
173
|
const beefHex =
|
|
181
174
|
'010101015c574f48257202b9bff1b14baaa31cea24b9132555216900c277566d440250c50200beef01fee100190003020602f1fdbfa55c7227d2d9f93b7c2b83596a8e336ced483c1616dd98e8a32054dc6307010102009602f0b0959d085cbfda1a0958f65882b1a2829d66853582c0a530586dd00e930100002a7f27bd83b7d490f6641bbd3a8bdeff31490c14430597302ba579392be33f730201000100000001faba5977e9d7894778490ad3d3cf3ff0144da2920f6b31869dbcc026b693061b000000006a473044022050b2a300cad0e4b4c5ecaf93445937f21f6ec61d0c1726ac46bfb5bc2419af2102205d53e70fbdb0d1181a3cb1ef437ae27a73320367fdb78e8cadbfcbf82054e696412102480166f272ee9b639317c16ee60a2254ece67d0c7190fedbd26d57ac30f69d65ffffffff1da861000000000000c421029b09fdddfae493e309d3d97b919f6ab2902a789158f6f78489ad903b7a14baeaac2131546f446f44744b7265457a6248594b466a6d6f42756475466d53585855475a4735840423b7e26b5fd304a88f2ea28c9cf04d6c0a6c52a3174b69ea097039a355dbc6d95e702ac325c3f07518c9b4370796f90ad74e1c46304402206cd8228dd5102f7d8bd781e71dbf60df6559e90df9b79ed1c2b51d0316432f5502207a8713e899232190322dd4fdac6384f6b416ffa10b4196cdc7edbaf751b4a1156d7502000000000000001976a914ee8f77d351270123065a30a13e30394cbb4a6a2b88ace8030000000000001976a9147c8d0d51b07812872049e60e65a28d1041affc1f88ace8030000000000001976a914494c42ae91ebb8d4df662b0c2c98acfcbf14aff388ac93070000000000001976a9149619d3a2c3669335175d6fbd1d785719418cd69588acef030000000000001976a91435aabdafdc475012b7e2b7ab42e8f0fd9e8b665588ac59da0000000000001976a914c05b882ce290b3c19fbb0fca21e416f204d855a188acf3030000000000001976a9146ccff9f5e40844b784f1a68269afe30f5ec84c5d88accb340d00000000001976a914baf2186a8228a9581e0af744e28424343c6a464d88ace9030000000000001976a914a9c3b08f698df167c352f56aad483c907a0e64f488ac61140000000000001976a914f391b03543456ca68f3953b5ef4883f1299b4a2c88ac44c10500000000001976a914e6631bf6d96f93db48fb51daeace803ad805c09788ace9030000000000001976a9148cac2669fc696f5fb39aa59360a2cd20a6daffac88ac49b00400000000001976a9142c16b8a63604c66aa51f47f499024e327657ab5388acd7d50100000000001976a914ca5b56f03f796f55583c7cdd612c02f8d232669388ac42050000000000001976a914175a6812dbf2a550b1bf0d21594b96f9daf60d7988ac15040000000000001976a9147422a7237bb0fa77691047abf930e0274d193fe788ace9030000000000001976a9141a32c1c07dd4f9c632ce6b43dd28c8b27a37d81588ace8030000000000001976a914d9433de1883950578e9a29013aedb1e66d900bdc88ac39190000000000001976a9149fcdbc118b0114d2cc086a75eb14d880e3e25a9e88ac55390200000000001976a914cccf036ec7ae05690461c9d1be10193b6427055588ac1d010000000000001976a9148578396af7a6783824ff680315cc0a1375d9586e88acb3090000000000001976a9147c63cace8600f5400c8678cb2c843400c0c8ac2788acc55d0000000000001976a9148bf6991866b525f36dda54f7ca393c3a56cfff7188acc9100b00000000001976a914af41bf9bbf9d345f6b7cb37958d4cf43e88b17ef88acda040000000000001976a914ad818fcb671cc5b85dc22056d97a9b31aede4f3288ace8030000000000001976a91403ae9f7e41baee27ab7e66a323e73ee6801b5e1688ac59040000000000001976a9149f19356274a53ffdfb755bd81d40a97fe79b5e9b88ac10340000000000001976a914504dff507fccce4005f2d374cbdb6d5d493ceda288ac00000000000100000001f1fdbfa55c7227d2d9f93b7c2b83596a8e336ced483c1616dd98e8a32054dc63060000006b4830450221009bb61b5ec65cbcee0705cf757eba43e1716bfebf3ef976a09ffc926edee9ce6c022060606f5b5e59a6210067633a1263c23156d426feb1912cea480789beef62568741210208132e357b0d061848e779700eae5d69e5240a2503dd753a00e6cb3a8a920255ffffffff06e8030000000000001976a9149cedb88029c24f8bb9824628dfa0a023c1db5edc88acb40a0000000000001976a914da9b117c6880799eb3a0d0ccca252d7f11be240588ac35290000000000001976a914a8f814d3e2a2112bfe2f158f0596314a4379d45088ac54600000000000001976a91476f6f9a9ede3b7e496c921e6730be0af8d3fdfda88ac0e040000000000001976a91419a4615e24931e0e3b25e150fb362b56c5f4e89688ac253e0000000000001976a91435f0dcc5f8c47821a9d24d456b09995981cdb03f88ac00000000'
|
|
182
175
|
const beef = Beef.fromString(beefHex)
|
|
183
|
-
const btx = beef.findTxid(
|
|
184
|
-
'5c574f48257202b9bff1b14baaa31cea24b9132555216900c277566d440250c5'
|
|
185
|
-
)
|
|
176
|
+
const btx = beef.findTxid('5c574f48257202b9bff1b14baaa31cea24b9132555216900c277566d440250c5')
|
|
186
177
|
console.log(`
|
|
187
178
|
tx: '${Utils.toHex(btx?.rawTx!)}'
|
|
188
179
|
|
|
@@ -192,11 +183,8 @@ describe('walletLive test', () => {
|
|
|
192
183
|
})
|
|
193
184
|
|
|
194
185
|
test('5z send a wallet payment from myCtx to second wallet', async () => {
|
|
195
|
-
const tauriRootKey =
|
|
196
|
-
|
|
197
|
-
const tauriIdentityKey = PrivateKey.fromHex(tauriRootKey)
|
|
198
|
-
.toPublicKey()
|
|
199
|
-
.toString()
|
|
186
|
+
const tauriRootKey = '1363ef9b14531a52648e1e7e7f430a10ceda1df8d514a2a75d8404094f14a649'
|
|
187
|
+
const tauriIdentityKey = PrivateKey.fromHex(tauriRootKey).toPublicKey().toString()
|
|
200
188
|
|
|
201
189
|
const r = await createWalletPaymentAction({
|
|
202
190
|
toIdentityKey: tauriIdentityKey,
|
|
@@ -296,8 +284,7 @@ describe('walletLive test', () => {
|
|
|
296
284
|
`Requires a .env file with MY_${env.chain.toUpperCase()}_IDENTITY and corresponding DEV_KEYS entries.`
|
|
297
285
|
)
|
|
298
286
|
|
|
299
|
-
const toIdentityKey: string =
|
|
300
|
-
'02947542cf31c8d91c303bba8f981ee9595c414e63c185d495a97c558aa7b2e522'
|
|
287
|
+
const toIdentityKey: string = '02947542cf31c8d91c303bba8f981ee9595c414e63c185d495a97c558aa7b2e522'
|
|
301
288
|
const r = createWalletPaymentOutput({
|
|
302
289
|
toIdentityKey,
|
|
303
290
|
fromRootKeyHex: myRootKeyHex,
|
|
@@ -307,8 +294,7 @@ describe('walletLive test', () => {
|
|
|
307
294
|
})
|
|
308
295
|
|
|
309
296
|
test('6d make atomicBEEF for known txid', async () => {
|
|
310
|
-
const txid =
|
|
311
|
-
'6b9e8ed767ed6e6366527ddf8707637f3aaee1093085985c1dd04f347a3c25be'
|
|
297
|
+
const txid = '6b9e8ed767ed6e6366527ddf8707637f3aaee1093085985c1dd04f347a3c25be'
|
|
312
298
|
const beef = new Beef()
|
|
313
299
|
beef.mergeTxidOnly(txid)
|
|
314
300
|
console.log(`
|
|
@@ -322,8 +308,7 @@ ${Utils.toHex(beef.toBinaryAtomic(txid))}
|
|
|
322
308
|
test('6e make atomicBEEF for txid from staging-dojo', async () => {
|
|
323
309
|
const myIdentityKey = env.identityKey
|
|
324
310
|
const myRootKeyHex = env.devKeys[myIdentityKey]
|
|
325
|
-
const txid =
|
|
326
|
-
'6b9e8ed767ed6e6366527ddf8707637f3aaee1093085985c1dd04f347a3c25be'
|
|
311
|
+
const txid = '6b9e8ed767ed6e6366527ddf8707637f3aaee1093085985c1dd04f347a3c25be'
|
|
327
312
|
|
|
328
313
|
const beef = await stagingStorage.getBeefForTransaction(txid, {})
|
|
329
314
|
console.log(`
|
|
@@ -389,9 +374,7 @@ async function confirmSpendableOutputs(
|
|
|
389
374
|
const users = await storage.findUsers({ partial: {} })
|
|
390
375
|
|
|
391
376
|
for (const { userId } of users) {
|
|
392
|
-
const defaultBasket = verifyOne(
|
|
393
|
-
await storage.findOutputBaskets({ partial: { userId, name: 'default' } })
|
|
394
|
-
)
|
|
377
|
+
const defaultBasket = verifyOne(await storage.findOutputBaskets({ partial: { userId, name: 'default' } }))
|
|
395
378
|
const where: Partial<TableOutput> = {
|
|
396
379
|
userId,
|
|
397
380
|
basketId: defaultBasket.basketId,
|
|
@@ -408,10 +391,7 @@ async function confirmSpendableOutputs(
|
|
|
408
391
|
let ok = false
|
|
409
392
|
|
|
410
393
|
if (o.lockingScript && o.lockingScript.length > 0) {
|
|
411
|
-
const r = await services.getUtxoStatus(
|
|
412
|
-
asString(o.lockingScript),
|
|
413
|
-
'script'
|
|
414
|
-
)
|
|
394
|
+
const r = await services.getUtxoStatus(asString(o.lockingScript), 'script')
|
|
415
395
|
|
|
416
396
|
if (r.status === 'success' && r.isUtxo && r.details?.length > 0) {
|
|
417
397
|
const tx = await storage.findTransactionById(o.transactionId)
|
|
@@ -419,12 +399,7 @@ async function confirmSpendableOutputs(
|
|
|
419
399
|
if (
|
|
420
400
|
tx &&
|
|
421
401
|
tx.txid &&
|
|
422
|
-
r.details.some(
|
|
423
|
-
d =>
|
|
424
|
-
d.txid === tx.txid &&
|
|
425
|
-
d.satoshis === o.satoshis &&
|
|
426
|
-
d.index === o.vout
|
|
427
|
-
)
|
|
402
|
+
r.details.some(d => d.txid === tx.txid && d.satoshis === o.satoshis && d.index === o.vout)
|
|
428
403
|
) {
|
|
429
404
|
ok = true
|
|
430
405
|
}
|
|
@@ -507,9 +482,7 @@ export async function createWalletPaymentAction(args: {
|
|
|
507
482
|
outputs: [
|
|
508
483
|
{
|
|
509
484
|
satoshis: outputSatoshis,
|
|
510
|
-
lockingScript: t
|
|
511
|
-
.lock(keyDeriver.rootKey.toString(), toIdentityKey)
|
|
512
|
-
.toHex(),
|
|
485
|
+
lockingScript: t.lock(keyDeriver.rootKey.toString(), toIdentityKey).toHex(),
|
|
513
486
|
outputDescription: `for ${args.toIdentityKey}`.slice(0, 50),
|
|
514
487
|
basket: 'wallet-paymnet',
|
|
515
488
|
tags: ['wp-out']
|