@bsv/wallet-toolbox 1.1.6 → 1.1.8
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 +499 -900
- package/docs/monitor.md +29 -69
- package/docs/services.md +22 -40
- package/docs/setup.md +23 -65
- package/docs/storage.md +2163 -489
- package/docs/wallet.md +499 -900
- 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 +2 -2
- 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 +4 -2
- package/out/src/storage/methods/purgeData.js.map +1 -1
- package/out/src/storage/methods/reviewStatus.js +1 -1
- package/out/src/storage/methods/reviewStatus.js.map +1 -1
- package/out/src/storage/remoting/StorageClient.d.ts +11 -11
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
- 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.d.ts.map +1 -1
- package/out/test/Wallet/live/walletLive.man.test.js +35 -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 +47 -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 +124 -104
- package/src/storage/StorageProvider.ts +43 -30
- package/src/storage/StorageReader.ts +36 -21
- package/src/storage/StorageReaderWriter.ts +78 -65
- package/src/storage/StorageSyncReader.ts +34 -17
- package/src/storage/WalletStorageManager.ts +17 -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 +20 -12
- package/src/storage/methods/reviewStatus.ts +5 -5
- package/src/storage/remoting/StorageClient.ts +28 -18
- 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 +67 -50
- package/test/Wallet/certificate/listCertificates.test.ts +12 -8
- package/test/Wallet/live/walletLive.man.test.ts +46 -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 +12 -6
- 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
|
@@ -17,9 +17,17 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
asArray,
|
|
19
19
|
asString,
|
|
20
|
-
entity,
|
|
21
20
|
sdk,
|
|
22
|
-
|
|
21
|
+
TableCertificate,
|
|
22
|
+
TableCertificateX,
|
|
23
|
+
TableMonitorEvent,
|
|
24
|
+
TableOutput,
|
|
25
|
+
TableOutputBasket,
|
|
26
|
+
TableOutputTag,
|
|
27
|
+
TableProvenTxReq,
|
|
28
|
+
TableProvenTxReqDynamics,
|
|
29
|
+
TableTransaction,
|
|
30
|
+
TableTxLabel,
|
|
23
31
|
verifyId,
|
|
24
32
|
verifyOne,
|
|
25
33
|
verifyOneOrNone,
|
|
@@ -42,7 +50,12 @@ import {
|
|
|
42
50
|
StorageReaderWriter,
|
|
43
51
|
StorageReaderWriterOptions
|
|
44
52
|
} from './StorageReaderWriter'
|
|
45
|
-
import {
|
|
53
|
+
import {
|
|
54
|
+
EntityProvenTx,
|
|
55
|
+
EntityProvenTxReq,
|
|
56
|
+
EntitySyncState,
|
|
57
|
+
EntityTransaction
|
|
58
|
+
} from './schema/entities'
|
|
46
59
|
|
|
47
60
|
export abstract class StorageProvider
|
|
48
61
|
extends StorageReaderWriter
|
|
@@ -95,7 +108,7 @@ export abstract class StorageProvider
|
|
|
95
108
|
exactSatoshis: number | undefined,
|
|
96
109
|
excludeSending: boolean,
|
|
97
110
|
transactionId: number
|
|
98
|
-
): Promise<
|
|
111
|
+
): Promise<TableOutput | undefined>
|
|
99
112
|
|
|
100
113
|
abstract getProvenOrRawTx(
|
|
101
114
|
txid: string,
|
|
@@ -111,11 +124,11 @@ export abstract class StorageProvider
|
|
|
111
124
|
abstract getLabelsForTransactionId(
|
|
112
125
|
transactionId?: number,
|
|
113
126
|
trx?: sdk.TrxToken
|
|
114
|
-
): Promise<
|
|
127
|
+
): Promise<TableTxLabel[]>
|
|
115
128
|
abstract getTagsForOutputId(
|
|
116
129
|
outputId: number,
|
|
117
130
|
trx?: sdk.TrxToken
|
|
118
|
-
): Promise<
|
|
131
|
+
): Promise<TableOutputTag[]>
|
|
119
132
|
|
|
120
133
|
abstract listActions(
|
|
121
134
|
auth: sdk.AuthId,
|
|
@@ -135,18 +148,18 @@ export abstract class StorageProvider
|
|
|
135
148
|
abstract findCertificatesAuth(
|
|
136
149
|
auth: sdk.AuthId,
|
|
137
150
|
args: sdk.FindCertificatesArgs
|
|
138
|
-
): Promise<
|
|
151
|
+
): Promise<TableCertificate[]>
|
|
139
152
|
abstract findOutputBasketsAuth(
|
|
140
153
|
auth: sdk.AuthId,
|
|
141
154
|
args: sdk.FindOutputBasketsArgs
|
|
142
|
-
): Promise<
|
|
155
|
+
): Promise<TableOutputBasket[]>
|
|
143
156
|
abstract findOutputsAuth(
|
|
144
157
|
auth: sdk.AuthId,
|
|
145
158
|
args: sdk.FindOutputsArgs
|
|
146
|
-
): Promise<
|
|
159
|
+
): Promise<TableOutput[]>
|
|
147
160
|
abstract insertCertificateAuth(
|
|
148
161
|
auth: sdk.AuthId,
|
|
149
|
-
certificate:
|
|
162
|
+
certificate: TableCertificateX
|
|
150
163
|
): Promise<number>
|
|
151
164
|
|
|
152
165
|
override isStorageProvider(): boolean {
|
|
@@ -164,7 +177,7 @@ export abstract class StorageProvider
|
|
|
164
177
|
|
|
165
178
|
async abortAction(
|
|
166
179
|
auth: sdk.AuthId,
|
|
167
|
-
args: Partial<
|
|
180
|
+
args: Partial<TableTransaction>
|
|
168
181
|
): Promise<AbortActionResult> {
|
|
169
182
|
const r = await this.transaction(async trx => {
|
|
170
183
|
const tx = verifyOneOrNone(
|
|
@@ -193,7 +206,7 @@ export abstract class StorageProvider
|
|
|
193
206
|
trx
|
|
194
207
|
)
|
|
195
208
|
if (tx.txid) {
|
|
196
|
-
const req = await
|
|
209
|
+
const req = await EntityProvenTxReq.fromStorageTxid(this, tx.txid, trx)
|
|
197
210
|
if (req) {
|
|
198
211
|
req.addHistoryNote({ what: 'aborted' })
|
|
199
212
|
req.status = 'invalid'
|
|
@@ -299,7 +312,7 @@ export abstract class StorageProvider
|
|
|
299
312
|
}
|
|
300
313
|
|
|
301
314
|
async mergeReqToBeefToShareExternally(
|
|
302
|
-
req:
|
|
315
|
+
req: TableProvenTxReq,
|
|
303
316
|
mergeToBeef: Beef,
|
|
304
317
|
knownTxids: string[],
|
|
305
318
|
trx?: sdk.TrxToken
|
|
@@ -348,7 +361,7 @@ export abstract class StorageProvider
|
|
|
348
361
|
*/
|
|
349
362
|
async getProvenOrReq(
|
|
350
363
|
txid: string,
|
|
351
|
-
newReq?:
|
|
364
|
+
newReq?: TableProvenTxReq,
|
|
352
365
|
trx?: sdk.TrxToken
|
|
353
366
|
): Promise<sdk.StorageProvenOrReq> {
|
|
354
367
|
if (newReq && txid !== newReq.txid)
|
|
@@ -372,7 +385,7 @@ export abstract class StorageProvider
|
|
|
372
385
|
}
|
|
373
386
|
if (r.req && newReq) {
|
|
374
387
|
// Merge history and notify into existing
|
|
375
|
-
const req1 = new
|
|
388
|
+
const req1 = new EntityProvenTxReq(r.req)
|
|
376
389
|
req1.mergeHistory(newReq, undefined, true)
|
|
377
390
|
req1.mergeNotifyTransactionIds(newReq)
|
|
378
391
|
await req1.updateStorageDynamicProperties(this, trx)
|
|
@@ -427,7 +440,7 @@ export abstract class StorageProvider
|
|
|
427
440
|
)
|
|
428
441
|
|
|
429
442
|
await this.transaction(async trx => {
|
|
430
|
-
const where: Partial<
|
|
443
|
+
const where: Partial<TableTransaction> = {}
|
|
431
444
|
if (transactionId) where.transactionId = transactionId
|
|
432
445
|
if (userId) where.userId = userId
|
|
433
446
|
if (reference) where.reference = reference
|
|
@@ -459,7 +472,7 @@ export abstract class StorageProvider
|
|
|
459
472
|
{
|
|
460
473
|
// Attempt to make outputs previously allocated as inputs to this transaction usable again.
|
|
461
474
|
// Only clear input's spentBy and reset spendable = true if it references this transaction
|
|
462
|
-
const t = new
|
|
475
|
+
const t = new EntityTransaction(tx)
|
|
463
476
|
const inputs = await t.getInputs(this, trx)
|
|
464
477
|
for (const input of inputs) {
|
|
465
478
|
// input is a prior output belonging to userId that reference this transaction either by `spentBy`
|
|
@@ -503,7 +516,7 @@ export abstract class StorageProvider
|
|
|
503
516
|
}
|
|
504
517
|
|
|
505
518
|
async attemptToPostReqsToNetwork(
|
|
506
|
-
reqs:
|
|
519
|
+
reqs: EntityProvenTxReq[],
|
|
507
520
|
trx?: sdk.TrxToken
|
|
508
521
|
): Promise<PostReqsToNetworkResult> {
|
|
509
522
|
return await attemptToPostReqsToNetwork(this, reqs, trx)
|
|
@@ -560,7 +573,7 @@ export abstract class StorageProvider
|
|
|
560
573
|
if (trustSelf === 'known') beef.mergeTxidOnly(txid)
|
|
561
574
|
else {
|
|
562
575
|
beef.mergeRawTx(r.proven.rawTx)
|
|
563
|
-
const mp = new
|
|
576
|
+
const mp = new EntityProvenTx(r.proven).getMerklePath()
|
|
564
577
|
beef.mergeBump(mp)
|
|
565
578
|
return beef
|
|
566
579
|
}
|
|
@@ -604,7 +617,7 @@ export abstract class StorageProvider
|
|
|
604
617
|
async findMonitorEventById(
|
|
605
618
|
id: number,
|
|
606
619
|
trx?: sdk.TrxToken
|
|
607
|
-
): Promise<
|
|
620
|
+
): Promise<TableMonitorEvent | undefined> {
|
|
608
621
|
return verifyOneOrNone(
|
|
609
622
|
await this.findMonitorEvents({ partial: { id }, trx })
|
|
610
623
|
)
|
|
@@ -648,7 +661,7 @@ export abstract class StorageProvider
|
|
|
648
661
|
const user = verifyTruthy(
|
|
649
662
|
await this.findUserByIdentityKey(args.identityKey)
|
|
650
663
|
)
|
|
651
|
-
const ss = new
|
|
664
|
+
const ss = new EntitySyncState(
|
|
652
665
|
verifyOne(
|
|
653
666
|
await this.findSyncStates({
|
|
654
667
|
partial: {
|
|
@@ -678,11 +691,11 @@ export abstract class StorageProvider
|
|
|
678
691
|
async updateProvenTxReqWithNewProvenTx(
|
|
679
692
|
args: sdk.UpdateProvenTxReqWithNewProvenTxArgs
|
|
680
693
|
): Promise<sdk.UpdateProvenTxReqWithNewProvenTxResult> {
|
|
681
|
-
const req = await
|
|
682
|
-
let proven:
|
|
694
|
+
const req = await EntityProvenTxReq.fromStorageId(this, args.provenTxReqId)
|
|
695
|
+
let proven: EntityProvenTx
|
|
683
696
|
if (req.provenTxId) {
|
|
684
697
|
// Someone beat us to it, grab what we need for results...
|
|
685
|
-
proven = new
|
|
698
|
+
proven = new EntityProvenTx(
|
|
686
699
|
verifyOne(await this.findProvenTxs({ partial: { txid: args.txid } }))
|
|
687
700
|
)
|
|
688
701
|
} else {
|
|
@@ -703,7 +716,7 @@ export abstract class StorageProvider
|
|
|
703
716
|
},
|
|
704
717
|
trx
|
|
705
718
|
)
|
|
706
|
-
proven = new
|
|
719
|
+
proven = new EntityProvenTx(api)
|
|
707
720
|
if (isNew) {
|
|
708
721
|
req.status = 'completed'
|
|
709
722
|
req.provenTxId = proven.provenTxId
|
|
@@ -750,15 +763,15 @@ export abstract class StorageProvider
|
|
|
750
763
|
* @returns object with invalidSpendableOutputs array. A good result is an empty array.
|
|
751
764
|
*/
|
|
752
765
|
async confirmSpendableOutputs(): Promise<{
|
|
753
|
-
invalidSpendableOutputs:
|
|
766
|
+
invalidSpendableOutputs: TableOutput[]
|
|
754
767
|
}> {
|
|
755
|
-
const invalidSpendableOutputs:
|
|
768
|
+
const invalidSpendableOutputs: TableOutput[] = []
|
|
756
769
|
const users = await this.findUsers({ partial: {} })
|
|
757
770
|
for (const { userId } of users) {
|
|
758
771
|
const defaultBasket = verifyOne(
|
|
759
772
|
await this.findOutputBaskets({ partial: { userId, name: 'default' } })
|
|
760
773
|
)
|
|
761
|
-
const where: Partial<
|
|
774
|
+
const where: Partial<TableOutput> = {
|
|
762
775
|
userId,
|
|
763
776
|
basketId: defaultBasket.basketId,
|
|
764
777
|
spendable: true
|
|
@@ -799,10 +812,10 @@ export abstract class StorageProvider
|
|
|
799
812
|
|
|
800
813
|
async updateProvenTxReqDynamics(
|
|
801
814
|
id: number,
|
|
802
|
-
update: Partial<
|
|
815
|
+
update: Partial<TableProvenTxReqDynamics>,
|
|
803
816
|
trx?: sdk.TrxToken
|
|
804
817
|
): Promise<number> {
|
|
805
|
-
const partial: Partial<
|
|
818
|
+
const partial: Partial<TableProvenTxReq> = {}
|
|
806
819
|
if (update['updated_at']) partial['updated_at'] = update['updated_at']
|
|
807
820
|
if (update['provenTxId']) partial['provenTxId'] = update['provenTxId']
|
|
808
821
|
if (update['status']) partial['status'] = update['status']
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sdk,
|
|
3
|
-
|
|
3
|
+
TableCertificate,
|
|
4
|
+
TableCertificateField,
|
|
5
|
+
TableCommission,
|
|
6
|
+
TableMonitorEvent,
|
|
7
|
+
TableOutput,
|
|
8
|
+
TableOutputBasket,
|
|
9
|
+
TableOutputTag,
|
|
10
|
+
TableOutputTagMap,
|
|
11
|
+
TableProvenTx,
|
|
12
|
+
TableProvenTxReq,
|
|
13
|
+
TableSettings,
|
|
14
|
+
TableSyncState,
|
|
15
|
+
TableTransaction,
|
|
16
|
+
TableTxLabel,
|
|
17
|
+
TableTxLabelMap,
|
|
18
|
+
TableUser,
|
|
4
19
|
validateSecondsSinceEpoch,
|
|
5
20
|
verifyOneOrNone,
|
|
6
21
|
verifyTruthy
|
|
@@ -21,7 +36,7 @@ import { getSyncChunk } from './methods/getSyncChunk'
|
|
|
21
36
|
*/
|
|
22
37
|
export abstract class StorageReader implements sdk.StorageSyncReader {
|
|
23
38
|
chain: sdk.Chain
|
|
24
|
-
_settings?:
|
|
39
|
+
_settings?: TableSettings
|
|
25
40
|
whenLastAccess?: Date
|
|
26
41
|
get dbtype(): DBType | undefined {
|
|
27
42
|
return this._settings?.dbtype
|
|
@@ -34,11 +49,11 @@ export abstract class StorageReader implements sdk.StorageSyncReader {
|
|
|
34
49
|
isAvailable(): boolean {
|
|
35
50
|
return !!this._settings
|
|
36
51
|
}
|
|
37
|
-
async makeAvailable(): Promise<
|
|
52
|
+
async makeAvailable(): Promise<TableSettings> {
|
|
38
53
|
return (this._settings = await this.readSettings())
|
|
39
54
|
}
|
|
40
55
|
|
|
41
|
-
getSettings():
|
|
56
|
+
getSettings(): TableSettings {
|
|
42
57
|
if (!this._settings)
|
|
43
58
|
throw new sdk.WERR_INVALID_OPERATION(
|
|
44
59
|
'must call "makeAvailable" before accessing "settings"'
|
|
@@ -57,35 +72,35 @@ export abstract class StorageReader implements sdk.StorageSyncReader {
|
|
|
57
72
|
trx?: sdk.TrxToken
|
|
58
73
|
): Promise<T>
|
|
59
74
|
|
|
60
|
-
abstract readSettings(trx?: sdk.TrxToken): Promise<
|
|
75
|
+
abstract readSettings(trx?: sdk.TrxToken): Promise<TableSettings>
|
|
61
76
|
|
|
62
77
|
abstract findCertificateFields(
|
|
63
78
|
args: sdk.FindCertificateFieldsArgs
|
|
64
|
-
): Promise<
|
|
79
|
+
): Promise<TableCertificateField[]>
|
|
65
80
|
abstract findCertificates(
|
|
66
81
|
args: sdk.FindCertificatesArgs
|
|
67
|
-
): Promise<
|
|
82
|
+
): Promise<TableCertificate[]>
|
|
68
83
|
abstract findCommissions(
|
|
69
84
|
args: sdk.FindCommissionsArgs
|
|
70
|
-
): Promise<
|
|
85
|
+
): Promise<TableCommission[]>
|
|
71
86
|
abstract findMonitorEvents(
|
|
72
87
|
args: sdk.FindMonitorEventsArgs
|
|
73
|
-
): Promise<
|
|
88
|
+
): Promise<TableMonitorEvent[]>
|
|
74
89
|
abstract findOutputBaskets(
|
|
75
90
|
args: sdk.FindOutputBasketsArgs
|
|
76
|
-
): Promise<
|
|
77
|
-
abstract findOutputs(args: sdk.FindOutputsArgs): Promise<
|
|
91
|
+
): Promise<TableOutputBasket[]>
|
|
92
|
+
abstract findOutputs(args: sdk.FindOutputsArgs): Promise<TableOutput[]>
|
|
78
93
|
abstract findOutputTags(
|
|
79
94
|
args: sdk.FindOutputTagsArgs
|
|
80
|
-
): Promise<
|
|
95
|
+
): Promise<TableOutputTag[]>
|
|
81
96
|
abstract findSyncStates(
|
|
82
97
|
args: sdk.FindSyncStatesArgs
|
|
83
|
-
): Promise<
|
|
98
|
+
): Promise<TableSyncState[]>
|
|
84
99
|
abstract findTransactions(
|
|
85
100
|
args: sdk.FindTransactionsArgs
|
|
86
|
-
): Promise<
|
|
87
|
-
abstract findTxLabels(args: sdk.FindTxLabelsArgs): Promise<
|
|
88
|
-
abstract findUsers(args: sdk.FindUsersArgs): Promise<
|
|
101
|
+
): Promise<TableTransaction[]>
|
|
102
|
+
abstract findTxLabels(args: sdk.FindTxLabelsArgs): Promise<TableTxLabel[]>
|
|
103
|
+
abstract findUsers(args: sdk.FindUsersArgs): Promise<TableUser[]>
|
|
89
104
|
|
|
90
105
|
abstract countCertificateFields(
|
|
91
106
|
args: sdk.FindCertificateFieldsArgs
|
|
@@ -103,18 +118,18 @@ export abstract class StorageReader implements sdk.StorageSyncReader {
|
|
|
103
118
|
|
|
104
119
|
abstract getProvenTxsForUser(
|
|
105
120
|
args: sdk.FindForUserSincePagedArgs
|
|
106
|
-
): Promise<
|
|
121
|
+
): Promise<TableProvenTx[]>
|
|
107
122
|
abstract getProvenTxReqsForUser(
|
|
108
123
|
args: sdk.FindForUserSincePagedArgs
|
|
109
|
-
): Promise<
|
|
124
|
+
): Promise<TableProvenTxReq[]>
|
|
110
125
|
abstract getTxLabelMapsForUser(
|
|
111
126
|
args: sdk.FindForUserSincePagedArgs
|
|
112
|
-
): Promise<
|
|
127
|
+
): Promise<TableTxLabelMap[]>
|
|
113
128
|
abstract getOutputTagMapsForUser(
|
|
114
129
|
args: sdk.FindForUserSincePagedArgs
|
|
115
|
-
): Promise<
|
|
130
|
+
): Promise<TableOutputTagMap[]>
|
|
116
131
|
|
|
117
|
-
async findUserByIdentityKey(key: string): Promise<
|
|
132
|
+
async findUserByIdentityKey(key: string): Promise<TableUser | undefined> {
|
|
118
133
|
return verifyOneOrNone(
|
|
119
134
|
await this.findUsers({ partial: { identityKey: key } })
|
|
120
135
|
)
|