@bsv/wallet-toolbox 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/docs/client.md +97 -28
- package/docs/services.md +2 -1
- package/docs/setup.md +404 -14
- package/docs/storage.md +720 -42
- package/docs/wallet.md +97 -28
- package/out/src/CWIStyleWalletManager.d.ts.map +1 -1
- package/out/src/CWIStyleWalletManager.js +12 -5
- package/out/src/CWIStyleWalletManager.js.map +1 -1
- package/out/src/Setup.d.ts +2 -69
- package/out/src/Setup.d.ts.map +1 -1
- package/out/src/Setup.js.map +1 -1
- package/out/src/SetupClient.d.ts +126 -0
- package/out/src/SetupClient.d.ts.map +1 -0
- package/out/src/SetupClient.js +220 -0
- package/out/src/SetupClient.js.map +1 -0
- package/out/src/SetupWallet.d.ts +100 -0
- package/out/src/SetupWallet.d.ts.map +1 -0
- package/out/src/{storage/schema/tables/Certificate.js → SetupWallet.js} +1 -1
- package/out/src/SetupWallet.js.map +1 -0
- package/out/src/index.all.d.ts +2 -0
- package/out/src/index.all.d.ts.map +1 -1
- package/out/src/index.all.js +2 -0
- package/out/src/index.all.js.map +1 -1
- package/out/src/index.client.d.ts +1 -0
- package/out/src/index.client.d.ts.map +1 -1
- package/out/src/index.client.js +1 -0
- package/out/src/index.client.js.map +1 -1
- package/out/src/monitor/Monitor.d.ts.map +1 -1
- package/out/src/monitor/Monitor.js +4 -0
- package/out/src/monitor/Monitor.js.map +1 -1
- package/out/src/monitor/MonitorDaemon.d.ts.map +1 -1
- package/out/src/monitor/MonitorDaemon.js +0 -3
- package/out/src/monitor/MonitorDaemon.js.map +1 -1
- package/out/src/monitor/tasks/TaskUnFail.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskUnFail.js +1 -2
- package/out/src/monitor/tasks/TaskUnFail.js.map +1 -1
- package/out/src/sdk/WalletServices.interfaces.d.ts +9 -0
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
- package/out/src/services/Services.d.ts +2 -1
- package/out/src/services/Services.d.ts.map +1 -1
- package/out/src/services/Services.js +8 -0
- package/out/src/services/Services.js.map +1 -1
- package/out/src/services/__tests/postBeef.test.js +1 -1
- package/out/src/services/__tests/postBeef.test.js.map +1 -1
- package/out/src/storage/StorageIdb.d.ts +203 -0
- package/out/src/storage/StorageIdb.d.ts.map +1 -0
- package/out/src/storage/StorageIdb.js +2289 -0
- package/out/src/storage/StorageIdb.js.map +1 -0
- package/out/src/storage/StorageKnex.d.ts +6 -6
- package/out/src/storage/StorageKnex.d.ts.map +1 -1
- package/out/src/storage/StorageKnex.js +9 -29
- package/out/src/storage/StorageKnex.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts +3 -1
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +22 -0
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/StorageReader.d.ts +1 -1
- package/out/src/storage/StorageReader.d.ts.map +1 -1
- package/out/src/storage/StorageReader.js +5 -0
- package/out/src/storage/StorageReader.js.map +1 -1
- package/out/src/storage/__test/StorageIdb.test.d.ts +2 -0
- package/out/src/storage/__test/StorageIdb.test.d.ts.map +1 -0
- package/out/src/storage/__test/StorageIdb.test.js +16 -0
- package/out/src/storage/__test/StorageIdb.test.js.map +1 -0
- package/out/src/storage/methods/ListActionsSpecOp.d.ts +16 -0
- package/out/src/storage/methods/ListActionsSpecOp.d.ts.map +1 -0
- package/out/src/storage/methods/ListActionsSpecOp.js +40 -0
- package/out/src/storage/methods/ListActionsSpecOp.js.map +1 -0
- package/out/src/storage/methods/ListOutputsSpecOp.d.ts +26 -0
- package/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +1 -0
- package/out/src/storage/methods/ListOutputsSpecOp.js +71 -0
- package/out/src/storage/methods/ListOutputsSpecOp.js.map +1 -0
- package/out/src/storage/methods/listActionsIdb.d.ts +5 -0
- package/out/src/storage/methods/listActionsIdb.d.ts.map +1 -0
- package/out/src/storage/methods/listActionsIdb.js +155 -0
- package/out/src/storage/methods/listActionsIdb.js.map +1 -0
- package/out/src/storage/methods/{listActions.d.ts → listActionsKnex.d.ts} +1 -1
- package/out/src/storage/methods/listActionsKnex.d.ts.map +1 -0
- package/out/src/storage/methods/{listActions.js → listActionsKnex.js} +3 -34
- package/out/src/storage/methods/listActionsKnex.js.map +1 -0
- package/out/src/storage/methods/listOutputsIdb.d.ts +5 -0
- package/out/src/storage/methods/listOutputsIdb.d.ts.map +1 -0
- package/out/src/storage/methods/listOutputsIdb.js +181 -0
- package/out/src/storage/methods/listOutputsIdb.js.map +1 -0
- package/out/src/storage/methods/{listOutputs.d.ts → listOutputsKnex.d.ts} +1 -1
- package/out/src/storage/methods/listOutputsKnex.d.ts.map +1 -0
- package/out/src/storage/methods/{listOutputs.js → listOutputsKnex.js} +7 -76
- package/out/src/storage/methods/listOutputsKnex.js.map +1 -0
- package/out/src/storage/methods/purgeDataIdb.d.ts +4 -0
- package/out/src/storage/methods/purgeDataIdb.d.ts.map +1 -0
- package/out/src/storage/methods/purgeDataIdb.js +9 -0
- package/out/src/storage/methods/purgeDataIdb.js.map +1 -0
- package/out/src/storage/methods/reviewStatus.d.ts +11 -0
- package/out/src/storage/methods/reviewStatus.d.ts.map +1 -1
- package/out/src/storage/methods/reviewStatus.js +11 -0
- package/out/src/storage/methods/reviewStatus.js.map +1 -1
- package/out/src/storage/methods/reviewStatusIdb.d.ts +20 -0
- package/out/src/storage/methods/reviewStatusIdb.d.ts.map +1 -0
- package/out/src/storage/methods/reviewStatusIdb.js +35 -0
- package/out/src/storage/methods/reviewStatusIdb.js.map +1 -0
- package/out/src/storage/schema/StorageIdbSchema.d.ts +133 -0
- package/out/src/storage/schema/StorageIdbSchema.d.ts.map +1 -0
- package/out/src/storage/schema/{tables/CertificateField.js → StorageIdbSchema.js} +1 -1
- package/out/src/storage/schema/StorageIdbSchema.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
- package/out/src/storage/schema/tables/{Certificate.d.ts → TableCertificate.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableCertificate.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableCertificate.js +3 -0
- package/out/src/storage/schema/tables/TableCertificate.js.map +1 -0
- package/out/src/storage/schema/tables/{CertificateField.d.ts → TableCertificateField.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableCertificateField.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableCertificateField.js +3 -0
- package/out/src/storage/schema/tables/TableCertificateField.js.map +1 -0
- package/out/src/storage/schema/tables/{Commission.d.ts → TableCommission.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableCommission.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableCommission.js +3 -0
- package/out/src/storage/schema/tables/TableCommission.js.map +1 -0
- package/out/src/storage/schema/tables/{MonitorEvent.d.ts → TableMonitorEvent.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableMonitorEvent.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableMonitorEvent.js +3 -0
- package/out/src/storage/schema/tables/TableMonitorEvent.js.map +1 -0
- package/out/src/storage/schema/tables/{Output.d.ts → TableOutput.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableOutput.d.ts.map +1 -0
- package/out/src/storage/schema/tables/{Output.js → TableOutput.js} +1 -1
- package/out/src/storage/schema/tables/TableOutput.js.map +1 -0
- package/out/src/storage/schema/tables/{OutputBasket.d.ts → TableOutputBasket.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableOutputBasket.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableOutputBasket.js +3 -0
- package/out/src/storage/schema/tables/TableOutputBasket.js.map +1 -0
- package/out/src/storage/schema/tables/{OutputTag.d.ts → TableOutputTag.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableOutputTag.d.ts.map +1 -0
- package/out/src/storage/schema/tables/{MonitorEvent.js → TableOutputTag.js} +1 -1
- package/out/src/storage/schema/tables/TableOutputTag.js.map +1 -0
- package/out/src/storage/schema/tables/{OutputTagMap.d.ts → TableOutputTagMap.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableOutputTagMap.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableOutputTagMap.js +3 -0
- package/out/src/storage/schema/tables/TableOutputTagMap.js.map +1 -0
- package/out/src/storage/schema/tables/{ProvenTx.d.ts → TableProvenTx.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableProvenTx.d.ts.map +1 -0
- package/out/src/storage/schema/tables/{Commission.js → TableProvenTx.js} +1 -1
- package/out/src/storage/schema/tables/TableProvenTx.js.map +1 -0
- package/out/src/storage/schema/tables/{ProvenTxReq.d.ts → TableProvenTxReq.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableProvenTxReq.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableProvenTxReq.js +3 -0
- package/out/src/storage/schema/tables/TableProvenTxReq.js.map +1 -0
- package/out/src/storage/schema/tables/TableSettings.d.ts +1 -1
- package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -1
- package/out/src/storage/schema/tables/{SyncState.d.ts → TableSyncState.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableSyncState.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableSyncState.js +3 -0
- package/out/src/storage/schema/tables/TableSyncState.js.map +1 -0
- package/out/src/storage/schema/tables/{Transaction.d.ts → TableTransaction.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableTransaction.d.ts.map +1 -0
- package/out/src/storage/schema/tables/{Transaction.js → TableTransaction.js} +1 -1
- package/out/src/storage/schema/tables/TableTransaction.js.map +1 -0
- package/out/src/storage/schema/tables/{TxLabel.d.ts → TableTxLabel.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableTxLabel.d.ts.map +1 -0
- package/out/src/storage/schema/tables/{OutputBasket.js → TableTxLabel.js} +1 -1
- package/out/src/storage/schema/tables/TableTxLabel.js.map +1 -0
- package/out/src/storage/schema/tables/{TxLabelMap.d.ts → TableTxLabelMap.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableTxLabelMap.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TableTxLabelMap.js +3 -0
- package/out/src/storage/schema/tables/TableTxLabelMap.js.map +1 -0
- package/out/src/storage/schema/tables/{User.d.ts → TableUser.d.ts} +1 -1
- package/out/src/storage/schema/tables/TableUser.d.ts.map +1 -0
- package/out/src/storage/schema/tables/{SyncState.js → TableUser.js} +1 -1
- package/out/src/storage/schema/tables/TableUser.js.map +1 -0
- package/out/src/storage/schema/tables/index.d.ts +15 -15
- package/out/src/storage/schema/tables/index.d.ts.map +1 -1
- package/out/src/storage/schema/tables/index.js +15 -15
- package/out/src/storage/schema/tables/index.js.map +1 -1
- package/out/test/Wallet/local/localWallet2.man.test.js +4 -0
- package/out/test/Wallet/local/localWallet2.man.test.js.map +1 -1
- package/out/test/Wallet/support/operations.man.test.d.ts +2 -0
- package/out/test/Wallet/support/operations.man.test.d.ts.map +1 -0
- package/out/test/Wallet/support/{opers1.man.test.js → operations.man.test.js} +41 -6
- package/out/test/Wallet/support/operations.man.test.js.map +1 -0
- package/out/test/storage/find.test.js +1 -1
- package/out/test/storage/find.test.js.map +1 -1
- package/out/test/storage/idb/allocateChange.test.d.ts +2 -0
- package/out/test/storage/idb/allocateChange.test.d.ts.map +1 -0
- package/out/test/storage/idb/allocateChange.test.js +110 -0
- package/out/test/storage/idb/allocateChange.test.js.map +1 -0
- package/out/test/storage/idb/count.test.d.ts +2 -0
- package/out/test/storage/idb/count.test.d.ts.map +1 -0
- package/out/test/storage/idb/count.test.js +129 -0
- package/out/test/storage/idb/count.test.js.map +1 -0
- package/out/test/storage/idb/find.test.d.ts +2 -0
- package/out/test/storage/idb/find.test.d.ts.map +1 -0
- package/out/test/storage/idb/find.test.js +131 -0
- package/out/test/storage/idb/find.test.js.map +1 -0
- package/out/test/storage/idb/idbSpeed.test.d.ts +2 -0
- package/out/test/storage/idb/idbSpeed.test.d.ts.map +1 -0
- package/out/test/storage/idb/idbSpeed.test.js +29 -0
- package/out/test/storage/idb/idbSpeed.test.js.map +1 -0
- package/out/test/storage/idb/insert.test.d.ts +2 -0
- package/out/test/storage/idb/insert.test.d.ts.map +1 -0
- package/out/test/storage/idb/insert.test.js +242 -0
- package/out/test/storage/idb/insert.test.js.map +1 -0
- package/out/test/storage/idb/transactionAbort.test.d.ts +2 -0
- package/out/test/storage/idb/transactionAbort.test.d.ts.map +1 -0
- package/out/test/storage/idb/transactionAbort.test.js +97 -0
- package/out/test/storage/idb/transactionAbort.test.js.map +1 -0
- package/out/test/storage/idb/update.test.d.ts +2 -0
- package/out/test/storage/idb/update.test.d.ts.map +1 -0
- package/out/test/storage/idb/update.test.js +902 -0
- package/out/test/storage/idb/update.test.js.map +1 -0
- package/out/test/storage/update.test.js +2 -2
- package/out/test/storage/update.test.js.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.d.ts +24 -1
- package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.js +147 -3
- package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
- package/out/test/wallet/list/listActions.test.d.ts +1 -1
- package/out/test/wallet/list/listActions.test.d.ts.map +1 -1
- package/out/test/wallet/list/listActions.test.js +9 -3
- package/out/test/wallet/list/listActions.test.js.map +1 -1
- package/out/test/wallet/list/listOutputs.test.d.ts +1 -1
- package/out/test/wallet/list/listOutputs.test.d.ts.map +1 -1
- package/out/test/wallet/list/listOutputs.test.js +34 -219
- package/out/test/wallet/list/listOutputs.test.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +3 -1
- package/src/CWIStyleWalletManager.ts +12 -5
- package/src/Setup.ts +1 -71
- package/src/SetupClient.ts +312 -0
- package/src/SetupWallet.ts +105 -0
- package/src/index.all.ts +2 -0
- package/src/index.client.ts +1 -0
- package/src/monitor/Monitor.ts +4 -0
- package/src/monitor/MonitorDaemon.ts +0 -1
- package/src/monitor/tasks/TaskUnFail.ts +3 -4
- package/src/sdk/WalletServices.interfaces.ts +10 -0
- package/src/services/Services.ts +13 -1
- package/src/services/__tests/postBeef.test.ts +1 -1
- package/src/storage/StorageIdb.ts +2298 -0
- package/src/storage/StorageKnex.ts +7 -32
- package/src/storage/StorageProvider.ts +28 -0
- package/src/storage/StorageReader.ts +5 -1
- package/src/storage/__test/StorageIdb.test.ts +15 -0
- package/src/storage/methods/ListActionsSpecOp.ts +68 -0
- package/src/storage/methods/ListOutputsSpecOp.ts +125 -0
- package/src/storage/methods/listActionsIdb.ts +181 -0
- package/src/storage/methods/{listActions.ts → listActionsKnex.ts} +2 -64
- package/src/storage/methods/listOutputsIdb.ts +199 -0
- package/src/storage/methods/{listOutputs.ts → listOutputsKnex.ts} +9 -133
- package/src/storage/methods/purgeDataIdb.ts +15 -0
- package/src/storage/methods/reviewStatus.ts +11 -0
- package/src/storage/methods/reviewStatusIdb.ts +43 -0
- package/src/storage/schema/StorageIdbSchema.ts +150 -0
- package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +2 -0
- package/src/storage/schema/tables/TableSettings.ts +1 -1
- package/src/storage/schema/tables/index.ts +15 -15
- package/test/Wallet/local/localWallet2.man.test.ts +5 -0
- package/test/Wallet/support/{opers1.man.test.ts → operations.man.test.ts} +43 -14
- package/test/storage/find.test.ts +1 -1
- package/test/storage/idb/allocateChange.test.ts +251 -0
- package/test/storage/idb/count.test.ts +158 -0
- package/test/storage/idb/find.test.ts +177 -0
- package/test/storage/idb/idbSpeed.test.ts +34 -0
- package/test/storage/idb/insert.test.ts +268 -0
- package/test/storage/idb/transactionAbort.test.ts +108 -0
- package/test/storage/idb/update.test.ts +1000 -0
- package/test/storage/update.test.ts +2 -2
- package/test/utils/TestUtilsWalletStorage.ts +188 -4
- package/test/wallet/list/listActions.test.ts +15 -5
- package/test/wallet/list/listOutputs.test.ts +29 -214
- package/out/src/storage/methods/listActions.d.ts.map +0 -1
- package/out/src/storage/methods/listActions.js.map +0 -1
- package/out/src/storage/methods/listOutputs.d.ts.map +0 -1
- package/out/src/storage/methods/listOutputs.js.map +0 -1
- package/out/src/storage/schema/tables/Certificate.d.ts.map +0 -1
- package/out/src/storage/schema/tables/Certificate.js.map +0 -1
- package/out/src/storage/schema/tables/CertificateField.d.ts.map +0 -1
- package/out/src/storage/schema/tables/CertificateField.js.map +0 -1
- package/out/src/storage/schema/tables/Commission.d.ts.map +0 -1
- package/out/src/storage/schema/tables/Commission.js.map +0 -1
- package/out/src/storage/schema/tables/MonitorEvent.d.ts.map +0 -1
- package/out/src/storage/schema/tables/MonitorEvent.js.map +0 -1
- package/out/src/storage/schema/tables/Output.d.ts.map +0 -1
- package/out/src/storage/schema/tables/Output.js.map +0 -1
- package/out/src/storage/schema/tables/OutputBasket.d.ts.map +0 -1
- package/out/src/storage/schema/tables/OutputBasket.js.map +0 -1
- package/out/src/storage/schema/tables/OutputTag.d.ts.map +0 -1
- package/out/src/storage/schema/tables/OutputTag.js +0 -3
- package/out/src/storage/schema/tables/OutputTag.js.map +0 -1
- package/out/src/storage/schema/tables/OutputTagMap.d.ts.map +0 -1
- package/out/src/storage/schema/tables/OutputTagMap.js +0 -3
- package/out/src/storage/schema/tables/OutputTagMap.js.map +0 -1
- package/out/src/storage/schema/tables/ProvenTx.d.ts.map +0 -1
- package/out/src/storage/schema/tables/ProvenTx.js +0 -3
- package/out/src/storage/schema/tables/ProvenTx.js.map +0 -1
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts.map +0 -1
- package/out/src/storage/schema/tables/ProvenTxReq.js +0 -3
- package/out/src/storage/schema/tables/ProvenTxReq.js.map +0 -1
- package/out/src/storage/schema/tables/SyncState.d.ts.map +0 -1
- package/out/src/storage/schema/tables/SyncState.js.map +0 -1
- package/out/src/storage/schema/tables/Transaction.d.ts.map +0 -1
- package/out/src/storage/schema/tables/Transaction.js.map +0 -1
- package/out/src/storage/schema/tables/TxLabel.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TxLabel.js +0 -3
- package/out/src/storage/schema/tables/TxLabel.js.map +0 -1
- package/out/src/storage/schema/tables/TxLabelMap.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TxLabelMap.js +0 -3
- package/out/src/storage/schema/tables/TxLabelMap.js.map +0 -1
- package/out/src/storage/schema/tables/User.d.ts.map +0 -1
- package/out/src/storage/schema/tables/User.js +0 -3
- package/out/src/storage/schema/tables/User.js.map +0 -1
- package/out/test/Wallet/support/opers1.man.test.d.ts +0 -2
- package/out/test/Wallet/support/opers1.man.test.d.ts.map +0 -1
- package/out/test/Wallet/support/opers1.man.test.js.map +0 -1
- package/unlock-migrations.sh +0 -41
- /package/src/storage/schema/tables/{Certificate.ts → TableCertificate.ts} +0 -0
- /package/src/storage/schema/tables/{CertificateField.ts → TableCertificateField.ts} +0 -0
- /package/src/storage/schema/tables/{Commission.ts → TableCommission.ts} +0 -0
- /package/src/storage/schema/tables/{MonitorEvent.ts → TableMonitorEvent.ts} +0 -0
- /package/src/storage/schema/tables/{Output.ts → TableOutput.ts} +0 -0
- /package/src/storage/schema/tables/{OutputBasket.ts → TableOutputBasket.ts} +0 -0
- /package/src/storage/schema/tables/{OutputTag.ts → TableOutputTag.ts} +0 -0
- /package/src/storage/schema/tables/{OutputTagMap.ts → TableOutputTagMap.ts} +0 -0
- /package/src/storage/schema/tables/{ProvenTx.ts → TableProvenTx.ts} +0 -0
- /package/src/storage/schema/tables/{ProvenTxReq.ts → TableProvenTxReq.ts} +0 -0
- /package/src/storage/schema/tables/{SyncState.ts → TableSyncState.ts} +0 -0
- /package/src/storage/schema/tables/{Transaction.ts → TableTransaction.ts} +0 -0
- /package/src/storage/schema/tables/{TxLabel.ts → TableTxLabel.ts} +0 -0
- /package/src/storage/schema/tables/{TxLabelMap.ts → TableTxLabelMap.ts} +0 -0
- /package/src/storage/schema/tables/{User.ts → TableUser.ts} +0 -0
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { WalletOutput } from '@bsv/sdk'
|
|
2
2
|
import { sdk, Services, Setup, StorageKnex, TableOutput, TableUser, verifyOne, verifyOneOrNone } from '../../../src'
|
|
3
3
|
import { _tu, TuEnv } from '../../utils/TestUtilsWalletStorage'
|
|
4
|
-
import { specOpInvalidChange, ValidListOutputsArgs
|
|
5
|
-
import {
|
|
6
|
-
burnOneSatTestOutput,
|
|
7
|
-
createOneSatTestOutput,
|
|
8
|
-
createSetup,
|
|
9
|
-
doubleSpendOldChange,
|
|
10
|
-
LocalWalletTestOptions,
|
|
11
|
-
recoverOneSatTestOutputs
|
|
12
|
-
} from '../../utils/localWalletMethods'
|
|
4
|
+
import { specOpInvalidChange, ValidListOutputsArgs } from '../../../src/sdk'
|
|
5
|
+
import { LocalWalletTestOptions } from '../../utils/localWalletMethods'
|
|
13
6
|
|
|
14
7
|
import * as dotenv from 'dotenv'
|
|
15
8
|
dotenv.config()
|
|
@@ -23,7 +16,7 @@ const options: LocalWalletTestOptions = {
|
|
|
23
16
|
useIdentityKey2: false
|
|
24
17
|
}
|
|
25
18
|
|
|
26
|
-
describe('
|
|
19
|
+
describe('operations.man tests', () => {
|
|
27
20
|
jest.setTimeout(99999999)
|
|
28
21
|
|
|
29
22
|
test('0 review and release all production invalid change utxos', async () => {
|
|
@@ -62,9 +55,45 @@ describe('operations1 tests', () => {
|
|
|
62
55
|
await storage.destroy()
|
|
63
56
|
})
|
|
64
57
|
|
|
65
|
-
test('
|
|
58
|
+
test.skip('0a review all spendable outputs for userId', async () => {
|
|
59
|
+
const { env, storage } = await createMainReviewSetup()
|
|
60
|
+
const users = await storage.findUsers({ partial: {} })
|
|
61
|
+
const withInvalid: Record<number, { user: TableUser; outputs: WalletOutput[]; total: number }> = {}
|
|
62
|
+
const vargs: ValidListOutputsArgs = {
|
|
63
|
+
basket: specOpInvalidChange,
|
|
64
|
+
tags: ['release', 'all'],
|
|
65
|
+
tagQueryMode: 'all',
|
|
66
|
+
includeLockingScripts: false,
|
|
67
|
+
includeTransactions: false,
|
|
68
|
+
includeCustomInstructions: false,
|
|
69
|
+
includeTags: false,
|
|
70
|
+
includeLabels: false,
|
|
71
|
+
limit: 0,
|
|
72
|
+
offset: 0,
|
|
73
|
+
seekPermission: false,
|
|
74
|
+
knownTxids: []
|
|
75
|
+
}
|
|
76
|
+
let log = ''
|
|
77
|
+
for (const user of users) {
|
|
78
|
+
const { userId } = user
|
|
79
|
+
const auth = { userId, identityKey: '' }
|
|
80
|
+
let r = await storage.listOutputs(auth, vargs)
|
|
81
|
+
if (r.totalOutputs > 0) {
|
|
82
|
+
const total: number = r.outputs.reduce((s, o) => (s += o.satoshis), 0)
|
|
83
|
+
log += `userId ${userId}: ${r.totalOutputs} unspendable utxos, total ${total}, ${user.identityKey}\n`
|
|
84
|
+
for (const o of r.outputs) {
|
|
85
|
+
log += ` ${o.outpoint} ${o.satoshis}\n`
|
|
86
|
+
}
|
|
87
|
+
withInvalid[userId] = { user, outputs: r.outputs, total }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
console.log(log || 'Found zero invalid change outputs.')
|
|
91
|
+
await storage.destroy()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('1 review and unfail false doubleSpends', async () => {
|
|
66
95
|
const { env, storage, services } = await createMainReviewSetup()
|
|
67
|
-
let offset =
|
|
96
|
+
let offset = 2400
|
|
68
97
|
const limit = 100
|
|
69
98
|
let allUnfails: number[] = []
|
|
70
99
|
for (;;) {
|
|
@@ -89,9 +118,9 @@ describe('operations1 tests', () => {
|
|
|
89
118
|
await storage.destroy()
|
|
90
119
|
})
|
|
91
120
|
|
|
92
|
-
test('
|
|
121
|
+
test('2 review and unfail false invalids', async () => {
|
|
93
122
|
const { env, storage, services } = await createMainReviewSetup()
|
|
94
|
-
let offset =
|
|
123
|
+
let offset = 600
|
|
95
124
|
const limit = 100
|
|
96
125
|
let allUnfails: number[] = []
|
|
97
126
|
for (;;) {
|
|
@@ -34,7 +34,7 @@ describe('find tests', () => {
|
|
|
34
34
|
|
|
35
35
|
for (const storage of storages) {
|
|
36
36
|
await storage.dropAllData()
|
|
37
|
-
await storage.migrate('
|
|
37
|
+
await storage.migrate('find tests', '1'.repeat(64))
|
|
38
38
|
await storage.makeAvailable()
|
|
39
39
|
setups.push({ storage, setup: await _tu.createTestSetup1(storage) })
|
|
40
40
|
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { _tu, logger, TestSetup1 } from '../../utils/TestUtilsWalletStorage'
|
|
2
|
+
import {
|
|
3
|
+
randomBytesBase64,
|
|
4
|
+
randomBytesHex,
|
|
5
|
+
sdk,
|
|
6
|
+
StorageProvider,
|
|
7
|
+
StorageProviderOptions,
|
|
8
|
+
TableCommission,
|
|
9
|
+
TableOutput,
|
|
10
|
+
TableTransaction
|
|
11
|
+
} from '../../../src/index.client'
|
|
12
|
+
import { StorageIdb } from '../../../src/storage/StorageIdb'
|
|
13
|
+
|
|
14
|
+
import 'fake-indexeddb/auto'
|
|
15
|
+
import { openDB } from 'idb'
|
|
16
|
+
|
|
17
|
+
describe('idb transactionAbort tests', () => {
|
|
18
|
+
jest.setTimeout(99999999)
|
|
19
|
+
|
|
20
|
+
const chain: sdk.Chain = 'test'
|
|
21
|
+
const env = _tu.getEnv(chain)
|
|
22
|
+
let setups: { setup: TestSetup2; storage: StorageProvider }[] = []
|
|
23
|
+
|
|
24
|
+
beforeEach(async () => {
|
|
25
|
+
const options: StorageProviderOptions = StorageProvider.createStorageBaseOptions(chain)
|
|
26
|
+
const storage = new StorageIdb(options)
|
|
27
|
+
await storage.dropAllData()
|
|
28
|
+
await storage.migrate('idb find tests', '1'.repeat(64))
|
|
29
|
+
await storage.makeAvailable()
|
|
30
|
+
const setup1 = await _tu.createTestSetup1(storage)
|
|
31
|
+
const u1tx2 = (await _tu.insertTestTransaction(storage, setup1.u1, false, { status: 'completed' })).tx
|
|
32
|
+
const setup2: TestSetup2 = {
|
|
33
|
+
...setup1,
|
|
34
|
+
u1tx2,
|
|
35
|
+
u1tx2o0: await _tu.insertTestOutput(storage, u1tx2, 0, 3, setup1.u1basket1),
|
|
36
|
+
u1tx2o1: await _tu.insertTestOutput(storage, u1tx2, 1, 13, setup1.u1basket1),
|
|
37
|
+
u1tx2o2: await _tu.insertTestOutput(storage, u1tx2, 2, 113, setup1.u1basket1),
|
|
38
|
+
u1tx2o3: await _tu.insertTestOutput(storage, u1tx2, 3, 1113, setup1.u1basket1),
|
|
39
|
+
u1tx2o4: await _tu.insertTestOutput(storage, u1tx2, 4, 11113, setup1.u1basket1),
|
|
40
|
+
u1tx2o5: await _tu.insertTestOutput(storage, u1tx2, 5, 111113, setup1.u1basket1),
|
|
41
|
+
u1tx2o6: await _tu.insertTestOutput(storage, u1tx2, 6, 1111113, setup1.u1basket1),
|
|
42
|
+
u1tx2o7: await _tu.insertTestOutput(storage, u1tx2, 7, 11111113, setup1.u1basket1),
|
|
43
|
+
u1tx2o8: await _tu.insertTestOutput(storage, u1tx2, 8, 111111113, setup1.u1basket1),
|
|
44
|
+
u1tx3: (await _tu.insertTestTransaction(storage, setup1.u1, false, { status: 'completed' })).tx,
|
|
45
|
+
u1tx4: (await _tu.insertTestTransaction(storage, setup1.u1, false, { status: 'unproven' })).tx,
|
|
46
|
+
u1tx5: (await _tu.insertTestTransaction(storage, setup1.u1, false, { status: 'sending' })).tx
|
|
47
|
+
}
|
|
48
|
+
setups = [{ setup: setup2, storage }]
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
afterEach(async () => {
|
|
52
|
+
for (const { storage } of setups) {
|
|
53
|
+
await storage.destroy()
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
test('0 basket with no outputs', async () => {
|
|
58
|
+
for (const { storage, setup } of setups) {
|
|
59
|
+
const r = await storage.allocateChangeInput(setup.u1.userId, 42, 11113, 11113, true, setup.u1tx3.transactionId)
|
|
60
|
+
expect(r).toBeUndefined()
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
test('1 exactSatoshis', async () => {
|
|
65
|
+
for (const { storage, setup } of setups) {
|
|
66
|
+
const r = await storage.allocateChangeInput(
|
|
67
|
+
setup.u1.userId,
|
|
68
|
+
setup.u1basket1.basketId,
|
|
69
|
+
11113,
|
|
70
|
+
11113,
|
|
71
|
+
true,
|
|
72
|
+
setup.u1tx3.transactionId
|
|
73
|
+
)
|
|
74
|
+
expect(r?.outputId).toBe(setup.u1tx2o4.outputId)
|
|
75
|
+
const r2 = await storage.allocateChangeInput(
|
|
76
|
+
setup.u1.userId,
|
|
77
|
+
setup.u1basket1.basketId,
|
|
78
|
+
11113,
|
|
79
|
+
11113,
|
|
80
|
+
true,
|
|
81
|
+
setup.u1tx3.transactionId
|
|
82
|
+
)
|
|
83
|
+
expect(r2?.outputId).toBe(setup.u1tx2o5.outputId)
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
test('2 targetSatoshis exact', async () => {
|
|
88
|
+
for (const { storage, setup } of setups) {
|
|
89
|
+
const r = await storage.allocateChangeInput(
|
|
90
|
+
setup.u1.userId,
|
|
91
|
+
setup.u1basket1.basketId,
|
|
92
|
+
11113,
|
|
93
|
+
undefined,
|
|
94
|
+
true,
|
|
95
|
+
setup.u1tx3.transactionId
|
|
96
|
+
)
|
|
97
|
+
expect(r?.outputId).toBe(setup.u1tx2o4.outputId)
|
|
98
|
+
const r2 = await storage.allocateChangeInput(
|
|
99
|
+
setup.u1.userId,
|
|
100
|
+
setup.u1basket1.basketId,
|
|
101
|
+
11113,
|
|
102
|
+
undefined,
|
|
103
|
+
true,
|
|
104
|
+
setup.u1tx3.transactionId
|
|
105
|
+
)
|
|
106
|
+
expect(r2?.outputId).toBe(setup.u1tx2o5.outputId)
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
test('2a targetSatoshis exact unproven', async () => {
|
|
111
|
+
for (const { storage, setup } of setups) {
|
|
112
|
+
await storage.updateTransaction(setup.u1tx2.transactionId, { status: 'unproven' })
|
|
113
|
+
const r = await storage.allocateChangeInput(
|
|
114
|
+
setup.u1.userId,
|
|
115
|
+
setup.u1basket1.basketId,
|
|
116
|
+
11113,
|
|
117
|
+
undefined,
|
|
118
|
+
true,
|
|
119
|
+
setup.u1tx3.transactionId
|
|
120
|
+
)
|
|
121
|
+
expect(r?.outputId).toBe(setup.u1tx2o4.outputId)
|
|
122
|
+
const r2 = await storage.allocateChangeInput(
|
|
123
|
+
setup.u1.userId,
|
|
124
|
+
setup.u1basket1.basketId,
|
|
125
|
+
11113,
|
|
126
|
+
undefined,
|
|
127
|
+
true,
|
|
128
|
+
setup.u1tx3.transactionId
|
|
129
|
+
)
|
|
130
|
+
expect(r2?.outputId).toBe(setup.u1tx2o5.outputId)
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
test('2b targetSatoshis exact sending', async () => {
|
|
135
|
+
for (const { storage, setup } of setups) {
|
|
136
|
+
await storage.updateTransaction(setup.u1tx2.transactionId, { status: 'sending' })
|
|
137
|
+
const r3 = await storage.allocateChangeInput(
|
|
138
|
+
setup.u1.userId,
|
|
139
|
+
setup.u1basket1.basketId,
|
|
140
|
+
11113,
|
|
141
|
+
undefined,
|
|
142
|
+
true,
|
|
143
|
+
setup.u1tx3.transactionId
|
|
144
|
+
)
|
|
145
|
+
expect(r3).toBeUndefined()
|
|
146
|
+
const r = await storage.allocateChangeInput(
|
|
147
|
+
setup.u1.userId,
|
|
148
|
+
setup.u1basket1.basketId,
|
|
149
|
+
11113,
|
|
150
|
+
undefined,
|
|
151
|
+
false,
|
|
152
|
+
setup.u1tx3.transactionId
|
|
153
|
+
)
|
|
154
|
+
expect(r?.outputId).toBe(setup.u1tx2o4.outputId)
|
|
155
|
+
const r2 = await storage.allocateChangeInput(
|
|
156
|
+
setup.u1.userId,
|
|
157
|
+
setup.u1basket1.basketId,
|
|
158
|
+
11113,
|
|
159
|
+
undefined,
|
|
160
|
+
false,
|
|
161
|
+
setup.u1tx3.transactionId
|
|
162
|
+
)
|
|
163
|
+
expect(r2?.outputId).toBe(setup.u1tx2o5.outputId)
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
test('3 targetSatoshis high', async () => {
|
|
168
|
+
for (const { storage, setup } of setups) {
|
|
169
|
+
const r = await storage.allocateChangeInput(
|
|
170
|
+
setup.u1.userId,
|
|
171
|
+
setup.u1basket1.basketId,
|
|
172
|
+
11114,
|
|
173
|
+
undefined,
|
|
174
|
+
true,
|
|
175
|
+
setup.u1tx3.transactionId
|
|
176
|
+
)
|
|
177
|
+
expect(r?.outputId).toBe(setup.u1tx2o5.outputId)
|
|
178
|
+
const r2 = await storage.allocateChangeInput(
|
|
179
|
+
setup.u1.userId,
|
|
180
|
+
setup.u1basket1.basketId,
|
|
181
|
+
11114,
|
|
182
|
+
undefined,
|
|
183
|
+
true,
|
|
184
|
+
setup.u1tx3.transactionId
|
|
185
|
+
)
|
|
186
|
+
expect(r2?.outputId).toBe(setup.u1tx2o6.outputId)
|
|
187
|
+
}
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
test('4 targetSatoshis low', async () => {
|
|
191
|
+
for (const { storage, setup } of setups) {
|
|
192
|
+
const r = await storage.allocateChangeInput(
|
|
193
|
+
setup.u1.userId,
|
|
194
|
+
setup.u1basket1.basketId,
|
|
195
|
+
11112,
|
|
196
|
+
undefined,
|
|
197
|
+
true,
|
|
198
|
+
setup.u1tx3.transactionId
|
|
199
|
+
)
|
|
200
|
+
expect(r?.outputId).toBe(setup.u1tx2o4.outputId)
|
|
201
|
+
const r2 = await storage.allocateChangeInput(
|
|
202
|
+
setup.u1.userId,
|
|
203
|
+
setup.u1basket1.basketId,
|
|
204
|
+
11112,
|
|
205
|
+
undefined,
|
|
206
|
+
true,
|
|
207
|
+
setup.u1tx3.transactionId
|
|
208
|
+
)
|
|
209
|
+
expect(r2?.outputId).toBe(setup.u1tx2o5.outputId)
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
test('5 targetSatoshis above max', async () => {
|
|
214
|
+
for (const { storage, setup } of setups) {
|
|
215
|
+
const r = await storage.allocateChangeInput(
|
|
216
|
+
setup.u1.userId,
|
|
217
|
+
setup.u1basket1.basketId,
|
|
218
|
+
111111114,
|
|
219
|
+
undefined,
|
|
220
|
+
true,
|
|
221
|
+
setup.u1tx3.transactionId
|
|
222
|
+
)
|
|
223
|
+
expect(r?.outputId).toBe(setup.u1tx2o8.outputId)
|
|
224
|
+
const r2 = await storage.allocateChangeInput(
|
|
225
|
+
setup.u1.userId,
|
|
226
|
+
setup.u1basket1.basketId,
|
|
227
|
+
111111114,
|
|
228
|
+
undefined,
|
|
229
|
+
true,
|
|
230
|
+
setup.u1tx3.transactionId
|
|
231
|
+
)
|
|
232
|
+
expect(r2?.outputId).toBe(setup.u1tx2o7.outputId)
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
interface TestSetup2 extends TestSetup1 {
|
|
238
|
+
u1tx2: TableTransaction
|
|
239
|
+
u1tx2o0: TableOutput
|
|
240
|
+
u1tx2o1: TableOutput
|
|
241
|
+
u1tx2o2: TableOutput
|
|
242
|
+
u1tx2o3: TableOutput
|
|
243
|
+
u1tx2o4: TableOutput
|
|
244
|
+
u1tx2o5: TableOutput
|
|
245
|
+
u1tx2o6: TableOutput
|
|
246
|
+
u1tx2o7: TableOutput
|
|
247
|
+
u1tx2o8: TableOutput
|
|
248
|
+
u1tx3: TableTransaction
|
|
249
|
+
u1tx4: TableTransaction
|
|
250
|
+
u1tx5: TableTransaction
|
|
251
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { _tu, TestSetup1 } from '../../utils/TestUtilsWalletStorage'
|
|
2
|
+
import { sdk, StorageProvider, StorageProviderOptions } from '../../../src/index.client'
|
|
3
|
+
import { StorageIdb } from '../../../src/storage/StorageIdb'
|
|
4
|
+
|
|
5
|
+
import 'fake-indexeddb/auto'
|
|
6
|
+
|
|
7
|
+
describe('idb count tests', () => {
|
|
8
|
+
jest.setTimeout(99999999)
|
|
9
|
+
|
|
10
|
+
const chain: sdk.Chain = 'test'
|
|
11
|
+
const env = _tu.getEnv(chain)
|
|
12
|
+
let setups: { setup: TestSetup1; storage: StorageProvider }[] = []
|
|
13
|
+
|
|
14
|
+
beforeEach(async () => {
|
|
15
|
+
const options: StorageProviderOptions = StorageProvider.createStorageBaseOptions(chain)
|
|
16
|
+
const storage = new StorageIdb(options)
|
|
17
|
+
await storage.dropAllData()
|
|
18
|
+
await storage.migrate('idb find tests', '1'.repeat(64))
|
|
19
|
+
await storage.makeAvailable()
|
|
20
|
+
const setup = await _tu.createTestSetup1(storage)
|
|
21
|
+
setups = [{ setup, storage }]
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
afterEach(async () => {
|
|
25
|
+
for (const { storage } of setups) {
|
|
26
|
+
await storage.destroy()
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('0 count ProvenTx', async () => {
|
|
31
|
+
for (const { storage, setup } of setups) {
|
|
32
|
+
expect(await storage.countProvenTxs({ partial: {} })).toBe(1)
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
test('1 count ProvenTxReq', async () => {
|
|
37
|
+
for (const { storage, setup } of setups) {
|
|
38
|
+
expect(await storage.countProvenTxReqs({ partial: {} })).toBe(2)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
test('2 count User', async () => {
|
|
43
|
+
for (const { storage, setup } of setups) {
|
|
44
|
+
expect(await storage.countUsers({ partial: {} })).toBe(2)
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('3 count Certificate', async () => {
|
|
49
|
+
for (const { storage, setup } of setups) {
|
|
50
|
+
expect(await storage.countCertificates({ partial: {} })).toBe(3)
|
|
51
|
+
expect(
|
|
52
|
+
await storage.countCertificates({
|
|
53
|
+
partial: {},
|
|
54
|
+
certifiers: [setup.u1cert1.certifier]
|
|
55
|
+
})
|
|
56
|
+
).toBe(1)
|
|
57
|
+
expect(await storage.countCertificates({ partial: {}, certifiers: ['none'] })).toBe(0)
|
|
58
|
+
expect(
|
|
59
|
+
await storage.countCertificates({
|
|
60
|
+
partial: {},
|
|
61
|
+
types: [setup.u1cert2.type]
|
|
62
|
+
})
|
|
63
|
+
).toBe(1)
|
|
64
|
+
expect(await storage.countCertificates({ partial: {}, types: ['oblongata'] })).toBe(0)
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('4 count CertificateField', async () => {
|
|
69
|
+
for (const { storage, setup } of setups) {
|
|
70
|
+
expect(await storage.countCertificateFields({ partial: {} })).toBe(3)
|
|
71
|
+
expect(
|
|
72
|
+
await storage.countCertificateFields({
|
|
73
|
+
partial: { userId: setup.u1.userId }
|
|
74
|
+
})
|
|
75
|
+
).toBe(3)
|
|
76
|
+
expect(
|
|
77
|
+
await storage.countCertificateFields({
|
|
78
|
+
partial: { userId: setup.u2.userId }
|
|
79
|
+
})
|
|
80
|
+
).toBe(0)
|
|
81
|
+
expect(await storage.countCertificateFields({ partial: { userId: 99 } })).toBe(0)
|
|
82
|
+
expect(await storage.countCertificateFields({ partial: { fieldName: 'name' } })).toBe(2)
|
|
83
|
+
expect(await storage.countCertificateFields({ partial: { fieldName: 'bob' } })).toBe(1)
|
|
84
|
+
expect(
|
|
85
|
+
await storage.countCertificateFields({
|
|
86
|
+
partial: { fieldName: 'bob42' }
|
|
87
|
+
})
|
|
88
|
+
).toBe(0)
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
test('5 count OutputBasket', async () => {
|
|
93
|
+
for (const { storage, setup } of setups) {
|
|
94
|
+
expect(await storage.countOutputBaskets({ partial: {} })).toBe(3)
|
|
95
|
+
expect(
|
|
96
|
+
await storage.countOutputBaskets({
|
|
97
|
+
partial: {},
|
|
98
|
+
since: setup.u1.created_at
|
|
99
|
+
})
|
|
100
|
+
).toBe(3)
|
|
101
|
+
expect(await storage.countOutputBaskets({ partial: {}, since: new Date() })).toBe(0)
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
test('6 count Transaction', async () => {
|
|
106
|
+
for (const { storage, setup } of setups) {
|
|
107
|
+
expect(await storage.countTransactions({ partial: {} })).toBe(3)
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('7 count Commission', async () => {
|
|
112
|
+
for (const { storage, setup } of setups) {
|
|
113
|
+
expect(await storage.countCommissions({ partial: {} })).toBe(3)
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
test('8 count Output', async () => {
|
|
118
|
+
for (const { storage, setup } of setups) {
|
|
119
|
+
expect(await storage.countOutputs({ partial: {} })).toBe(3)
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
test('9 count OutputTag', async () => {
|
|
124
|
+
for (const { storage, setup } of setups) {
|
|
125
|
+
expect(await storage.countOutputTags({ partial: {} })).toBe(2)
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
test('10 count OutputTagMap', async () => {
|
|
130
|
+
for (const { storage, setup } of setups) {
|
|
131
|
+
expect(await storage.countOutputTagMaps({ partial: {} })).toBe(3)
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
test('11 count TxLabel', async () => {
|
|
136
|
+
for (const { storage, setup } of setups) {
|
|
137
|
+
expect(await storage.countTxLabels({ partial: {} })).toBe(3)
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
test('12 count TxLabelMap', async () => {
|
|
142
|
+
for (const { storage, setup } of setups) {
|
|
143
|
+
expect(await storage.countTxLabelMaps({ partial: {} })).toBe(3)
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
test('13 count MonitorEvent', async () => {
|
|
148
|
+
for (const { storage, setup } of setups) {
|
|
149
|
+
expect(await storage.countMonitorEvents({ partial: {} })).toBe(1)
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
test('14 count SyncState', async () => {
|
|
154
|
+
for (const { storage, setup } of setups) {
|
|
155
|
+
expect(await storage.countSyncStates({ partial: {} })).toBe(1)
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
})
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { _tu, TestSetup1 } from '../../utils/TestUtilsWalletStorage'
|
|
2
|
+
import { sdk, StorageProvider, StorageProviderOptions } from '../../../src/index.client'
|
|
3
|
+
|
|
4
|
+
import { StorageIdb } from '../../../src/storage/StorageIdb'
|
|
5
|
+
|
|
6
|
+
import 'fake-indexeddb/auto'
|
|
7
|
+
|
|
8
|
+
describe('idb find tests', () => {
|
|
9
|
+
jest.setTimeout(99999999)
|
|
10
|
+
|
|
11
|
+
const chain: sdk.Chain = 'test'
|
|
12
|
+
const env = _tu.getEnv(chain)
|
|
13
|
+
let setups: { setup: TestSetup1; storage: StorageProvider }[] = []
|
|
14
|
+
|
|
15
|
+
beforeEach(async () => {
|
|
16
|
+
const options: StorageProviderOptions = StorageProvider.createStorageBaseOptions(chain)
|
|
17
|
+
const storage = new StorageIdb(options)
|
|
18
|
+
await storage.dropAllData()
|
|
19
|
+
await storage.migrate('idb find tests', '1'.repeat(64))
|
|
20
|
+
await storage.makeAvailable()
|
|
21
|
+
const setup = await _tu.createTestSetup1(storage)
|
|
22
|
+
setups = [{ setup, storage }]
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
afterEach(async () => {
|
|
26
|
+
for (const { storage } of setups) {
|
|
27
|
+
await storage.destroy()
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('0 find ProvenTx', async () => {
|
|
32
|
+
for (const { storage, setup } of setups) {
|
|
33
|
+
expect((await storage.findProvenTxs({ partial: {} })).length).toBe(1)
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
test('1 find ProvenTxReq', async () => {
|
|
38
|
+
for (const { storage, setup } of setups) {
|
|
39
|
+
expect((await storage.findProvenTxReqs({ partial: {} })).length).toBe(2)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test('2 find User', async () => {
|
|
44
|
+
for (const { storage, setup } of setups) {
|
|
45
|
+
expect((await storage.findUsers({ partial: {} })).length).toBe(2)
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('3 find Certificate', async () => {
|
|
50
|
+
for (const { storage, setup } of setups) {
|
|
51
|
+
expect((await storage.findCertificates({ partial: {} })).length).toBe(3)
|
|
52
|
+
expect(
|
|
53
|
+
(
|
|
54
|
+
await storage.findCertificates({
|
|
55
|
+
partial: {},
|
|
56
|
+
certifiers: [setup.u1cert1.certifier]
|
|
57
|
+
})
|
|
58
|
+
).length
|
|
59
|
+
).toBe(1)
|
|
60
|
+
expect((await storage.findCertificates({ partial: {}, certifiers: ['none'] })).length).toBe(0)
|
|
61
|
+
expect(
|
|
62
|
+
(
|
|
63
|
+
await storage.findCertificates({
|
|
64
|
+
partial: {},
|
|
65
|
+
types: [setup.u1cert2.type]
|
|
66
|
+
})
|
|
67
|
+
).length
|
|
68
|
+
).toBe(1)
|
|
69
|
+
expect((await storage.findCertificates({ partial: {}, types: ['oblongata'] })).length).toBe(0)
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
test('4 find CertificateField', async () => {
|
|
74
|
+
for (const { storage, setup } of setups) {
|
|
75
|
+
expect((await storage.findCertificateFields({ partial: {} })).length).toBe(3)
|
|
76
|
+
expect(
|
|
77
|
+
(
|
|
78
|
+
await storage.findCertificateFields({
|
|
79
|
+
partial: { userId: setup.u1.userId }
|
|
80
|
+
})
|
|
81
|
+
).length
|
|
82
|
+
).toBe(3)
|
|
83
|
+
expect(
|
|
84
|
+
(
|
|
85
|
+
await storage.findCertificateFields({
|
|
86
|
+
partial: { userId: setup.u2.userId }
|
|
87
|
+
})
|
|
88
|
+
).length
|
|
89
|
+
).toBe(0)
|
|
90
|
+
expect((await storage.findCertificateFields({ partial: { userId: 99 } })).length).toBe(0)
|
|
91
|
+
expect(
|
|
92
|
+
(
|
|
93
|
+
await storage.findCertificateFields({
|
|
94
|
+
partial: { fieldName: 'name' }
|
|
95
|
+
})
|
|
96
|
+
).length
|
|
97
|
+
).toBe(2)
|
|
98
|
+
expect((await storage.findCertificateFields({ partial: { fieldName: 'bob' } })).length).toBe(1)
|
|
99
|
+
expect(
|
|
100
|
+
(
|
|
101
|
+
await storage.findCertificateFields({
|
|
102
|
+
partial: { fieldName: 'bob42' }
|
|
103
|
+
})
|
|
104
|
+
).length
|
|
105
|
+
).toBe(0)
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
test('5 find OutputBasket', async () => {
|
|
110
|
+
for (const { storage, setup } of setups) {
|
|
111
|
+
expect((await storage.findOutputBaskets({ partial: {} })).length).toBe(3)
|
|
112
|
+
expect(
|
|
113
|
+
(
|
|
114
|
+
await storage.findOutputBaskets({
|
|
115
|
+
partial: {},
|
|
116
|
+
since: setup.u1.created_at
|
|
117
|
+
})
|
|
118
|
+
).length
|
|
119
|
+
).toBe(3)
|
|
120
|
+
expect((await storage.findOutputBaskets({ partial: {}, since: new Date() })).length).toBe(0)
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
test('6 find Transaction', async () => {
|
|
125
|
+
for (const { storage, setup } of setups) {
|
|
126
|
+
expect((await storage.findTransactions({ partial: {} })).length).toBe(3)
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
test('7 find Commission', async () => {
|
|
131
|
+
for (const { storage, setup } of setups) {
|
|
132
|
+
expect((await storage.findCommissions({ partial: {} })).length).toBe(3)
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
test('8 find Output', async () => {
|
|
137
|
+
for (const { storage, setup } of setups) {
|
|
138
|
+
expect((await storage.findOutputs({ partial: {} })).length).toBe(3)
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
test('9 find OutputTag', async () => {
|
|
143
|
+
for (const { storage, setup } of setups) {
|
|
144
|
+
expect((await storage.findOutputTags({ partial: {} })).length).toBe(2)
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
test('10 find OutputTagMap', async () => {
|
|
149
|
+
for (const { storage, setup } of setups) {
|
|
150
|
+
expect((await storage.findOutputTagMaps({ partial: {} })).length).toBe(3)
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
test('11 find TxLabel', async () => {
|
|
155
|
+
for (const { storage, setup } of setups) {
|
|
156
|
+
expect((await storage.findTxLabels({ partial: {} })).length).toBe(3)
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
test('12 find TxLabelMap', async () => {
|
|
161
|
+
for (const { storage, setup } of setups) {
|
|
162
|
+
expect((await storage.findTxLabelMaps({ partial: {} })).length).toBe(3)
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
test('13 find MonitorEvent', async () => {
|
|
167
|
+
for (const { storage, setup } of setups) {
|
|
168
|
+
expect((await storage.findMonitorEvents({ partial: {} })).length).toBe(1)
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
test('14 find SyncState', async () => {
|
|
173
|
+
for (const { storage, setup } of setups) {
|
|
174
|
+
expect((await storage.findSyncStates({ partial: {} })).length).toBe(1)
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
})
|