@bsv/wallet-toolbox 1.7.1 → 1.7.3
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/CHANGELOG.md +11 -0
- package/docs/client.md +489 -1334
- package/docs/services.md +5 -5
- package/docs/storage.md +64 -61
- package/docs/wallet.md +489 -1334
- package/mobile/out/src/Wallet.d.ts +21 -4
- package/mobile/out/src/Wallet.d.ts.map +1 -1
- package/mobile/out/src/Wallet.js +93 -57
- package/mobile/out/src/Wallet.js.map +1 -1
- package/mobile/out/src/WalletLogger.d.ts +33 -0
- package/mobile/out/src/WalletLogger.d.ts.map +1 -0
- package/mobile/out/src/WalletLogger.js +157 -0
- package/mobile/out/src/WalletLogger.js.map +1 -0
- package/mobile/out/src/WalletPermissionsManager.d.ts.map +1 -1
- package/mobile/out/src/WalletPermissionsManager.js +1 -2
- package/mobile/out/src/WalletPermissionsManager.js.map +1 -1
- package/mobile/out/src/index.mobile.d.ts +1 -0
- package/mobile/out/src/index.mobile.d.ts.map +1 -1
- package/mobile/out/src/index.mobile.js +1 -0
- package/mobile/out/src/index.mobile.js.map +1 -1
- package/mobile/out/src/sdk/WERR_errors.d.ts.map +1 -1
- package/mobile/out/src/sdk/WERR_errors.js.map +1 -1
- package/mobile/out/src/sdk/WalletError.d.ts.map +1 -1
- package/mobile/out/src/sdk/WalletError.js +0 -2
- package/mobile/out/src/sdk/WalletError.js.map +1 -1
- package/mobile/out/src/sdk/WalletServices.interfaces.d.ts +3 -3
- package/mobile/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
- package/mobile/out/src/sdk/WalletStorage.interfaces.d.ts +9 -10
- package/mobile/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/mobile/out/src/sdk/index.d.ts +1 -1
- package/mobile/out/src/sdk/index.d.ts.map +1 -1
- package/mobile/out/src/sdk/index.js +3 -1
- package/mobile/out/src/sdk/index.js.map +1 -1
- package/mobile/out/src/services/Services.d.ts +5 -5
- package/mobile/out/src/services/Services.d.ts.map +1 -1
- package/mobile/out/src/services/Services.js +18 -4
- package/mobile/out/src/services/Services.js.map +1 -1
- package/mobile/out/src/services/providers/WhatsOnChain.d.ts.map +1 -1
- package/mobile/out/src/services/providers/WhatsOnChain.js +1 -2
- package/mobile/out/src/services/providers/WhatsOnChain.js.map +1 -1
- package/mobile/out/src/services/providers/getBeefForTxid.d.ts.map +1 -1
- package/mobile/out/src/services/providers/getBeefForTxid.js.map +1 -1
- package/mobile/out/src/signer/methods/acquireDirectCertificate.d.ts +2 -3
- package/mobile/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -1
- package/mobile/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
- package/mobile/out/src/signer/methods/buildSignableTransaction.d.ts +3 -4
- package/mobile/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
- package/mobile/out/src/signer/methods/buildSignableTransaction.js +1 -2
- package/mobile/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
- package/mobile/out/src/signer/methods/createAction.d.ts +3 -4
- package/mobile/out/src/signer/methods/createAction.d.ts.map +1 -1
- package/mobile/out/src/signer/methods/createAction.js +17 -6
- package/mobile/out/src/signer/methods/createAction.js.map +1 -1
- package/mobile/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
- package/mobile/out/src/signer/methods/internalizeAction.js +1 -2
- package/mobile/out/src/signer/methods/internalizeAction.js.map +1 -1
- package/mobile/out/src/signer/methods/proveCertificate.d.ts +2 -3
- package/mobile/out/src/signer/methods/proveCertificate.d.ts.map +1 -1
- package/mobile/out/src/signer/methods/proveCertificate.js.map +1 -1
- package/mobile/out/src/signer/methods/signAction.d.ts.map +1 -1
- package/mobile/out/src/signer/methods/signAction.js +1 -2
- package/mobile/out/src/signer/methods/signAction.js.map +1 -1
- package/mobile/out/src/storage/StorageIdb.d.ts +3 -4
- package/mobile/out/src/storage/StorageIdb.d.ts.map +1 -1
- package/mobile/out/src/storage/StorageIdb.js.map +1 -1
- package/mobile/out/src/storage/StorageProvider.d.ts +6 -7
- package/mobile/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/mobile/out/src/storage/StorageProvider.js +5 -6
- package/mobile/out/src/storage/StorageProvider.js.map +1 -1
- package/mobile/out/src/storage/WalletStorageManager.d.ts +5 -5
- package/mobile/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/mobile/out/src/storage/WalletStorageManager.js +5 -4
- package/mobile/out/src/storage/WalletStorageManager.js.map +1 -1
- package/mobile/out/src/storage/methods/ListActionsSpecOp.d.ts +2 -2
- package/mobile/out/src/storage/methods/ListActionsSpecOp.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/ListActionsSpecOp.js.map +1 -1
- package/mobile/out/src/storage/methods/ListOutputsSpecOp.d.ts +4 -5
- package/mobile/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/ListOutputsSpecOp.js.map +1 -1
- package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +2 -2
- package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.js +11 -7
- package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
- package/mobile/out/src/storage/methods/createAction.d.ts +3 -4
- package/mobile/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/createAction.js +18 -5
- package/mobile/out/src/storage/methods/createAction.js.map +1 -1
- package/mobile/out/src/storage/methods/generateChange.js +10 -10
- package/mobile/out/src/storage/methods/generateChange.js.map +1 -1
- package/mobile/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/internalizeAction.js +1 -2
- package/mobile/out/src/storage/methods/internalizeAction.js.map +1 -1
- package/mobile/out/src/storage/methods/listActionsIdb.d.ts +2 -3
- package/mobile/out/src/storage/methods/listActionsIdb.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/listActionsIdb.js.map +1 -1
- package/mobile/out/src/storage/methods/listCertificates.d.ts +3 -3
- package/mobile/out/src/storage/methods/listCertificates.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/listCertificates.js.map +1 -1
- package/mobile/out/src/storage/methods/listOutputsIdb.d.ts +2 -3
- package/mobile/out/src/storage/methods/listOutputsIdb.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/listOutputsIdb.js.map +1 -1
- package/mobile/out/src/storage/methods/processAction.d.ts +2 -2
- package/mobile/out/src/storage/methods/processAction.d.ts.map +1 -1
- package/mobile/out/src/storage/methods/processAction.js +15 -10
- package/mobile/out/src/storage/methods/processAction.js.map +1 -1
- package/mobile/out/src/storage/remoting/StorageClient.d.ts +5 -6
- package/mobile/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
- package/mobile/out/src/storage/remoting/StorageClient.js +22 -0
- package/mobile/out/src/storage/remoting/StorageClient.js.map +1 -1
- package/mobile/out/src/storage/remoting/StorageMobile.d.ts +5 -6
- package/mobile/out/src/storage/remoting/StorageMobile.d.ts.map +1 -1
- package/mobile/out/src/storage/remoting/StorageMobile.js.map +1 -1
- package/mobile/package-lock.json +6 -6
- package/mobile/package.json +2 -2
- package/out/src/Wallet.d.ts +21 -4
- package/out/src/Wallet.d.ts.map +1 -1
- package/out/src/Wallet.js +93 -57
- package/out/src/Wallet.js.map +1 -1
- package/out/src/WalletLogger.d.ts +33 -0
- package/out/src/WalletLogger.d.ts.map +1 -0
- package/out/src/WalletLogger.js +157 -0
- package/out/src/WalletLogger.js.map +1 -0
- package/out/src/WalletPermissionsManager.d.ts.map +1 -1
- package/out/src/WalletPermissionsManager.js +1 -2
- package/out/src/WalletPermissionsManager.js.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.fixtures.d.ts +1 -0
- package/out/src/__tests/WalletPermissionsManager.fixtures.d.ts.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.fixtures.js +15 -4
- package/out/src/__tests/WalletPermissionsManager.fixtures.js.map +1 -1
- package/out/src/__tests/WalletPermissionsManager.proxying.test.js +79 -74
- package/out/src/__tests/WalletPermissionsManager.proxying.test.js.map +1 -1
- package/out/src/index.mobile.d.ts +1 -0
- package/out/src/index.mobile.d.ts.map +1 -1
- package/out/src/index.mobile.js +1 -0
- package/out/src/index.mobile.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 +0 -2
- package/out/src/sdk/WalletError.js.map +1 -1
- package/out/src/sdk/WalletServices.interfaces.d.ts +3 -3
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
- package/out/src/sdk/WalletStorage.interfaces.d.ts +9 -10
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/out/src/sdk/__test/validationHelpers.test.js +4 -4
- package/out/src/sdk/__test/validationHelpers.test.js.map +1 -1
- package/out/src/sdk/index.d.ts +1 -1
- package/out/src/sdk/index.d.ts.map +1 -1
- package/out/src/sdk/index.js +3 -1
- package/out/src/sdk/index.js.map +1 -1
- package/out/src/services/Services.d.ts +5 -5
- package/out/src/services/Services.d.ts.map +1 -1
- package/out/src/services/Services.js +18 -4
- package/out/src/services/Services.js.map +1 -1
- package/out/src/services/providers/WhatsOnChain.d.ts.map +1 -1
- package/out/src/services/providers/WhatsOnChain.js +1 -2
- package/out/src/services/providers/WhatsOnChain.js.map +1 -1
- package/out/src/services/providers/getBeefForTxid.d.ts.map +1 -1
- package/out/src/services/providers/getBeefForTxid.js.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.d.ts +2 -3
- package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
- package/out/src/signer/methods/buildSignableTransaction.d.ts +3 -4
- package/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
- package/out/src/signer/methods/buildSignableTransaction.js +1 -2
- package/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
- package/out/src/signer/methods/createAction.d.ts +3 -4
- package/out/src/signer/methods/createAction.d.ts.map +1 -1
- package/out/src/signer/methods/createAction.js +17 -6
- 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 +1 -2
- package/out/src/signer/methods/internalizeAction.js.map +1 -1
- package/out/src/signer/methods/proveCertificate.d.ts +2 -3
- 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 +1 -2
- package/out/src/signer/methods/signAction.js.map +1 -1
- package/out/src/storage/StorageIdb.d.ts +3 -4
- package/out/src/storage/StorageIdb.d.ts.map +1 -1
- package/out/src/storage/StorageIdb.js.map +1 -1
- package/out/src/storage/StorageKnex.d.ts +3 -4
- package/out/src/storage/StorageKnex.d.ts.map +1 -1
- package/out/src/storage/StorageKnex.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts +6 -7
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +5 -6
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/WalletStorageManager.d.ts +5 -5
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.js +5 -4
- package/out/src/storage/WalletStorageManager.js.map +1 -1
- package/out/src/storage/__test/getBeefForTransaction.test.js.map +1 -1
- package/out/src/storage/methods/ListActionsSpecOp.d.ts +2 -2
- package/out/src/storage/methods/ListActionsSpecOp.d.ts.map +1 -1
- package/out/src/storage/methods/ListActionsSpecOp.js.map +1 -1
- package/out/src/storage/methods/ListOutputsSpecOp.d.ts +4 -5
- package/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +1 -1
- package/out/src/storage/methods/ListOutputsSpecOp.js.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +2 -2
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +11 -7
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
- package/out/src/storage/methods/createAction.d.ts +3 -4
- package/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/out/src/storage/methods/createAction.js +18 -5
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/methods/generateChange.js +10 -10
- package/out/src/storage/methods/generateChange.js.map +1 -1
- package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/storage/methods/internalizeAction.js +1 -2
- package/out/src/storage/methods/internalizeAction.js.map +1 -1
- package/out/src/storage/methods/listActionsIdb.d.ts +2 -3
- package/out/src/storage/methods/listActionsIdb.d.ts.map +1 -1
- package/out/src/storage/methods/listActionsIdb.js.map +1 -1
- package/out/src/storage/methods/listActionsKnex.d.ts +2 -3
- package/out/src/storage/methods/listActionsKnex.d.ts.map +1 -1
- package/out/src/storage/methods/listActionsKnex.js.map +1 -1
- package/out/src/storage/methods/listCertificates.d.ts +3 -3
- 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/listOutputsIdb.d.ts +2 -3
- package/out/src/storage/methods/listOutputsIdb.d.ts.map +1 -1
- package/out/src/storage/methods/listOutputsIdb.js.map +1 -1
- package/out/src/storage/methods/listOutputsKnex.d.ts +2 -3
- package/out/src/storage/methods/listOutputsKnex.d.ts.map +1 -1
- package/out/src/storage/methods/listOutputsKnex.js.map +1 -1
- package/out/src/storage/methods/processAction.d.ts +2 -2
- package/out/src/storage/methods/processAction.d.ts.map +1 -1
- package/out/src/storage/methods/processAction.js +15 -10
- package/out/src/storage/methods/processAction.js.map +1 -1
- package/out/src/storage/remoting/StorageClient.d.ts +5 -6
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageClient.js +22 -0
- package/out/src/storage/remoting/StorageClient.js.map +1 -1
- package/out/src/storage/remoting/StorageMobile.d.ts +5 -6
- package/out/src/storage/remoting/StorageMobile.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageMobile.js.map +1 -1
- package/out/src/storage/remoting/StorageServer.d.ts +5 -0
- package/out/src/storage/remoting/StorageServer.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageServer.js +38 -5
- package/out/src/storage/remoting/StorageServer.js.map +1 -1
- package/out/src/storage/remoting/__test/StorageClient.test.d.ts +2 -0
- package/out/src/storage/remoting/__test/StorageClient.test.d.ts.map +1 -0
- package/out/src/storage/remoting/__test/StorageClient.test.js +98 -0
- package/out/src/storage/remoting/__test/StorageClient.test.js.map +1 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
- package/out/src/storage/sync/StorageMySQLDojoReader.js +1 -2
- package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -1
- package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -1
- package/out/test/Wallet/local/localWallet2.man.test.js.map +1 -1
- package/out/test/Wallet/signAction/mountaintop.man.test.js +2 -2
- package/out/test/Wallet/signAction/mountaintop.man.test.js.map +1 -1
- package/out/test/Wallet/support/operations.man.test.js +46 -1
- package/out/test/Wallet/support/operations.man.test.js.map +1 -1
- package/out/test/Wallet/support/reqErrorReview.2025.05.06.man.test.js.map +1 -1
- package/out/test/WalletClient/WERR.man.test.js +1 -1
- package/out/test/WalletClient/WERR.man.test.js.map +1 -1
- package/out/test/utils/localWalletMethods.d.ts.map +1 -1
- package/out/test/utils/localWalletMethods.js +2 -3
- package/out/test/utils/localWalletMethods.js.map +1 -1
- package/out/test/wallet/action/createAction.test.js +3 -0
- package/out/test/wallet/action/createAction.test.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Wallet.ts +114 -79
- package/src/WalletLogger.ts +167 -0
- package/src/WalletPermissionsManager.ts +3 -5
- package/src/__tests/WalletPermissionsManager.fixtures.ts +14 -1
- package/src/__tests/WalletPermissionsManager.proxying.test.ts +89 -85
- package/src/index.mobile.ts +1 -0
- package/src/sdk/WERR_errors.ts +6 -3
- package/src/sdk/WalletError.ts +0 -4
- package/src/sdk/WalletServices.interfaces.ts +14 -3
- package/src/sdk/WalletStorage.interfaces.ts +11 -16
- package/src/sdk/__test/validationHelpers.test.ts +4 -5
- package/src/sdk/index.ts +1 -1
- package/src/services/Services.ts +23 -5
- package/src/services/providers/WhatsOnChain.ts +2 -3
- package/src/services/providers/getBeefForTxid.ts +3 -5
- package/src/signer/methods/acquireDirectCertificate.ts +2 -3
- package/src/signer/methods/buildSignableTransaction.ts +5 -6
- package/src/signer/methods/createAction.ts +24 -18
- package/src/signer/methods/internalizeAction.ts +4 -5
- package/src/signer/methods/proveCertificate.ts +3 -4
- package/src/signer/methods/signAction.ts +6 -4
- package/src/storage/StorageIdb.ts +3 -4
- package/src/storage/StorageKnex.ts +3 -4
- package/src/storage/StorageProvider.ts +16 -20
- package/src/storage/WalletStorageManager.ts +10 -11
- package/src/storage/__test/getBeefForTransaction.test.ts +3 -4
- package/src/storage/methods/ListActionsSpecOp.ts +4 -4
- package/src/storage/methods/ListOutputsSpecOp.ts +7 -8
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +15 -8
- package/src/storage/methods/createAction.ts +39 -23
- package/src/storage/methods/generateChange.ts +10 -10
- package/src/storage/methods/internalizeAction.ts +4 -4
- package/src/storage/methods/listActionsIdb.ts +3 -3
- package/src/storage/methods/listActionsKnex.ts +3 -3
- package/src/storage/methods/listCertificates.ts +7 -6
- package/src/storage/methods/listOutputsIdb.ts +2 -3
- package/src/storage/methods/listOutputsKnex.ts +2 -3
- package/src/storage/methods/processAction.ts +30 -11
- package/src/storage/remoting/StorageClient.ts +31 -12
- package/src/storage/remoting/StorageMobile.ts +6 -12
- package/src/storage/remoting/StorageServer.ts +45 -6
- package/src/storage/remoting/__test/StorageClient.test.ts +113 -0
- package/src/storage/sync/StorageMySQLDojoReader.ts +2 -3
- package/test/Wallet/certificate/listCertificates.test.ts +2 -2
- package/test/Wallet/local/localWallet2.man.test.ts +5 -5
- package/test/Wallet/signAction/mountaintop.man.test.ts +3 -2
- package/test/Wallet/support/operations.man.test.ts +65 -6
- package/test/Wallet/support/reqErrorReview.2025.05.06.man.test.ts +2 -14
- package/test/WalletClient/WERR.man.test.ts +3 -3
- package/test/utils/localWalletMethods.ts +5 -5
- package/test/wallet/action/createAction.test.ts +3 -0
- package/mobile/out/src/sdk/validationHelpers.d.ts +0 -322
- package/mobile/out/src/sdk/validationHelpers.d.ts.map +0 -1
- package/mobile/out/src/sdk/validationHelpers.js +0 -691
- package/mobile/out/src/sdk/validationHelpers.js.map +0 -1
- package/out/src/sdk/validationHelpers.d.ts +0 -322
- package/out/src/sdk/validationHelpers.d.ts.map +0 -1
- package/out/src/sdk/validationHelpers.js +0 -691
- package/out/src/sdk/validationHelpers.js.map +0 -1
- package/src/sdk/validationHelpers.ts +0 -1034
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
AbortActionArgs,
|
|
3
3
|
AbortActionResult,
|
|
4
4
|
InternalizeActionArgs,
|
|
5
|
-
InternalizeActionResult,
|
|
6
5
|
ListActionsResult,
|
|
7
6
|
ListCertificatesResult,
|
|
8
7
|
ListOutputsResult,
|
|
9
8
|
RelinquishCertificateArgs,
|
|
10
9
|
RelinquishOutputArgs,
|
|
11
10
|
WalletInterface,
|
|
12
|
-
AuthFetch
|
|
11
|
+
AuthFetch,
|
|
12
|
+
Validation
|
|
13
13
|
} from '@bsv/sdk'
|
|
14
14
|
import {
|
|
15
15
|
AuthId,
|
|
@@ -30,12 +30,6 @@ import {
|
|
|
30
30
|
} from '../../sdk/WalletStorage.interfaces'
|
|
31
31
|
import { WERR_INVALID_OPERATION } from '../../sdk/WERR_errors'
|
|
32
32
|
import { WalletServices } from '../../sdk/WalletServices.interfaces'
|
|
33
|
-
import {
|
|
34
|
-
ValidCreateActionArgs,
|
|
35
|
-
ValidListActionsArgs,
|
|
36
|
-
ValidListCertificatesArgs,
|
|
37
|
-
ValidListOutputsArgs
|
|
38
|
-
} from '../../sdk/validationHelpers'
|
|
39
33
|
import { TableSettings } from '../schema/tables/TableSettings'
|
|
40
34
|
import { TableUser } from '../schema/tables/TableUser'
|
|
41
35
|
import { TableSyncState } from '../schema/tables/TableSyncState'
|
|
@@ -229,7 +223,7 @@ export class StorageClient implements WalletStorageProvider {
|
|
|
229
223
|
* @param args Validated extension of original wallet `createAction` arguments.
|
|
230
224
|
* @returns `StorageCreateActionResults` supporting additional wallet processing to yield `createAction` results.
|
|
231
225
|
*/
|
|
232
|
-
async createAction(auth: AuthId, args: ValidCreateActionArgs): Promise<StorageCreateActionResult> {
|
|
226
|
+
async createAction(auth: AuthId, args: Validation.ValidCreateActionArgs): Promise<StorageCreateActionResult> {
|
|
233
227
|
return this.rpcCall<StorageCreateActionResult>('createAction', [auth, args])
|
|
234
228
|
}
|
|
235
229
|
|
|
@@ -309,7 +303,7 @@ export class StorageClient implements WalletStorageProvider {
|
|
|
309
303
|
* @param args Validated extension of original wallet `listActions` arguments.
|
|
310
304
|
* @returns `listActions` results.
|
|
311
305
|
*/
|
|
312
|
-
async listActions(auth: AuthId, vargs: ValidListActionsArgs): Promise<ListActionsResult> {
|
|
306
|
+
async listActions(auth: AuthId, vargs: Validation.ValidListActionsArgs): Promise<ListActionsResult> {
|
|
313
307
|
const r = await this.rpcCall<ListActionsResult>('listActions', [auth, vargs])
|
|
314
308
|
return r
|
|
315
309
|
}
|
|
@@ -321,7 +315,7 @@ export class StorageClient implements WalletStorageProvider {
|
|
|
321
315
|
* @param args Validated extension of original wallet `listOutputs` arguments.
|
|
322
316
|
* @returns `listOutputs` results.
|
|
323
317
|
*/
|
|
324
|
-
async listOutputs(auth: AuthId, vargs: ValidListOutputsArgs): Promise<ListOutputsResult> {
|
|
318
|
+
async listOutputs(auth: AuthId, vargs: Validation.ValidListOutputsArgs): Promise<ListOutputsResult> {
|
|
325
319
|
const r = await this.rpcCall<ListOutputsResult>('listOutputs', [auth, vargs])
|
|
326
320
|
return r
|
|
327
321
|
}
|
|
@@ -333,7 +327,7 @@ export class StorageClient implements WalletStorageProvider {
|
|
|
333
327
|
* @param args Validated extension of original wallet `listCertificates` arguments.
|
|
334
328
|
* @returns `listCertificates` results.
|
|
335
329
|
*/
|
|
336
|
-
async listCertificates(auth: AuthId, vargs: ValidListCertificatesArgs): Promise<ListCertificatesResult> {
|
|
330
|
+
async listCertificates(auth: AuthId, vargs: Validation.ValidListCertificatesArgs): Promise<ListCertificatesResult> {
|
|
337
331
|
const r = await this.rpcCall<ListCertificatesResult>('listCertificates', [auth, vargs])
|
|
338
332
|
return r
|
|
339
333
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* and exposes it via a JSON-RPC POST endpoint using Express.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { WalletInterface } from '@bsv/sdk'
|
|
8
|
+
import { MakeWalletLogger, WalletInterface, WalletLoggerInterface } from '@bsv/sdk'
|
|
9
9
|
import express, { Request, Response } from 'express'
|
|
10
10
|
import { AuthMiddlewareOptions, createAuthMiddleware } from '@bsv/auth-express-middleware'
|
|
11
11
|
import { createPaymentMiddleware } from '@bsv/payment-express-middleware'
|
|
@@ -15,6 +15,7 @@ import { WERR_UNAUTHORIZED } from '../../sdk/WERR_errors'
|
|
|
15
15
|
import { SyncChunk } from '../../sdk/WalletStorage.interfaces'
|
|
16
16
|
import { EntityTimeStamp } from '../../sdk/types'
|
|
17
17
|
import { WalletError } from '../../sdk/WalletError'
|
|
18
|
+
import { logWalletError } from '../../WalletLogger'
|
|
18
19
|
|
|
19
20
|
export interface WalletStorageServerOptions {
|
|
20
21
|
port: number
|
|
@@ -22,6 +23,7 @@ export interface WalletStorageServerOptions {
|
|
|
22
23
|
monetize: boolean
|
|
23
24
|
calculateRequestPrice?: (req: Request) => number | Promise<number>
|
|
24
25
|
adminIdentityKeys?: string[]
|
|
26
|
+
makeLogger?: MakeWalletLogger
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export class StorageServer {
|
|
@@ -32,6 +34,7 @@ export class StorageServer {
|
|
|
32
34
|
private monetize: boolean
|
|
33
35
|
private calculateRequestPrice?: (req: Request) => number | Promise<number>
|
|
34
36
|
private adminIdentityKeys?: string[]
|
|
37
|
+
private makeLogger?: MakeWalletLogger
|
|
35
38
|
|
|
36
39
|
constructor(storage: StorageProvider, options: WalletStorageServerOptions) {
|
|
37
40
|
this.storage = storage
|
|
@@ -40,6 +43,7 @@ export class StorageServer {
|
|
|
40
43
|
this.monetize = options.monetize
|
|
41
44
|
this.calculateRequestPrice = options.calculateRequestPrice
|
|
42
45
|
this.adminIdentityKeys = options.adminIdentityKeys
|
|
46
|
+
this.makeLogger = options.makeLogger
|
|
43
47
|
|
|
44
48
|
this.setupRoutes()
|
|
45
49
|
}
|
|
@@ -154,10 +158,35 @@ export class StorageServer {
|
|
|
154
158
|
}
|
|
155
159
|
break
|
|
156
160
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
|
|
162
|
+
// If makeLogger is valid, setup and potentially initialize to return data
|
|
163
|
+
let logger: WalletLoggerInterface | undefined
|
|
164
|
+
if (this.makeLogger && typeof params[1] === 'object') {
|
|
165
|
+
logger = this.makeLogger(params[1]['logger'])
|
|
166
|
+
params[1]['logger'] = logger
|
|
167
|
+
logger.group(`StorageSever ${method}`)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
const result = await (this.storage as any)[method](...(params || []))
|
|
172
|
+
|
|
173
|
+
if (logger) {
|
|
174
|
+
logger.groupEnd()
|
|
175
|
+
logger.flush?.()
|
|
176
|
+
if (logger.isOrigin) {
|
|
177
|
+
// Potentially only flush if isOrigin...
|
|
178
|
+
} else if (logger.logs && typeof result === 'object') {
|
|
179
|
+
// If not the start of logging, return logged data with result.
|
|
180
|
+
result['log'] = { logs: logger.logs }
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return res.json({ jsonrpc: '2.0', result, id })
|
|
185
|
+
} catch (eu: unknown) {
|
|
186
|
+
logWalletError(eu, logger, 'error executing requested method')
|
|
187
|
+
logger?.flush?.()
|
|
188
|
+
throw eu
|
|
189
|
+
}
|
|
161
190
|
} else {
|
|
162
191
|
// Unknown method
|
|
163
192
|
return res.status(400).json({
|
|
@@ -198,12 +227,22 @@ export class StorageServer {
|
|
|
198
227
|
if (params[0]['identityKey']) params[0].userId = user.userId
|
|
199
228
|
}
|
|
200
229
|
|
|
230
|
+
server: any
|
|
231
|
+
|
|
201
232
|
public start(): void {
|
|
202
|
-
this.app.listen(this.port, () => {
|
|
233
|
+
this.server = this.app.listen(this.port, () => {
|
|
203
234
|
console.log(`WalletStorageServer listening at http://localhost:${this.port}`)
|
|
204
235
|
})
|
|
205
236
|
}
|
|
206
237
|
|
|
238
|
+
public async close(): Promise<void> {
|
|
239
|
+
if (this.server) {
|
|
240
|
+
await this.server.close(() => {
|
|
241
|
+
console.log('WalletStorageServer closed')
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
207
246
|
validateDate(date: Date | string | number): Date {
|
|
208
247
|
let r: Date
|
|
209
248
|
if (date instanceof Date) r = date
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { CreateActionArgs, WalletLoggerInterface } from '@bsv/sdk'
|
|
2
|
+
import { _tu, TestWalletNoSetup, TestWalletOnly } from '../../../../test/utils/TestUtilsWalletStorage'
|
|
3
|
+
import { wait } from '../../../utility/utilityHelpers'
|
|
4
|
+
import { WalletLogger } from '../../../WalletLogger'
|
|
5
|
+
import { StorageServer, WalletStorageServerOptions } from '../StorageServer'
|
|
6
|
+
import { StorageClient } from '../StorageClient'
|
|
7
|
+
|
|
8
|
+
describe('StorageClient tests', () => {
|
|
9
|
+
jest.setTimeout(99999999)
|
|
10
|
+
|
|
11
|
+
let server: { setup: TestWalletNoSetup; server: StorageServer }
|
|
12
|
+
|
|
13
|
+
let client: TestWalletOnly
|
|
14
|
+
|
|
15
|
+
beforeAll(async () => {
|
|
16
|
+
server = await createStorageServer()
|
|
17
|
+
|
|
18
|
+
client = await _tu.createTestWalletWithStorageClient({
|
|
19
|
+
rootKeyHex: server.setup.rootKey.toHex(),
|
|
20
|
+
endpointUrl: 'http://localhost:8042',
|
|
21
|
+
chain: server.setup.chain
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
afterAll(async () => {
|
|
26
|
+
await client.wallet.destroy()
|
|
27
|
+
await server.server.close()
|
|
28
|
+
await server.setup.wallet.destroy()
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('0 repeatable createAction', async () => {
|
|
32
|
+
const storageClient = client.storage.getActive() as StorageClient
|
|
33
|
+
const u = await storageClient.findOrInsertUser(server.setup.identityKey)
|
|
34
|
+
expect(u).toBeTruthy()
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
test('1 repeatable createAction', async () => {
|
|
38
|
+
const wallet = client.wallet
|
|
39
|
+
//wallet.makeLogger = () => console
|
|
40
|
+
wallet.makeLogger = () => new WalletLogger()
|
|
41
|
+
wallet.randomVals = [0.1, 0.2, 0.3, 0.7, 0.8, 0.9]
|
|
42
|
+
const root = '02135476'
|
|
43
|
+
const kp = _tu.getKeyPair(root.repeat(8))
|
|
44
|
+
const createArgs: CreateActionArgs = {
|
|
45
|
+
description: `repeatable`,
|
|
46
|
+
outputs: [
|
|
47
|
+
{
|
|
48
|
+
satoshis: 45,
|
|
49
|
+
lockingScript: _tu.getLockP2PKH(kp.address).toHex(),
|
|
50
|
+
outputDescription: 'pay echo'
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
options: {
|
|
54
|
+
randomizeOutputs: false,
|
|
55
|
+
signAndProcess: true,
|
|
56
|
+
noSend: true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const cr = await wallet.createAction(createArgs)
|
|
61
|
+
expect(cr.txid === '4f428a93c43c2d120204ecdc06f7916be8a5f4542cc8839a0fd79bd1b44582f3')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
test('1a error createAction', async () => {
|
|
65
|
+
if (_tu.noEnv('main')) return
|
|
66
|
+
|
|
67
|
+
const wallet = client.wallet
|
|
68
|
+
//wallet.makeLogger = () => console
|
|
69
|
+
wallet.makeLogger = () => new WalletLogger()
|
|
70
|
+
wallet.randomVals = [0.1, 0.2, 0.3, 0.7, 0.8, 0.9]
|
|
71
|
+
const root = '02135476'
|
|
72
|
+
const kp = _tu.getKeyPair(root.repeat(8))
|
|
73
|
+
const createArgs: CreateActionArgs = {
|
|
74
|
+
description: `error`,
|
|
75
|
+
outputs: [
|
|
76
|
+
{
|
|
77
|
+
satoshis: 45,
|
|
78
|
+
lockingScript: _tu.getLockP2PKH(kp.address).toHex(),
|
|
79
|
+
outputDescription: 'pay echo'
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
options: {
|
|
83
|
+
randomizeOutputs: false,
|
|
84
|
+
signAndProcess: true,
|
|
85
|
+
noSend: false,
|
|
86
|
+
acceptDelayedBroadcast: false
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const cr = await wallet.createAction(createArgs)
|
|
91
|
+
expect(cr.txid === '4f428a93c43c2d120204ecdc06f7916be8a5f4542cc8839a0fd79bd1b44582f3')
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
async function createStorageServer(): Promise<{ setup: TestWalletNoSetup; server: StorageServer }> {
|
|
96
|
+
const setup = await _tu.createLegacyWalletSQLiteCopy('StorageClientTest')
|
|
97
|
+
|
|
98
|
+
const options: WalletStorageServerOptions = {
|
|
99
|
+
port: Number(8042),
|
|
100
|
+
wallet: setup.wallet,
|
|
101
|
+
monetize: false,
|
|
102
|
+
adminIdentityKeys: [],
|
|
103
|
+
calculateRequestPrice: async () => {
|
|
104
|
+
return 0 // Monetize your server here! Price is in satoshis.
|
|
105
|
+
},
|
|
106
|
+
makeLogger: (log?: string | WalletLoggerInterface) => new WalletLogger(log)
|
|
107
|
+
}
|
|
108
|
+
const server = new StorageServer(setup.activeStorage, options)
|
|
109
|
+
|
|
110
|
+
server.start()
|
|
111
|
+
|
|
112
|
+
return { setup, server }
|
|
113
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Utils } from '@bsv/sdk'
|
|
1
|
+
import { Utils, Validation } from '@bsv/sdk'
|
|
2
2
|
import { Knex } from 'knex'
|
|
3
3
|
import { StorageReader, StorageReaderOptions } from '../StorageReader'
|
|
4
4
|
import { TableSettings } from '../schema/tables/TableSettings'
|
|
@@ -46,7 +46,6 @@ import { asArray, asString } from '../../utility/utilityHelpers.buffer'
|
|
|
46
46
|
import { TableTxLabelMap } from '../schema/tables/TableTxLabelMap'
|
|
47
47
|
import { TableOutputTagMap } from '../schema/tables/TableOutputTagMap'
|
|
48
48
|
import { TableMonitorEvent } from '../schema/tables/TableMonitorEvent'
|
|
49
|
-
import { isHexString } from '../../sdk/validationHelpers'
|
|
50
49
|
|
|
51
50
|
export interface StorageMySQLDojoReaderOptions extends StorageReaderOptions {
|
|
52
51
|
chain: Chain
|
|
@@ -692,6 +691,6 @@ function convertSyncStatus(status: DojoSyncStatus): SyncStatus {
|
|
|
692
691
|
|
|
693
692
|
function forceToBase64(s?: string | null): string {
|
|
694
693
|
if (!s) return randomBytesBase64(12)
|
|
695
|
-
if (isHexString(s)) return Utils.toBase64(asArray(s.trim()))
|
|
694
|
+
if (Validation.isHexString(s)) return Utils.toBase64(asArray(s.trim()))
|
|
696
695
|
return s.trim()
|
|
697
696
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OriginatorDomainNameStringUnder250Bytes } from '@bsv/sdk'
|
|
1
|
+
import { OriginatorDomainNameStringUnder250Bytes, Validation } from '@bsv/sdk'
|
|
2
2
|
import { listCertificates } from '../../../src/storage/methods/listCertificates'
|
|
3
3
|
import { StorageProvider } from '../../../src/storage/StorageProvider'
|
|
4
4
|
import { sdk, TableCertificate, TableCertificateField } from '../../../src/index.all'
|
|
@@ -11,7 +11,7 @@ describe('listCertificates', () => {
|
|
|
11
11
|
let auth: sdk.AuthId
|
|
12
12
|
|
|
13
13
|
// This is a valid, minimal set of arguments for listCertificates
|
|
14
|
-
let vargs:
|
|
14
|
+
let vargs: Validation.ValidListCertificatesArgs
|
|
15
15
|
let originator: OriginatorDomainNameStringUnder250Bytes | undefined
|
|
16
16
|
|
|
17
17
|
// Helper so we can easily mock the transaction call
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Beef, PrivateKey, SignActionArgs, WalletOutput } from '@bsv/sdk'
|
|
2
|
-
import { sdk,
|
|
3
|
-
import { _tu
|
|
4
|
-
import { specOpInvalidChange,
|
|
1
|
+
import { Beef, PrivateKey, SignActionArgs, WalletOutput, Validation } from '@bsv/sdk'
|
|
2
|
+
import { sdk, Setup, TableUser } from '../../../src'
|
|
3
|
+
import { _tu } from '../../utils/TestUtilsWalletStorage'
|
|
4
|
+
import { specOpInvalidChange, WERR_REVIEW_ACTIONS } from '../../../src/sdk'
|
|
5
5
|
import {
|
|
6
6
|
burnOneSatTestOutput,
|
|
7
7
|
createMainReviewSetup,
|
|
@@ -104,7 +104,7 @@ describe('localWallet2 tests', () => {
|
|
|
104
104
|
const users = await storage.findUsers({ partial: {} })
|
|
105
105
|
const withInvalid: Record<number, { user: TableUser; outputs: WalletOutput[]; total: number }> = {}
|
|
106
106
|
// [76, 48, 166, 94, 110, 111, 81]
|
|
107
|
-
const vargs: ValidListOutputsArgs = {
|
|
107
|
+
const vargs: Validation.ValidListOutputsArgs = {
|
|
108
108
|
basket: specOpInvalidChange,
|
|
109
109
|
tags: [],
|
|
110
110
|
tagQueryMode: 'all',
|
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
Transaction,
|
|
9
9
|
TransactionSignature,
|
|
10
10
|
UnlockingScript,
|
|
11
|
-
Utils
|
|
11
|
+
Utils,
|
|
12
|
+
Validation
|
|
12
13
|
} from '@bsv/sdk'
|
|
13
14
|
import { Setup, verifyInteger, verifyTruthy, Wallet } from '../../../src'
|
|
14
|
-
|
|
15
|
+
const parseWalletOutpoint = Validation.parseWalletOutpoint
|
|
15
16
|
|
|
16
17
|
describe('mountaintop tests', () => {
|
|
17
18
|
jest.setTimeout(99999999)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Beef, MerklePath, Transaction,
|
|
2
|
-
import {
|
|
1
|
+
import { Beef, MerklePath, Transaction, WalletOutput, Validation, Utils } from '@bsv/sdk'
|
|
2
|
+
import { TableOutput, TableUser, verifyOne, verifyOneOrNone } from '../../../src'
|
|
3
3
|
import { _tu, logger } from '../../utils/TestUtilsWalletStorage'
|
|
4
|
-
import { specOpInvalidChange
|
|
5
|
-
import { LocalWalletTestOptions } from '../../utils/localWalletMethods'
|
|
4
|
+
import { specOpInvalidChange } from '../../../src/sdk'
|
|
6
5
|
import { Format } from '../../../src/utility/Format'
|
|
7
6
|
import { asString } from '../../../src/utility/utilityHelpers.noBuffer'
|
|
8
7
|
|
|
@@ -13,7 +12,7 @@ describe('operations.man tests', () => {
|
|
|
13
12
|
const { env, storage } = await _tu.createMainReviewSetup()
|
|
14
13
|
const users = await storage.findUsers({ partial: { userId: 124 } })
|
|
15
14
|
const withInvalid: Record<number, { user: TableUser; outputs: WalletOutput[]; total: number }> = {}
|
|
16
|
-
const vargs: ValidListOutputsArgs = {
|
|
15
|
+
const vargs: Validation.ValidListOutputsArgs = {
|
|
17
16
|
basket: specOpInvalidChange,
|
|
18
17
|
tags: ['release'],
|
|
19
18
|
tagQueryMode: 'all',
|
|
@@ -298,7 +297,7 @@ describe('operations.man tests', () => {
|
|
|
298
297
|
await storage.destroy()
|
|
299
298
|
})
|
|
300
299
|
|
|
301
|
-
test('14 review inputs of tx
|
|
300
|
+
test('14 review utxo status of inputs of tx', async () => {
|
|
302
301
|
const { env, storage, services } = await _tu.createMainReviewSetup()
|
|
303
302
|
|
|
304
303
|
const tx = Transaction.fromHex(testTxInputUtxoStatus)
|
|
@@ -327,6 +326,66 @@ describe('operations.man tests', () => {
|
|
|
327
326
|
await storage.destroy()
|
|
328
327
|
})
|
|
329
328
|
|
|
329
|
+
test('14a review utxo status of custom spentBy null spendable false outputs', async () => {
|
|
330
|
+
const { env, storage, services } = await _tu.createMainReviewSetup()
|
|
331
|
+
|
|
332
|
+
let offset = 0
|
|
333
|
+
const limit = 100
|
|
334
|
+
|
|
335
|
+
for (;;) {
|
|
336
|
+
let validOutputIds: number[] = []
|
|
337
|
+
|
|
338
|
+
let log = `offset ${offset}\n`
|
|
339
|
+
// select count(*)
|
|
340
|
+
// and o.lockingScript is null
|
|
341
|
+
// and o.txid = '533e50fba3fca9b08845fc46ae3df81713129876faddf84f9d26d4185dea8324'
|
|
342
|
+
const outputs: {
|
|
343
|
+
outputId: number
|
|
344
|
+
txid: string
|
|
345
|
+
vout: number
|
|
346
|
+
lockingScript: number[]
|
|
347
|
+
scriptOffset: number
|
|
348
|
+
scriptLength: number
|
|
349
|
+
}[] = (
|
|
350
|
+
await storage.knex.raw(`
|
|
351
|
+
select o.outputId, o.txid, o.vout, o.lockingScript, o.scriptOffset, o.scriptLength
|
|
352
|
+
from outputs o, transactions t
|
|
353
|
+
where o.transactionId = t.transactionId
|
|
354
|
+
and o.type = 'custom' and o.spentBy is null and o.spendable = 0
|
|
355
|
+
and t.status = 'completed'
|
|
356
|
+
limit ${limit}
|
|
357
|
+
offset ${offset}
|
|
358
|
+
`)
|
|
359
|
+
)[0]
|
|
360
|
+
|
|
361
|
+
for (const { outputId, txid, vout, lockingScript, scriptOffset, scriptLength } of outputs) {
|
|
362
|
+
let script: number[] | null | undefined = lockingScript
|
|
363
|
+
if (!lockingScript) {
|
|
364
|
+
script = await storage.getRawTxOfKnownValidTransaction(txid, scriptOffset, scriptLength)
|
|
365
|
+
}
|
|
366
|
+
expect(script).toBeTruthy()
|
|
367
|
+
const hex = Utils.toHex(script!)
|
|
368
|
+
const hash = services.hashOutputScript(hex)
|
|
369
|
+
const outpoint = `${txid}.${vout}`
|
|
370
|
+
const or = await services.getUtxoStatus(hash, undefined, outpoint)
|
|
371
|
+
if (or.isUtxo && or.status === 'success') {
|
|
372
|
+
log += `${outpoint} ${or.isUtxo} ${or.status}\n`
|
|
373
|
+
validOutputIds.push(outputId)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
log += `offset ${offset}\n`
|
|
377
|
+
logger(log)
|
|
378
|
+
|
|
379
|
+
for (const outputId of validOutputIds) {
|
|
380
|
+
await storage.updateOutput(outputId, { spendable: true })
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (outputs.length < limit) break
|
|
384
|
+
offset += limit
|
|
385
|
+
}
|
|
386
|
+
await storage.destroy()
|
|
387
|
+
})
|
|
388
|
+
|
|
330
389
|
test('15 abort a transaction', async () => {
|
|
331
390
|
const { env, storage } = await _tu.createMainReviewSetup()
|
|
332
391
|
const refOrTxid = '42671b6c9b79cec03bf5be9105203589b8b092774a40b459fbd835e5fd582202'
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import { Beef, Transaction
|
|
2
|
-
import {
|
|
3
|
-
EntityProvenTxReq,
|
|
4
|
-
sdk,
|
|
5
|
-
Services,
|
|
6
|
-
Setup,
|
|
7
|
-
StorageKnex,
|
|
8
|
-
TableOutput,
|
|
9
|
-
TableProvenTxReq,
|
|
10
|
-
TableUser,
|
|
11
|
-
verifyOne,
|
|
12
|
-
verifyOneOrNone
|
|
13
|
-
} from '../../../src'
|
|
1
|
+
import { Beef, Transaction } from '@bsv/sdk'
|
|
2
|
+
import { EntityProvenTxReq, sdk, TableProvenTxReq, verifyOneOrNone } from '../../../src'
|
|
14
3
|
import { _tu, TuEnv } from '../../utils/TestUtilsWalletStorage'
|
|
15
|
-
import { specOpInvalidChange, ValidListOutputsArgs } from '../../../src/sdk'
|
|
16
4
|
import { LocalWalletTestOptions } from '../../utils/localWalletMethods'
|
|
17
5
|
import { Format } from '../../../src/utility/Format'
|
|
18
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CreateActionArgs, WalletClient } from '@bsv/sdk'
|
|
1
|
+
import { Validation as V, CreateActionArgs, WalletClient } from '@bsv/sdk'
|
|
2
2
|
import { specOpThrowReviewActions } from '../../src/sdk/types'
|
|
3
3
|
import { WalletError } from '../../src/sdk/WalletError'
|
|
4
4
|
import { WERR_REVIEW_ACTIONS } from '../../src/sdk/WERR_errors'
|
|
5
|
-
import {
|
|
5
|
+
import { WalletErrorFromJson } from '../../src/sdk'
|
|
6
6
|
|
|
7
7
|
describe('WERR.man tests', () => {
|
|
8
8
|
jest.setTimeout(99999999)
|
|
@@ -14,7 +14,7 @@ describe('WERR.man tests', () => {
|
|
|
14
14
|
labels: [specOpThrowReviewActions],
|
|
15
15
|
description: 'must throw'
|
|
16
16
|
}
|
|
17
|
-
const vargs = validateCreateActionArgs(args)
|
|
17
|
+
const vargs = V.validateCreateActionArgs(args)
|
|
18
18
|
|
|
19
19
|
try {
|
|
20
20
|
const r = await wallet.createAction(args)
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
Script,
|
|
10
10
|
SignActionArgs,
|
|
11
11
|
SignActionOptions,
|
|
12
|
-
SignActionResult
|
|
12
|
+
SignActionResult,
|
|
13
|
+
Validation
|
|
13
14
|
} from '@bsv/sdk'
|
|
14
15
|
import {
|
|
15
16
|
EntityProvenTxReq,
|
|
@@ -23,7 +24,6 @@ import {
|
|
|
23
24
|
wait
|
|
24
25
|
} from '../../src'
|
|
25
26
|
import { _tu, logger, TestWalletNoSetup, TuEnv } from './TestUtilsWalletStorage'
|
|
26
|
-
import { validateCreateActionArgs, ValidCreateActionArgs } from '../../src/sdk'
|
|
27
27
|
import { setDisableDoubleSpendCheckForTest } from '../../src/storage/methods/createAction'
|
|
28
28
|
|
|
29
29
|
export interface LocalWalletTestOptions {
|
|
@@ -133,7 +133,7 @@ export async function createOneSatTestOutput(
|
|
|
133
133
|
|
|
134
134
|
let noSendChange: OutpointString[] | undefined = undefined
|
|
135
135
|
let txids: string[] = []
|
|
136
|
-
let vargs: ValidCreateActionArgs
|
|
136
|
+
let vargs: Validation.ValidCreateActionArgs
|
|
137
137
|
|
|
138
138
|
for (let i = 0; i < howMany; i++) {
|
|
139
139
|
const args: CreateActionArgs = {
|
|
@@ -155,7 +155,7 @@ export async function createOneSatTestOutput(
|
|
|
155
155
|
noSendChange
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
vargs = validateCreateActionArgs(args)
|
|
158
|
+
vargs = Validation.validateCreateActionArgs(args)
|
|
159
159
|
car = await setup.wallet.createAction(args)
|
|
160
160
|
expect(car.txid)
|
|
161
161
|
txids.push(car.txid!)
|
|
@@ -187,7 +187,7 @@ export async function createOneSatTestOutput(
|
|
|
187
187
|
sendWith: txids
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
vargs = validateCreateActionArgs(args)
|
|
190
|
+
vargs = Validation.validateCreateActionArgs(args)
|
|
191
191
|
car = await setup.wallet.createAction(args)
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { AtomicBEEF, Beef, CreateActionArgs, SignActionArgs } from '@bsv/sdk'
|
|
3
3
|
import { sdk, StorageKnex } from '../../../src/index.all'
|
|
4
4
|
import { _tu, expectToThrowWERR, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
|
|
5
|
+
import { WalletLogger } from '../../../src/WalletLogger'
|
|
5
6
|
|
|
6
7
|
const includeTestChaintracks = false
|
|
7
8
|
const noLog = true
|
|
@@ -69,6 +70,8 @@ describe('createAction test', () => {
|
|
|
69
70
|
|
|
70
71
|
test('1_repeatable txid', async () => {
|
|
71
72
|
for (const { wallet } of ctxs) {
|
|
73
|
+
//wallet.makeLogger = () => console
|
|
74
|
+
wallet.makeLogger = () => new WalletLogger()
|
|
72
75
|
wallet.randomVals = [0.1, 0.2, 0.3, 0.7, 0.8, 0.9]
|
|
73
76
|
const root = '02135476'
|
|
74
77
|
const kp = _tu.getKeyPair(root.repeat(8))
|