@bsv/wallet-toolbox 1.1.7 → 1.1.9
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/docs/client.md +3872 -1555
- package/docs/monitor.md +29 -27
- package/docs/services.md +22 -22
- package/docs/setup.md +23 -23
- package/docs/storage.md +2747 -438
- package/docs/wallet.md +3872 -1555
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +4 -4
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.js +2 -2
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts +2 -2
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.js +2 -2
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
- package/out/src/sdk/StorageSyncReader.d.ts +30 -30
- package/out/src/sdk/StorageSyncReader.d.ts.map +1 -1
- package/out/src/sdk/StorageSyncReaderWriter.d.ts +60 -60
- package/out/src/sdk/StorageSyncReaderWriter.d.ts.map +1 -1
- package/out/src/sdk/WalletStorage.interfaces.d.ts +36 -36
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
- package/out/src/storage/StorageKnex.d.ts +61 -61
- package/out/src/storage/StorageKnex.d.ts.map +1 -1
- package/out/src/storage/StorageKnex.js +13 -4
- package/out/src/storage/StorageKnex.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts +16 -15
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +8 -8
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/StorageReader.d.ts +21 -21
- 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 +60 -60
- 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 +17 -17
- 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 +9 -9
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.js +2 -2
- package/out/src/storage/WalletStorageManager.js.map +1 -1
- package/out/src/storage/index.all.d.ts +2 -2
- package/out/src/storage/index.all.d.ts.map +1 -1
- package/out/src/storage/index.all.js +3 -3
- package/out/src/storage/index.all.js.map +1 -1
- package/out/src/storage/index.client.d.ts +2 -2
- package/out/src/storage/index.client.d.ts.map +1 -1
- package/out/src/storage/index.client.js +2 -25
- package/out/src/storage/index.client.js.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +3 -3
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- 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 +1 -1
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/methods/getBeefForTransaction.js +2 -2
- 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 +1 -1
- package/out/src/storage/methods/internalizeAction.js.map +1 -1
- 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.js.map +1 -1
- package/out/src/storage/methods/processAction.d.ts +4 -4
- package/out/src/storage/methods/processAction.d.ts.map +1 -1
- package/out/src/storage/methods/processAction.js +2 -2
- 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.map +1 -1
- package/out/src/storage/methods/reviewStatus.js.map +1 -1
- package/out/src/storage/remoting/StorageClient.d.ts +230 -15
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageClient.js +222 -7
- package/out/src/storage/remoting/StorageClient.js.map +1 -1
- package/out/src/storage/schema/entities/Certificate.d.ts +9 -9
- package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Certificate.js +5 -5
- package/out/src/storage/schema/entities/Certificate.js.map +1 -1
- package/out/src/storage/schema/entities/CertificateField.d.ts +9 -9
- package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/entities/CertificateField.js +5 -5
- package/out/src/storage/schema/entities/CertificateField.js.map +1 -1
- package/out/src/storage/schema/entities/Commission.d.ts +9 -9
- package/out/src/storage/schema/entities/Commission.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Commission.js +5 -5
- package/out/src/storage/schema/entities/Commission.js.map +1 -1
- package/out/src/storage/schema/entities/EntityBase.d.ts +1 -1
- package/out/src/storage/schema/entities/MergeEntity.d.ts +6 -7
- package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
- package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
- package/out/src/storage/schema/entities/Output.d.ts +9 -9
- package/out/src/storage/schema/entities/Output.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Output.js +5 -5
- package/out/src/storage/schema/entities/Output.js.map +1 -1
- package/out/src/storage/schema/entities/OutputBasket.d.ts +9 -9
- package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputBasket.js +5 -5
- package/out/src/storage/schema/entities/OutputBasket.js.map +1 -1
- package/out/src/storage/schema/entities/OutputTag.d.ts +9 -9
- package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputTag.js +5 -5
- package/out/src/storage/schema/entities/OutputTag.js.map +1 -1
- package/out/src/storage/schema/entities/OutputTagMap.d.ts +9 -9
- package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputTagMap.js +5 -5
- package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -1
- package/out/src/storage/schema/entities/ProvenTx.d.ts +11 -11
- package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/entities/ProvenTx.js +11 -11
- package/out/src/storage/schema/entities/ProvenTx.js.map +1 -1
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts +19 -19
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/entities/ProvenTxReq.js +13 -13
- package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -1
- package/out/src/storage/schema/entities/SyncState.d.ts +11 -11
- package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -1
- package/out/src/storage/schema/entities/SyncState.js +27 -27
- package/out/src/storage/schema/entities/SyncState.js.map +1 -1
- package/out/src/storage/schema/entities/Transaction.d.ts +11 -11
- package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Transaction.js +6 -6
- package/out/src/storage/schema/entities/Transaction.js.map +1 -1
- package/out/src/storage/schema/entities/TxLabel.d.ts +9 -9
- package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/entities/TxLabel.js +5 -5
- package/out/src/storage/schema/entities/TxLabel.js.map +1 -1
- package/out/src/storage/schema/entities/TxLabelMap.d.ts +9 -9
- package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/TxLabelMap.js +5 -5
- package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -1
- package/out/src/storage/schema/entities/User.d.ts +9 -9
- package/out/src/storage/schema/entities/User.d.ts.map +1 -1
- package/out/src/storage/schema/entities/User.js +5 -5
- package/out/src/storage/schema/entities/User.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js +20 -307
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js +17 -158
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js +23 -309
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js +19 -306
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js +19 -306
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js +23 -237
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js +20 -233
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js +27 -98
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +25 -241
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js +38 -112
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +39 -323
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js +31 -169
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js +16 -159
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/usersTests.test.js +21 -168
- package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -1
- package/out/src/storage/schema/tables/Certificate.d.ts +4 -4
- package/out/src/storage/schema/tables/Certificate.d.ts.map +1 -1
- package/out/src/storage/schema/tables/CertificateField.d.ts +1 -1
- package/out/src/storage/schema/tables/CertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/tables/Commission.d.ts +1 -1
- package/out/src/storage/schema/tables/Commission.d.ts.map +1 -1
- package/out/src/storage/schema/tables/MonitorEvent.d.ts +1 -1
- package/out/src/storage/schema/tables/MonitorEvent.d.ts.map +1 -1
- package/out/src/storage/schema/tables/Output.d.ts +5 -5
- package/out/src/storage/schema/tables/Output.d.ts.map +1 -1
- package/out/src/storage/schema/tables/OutputBasket.d.ts +1 -1
- package/out/src/storage/schema/tables/OutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/tables/OutputTag.d.ts +1 -1
- package/out/src/storage/schema/tables/OutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/tables/OutputTagMap.d.ts +1 -1
- package/out/src/storage/schema/tables/OutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/tables/ProvenTx.d.ts +1 -1
- package/out/src/storage/schema/tables/ProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts +2 -2
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/tables/SyncState.d.ts +1 -1
- package/out/src/storage/schema/tables/SyncState.d.ts.map +1 -1
- package/out/src/storage/schema/tables/{Settings.d.ts → TableSettings.d.ts} +2 -2
- package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -0
- package/out/src/storage/schema/tables/{Settings.js → TableSettings.js} +1 -1
- package/out/src/storage/schema/tables/TableSettings.js.map +1 -0
- package/out/src/storage/schema/tables/Transaction.d.ts +1 -1
- package/out/src/storage/schema/tables/Transaction.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TxLabel.d.ts +1 -1
- package/out/src/storage/schema/tables/TxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TxLabelMap.d.ts +1 -1
- package/out/src/storage/schema/tables/TxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/tables/User.d.ts +1 -1
- package/out/src/storage/schema/tables/User.d.ts.map +1 -1
- package/out/src/storage/schema/tables/index.d.ts +1 -1
- package/out/src/storage/schema/tables/index.d.ts.map +1 -1
- package/out/src/storage/schema/tables/index.js +1 -1
- package/out/src/storage/schema/tables/index.js.map +1 -1
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts +17 -17
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
- package/out/src/storage/sync/StorageMySQLDojoReader.js +2 -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/live/walletLive.man.test.js +1 -1
- package/out/test/Wallet/live/walletLive.man.test.js.map +1 -1
- package/out/test/monitor/Monitor.test.js +7 -7
- package/out/test/monitor/Monitor.test.js.map +1 -1
- package/out/test/storage/StorageMySQLDojoReader.man.test.js +1 -1
- package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -1
- package/out/test/storage/insert.test.js.map +1 -1
- package/out/test/storage/update.test.js.map +1 -1
- package/out/test/storage/update2.test.js.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.d.ts +56 -56
- package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.js +11 -4
- package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/monitor/tasks/TaskCheckForProofs.ts +11 -10
- package/src/monitor/tasks/TaskSendWaiting.ts +5 -5
- package/src/sdk/StorageSyncReader.ts +48 -30
- package/src/sdk/StorageSyncReaderWriter.ts +77 -63
- package/src/sdk/WalletStorage.interfaces.ts +55 -36
- package/src/signer/methods/acquireDirectCertificate.ts +2 -2
- package/src/storage/StorageKnex.ts +137 -106
- package/src/storage/StorageProvider.ts +43 -30
- package/src/storage/StorageReader.ts +37 -21
- package/src/storage/StorageReaderWriter.ts +78 -65
- package/src/storage/StorageSyncReader.ts +35 -17
- package/src/storage/WalletStorageManager.ts +18 -12
- package/src/storage/index.all.ts +2 -2
- package/src/storage/index.client.ts +2 -2
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +3 -3
- package/src/storage/methods/createAction.ts +29 -26
- package/src/storage/methods/getBeefForTransaction.ts +3 -3
- package/src/storage/methods/getSyncChunk.ts +28 -13
- package/src/storage/methods/internalizeAction.ts +19 -17
- package/src/storage/methods/listActions.ts +5 -5
- package/src/storage/methods/listCertificates.ts +2 -2
- package/src/storage/methods/listOutputs.ts +5 -5
- package/src/storage/methods/processAction.ts +21 -17
- package/src/storage/methods/purgeData.ts +17 -11
- package/src/storage/methods/reviewStatus.ts +4 -4
- package/src/storage/remoting/StorageClient.ts +250 -26
- package/src/storage/schema/entities/Certificate.ts +16 -17
- package/src/storage/schema/entities/CertificateField.ts +17 -18
- package/src/storage/schema/entities/Commission.ts +16 -20
- package/src/storage/schema/entities/EntityBase.ts +1 -1
- package/src/storage/schema/entities/MergeEntity.ts +7 -7
- package/src/storage/schema/entities/Output.ts +16 -20
- package/src/storage/schema/entities/OutputBasket.ts +16 -17
- package/src/storage/schema/entities/OutputTag.ts +16 -20
- package/src/storage/schema/entities/OutputTagMap.ts +17 -18
- package/src/storage/schema/entities/ProvenTx.ts +24 -28
- package/src/storage/schema/entities/ProvenTxReq.ts +42 -45
- package/src/storage/schema/entities/SyncState.ts +61 -38
- package/src/storage/schema/entities/Transaction.ts +23 -23
- package/src/storage/schema/entities/TxLabel.ts +16 -17
- package/src/storage/schema/entities/TxLabelMap.ts +16 -20
- package/src/storage/schema/entities/User.ts +15 -19
- package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +39 -318
- package/src/storage/schema/entities/__tests/CertificateTests.test.ts +29 -169
- package/src/storage/schema/entities/__tests/CommissionTests.test.ts +47 -325
- package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +35 -316
- package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +38 -318
- package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +36 -249
- package/src/storage/schema/entities/__tests/OutputTests.test.ts +30 -244
- package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +35 -101
- package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +27 -243
- package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +54 -122
- package/src/storage/schema/entities/__tests/TransactionTests.test.ts +53 -333
- package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +44 -177
- package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +19 -163
- package/src/storage/schema/entities/__tests/usersTests.test.ts +31 -179
- package/src/storage/schema/tables/Certificate.ts +4 -4
- package/src/storage/schema/tables/CertificateField.ts +1 -1
- package/src/storage/schema/tables/Commission.ts +1 -1
- package/src/storage/schema/tables/MonitorEvent.ts +1 -1
- package/src/storage/schema/tables/Output.ts +5 -5
- package/src/storage/schema/tables/OutputBasket.ts +1 -1
- package/src/storage/schema/tables/OutputTag.ts +1 -1
- package/src/storage/schema/tables/OutputTagMap.ts +1 -1
- package/src/storage/schema/tables/ProvenTx.ts +1 -1
- package/src/storage/schema/tables/ProvenTxReq.ts +2 -2
- package/src/storage/schema/tables/SyncState.ts +1 -1
- package/src/storage/schema/tables/{Settings.ts → TableSettings.ts} +3 -1
- package/src/storage/schema/tables/Transaction.ts +1 -1
- package/src/storage/schema/tables/TxLabel.ts +1 -1
- package/src/storage/schema/tables/TxLabelMap.ts +1 -1
- package/src/storage/schema/tables/User.ts +1 -1
- package/src/storage/schema/tables/index.ts +1 -1
- package/src/storage/sync/StorageMySQLDojoReader.ts +68 -50
- package/test/Wallet/certificate/listCertificates.test.ts +12 -8
- package/test/Wallet/live/walletLive.man.test.ts +6 -6
- package/test/monitor/Monitor.test.ts +8 -8
- package/test/storage/StorageMySQLDojoReader.man.test.ts +1 -1
- package/test/storage/insert.test.ts +2 -2
- package/test/storage/update.test.ts +30 -30
- package/test/storage/update2.test.ts +23 -24
- package/test/utils/TestUtilsWalletStorage.ts +103 -82
- package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +1 -2
- package/ts2md.json +1 -1
- package/out/src/storage/index.db.d.ts +0 -1
- package/out/src/storage/index.db.d.ts.map +0 -1
- package/out/src/storage/index.db.js +0 -2
- package/out/src/storage/index.db.js.map +0 -1
- package/out/src/storage/schema/tables/Settings.d.ts.map +0 -1
- package/out/src/storage/schema/tables/Settings.js.map +0 -1
- package/src/storage/index.db.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './WalletStorageManager'
|
|
2
2
|
export * from './StorageProvider'
|
|
3
3
|
export * from './StorageSyncReader'
|
|
4
|
-
export *
|
|
5
|
-
export *
|
|
4
|
+
export * from './schema/tables/index'
|
|
5
|
+
export * from './schema/entities/index'
|
|
6
6
|
export * from './remoting/StorageClient'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Beef } from '@bsv/sdk'
|
|
2
2
|
import { StorageProvider } from '../StorageProvider'
|
|
3
|
-
import {
|
|
3
|
+
import { EntityProvenTxReq, sdk } from '../../index.client'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Attempt to post one or more `ProvenTxReq` with status 'unsent'
|
|
@@ -10,7 +10,7 @@ import { entity, sdk } from '../../index.client'
|
|
|
10
10
|
*/
|
|
11
11
|
export async function attemptToPostReqsToNetwork(
|
|
12
12
|
storage: StorageProvider,
|
|
13
|
-
reqs:
|
|
13
|
+
reqs: EntityProvenTxReq[],
|
|
14
14
|
trx?: sdk.TrxToken
|
|
15
15
|
): Promise<PostReqsToNetworkResult> {
|
|
16
16
|
const r: PostReqsToNetworkResult = {
|
|
@@ -169,7 +169,7 @@ export type PostReqsToNetworkDetailsStatus =
|
|
|
169
169
|
|
|
170
170
|
export interface PostReqsToNetworkDetails {
|
|
171
171
|
txid: string
|
|
172
|
-
req:
|
|
172
|
+
req: EntityProvenTxReq
|
|
173
173
|
status: PostReqsToNetworkDetailsStatus
|
|
174
174
|
pbrft: sdk.PostTxResultForTxid
|
|
175
175
|
data?: string
|
|
@@ -14,14 +14,17 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
asArray,
|
|
16
16
|
asString,
|
|
17
|
-
|
|
17
|
+
EntityProvenTx,
|
|
18
18
|
randomBytesBase64,
|
|
19
19
|
sdk,
|
|
20
20
|
sha256Hash,
|
|
21
21
|
stampLog,
|
|
22
22
|
stampLogFormat,
|
|
23
23
|
StorageProvider,
|
|
24
|
-
|
|
24
|
+
TableOutput,
|
|
25
|
+
TableOutputBasket,
|
|
26
|
+
TableOutputTag,
|
|
27
|
+
TableTransaction,
|
|
25
28
|
validateStorageFeeModel,
|
|
26
29
|
verifyId,
|
|
27
30
|
verifyNumber,
|
|
@@ -157,8 +160,8 @@ export async function createAction(
|
|
|
157
160
|
interface CreateTransactionSdkContext {
|
|
158
161
|
xinputs: XValidCreateActionInput[]
|
|
159
162
|
xoutputs: XValidCreateActionOutput[]
|
|
160
|
-
changeBasket:
|
|
161
|
-
noSendChangeIn:
|
|
163
|
+
changeBasket: TableOutputBasket
|
|
164
|
+
noSendChangeIn: TableOutput[]
|
|
162
165
|
availableChangeCount: number
|
|
163
166
|
feeModel: sdk.StorageFeeModel
|
|
164
167
|
transactionId: number
|
|
@@ -168,7 +171,7 @@ interface XValidCreateActionInput extends sdk.ValidCreateActionInput {
|
|
|
168
171
|
vin: number
|
|
169
172
|
lockingScript: Script
|
|
170
173
|
satoshis: number
|
|
171
|
-
output?:
|
|
174
|
+
output?: TableOutput
|
|
172
175
|
}
|
|
173
176
|
|
|
174
177
|
export interface XValidCreateActionOutput extends sdk.ValidCreateActionOutput {
|
|
@@ -184,9 +187,9 @@ function makeDefaultOutput(
|
|
|
184
187
|
transactionId: number,
|
|
185
188
|
satoshis: number,
|
|
186
189
|
vout: number
|
|
187
|
-
):
|
|
190
|
+
): TableOutput {
|
|
188
191
|
const now = new Date()
|
|
189
|
-
const output:
|
|
192
|
+
const output: TableOutput = {
|
|
190
193
|
created_at: now,
|
|
191
194
|
updated_at: now,
|
|
192
195
|
outputId: 0,
|
|
@@ -219,13 +222,13 @@ async function createNewInputs(
|
|
|
219
222
|
userId: number,
|
|
220
223
|
vargs: sdk.ValidCreateActionArgs,
|
|
221
224
|
ctx: CreateTransactionSdkContext,
|
|
222
|
-
allocatedChange:
|
|
225
|
+
allocatedChange: TableOutput[]
|
|
223
226
|
): Promise<sdk.StorageCreateTransactionSdkInput[]> {
|
|
224
227
|
const r: sdk.StorageCreateTransactionSdkInput[] = []
|
|
225
228
|
|
|
226
229
|
const newInputs: {
|
|
227
230
|
i?: XValidCreateActionInput
|
|
228
|
-
o?:
|
|
231
|
+
o?: TableOutput
|
|
229
232
|
unlockLen?: number
|
|
230
233
|
}[] = []
|
|
231
234
|
for (const i of ctx.xinputs) {
|
|
@@ -298,7 +301,7 @@ async function createNewOutputs(
|
|
|
298
301
|
userId: number,
|
|
299
302
|
vargs: sdk.ValidCreateActionArgs,
|
|
300
303
|
ctx: CreateTransactionSdkContext,
|
|
301
|
-
changeOutputs:
|
|
304
|
+
changeOutputs: TableOutput[]
|
|
302
305
|
): Promise<{
|
|
303
306
|
outputs: sdk.StorageCreateTransactionSdkOutput[]
|
|
304
307
|
changeVouts: number[]
|
|
@@ -306,7 +309,7 @@ async function createNewOutputs(
|
|
|
306
309
|
const outputs: sdk.StorageCreateTransactionSdkOutput[] = []
|
|
307
310
|
|
|
308
311
|
// Lookup output baskets
|
|
309
|
-
const txBaskets: Record<string,
|
|
312
|
+
const txBaskets: Record<string, TableOutputBasket> = {}
|
|
310
313
|
for (const xo of ctx.xoutputs) {
|
|
311
314
|
if (xo.basket !== undefined && !txBaskets[xo.basket])
|
|
312
315
|
txBaskets[xo.basket] = await storage.findOrInsertOutputBasket(
|
|
@@ -315,14 +318,14 @@ async function createNewOutputs(
|
|
|
315
318
|
)
|
|
316
319
|
}
|
|
317
320
|
// Lookup output tags
|
|
318
|
-
const txTags: Record<string,
|
|
321
|
+
const txTags: Record<string, TableOutputTag> = {}
|
|
319
322
|
for (const xo of ctx.xoutputs) {
|
|
320
323
|
for (const tag of xo.tags) {
|
|
321
324
|
txTags[tag] = await storage.findOrInsertOutputTag(userId, tag)
|
|
322
325
|
}
|
|
323
326
|
}
|
|
324
327
|
|
|
325
|
-
const newOutputs: { o:
|
|
328
|
+
const newOutputs: { o: TableOutput; tags: string[] }[] = []
|
|
326
329
|
|
|
327
330
|
for (const xo of ctx.xoutputs) {
|
|
328
331
|
const lockingScript = asArray(xo.lockingScript)
|
|
@@ -463,9 +466,9 @@ async function createNewTxRecord(
|
|
|
463
466
|
userId: number,
|
|
464
467
|
vargs: sdk.ValidCreateActionArgs,
|
|
465
468
|
storageBeef: Beef
|
|
466
|
-
): Promise<
|
|
469
|
+
): Promise<TableTransaction> {
|
|
467
470
|
const now = new Date()
|
|
468
|
-
const newTx:
|
|
471
|
+
const newTx: TableTransaction = {
|
|
469
472
|
created_at: now,
|
|
470
473
|
updated_at: now,
|
|
471
474
|
transactionId: 0,
|
|
@@ -695,7 +698,7 @@ async function validateRequiredInputs(
|
|
|
695
698
|
`valid and contain proof data for ${txid}`
|
|
696
699
|
)
|
|
697
700
|
btx = beef.mergeRawTx(asArray(rawTx))
|
|
698
|
-
if (proven) beef.mergeBump(new
|
|
701
|
+
if (proven) beef.mergeBump(new EntityProvenTx(proven).getMerklePath())
|
|
699
702
|
}
|
|
700
703
|
// btx is valid has parsed transaction data.
|
|
701
704
|
if (vout >= btx.tx.outputs.length)
|
|
@@ -716,9 +719,9 @@ async function validateNoSendChange(
|
|
|
716
719
|
storage: StorageProvider,
|
|
717
720
|
userId: number,
|
|
718
721
|
vargs: sdk.ValidCreateActionArgs,
|
|
719
|
-
changeBasket:
|
|
720
|
-
): Promise<
|
|
721
|
-
const r:
|
|
722
|
+
changeBasket: TableOutputBasket
|
|
723
|
+
): Promise<TableOutput[]> {
|
|
724
|
+
const r: TableOutput[] = []
|
|
722
725
|
|
|
723
726
|
if (!vargs.isNoSend) return []
|
|
724
727
|
|
|
@@ -761,8 +764,8 @@ async function fundNewTransactionSdk(
|
|
|
761
764
|
vargs: sdk.ValidCreateActionArgs,
|
|
762
765
|
ctx: CreateTransactionSdkContext
|
|
763
766
|
): Promise<{
|
|
764
|
-
allocatedChange:
|
|
765
|
-
changeOutputs:
|
|
767
|
+
allocatedChange: TableOutput[]
|
|
768
|
+
changeOutputs: TableOutput[]
|
|
766
769
|
derivationPrefix: string
|
|
767
770
|
}> {
|
|
768
771
|
const params: GenerateChangeSdkParams = {
|
|
@@ -788,7 +791,7 @@ async function fundNewTransactionSdk(
|
|
|
788
791
|
}
|
|
789
792
|
|
|
790
793
|
const noSendChange = [...ctx.noSendChangeIn]
|
|
791
|
-
const outputs: Record<number,
|
|
794
|
+
const outputs: Record<number, TableOutput> = {}
|
|
792
795
|
|
|
793
796
|
const allocateChangeInput = async (
|
|
794
797
|
targetSatoshis: number,
|
|
@@ -885,14 +888,14 @@ async function fundNewTransactionSdk(
|
|
|
885
888
|
const derivationPrefix = randomDerivation(16)
|
|
886
889
|
|
|
887
890
|
const r: {
|
|
888
|
-
allocatedChange:
|
|
889
|
-
changeOutputs:
|
|
891
|
+
allocatedChange: TableOutput[]
|
|
892
|
+
changeOutputs: TableOutput[]
|
|
890
893
|
derivationPrefix: string
|
|
891
894
|
} = {
|
|
892
895
|
allocatedChange: gcr.allocatedChangeInputs.map(i => outputs[i.outputId]),
|
|
893
896
|
changeOutputs: gcr.changeOutputs.map(
|
|
894
897
|
(o, i) =>
|
|
895
|
-
<
|
|
898
|
+
<TableOutput>{
|
|
896
899
|
// what we knnow now and can insert into the database for this new transaction's change output
|
|
897
900
|
created_at: new Date(),
|
|
898
901
|
updated_at: new Date(),
|
|
@@ -949,7 +952,7 @@ async function mergeAllocatedChangeBeefs(
|
|
|
949
952
|
storage: StorageProvider,
|
|
950
953
|
userId: number,
|
|
951
954
|
vargs: sdk.ValidCreateActionArgs,
|
|
952
|
-
allocatedChange:
|
|
955
|
+
allocatedChange: TableOutput[],
|
|
953
956
|
beef: Beef
|
|
954
957
|
): Promise<number[] | undefined> {
|
|
955
958
|
const options: sdk.StorageGetBeefOptions = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Beef } from '@bsv/sdk'
|
|
2
2
|
import {
|
|
3
3
|
asBsvSdkTx,
|
|
4
|
-
|
|
4
|
+
EntityProvenTx,
|
|
5
5
|
sdk,
|
|
6
6
|
StorageProvider,
|
|
7
7
|
verifyTruthy
|
|
@@ -51,7 +51,7 @@ async function getProvenOrRawTxFromServices(
|
|
|
51
51
|
options: sdk.StorageGetBeefOptions
|
|
52
52
|
): Promise<sdk.ProvenOrRawTx> {
|
|
53
53
|
const services = storage.getServices()
|
|
54
|
-
const por = await
|
|
54
|
+
const por = await EntityProvenTx.fromTxid(txid, await storage.getServices())
|
|
55
55
|
if (por.proven && !options.ignoreStorage && !options.ignoreNewProven) {
|
|
56
56
|
por.proven.provenTxId = await storage.insertProvenTx(por.proven.toApi())
|
|
57
57
|
}
|
|
@@ -111,7 +111,7 @@ async function mergeBeefForTransactionRecurse(
|
|
|
111
111
|
// storage has proven this txid,
|
|
112
112
|
// merge both the raw transaction and its merkle path
|
|
113
113
|
beef.mergeRawTx(r.proven.rawTx)
|
|
114
|
-
beef.mergeBump(new
|
|
114
|
+
beef.mergeBump(new EntityProvenTx(r.proven).getMerklePath())
|
|
115
115
|
return beef
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
sdk,
|
|
3
|
+
TableCertificate,
|
|
4
|
+
TableCertificateField,
|
|
5
|
+
TableCommission,
|
|
6
|
+
TableOutput,
|
|
7
|
+
TableOutputBasket,
|
|
8
|
+
TableOutputTag,
|
|
9
|
+
TableOutputTagMap,
|
|
10
|
+
TableProvenTx,
|
|
11
|
+
TableProvenTxReq,
|
|
12
|
+
TableTransaction,
|
|
13
|
+
TableTxLabel,
|
|
14
|
+
TableTxLabelMap,
|
|
15
|
+
verifyTruthy
|
|
16
|
+
} from '../../index.client'
|
|
2
17
|
import { StorageReader } from '../StorageReader'
|
|
3
18
|
|
|
4
19
|
/**
|
|
@@ -34,7 +49,7 @@ export async function getSyncChunk(
|
|
|
34
49
|
preAdd: () => {
|
|
35
50
|
r.provenTxs = []
|
|
36
51
|
},
|
|
37
|
-
addItem: (i:
|
|
52
|
+
addItem: (i: TableProvenTx) => {
|
|
38
53
|
r.provenTxs!.push(i)
|
|
39
54
|
},
|
|
40
55
|
findItems: async (
|
|
@@ -50,7 +65,7 @@ export async function getSyncChunk(
|
|
|
50
65
|
preAdd: () => {
|
|
51
66
|
r.outputBaskets = []
|
|
52
67
|
},
|
|
53
|
-
addItem: (i:
|
|
68
|
+
addItem: (i: TableOutputBasket) => {
|
|
54
69
|
r.outputBaskets!.push(i)
|
|
55
70
|
},
|
|
56
71
|
findItems: async (
|
|
@@ -70,7 +85,7 @@ export async function getSyncChunk(
|
|
|
70
85
|
preAdd: () => {
|
|
71
86
|
r.outputTags = []
|
|
72
87
|
},
|
|
73
|
-
addItem: (i:
|
|
88
|
+
addItem: (i: TableOutputTag) => {
|
|
74
89
|
r.outputTags!.push(i)
|
|
75
90
|
},
|
|
76
91
|
findItems: async (
|
|
@@ -90,7 +105,7 @@ export async function getSyncChunk(
|
|
|
90
105
|
preAdd: () => {
|
|
91
106
|
r.txLabels = []
|
|
92
107
|
},
|
|
93
|
-
addItem: (i:
|
|
108
|
+
addItem: (i: TableTxLabel) => {
|
|
94
109
|
r.txLabels!.push(i)
|
|
95
110
|
},
|
|
96
111
|
findItems: async (
|
|
@@ -110,7 +125,7 @@ export async function getSyncChunk(
|
|
|
110
125
|
preAdd: () => {
|
|
111
126
|
r.transactions = []
|
|
112
127
|
},
|
|
113
|
-
addItem: (i:
|
|
128
|
+
addItem: (i: TableTransaction) => {
|
|
114
129
|
r.transactions!.push(i)
|
|
115
130
|
},
|
|
116
131
|
findItems: async (
|
|
@@ -130,7 +145,7 @@ export async function getSyncChunk(
|
|
|
130
145
|
preAdd: () => {
|
|
131
146
|
r.outputs = []
|
|
132
147
|
},
|
|
133
|
-
addItem: (i:
|
|
148
|
+
addItem: (i: TableOutput) => {
|
|
134
149
|
r.outputs!.push(i)
|
|
135
150
|
},
|
|
136
151
|
findItems: async (
|
|
@@ -150,7 +165,7 @@ export async function getSyncChunk(
|
|
|
150
165
|
preAdd: () => {
|
|
151
166
|
r.txLabelMaps = []
|
|
152
167
|
},
|
|
153
|
-
addItem: (i:
|
|
168
|
+
addItem: (i: TableTxLabelMap) => {
|
|
154
169
|
r.txLabelMaps!.push(i)
|
|
155
170
|
},
|
|
156
171
|
findItems: async (
|
|
@@ -166,7 +181,7 @@ export async function getSyncChunk(
|
|
|
166
181
|
preAdd: () => {
|
|
167
182
|
r.outputTagMaps = []
|
|
168
183
|
},
|
|
169
|
-
addItem: (i:
|
|
184
|
+
addItem: (i: TableOutputTagMap) => {
|
|
170
185
|
r.outputTagMaps!.push(i)
|
|
171
186
|
},
|
|
172
187
|
findItems: async (
|
|
@@ -182,7 +197,7 @@ export async function getSyncChunk(
|
|
|
182
197
|
preAdd: () => {
|
|
183
198
|
r.certificates = []
|
|
184
199
|
},
|
|
185
|
-
addItem: (i:
|
|
200
|
+
addItem: (i: TableCertificate) => {
|
|
186
201
|
r.certificates!.push(i)
|
|
187
202
|
},
|
|
188
203
|
findItems: async (
|
|
@@ -202,7 +217,7 @@ export async function getSyncChunk(
|
|
|
202
217
|
preAdd: () => {
|
|
203
218
|
r.certificateFields = []
|
|
204
219
|
},
|
|
205
|
-
addItem: (i:
|
|
220
|
+
addItem: (i: TableCertificateField) => {
|
|
206
221
|
r.certificateFields!.push(i)
|
|
207
222
|
},
|
|
208
223
|
findItems: async (
|
|
@@ -222,7 +237,7 @@ export async function getSyncChunk(
|
|
|
222
237
|
preAdd: () => {
|
|
223
238
|
r.commissions = []
|
|
224
239
|
},
|
|
225
|
-
addItem: (i:
|
|
240
|
+
addItem: (i: TableCommission) => {
|
|
226
241
|
r.commissions!.push(i)
|
|
227
242
|
},
|
|
228
243
|
findItems: async (
|
|
@@ -242,7 +257,7 @@ export async function getSyncChunk(
|
|
|
242
257
|
preAdd: () => {
|
|
243
258
|
r.provenTxReqs = []
|
|
244
259
|
},
|
|
245
|
-
addItem: (i:
|
|
260
|
+
addItem: (i: TableProvenTxReq) => {
|
|
246
261
|
r.provenTxReqs!.push(i)
|
|
247
262
|
},
|
|
248
263
|
findItems: async (
|
|
@@ -10,12 +10,14 @@ import {
|
|
|
10
10
|
Beef
|
|
11
11
|
} from '@bsv/sdk'
|
|
12
12
|
import {
|
|
13
|
-
|
|
13
|
+
EntityProvenTxReq,
|
|
14
14
|
randomBytesBase64,
|
|
15
15
|
sdk,
|
|
16
16
|
stampLog,
|
|
17
17
|
StorageProvider,
|
|
18
|
-
|
|
18
|
+
TableOutput,
|
|
19
|
+
TableOutputBasket,
|
|
20
|
+
TableTransaction,
|
|
19
21
|
verifyId,
|
|
20
22
|
verifyOne,
|
|
21
23
|
verifyOneOrNone
|
|
@@ -77,7 +79,7 @@ interface BasketInsertionX extends BasketInsertion {
|
|
|
77
79
|
/** incoming transaction output */
|
|
78
80
|
txo: TransactionOutput
|
|
79
81
|
/** if valid, corresponding storage output */
|
|
80
|
-
eo?:
|
|
82
|
+
eo?: TableOutput
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
interface WalletPaymentX extends WalletPayment {
|
|
@@ -86,7 +88,7 @@ interface WalletPaymentX extends WalletPayment {
|
|
|
86
88
|
/** incoming transaction output */
|
|
87
89
|
txo: TransactionOutput
|
|
88
90
|
/** if valid, corresponding storage output */
|
|
89
|
-
eo?:
|
|
91
|
+
eo?: TableOutput
|
|
90
92
|
/** corresponds to an existing change output */
|
|
91
93
|
ignore: boolean
|
|
92
94
|
}
|
|
@@ -99,13 +101,13 @@ class InternalizeActionContext {
|
|
|
99
101
|
/** the incoming transaction extracted from AtomicBEEF */
|
|
100
102
|
tx: BsvTransaction
|
|
101
103
|
/** the user's change basket */
|
|
102
|
-
changeBasket:
|
|
104
|
+
changeBasket: TableOutputBasket
|
|
103
105
|
/** cached baskets referenced by basket insertions */
|
|
104
|
-
baskets: Record<string,
|
|
106
|
+
baskets: Record<string, TableOutputBasket>
|
|
105
107
|
/** existing storage transaction for this txid and userId */
|
|
106
|
-
etx?:
|
|
108
|
+
etx?: TableTransaction
|
|
107
109
|
/** existing outputs */
|
|
108
|
-
eos:
|
|
110
|
+
eos: TableOutput[]
|
|
109
111
|
/** all the basket insertions from incoming outputs array */
|
|
110
112
|
basketInsertions: BasketInsertionX[]
|
|
111
113
|
/** all the wallet payments from incoming outputs array */
|
|
@@ -128,7 +130,7 @@ class InternalizeActionContext {
|
|
|
128
130
|
}
|
|
129
131
|
this.ab = new Beef()
|
|
130
132
|
this.tx = new BsvTransaction()
|
|
131
|
-
this.changeBasket = {} as
|
|
133
|
+
this.changeBasket = {} as TableOutputBasket
|
|
132
134
|
this.baskets = {}
|
|
133
135
|
this.basketInsertions = []
|
|
134
136
|
this.walletPayments = []
|
|
@@ -154,7 +156,7 @@ class InternalizeActionContext {
|
|
|
154
156
|
this.r.satoshis = v
|
|
155
157
|
}
|
|
156
158
|
|
|
157
|
-
async getBasket(basketName: string): Promise<
|
|
159
|
+
async getBasket(basketName: string): Promise<TableOutputBasket> {
|
|
158
160
|
let b = this.baskets[basketName]
|
|
159
161
|
if (b) return b
|
|
160
162
|
b = await this.storage.findOrInsertOutputBasket(this.userId, basketName)
|
|
@@ -322,9 +324,9 @@ class InternalizeActionContext {
|
|
|
322
324
|
async findOrInsertTargetTransaction(
|
|
323
325
|
satoshis: number,
|
|
324
326
|
status: sdk.TransactionStatus
|
|
325
|
-
): Promise<
|
|
327
|
+
): Promise<TableTransaction> {
|
|
326
328
|
const now = new Date()
|
|
327
|
-
const newTx:
|
|
329
|
+
const newTx: TableTransaction = {
|
|
328
330
|
created_at: now,
|
|
329
331
|
updated_at: now,
|
|
330
332
|
transactionId: 0,
|
|
@@ -386,7 +388,7 @@ class InternalizeActionContext {
|
|
|
386
388
|
|
|
387
389
|
// transaction record for user is new, but the txid may not be new to storage
|
|
388
390
|
// make sure storage pursues getting a proof for it.
|
|
389
|
-
const newReq =
|
|
391
|
+
const newReq = EntityProvenTxReq.fromTxid(
|
|
390
392
|
this.txid,
|
|
391
393
|
this.tx.toBinary(),
|
|
392
394
|
this.args.tx
|
|
@@ -428,7 +430,7 @@ class InternalizeActionContext {
|
|
|
428
430
|
payment: WalletPaymentX
|
|
429
431
|
): Promise<void> {
|
|
430
432
|
const now = new Date()
|
|
431
|
-
const txOut:
|
|
433
|
+
const txOut: TableOutput = {
|
|
432
434
|
created_at: now,
|
|
433
435
|
updated_at: now,
|
|
434
436
|
outputId: 0,
|
|
@@ -462,7 +464,7 @@ class InternalizeActionContext {
|
|
|
462
464
|
payment: WalletPaymentX
|
|
463
465
|
) {
|
|
464
466
|
const outputId = payment.eo!.outputId!
|
|
465
|
-
const update: Partial<
|
|
467
|
+
const update: Partial<TableOutput> = {
|
|
466
468
|
basketId: this.changeBasket.basketId,
|
|
467
469
|
type: 'P2PKH',
|
|
468
470
|
customInstructions: undefined,
|
|
@@ -482,7 +484,7 @@ class InternalizeActionContext {
|
|
|
482
484
|
basket: BasketInsertionX
|
|
483
485
|
) {
|
|
484
486
|
const outputId = basket.eo!.outputId!
|
|
485
|
-
const update: Partial<
|
|
487
|
+
const update: Partial<TableOutput> = {
|
|
486
488
|
basketId: (await this.getBasket(basket.basket)).basketId,
|
|
487
489
|
type: 'custom',
|
|
488
490
|
customInstructions: basket.customInstructions,
|
|
@@ -502,7 +504,7 @@ class InternalizeActionContext {
|
|
|
502
504
|
basket: BasketInsertionX
|
|
503
505
|
): Promise<void> {
|
|
504
506
|
const now = new Date()
|
|
505
|
-
const txOut:
|
|
507
|
+
const txOut: TableOutput = {
|
|
506
508
|
created_at: now,
|
|
507
509
|
updated_at: now,
|
|
508
510
|
outputId: 0,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
WalletActionOutput,
|
|
7
7
|
WalletActionInput
|
|
8
8
|
} from '@bsv/sdk'
|
|
9
|
-
import {
|
|
9
|
+
import { TableOutputX, TableTransaction, TableTxLabel } from '../index.client'
|
|
10
10
|
import { asString, sdk, verifyOne } from '../../index.client'
|
|
11
11
|
import { StorageKnex } from '../StorageKnex'
|
|
12
12
|
|
|
@@ -27,7 +27,7 @@ export async function listActions(
|
|
|
27
27
|
|
|
28
28
|
let labelIds: number[] = []
|
|
29
29
|
if (vargs.labels.length > 0) {
|
|
30
|
-
const q = k<
|
|
30
|
+
const q = k<TableTxLabel>('tx_labels')
|
|
31
31
|
.where({
|
|
32
32
|
userId: auth.userId,
|
|
33
33
|
isDeleted: false
|
|
@@ -107,7 +107,7 @@ export async function listActions(
|
|
|
107
107
|
|
|
108
108
|
q.limit(limit).offset(offset).orderBy('transactionId', 'asc')
|
|
109
109
|
|
|
110
|
-
const txs: Partial<
|
|
110
|
+
const txs: Partial<TableTransaction>[] = await q
|
|
111
111
|
|
|
112
112
|
if (!limit || txs.length < limit) r.totalActions = txs.length
|
|
113
113
|
else {
|
|
@@ -141,7 +141,7 @@ export async function listActions(
|
|
|
141
141
|
).map(l => l.label)
|
|
142
142
|
}
|
|
143
143
|
if (vargs.includeOutputs) {
|
|
144
|
-
const outputs:
|
|
144
|
+
const outputs: TableOutputX[] = await storage.findOutputs({
|
|
145
145
|
partial: { transactionId: tx.transactionId },
|
|
146
146
|
noScript: !vargs.includeOutputLockingScripts
|
|
147
147
|
})
|
|
@@ -162,7 +162,7 @@ export async function listActions(
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
if (vargs.includeInputs) {
|
|
165
|
-
const inputs:
|
|
165
|
+
const inputs: TableOutputX[] = await storage.findOutputs({
|
|
166
166
|
partial: { spentBy: tx.transactionId },
|
|
167
167
|
noScript: !vargs.includeInputSourceLockingScripts
|
|
168
168
|
})
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ListCertificatesResult,
|
|
3
3
|
OriginatorDomainNameStringUnder250Bytes
|
|
4
4
|
} from '@bsv/sdk'
|
|
5
|
-
import { StorageProvider,
|
|
5
|
+
import { StorageProvider, TableCertificate } from '../index.client'
|
|
6
6
|
import { sdk } from '../../index.client'
|
|
7
7
|
|
|
8
8
|
export async function listCertificates(
|
|
@@ -13,7 +13,7 @@ export async function listCertificates(
|
|
|
13
13
|
): Promise<ListCertificatesResult> {
|
|
14
14
|
const paged: sdk.Paged = { limit: vargs.limit, offset: vargs.offset }
|
|
15
15
|
|
|
16
|
-
const partial: Partial<
|
|
16
|
+
const partial: Partial<TableCertificate> = {
|
|
17
17
|
userId: auth.userId,
|
|
18
18
|
isDeleted: false
|
|
19
19
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
OriginatorDomainNameStringUnder250Bytes,
|
|
5
5
|
WalletOutput
|
|
6
6
|
} from '@bsv/sdk'
|
|
7
|
-
import {
|
|
7
|
+
import { TableOutput, TableOutputBasket, TableOutputTag } from '../index.client'
|
|
8
8
|
import { asString, sdk, verifyId, verifyOne } from '../../index.client'
|
|
9
9
|
import { StorageKnex } from '../StorageKnex'
|
|
10
10
|
|
|
@@ -39,7 +39,7 @@ export async function listOutputs(
|
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
let basketId: number | undefined = undefined
|
|
42
|
-
const basketsById: Record<number,
|
|
42
|
+
const basketsById: Record<number, TableOutputBasket> = {}
|
|
43
43
|
if (vargs.basket) {
|
|
44
44
|
const baskets = await dsk.findOutputBaskets({
|
|
45
45
|
partial: { userId, name: vargs.basket },
|
|
@@ -56,7 +56,7 @@ export async function listOutputs(
|
|
|
56
56
|
|
|
57
57
|
let tagIds: number[] = []
|
|
58
58
|
if (vargs.tags && vargs.tags.length > 0) {
|
|
59
|
-
const q = k<
|
|
59
|
+
const q = k<TableOutputTag>('output_tags')
|
|
60
60
|
.where({
|
|
61
61
|
userId: userId,
|
|
62
62
|
isDeleted: false
|
|
@@ -119,7 +119,7 @@ export async function listOutputs(
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
const makeWithoutTagsQueries = () => {
|
|
122
|
-
const where: Partial<
|
|
122
|
+
const where: Partial<TableOutput> = { userId }
|
|
123
123
|
if (basketId) where.basketId = basketId
|
|
124
124
|
if (!includeSpent) where.spendable = true
|
|
125
125
|
const q = k('outputs').where(where).whereRaw(txStatusOk)
|
|
@@ -134,7 +134,7 @@ export async function listOutputs(
|
|
|
134
134
|
// Sort order when limit and offset are possible must be ascending for determinism.
|
|
135
135
|
q.limit(limit).offset(offset).orderBy('outputId', 'asc')
|
|
136
136
|
|
|
137
|
-
const outputs:
|
|
137
|
+
const outputs: TableOutput[] = await q
|
|
138
138
|
|
|
139
139
|
if (!limit || outputs.length < limit) r.totalOutputs = outputs.length
|
|
140
140
|
else {
|