@bsv/wallet-toolbox 1.3.3 → 1.3.5
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 +24 -10
- 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 +1 -1
- package/out/src/sdk/WalletServices.interfaces.d.ts.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 -1
- 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} +39 -4
- 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 +29 -13
- 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 +1 -2
- 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 +1 -1
- 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} +41 -12
- 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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ListActionsArgs } from '@bsv/sdk'
|
|
2
|
+
import { _tu, logger } from '../../utils/TestUtilsWalletStorage'
|
|
3
|
+
|
|
4
|
+
import 'fake-indexeddb/auto'
|
|
5
|
+
|
|
6
|
+
describe('idbSpeed tests', () => {
|
|
7
|
+
jest.setTimeout(99999999)
|
|
8
|
+
|
|
9
|
+
const testName = () => expect.getState().currentTestName || 'test'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Starting speed 2025-04-18 07:58 was 66+ seconds
|
|
13
|
+
*/
|
|
14
|
+
test('0 copy legacy wallet', async () => {
|
|
15
|
+
const databaseName = testName()
|
|
16
|
+
const setup = await _tu.createIdbLegacyWalletCopy(databaseName)
|
|
17
|
+
expect(setup.activeStorage).toBeTruthy()
|
|
18
|
+
|
|
19
|
+
const stats = _tu.wrapProfiling(setup.activeStorage, 'StorageIdb')
|
|
20
|
+
|
|
21
|
+
const args: ListActionsArgs = {
|
|
22
|
+
includeLabels: true,
|
|
23
|
+
labels: ['babbage_protocol_perm']
|
|
24
|
+
}
|
|
25
|
+
const r = await setup.wallet.listActions(args)
|
|
26
|
+
expect(r.actions.length).toBe(args.limit || 10)
|
|
27
|
+
|
|
28
|
+
let log = 'function,count,totalMsecs,avgMsecs\n'
|
|
29
|
+
for (const [key, value] of Object.entries(stats)) {
|
|
30
|
+
log += `${key},${value.count},${value.totalMsecs},${value.totalMsecs / value.count}\n`
|
|
31
|
+
}
|
|
32
|
+
logger(log)
|
|
33
|
+
})
|
|
34
|
+
})
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { _tu } from '../../utils/TestUtilsWalletStorage'
|
|
2
|
+
import {
|
|
3
|
+
randomBytesBase64,
|
|
4
|
+
randomBytesHex,
|
|
5
|
+
sdk,
|
|
6
|
+
StorageProvider,
|
|
7
|
+
StorageProviderOptions,
|
|
8
|
+
TableCommission
|
|
9
|
+
} from '../../../src/index.client'
|
|
10
|
+
import { StorageIdb } from '../../../src/storage/StorageIdb'
|
|
11
|
+
|
|
12
|
+
import 'fake-indexeddb/auto'
|
|
13
|
+
import { openDB } from 'idb'
|
|
14
|
+
|
|
15
|
+
describe('idb insert tests', () => {
|
|
16
|
+
jest.setTimeout(99999999)
|
|
17
|
+
|
|
18
|
+
let storages: StorageProvider[] = []
|
|
19
|
+
const chain: sdk.Chain = 'test'
|
|
20
|
+
const env = _tu.getEnv(chain)
|
|
21
|
+
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
storages = []
|
|
24
|
+
const options: StorageProviderOptions = StorageProvider.createStorageBaseOptions(chain)
|
|
25
|
+
storages.push(new StorageIdb(options))
|
|
26
|
+
|
|
27
|
+
for (const storage of storages) {
|
|
28
|
+
await storage.dropAllData()
|
|
29
|
+
await storage.migrate('insert tests', '1'.repeat(64))
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
afterEach(async () => {
|
|
34
|
+
for (const storage of storages) {
|
|
35
|
+
await storage.destroy()
|
|
36
|
+
await new Promise(resolve => setTimeout(resolve, 0)) // Allow fake-indexeddb to clean up
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
test('0 insert ProvenTx', async () => {
|
|
41
|
+
for (const storage of storages) {
|
|
42
|
+
const ptx = await _tu.insertTestProvenTx(storage)
|
|
43
|
+
expect(ptx.provenTxId).toBe(1)
|
|
44
|
+
ptx.provenTxId = 0
|
|
45
|
+
// duplicate must throw
|
|
46
|
+
await expect(storage.insertProvenTx(ptx)).rejects.toThrow()
|
|
47
|
+
ptx.provenTxId = 0
|
|
48
|
+
ptx.txid = '4'.repeat(64)
|
|
49
|
+
ptx.provenTxId = await storage.insertProvenTx(ptx)
|
|
50
|
+
// MySQL counts the failed insertion as a used id, SQLite does not.
|
|
51
|
+
expect(ptx.provenTxId).toBeGreaterThan(1)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test('1 insert ProvenTxReq', async () => {
|
|
56
|
+
for (const storage of storages) {
|
|
57
|
+
const ptxreq = await _tu.insertTestProvenTxReq(storage)
|
|
58
|
+
expect(ptxreq.provenTxReqId).toBe(1)
|
|
59
|
+
ptxreq.provenTxReqId = 0
|
|
60
|
+
// duplicate must throw
|
|
61
|
+
await expect(storage.insertProvenTxReq(ptxreq)).rejects.toThrow()
|
|
62
|
+
ptxreq.provenTxReqId = 0
|
|
63
|
+
ptxreq.txid = '4'.repeat(64)
|
|
64
|
+
const id = await storage.insertProvenTxReq(ptxreq)
|
|
65
|
+
expect(id).toBe(2)
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('2 insert User', async () => {
|
|
70
|
+
for (const storage of storages) {
|
|
71
|
+
const e = await _tu.insertTestUser(storage)
|
|
72
|
+
const id = e.userId
|
|
73
|
+
expect(id).toBeGreaterThan(0)
|
|
74
|
+
e.userId = 0
|
|
75
|
+
// duplicate must throw
|
|
76
|
+
await expect(storage.insertUser(e)).rejects.toThrow()
|
|
77
|
+
e.userId = 0
|
|
78
|
+
e.identityKey = randomBytesHex(33)
|
|
79
|
+
await storage.insertUser(e)
|
|
80
|
+
// MySQL counts the failed insertion as a used id, SQLite does not.
|
|
81
|
+
expect(e.userId).toBeGreaterThan(id)
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('3 insert Certificate', async () => {
|
|
86
|
+
for (const storage of storages) {
|
|
87
|
+
const e = await _tu.insertTestCertificate(storage)
|
|
88
|
+
const id = e.certificateId
|
|
89
|
+
expect(id).toBeGreaterThan(0)
|
|
90
|
+
// duplicate must throw
|
|
91
|
+
await expect(storage.insertCertificate(e)).rejects.toThrow()
|
|
92
|
+
e.certificateId = 0
|
|
93
|
+
e.serialNumber = randomBytesBase64(33)
|
|
94
|
+
await storage.insertCertificate(e)
|
|
95
|
+
// MySQL counts the failed insertion as a used id, SQLite does not.
|
|
96
|
+
expect(e.certificateId).toBeGreaterThan(id)
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test('4 insert CertificateField', async () => {
|
|
101
|
+
for (const storage of storages) {
|
|
102
|
+
const c = await _tu.insertTestCertificate(storage)
|
|
103
|
+
const e = await _tu.insertTestCertificateField(storage, c, 'prize', 'starship')
|
|
104
|
+
expect(e.certificateId).toBe(c.certificateId)
|
|
105
|
+
expect(e.userId).toBe(c.userId)
|
|
106
|
+
expect(e.fieldName).toBe('prize')
|
|
107
|
+
// duplicate must throw
|
|
108
|
+
await expect(storage.insertCertificateField(e)).rejects.toThrow()
|
|
109
|
+
e.fieldName = 'address'
|
|
110
|
+
await storage.insertCertificateField(e)
|
|
111
|
+
// MySQL counts the failed insertion as a used id, SQLite does not.
|
|
112
|
+
expect(e.fieldName).toBe('address')
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
test('5 insert OutputBasket', async () => {
|
|
117
|
+
for (const storage of storages) {
|
|
118
|
+
const e = await _tu.insertTestOutputBasket(storage)
|
|
119
|
+
const id = e.basketId
|
|
120
|
+
expect(id).toBeGreaterThan(0)
|
|
121
|
+
e.basketId = 0
|
|
122
|
+
// duplicate must throw
|
|
123
|
+
await expect(storage.insertOutputBasket(e)).rejects.toThrow()
|
|
124
|
+
e.basketId = 0
|
|
125
|
+
e.name = randomBytesHex(10)
|
|
126
|
+
await storage.insertOutputBasket(e)
|
|
127
|
+
// MySQL counts the failed insertion as a used id, SQLite does not.
|
|
128
|
+
expect(e.basketId).toBeGreaterThan(id)
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
test('6 insert Transaction', async () => {
|
|
133
|
+
for (const storage of storages) {
|
|
134
|
+
const { tx: e, user } = await _tu.insertTestTransaction(storage)
|
|
135
|
+
const id = e.transactionId
|
|
136
|
+
expect(id).toBeGreaterThan(0)
|
|
137
|
+
e.transactionId = 0
|
|
138
|
+
// duplicate must throw
|
|
139
|
+
await expect(storage.insertTransaction(e)).rejects.toThrow()
|
|
140
|
+
e.transactionId = 0
|
|
141
|
+
e.reference = randomBytesBase64(10)
|
|
142
|
+
await storage.insertTransaction(e)
|
|
143
|
+
// MySQL counts the failed insertion as a used id, SQLite does not.
|
|
144
|
+
expect(e.transactionId).toBeGreaterThan(id)
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
test('7 insert Commission', async () => {
|
|
149
|
+
for (const storage of storages) {
|
|
150
|
+
const { tx: t, user } = await _tu.insertTestTransaction(storage)
|
|
151
|
+
const e: TableCommission = await _tu.insertTestCommission(storage, t)
|
|
152
|
+
const id = e.commissionId
|
|
153
|
+
expect(id).toBeGreaterThan(0)
|
|
154
|
+
e.commissionId = 0
|
|
155
|
+
// duplicate must throw
|
|
156
|
+
await expect(storage.insertCommission(e)).rejects.toThrow()
|
|
157
|
+
e.commissionId = 0
|
|
158
|
+
const { tx: t2 } = await _tu.insertTestTransaction(storage)
|
|
159
|
+
e.transactionId = t2.transactionId
|
|
160
|
+
e.userId = t2.userId
|
|
161
|
+
await storage.insertCommission(e)
|
|
162
|
+
// MySQL counts the failed insertion as a used id, SQLite does not.
|
|
163
|
+
expect(e.commissionId).toBeGreaterThan(id)
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
test('8 insert Output', async () => {
|
|
168
|
+
for (const storage of storages) {
|
|
169
|
+
const { tx: t, user } = await _tu.insertTestTransaction(storage)
|
|
170
|
+
const e = await _tu.insertTestOutput(storage, t, 0, 101)
|
|
171
|
+
const id = e.outputId
|
|
172
|
+
expect(id).toBeGreaterThan(0)
|
|
173
|
+
expect(e.userId).toBe(t.userId)
|
|
174
|
+
expect(e.transactionId).toBe(t.transactionId)
|
|
175
|
+
expect(e.vout).toBe(0)
|
|
176
|
+
expect(e.satoshis).toBe(101)
|
|
177
|
+
e.outputId = 0
|
|
178
|
+
// duplicate must throw
|
|
179
|
+
await expect(storage.insertOutput(e)).rejects.toThrow()
|
|
180
|
+
e.vout = 1
|
|
181
|
+
await storage.insertOutput(e)
|
|
182
|
+
// MySQL counts the failed insertion as a used id, SQLite does not.
|
|
183
|
+
expect(e.outputId).toBeGreaterThan(id)
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
test('9 insert OutputTag', async () => {
|
|
188
|
+
for (const storage of storages) {
|
|
189
|
+
const u = await _tu.insertTestUser(storage)
|
|
190
|
+
const e = await _tu.insertTestOutputTag(storage, u)
|
|
191
|
+
const id = e.outputTagId
|
|
192
|
+
expect(id).toBeGreaterThan(0)
|
|
193
|
+
expect(e.userId).toBe(u.userId)
|
|
194
|
+
expect(e.tag).toBeTruthy()
|
|
195
|
+
e.outputTagId = 0
|
|
196
|
+
// duplicate must throw
|
|
197
|
+
await expect(storage.insertOutputTag(e)).rejects.toThrow()
|
|
198
|
+
e.tag = randomBytesHex(6)
|
|
199
|
+
await storage.insertOutputTag(e)
|
|
200
|
+
// MySQL counts the failed insertion as a used id, SQLite does not.
|
|
201
|
+
expect(e.outputTagId).toBeGreaterThan(id)
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
test('10 insert OutputTagMap', async () => {
|
|
206
|
+
for (const storage of storages) {
|
|
207
|
+
const { tx, user } = await _tu.insertTestTransaction(storage)
|
|
208
|
+
const o = await _tu.insertTestOutput(storage, tx, 0, 101)
|
|
209
|
+
const tag = await _tu.insertTestOutputTag(storage, user)
|
|
210
|
+
const e = await _tu.insertTestOutputTagMap(storage, o, tag)
|
|
211
|
+
expect(e.outputId).toBe(o.outputId)
|
|
212
|
+
expect(e.outputTagId).toBe(tag.outputTagId)
|
|
213
|
+
// duplicate must throw
|
|
214
|
+
await expect(storage.insertOutputTagMap(e)).rejects.toThrow()
|
|
215
|
+
const tag2 = await _tu.insertTestOutputTag(storage, user)
|
|
216
|
+
const e2 = await _tu.insertTestOutputTagMap(storage, o, tag2)
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
test('11 insert TxLabel', async () => {
|
|
221
|
+
for (const storage of storages) {
|
|
222
|
+
const u = await _tu.insertTestUser(storage)
|
|
223
|
+
const e = await _tu.insertTestTxLabel(storage, u)
|
|
224
|
+
const id = e.txLabelId
|
|
225
|
+
expect(id).toBeGreaterThan(0)
|
|
226
|
+
expect(e.userId).toBe(u.userId)
|
|
227
|
+
expect(e.label).toBeTruthy()
|
|
228
|
+
e.txLabelId = 0
|
|
229
|
+
// duplicate must throw
|
|
230
|
+
await expect(storage.insertTxLabel(e)).rejects.toThrow()
|
|
231
|
+
e.label = randomBytesHex(6)
|
|
232
|
+
await storage.insertTxLabel(e)
|
|
233
|
+
// MySQL counts the failed insertion as a used id, SQLite does not.
|
|
234
|
+
expect(e.txLabelId).toBeGreaterThan(id)
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
test('12 insert TxLabelMap', async () => {
|
|
239
|
+
for (const storage of storages) {
|
|
240
|
+
const { tx, user } = await _tu.insertTestTransaction(storage)
|
|
241
|
+
const label = await _tu.insertTestTxLabel(storage, user)
|
|
242
|
+
const e = await _tu.insertTestTxLabelMap(storage, tx, label)
|
|
243
|
+
expect(e.transactionId).toBe(tx.transactionId)
|
|
244
|
+
expect(e.txLabelId).toBe(label.txLabelId)
|
|
245
|
+
// duplicate must throw
|
|
246
|
+
await expect(storage.insertTxLabelMap(e)).rejects.toThrow()
|
|
247
|
+
const label2 = await _tu.insertTestTxLabel(storage, user)
|
|
248
|
+
const e2 = await _tu.insertTestTxLabelMap(storage, tx, label2)
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
test('13 insert MonitorEvent', async () => {
|
|
253
|
+
for (const storage of storages) {
|
|
254
|
+
const e = await _tu.insertTestMonitorEvent(storage)
|
|
255
|
+
const id = e.id
|
|
256
|
+
expect(id).toBeGreaterThan(0)
|
|
257
|
+
}
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
test('14 insert SyncState', async () => {
|
|
261
|
+
for (const storage of storages) {
|
|
262
|
+
const u = await _tu.insertTestUser(storage)
|
|
263
|
+
const e = await _tu.insertTestSyncState(storage, u)
|
|
264
|
+
const id = e.syncStateId
|
|
265
|
+
expect(id).toBeGreaterThan(0)
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
})
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { _tu, logger } from '../../utils/TestUtilsWalletStorage'
|
|
2
|
+
import {
|
|
3
|
+
randomBytesBase64,
|
|
4
|
+
randomBytesHex,
|
|
5
|
+
sdk,
|
|
6
|
+
StorageProvider,
|
|
7
|
+
StorageProviderOptions,
|
|
8
|
+
TableCommission
|
|
9
|
+
} from '../../../src/index.client'
|
|
10
|
+
import { StorageIdb } from '../../../src/storage/StorageIdb'
|
|
11
|
+
|
|
12
|
+
import 'fake-indexeddb/auto'
|
|
13
|
+
import { openDB } from 'idb'
|
|
14
|
+
|
|
15
|
+
describe('idb transactionAbort tests', () => {
|
|
16
|
+
jest.setTimeout(99999999)
|
|
17
|
+
|
|
18
|
+
let storages: StorageProvider[] = []
|
|
19
|
+
const chain: sdk.Chain = 'test'
|
|
20
|
+
const env = _tu.getEnv(chain)
|
|
21
|
+
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
storages = []
|
|
24
|
+
const options: StorageProviderOptions = StorageProvider.createStorageBaseOptions(chain)
|
|
25
|
+
storages.push(new StorageIdb(options))
|
|
26
|
+
|
|
27
|
+
for (const storage of storages) {
|
|
28
|
+
await storage.dropAllData()
|
|
29
|
+
await storage.migrate('insert tests', '1'.repeat(64))
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
afterEach(async () => {
|
|
34
|
+
for (const storage of storages) {
|
|
35
|
+
await storage.destroy()
|
|
36
|
+
await new Promise(resolve => setTimeout(resolve, 0)) // Allow fake-indexeddb to clean up
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
test('0 unaborted case', async () => {
|
|
41
|
+
for (const storage of storages) {
|
|
42
|
+
let aborted = false
|
|
43
|
+
let count = await storage.countProvenTxs({ partial: {} })
|
|
44
|
+
expect(count).toBe(0)
|
|
45
|
+
try {
|
|
46
|
+
const r = await storage.transaction(async tx => {
|
|
47
|
+
const r12 = await _tu.insertTestProvenTx(storage, '12'.repeat(32), tx)
|
|
48
|
+
const r23 = await _tu.insertTestProvenTx(storage, '23'.repeat(32), tx)
|
|
49
|
+
//tx['abort']()
|
|
50
|
+
return [r12.provenTxId, r23.provenTxId]
|
|
51
|
+
})
|
|
52
|
+
expect(r).toEqual([1, 2])
|
|
53
|
+
} catch (e) {
|
|
54
|
+
aborted = true
|
|
55
|
+
logger('Transaction aborted', e?.['name'])
|
|
56
|
+
}
|
|
57
|
+
expect(aborted).toBe(false)
|
|
58
|
+
count = await storage.countProvenTxs({ partial: {} })
|
|
59
|
+
expect(count).toBe(2)
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test('1 call abort case', async () => {
|
|
64
|
+
for (const storage of storages) {
|
|
65
|
+
let aborted = false
|
|
66
|
+
let count = await storage.countProvenTxs({ partial: {} })
|
|
67
|
+
expect(count).toBe(0)
|
|
68
|
+
try {
|
|
69
|
+
const r = await storage.transaction(async tx => {
|
|
70
|
+
const r12 = await _tu.insertTestProvenTx(storage, '12'.repeat(32), tx)
|
|
71
|
+
const r23 = await _tu.insertTestProvenTx(storage, '23'.repeat(32), tx)
|
|
72
|
+
tx['abort']()
|
|
73
|
+
return [r12.provenTxId, r23.provenTxId]
|
|
74
|
+
})
|
|
75
|
+
expect(r).toEqual([1, 2])
|
|
76
|
+
} catch (e) {
|
|
77
|
+
aborted = true
|
|
78
|
+
logger('Transaction aborted', e?.['name'])
|
|
79
|
+
}
|
|
80
|
+
expect(aborted).toBe(true)
|
|
81
|
+
count = await storage.countProvenTxs({ partial: {} })
|
|
82
|
+
expect(count).toBe(0)
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
test('2 throw error case', async () => {
|
|
87
|
+
for (const storage of storages) {
|
|
88
|
+
let aborted = false
|
|
89
|
+
let count = await storage.countProvenTxs({ partial: {} })
|
|
90
|
+
expect(count).toBe(0)
|
|
91
|
+
try {
|
|
92
|
+
const r = await storage.transaction(async tx => {
|
|
93
|
+
const r12 = await _tu.insertTestProvenTx(storage, '12'.repeat(32), tx)
|
|
94
|
+
const r23 = await _tu.insertTestProvenTx(storage, '23'.repeat(32), tx)
|
|
95
|
+
throw new Error('Test error')
|
|
96
|
+
return [r12.provenTxId, r23.provenTxId]
|
|
97
|
+
})
|
|
98
|
+
expect(r).toEqual([1, 2])
|
|
99
|
+
} catch (e) {
|
|
100
|
+
aborted = true
|
|
101
|
+
logger('Transaction aborted', e?.['name'])
|
|
102
|
+
}
|
|
103
|
+
expect(aborted).toBe(true)
|
|
104
|
+
count = await storage.countProvenTxs({ partial: {} })
|
|
105
|
+
expect(count).toBe(0)
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
})
|