@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,8 +1,5 @@
|
|
|
1
1
|
import { createSyncMap, sdk, TableCertificate } from '../../../../../src'
|
|
2
|
-
import {
|
|
3
|
-
TestUtilsWalletStorage as _tu,
|
|
4
|
-
TestWalletNoSetup
|
|
5
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
2
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
6
3
|
import { EntityCertificate } from '../../../../../src/storage/schema/entities/Certificate'
|
|
7
4
|
|
|
8
5
|
describe('Certificate class method tests', () => {
|
|
@@ -41,14 +38,10 @@ describe('Certificate class method tests', () => {
|
|
|
41
38
|
userId: 1,
|
|
42
39
|
type: Buffer.from('exampleType').toString('base64'), // Base64-encoded string
|
|
43
40
|
serialNumber: Buffer.from('serial123').toString('base64'), // Base64-encoded string
|
|
44
|
-
certifier:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
revocationOutpoint:
|
|
49
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0', // OutpointString
|
|
50
|
-
signature:
|
|
51
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // HexString
|
|
41
|
+
certifier: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234', // PubKeyHex
|
|
42
|
+
subject: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // PubKeyHex
|
|
43
|
+
revocationOutpoint: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0', // OutpointString
|
|
44
|
+
signature: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // HexString
|
|
52
45
|
isDeleted: false
|
|
53
46
|
}
|
|
54
47
|
|
|
@@ -76,14 +69,10 @@ describe('Certificate class method tests', () => {
|
|
|
76
69
|
userId: 1,
|
|
77
70
|
type: Buffer.from('exampleType1').toString('base64'), // Unique Base64-encoded string
|
|
78
71
|
serialNumber: Buffer.from('serial123-1').toString('base64'), // Unique Base64-encoded string
|
|
79
|
-
certifier:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
revocationOutpoint:
|
|
84
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0', // Same OutpointString
|
|
85
|
-
signature:
|
|
86
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // Same HexString
|
|
72
|
+
certifier: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234', // Same PubKeyHex
|
|
73
|
+
subject: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // Same PubKeyHex
|
|
74
|
+
revocationOutpoint: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0', // Same OutpointString
|
|
75
|
+
signature: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // Same HexString
|
|
87
76
|
isDeleted: false
|
|
88
77
|
}
|
|
89
78
|
const certificateData2: TableCertificate = {
|
|
@@ -93,14 +82,10 @@ describe('Certificate class method tests', () => {
|
|
|
93
82
|
userId: 1,
|
|
94
83
|
type: Buffer.from('exampleType2').toString('base64'), // Unique Base64-encoded string
|
|
95
84
|
serialNumber: Buffer.from('serial123-2').toString('base64'), // Unique Base64-encoded string
|
|
96
|
-
certifier:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
revocationOutpoint:
|
|
101
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:1', // Unique OutpointString
|
|
102
|
-
signature:
|
|
103
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // Same HexString
|
|
85
|
+
certifier: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // Same PubKeyHex
|
|
86
|
+
subject: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // Same PubKeyHex
|
|
87
|
+
revocationOutpoint: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:1', // Unique OutpointString
|
|
88
|
+
signature: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // Same HexString
|
|
104
89
|
isDeleted: false
|
|
105
90
|
}
|
|
106
91
|
|
|
@@ -147,14 +132,10 @@ describe('Certificate class method tests', () => {
|
|
|
147
132
|
userId: 1,
|
|
148
133
|
type: Buffer.from('exampleTypeMerge').toString('base64'),
|
|
149
134
|
serialNumber: Buffer.from('serialMerge123').toString('base64'),
|
|
150
|
-
certifier:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
revocationOutpoint:
|
|
155
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0',
|
|
156
|
-
signature:
|
|
157
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
|
|
135
|
+
certifier: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234',
|
|
136
|
+
subject: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678',
|
|
137
|
+
revocationOutpoint: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0',
|
|
138
|
+
signature: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
|
|
158
139
|
isDeleted: false
|
|
159
140
|
}
|
|
160
141
|
|
|
@@ -230,14 +211,10 @@ describe('Certificate class method tests', () => {
|
|
|
230
211
|
userId: 1,
|
|
231
212
|
type: 'exampleType',
|
|
232
213
|
serialNumber: 'exampleSerialNumber',
|
|
233
|
-
certifier:
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
revocationOutpoint:
|
|
238
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0',
|
|
239
|
-
signature:
|
|
240
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
|
|
214
|
+
certifier: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234',
|
|
215
|
+
subject: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678',
|
|
216
|
+
revocationOutpoint: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0',
|
|
217
|
+
signature: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
|
|
241
218
|
isDeleted: false
|
|
242
219
|
}
|
|
243
220
|
|
|
@@ -278,16 +255,10 @@ describe('Certificate class method tests', () => {
|
|
|
278
255
|
|
|
279
256
|
// Verify that the entity is not updated
|
|
280
257
|
expect(entity.type).toBe('exampleType')
|
|
281
|
-
expect(entity.subject).toBe(
|
|
282
|
-
'02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678'
|
|
283
|
-
)
|
|
258
|
+
expect(entity.subject).toBe('02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678')
|
|
284
259
|
expect(entity.serialNumber).toBe('exampleSerialNumber')
|
|
285
|
-
expect(entity.revocationOutpoint).toBe(
|
|
286
|
-
|
|
287
|
-
)
|
|
288
|
-
expect(entity.signature).toBe(
|
|
289
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890'
|
|
290
|
-
)
|
|
260
|
+
expect(entity.revocationOutpoint).toBe('abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0')
|
|
261
|
+
expect(entity.signature).toBe('abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890')
|
|
291
262
|
expect(entity.isDeleted).toBe(0)
|
|
292
263
|
|
|
293
264
|
// Verify that the database is not updated
|
|
@@ -297,16 +268,12 @@ describe('Certificate class method tests', () => {
|
|
|
297
268
|
expect(unchangedRecord.length).toBe(1)
|
|
298
269
|
expect(unchangedRecord[0]).toBeDefined()
|
|
299
270
|
expect(unchangedRecord[0].type).toBe('exampleType')
|
|
300
|
-
expect(unchangedRecord[0].subject).toBe(
|
|
301
|
-
'02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678'
|
|
302
|
-
)
|
|
271
|
+
expect(unchangedRecord[0].subject).toBe('02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678')
|
|
303
272
|
expect(unchangedRecord[0].serialNumber).toBe('exampleSerialNumber')
|
|
304
273
|
expect(unchangedRecord[0].revocationOutpoint).toBe(
|
|
305
274
|
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0'
|
|
306
275
|
)
|
|
307
|
-
expect(unchangedRecord[0].signature).toBe(
|
|
308
|
-
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890'
|
|
309
|
-
)
|
|
276
|
+
expect(unchangedRecord[0].signature).toBe('abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890')
|
|
310
277
|
expect(unchangedRecord[0].isDeleted).toBe(false)
|
|
311
278
|
}
|
|
312
279
|
})
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
sdk,
|
|
4
|
-
SyncMap,
|
|
5
|
-
TableCommission,
|
|
6
|
-
TableTransaction
|
|
7
|
-
} from '../../../../../src'
|
|
8
|
-
import {
|
|
9
|
-
TestUtilsWalletStorage as _tu,
|
|
10
|
-
TestWalletNoSetup
|
|
11
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
1
|
+
import { createSyncMap, sdk, SyncMap, TableCommission, TableTransaction } from '../../../../../src'
|
|
2
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
12
3
|
import { EntityCommission } from '../../../../../src/storage/schema/entities/Commission'
|
|
13
4
|
|
|
14
5
|
describe('Commission class method tests', () => {
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
sdk,
|
|
4
|
-
SyncMap,
|
|
5
|
-
TableOutputBasket
|
|
6
|
-
} from '../../../../../src'
|
|
7
|
-
import {
|
|
8
|
-
TestUtilsWalletStorage as _tu,
|
|
9
|
-
TestWalletNoSetup
|
|
10
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
1
|
+
import { createSyncMap, sdk, SyncMap, TableOutputBasket } from '../../../../../src'
|
|
2
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
11
3
|
import { EntityOutputBasket } from '../../../../../src/storage/schema/entities/OutputBasket'
|
|
12
4
|
|
|
13
5
|
describe('OutputBasket class method tests', () => {
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import * as bsv from '@bsv/sdk'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
sdk,
|
|
5
|
-
SyncMap,
|
|
6
|
-
TableOutputTagMap
|
|
7
|
-
} from '../../../../../src'
|
|
8
|
-
import {
|
|
9
|
-
TestUtilsWalletStorage as _tu,
|
|
10
|
-
TestWalletNoSetup
|
|
11
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
2
|
+
import { createSyncMap, sdk, SyncMap, TableOutputTagMap } from '../../../../../src'
|
|
3
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
12
4
|
import { EntityOutputTagMap } from '../../../../../src/storage/schema/entities/OutputTagMap'
|
|
13
5
|
|
|
14
6
|
describe('OutputTagMap class method tests', () => {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { createSyncMap, sdk, SyncMap, TableOutputTag } from '../../../../../src'
|
|
2
|
-
import {
|
|
3
|
-
TestUtilsWalletStorage as _tu,
|
|
4
|
-
TestWalletNoSetup
|
|
5
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
2
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
6
3
|
import { EntityOutputTag } from '../../../../../src/storage/schema/entities/OutputTag'
|
|
7
4
|
|
|
8
5
|
describe('OutputTag class method tests', () => {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { createSyncMap, sdk, SyncMap, TableOutput } from '../../../../../src'
|
|
2
|
-
import {
|
|
3
|
-
TestUtilsWalletStorage as _tu,
|
|
4
|
-
TestWalletNoSetup
|
|
5
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
2
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
6
3
|
import { EntityOutput } from '../../../../../src/storage/schema/entities/Output'
|
|
7
4
|
|
|
8
5
|
describe('Output class method tests', () => {
|
|
@@ -270,9 +267,7 @@ describe('Output class method tests', () => {
|
|
|
270
267
|
|
|
271
268
|
// Handle undefined lockingScript gracefully
|
|
272
269
|
if (updatedRecord[0].lockingScript) {
|
|
273
|
-
expect(Buffer.from(updatedRecord[0].lockingScript).toJSON().data).toEqual(
|
|
274
|
-
[4, 5, 6]
|
|
275
|
-
)
|
|
270
|
+
expect(Buffer.from(updatedRecord[0].lockingScript).toJSON().data).toEqual([4, 5, 6])
|
|
276
271
|
} else {
|
|
277
272
|
throw new Error('lockingScript is undefined')
|
|
278
273
|
}
|
|
@@ -327,13 +322,7 @@ describe('Output class method tests', () => {
|
|
|
327
322
|
syncMap.outputBasket.idMap[1] = 1
|
|
328
323
|
|
|
329
324
|
// Call mergeExisting
|
|
330
|
-
const wasMergedRaw = await entity.mergeExisting(
|
|
331
|
-
ctx.activeStorage,
|
|
332
|
-
undefined,
|
|
333
|
-
earlierData,
|
|
334
|
-
syncMap,
|
|
335
|
-
undefined
|
|
336
|
-
)
|
|
325
|
+
const wasMergedRaw = await entity.mergeExisting(ctx.activeStorage, undefined, earlierData, syncMap, undefined)
|
|
337
326
|
|
|
338
327
|
const wasMerged = Boolean(wasMergedRaw)
|
|
339
328
|
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import * as bsv from '@bsv/sdk'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
SyncMap,
|
|
6
|
-
TableProvenTxReq
|
|
7
|
-
} from '../../../../../src'
|
|
8
|
-
import {
|
|
9
|
-
TestUtilsWalletStorage as _tu,
|
|
10
|
-
TestWalletNoSetup
|
|
11
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
12
|
-
import {
|
|
13
|
-
EntityProvenTxReq,
|
|
14
|
-
ProvenTxReqHistorySummaryApi
|
|
15
|
-
} from '../../../../../src/storage/schema/entities/ProvenTxReq'
|
|
2
|
+
import { createSyncMap, sdk, SyncMap, TableProvenTxReq } from '../../../../../src'
|
|
3
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
4
|
+
import { EntityProvenTxReq, ProvenTxReqHistorySummaryApi } from '../../../../../src/storage/schema/entities/ProvenTxReq'
|
|
16
5
|
|
|
17
6
|
describe('ProvenTxReq class method tests', () => {
|
|
18
7
|
jest.setTimeout(99999999)
|
|
@@ -333,8 +322,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
333
322
|
const ctx = ctxs[0]
|
|
334
323
|
|
|
335
324
|
// Fetch terminal statuses if they are stored in the database or available via context
|
|
336
|
-
const terminalStatuses: sdk.ProvenTxReqStatus[] =
|
|
337
|
-
sdk.ProvenTxReqTerminalStatus
|
|
325
|
+
const terminalStatuses: sdk.ProvenTxReqStatus[] = sdk.ProvenTxReqTerminalStatus
|
|
338
326
|
|
|
339
327
|
// Test cases for valid and invalid statuses
|
|
340
328
|
const testCases: { status: sdk.ProvenTxReqStatus; expected: boolean }[] = [
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as bsv from '@bsv/sdk'
|
|
2
2
|
import { createSyncMap, sdk, SyncMap } from '../../../../../src'
|
|
3
|
-
import {
|
|
4
|
-
TestUtilsWalletStorage as _tu,
|
|
5
|
-
TestWalletNoSetup
|
|
6
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
3
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
7
4
|
import { EntityProvenTx } from '../../../../../src/storage/schema/entities/ProvenTx'
|
|
8
5
|
|
|
9
6
|
describe('ProvenTx class method tests', () => {
|
|
@@ -33,8 +30,7 @@ describe('ProvenTx class method tests', () => {
|
|
|
33
30
|
|
|
34
31
|
test('0_fromTxid: valid txid with rawTx and Merkle proof (real database)', async () => {
|
|
35
32
|
const ctx = ctxs[0]
|
|
36
|
-
const txid =
|
|
37
|
-
'2795b293c698b2244147aaba745db887a632d21990c474df46d842ec3e52f122' // Using a valid txid from the table
|
|
33
|
+
const txid = '2795b293c698b2244147aaba745db887a632d21990c474df46d842ec3e52f122' // Using a valid txid from the table
|
|
38
34
|
|
|
39
35
|
// Fetch the rawTx and Merkle proof data directly from the database
|
|
40
36
|
const provenTxRecord = await ctx.activeStorage.findProvenTxs({
|
|
@@ -202,8 +198,7 @@ describe('ProvenTx class method tests', () => {
|
|
|
202
198
|
provenTx.provenTxId = 2
|
|
203
199
|
provenTx.created_at = new Date('2025-02-01T00:00:00Z')
|
|
204
200
|
provenTx.updated_at = new Date('2025-02-02T00:00:00Z')
|
|
205
|
-
provenTx.txid =
|
|
206
|
-
'a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7'
|
|
201
|
+
provenTx.txid = 'a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7'
|
|
207
202
|
provenTx.height = 456
|
|
208
203
|
provenTx.index = 1
|
|
209
204
|
provenTx.merklePath = [0x07, 0x08, 0x09]
|
|
@@ -215,9 +210,7 @@ describe('ProvenTx class method tests', () => {
|
|
|
215
210
|
expect(provenTx.provenTxId).toBe(2)
|
|
216
211
|
expect(provenTx.created_at).toEqual(new Date('2025-02-01T00:00:00Z'))
|
|
217
212
|
expect(provenTx.updated_at).toEqual(new Date('2025-02-02T00:00:00Z'))
|
|
218
|
-
expect(provenTx.txid).toBe(
|
|
219
|
-
'a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7'
|
|
220
|
-
)
|
|
213
|
+
expect(provenTx.txid).toBe('a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7')
|
|
221
214
|
expect(provenTx.height).toBe(456)
|
|
222
215
|
expect(provenTx.index).toBe(1)
|
|
223
216
|
expect(provenTx.merklePath).toEqual([0x07, 0x08, 0x09])
|
|
@@ -469,13 +462,7 @@ describe('ProvenTx class method tests', () => {
|
|
|
469
462
|
const mockTrx: sdk.TrxToken = {}
|
|
470
463
|
|
|
471
464
|
// Call the mergeExisting method
|
|
472
|
-
const result = await provenTx.mergeExisting(
|
|
473
|
-
mockStorage,
|
|
474
|
-
new Date(),
|
|
475
|
-
provenTx.toApi(),
|
|
476
|
-
mockSyncMap,
|
|
477
|
-
mockTrx
|
|
478
|
-
)
|
|
465
|
+
const result = await provenTx.mergeExisting(mockStorage, new Date(), provenTx.toApi(), mockSyncMap, mockTrx)
|
|
479
466
|
|
|
480
467
|
// Assert that it always returns false
|
|
481
468
|
expect(result).toBe(false)
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { EntitySyncState } from '../../../../../src/storage/schema/entities/SyncState'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
EntityStorage,
|
|
5
|
-
sdk,
|
|
6
|
-
SyncMap,
|
|
7
|
-
TableSyncState
|
|
8
|
-
} from '../../../../../src'
|
|
9
|
-
import {
|
|
10
|
-
TestUtilsWalletStorage as _tu,
|
|
11
|
-
TestWalletNoSetup
|
|
12
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
2
|
+
import { createSyncMap, EntityStorage, sdk, SyncMap, TableSyncState } from '../../../../../src'
|
|
3
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
13
4
|
|
|
14
5
|
describe('SyncState class method tests', () => {
|
|
15
6
|
jest.setTimeout(99999999)
|
|
@@ -173,11 +164,7 @@ describe('SyncState class method tests', () => {
|
|
|
173
164
|
toStorageIdentityKey: 'toKey'
|
|
174
165
|
}
|
|
175
166
|
|
|
176
|
-
const result = await syncState.processSyncChunk(
|
|
177
|
-
ctx.activeStorage,
|
|
178
|
-
args,
|
|
179
|
-
chunk
|
|
180
|
-
)
|
|
167
|
+
const result = await syncState.processSyncChunk(ctx.activeStorage, args, chunk)
|
|
181
168
|
|
|
182
169
|
expect(result.done).toBe(true)
|
|
183
170
|
expect(result.updates).toBe(0)
|
|
@@ -285,9 +272,7 @@ describe('SyncState class method tests', () => {
|
|
|
285
272
|
|
|
286
273
|
const syncMap = createSyncMap()
|
|
287
274
|
|
|
288
|
-
await expect(
|
|
289
|
-
syncState.mergeNew(mockStorage, 1, syncMap, undefined)
|
|
290
|
-
).resolves.toBeUndefined()
|
|
275
|
+
await expect(syncState.mergeNew(mockStorage, 1, syncMap, undefined)).resolves.toBeUndefined()
|
|
291
276
|
})
|
|
292
277
|
|
|
293
278
|
// Test: mergeExisting method (always returns false)
|
|
@@ -297,13 +282,7 @@ describe('SyncState class method tests', () => {
|
|
|
297
282
|
|
|
298
283
|
const syncMap = createSyncMap()
|
|
299
284
|
|
|
300
|
-
const result = await syncState.mergeExisting(
|
|
301
|
-
mockStorage,
|
|
302
|
-
new Date(),
|
|
303
|
-
{} as TableSyncState,
|
|
304
|
-
syncMap,
|
|
305
|
-
undefined
|
|
306
|
-
)
|
|
285
|
+
const result = await syncState.mergeExisting(mockStorage, new Date(), {} as TableSyncState, syncMap, undefined)
|
|
307
286
|
expect(result).toBe(false)
|
|
308
287
|
})
|
|
309
288
|
})
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { Knex } from 'knex'
|
|
2
2
|
import * as bsv from '@bsv/sdk'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
sdk,
|
|
6
|
-
SyncMap,
|
|
7
|
-
TableTransaction
|
|
8
|
-
} from '../../../../../src'
|
|
9
|
-
import {
|
|
10
|
-
TestUtilsWalletStorage as _tu,
|
|
11
|
-
TestWalletNoSetup
|
|
12
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
3
|
+
import { createSyncMap, sdk, SyncMap, TableTransaction } from '../../../../../src'
|
|
4
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
13
5
|
import { EntityTransaction } from '../../../../../src/storage/schema/entities/Transaction'
|
|
14
6
|
|
|
15
7
|
describe('Transaction class method tests', () => {
|
|
@@ -166,11 +158,7 @@ describe('Transaction class method tests', () => {
|
|
|
166
158
|
test('6_getInputs_combines_spentBy_and_rawTx_inputs', async () => {
|
|
167
159
|
for (const { activeStorage } of ctxs) {
|
|
168
160
|
// Insert the transaction into the database
|
|
169
|
-
const txData = await _tu.insertTestTransaction(
|
|
170
|
-
activeStorage,
|
|
171
|
-
undefined,
|
|
172
|
-
true
|
|
173
|
-
)
|
|
161
|
+
const txData = await _tu.insertTestTransaction(activeStorage, undefined, true)
|
|
174
162
|
const tx = new EntityTransaction(txData.tx)
|
|
175
163
|
|
|
176
164
|
// Assign rawTx to simulate transaction inputs
|
|
@@ -217,11 +205,7 @@ describe('Transaction class method tests', () => {
|
|
|
217
205
|
test('9_mergeExisting_updates_when_ei_updated_at_is_newer', async () => {
|
|
218
206
|
for (const { activeStorage } of ctxs) {
|
|
219
207
|
// Insert a test transaction into the database
|
|
220
|
-
const txData = await _tu.insertTestTransaction(
|
|
221
|
-
activeStorage,
|
|
222
|
-
undefined,
|
|
223
|
-
true
|
|
224
|
-
)
|
|
208
|
+
const txData = await _tu.insertTestTransaction(activeStorage, undefined, true)
|
|
225
209
|
|
|
226
210
|
// Create the `Transaction` instance with an earlier updated_at timestamp
|
|
227
211
|
const tx = new EntityTransaction({
|
|
@@ -240,13 +224,10 @@ describe('Transaction class method tests', () => {
|
|
|
240
224
|
syncMap.transaction.idMap = { 456: 123 }
|
|
241
225
|
syncMap.transaction.count = 1
|
|
242
226
|
|
|
227
|
+
const expectedMergeUpdatedAt = Math.max(ei.updated_at.getTime(), tx.updated_at.getTime())
|
|
228
|
+
|
|
243
229
|
// Execute `mergeExisting`
|
|
244
|
-
const result = await tx.mergeExisting(
|
|
245
|
-
activeStorage,
|
|
246
|
-
new Date(),
|
|
247
|
-
ei,
|
|
248
|
-
syncMap
|
|
249
|
-
)
|
|
230
|
+
const result = await tx.mergeExisting(activeStorage, new Date(), ei, syncMap)
|
|
250
231
|
|
|
251
232
|
// Validate the result and check that the transaction was updated in the database
|
|
252
233
|
expect(result).toBe(true)
|
|
@@ -257,9 +238,8 @@ describe('Transaction class method tests', () => {
|
|
|
257
238
|
|
|
258
239
|
expect(updatedTx[0]?.txid).toBe('newTxId')
|
|
259
240
|
// Currently expecting current time and date, but should be the updated_at from the incoming entity
|
|
260
|
-
const now = Date.now()
|
|
261
241
|
const updatedAtTime = updatedTx[0]?.updated_at.getTime()
|
|
262
|
-
expect(
|
|
242
|
+
expect(updatedAtTime).toBe(expectedMergeUpdatedAt)
|
|
263
243
|
}
|
|
264
244
|
})
|
|
265
245
|
|
|
@@ -274,11 +254,7 @@ describe('Transaction class method tests', () => {
|
|
|
274
254
|
test('11_getInputs_handles_storage_lookups_and_input_merging', async () => {
|
|
275
255
|
for (const { activeStorage } of ctxs) {
|
|
276
256
|
// Insert a test transaction into the database
|
|
277
|
-
const { tx } = await _tu.insertTestTransaction(
|
|
278
|
-
activeStorage,
|
|
279
|
-
undefined,
|
|
280
|
-
true
|
|
281
|
-
)
|
|
257
|
+
const { tx } = await _tu.insertTestTransaction(activeStorage, undefined, true)
|
|
282
258
|
|
|
283
259
|
// Create a Transaction instance with the inserted transaction's data
|
|
284
260
|
const transaction = new EntityTransaction(tx)
|
|
@@ -377,11 +353,7 @@ describe('Transaction class method tests', () => {
|
|
|
377
353
|
test('18_getInputs_merges_known_inputs_correctly', async () => {
|
|
378
354
|
for (const { activeStorage } of ctxs) {
|
|
379
355
|
// Step 1: Insert a Transaction
|
|
380
|
-
const { tx } = await _tu.insertTestTransaction(
|
|
381
|
-
activeStorage,
|
|
382
|
-
undefined,
|
|
383
|
-
true
|
|
384
|
-
)
|
|
356
|
+
const { tx } = await _tu.insertTestTransaction(activeStorage, undefined, true)
|
|
385
357
|
|
|
386
358
|
// Step 2: Insert outputs associated with the transaction
|
|
387
359
|
const output1 = await _tu.insertTestOutput(activeStorage, tx, 0, 100) // vout = 0
|
|
@@ -455,11 +427,7 @@ describe('Transaction class method tests', () => {
|
|
|
455
427
|
test('25_equals_returns_false_for_mismatched_other_properties', async () => {
|
|
456
428
|
for (const { activeStorage } of ctxs) {
|
|
457
429
|
// Insert a test transaction to use as the baseline
|
|
458
|
-
const txData = await _tu.insertTestTransaction(
|
|
459
|
-
activeStorage,
|
|
460
|
-
undefined,
|
|
461
|
-
true
|
|
462
|
-
)
|
|
430
|
+
const txData = await _tu.insertTestTransaction(activeStorage, undefined, true)
|
|
463
431
|
|
|
464
432
|
const syncMap = createSyncMap()
|
|
465
433
|
syncMap.transaction.idMap = {
|
|
@@ -501,11 +469,7 @@ describe('Transaction class method tests', () => {
|
|
|
501
469
|
test('26_getInputs_handles_known_and_unknown_inputs', async () => {
|
|
502
470
|
for (const { activeStorage } of ctxs) {
|
|
503
471
|
// Step 1: Insert a Transaction into the database
|
|
504
|
-
const { tx } = await _tu.insertTestTransaction(
|
|
505
|
-
activeStorage,
|
|
506
|
-
undefined,
|
|
507
|
-
true
|
|
508
|
-
)
|
|
472
|
+
const { tx } = await _tu.insertTestTransaction(activeStorage, undefined, true)
|
|
509
473
|
|
|
510
474
|
// Step 2: Insert test outputs associated with the transaction
|
|
511
475
|
const output1 = await _tu.insertTestOutput(activeStorage, tx, 0, 100) // vout = 0, satoshis = 100
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { EntityTxLabelMap } from '../../../../../src/storage/schema/entities/TxLabelMap'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
sdk,
|
|
5
|
-
SyncMap,
|
|
6
|
-
TableTxLabelMap
|
|
7
|
-
} from '../../../../../src'
|
|
8
|
-
import {
|
|
9
|
-
TestUtilsWalletStorage as _tu,
|
|
10
|
-
TestWalletNoSetup
|
|
11
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
2
|
+
import { createSyncMap, sdk, SyncMap, TableTxLabelMap } from '../../../../../src'
|
|
3
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
12
4
|
import { EntityTransaction } from '../../../../../src/storage/schema/entities/Transaction'
|
|
13
5
|
import { EntityTxLabel } from '../../../../../src/storage/schema/entities/TxLabel'
|
|
14
6
|
|
|
@@ -143,12 +135,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
143
135
|
txLabelId: 456
|
|
144
136
|
}
|
|
145
137
|
|
|
146
|
-
const result = await EntityTxLabelMap.mergeFind(
|
|
147
|
-
storage,
|
|
148
|
-
1,
|
|
149
|
-
ei as TableTxLabelMap,
|
|
150
|
-
syncMap
|
|
151
|
-
)
|
|
138
|
+
const result = await EntityTxLabelMap.mergeFind(storage, 1, ei as TableTxLabelMap, syncMap)
|
|
152
139
|
expect(result.found).toBe(true)
|
|
153
140
|
expect(result.eo.transactionId).toBe(999)
|
|
154
141
|
expect(result.eo.txLabelId).toBe(888)
|
|
@@ -209,12 +196,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
209
196
|
txLabel: { idMap: { 456: 888 } }
|
|
210
197
|
}
|
|
211
198
|
|
|
212
|
-
const result = await txLabelMap.mergeExisting(
|
|
213
|
-
storage,
|
|
214
|
-
new Date(),
|
|
215
|
-
ei,
|
|
216
|
-
syncMap
|
|
217
|
-
)
|
|
199
|
+
const result = await txLabelMap.mergeExisting(storage, new Date(), ei, syncMap)
|
|
218
200
|
expect(result).toBe(true)
|
|
219
201
|
expect(storage.updateTxLabelMap).toHaveBeenCalledWith(
|
|
220
202
|
123,
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { EntityTxLabel } from '../../../../../src/storage/schema/entities/TxLabel'
|
|
2
2
|
import { createSyncMap, sdk, SyncMap, TableTxLabel } from '../../../../../src'
|
|
3
|
-
import {
|
|
4
|
-
TestUtilsWalletStorage as _tu,
|
|
5
|
-
TestWalletNoSetup
|
|
6
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
3
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
7
4
|
|
|
8
5
|
describe('TxLabel Class Tests', () => {
|
|
9
6
|
jest.setTimeout(99999999) // Extend timeout for database operations
|
|
@@ -116,12 +113,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
116
113
|
updated_at: new Date('2023-01-01')
|
|
117
114
|
}
|
|
118
115
|
|
|
119
|
-
const result = await txLabel.mergeExisting(
|
|
120
|
-
activeStorage,
|
|
121
|
-
undefined,
|
|
122
|
-
olderEi,
|
|
123
|
-
{} as any
|
|
124
|
-
)
|
|
116
|
+
const result = await txLabel.mergeExisting(activeStorage, undefined, olderEi, {} as any)
|
|
125
117
|
|
|
126
118
|
const reloadedTxLabel = await activeStorage.findTxLabelById(txLabel.id)
|
|
127
119
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { stampLog, stampLogFormat } from '../../../../../src/utility/stampLog'
|
|
2
|
-
import {
|
|
3
|
-
TestUtilsWalletStorage as _tu,
|
|
4
|
-
TestWalletNoSetup
|
|
5
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
2
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
6
3
|
|
|
7
4
|
describe('stampLog and stampLogFormat Tests', () => {
|
|
8
5
|
jest.setTimeout(99999999)
|
|
@@ -27,9 +24,7 @@ describe('stampLog and stampLogFormat Tests', () => {
|
|
|
27
24
|
const lineToAdd = 'Event 2'
|
|
28
25
|
const updatedLog = stampLog(initialLog, lineToAdd)
|
|
29
26
|
expect(updatedLog).toContain('Event 2')
|
|
30
|
-
expect(updatedLog).toMatch(
|
|
31
|
-
/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z Event 2\n$/
|
|
32
|
-
)
|
|
27
|
+
expect(updatedLog).toMatch(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z Event 2\n$/)
|
|
33
28
|
}
|
|
34
29
|
})
|
|
35
30
|
|
|
@@ -40,9 +35,7 @@ describe('stampLog and stampLogFormat Tests', () => {
|
|
|
40
35
|
const lineToAdd = 'Event 2'
|
|
41
36
|
const updatedLog = stampLog(initialLog, lineToAdd)
|
|
42
37
|
expect(updatedLog).toContain('Event 2')
|
|
43
|
-
expect(updatedLog).toMatch(
|
|
44
|
-
/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z Event 2\n$/
|
|
45
|
-
)
|
|
38
|
+
expect(updatedLog).toMatch(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z Event 2\n$/)
|
|
46
39
|
}
|
|
47
40
|
})
|
|
48
41
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { EntityUser } from '../../../../../src/storage/schema/entities/User'
|
|
2
2
|
import { createSyncMap, sdk, SyncMap, TableUser } from '../../../../../src'
|
|
3
|
-
import {
|
|
4
|
-
TestUtilsWalletStorage as _tu,
|
|
5
|
-
TestWalletNoSetup
|
|
6
|
-
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
3
|
+
import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
7
4
|
describe('User class method tests', () => {
|
|
8
5
|
jest.setTimeout(99999999) // Extend timeout for database operations
|
|
9
6
|
|
|
@@ -336,8 +333,8 @@ describe('User class method tests', () => {
|
|
|
336
333
|
const trx = undefined // Optional transaction token, set as undefined.
|
|
337
334
|
|
|
338
335
|
// The method should throw an error when called
|
|
339
|
-
await expect(
|
|
340
|
-
|
|
341
|
-
)
|
|
336
|
+
await expect(user.mergeNew(storage as any, userId, syncMap as any, trx)).rejects.toThrowError(
|
|
337
|
+
'a sync chunk merge must never create a new user'
|
|
338
|
+
)
|
|
342
339
|
})
|
|
343
340
|
})
|