@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
|
@@ -21,9 +21,7 @@ const logFilePath = path.resolve(__dirname, 'createAction2.test.ts')
|
|
|
21
21
|
|
|
22
22
|
function sanitizeTestName(testName: string): string {
|
|
23
23
|
const cleanTestName = testName.replace(/[^a-zA-Z0-9_]/g, '_')
|
|
24
|
-
return cleanTestName.startsWith('LOG_')
|
|
25
|
-
? cleanTestName
|
|
26
|
-
: `LOG_${cleanTestName}`
|
|
24
|
+
return cleanTestName.startsWith('LOG_') ? cleanTestName : `LOG_${cleanTestName}`
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
describe('createAction2 nosend transactions', () => {
|
|
@@ -68,8 +66,7 @@ describe('createAction2 nosend transactions', () => {
|
|
|
68
66
|
description: 'Funding transaction',
|
|
69
67
|
options: { noSend: true, randomizeOutputs: false }
|
|
70
68
|
}
|
|
71
|
-
const fundingResult: CreateActionResult =
|
|
72
|
-
await wallet.createAction(fundingArgs)
|
|
69
|
+
const fundingResult: CreateActionResult = await wallet.createAction(fundingArgs)
|
|
73
70
|
expect(fundingResult.tx).toBeDefined()
|
|
74
71
|
const actionsResult = await wallet.listActions({
|
|
75
72
|
labels: [fundingLabel],
|
|
@@ -121,8 +118,7 @@ describe('createAction2 nosend transactions', () => {
|
|
|
121
118
|
description: 'Funding transaction with multiple outputs',
|
|
122
119
|
options: { noSend: true, randomizeOutputs: false }
|
|
123
120
|
}
|
|
124
|
-
const fundingResult: CreateActionResult =
|
|
125
|
-
await wallet.createAction(fundingArgs)
|
|
121
|
+
const fundingResult: CreateActionResult = await wallet.createAction(fundingArgs)
|
|
126
122
|
const actionsResult = await wallet.listActions({
|
|
127
123
|
labels: [fundingLabel],
|
|
128
124
|
includeInputs: true,
|
|
@@ -164,14 +160,11 @@ describe('createAction2 nosend transactions', () => {
|
|
|
164
160
|
description: 'Funding transaction',
|
|
165
161
|
options: { noSend: true, randomizeOutputs: false }
|
|
166
162
|
}
|
|
167
|
-
const fundingResult: CreateActionResult =
|
|
168
|
-
await wallet.createAction(fundingArgs)
|
|
163
|
+
const fundingResult: CreateActionResult = await wallet.createAction(fundingArgs)
|
|
169
164
|
expect(fundingResult.tx).toBeDefined()
|
|
170
165
|
expect(fundingResult.noSendChange).toBeDefined()
|
|
171
166
|
expect(fundingResult.noSendChange!.length).toBe(1)
|
|
172
|
-
log(
|
|
173
|
-
`noSendChange returned:${JSON.stringify(fundingResult.noSendChange, null, 2)}`
|
|
174
|
-
)
|
|
167
|
+
log(`noSendChange returned:${JSON.stringify(fundingResult.noSendChange, null, 2)}`)
|
|
175
168
|
const outputSatoshis = 2
|
|
176
169
|
const estimatedFee = 1
|
|
177
170
|
const fundingBeef = Beef.fromBinary(fundingResult.tx!)
|
|
@@ -200,12 +193,9 @@ describe('createAction2 nosend transactions', () => {
|
|
|
200
193
|
noSendChange: []
|
|
201
194
|
}
|
|
202
195
|
}
|
|
203
|
-
const spendingResult: CreateActionResult =
|
|
204
|
-
await wallet.createAction(spendingArgs)
|
|
196
|
+
const spendingResult: CreateActionResult = await wallet.createAction(spendingArgs)
|
|
205
197
|
expect(spendingResult.tx).toBeDefined()
|
|
206
|
-
log(
|
|
207
|
-
`Spending transaction created:${JSON.stringify(spendingResult, null, 2)}`
|
|
208
|
-
)
|
|
198
|
+
log(`Spending transaction created:${JSON.stringify(spendingResult, null, 2)}`)
|
|
209
199
|
const spendingActionsResult = await wallet.listActions({
|
|
210
200
|
labels: ['spending transaction test'],
|
|
211
201
|
includeInputs: true,
|
|
@@ -215,11 +205,10 @@ describe('createAction2 nosend transactions', () => {
|
|
|
215
205
|
includeOutputLockingScripts: true,
|
|
216
206
|
includeLabels: true
|
|
217
207
|
})
|
|
218
|
-
const totalInputSatoshis =
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
)
|
|
208
|
+
const totalInputSatoshis = spendingActionsResult.actions[0]?.inputs?.reduce(
|
|
209
|
+
(sum, input) => sum + input.sourceSatoshis,
|
|
210
|
+
0
|
|
211
|
+
)
|
|
223
212
|
const expectedChange = totalInputSatoshis! - outputSatoshis - estimatedFee
|
|
224
213
|
const outputs = spendingActionsResult.actions[0]?.outputs || []
|
|
225
214
|
const changeOutput = outputs.find(output => output.basket === 'default')
|
|
@@ -258,8 +247,7 @@ describe('createAction2 nosend transactions', () => {
|
|
|
258
247
|
description: 'Funding transaction',
|
|
259
248
|
options: { noSend: true, randomizeOutputs: false }
|
|
260
249
|
}
|
|
261
|
-
const fundingResult: CreateActionResult =
|
|
262
|
-
await wallet.createAction(fundingArgs)
|
|
250
|
+
const fundingResult: CreateActionResult = await wallet.createAction(fundingArgs)
|
|
263
251
|
expect(fundingResult.tx).toBeDefined()
|
|
264
252
|
const spendingArgs: CreateActionArgs = {
|
|
265
253
|
description: 'Check knownTxids and returnTXIDOnly',
|
|
@@ -278,11 +266,8 @@ describe('createAction2 nosend transactions', () => {
|
|
|
278
266
|
randomizeOutputs: false
|
|
279
267
|
}
|
|
280
268
|
}
|
|
281
|
-
const spendingResult: CreateActionResult =
|
|
282
|
-
|
|
283
|
-
expect(spendingArgs.options!.knownTxids).toEqual(
|
|
284
|
-
expect.arrayContaining(['tx123', 'tx456'])
|
|
285
|
-
)
|
|
269
|
+
const spendingResult: CreateActionResult = await wallet.createAction(spendingArgs)
|
|
270
|
+
expect(spendingArgs.options!.knownTxids).toEqual(expect.arrayContaining(['tx123', 'tx456']))
|
|
286
271
|
const spendingActionsResult = await wallet.listActions({
|
|
287
272
|
labels: ['custom options test'],
|
|
288
273
|
includeInputs: true,
|
|
@@ -322,8 +307,7 @@ describe('createAction2 nosend transactions', () => {
|
|
|
322
307
|
description: 'Funding transaction',
|
|
323
308
|
options: { noSend: true }
|
|
324
309
|
}
|
|
325
|
-
const fundingResult: CreateActionResult =
|
|
326
|
-
await wallet.createAction(fundingArgs)
|
|
310
|
+
const fundingResult: CreateActionResult = await wallet.createAction(fundingArgs)
|
|
327
311
|
expect(fundingResult.tx).toBeDefined()
|
|
328
312
|
const spendingArgs: CreateActionArgs = {
|
|
329
313
|
description: 'Check knownTxids and returnTXIDOnly',
|
|
@@ -341,12 +325,9 @@ describe('createAction2 nosend transactions', () => {
|
|
|
341
325
|
noSend: true
|
|
342
326
|
}
|
|
343
327
|
}
|
|
344
|
-
const spendingResult: CreateActionResult =
|
|
345
|
-
await wallet.createAction(spendingArgs)
|
|
328
|
+
const spendingResult: CreateActionResult = await wallet.createAction(spendingArgs)
|
|
346
329
|
expect(spendingResult.tx).not.toBeDefined()
|
|
347
|
-
expect(spendingArgs.options!.knownTxids).toEqual(
|
|
348
|
-
expect.arrayContaining(['tx123', 'tx456'])
|
|
349
|
-
)
|
|
330
|
+
expect(spendingArgs.options!.knownTxids).toEqual(expect.arrayContaining(['tx123', 'tx456']))
|
|
350
331
|
}
|
|
351
332
|
})
|
|
352
333
|
|
|
@@ -365,8 +346,7 @@ describe('createAction2 nosend transactions', () => {
|
|
|
365
346
|
description: 'Funding transaction',
|
|
366
347
|
options: { noSend: true }
|
|
367
348
|
}
|
|
368
|
-
const fundingResult: CreateActionResult =
|
|
369
|
-
await wallet.createAction(fundingArgs)
|
|
349
|
+
const fundingResult: CreateActionResult = await wallet.createAction(fundingArgs)
|
|
370
350
|
expect(fundingResult.tx).toBeDefined()
|
|
371
351
|
const spendingArgs: CreateActionArgs = {
|
|
372
352
|
description: 'Check knownTxids txids',
|
|
@@ -384,19 +364,14 @@ describe('createAction2 nosend transactions', () => {
|
|
|
384
364
|
noSend: true
|
|
385
365
|
}
|
|
386
366
|
}
|
|
387
|
-
const spendingResult: CreateActionResult =
|
|
388
|
-
await wallet.createAction(spendingArgs)
|
|
367
|
+
const spendingResult: CreateActionResult = await wallet.createAction(spendingArgs)
|
|
389
368
|
expect(spendingResult).toBeDefined()
|
|
390
|
-
expect(spendingArgs.options!.knownTxids).toEqual(
|
|
391
|
-
expect.arrayContaining(['tx123', 'tx456'])
|
|
392
|
-
)
|
|
369
|
+
expect(spendingArgs.options!.knownTxids).toEqual(expect.arrayContaining(['tx123', 'tx456']))
|
|
393
370
|
const fundingBeef = Beef.fromBinary(fundingResult.tx!)
|
|
394
371
|
expect(fundingBeef).toBeDefined()
|
|
395
372
|
const BeefPartyTxids = fundingBeef.txs.map(tx => tx.txid)
|
|
396
373
|
const expectedTxids = ['tx123', 'tx456', ...BeefPartyTxids]
|
|
397
|
-
expect(spendingArgs.options!.knownTxids?.sort()).toEqual(
|
|
398
|
-
expectedTxids.sort()
|
|
399
|
-
)
|
|
374
|
+
expect(spendingArgs.options!.knownTxids?.sort()).toEqual(expectedTxids.sort())
|
|
400
375
|
}
|
|
401
376
|
})
|
|
402
377
|
|
|
@@ -415,8 +390,7 @@ describe('createAction2 nosend transactions', () => {
|
|
|
415
390
|
description: 'Funding transaction',
|
|
416
391
|
options: { noSend: true }
|
|
417
392
|
}
|
|
418
|
-
const fundingResult: CreateActionResult =
|
|
419
|
-
await wallet.createAction(fundingArgs)
|
|
393
|
+
const fundingResult: CreateActionResult = await wallet.createAction(fundingArgs)
|
|
420
394
|
expect(fundingResult.tx).toBeDefined()
|
|
421
395
|
const spendingArgs: CreateActionArgs = {
|
|
422
396
|
description: 'Check knownTxids txids extra',
|
|
@@ -433,19 +407,14 @@ describe('createAction2 nosend transactions', () => {
|
|
|
433
407
|
noSend: true
|
|
434
408
|
}
|
|
435
409
|
}
|
|
436
|
-
const spendingResult: CreateActionResult =
|
|
437
|
-
await wallet.createAction(spendingArgs)
|
|
410
|
+
const spendingResult: CreateActionResult = await wallet.createAction(spendingArgs)
|
|
438
411
|
expect(spendingResult).toBeDefined()
|
|
439
|
-
expect(spendingArgs.options!.knownTxids).toEqual(
|
|
440
|
-
expect.arrayContaining(['tx123', 'tx456'])
|
|
441
|
-
)
|
|
412
|
+
expect(spendingArgs.options!.knownTxids).toEqual(expect.arrayContaining(['tx123', 'tx456']))
|
|
442
413
|
const fundingBeef = Beef.fromBinary(fundingResult.tx!)
|
|
443
414
|
expect(fundingBeef).toBeDefined()
|
|
444
415
|
const partyBeefTxids = fundingBeef.txs.map(tx => tx.txid)
|
|
445
416
|
const expectedTxids = ['tx123', 'tx456', ...partyBeefTxids]
|
|
446
|
-
expect(spendingArgs.options!.knownTxids?.sort()).toEqual(
|
|
447
|
-
expectedTxids.sort()
|
|
448
|
-
)
|
|
417
|
+
expect(spendingArgs.options!.knownTxids?.sort()).toEqual(expectedTxids.sort())
|
|
449
418
|
const additionalSpendArgs: CreateActionArgs = {
|
|
450
419
|
description: 'Extra spend transaction',
|
|
451
420
|
outputs: [
|
|
@@ -462,16 +431,13 @@ describe('createAction2 nosend transactions', () => {
|
|
|
462
431
|
noSend: true
|
|
463
432
|
}
|
|
464
433
|
}
|
|
465
|
-
const additionalSpendResult: CreateActionResult =
|
|
466
|
-
await wallet.createAction(additionalSpendArgs)
|
|
434
|
+
const additionalSpendResult: CreateActionResult = await wallet.createAction(additionalSpendArgs)
|
|
467
435
|
expect(additionalSpendResult).toBeDefined()
|
|
468
436
|
const finalBeef = Beef.fromBinary(spendingResult.tx!)
|
|
469
437
|
expect(finalBeef).toBeDefined()
|
|
470
438
|
const finalPartyBeefTxids = finalBeef.txs.map(tx => tx.txid)
|
|
471
439
|
const finalExpectedTxids = [...expectedTxids, ...finalPartyBeefTxids]
|
|
472
|
-
expect(additionalSpendArgs.options!.knownTxids?.sort()).toEqual(
|
|
473
|
-
finalExpectedTxids.sort()
|
|
474
|
-
)
|
|
440
|
+
expect(additionalSpendArgs.options!.knownTxids?.sort()).toEqual(finalExpectedTxids.sort())
|
|
475
441
|
}
|
|
476
442
|
})
|
|
477
443
|
|
|
@@ -635,10 +601,7 @@ describe('createAction2 nosend transactions', () => {
|
|
|
635
601
|
|
|
636
602
|
// Helper functions
|
|
637
603
|
|
|
638
|
-
function getExpectedLog(
|
|
639
|
-
testName: string,
|
|
640
|
-
logFilePath: string
|
|
641
|
-
): { log: string; logColor: string } | null {
|
|
604
|
+
function getExpectedLog(testName: string, logFilePath: string): { log: string; logColor: string } | null {
|
|
642
605
|
if (!fs.existsSync(logFilePath)) {
|
|
643
606
|
return null
|
|
644
607
|
}
|
|
@@ -662,10 +625,7 @@ function getExpectedLog(
|
|
|
662
625
|
const normalizeVariableParts = (log: string): string => {
|
|
663
626
|
return log
|
|
664
627
|
.replace(/txid:[a-f0-9]{64}/g, 'txid:PLACEHOLDER') // Replace txids
|
|
665
|
-
.replace(
|
|
666
|
-
/unlock:\(\d+\)(?:483045022100[a-f0-9]{64}0220|[a-f0-9]+)/g,
|
|
667
|
-
'unlock:PLACEHOLDER'
|
|
668
|
-
)
|
|
628
|
+
.replace(/unlock:\(\d+\)(?:483045022100[a-f0-9]{64}0220|[a-f0-9]+)/g, 'unlock:PLACEHOLDER')
|
|
669
629
|
.replace(/lock:\(\d+\)76a914[a-f0-9]{40}/g, 'lock:PLACEHOLDER') // Replace locking script
|
|
670
630
|
.replace(/index:\d+ spendable:/g, 'index:PLACEHOLDER spendable:') // Normalize index
|
|
671
631
|
.trim()
|
|
@@ -676,10 +636,7 @@ const normalizeVariableParts = (log: string): string => {
|
|
|
676
636
|
* @param {string} testName - The name of the test.
|
|
677
637
|
* @param {{ log: string; logColor: string }} rl - The log data.
|
|
678
638
|
*/
|
|
679
|
-
function appendLogsAsConst(
|
|
680
|
-
testName: string,
|
|
681
|
-
rl: { log: string; logColor: string }
|
|
682
|
-
) {
|
|
639
|
+
function appendLogsAsConst(testName: string, rl: { log: string; logColor: string }) {
|
|
683
640
|
const normalizedTestName = testName
|
|
684
641
|
.replace(/[^a-zA-Z0-9_ ]/g, '')
|
|
685
642
|
.trim()
|
|
@@ -710,9 +667,7 @@ const ${sanitizedTestName} = {
|
|
|
710
667
|
* @returns {string} - The formatted field string.
|
|
711
668
|
*/
|
|
712
669
|
const formatOptionalField = (fieldName: string, value: any) =>
|
|
713
|
-
value !== undefined && value !== null && value !== ''
|
|
714
|
-
? ` ${fieldName}:${value}`
|
|
715
|
-
: ''
|
|
670
|
+
value !== undefined && value !== null && value !== '' ? ` ${fieldName}:${value}` : ''
|
|
716
671
|
|
|
717
672
|
/**
|
|
718
673
|
* Formats an optional field with quotes if it has a defined value.
|
|
@@ -721,9 +676,7 @@ const formatOptionalField = (fieldName: string, value: any) =>
|
|
|
721
676
|
* @returns {string} - The formatted field string with quotes.
|
|
722
677
|
*/
|
|
723
678
|
const formatOptionalFieldWithQuotes = (fieldName: string, value: any) =>
|
|
724
|
-
value !== undefined && value !== null && value !== ''
|
|
725
|
-
? ` ${fieldName}:'${value}'`
|
|
726
|
-
: ''
|
|
679
|
+
value !== undefined && value !== null && value !== '' ? ` ${fieldName}:'${value}'` : ''
|
|
727
680
|
|
|
728
681
|
/**
|
|
729
682
|
* Formats an optional field with color if it has a defined value.
|
|
@@ -732,11 +685,7 @@ const formatOptionalFieldWithQuotes = (fieldName: string, value: any) =>
|
|
|
732
685
|
* @param {(val: string) => string} colorFunc - The function to apply color formatting.
|
|
733
686
|
* @returns {string} - The formatted field string with color.
|
|
734
687
|
*/
|
|
735
|
-
const formatOptionalFieldWithColor = (
|
|
736
|
-
fieldName: string,
|
|
737
|
-
value: any,
|
|
738
|
-
colorFunc: (val: string) => string
|
|
739
|
-
) =>
|
|
688
|
+
const formatOptionalFieldWithColor = (fieldName: string, value: any, colorFunc: (val: string) => string) =>
|
|
740
689
|
value !== undefined && value !== null && value !== ''
|
|
741
690
|
? ` ${chalk.gray(fieldName + ':')}${colorFunc(typeof value === 'string' ? value : String(value))}`
|
|
742
691
|
: ''
|
|
@@ -747,17 +696,14 @@ const formatOptionalFieldWithColor = (
|
|
|
747
696
|
* @returns {string} - The formatted metadata string.
|
|
748
697
|
*/
|
|
749
698
|
const formatMetadata = (metadata?: any) =>
|
|
750
|
-
metadata && !isEmptyObject(metadata)
|
|
751
|
-
? `metadata:${JSON.stringify(metadata)}`
|
|
752
|
-
: ''
|
|
699
|
+
metadata && !isEmptyObject(metadata) ? `metadata:${JSON.stringify(metadata)}` : ''
|
|
753
700
|
|
|
754
701
|
/**
|
|
755
702
|
* Formats the Merkle path if present.
|
|
756
703
|
* @param {MerklePath | string} [merklePath] - The Merkle path.
|
|
757
704
|
* @returns {string} - The formatted Merkle path string.
|
|
758
705
|
*/
|
|
759
|
-
const formatMerklePath = (merklePath?: MerklePath | string) =>
|
|
760
|
-
merklePath ? `merklePath:${String(merklePath)}` : ''
|
|
706
|
+
const formatMerklePath = (merklePath?: MerklePath | string) => (merklePath ? `merklePath:${String(merklePath)}` : '')
|
|
761
707
|
|
|
762
708
|
const MAX_LOG_LINE_LENGTH = 120 // Define in the test
|
|
763
709
|
|
|
@@ -768,11 +714,7 @@ const MAX_LOG_LINE_LENGTH = 120 // Define in the test
|
|
|
768
714
|
* @param {number} [maxLength=120] - The maximum length of a line.
|
|
769
715
|
* @returns {string} - The wrapped log line.
|
|
770
716
|
*/
|
|
771
|
-
const wrapLogLine = (
|
|
772
|
-
text: string,
|
|
773
|
-
indent: number,
|
|
774
|
-
maxLength: number = 120
|
|
775
|
-
): string => {
|
|
717
|
+
const wrapLogLine = (text: string, indent: number, maxLength: number = 120): string => {
|
|
776
718
|
const words = text.trim().split(' ')
|
|
777
719
|
let wrappedText = ' '.repeat(indent)
|
|
778
720
|
let currentLineLength = indent * 2
|
|
@@ -796,11 +738,8 @@ const wrapLogLine = (
|
|
|
796
738
|
* @param {string} content - The content of the line.
|
|
797
739
|
* @returns {string} - The formatted indented line.
|
|
798
740
|
*/
|
|
799
|
-
const formatIndentedLineWithWrap = (
|
|
800
|
-
indent
|
|
801
|
-
content: string,
|
|
802
|
-
maxLength: number = 120
|
|
803
|
-
) => wrapLogLine(content.trim(), indent, maxLength)
|
|
741
|
+
const formatIndentedLineWithWrap = (indent: number, content: string, maxLength: number = 120) =>
|
|
742
|
+
wrapLogLine(content.trim(), indent, maxLength)
|
|
804
743
|
|
|
805
744
|
/**
|
|
806
745
|
* Formats a list of wallet action inputs for logging.
|
|
@@ -816,11 +755,7 @@ const formatInputs = (inputs: WalletActionInput[]) =>
|
|
|
816
755
|
let color = `${chalk.gray(`${i}:`)} ${chalk.blue(input.sourceOutpoint)} ${chalk.green(`${input.sourceSatoshis} sats`)}`
|
|
817
756
|
|
|
818
757
|
line += formatOptionalFieldWithQuotes('desc', input.inputDescription)
|
|
819
|
-
color += formatOptionalFieldWithColor(
|
|
820
|
-
'desc',
|
|
821
|
-
input.inputDescription,
|
|
822
|
-
chalk.white
|
|
823
|
-
)
|
|
758
|
+
color += formatOptionalFieldWithColor('desc', input.inputDescription, chalk.white)
|
|
824
759
|
|
|
825
760
|
if (input.sourceLockingScript) {
|
|
826
761
|
line += ` lock:(${input.sourceLockingScript.length})${truncate(input.sourceLockingScript)}`
|
|
@@ -861,45 +796,19 @@ const formatOutputs = (outputs: WalletActionOutput[]) =>
|
|
|
861
796
|
let color = `${chalk.gray(`${i}:`)} ${chalk.green(`${output.satoshis} sats`)} ${chalk.gray('lock:')}(${output.lockingScript?.length || ''})${chalk.cyan(truncate(output.lockingScript!) ?? 'N/A')}`
|
|
862
797
|
|
|
863
798
|
line += formatOptionalField('index', output.outputIndex)
|
|
864
|
-
color += formatOptionalFieldWithColor(
|
|
865
|
-
'index',
|
|
866
|
-
output.outputIndex,
|
|
867
|
-
chalk.white
|
|
868
|
-
)
|
|
799
|
+
color += formatOptionalFieldWithColor('index', output.outputIndex, chalk.white)
|
|
869
800
|
|
|
870
801
|
line += formatOptionalField('spendable', output.spendable)
|
|
871
|
-
color += formatOptionalFieldWithColor(
|
|
872
|
-
'spendable',
|
|
873
|
-
output.spendable,
|
|
874
|
-
chalk.white
|
|
875
|
-
)
|
|
802
|
+
color += formatOptionalFieldWithColor('spendable', output.spendable, chalk.white)
|
|
876
803
|
|
|
877
|
-
line += formatOptionalFieldWithQuotes(
|
|
878
|
-
|
|
879
|
-
output.customInstructions
|
|
880
|
-
)
|
|
881
|
-
color += formatOptionalFieldWithColor(
|
|
882
|
-
'custinst',
|
|
883
|
-
output.customInstructions,
|
|
884
|
-
chalk.white
|
|
885
|
-
)
|
|
804
|
+
line += formatOptionalFieldWithQuotes('custinst', output.customInstructions)
|
|
805
|
+
color += formatOptionalFieldWithColor('custinst', output.customInstructions, chalk.white)
|
|
886
806
|
|
|
887
807
|
line += formatOptionalFieldWithQuotes('basket', output.basket)
|
|
888
|
-
color += formatOptionalFieldWithColor(
|
|
889
|
-
'basket',
|
|
890
|
-
output.basket,
|
|
891
|
-
chalk.white
|
|
892
|
-
)
|
|
808
|
+
color += formatOptionalFieldWithColor('basket', output.basket, chalk.white)
|
|
893
809
|
|
|
894
|
-
line += formatOptionalFieldWithQuotes(
|
|
895
|
-
|
|
896
|
-
output.outputDescription
|
|
897
|
-
)
|
|
898
|
-
color += formatOptionalFieldWithColor(
|
|
899
|
-
'desc',
|
|
900
|
-
output.outputDescription,
|
|
901
|
-
chalk.white
|
|
902
|
-
)
|
|
810
|
+
line += formatOptionalFieldWithQuotes('desc', output.outputDescription)
|
|
811
|
+
color += formatOptionalFieldWithColor('desc', output.outputDescription, chalk.white)
|
|
903
812
|
|
|
904
813
|
if (output.tags?.length) {
|
|
905
814
|
const tagsString = `[${output.tags.map(tag => `'${truncate(tag)}'`).join(',')}]`
|
|
@@ -925,9 +834,7 @@ const formatOutputs = (outputs: WalletActionOutput[]) =>
|
|
|
925
834
|
* @returns {string} - A formatted string of labels enclosed in brackets.
|
|
926
835
|
*/
|
|
927
836
|
const formatLabels = (labels?: string[]) =>
|
|
928
|
-
labels && labels.length > 0
|
|
929
|
-
? `[${labels.map(label => `'${truncate(label)}'`).join(',')}]`
|
|
930
|
-
: ''
|
|
837
|
+
labels && labels.length > 0 ? `[${labels.map(label => `'${truncate(label)}'`).join(',')}]` : ''
|
|
931
838
|
|
|
932
839
|
/**
|
|
933
840
|
* Generates a formatted log string from an AtomicBEEF object.
|
|
@@ -972,11 +879,7 @@ export function toLogString(
|
|
|
972
879
|
` ${chalk.gray('lockTime:')}${mainTx.lockTime}`,
|
|
973
880
|
` ${chalk.green(`${action?.satoshis} sats`)}`,
|
|
974
881
|
formatOptionalFieldWithColor('status', action?.status, chalk.white),
|
|
975
|
-
formatOptionalFieldWithColor(
|
|
976
|
-
'outgoing',
|
|
977
|
-
action?.isOutgoing,
|
|
978
|
-
chalk.white
|
|
979
|
-
),
|
|
882
|
+
formatOptionalFieldWithColor('outgoing', action?.isOutgoing, chalk.white),
|
|
980
883
|
formatOptionalFieldWithColor('desc', action?.description, chalk.white),
|
|
981
884
|
metadataString ? chalk.gray(metadataString) : '',
|
|
982
885
|
merklePathString ? chalk.gray(merklePathString) : '',
|
|
@@ -989,9 +892,7 @@ export function toLogString(
|
|
|
989
892
|
log += `\n${formatIndentedLine(1, `inputs: ${action?.inputs?.length ?? 0}`)}`
|
|
990
893
|
logColor += `\n${formatIndentedLine(1, chalk.gray(`inputs: ${action?.inputs?.length ?? 0}`))}`
|
|
991
894
|
|
|
992
|
-
const sortedInputs = (action?.inputs ?? []).sort((a, b) =>
|
|
993
|
-
a.sourceOutpoint.localeCompare(b.sourceOutpoint)
|
|
994
|
-
)
|
|
895
|
+
const sortedInputs = (action?.inputs ?? []).sort((a, b) => a.sourceOutpoint.localeCompare(b.sourceOutpoint))
|
|
995
896
|
const formattedInputs = formatInputs(sortedInputs)
|
|
996
897
|
formattedInputs.forEach(({ log: inputLog, logColor: inputLogColor }) => {
|
|
997
898
|
log += `\n${formatIndentedLine(2, inputLog)}`
|
|
@@ -1001,9 +902,7 @@ export function toLogString(
|
|
|
1001
902
|
log += `\n${formatIndentedLineWithWrap(1, `outputs: ${action?.outputs?.length ?? 0}`)}`
|
|
1002
903
|
logColor += `\n${formatIndentedLineWithWrap(1, chalk.gray(`outputs: ${action?.outputs?.length ?? 0}`))}`
|
|
1003
904
|
|
|
1004
|
-
const sortedOutputs = action?.outputs
|
|
1005
|
-
?.slice()
|
|
1006
|
-
.sort((a, b) => a.satoshis - b.satoshis)
|
|
905
|
+
const sortedOutputs = action?.outputs?.slice().sort((a, b) => a.satoshis - b.satoshis)
|
|
1007
906
|
const formattedOutputs = formatOutputs(sortedOutputs!)
|
|
1008
907
|
formattedOutputs.forEach(({ log: outputLog, logColor: outputLogColor }) => {
|
|
1009
908
|
log += `\n${formatIndentedLine(2, outputLog)}`
|
|
@@ -1014,9 +913,7 @@ export function toLogString(
|
|
|
1014
913
|
} catch (error) {
|
|
1015
914
|
return {
|
|
1016
915
|
log: `Error parsing transaction: ${(error as Error).message}`,
|
|
1017
|
-
logColor: chalk.red(
|
|
1018
|
-
`Error parsing transaction: ${(error as Error).message}`
|
|
1019
|
-
)
|
|
916
|
+
logColor: chalk.red(`Error parsing transaction: ${(error as Error).message}`)
|
|
1020
917
|
}
|
|
1021
918
|
}
|
|
1022
919
|
}
|
|
@@ -1032,12 +929,7 @@ export function createActionResultToTxLogString(
|
|
|
1032
929
|
beef.version = BEEF_V1
|
|
1033
930
|
const mainTxid = beef.txs.slice(-1)[0].txid
|
|
1034
931
|
|
|
1035
|
-
return txToLogString(
|
|
1036
|
-
beef.findAtomicTransaction(mainTxid)!,
|
|
1037
|
-
0,
|
|
1038
|
-
showKey,
|
|
1039
|
-
actionsResult
|
|
1040
|
-
)
|
|
932
|
+
return txToLogString(beef.findAtomicTransaction(mainTxid)!, 0, showKey, actionsResult)
|
|
1041
933
|
}
|
|
1042
934
|
|
|
1043
935
|
const MAX_RECURSION_DEPTH = 3
|
|
@@ -1119,16 +1011,9 @@ const formatTxInputs = (inputs: TransactionInput[], indent: number) =>
|
|
|
1119
1011
|
}
|
|
1120
1012
|
|
|
1121
1013
|
if (input.sourceTransaction) {
|
|
1122
|
-
const { log: sourceTxLog, logColor: sourceTxLogColor } =
|
|
1123
|
-
|
|
1124
|
-
const
|
|
1125
|
-
/\s+Transaction/,
|
|
1126
|
-
'Transaction'
|
|
1127
|
-
)
|
|
1128
|
-
const sourceTxLogColorTrimed = sourceTxLogColor.replace(
|
|
1129
|
-
/\s+Transaction/,
|
|
1130
|
-
'Transaction'
|
|
1131
|
-
)
|
|
1014
|
+
const { log: sourceTxLog, logColor: sourceTxLogColor } = txToLogString(input.sourceTransaction, indent + 6)
|
|
1015
|
+
const sourceTxLogTrimed = sourceTxLog.replace(/\s+Transaction/, 'Transaction')
|
|
1016
|
+
const sourceTxLogColorTrimed = sourceTxLogColor.replace(/\s+Transaction/, 'Transaction')
|
|
1132
1017
|
line += `\n${formatIndentedLine(indent + 6, `sourceTx:`)}${sourceTxLogTrimed}`
|
|
1133
1018
|
color += `\n${formatIndentedLine(indent + 6, `${chalk.gray('sourceTx:')}`)}${sourceTxLogColorTrimed}`
|
|
1134
1019
|
} else {
|
|
@@ -1164,23 +1049,15 @@ export function txToLogString(
|
|
|
1164
1049
|
if (indent / 2 >= MAX_RECURSION_DEPTH) {
|
|
1165
1050
|
return {
|
|
1166
1051
|
log: formatIndentedLine(indent + 4, 'Transaction [Max Depth Reached]'),
|
|
1167
|
-
logColor: chalk.gray(
|
|
1168
|
-
formatIndentedLine(indent + 4, 'Transaction [Max Depth Reached]')
|
|
1169
|
-
)
|
|
1052
|
+
logColor: chalk.gray(formatIndentedLine(indent + 4, 'Transaction [Max Depth Reached]'))
|
|
1170
1053
|
}
|
|
1171
1054
|
}
|
|
1172
1055
|
const beef = Beef.fromBinary(tx.toBEEF())
|
|
1173
1056
|
const mainTxid = beef.txs.slice(-1)[0].txid
|
|
1174
1057
|
const metadataString = formatMetadata(tx.metadata)
|
|
1175
1058
|
const merklePathString = formatMerklePath(tx.merklePath)
|
|
1176
|
-
let log = formatIndentedLine(
|
|
1177
|
-
|
|
1178
|
-
`Transaction:${truncateTxid(mainTxid)}`
|
|
1179
|
-
)
|
|
1180
|
-
let logColor = formatIndentedLine(
|
|
1181
|
-
indent,
|
|
1182
|
-
`${chalk.gray('Transaction:')}${chalk.blue(truncateTxid(mainTxid))}`
|
|
1183
|
-
)
|
|
1059
|
+
let log = formatIndentedLine(indent, `Transaction:${truncateTxid(mainTxid)}`)
|
|
1060
|
+
let logColor = formatIndentedLine(indent, `${chalk.gray('Transaction:')}${chalk.blue(truncateTxid(mainTxid))}`)
|
|
1184
1061
|
|
|
1185
1062
|
if (showKey) {
|
|
1186
1063
|
logColor += ` ${chalk.gray(`key:`)} (${chalk.blue('txid/outpoint')} ${chalk.cyan('script')} ${chalk.green('sats')})`
|
|
@@ -1197,9 +1074,7 @@ export function txToLogString(
|
|
|
1197
1074
|
log += `\n${formatIndentedLine(indent + 2, `inputs: ${tx?.inputs?.length ?? 0}`)}`
|
|
1198
1075
|
logColor += `\n${formatIndentedLine(indent + 2, chalk.gray(`inputs: ${tx?.inputs?.length ?? 0}`))}`
|
|
1199
1076
|
|
|
1200
|
-
const sortedInputs = (tx?.inputs ?? []).sort((a, b) =>
|
|
1201
|
-
a.sourceTXID!.localeCompare(b.sourceTXID!)
|
|
1202
|
-
)
|
|
1077
|
+
const sortedInputs = (tx?.inputs ?? []).sort((a, b) => a.sourceTXID!.localeCompare(b.sourceTXID!))
|
|
1203
1078
|
const formattedInputs = formatTxInputs(sortedInputs, indent)
|
|
1204
1079
|
formattedInputs.forEach(({ log: inputLog, logColor: inputLogColor }) => {
|
|
1205
1080
|
log += `\n${inputLog}`
|
|
@@ -1209,24 +1084,18 @@ export function txToLogString(
|
|
|
1209
1084
|
log += `\n${formatIndentedLine(indent + 2, `outputs: ${tx?.outputs?.length ?? 0}`)}`
|
|
1210
1085
|
logColor += `\n${formatIndentedLine(indent + 2, chalk.gray(`outputs: ${tx?.outputs?.length ?? 0}`))}`
|
|
1211
1086
|
|
|
1212
|
-
const sortedOutputs = tx?.outputs
|
|
1213
|
-
?.slice()
|
|
1214
|
-
.sort((a, b) => a.satoshis! - b.satoshis!)
|
|
1087
|
+
const sortedOutputs = tx?.outputs?.slice().sort((a, b) => a.satoshis! - b.satoshis!)
|
|
1215
1088
|
const formattedTxOutputs = formatTxOutputs(sortedOutputs, indent)
|
|
1216
|
-
formattedTxOutputs.forEach(
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
}
|
|
1221
|
-
)
|
|
1089
|
+
formattedTxOutputs.forEach(({ log: outputLog, logColor: outputLogColor }) => {
|
|
1090
|
+
log += `\n${outputLog}`
|
|
1091
|
+
logColor += `\n${outputLogColor}`
|
|
1092
|
+
})
|
|
1222
1093
|
|
|
1223
1094
|
return { log, logColor }
|
|
1224
1095
|
} catch (error) {
|
|
1225
1096
|
return {
|
|
1226
1097
|
log: `Error parsing transaction: ${(error as Error).message}`,
|
|
1227
|
-
logColor: chalk.red(
|
|
1228
|
-
`Error parsing transaction: ${(error as Error).message}`
|
|
1229
|
-
)
|
|
1098
|
+
logColor: chalk.red(`Error parsing transaction: ${(error as Error).message}`)
|
|
1230
1099
|
}
|
|
1231
1100
|
}
|
|
1232
1101
|
}
|
|
@@ -1240,8 +1109,7 @@ export const isEmptyObject = (obj: unknown): boolean => {
|
|
|
1240
1109
|
return !!obj && typeof obj === 'object' && Object.keys(obj).length === 0
|
|
1241
1110
|
}
|
|
1242
1111
|
|
|
1243
|
-
const formatIndentedLine = (indent: number, content: string) =>
|
|
1244
|
-
' '.repeat(indent * 2) + content.trim() // Trim ensures no accidental double spacing
|
|
1112
|
+
const formatIndentedLine = (indent: number, content: string) => ' '.repeat(indent * 2) + content.trim() // Trim ensures no accidental double spacing
|
|
1245
1113
|
|
|
1246
1114
|
function log(s: string) {
|
|
1247
1115
|
if (!noLog) console.log(s)
|
|
@@ -1261,9 +1129,8 @@ export function numberArrayToHexString(numbers: number[]): string {
|
|
|
1261
1129
|
//appendLogsAsConst(testName, rl1)
|
|
1262
1130
|
|
|
1263
1131
|
// Auto-generated test log - 2025-02-05T13:04:29.906Z
|
|
1264
|
-
const LOG_createAction_nosend_transactions_1_transaction_with_single_output_checked_using_toLogString =
|
|
1265
|
-
|
|
1266
|
-
log: `transactions:3
|
|
1132
|
+
const LOG_createAction_nosend_transactions_1_transaction_with_single_output_checked_using_toLogString = {
|
|
1133
|
+
log: `transactions:3
|
|
1267
1134
|
txid:30bdac0f5c6491f130820517802ff57e20e5a50c08b5c65e6976627fb82ae930 version:1 lockTime:0 sats:-4 status:nosend
|
|
1268
1135
|
outgoing:true desc:'Funding transaction' labels:['funding transaction for createaction','this is an extra long test
|
|
1269
1136
|
label that should be truncated at 80 chars when it is...']
|
|
@@ -1275,7 +1142,7 @@ const LOG_createAction_nosend_transactions_1_transaction_with_single_output_chec
|
|
|
1275
1142
|
0: sats:3 lock:(48)76a914abcdef0123456789abcdef0123456789abcdef88ac index:0 spendable:true basket:'funding basket'
|
|
1276
1143
|
desc:'Funding Output' tags:['funding transaction output','test tag']
|
|
1277
1144
|
1: sats:909 lock:(50)76a9145947e66cdd43c70fb1780116b79e6f7d96e30e0888ac index:1 spendable:true basket:'default'`,
|
|
1278
|
-
|
|
1145
|
+
logColor: `[90mtransactions:3[39m [90mkey:[39m ([34mtxid/outpoint[39m [36mscript[39m [32msats[39m)
|
|
1279
1146
|
[34m30bdac0f5c6491f130820517802ff57e20e5a50c08b5c65e6976627fb82ae930[39m [90mversion:[39m1 [90mlockTime:[39m0
|
|
1280
1147
|
[32m-4 sats[39m [90mstatus:[39m[37mnosend[39m [90moutgoing:[39m[37mtrue[39m [90mdesc:[39m[37mFunding
|
|
1281
1148
|
transaction[39m [90mlabels:[39m[37m['funding transaction for createaction','this is an extra long test label that
|
|
@@ -1291,12 +1158,11 @@ const LOG_createAction_nosend_transactions_1_transaction_with_single_output_chec
|
|
|
1291
1158
|
[90mdesc:[39m[37mFunding Output[39m [90mtags:[39m[37m['funding transaction output','test tag'][39m
|
|
1292
1159
|
[90m1:[39m [32m909 sats[39m [90mlock:[39m(50)[36m76a9145947e66cdd43c70fb1780116b79e6f7d96e30e0888ac[39m
|
|
1293
1160
|
[90mindex:[39m[37m1[39m [90mspendable:[39m[37mtrue[39m [90mbasket:[39m[37mdefault[39m`
|
|
1294
|
-
|
|
1161
|
+
}
|
|
1295
1162
|
|
|
1296
1163
|
// Auto-generated test log - 2025-02-05T13:46:12.091Z
|
|
1297
|
-
const LOG_createAction_nosend_transactions_2_transaction_with_multiple_outputs_checked_using_toLogString =
|
|
1298
|
-
|
|
1299
|
-
log: `transactions:3
|
|
1164
|
+
const LOG_createAction_nosend_transactions_2_transaction_with_multiple_outputs_checked_using_toLogString = {
|
|
1165
|
+
log: `transactions:3
|
|
1300
1166
|
txid:b3848f2cabf5887ec679ca60347a29f6ecad425fda738700265c2f9d22c18ab5 version:1 lockTime:0 sats:-12 status:nosend
|
|
1301
1167
|
outgoing:true desc:'Funding transaction with multiple outputs' labels:['funding transaction for createaction','this
|
|
1302
1168
|
is the extra label']
|
|
@@ -1310,7 +1176,7 @@ const LOG_createAction_nosend_transactions_2_transaction_with_multiple_outputs_c
|
|
|
1310
1176
|
1: sats:6 lock:(48)76a914fedcba9876543210fedcba9876543210fedcba88ac index:1 spendable:true basket:'extra basket'
|
|
1311
1177
|
desc:'Extra Output' tags:['extra transaction output','extra test tag']
|
|
1312
1178
|
2: sats:901 lock:(50)76a9145947e66cdd43c70fb1780116b79e6f7d96e30e0888ac index:2 spendable:true basket:'default'`,
|
|
1313
|
-
|
|
1179
|
+
logColor: `[90mtransactions:3[39m [90mkey:[39m ([34mtxid/outpoint[39m [36mscript[39m [32msats[39m)
|
|
1314
1180
|
[34mb3848f2cabf5887ec679ca60347a29f6ecad425fda738700265c2f9d22c18ab5[39m [90mversion:[39m1 [90mlockTime:[39m0
|
|
1315
1181
|
[32m-12 sats[39m [90mstatus:[39m[37mnosend[39m [90moutgoing:[39m[37mtrue[39m [90mdesc:[39m[37mFunding
|
|
1316
1182
|
transaction with multiple outputs[39m [90mlabels:[39m[37m['funding transaction for createaction','this is the
|
|
@@ -1330,7 +1196,7 @@ const LOG_createAction_nosend_transactions_2_transaction_with_multiple_outputs_c
|
|
|
1330
1196
|
[90mdesc:[39m[37mExtra Output[39m [90mtags:[39m[37m['extra transaction output','extra test tag'][39m
|
|
1331
1197
|
[90m2:[39m [32m901 sats[39m [90mlock:[39m(50)[36m76a9145947e66cdd43c70fb1780116b79e6f7d96e30e0888ac[39m
|
|
1332
1198
|
[90mindex:[39m[37m2[39m [90mspendable:[39m[37mtrue[39m [90mbasket:[39m[37mdefault[39m`
|
|
1333
|
-
|
|
1199
|
+
}
|
|
1334
1200
|
|
|
1335
1201
|
// Auto-generated test log - 2025-02-05T14:50:57.843Z
|
|
1336
1202
|
const LOG_createAction_nosend_transactions_3_transaction_with_explicit_change_check_also_uses_toLogString_on_the_spend =
|
|
@@ -23,16 +23,14 @@ describe('createActionToGenerateBeefs test', () => {
|
|
|
23
23
|
// Mock the services postBeef to avoid actually broadcasting new transactions and collect beef data.
|
|
24
24
|
services.postBeef = jest
|
|
25
25
|
.fn()
|
|
26
|
-
.mockImplementation(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
txidResults: txids.map(txid => ({ txid, status: 'success' }))
|
|
32
|
-
}
|
|
33
|
-
return Promise.resolve([r])
|
|
26
|
+
.mockImplementation((beef: bsv.Beef, txids: string[]): Promise<sdk.PostBeefResult[]> => {
|
|
27
|
+
const r: sdk.PostBeefResult = {
|
|
28
|
+
name: 'mock',
|
|
29
|
+
status: 'success',
|
|
30
|
+
txidResults: txids.map(txid => ({ txid, status: 'success' }))
|
|
34
31
|
}
|
|
35
|
-
|
|
32
|
+
return Promise.resolve([r])
|
|
33
|
+
})
|
|
36
34
|
}
|
|
37
35
|
})
|
|
38
36
|
|
|
@@ -135,8 +133,7 @@ describe('createActionToGenerateBeefs test', () => {
|
|
|
135
133
|
|
|
136
134
|
test('3_test tranaction log', async () => {
|
|
137
135
|
for (const { activeStorage: storage } of ctxs) {
|
|
138
|
-
const txid: bsv.HexString =
|
|
139
|
-
'ed11e4b7402e38bac0ec7431063ae7c14ee82370e5f1963d48ae27a70527f784'
|
|
136
|
+
const txid: bsv.HexString = 'ed11e4b7402e38bac0ec7431063ae7c14ee82370e5f1963d48ae27a70527f784'
|
|
140
137
|
const rl = await logTransaction(storage, txid)
|
|
141
138
|
console.log(rl)
|
|
142
139
|
break
|