@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
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createSyncMap,
|
|
3
|
+
sdk,
|
|
4
|
+
SyncMap,
|
|
5
|
+
TableCommission,
|
|
6
|
+
TableTransaction
|
|
7
|
+
} from '../../../../../src'
|
|
2
8
|
import {
|
|
3
9
|
TestUtilsWalletStorage as _tu,
|
|
4
10
|
TestWalletNoSetup
|
|
5
11
|
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
6
|
-
import {
|
|
12
|
+
import { EntityCommission } from '../../../../../src/storage/schema/entities/Commission'
|
|
7
13
|
|
|
8
14
|
describe('Commission class method tests', () => {
|
|
9
15
|
jest.setTimeout(99999999)
|
|
@@ -37,7 +43,7 @@ describe('Commission class method tests', () => {
|
|
|
37
43
|
|
|
38
44
|
// Insert the transaction to satisfy the foreign key constraint
|
|
39
45
|
const now = new Date()
|
|
40
|
-
const transactionData:
|
|
46
|
+
const transactionData: TableTransaction = {
|
|
41
47
|
transactionId,
|
|
42
48
|
created_at: now,
|
|
43
49
|
updated_at: now,
|
|
@@ -53,7 +59,7 @@ describe('Commission class method tests', () => {
|
|
|
53
59
|
await activeStorage.insertTransaction(transactionData)
|
|
54
60
|
|
|
55
61
|
// Insert initial Commission record
|
|
56
|
-
const initialData:
|
|
62
|
+
const initialData: TableCommission = {
|
|
57
63
|
commissionId: 801,
|
|
58
64
|
created_at: now,
|
|
59
65
|
updated_at: now,
|
|
@@ -68,84 +74,11 @@ describe('Commission class method tests', () => {
|
|
|
68
74
|
await activeStorage.insertCommission(initialData)
|
|
69
75
|
|
|
70
76
|
// Create two Commission entities from the same data
|
|
71
|
-
const entity1 = new
|
|
72
|
-
const entity2 = new
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
transaction: {
|
|
77
|
-
idMap: { [transactionId]: transactionId },
|
|
78
|
-
entityName: 'Transaction',
|
|
79
|
-
maxUpdated_at: undefined,
|
|
80
|
-
count: 0
|
|
81
|
-
},
|
|
82
|
-
outputBasket: {
|
|
83
|
-
idMap: {},
|
|
84
|
-
entityName: 'OutputBasket',
|
|
85
|
-
maxUpdated_at: undefined,
|
|
86
|
-
count: 0
|
|
87
|
-
},
|
|
88
|
-
provenTx: {
|
|
89
|
-
idMap: {},
|
|
90
|
-
entityName: 'ProvenTx',
|
|
91
|
-
maxUpdated_at: undefined,
|
|
92
|
-
count: 0
|
|
93
|
-
},
|
|
94
|
-
output: {
|
|
95
|
-
idMap: {},
|
|
96
|
-
entityName: 'Output',
|
|
97
|
-
maxUpdated_at: undefined,
|
|
98
|
-
count: 0
|
|
99
|
-
},
|
|
100
|
-
outputTag: {
|
|
101
|
-
idMap: {},
|
|
102
|
-
entityName: 'OutputTag',
|
|
103
|
-
maxUpdated_at: undefined,
|
|
104
|
-
count: 0
|
|
105
|
-
},
|
|
106
|
-
provenTxReq: {
|
|
107
|
-
idMap: {},
|
|
108
|
-
entityName: 'ProvenTxReq',
|
|
109
|
-
maxUpdated_at: undefined,
|
|
110
|
-
count: 0
|
|
111
|
-
},
|
|
112
|
-
txLabel: {
|
|
113
|
-
idMap: {},
|
|
114
|
-
entityName: 'TxLabel',
|
|
115
|
-
maxUpdated_at: undefined,
|
|
116
|
-
count: 0
|
|
117
|
-
},
|
|
118
|
-
txLabelMap: {
|
|
119
|
-
idMap: {},
|
|
120
|
-
entityName: 'TxLabelMap',
|
|
121
|
-
maxUpdated_at: undefined,
|
|
122
|
-
count: 0
|
|
123
|
-
},
|
|
124
|
-
outputTagMap: {
|
|
125
|
-
idMap: {},
|
|
126
|
-
entityName: 'OutputTagMap',
|
|
127
|
-
maxUpdated_at: undefined,
|
|
128
|
-
count: 0
|
|
129
|
-
},
|
|
130
|
-
certificate: {
|
|
131
|
-
idMap: {},
|
|
132
|
-
entityName: 'Certificate',
|
|
133
|
-
maxUpdated_at: undefined,
|
|
134
|
-
count: 0
|
|
135
|
-
},
|
|
136
|
-
certificateField: {
|
|
137
|
-
idMap: {},
|
|
138
|
-
entityName: 'CertificateField',
|
|
139
|
-
maxUpdated_at: undefined,
|
|
140
|
-
count: 0
|
|
141
|
-
},
|
|
142
|
-
commission: {
|
|
143
|
-
idMap: {},
|
|
144
|
-
entityName: 'Commission',
|
|
145
|
-
maxUpdated_at: undefined,
|
|
146
|
-
count: 0
|
|
147
|
-
}
|
|
148
|
-
}
|
|
77
|
+
const entity1 = new EntityCommission(initialData)
|
|
78
|
+
const entity2 = new EntityCommission(initialData)
|
|
79
|
+
|
|
80
|
+
const syncMap = createSyncMap()
|
|
81
|
+
syncMap.transaction.idMap[transactionId] = transactionId
|
|
149
82
|
|
|
150
83
|
// Test: equals returns true for identical entities without SyncMap
|
|
151
84
|
expect(entity1.equals(entity2.toApi())).toBe(true)
|
|
@@ -164,7 +97,7 @@ describe('Commission class method tests', () => {
|
|
|
164
97
|
|
|
165
98
|
// Insert the first transaction to satisfy the foreign key constraint
|
|
166
99
|
const now = new Date()
|
|
167
|
-
const transactionData1:
|
|
100
|
+
const transactionData1: TableTransaction = {
|
|
168
101
|
transactionId: transactionId1,
|
|
169
102
|
created_at: now,
|
|
170
103
|
updated_at: now,
|
|
@@ -179,7 +112,7 @@ describe('Commission class method tests', () => {
|
|
|
179
112
|
await activeStorage.insertTransaction(transactionData1)
|
|
180
113
|
|
|
181
114
|
// Insert the second transaction to satisfy the foreign key constraint for mismatched data
|
|
182
|
-
const transactionData2:
|
|
115
|
+
const transactionData2: TableTransaction = {
|
|
183
116
|
transactionId: transactionId2,
|
|
184
117
|
created_at: now,
|
|
185
118
|
updated_at: now,
|
|
@@ -194,7 +127,7 @@ describe('Commission class method tests', () => {
|
|
|
194
127
|
await activeStorage.insertTransaction(transactionData2)
|
|
195
128
|
|
|
196
129
|
// Insert initial Commission record
|
|
197
|
-
const initialData:
|
|
130
|
+
const initialData: TableCommission = {
|
|
198
131
|
commissionId: 802,
|
|
199
132
|
created_at: now,
|
|
200
133
|
updated_at: now,
|
|
@@ -208,10 +141,10 @@ describe('Commission class method tests', () => {
|
|
|
208
141
|
await activeStorage.insertCommission(initialData)
|
|
209
142
|
|
|
210
143
|
// Create a Commission entity from the initial data
|
|
211
|
-
const entity1 = new
|
|
144
|
+
const entity1 = new EntityCommission(initialData)
|
|
212
145
|
|
|
213
146
|
// Create mismatched entities and test each condition
|
|
214
|
-
const mismatchedEntities: Partial<
|
|
147
|
+
const mismatchedEntities: Partial<TableCommission>[] = [
|
|
215
148
|
{ isRedeemed: true },
|
|
216
149
|
{ transactionId: transactionId2 }, // Requires valid transaction
|
|
217
150
|
{ keyOffset: 'offset456' },
|
|
@@ -220,87 +153,16 @@ describe('Commission class method tests', () => {
|
|
|
220
153
|
]
|
|
221
154
|
|
|
222
155
|
for (const mismatch of mismatchedEntities) {
|
|
223
|
-
const mismatchedEntity = new
|
|
156
|
+
const mismatchedEntity = new EntityCommission({
|
|
157
|
+
...initialData,
|
|
158
|
+
...mismatch
|
|
159
|
+
})
|
|
224
160
|
expect(entity1.equals(mismatchedEntity.toApi())).toBe(false)
|
|
225
161
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
[transactionId1]: transactionId1,
|
|
231
|
-
[transactionId2]: transactionId2
|
|
232
|
-
},
|
|
233
|
-
entityName: 'Transaction',
|
|
234
|
-
maxUpdated_at: undefined,
|
|
235
|
-
count: 0
|
|
236
|
-
},
|
|
237
|
-
outputBasket: {
|
|
238
|
-
idMap: {},
|
|
239
|
-
entityName: 'OutputBasket',
|
|
240
|
-
maxUpdated_at: undefined,
|
|
241
|
-
count: 0
|
|
242
|
-
},
|
|
243
|
-
provenTx: {
|
|
244
|
-
idMap: {},
|
|
245
|
-
entityName: 'ProvenTx',
|
|
246
|
-
maxUpdated_at: undefined,
|
|
247
|
-
count: 0
|
|
248
|
-
},
|
|
249
|
-
output: {
|
|
250
|
-
idMap: {},
|
|
251
|
-
entityName: 'Output',
|
|
252
|
-
maxUpdated_at: undefined,
|
|
253
|
-
count: 0
|
|
254
|
-
},
|
|
255
|
-
outputTag: {
|
|
256
|
-
idMap: {},
|
|
257
|
-
entityName: 'OutputTag',
|
|
258
|
-
maxUpdated_at: undefined,
|
|
259
|
-
count: 0
|
|
260
|
-
},
|
|
261
|
-
provenTxReq: {
|
|
262
|
-
idMap: {},
|
|
263
|
-
entityName: 'ProvenTxReq',
|
|
264
|
-
maxUpdated_at: undefined,
|
|
265
|
-
count: 0
|
|
266
|
-
},
|
|
267
|
-
txLabel: {
|
|
268
|
-
idMap: {},
|
|
269
|
-
entityName: 'TxLabel',
|
|
270
|
-
maxUpdated_at: undefined,
|
|
271
|
-
count: 0
|
|
272
|
-
},
|
|
273
|
-
txLabelMap: {
|
|
274
|
-
idMap: {},
|
|
275
|
-
entityName: 'TxLabelMap',
|
|
276
|
-
maxUpdated_at: undefined,
|
|
277
|
-
count: 0
|
|
278
|
-
},
|
|
279
|
-
outputTagMap: {
|
|
280
|
-
idMap: {},
|
|
281
|
-
entityName: 'OutputTagMap',
|
|
282
|
-
maxUpdated_at: undefined,
|
|
283
|
-
count: 0
|
|
284
|
-
},
|
|
285
|
-
certificate: {
|
|
286
|
-
idMap: {},
|
|
287
|
-
entityName: 'Certificate',
|
|
288
|
-
maxUpdated_at: undefined,
|
|
289
|
-
count: 0
|
|
290
|
-
},
|
|
291
|
-
certificateField: {
|
|
292
|
-
idMap: {},
|
|
293
|
-
entityName: 'CertificateField',
|
|
294
|
-
maxUpdated_at: undefined,
|
|
295
|
-
count: 0
|
|
296
|
-
},
|
|
297
|
-
commission: {
|
|
298
|
-
idMap: {},
|
|
299
|
-
entityName: 'Commission',
|
|
300
|
-
maxUpdated_at: undefined,
|
|
301
|
-
count: 0
|
|
302
|
-
}
|
|
303
|
-
}
|
|
162
|
+
const syncMap = createSyncMap()
|
|
163
|
+
syncMap.transaction.idMap[transactionId1] = transactionId1
|
|
164
|
+
syncMap.transaction.idMap[transactionId2] = transactionId2
|
|
165
|
+
|
|
304
166
|
expect(entity1.equals(mismatchedEntity.toApi(), syncMap)).toBe(false)
|
|
305
167
|
}
|
|
306
168
|
}
|
|
@@ -314,7 +176,7 @@ describe('Commission class method tests', () => {
|
|
|
314
176
|
|
|
315
177
|
// Insert a valid transaction to satisfy foreign key constraints
|
|
316
178
|
const now = new Date()
|
|
317
|
-
const transactionData:
|
|
179
|
+
const transactionData: TableTransaction = {
|
|
318
180
|
transactionId,
|
|
319
181
|
created_at: now,
|
|
320
182
|
updated_at: now,
|
|
@@ -329,7 +191,7 @@ describe('Commission class method tests', () => {
|
|
|
329
191
|
await activeStorage.insertTransaction(transactionData)
|
|
330
192
|
|
|
331
193
|
// Insert the initial Commission record
|
|
332
|
-
const initialData:
|
|
194
|
+
const initialData: TableCommission = {
|
|
333
195
|
commissionId: 803,
|
|
334
196
|
created_at: now,
|
|
335
197
|
updated_at: now,
|
|
@@ -343,94 +205,24 @@ describe('Commission class method tests', () => {
|
|
|
343
205
|
await activeStorage.insertCommission(initialData)
|
|
344
206
|
|
|
345
207
|
// Create a Commission entity from the initial data
|
|
346
|
-
const entity = new
|
|
208
|
+
const entity = new EntityCommission(initialData)
|
|
347
209
|
|
|
348
210
|
// Simulate the `ei` argument with a later `updated_at`
|
|
349
|
-
const updatedData:
|
|
211
|
+
const updatedData: TableCommission = {
|
|
350
212
|
...initialData,
|
|
351
213
|
updated_at: new Date(now.getTime() + 1000),
|
|
352
214
|
isRedeemed: true
|
|
353
215
|
}
|
|
354
216
|
|
|
217
|
+
const syncMap = createSyncMap()
|
|
218
|
+
syncMap.transaction.idMap[transactionId] = transactionId
|
|
219
|
+
|
|
355
220
|
// Call mergeExisting
|
|
356
221
|
const wasMergedRaw = await entity.mergeExisting(
|
|
357
222
|
activeStorage,
|
|
358
223
|
undefined, // `since` is not used
|
|
359
224
|
updatedData,
|
|
360
|
-
|
|
361
|
-
transaction: {
|
|
362
|
-
idMap: { [transactionId]: transactionId },
|
|
363
|
-
entityName: 'Transaction',
|
|
364
|
-
maxUpdated_at: undefined,
|
|
365
|
-
count: 0
|
|
366
|
-
},
|
|
367
|
-
outputBasket: {
|
|
368
|
-
idMap: {},
|
|
369
|
-
entityName: 'OutputBasket',
|
|
370
|
-
maxUpdated_at: undefined,
|
|
371
|
-
count: 0
|
|
372
|
-
},
|
|
373
|
-
output: {
|
|
374
|
-
idMap: {},
|
|
375
|
-
entityName: 'Output',
|
|
376
|
-
maxUpdated_at: undefined,
|
|
377
|
-
count: 0
|
|
378
|
-
},
|
|
379
|
-
provenTx: {
|
|
380
|
-
idMap: {},
|
|
381
|
-
entityName: 'ProvenTx',
|
|
382
|
-
maxUpdated_at: undefined,
|
|
383
|
-
count: 0
|
|
384
|
-
},
|
|
385
|
-
outputTag: {
|
|
386
|
-
idMap: {},
|
|
387
|
-
entityName: 'OutputTag',
|
|
388
|
-
maxUpdated_at: undefined,
|
|
389
|
-
count: 0
|
|
390
|
-
},
|
|
391
|
-
provenTxReq: {
|
|
392
|
-
idMap: {},
|
|
393
|
-
entityName: 'ProvenTxReq',
|
|
394
|
-
maxUpdated_at: undefined,
|
|
395
|
-
count: 0
|
|
396
|
-
},
|
|
397
|
-
txLabel: {
|
|
398
|
-
idMap: {},
|
|
399
|
-
entityName: 'TxLabel',
|
|
400
|
-
maxUpdated_at: undefined,
|
|
401
|
-
count: 0
|
|
402
|
-
},
|
|
403
|
-
txLabelMap: {
|
|
404
|
-
idMap: {},
|
|
405
|
-
entityName: 'TxLabelMap',
|
|
406
|
-
maxUpdated_at: undefined,
|
|
407
|
-
count: 0
|
|
408
|
-
},
|
|
409
|
-
outputTagMap: {
|
|
410
|
-
idMap: {},
|
|
411
|
-
entityName: 'OutputTagMap',
|
|
412
|
-
maxUpdated_at: undefined,
|
|
413
|
-
count: 0
|
|
414
|
-
},
|
|
415
|
-
certificate: {
|
|
416
|
-
idMap: {},
|
|
417
|
-
entityName: 'Certificate',
|
|
418
|
-
maxUpdated_at: undefined,
|
|
419
|
-
count: 0
|
|
420
|
-
},
|
|
421
|
-
certificateField: {
|
|
422
|
-
idMap: {},
|
|
423
|
-
entityName: 'CertificateField',
|
|
424
|
-
maxUpdated_at: undefined,
|
|
425
|
-
count: 0
|
|
426
|
-
},
|
|
427
|
-
commission: {
|
|
428
|
-
idMap: {},
|
|
429
|
-
entityName: 'Commission',
|
|
430
|
-
maxUpdated_at: undefined,
|
|
431
|
-
count: 0
|
|
432
|
-
}
|
|
433
|
-
},
|
|
225
|
+
syncMap,
|
|
434
226
|
undefined // `trx` is not used
|
|
435
227
|
)
|
|
436
228
|
|
|
@@ -460,7 +252,7 @@ describe('Commission class method tests', () => {
|
|
|
460
252
|
|
|
461
253
|
// Insert a valid transaction to satisfy foreign key constraints
|
|
462
254
|
const now = new Date()
|
|
463
|
-
const transactionData:
|
|
255
|
+
const transactionData: TableTransaction = {
|
|
464
256
|
transactionId,
|
|
465
257
|
created_at: now,
|
|
466
258
|
updated_at: now,
|
|
@@ -475,7 +267,7 @@ describe('Commission class method tests', () => {
|
|
|
475
267
|
await activeStorage.insertTransaction(transactionData)
|
|
476
268
|
|
|
477
269
|
// Insert the initial Commission record
|
|
478
|
-
const initialData:
|
|
270
|
+
const initialData: TableCommission = {
|
|
479
271
|
commissionId: 804,
|
|
480
272
|
created_at: now,
|
|
481
273
|
updated_at: now,
|
|
@@ -489,94 +281,24 @@ describe('Commission class method tests', () => {
|
|
|
489
281
|
await activeStorage.insertCommission(initialData)
|
|
490
282
|
|
|
491
283
|
// Create a Commission entity from the initial data
|
|
492
|
-
const entity = new
|
|
284
|
+
const entity = new EntityCommission(initialData)
|
|
493
285
|
|
|
494
286
|
// Simulate the `ei` argument with an earlier or equal `updated_at`
|
|
495
|
-
const olderOrEqualData:
|
|
287
|
+
const olderOrEqualData: TableCommission = {
|
|
496
288
|
...initialData,
|
|
497
289
|
updated_at: new Date(now.getTime()),
|
|
498
290
|
isRedeemed: true
|
|
499
291
|
}
|
|
500
292
|
|
|
293
|
+
const syncMap = createSyncMap()
|
|
294
|
+
syncMap.transaction.idMap[transactionId] = transactionId
|
|
295
|
+
|
|
501
296
|
// Call mergeExisting
|
|
502
297
|
const wasMergedRaw = await entity.mergeExisting(
|
|
503
298
|
activeStorage,
|
|
504
299
|
undefined,
|
|
505
300
|
olderOrEqualData,
|
|
506
|
-
|
|
507
|
-
transaction: {
|
|
508
|
-
idMap: { [transactionId]: transactionId },
|
|
509
|
-
entityName: 'Transaction',
|
|
510
|
-
maxUpdated_at: undefined,
|
|
511
|
-
count: 0
|
|
512
|
-
},
|
|
513
|
-
outputBasket: {
|
|
514
|
-
idMap: {},
|
|
515
|
-
entityName: 'OutputBasket',
|
|
516
|
-
maxUpdated_at: undefined,
|
|
517
|
-
count: 0
|
|
518
|
-
},
|
|
519
|
-
output: {
|
|
520
|
-
idMap: {},
|
|
521
|
-
entityName: 'Output',
|
|
522
|
-
maxUpdated_at: undefined,
|
|
523
|
-
count: 0
|
|
524
|
-
},
|
|
525
|
-
provenTx: {
|
|
526
|
-
idMap: {},
|
|
527
|
-
entityName: 'ProvenTx',
|
|
528
|
-
maxUpdated_at: undefined,
|
|
529
|
-
count: 0
|
|
530
|
-
},
|
|
531
|
-
outputTag: {
|
|
532
|
-
idMap: {},
|
|
533
|
-
entityName: 'OutputTag',
|
|
534
|
-
maxUpdated_at: undefined,
|
|
535
|
-
count: 0
|
|
536
|
-
},
|
|
537
|
-
provenTxReq: {
|
|
538
|
-
idMap: {},
|
|
539
|
-
entityName: 'ProvenTxReq',
|
|
540
|
-
maxUpdated_at: undefined,
|
|
541
|
-
count: 0
|
|
542
|
-
},
|
|
543
|
-
txLabel: {
|
|
544
|
-
idMap: {},
|
|
545
|
-
entityName: 'TxLabel',
|
|
546
|
-
maxUpdated_at: undefined,
|
|
547
|
-
count: 0
|
|
548
|
-
},
|
|
549
|
-
txLabelMap: {
|
|
550
|
-
idMap: {},
|
|
551
|
-
entityName: 'TxLabelMap',
|
|
552
|
-
maxUpdated_at: undefined,
|
|
553
|
-
count: 0
|
|
554
|
-
},
|
|
555
|
-
outputTagMap: {
|
|
556
|
-
idMap: {},
|
|
557
|
-
entityName: 'OutputTagMap',
|
|
558
|
-
maxUpdated_at: undefined,
|
|
559
|
-
count: 0
|
|
560
|
-
},
|
|
561
|
-
certificate: {
|
|
562
|
-
idMap: {},
|
|
563
|
-
entityName: 'Certificate',
|
|
564
|
-
maxUpdated_at: undefined,
|
|
565
|
-
count: 0
|
|
566
|
-
},
|
|
567
|
-
certificateField: {
|
|
568
|
-
idMap: {},
|
|
569
|
-
entityName: 'CertificateField',
|
|
570
|
-
maxUpdated_at: undefined,
|
|
571
|
-
count: 0
|
|
572
|
-
},
|
|
573
|
-
commission: {
|
|
574
|
-
idMap: {},
|
|
575
|
-
entityName: 'Commission',
|
|
576
|
-
maxUpdated_at: undefined,
|
|
577
|
-
count: 0
|
|
578
|
-
}
|
|
579
|
-
},
|
|
301
|
+
syncMap,
|
|
580
302
|
undefined // `trx` is not used
|
|
581
303
|
)
|
|
582
304
|
|
|
@@ -603,7 +325,7 @@ describe('Commission class method tests', () => {
|
|
|
603
325
|
const now = new Date()
|
|
604
326
|
|
|
605
327
|
// Initial test data
|
|
606
|
-
const initialData:
|
|
328
|
+
const initialData: TableCommission = {
|
|
607
329
|
commissionId: 801,
|
|
608
330
|
created_at: now,
|
|
609
331
|
updated_at: now,
|
|
@@ -616,7 +338,7 @@ describe('Commission class method tests', () => {
|
|
|
616
338
|
}
|
|
617
339
|
|
|
618
340
|
// Create the Commission entity
|
|
619
|
-
const entity = new
|
|
341
|
+
const entity = new EntityCommission(initialData)
|
|
620
342
|
|
|
621
343
|
// Validate getters
|
|
622
344
|
expect(entity.commissionId).toBe(initialData.commissionId)
|
|
@@ -629,7 +351,7 @@ describe('Commission class method tests', () => {
|
|
|
629
351
|
expect(entity.lockingScript).toEqual(initialData.lockingScript)
|
|
630
352
|
expect(entity.satoshis).toBe(initialData.satoshis)
|
|
631
353
|
expect(entity.id).toBe(initialData.commissionId)
|
|
632
|
-
expect(entity.entityName).toBe('
|
|
354
|
+
expect(entity.entityName).toBe('commission')
|
|
633
355
|
expect(entity.entityTable).toBe('commissions')
|
|
634
356
|
|
|
635
357
|
// Validate setters
|