@bsv/wallet-toolbox 1.1.60 → 1.1.61
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/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 +1 -2
- 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 +4 -11
- 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 +15 -22
- 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/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/providers/ARC.ts +5 -24
- 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 +14 -68
- 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 +26 -99
- 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,11 +1,5 @@
|
|
|
1
1
|
import { _tu } from '../utils/TestUtilsWalletStorage'
|
|
2
|
-
import {
|
|
3
|
-
randomBytesBase64,
|
|
4
|
-
randomBytesHex,
|
|
5
|
-
sdk,
|
|
6
|
-
StorageProvider,
|
|
7
|
-
TableCommission
|
|
8
|
-
} from '../../src/index.client'
|
|
2
|
+
import { randomBytesBase64, randomBytesHex, sdk, StorageProvider, TableCommission } from '../../src/index.client'
|
|
9
3
|
import { StorageKnex } from '../../src/storage/StorageKnex'
|
|
10
4
|
|
|
11
5
|
describe('insert tests', () => {
|
|
@@ -16,12 +10,7 @@ describe('insert tests', () => {
|
|
|
16
10
|
const env = _tu.getEnv(chain)
|
|
17
11
|
|
|
18
12
|
beforeAll(async () => {
|
|
19
|
-
const localSQLiteFile = await _tu.newTmpFile(
|
|
20
|
-
'inserttest.sqlite',
|
|
21
|
-
false,
|
|
22
|
-
false,
|
|
23
|
-
true
|
|
24
|
-
)
|
|
13
|
+
const localSQLiteFile = await _tu.newTmpFile('inserttest.sqlite', false, false, true)
|
|
25
14
|
const knexSQLite = _tu.createLocalSQLite(localSQLiteFile)
|
|
26
15
|
storages.push(
|
|
27
16
|
new StorageKnex({
|
|
@@ -121,12 +110,7 @@ describe('insert tests', () => {
|
|
|
121
110
|
test('4 insert CertificateField', async () => {
|
|
122
111
|
for (const storage of storages) {
|
|
123
112
|
const c = await _tu.insertTestCertificate(storage)
|
|
124
|
-
const e = await _tu.insertTestCertificateField(
|
|
125
|
-
storage,
|
|
126
|
-
c,
|
|
127
|
-
'prize',
|
|
128
|
-
'starship'
|
|
129
|
-
)
|
|
113
|
+
const e = await _tu.insertTestCertificateField(storage, c, 'prize', 'starship')
|
|
130
114
|
expect(e.certificateId).toBe(c.certificateId)
|
|
131
115
|
expect(e.userId).toBe(c.userId)
|
|
132
116
|
expect(e.fieldName).toBe('prize')
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { _tu, TestSetup1 } from '../utils/TestUtilsWalletStorage'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
StorageProvider,
|
|
5
|
-
StorageKnex,
|
|
6
|
-
verifyOne
|
|
7
|
-
} from '../../src/index.all'
|
|
8
|
-
import {
|
|
9
|
-
normalizeDate,
|
|
10
|
-
setLogging,
|
|
11
|
-
updateTable,
|
|
12
|
-
verifyValues
|
|
13
|
-
} from '../utils/TestUtilsWalletStorage'
|
|
2
|
+
import { sdk, StorageProvider, StorageKnex, verifyOne } from '../../src/index.all'
|
|
3
|
+
import { normalizeDate, setLogging, updateTable, verifyValues } from '../utils/TestUtilsWalletStorage'
|
|
14
4
|
import {
|
|
15
5
|
TableProvenTx,
|
|
16
6
|
TableProvenTxReq,
|
|
@@ -46,12 +36,7 @@ describe('update tests', () => {
|
|
|
46
36
|
storages = []
|
|
47
37
|
const databaseName = testName()
|
|
48
38
|
|
|
49
|
-
const localSQLiteFile = await _tu.newTmpFile(
|
|
50
|
-
`${databaseName}.sqlite`,
|
|
51
|
-
false,
|
|
52
|
-
false,
|
|
53
|
-
true
|
|
54
|
-
)
|
|
39
|
+
const localSQLiteFile = await _tu.newTmpFile(`${databaseName}.sqlite`, false, false, true)
|
|
55
40
|
const knexSQLite = _tu.createLocalSQLite(localSQLiteFile)
|
|
56
41
|
storages.push(
|
|
57
42
|
new StorageKnex({
|
|
@@ -124,11 +109,7 @@ describe('update tests', () => {
|
|
|
124
109
|
merkleRoot: '1234',
|
|
125
110
|
rawTx: [4, 3, 2, 1]
|
|
126
111
|
}
|
|
127
|
-
await updateTable(
|
|
128
|
-
storage.updateProvenTx.bind(storage),
|
|
129
|
-
record[primaryKey],
|
|
130
|
-
testValues
|
|
131
|
-
)
|
|
112
|
+
await updateTable(storage.updateProvenTx.bind(storage), record[primaryKey], testValues)
|
|
132
113
|
const updatedTx = verifyOne(
|
|
133
114
|
await storage.findProvenTxs({
|
|
134
115
|
partial: { [primaryKey]: record[primaryKey] }
|
|
@@ -176,9 +157,7 @@ describe('update tests', () => {
|
|
|
176
157
|
partial: { [primaryKey]: record[primaryKey] }
|
|
177
158
|
})
|
|
178
159
|
)
|
|
179
|
-
expect(new Date(updatedRow[key]).toISOString()).toBe(
|
|
180
|
-
validDate.toISOString()
|
|
181
|
-
)
|
|
160
|
+
expect(new Date(updatedRow[key]).toISOString()).toBe(validDate.toISOString())
|
|
182
161
|
}
|
|
183
162
|
if (Array.isArray(value)) {
|
|
184
163
|
const validArray = value.map(v => v + 1)
|
|
@@ -226,10 +205,7 @@ describe('update tests', () => {
|
|
|
226
205
|
notify: JSON.stringify({ email: 'test@example.com', sent: true }),
|
|
227
206
|
rawTx: [1, 2, 3, 4]
|
|
228
207
|
}
|
|
229
|
-
const r1 = await storage.updateProvenTxReq(
|
|
230
|
-
record[primaryKey],
|
|
231
|
-
testValues
|
|
232
|
-
)
|
|
208
|
+
const r1 = await storage.updateProvenTxReq(record[primaryKey], testValues)
|
|
233
209
|
expect(r1).toBe(1)
|
|
234
210
|
const updatedRow = verifyOne(
|
|
235
211
|
await storage.findProvenTxReqs({
|
|
@@ -244,37 +220,22 @@ describe('update tests', () => {
|
|
|
244
220
|
expect(normalizedActual).toBe(normalizedExpected)
|
|
245
221
|
continue
|
|
246
222
|
}
|
|
247
|
-
if (
|
|
248
|
-
typeof value === 'string' &&
|
|
249
|
-
value.startsWith('{') &&
|
|
250
|
-
value.endsWith('}')
|
|
251
|
-
) {
|
|
223
|
+
if (typeof value === 'string' && value.startsWith('{') && value.endsWith('}')) {
|
|
252
224
|
expect(JSON.parse(actualValue)).toStrictEqual(JSON.parse(value))
|
|
253
225
|
continue
|
|
254
226
|
}
|
|
255
|
-
if (
|
|
256
|
-
typeof value === 'string' ||
|
|
257
|
-
typeof value === 'number' ||
|
|
258
|
-
typeof value === 'boolean'
|
|
259
|
-
) {
|
|
227
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
260
228
|
expect(actualValue).toBe(value)
|
|
261
229
|
continue
|
|
262
230
|
}
|
|
263
|
-
if (
|
|
264
|
-
typeof actualValue === 'object' &&
|
|
265
|
-
actualValue?.type === 'Buffer'
|
|
266
|
-
) {
|
|
231
|
+
if (typeof actualValue === 'object' && actualValue?.type === 'Buffer') {
|
|
267
232
|
const actualArray = actualValue.data || actualValue
|
|
268
233
|
const expectedArray =
|
|
269
|
-
Buffer.isBuffer(value) || Array.isArray(value)
|
|
270
|
-
? Array.from(value as ArrayLike<number>)
|
|
271
|
-
: value
|
|
234
|
+
Buffer.isBuffer(value) || Array.isArray(value) ? Array.from(value as ArrayLike<number>) : value
|
|
272
235
|
expect(actualArray).toStrictEqual(expectedArray)
|
|
273
236
|
continue
|
|
274
237
|
}
|
|
275
|
-
expect(
|
|
276
|
-
JSON.stringify({ type: 'Buffer', data: actualValue })
|
|
277
|
-
).toStrictEqual(JSON.stringify(value))
|
|
238
|
+
expect(JSON.stringify({ type: 'Buffer', data: actualValue })).toStrictEqual(JSON.stringify(value))
|
|
278
239
|
}
|
|
279
240
|
} catch (error: any) {
|
|
280
241
|
console.error(
|
|
@@ -300,10 +261,7 @@ describe('update tests', () => {
|
|
|
300
261
|
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
301
262
|
activeStorage: storage.getSettings().storageIdentityKey
|
|
302
263
|
}
|
|
303
|
-
const updateResult = await storage.updateUser(
|
|
304
|
-
record[primaryKey],
|
|
305
|
-
testValues
|
|
306
|
-
)
|
|
264
|
+
const updateResult = await storage.updateUser(record[primaryKey], testValues)
|
|
307
265
|
expect(updateResult).toBe(1)
|
|
308
266
|
const updatedRow = verifyOne(
|
|
309
267
|
await storage.findUsers({
|
|
@@ -350,10 +308,7 @@ describe('update tests', () => {
|
|
|
350
308
|
signature: 'mockSignature',
|
|
351
309
|
subject: 'mockSubject'
|
|
352
310
|
}
|
|
353
|
-
const r1 = await storage.updateCertificate(
|
|
354
|
-
record[primaryKey],
|
|
355
|
-
testValues
|
|
356
|
-
)
|
|
311
|
+
const r1 = await storage.updateCertificate(record[primaryKey], testValues)
|
|
357
312
|
expect(r1).toBe(1)
|
|
358
313
|
const updatedRow = verifyOne(
|
|
359
314
|
await storage.findCertificates({
|
|
@@ -368,11 +323,7 @@ describe('update tests', () => {
|
|
|
368
323
|
expect(normalizedActual).toBe(normalizedExpected)
|
|
369
324
|
continue
|
|
370
325
|
}
|
|
371
|
-
if (
|
|
372
|
-
typeof value === 'string' &&
|
|
373
|
-
value.startsWith('{') &&
|
|
374
|
-
value.endsWith('}')
|
|
375
|
-
) {
|
|
326
|
+
if (typeof value === 'string' && value.startsWith('{') && value.endsWith('}')) {
|
|
376
327
|
expect(JSON.parse(actualValue)).toStrictEqual(JSON.parse(value))
|
|
377
328
|
continue
|
|
378
329
|
}
|
|
@@ -382,9 +333,7 @@ describe('update tests', () => {
|
|
|
382
333
|
} else if (value === 0) {
|
|
383
334
|
expect(actualValue).toBe(false)
|
|
384
335
|
} else {
|
|
385
|
-
throw new Error(
|
|
386
|
-
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
387
|
-
)
|
|
336
|
+
throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
|
|
388
337
|
}
|
|
389
338
|
continue
|
|
390
339
|
}
|
|
@@ -392,21 +341,14 @@ describe('update tests', () => {
|
|
|
392
341
|
expect(actualValue).toBe(value)
|
|
393
342
|
continue
|
|
394
343
|
}
|
|
395
|
-
if (
|
|
396
|
-
typeof actualValue === 'object' &&
|
|
397
|
-
actualValue?.type === 'Buffer'
|
|
398
|
-
) {
|
|
344
|
+
if (typeof actualValue === 'object' && actualValue?.type === 'Buffer') {
|
|
399
345
|
const actualArray = actualValue.data || actualValue
|
|
400
346
|
const expectedArray =
|
|
401
|
-
Buffer.isBuffer(value) || Array.isArray(value)
|
|
402
|
-
? Array.from(value as ArrayLike<number>)
|
|
403
|
-
: value
|
|
347
|
+
Buffer.isBuffer(value) || Array.isArray(value) ? Array.from(value as ArrayLike<number>) : value
|
|
404
348
|
expect(actualArray).toStrictEqual(expectedArray)
|
|
405
349
|
continue
|
|
406
350
|
}
|
|
407
|
-
expect(
|
|
408
|
-
JSON.stringify({ type: 'Buffer', data: actualValue })
|
|
409
|
-
).toStrictEqual(JSON.stringify(value))
|
|
351
|
+
expect(JSON.stringify({ type: 'Buffer', data: actualValue })).toStrictEqual(JSON.stringify(value))
|
|
410
352
|
}
|
|
411
353
|
} catch (error: any) {
|
|
412
354
|
console.error(
|
|
@@ -489,10 +431,7 @@ describe('update tests', () => {
|
|
|
489
431
|
minimumDesiredUTXOValue: 5000,
|
|
490
432
|
isDeleted: false
|
|
491
433
|
}
|
|
492
|
-
const updateResult = await storage.updateOutputBasket(
|
|
493
|
-
record.basketId,
|
|
494
|
-
testValues
|
|
495
|
-
)
|
|
434
|
+
const updateResult = await storage.updateOutputBasket(record.basketId, testValues)
|
|
496
435
|
expect(updateResult).toBe(1)
|
|
497
436
|
const updatedRecords = await storage.findOutputBaskets({
|
|
498
437
|
partial: { basketId: record.basketId, name: testValues.name }
|
|
@@ -509,9 +448,7 @@ describe('update tests', () => {
|
|
|
509
448
|
} else if (value === 0) {
|
|
510
449
|
expect(actualValue).toBe(false)
|
|
511
450
|
} else {
|
|
512
|
-
throw new Error(
|
|
513
|
-
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
514
|
-
)
|
|
451
|
+
throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
|
|
515
452
|
}
|
|
516
453
|
continue
|
|
517
454
|
}
|
|
@@ -555,10 +492,7 @@ describe('update tests', () => {
|
|
|
555
492
|
satoshis: 20000,
|
|
556
493
|
version: 2
|
|
557
494
|
}
|
|
558
|
-
const updateResult = await storage.updateTransaction(
|
|
559
|
-
record.transactionId,
|
|
560
|
-
testValues
|
|
561
|
-
)
|
|
495
|
+
const updateResult = await storage.updateTransaction(record.transactionId, testValues)
|
|
562
496
|
expect(updateResult).toBe(1)
|
|
563
497
|
const updatedRecords = await storage.findTransactions({
|
|
564
498
|
partial: { transactionId: record.transactionId }
|
|
@@ -589,9 +523,7 @@ describe('update tests', () => {
|
|
|
589
523
|
})
|
|
590
524
|
|
|
591
525
|
test('7a updateTransactionStatus', async () => {
|
|
592
|
-
const { activeStorage: storage } = await _tu.createLegacyWalletSQLiteCopy(
|
|
593
|
-
'updateTransactionStatus6a'
|
|
594
|
-
)
|
|
526
|
+
const { activeStorage: storage } = await _tu.createLegacyWalletSQLiteCopy('updateTransactionStatus6a')
|
|
595
527
|
|
|
596
528
|
let tx = verifyOne(
|
|
597
529
|
await storage.findTransactions({
|
|
@@ -628,10 +560,7 @@ describe('update tests', () => {
|
|
|
628
560
|
isRedeemed: true,
|
|
629
561
|
lockingScript: [1, 2, 3, 4]
|
|
630
562
|
}
|
|
631
|
-
const updateResult = await storage.updateCommission(
|
|
632
|
-
record.commissionId,
|
|
633
|
-
testValues
|
|
634
|
-
)
|
|
563
|
+
const updateResult = await storage.updateCommission(record.commissionId, testValues)
|
|
635
564
|
expect(updateResult).toBe(1)
|
|
636
565
|
const updatedRecords = await storage.findCommissions({
|
|
637
566
|
partial: { commissionId: record.commissionId }
|
|
@@ -649,9 +578,7 @@ describe('update tests', () => {
|
|
|
649
578
|
continue
|
|
650
579
|
}
|
|
651
580
|
if (Buffer.isBuffer(actualValue) || Array.isArray(actualValue)) {
|
|
652
|
-
expect(
|
|
653
|
-
JSON.stringify({ type: 'Buffer', data: actualValue })
|
|
654
|
-
).toStrictEqual(JSON.stringify(value))
|
|
581
|
+
expect(JSON.stringify({ type: 'Buffer', data: actualValue })).toStrictEqual(JSON.stringify(value))
|
|
655
582
|
continue
|
|
656
583
|
}
|
|
657
584
|
expect(actualValue).toBe(value)
|
|
@@ -675,22 +602,16 @@ describe('update tests', () => {
|
|
|
675
602
|
if (!record.transactionId) record.transactionId = 1
|
|
676
603
|
if (!record.basketId) record.basketId = 1
|
|
677
604
|
if (!record.userId || !record.transactionId || !record.basketId) {
|
|
678
|
-
throw new Error(
|
|
679
|
-
`Missing required foreign keys for record ${JSON.stringify(record)}`
|
|
680
|
-
)
|
|
605
|
+
throw new Error(`Missing required foreign keys for record ${JSON.stringify(record)}`)
|
|
681
606
|
}
|
|
682
607
|
}
|
|
683
608
|
for (const record of records) {
|
|
684
609
|
const existingRecords = await storage.findOutputs({ partial: {} })
|
|
685
|
-
const usedCombinations = new Set(
|
|
686
|
-
existingRecords.map(r => `${r.transactionId}-${r.vout}-${r.userId}`)
|
|
687
|
-
)
|
|
610
|
+
const usedCombinations = new Set(existingRecords.map(r => `${r.transactionId}-${r.vout}-${r.userId}`))
|
|
688
611
|
let testTransactionId = record.transactionId
|
|
689
612
|
let testVout = record.vout + 1
|
|
690
613
|
let testUserId = record.userId
|
|
691
|
-
while (
|
|
692
|
-
usedCombinations.has(`${testTransactionId}-${testVout}-${testUserId}`)
|
|
693
|
-
) {
|
|
614
|
+
while (usedCombinations.has(`${testTransactionId}-${testVout}-${testUserId}`)) {
|
|
694
615
|
testVout += 1
|
|
695
616
|
}
|
|
696
617
|
try {
|
|
@@ -721,10 +642,7 @@ describe('update tests', () => {
|
|
|
721
642
|
type: 'updated_type',
|
|
722
643
|
outputDescription: 'outputDescription'
|
|
723
644
|
}
|
|
724
|
-
const updateResult = await storage.updateOutput(
|
|
725
|
-
record.outputId,
|
|
726
|
-
testValues
|
|
727
|
-
)
|
|
645
|
+
const updateResult = await storage.updateOutput(record.outputId, testValues)
|
|
728
646
|
expect(updateResult).toBe(1)
|
|
729
647
|
const updatedRecords = await storage.findOutputs({
|
|
730
648
|
partial: { outputId: record.outputId }
|
|
@@ -742,18 +660,13 @@ describe('update tests', () => {
|
|
|
742
660
|
continue
|
|
743
661
|
}
|
|
744
662
|
if (Buffer.isBuffer(actualValue) || Array.isArray(actualValue)) {
|
|
745
|
-
expect(
|
|
746
|
-
JSON.stringify({ type: 'Buffer', data: actualValue })
|
|
747
|
-
).toStrictEqual(JSON.stringify(value))
|
|
663
|
+
expect(JSON.stringify({ type: 'Buffer', data: actualValue })).toStrictEqual(JSON.stringify(value))
|
|
748
664
|
continue
|
|
749
665
|
}
|
|
750
666
|
expect(actualValue).toBe(value)
|
|
751
667
|
}
|
|
752
668
|
} catch (error: any) {
|
|
753
|
-
console.error(
|
|
754
|
-
`Error updating or verifying Output record with outputId=${record[primaryKey]}:`,
|
|
755
|
-
error.message
|
|
756
|
-
)
|
|
669
|
+
console.error(`Error updating or verifying Output record with outputId=${record[primaryKey]}:`, error.message)
|
|
757
670
|
throw error
|
|
758
671
|
}
|
|
759
672
|
}
|
|
@@ -768,9 +681,7 @@ describe('update tests', () => {
|
|
|
768
681
|
if (!record.userId) record.userId = 1
|
|
769
682
|
if (!record.tag) record.tag = `default_tag_${record.outputTagId}`
|
|
770
683
|
if (!record.userId || !record.tag) {
|
|
771
|
-
throw new Error(
|
|
772
|
-
`Missing required fields for record ${JSON.stringify(record)}`
|
|
773
|
-
)
|
|
684
|
+
throw new Error(`Missing required fields for record ${JSON.stringify(record)}`)
|
|
774
685
|
}
|
|
775
686
|
}
|
|
776
687
|
for (const record of records) {
|
|
@@ -784,10 +695,7 @@ describe('update tests', () => {
|
|
|
784
695
|
isDeleted: false
|
|
785
696
|
}
|
|
786
697
|
try {
|
|
787
|
-
const updateResult = await storage.updateOutputTag(
|
|
788
|
-
record.outputTagId,
|
|
789
|
-
testValues
|
|
790
|
-
)
|
|
698
|
+
const updateResult = await storage.updateOutputTag(record.outputTagId, testValues)
|
|
791
699
|
expect(updateResult).toBe(1)
|
|
792
700
|
const updatedRecords = await storage.findOutputTags({
|
|
793
701
|
partial: { outputTagId: record.outputTagId }
|
|
@@ -804,9 +712,7 @@ describe('update tests', () => {
|
|
|
804
712
|
} else if (value === 0) {
|
|
805
713
|
expect(actualValue).toBe(false)
|
|
806
714
|
} else {
|
|
807
|
-
throw new Error(
|
|
808
|
-
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
809
|
-
)
|
|
715
|
+
throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
|
|
810
716
|
}
|
|
811
717
|
continue
|
|
812
718
|
}
|
|
@@ -834,14 +740,8 @@ describe('update tests', () => {
|
|
|
834
740
|
for (const { storage } of setups) {
|
|
835
741
|
const records = await storage.findOutputTagMaps({ partial: {} })
|
|
836
742
|
for (const record of records) {
|
|
837
|
-
if (!record.outputTagId)
|
|
838
|
-
|
|
839
|
-
`Missing outputTagId for record: ${JSON.stringify(record)}`
|
|
840
|
-
)
|
|
841
|
-
if (!record.outputId)
|
|
842
|
-
throw new Error(
|
|
843
|
-
`Missing outputId for record: ${JSON.stringify(record)}`
|
|
844
|
-
)
|
|
743
|
+
if (!record.outputTagId) throw new Error(`Missing outputTagId for record: ${JSON.stringify(record)}`)
|
|
744
|
+
if (!record.outputId) throw new Error(`Missing outputId for record: ${JSON.stringify(record)}`)
|
|
845
745
|
try {
|
|
846
746
|
const testValues: TableOutputTagMap = {
|
|
847
747
|
outputTagId: record.outputTagId,
|
|
@@ -850,11 +750,7 @@ describe('update tests', () => {
|
|
|
850
750
|
updated_at: new Date('2024-12-30T23:05:00Z'),
|
|
851
751
|
isDeleted: false
|
|
852
752
|
}
|
|
853
|
-
const updateResult = await storage.updateOutputTagMap(
|
|
854
|
-
record.outputId,
|
|
855
|
-
record.outputTagId,
|
|
856
|
-
testValues
|
|
857
|
-
)
|
|
753
|
+
const updateResult = await storage.updateOutputTagMap(record.outputId, record.outputTagId, testValues)
|
|
858
754
|
expect(updateResult).toBe(1)
|
|
859
755
|
const updatedRecords = await storage.findOutputTagMaps({
|
|
860
756
|
partial: {
|
|
@@ -874,9 +770,7 @@ describe('update tests', () => {
|
|
|
874
770
|
} else if (value === 0) {
|
|
875
771
|
expect(actualValue).toBe(false)
|
|
876
772
|
} else {
|
|
877
|
-
throw new Error(
|
|
878
|
-
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
879
|
-
)
|
|
773
|
+
throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
|
|
880
774
|
}
|
|
881
775
|
continue
|
|
882
776
|
}
|
|
@@ -905,9 +799,7 @@ describe('update tests', () => {
|
|
|
905
799
|
const records = await storage.findTxLabels({ partial: {} })
|
|
906
800
|
for (const record of records) {
|
|
907
801
|
if (!record.userId) {
|
|
908
|
-
throw new Error(
|
|
909
|
-
`Missing required foreign key userId for record ${JSON.stringify(record)}`
|
|
910
|
-
)
|
|
802
|
+
throw new Error(`Missing required foreign key userId for record ${JSON.stringify(record)}`)
|
|
911
803
|
}
|
|
912
804
|
}
|
|
913
805
|
for (const record of records) {
|
|
@@ -926,10 +818,7 @@ describe('update tests', () => {
|
|
|
926
818
|
if (existingLabel.length > 0) {
|
|
927
819
|
continue
|
|
928
820
|
}
|
|
929
|
-
const updateResult = await storage.updateTxLabel(
|
|
930
|
-
record.txLabelId,
|
|
931
|
-
testValues
|
|
932
|
-
)
|
|
821
|
+
const updateResult = await storage.updateTxLabel(record.txLabelId, testValues)
|
|
933
822
|
expect(updateResult).toBe(1)
|
|
934
823
|
const updatedRecords = await storage.findTxLabels({
|
|
935
824
|
partial: { txLabelId: record.txLabelId }
|
|
@@ -946,9 +835,7 @@ describe('update tests', () => {
|
|
|
946
835
|
} else if (value === 0) {
|
|
947
836
|
expect(actualValue).toBe(false)
|
|
948
837
|
} else {
|
|
949
|
-
throw new Error(
|
|
950
|
-
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
951
|
-
)
|
|
838
|
+
throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
|
|
952
839
|
}
|
|
953
840
|
continue
|
|
954
841
|
}
|
|
@@ -971,9 +858,7 @@ describe('update tests', () => {
|
|
|
971
858
|
const records = await storage.findTxLabelMaps({ partial: {} })
|
|
972
859
|
for (const record of records) {
|
|
973
860
|
if (!record.transactionId || !record.txLabelId) {
|
|
974
|
-
throw new Error(
|
|
975
|
-
`Missing required foreign keys for record ${JSON.stringify(record)}`
|
|
976
|
-
)
|
|
861
|
+
throw new Error(`Missing required foreign keys for record ${JSON.stringify(record)}`)
|
|
977
862
|
}
|
|
978
863
|
}
|
|
979
864
|
for (const record of records) {
|
|
@@ -994,11 +879,7 @@ describe('update tests', () => {
|
|
|
994
879
|
continue
|
|
995
880
|
}
|
|
996
881
|
try {
|
|
997
|
-
const updateResult = await storage.updateTxLabelMap(
|
|
998
|
-
record.transactionId,
|
|
999
|
-
record.txLabelId,
|
|
1000
|
-
testValues
|
|
1001
|
-
)
|
|
882
|
+
const updateResult = await storage.updateTxLabelMap(record.transactionId, record.txLabelId, testValues)
|
|
1002
883
|
expect(updateResult).toBe(1)
|
|
1003
884
|
const updatedRecords = await storage.findTxLabelMaps({
|
|
1004
885
|
partial: {
|
|
@@ -1044,10 +925,7 @@ describe('update tests', () => {
|
|
|
1044
925
|
event: 'updated_event',
|
|
1045
926
|
details: 'Updated details'
|
|
1046
927
|
}
|
|
1047
|
-
const updateResult = await storage.updateMonitorEvent(
|
|
1048
|
-
record.id,
|
|
1049
|
-
testValues
|
|
1050
|
-
)
|
|
928
|
+
const updateResult = await storage.updateMonitorEvent(record.id, testValues)
|
|
1051
929
|
expect(updateResult).toBe(1)
|
|
1052
930
|
const updatedRecords = await storage.findMonitorEvents({
|
|
1053
931
|
partial: { id: record.id }
|
|
@@ -1067,10 +945,7 @@ describe('update tests', () => {
|
|
|
1067
945
|
expect(actualValue).toBe(value)
|
|
1068
946
|
}
|
|
1069
947
|
} catch (error: any) {
|
|
1070
|
-
console.error(
|
|
1071
|
-
`Error updating or verifying MonitorEvent record with id=${record[primaryKey]}:`,
|
|
1072
|
-
error.message
|
|
1073
|
-
)
|
|
948
|
+
console.error(`Error updating or verifying MonitorEvent record with id=${record[primaryKey]}:`, error.message)
|
|
1074
949
|
throw error
|
|
1075
950
|
}
|
|
1076
951
|
}
|
|
@@ -1083,9 +958,7 @@ describe('update tests', () => {
|
|
|
1083
958
|
const records = await storage.findSyncStates({ partial: {} })
|
|
1084
959
|
for (const record of records) {
|
|
1085
960
|
if (!record.userId) {
|
|
1086
|
-
throw new Error(
|
|
1087
|
-
`Missing required foreign key userId for record ${JSON.stringify(record)}`
|
|
1088
|
-
)
|
|
961
|
+
throw new Error(`Missing required foreign key userId for record ${JSON.stringify(record)}`)
|
|
1089
962
|
}
|
|
1090
963
|
}
|
|
1091
964
|
for (const record of records) {
|
|
@@ -1105,10 +978,7 @@ describe('update tests', () => {
|
|
|
1105
978
|
syncMap: '{}',
|
|
1106
979
|
when: new Date('2025-01-01T02:00:00.000Z')
|
|
1107
980
|
}
|
|
1108
|
-
const updateResult = await storage.updateSyncState(
|
|
1109
|
-
record.syncStateId,
|
|
1110
|
-
testValues
|
|
1111
|
-
)
|
|
981
|
+
const updateResult = await storage.updateSyncState(record.syncStateId, testValues)
|
|
1112
982
|
expect(updateResult).toBe(1)
|
|
1113
983
|
const updatedRecords = await storage.findSyncStates({
|
|
1114
984
|
partial: { syncStateId: record.syncStateId }
|
|
@@ -1125,9 +995,7 @@ describe('update tests', () => {
|
|
|
1125
995
|
} else if (value === 0) {
|
|
1126
996
|
expect(actualValue).toBe(false)
|
|
1127
997
|
} else {
|
|
1128
|
-
throw new Error(
|
|
1129
|
-
`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
|
|
1130
|
-
)
|
|
998
|
+
throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
|
|
1131
999
|
}
|
|
1132
1000
|
continue
|
|
1133
1001
|
}
|