@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Beef, PushDrop, SignActionArgs, WalletProtocol } from '@bsv/sdk'
|
|
2
2
|
import { Setup, SetupWallet } from '../../src'
|
|
3
|
+
import { logger } from '../utils/TestUtilsWalletStorage'
|
|
3
4
|
|
|
4
5
|
describe('pushdrop example tests', () => {
|
|
5
6
|
jest.setTimeout(99999999)
|
|
@@ -104,7 +105,7 @@ async function outputPushDrop(
|
|
|
104
105
|
randomizeOutputs: false,
|
|
105
106
|
// This example prefers to immediately wait for the new transaction to be broadcast to the network.
|
|
106
107
|
// Typically, most production applications benefit from performance gains when broadcasts are handled in the background.
|
|
107
|
-
acceptDelayedBroadcast:
|
|
108
|
+
acceptDelayedBroadcast: true
|
|
108
109
|
},
|
|
109
110
|
labels: [label],
|
|
110
111
|
description: label
|
|
@@ -120,7 +121,7 @@ async function outputPushDrop(
|
|
|
120
121
|
// The outpoint string is constructed from the new transaction's txid and the output index: zero.
|
|
121
122
|
const outpoint = `${car.txid!}.0`
|
|
122
123
|
|
|
123
|
-
|
|
124
|
+
logger(`
|
|
124
125
|
outputPushDrop to ${toIdentityKey}
|
|
125
126
|
outpoint ${outpoint}
|
|
126
127
|
satoshis ${satoshis}
|
|
@@ -181,14 +182,7 @@ export async function inputPushDrop(
|
|
|
181
182
|
keyId: string
|
|
182
183
|
}
|
|
183
184
|
) {
|
|
184
|
-
const {
|
|
185
|
-
protocol,
|
|
186
|
-
keyId,
|
|
187
|
-
fromIdentityKey,
|
|
188
|
-
satoshis,
|
|
189
|
-
beef: inputBeef,
|
|
190
|
-
outpoint
|
|
191
|
-
} = outputPushDrop
|
|
185
|
+
const { protocol, keyId, fromIdentityKey, satoshis, beef: inputBeef, outpoint } = outputPushDrop
|
|
192
186
|
|
|
193
187
|
const { keyDeriver } = setup
|
|
194
188
|
|
|
@@ -196,14 +190,7 @@ export async function inputPushDrop(
|
|
|
196
190
|
|
|
197
191
|
// Construct an "unlock" object which is then associated with the input to be signed
|
|
198
192
|
// such that when the "sign" method is called, a signed "unlockingScript" is computed for that input.
|
|
199
|
-
const unlock = t.unlock(
|
|
200
|
-
protocol,
|
|
201
|
-
keyId,
|
|
202
|
-
fromIdentityKey,
|
|
203
|
-
'single',
|
|
204
|
-
false,
|
|
205
|
-
satoshis
|
|
206
|
-
)
|
|
193
|
+
const unlock = t.unlock(protocol, keyId, fromIdentityKey, 'single', false, satoshis)
|
|
207
194
|
|
|
208
195
|
const label = 'inputPushDrop'
|
|
209
196
|
|
|
@@ -265,7 +252,7 @@ export async function inputPushDrop(
|
|
|
265
252
|
spends: { 0: { unlockingScript } },
|
|
266
253
|
options: {
|
|
267
254
|
// Force an immediate broadcast of the signed transaction.
|
|
268
|
-
acceptDelayedBroadcast:
|
|
255
|
+
acceptDelayedBroadcast: true
|
|
269
256
|
}
|
|
270
257
|
}
|
|
271
258
|
|
|
@@ -282,7 +269,7 @@ export async function inputPushDrop(
|
|
|
282
269
|
const beef = Beef.fromBinary(sar.tx!)
|
|
283
270
|
const txid = sar.txid!
|
|
284
271
|
|
|
285
|
-
|
|
272
|
+
logger(`
|
|
286
273
|
inputP2PKH to ${setup.identityKey}
|
|
287
274
|
input's outpoint ${outpoint}
|
|
288
275
|
satoshis ${satoshis}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { MerklePath } from '@bsv/sdk'
|
|
2
|
-
import {
|
|
3
|
-
asArray,
|
|
4
|
-
EntityProvenTxReq,
|
|
5
|
-
sdk,
|
|
6
|
-
verifyOne,
|
|
7
|
-
verifyTruthy,
|
|
8
|
-
wait
|
|
9
|
-
} from '../../src/index.client'
|
|
2
|
+
import { asArray, EntityProvenTxReq, sdk, verifyOne, verifyTruthy, wait } from '../../src/index.client'
|
|
10
3
|
import { TaskCheckForProofs } from '../../src/monitor/tasks/TaskCheckForProofs'
|
|
11
4
|
import { TaskClock } from '../../src/monitor/tasks/TaskClock'
|
|
12
5
|
import { TaskNewHeader } from '../../src/monitor/tasks/TaskNewHeader'
|
|
13
6
|
import { TaskPurge } from '../../src/monitor/tasks/TaskPurge'
|
|
14
7
|
import { TaskSendWaiting } from '../../src/monitor/tasks/TaskSendWaiting'
|
|
15
|
-
import {
|
|
16
|
-
_tu,
|
|
17
|
-
TestSetup1Wallet,
|
|
18
|
-
TestWallet
|
|
19
|
-
} from '../utils/TestUtilsWalletStorage'
|
|
8
|
+
import { _tu, TestSetup1Wallet, TestWallet } from '../utils/TestUtilsWalletStorage'
|
|
20
9
|
import exp from 'constants'
|
|
21
10
|
import { TaskReviewStatus } from '../../src/monitor/tasks/TaskReviewStatus'
|
|
22
11
|
|
|
@@ -48,8 +37,7 @@ describe('Monitor tests', () => {
|
|
|
48
37
|
|
|
49
38
|
// This test takes a bit over a minute to run... un-skip it to work on it.
|
|
50
39
|
for (const { chain, wallet, services, monitor } of ctxs) {
|
|
51
|
-
if (!monitor)
|
|
52
|
-
throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
40
|
+
if (!monitor) throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
53
41
|
|
|
54
42
|
{
|
|
55
43
|
// The clock attempts to update nextMinute to msecs for each minute.
|
|
@@ -74,8 +62,7 @@ describe('Monitor tests', () => {
|
|
|
74
62
|
|
|
75
63
|
// This test takes 10+ seconds to run... un-skip it to work on it.
|
|
76
64
|
for (const { chain, wallet, services, monitor } of ctxs) {
|
|
77
|
-
if (!monitor)
|
|
78
|
-
throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
65
|
+
if (!monitor) throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
79
66
|
|
|
80
67
|
{
|
|
81
68
|
// The new header task polls chaintracks for latest header and if new sets flag to check for proofs.
|
|
@@ -104,8 +91,7 @@ describe('Monitor tests', () => {
|
|
|
104
91
|
*/
|
|
105
92
|
|
|
106
93
|
for (const { chain, wallet, services, monitor } of ctxs) {
|
|
107
|
-
if (!monitor)
|
|
108
|
-
throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
94
|
+
if (!monitor) throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
109
95
|
|
|
110
96
|
{
|
|
111
97
|
const task = new TaskPurge(monitor, {
|
|
@@ -155,18 +141,13 @@ describe('Monitor tests', () => {
|
|
|
155
141
|
})
|
|
156
142
|
|
|
157
143
|
for (const { activeStorage: storage, monitor } of ctxs) {
|
|
158
|
-
if (!monitor)
|
|
159
|
-
throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
144
|
+
if (!monitor) throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
160
145
|
|
|
161
146
|
{
|
|
162
147
|
for (const txid of expectedTxids) {
|
|
163
148
|
// no matching ProvenTx exists.
|
|
164
|
-
expect(
|
|
165
|
-
|
|
166
|
-
).toBe(0)
|
|
167
|
-
const req = verifyTruthy(
|
|
168
|
-
await EntityProvenTxReq.fromStorageTxid(storage, txid)
|
|
169
|
-
)
|
|
149
|
+
expect((await storage.findProvenTxs({ partial: { txid } })).length).toBe(0)
|
|
150
|
+
const req = verifyTruthy(await EntityProvenTxReq.fromStorageTxid(storage, txid))
|
|
170
151
|
expect(req.status).toBe('unmined')
|
|
171
152
|
}
|
|
172
153
|
|
|
@@ -176,13 +157,9 @@ describe('Monitor tests', () => {
|
|
|
176
157
|
await monitor.runTask('CheckForProofs')
|
|
177
158
|
|
|
178
159
|
for (const txid of expectedTxids) {
|
|
179
|
-
const proven = verifyOne(
|
|
180
|
-
await storage.findProvenTxs({ partial: { txid } })
|
|
181
|
-
)
|
|
160
|
+
const proven = verifyOne(await storage.findProvenTxs({ partial: { txid } }))
|
|
182
161
|
expect(proven.merklePath).toBeTruthy()
|
|
183
|
-
const req = verifyTruthy(
|
|
184
|
-
await EntityProvenTxReq.fromStorageTxid(storage, txid)
|
|
185
|
-
)
|
|
162
|
+
const req = verifyTruthy(await EntityProvenTxReq.fromStorageTxid(storage, txid))
|
|
186
163
|
expect(req.status).toBe('completed')
|
|
187
164
|
expect(req.provenTxId).toBe(proven.provenTxId)
|
|
188
165
|
}
|
|
@@ -215,20 +192,15 @@ describe('Monitor tests', () => {
|
|
|
215
192
|
})
|
|
216
193
|
|
|
217
194
|
for (const { activeStorage: storage, monitor } of ctxs) {
|
|
218
|
-
if (!monitor)
|
|
219
|
-
throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
195
|
+
if (!monitor) throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
220
196
|
|
|
221
197
|
{
|
|
222
198
|
const attempts: number[] = []
|
|
223
199
|
|
|
224
200
|
for (const txid of expectedTxids) {
|
|
225
201
|
// no matching ProvenTx exists.
|
|
226
|
-
expect(
|
|
227
|
-
|
|
228
|
-
).toBe(0)
|
|
229
|
-
const req = verifyTruthy(
|
|
230
|
-
await EntityProvenTxReq.fromStorageTxid(storage, txid)
|
|
231
|
-
)
|
|
202
|
+
expect((await storage.findProvenTxs({ partial: { txid } })).length).toBe(0)
|
|
203
|
+
const req = verifyTruthy(await EntityProvenTxReq.fromStorageTxid(storage, txid))
|
|
232
204
|
expect(req.status).toBe('unmined')
|
|
233
205
|
attempts.push(req.attempts)
|
|
234
206
|
}
|
|
@@ -242,12 +214,8 @@ describe('Monitor tests', () => {
|
|
|
242
214
|
for (const txid of expectedTxids) {
|
|
243
215
|
i++
|
|
244
216
|
// no matching ProvenTx exists.
|
|
245
|
-
expect(
|
|
246
|
-
|
|
247
|
-
).toBe(0)
|
|
248
|
-
const req = verifyTruthy(
|
|
249
|
-
await EntityProvenTxReq.fromStorageTxid(storage, txid)
|
|
250
|
-
)
|
|
217
|
+
expect((await storage.findProvenTxs({ partial: { txid } })).length).toBe(0)
|
|
218
|
+
const req = verifyTruthy(await EntityProvenTxReq.fromStorageTxid(storage, txid))
|
|
251
219
|
expect(req.status).toBe('unmined')
|
|
252
220
|
expect(req.attempts).toBeGreaterThanOrEqual(attempts[i])
|
|
253
221
|
}
|
|
@@ -289,10 +257,8 @@ describe('Monitor tests', () => {
|
|
|
289
257
|
]),
|
|
290
258
|
header: {
|
|
291
259
|
version: 536870912,
|
|
292
|
-
previousHash:
|
|
293
|
-
|
|
294
|
-
merkleRoot:
|
|
295
|
-
'68bde58600fbd2c716871356cc2ad34b43ac67ac8d7a879dd966429d5a6935b2',
|
|
260
|
+
previousHash: '0000000039f1c7dc943d50883e531022825bf5c15a40db2cedde7d203ca3d644',
|
|
261
|
+
merkleRoot: '68bde58600fbd2c716871356cc2ad34b43ac67ac8d7a879dd966429d5a6935b2',
|
|
296
262
|
time: 1734530373,
|
|
297
263
|
bits: 474103450,
|
|
298
264
|
nonce: 3894752803,
|
|
@@ -326,10 +292,8 @@ describe('Monitor tests', () => {
|
|
|
326
292
|
]),
|
|
327
293
|
header: {
|
|
328
294
|
version: 536870912,
|
|
329
|
-
previousHash:
|
|
330
|
-
|
|
331
|
-
merkleRoot:
|
|
332
|
-
'68bde58600fbd2c716871356cc2ad34b43ac67ac8d7a879dd966429d5a6935b2',
|
|
295
|
+
previousHash: '0000000039f1c7dc943d50883e531022825bf5c15a40db2cedde7d203ca3d644',
|
|
296
|
+
merkleRoot: '68bde58600fbd2c716871356cc2ad34b43ac67ac8d7a879dd966429d5a6935b2',
|
|
333
297
|
time: 1734530373,
|
|
334
298
|
bits: 474103450,
|
|
335
299
|
nonce: 3894752803,
|
|
@@ -360,10 +324,8 @@ describe('Monitor tests', () => {
|
|
|
360
324
|
]),
|
|
361
325
|
header: {
|
|
362
326
|
version: 536870912,
|
|
363
|
-
previousHash:
|
|
364
|
-
|
|
365
|
-
merkleRoot:
|
|
366
|
-
'f990936bc3267ba4911acc490107ed1841eedbd2c5017e1074891285df30f255',
|
|
327
|
+
previousHash: '000000001888ff57f4848f181f9f69cab27f2388d7c2edd99b8c004ae482cca7',
|
|
328
|
+
merkleRoot: 'f990936bc3267ba4911acc490107ed1841eedbd2c5017e1074891285df30f255',
|
|
367
329
|
time: 1734532172,
|
|
368
330
|
bits: 474081547,
|
|
369
331
|
nonce: 740519774,
|
|
@@ -391,10 +353,8 @@ describe('Monitor tests', () => {
|
|
|
391
353
|
]),
|
|
392
354
|
header: {
|
|
393
355
|
version: 536870912,
|
|
394
|
-
previousHash:
|
|
395
|
-
|
|
396
|
-
merkleRoot:
|
|
397
|
-
'f990936bc3267ba4911acc490107ed1841eedbd2c5017e1074891285df30f255',
|
|
356
|
+
previousHash: '000000001888ff57f4848f181f9f69cab27f2388d7c2edd99b8c004ae482cca7',
|
|
357
|
+
merkleRoot: 'f990936bc3267ba4911acc490107ed1841eedbd2c5017e1074891285df30f255',
|
|
398
358
|
time: 1734532172,
|
|
399
359
|
bits: 474081547,
|
|
400
360
|
nonce: 740519774,
|
|
@@ -419,10 +379,8 @@ describe('Monitor tests', () => {
|
|
|
419
379
|
]),
|
|
420
380
|
header: {
|
|
421
381
|
version: 536870912,
|
|
422
|
-
previousHash:
|
|
423
|
-
|
|
424
|
-
merkleRoot:
|
|
425
|
-
'c2714feeccc7db8ea4235799e6490271867008dd39e3cf8a6e9aa20fd47f3222',
|
|
382
|
+
previousHash: '0000000012dbd406fef49503c545bafd940ba2f2c9b05ef351177b71fe96e7d8',
|
|
383
|
+
merkleRoot: 'c2714feeccc7db8ea4235799e6490271867008dd39e3cf8a6e9aa20fd47f3222',
|
|
426
384
|
time: 1734538772,
|
|
427
385
|
bits: 474045917,
|
|
428
386
|
nonce: 2431702809,
|
|
@@ -442,8 +400,7 @@ describe('Monitor tests', () => {
|
|
|
442
400
|
})
|
|
443
401
|
|
|
444
402
|
for (const { activeStorage: storage, monitor } of ctxs) {
|
|
445
|
-
if (!monitor)
|
|
446
|
-
throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
403
|
+
if (!monitor) throw new sdk.WERR_INTERNAL('test requires setup with monitor')
|
|
447
404
|
|
|
448
405
|
{
|
|
449
406
|
const task = new TaskSendWaiting(monitor, 1, 1)
|
|
@@ -457,16 +414,11 @@ describe('Monitor tests', () => {
|
|
|
457
414
|
'6d68cc6fa7363e59aaccbaa65f0ca613a6ae8af718453ab5d3a2b022c59b5cc6'
|
|
458
415
|
]
|
|
459
416
|
for (const txid of expectedTxids) {
|
|
460
|
-
const req = verifyOne(
|
|
461
|
-
await storage.findProvenTxReqs({ partial: { txid } })
|
|
462
|
-
)
|
|
417
|
+
const req = verifyOne(await storage.findProvenTxReqs({ partial: { txid } }))
|
|
463
418
|
expect(req.status).toBe('unsent')
|
|
464
|
-
const notifyIds =
|
|
465
|
-
new EntityProvenTxReq(req).notify.transactionIds || []
|
|
419
|
+
const notifyIds = new EntityProvenTxReq(req).notify.transactionIds || []
|
|
466
420
|
for (const transactionId of notifyIds) {
|
|
467
|
-
const tx = verifyTruthy(
|
|
468
|
-
await storage.findTransactionById(transactionId)
|
|
469
|
-
)
|
|
421
|
+
const tx = verifyTruthy(await storage.findTransactionById(transactionId))
|
|
470
422
|
expect(['nosend', 'unprocessed', 'sending']).toContain(tx.status)
|
|
471
423
|
}
|
|
472
424
|
}
|
|
@@ -475,21 +427,15 @@ describe('Monitor tests', () => {
|
|
|
475
427
|
|
|
476
428
|
expect(txidsPosted).toEqual(expectedTxids)
|
|
477
429
|
for (const txid of expectedTxids) {
|
|
478
|
-
const req = verifyOne(
|
|
479
|
-
|
|
480
|
-
)
|
|
481
|
-
if (env.logTests)
|
|
482
|
-
console.log(new EntityProvenTxReq(req).historyPretty())
|
|
483
|
-
const notifyIds =
|
|
484
|
-
new EntityProvenTxReq(req).notify.transactionIds || []
|
|
430
|
+
const req = verifyOne(await storage.findProvenTxReqs({ partial: { txid } }))
|
|
431
|
+
if (env.logTests) console.log(new EntityProvenTxReq(req).historyPretty())
|
|
432
|
+
const notifyIds = new EntityProvenTxReq(req).notify.transactionIds || []
|
|
485
433
|
switch (postBeefMockStatus) {
|
|
486
434
|
case 'success':
|
|
487
435
|
{
|
|
488
436
|
expect(req.status).toBe('unmined')
|
|
489
437
|
for (const transactionId of notifyIds) {
|
|
490
|
-
const tx = verifyTruthy(
|
|
491
|
-
await storage.findTransactionById(transactionId)
|
|
492
|
-
)
|
|
438
|
+
const tx = verifyTruthy(await storage.findTransactionById(transactionId))
|
|
493
439
|
expect(['unproven']).toContain(tx.status)
|
|
494
440
|
}
|
|
495
441
|
}
|
|
@@ -32,8 +32,7 @@ describe('Wallet services tests', () => {
|
|
|
32
32
|
|
|
33
33
|
test('0 getUtxoStatus', async () => {
|
|
34
34
|
for (const { chain, wallet, services } of ctxs) {
|
|
35
|
-
if (!wallet.services || !services)
|
|
36
|
-
throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
35
|
+
if (!wallet.services || !services) throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
37
36
|
{
|
|
38
37
|
const us = await wallet.services.getUtxoStatus(
|
|
39
38
|
'4104eca750b68551fb5aa893acb428b6a7d2d673498fd055cf2a8d402211b9500bdc27936846c2aa45cf82afe2f566b69cd7f7298154b0ffb25fbfa4fef8986191c4ac',
|
|
@@ -53,8 +52,7 @@ describe('Wallet services tests', () => {
|
|
|
53
52
|
// Underlying WoC service is rate limited
|
|
54
53
|
test.skip('1 getBsvExchangeRate', async () => {
|
|
55
54
|
for (const { chain, wallet, services } of ctxs) {
|
|
56
|
-
if (!wallet.services || !services)
|
|
57
|
-
throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
55
|
+
if (!wallet.services || !services) throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
58
56
|
|
|
59
57
|
{
|
|
60
58
|
const usdPerBsv = await wallet.services.getBsvExchangeRate()
|
|
@@ -65,13 +63,9 @@ describe('Wallet services tests', () => {
|
|
|
65
63
|
|
|
66
64
|
test('2 getFiatExchangeRate', async () => {
|
|
67
65
|
for (const { chain, wallet, services } of ctxs) {
|
|
68
|
-
if (!wallet.services || !services)
|
|
69
|
-
throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
66
|
+
if (!wallet.services || !services) throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
70
67
|
{
|
|
71
|
-
const eurPerUsd = await wallet.services.getFiatExchangeRate(
|
|
72
|
-
'EUR',
|
|
73
|
-
'USD'
|
|
74
|
-
)
|
|
68
|
+
const eurPerUsd = await wallet.services.getFiatExchangeRate('EUR', 'USD')
|
|
75
69
|
expect(eurPerUsd).toBeGreaterThan(0)
|
|
76
70
|
}
|
|
77
71
|
}
|
|
@@ -79,8 +73,7 @@ describe('Wallet services tests', () => {
|
|
|
79
73
|
|
|
80
74
|
test('3 getChainTracker', async () => {
|
|
81
75
|
for (const { chain, wallet, services } of ctxs) {
|
|
82
|
-
if (!wallet.services || !services)
|
|
83
|
-
throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
76
|
+
if (!wallet.services || !services) throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
84
77
|
|
|
85
78
|
{
|
|
86
79
|
const chaintracker = await wallet.services.getChainTracker()
|
|
@@ -92,8 +85,7 @@ describe('Wallet services tests', () => {
|
|
|
92
85
|
|
|
93
86
|
test('4 getMerklePath', async () => {
|
|
94
87
|
for (const { chain, wallet, services } of ctxs) {
|
|
95
|
-
if (!wallet.services || !services)
|
|
96
|
-
throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
88
|
+
if (!wallet.services || !services) throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
97
89
|
|
|
98
90
|
{
|
|
99
91
|
const mp = await wallet.services.getMerklePath(
|
|
@@ -109,12 +101,9 @@ describe('Wallet services tests', () => {
|
|
|
109
101
|
|
|
110
102
|
test('5 getRawTx', async () => {
|
|
111
103
|
for (const { chain, wallet, services } of ctxs) {
|
|
112
|
-
if (!wallet.services || !services)
|
|
113
|
-
throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
104
|
+
if (!wallet.services || !services) throw new sdk.WERR_INTERNAL('test requires setup with services')
|
|
114
105
|
{
|
|
115
|
-
const rawTx = await wallet.services.getRawTx(
|
|
116
|
-
'9cce99686bc8621db439b7150dd5b3b269e4b0628fd75160222c417d6f2b95e4'
|
|
117
|
-
)
|
|
106
|
+
const rawTx = await wallet.services.getRawTx('9cce99686bc8621db439b7150dd5b3b269e4b0628fd75160222c417d6f2b95e4')
|
|
118
107
|
if (chain === 'main') expect(rawTx.rawTx!.length).toBe(176)
|
|
119
108
|
else expect(rawTx.rawTx).not.toBeTruthy()
|
|
120
109
|
}
|
|
@@ -9,12 +9,7 @@ describe('KnexMigrations tests', () => {
|
|
|
9
9
|
const env = _tu.getEnv('test')
|
|
10
10
|
|
|
11
11
|
beforeAll(async () => {
|
|
12
|
-
const localSQLiteFile = await _tu.newTmpFile(
|
|
13
|
-
'migratetest.sqlite',
|
|
14
|
-
false,
|
|
15
|
-
false,
|
|
16
|
-
true
|
|
17
|
-
)
|
|
12
|
+
const localSQLiteFile = await _tu.newTmpFile('migratetest.sqlite', false, false, true)
|
|
18
13
|
const knexSQLite = _tu.createLocalSQLite(localSQLiteFile)
|
|
19
14
|
knexs.push(knexSQLite)
|
|
20
15
|
|
|
@@ -42,12 +37,7 @@ describe('KnexMigrations tests', () => {
|
|
|
42
37
|
test('0 migragte down', async () => {
|
|
43
38
|
for (const knex of knexs) {
|
|
44
39
|
const config = {
|
|
45
|
-
migrationSource: new KnexMigrations(
|
|
46
|
-
'test',
|
|
47
|
-
'0 migration test',
|
|
48
|
-
'1'.repeat(64),
|
|
49
|
-
1000
|
|
50
|
-
)
|
|
40
|
+
migrationSource: new KnexMigrations('test', '0 migration test', '1'.repeat(64), 1000)
|
|
51
41
|
}
|
|
52
42
|
const count = Object.keys(config.migrationSource.migrations).length
|
|
53
43
|
for (let i = 0; i < count; i++) {
|
|
@@ -66,12 +56,7 @@ describe('KnexMigrations tests', () => {
|
|
|
66
56
|
await waitFor0()
|
|
67
57
|
for (const knex of knexs) {
|
|
68
58
|
const config = {
|
|
69
|
-
migrationSource: new KnexMigrations(
|
|
70
|
-
'test',
|
|
71
|
-
'0 migration test',
|
|
72
|
-
'1'.repeat(64),
|
|
73
|
-
1000
|
|
74
|
-
)
|
|
59
|
+
migrationSource: new KnexMigrations('test', '0 migration test', '1'.repeat(64), 1000)
|
|
75
60
|
}
|
|
76
61
|
const latest = await KnexMigrations.latestMigration()
|
|
77
62
|
await knex.migrate.latest(config)
|
|
@@ -16,9 +16,7 @@ describe('StorageMySQLDojoReader tests', () => {
|
|
|
16
16
|
|
|
17
17
|
beforeAll(async () => {
|
|
18
18
|
const connection = JSON.parse(
|
|
19
|
-
(chain === 'test'
|
|
20
|
-
? process.env.TEST_DOJO_CONNECTION
|
|
21
|
-
: process.env.MAIN_DOJO_CONNECTION) || ''
|
|
19
|
+
(chain === 'test' ? process.env.TEST_DOJO_CONNECTION : process.env.MAIN_DOJO_CONNECTION) || ''
|
|
22
20
|
)
|
|
23
21
|
const readerKnex = _tu.createMySQLFromConnection(connection)
|
|
24
22
|
reader = new StorageMySQLDojoReader({
|
|
@@ -29,9 +27,7 @@ describe('StorageMySQLDojoReader tests', () => {
|
|
|
29
27
|
|
|
30
28
|
const writerKnex = env.runMySQL
|
|
31
29
|
? _tu.createLocalMySQL('stagingdojotone')
|
|
32
|
-
: _tu.createLocalSQLite(
|
|
33
|
-
await _tu.newTmpFile('stagingdojotone', false, false, true)
|
|
34
|
-
)
|
|
30
|
+
: _tu.createLocalSQLite(await _tu.newTmpFile('stagingdojotone', false, false, true))
|
|
35
31
|
writer = new StorageKnex({
|
|
36
32
|
...StorageKnex.defaultOptions(),
|
|
37
33
|
chain,
|
|
@@ -51,17 +47,10 @@ describe('StorageMySQLDojoReader tests', () => {
|
|
|
51
47
|
const writerSettings = await writer.getSettings()
|
|
52
48
|
|
|
53
49
|
const identityKey = process.env.MY_TEST_IDENTITY || ''
|
|
54
|
-
const ss = await EntitySyncState.fromStorage(
|
|
55
|
-
writer,
|
|
56
|
-
identityKey,
|
|
57
|
-
readerSettings
|
|
58
|
-
)
|
|
50
|
+
const ss = await EntitySyncState.fromStorage(writer, identityKey, readerSettings)
|
|
59
51
|
|
|
60
52
|
for (;;) {
|
|
61
|
-
const args = ss.makeRequestSyncChunkArgs(
|
|
62
|
-
identityKey,
|
|
63
|
-
writerSettings.storageIdentityKey
|
|
64
|
-
)
|
|
53
|
+
const args = ss.makeRequestSyncChunkArgs(identityKey, writerSettings.storageIdentityKey)
|
|
65
54
|
const chunk = await reader.getSyncChunk(args)
|
|
66
55
|
const r = await ss.processRequestSyncChunkResult(writer, args, chunk)
|
|
67
56
|
//console.log(`${r.maxUpdated_at} inserted ${r.inserts} updated ${r.updates}`)
|
|
@@ -11,12 +11,7 @@ describe('count tests', () => {
|
|
|
11
11
|
const env = _tu.getEnv(chain)
|
|
12
12
|
|
|
13
13
|
beforeAll(async () => {
|
|
14
|
-
const localSQLiteFile = await _tu.newTmpFile(
|
|
15
|
-
'storagecounttest.sqlite',
|
|
16
|
-
false,
|
|
17
|
-
false,
|
|
18
|
-
true
|
|
19
|
-
)
|
|
14
|
+
const localSQLiteFile = await _tu.newTmpFile('storagecounttest.sqlite', false, false, true)
|
|
20
15
|
const knexSQLite = _tu.createLocalSQLite(localSQLiteFile)
|
|
21
16
|
storages.push(
|
|
22
17
|
new StorageKnex({
|
|
@@ -78,18 +73,14 @@ describe('count tests', () => {
|
|
|
78
73
|
certifiers: [setup.u1cert1.certifier]
|
|
79
74
|
})
|
|
80
75
|
).toBe(1)
|
|
81
|
-
expect(
|
|
82
|
-
await storage.countCertificates({ partial: {}, certifiers: ['none'] })
|
|
83
|
-
).toBe(0)
|
|
76
|
+
expect(await storage.countCertificates({ partial: {}, certifiers: ['none'] })).toBe(0)
|
|
84
77
|
expect(
|
|
85
78
|
await storage.countCertificates({
|
|
86
79
|
partial: {},
|
|
87
80
|
types: [setup.u1cert2.type]
|
|
88
81
|
})
|
|
89
82
|
).toBe(1)
|
|
90
|
-
expect(
|
|
91
|
-
await storage.countCertificates({ partial: {}, types: ['oblongata'] })
|
|
92
|
-
).toBe(0)
|
|
83
|
+
expect(await storage.countCertificates({ partial: {}, types: ['oblongata'] })).toBe(0)
|
|
93
84
|
}
|
|
94
85
|
})
|
|
95
86
|
|
|
@@ -106,15 +97,9 @@ describe('count tests', () => {
|
|
|
106
97
|
partial: { userId: setup.u2.userId }
|
|
107
98
|
})
|
|
108
99
|
).toBe(0)
|
|
109
|
-
expect(
|
|
110
|
-
|
|
111
|
-
).toBe(
|
|
112
|
-
expect(
|
|
113
|
-
await storage.countCertificateFields({ partial: { fieldName: 'name' } })
|
|
114
|
-
).toBe(2)
|
|
115
|
-
expect(
|
|
116
|
-
await storage.countCertificateFields({ partial: { fieldName: 'bob' } })
|
|
117
|
-
).toBe(1)
|
|
100
|
+
expect(await storage.countCertificateFields({ partial: { userId: 99 } })).toBe(0)
|
|
101
|
+
expect(await storage.countCertificateFields({ partial: { fieldName: 'name' } })).toBe(2)
|
|
102
|
+
expect(await storage.countCertificateFields({ partial: { fieldName: 'bob' } })).toBe(1)
|
|
118
103
|
expect(
|
|
119
104
|
await storage.countCertificateFields({
|
|
120
105
|
partial: { fieldName: 'bob42' }
|
|
@@ -132,9 +117,7 @@ describe('count tests', () => {
|
|
|
132
117
|
since: setup.u1.created_at
|
|
133
118
|
})
|
|
134
119
|
).toBe(3)
|
|
135
|
-
expect(
|
|
136
|
-
await storage.countOutputBaskets({ partial: {}, since: new Date() })
|
|
137
|
-
).toBe(0)
|
|
120
|
+
expect(await storage.countOutputBaskets({ partial: {}, since: new Date() })).toBe(0)
|
|
138
121
|
}
|
|
139
122
|
})
|
|
140
123
|
|
|
@@ -11,12 +11,7 @@ describe('find tests', () => {
|
|
|
11
11
|
const env = _tu.getEnv(chain)
|
|
12
12
|
|
|
13
13
|
beforeAll(async () => {
|
|
14
|
-
const localSQLiteFile = await _tu.newTmpFile(
|
|
15
|
-
'storagefindtest.sqlite',
|
|
16
|
-
false,
|
|
17
|
-
false,
|
|
18
|
-
true
|
|
19
|
-
)
|
|
14
|
+
const localSQLiteFile = await _tu.newTmpFile('storagefindtest.sqlite', false, false, true)
|
|
20
15
|
const knexSQLite = _tu.createLocalSQLite(localSQLiteFile)
|
|
21
16
|
storages.push(
|
|
22
17
|
new StorageKnex({
|
|
@@ -80,10 +75,7 @@ describe('find tests', () => {
|
|
|
80
75
|
})
|
|
81
76
|
).length
|
|
82
77
|
).toBe(1)
|
|
83
|
-
expect(
|
|
84
|
-
(await storage.findCertificates({ partial: {}, certifiers: ['none'] }))
|
|
85
|
-
.length
|
|
86
|
-
).toBe(0)
|
|
78
|
+
expect((await storage.findCertificates({ partial: {}, certifiers: ['none'] })).length).toBe(0)
|
|
87
79
|
expect(
|
|
88
80
|
(
|
|
89
81
|
await storage.findCertificates({
|
|
@@ -92,18 +84,13 @@ describe('find tests', () => {
|
|
|
92
84
|
})
|
|
93
85
|
).length
|
|
94
86
|
).toBe(1)
|
|
95
|
-
expect(
|
|
96
|
-
(await storage.findCertificates({ partial: {}, types: ['oblongata'] }))
|
|
97
|
-
.length
|
|
98
|
-
).toBe(0)
|
|
87
|
+
expect((await storage.findCertificates({ partial: {}, types: ['oblongata'] })).length).toBe(0)
|
|
99
88
|
}
|
|
100
89
|
})
|
|
101
90
|
|
|
102
91
|
test('4 find CertificateField', async () => {
|
|
103
92
|
for (const { storage, setup } of setups) {
|
|
104
|
-
expect(
|
|
105
|
-
(await storage.findCertificateFields({ partial: {} })).length
|
|
106
|
-
).toBe(3)
|
|
93
|
+
expect((await storage.findCertificateFields({ partial: {} })).length).toBe(3)
|
|
107
94
|
expect(
|
|
108
95
|
(
|
|
109
96
|
await storage.findCertificateFields({
|
|
@@ -118,10 +105,7 @@ describe('find tests', () => {
|
|
|
118
105
|
})
|
|
119
106
|
).length
|
|
120
107
|
).toBe(0)
|
|
121
|
-
expect(
|
|
122
|
-
(await storage.findCertificateFields({ partial: { userId: 99 } }))
|
|
123
|
-
.length
|
|
124
|
-
).toBe(0)
|
|
108
|
+
expect((await storage.findCertificateFields({ partial: { userId: 99 } })).length).toBe(0)
|
|
125
109
|
expect(
|
|
126
110
|
(
|
|
127
111
|
await storage.findCertificateFields({
|
|
@@ -129,10 +113,7 @@ describe('find tests', () => {
|
|
|
129
113
|
})
|
|
130
114
|
).length
|
|
131
115
|
).toBe(2)
|
|
132
|
-
expect(
|
|
133
|
-
(await storage.findCertificateFields({ partial: { fieldName: 'bob' } }))
|
|
134
|
-
.length
|
|
135
|
-
).toBe(1)
|
|
116
|
+
expect((await storage.findCertificateFields({ partial: { fieldName: 'bob' } })).length).toBe(1)
|
|
136
117
|
expect(
|
|
137
118
|
(
|
|
138
119
|
await storage.findCertificateFields({
|
|
@@ -154,10 +135,7 @@ describe('find tests', () => {
|
|
|
154
135
|
})
|
|
155
136
|
).length
|
|
156
137
|
).toBe(3)
|
|
157
|
-
expect(
|
|
158
|
-
(await storage.findOutputBaskets({ partial: {}, since: new Date() }))
|
|
159
|
-
.length
|
|
160
|
-
).toBe(0)
|
|
138
|
+
expect((await storage.findOutputBaskets({ partial: {}, since: new Date() })).length).toBe(0)
|
|
161
139
|
}
|
|
162
140
|
})
|
|
163
141
|
|
|
@@ -7,8 +7,7 @@ describe('find tests', () => {
|
|
|
7
7
|
const ctxs: TestWalletNoSetup[] = []
|
|
8
8
|
|
|
9
9
|
beforeAll(async () => {
|
|
10
|
-
if (env.runMySQL)
|
|
11
|
-
ctxs.push(await _tu.createLegacyWalletMySQLCopy('storagefindLegacytest'))
|
|
10
|
+
if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('storagefindLegacytest'))
|
|
12
11
|
ctxs.push(await _tu.createLegacyWalletSQLiteCopy('storagefindLegacytest'))
|
|
13
12
|
})
|
|
14
13
|
|
|
@@ -48,9 +47,7 @@ describe('find tests', () => {
|
|
|
48
47
|
txStatus: ['sending']
|
|
49
48
|
})
|
|
50
49
|
expect(r.length).toBe(1)
|
|
51
|
-
expect(r[0].txid).toBe(
|
|
52
|
-
'a3a8fe7f541c1383ff7b975af49b27284ae720af5f2705d8409baaf519190d26'
|
|
53
|
-
)
|
|
50
|
+
expect(r[0].txid).toBe('a3a8fe7f541c1383ff7b975af49b27284ae720af5f2705d8409baaf519190d26')
|
|
54
51
|
expect(r[0].vout).toBe(2)
|
|
55
52
|
}
|
|
56
53
|
}
|