@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
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
|
|
22
22
|
setLogging(false)
|
|
23
23
|
|
|
24
|
-
describe('update tests', () => {
|
|
24
|
+
describe('idb update tests', () => {
|
|
25
25
|
jest.setTimeout(99999999)
|
|
26
26
|
|
|
27
27
|
const chain: sdk.Chain = 'test'
|
|
@@ -57,7 +57,7 @@ describe('update tests', () => {
|
|
|
57
57
|
}
|
|
58
58
|
for (const storage of storages) {
|
|
59
59
|
await storage.dropAllData()
|
|
60
|
-
await storage.migrate('
|
|
60
|
+
await storage.migrate('update tests', '1'.repeat(64))
|
|
61
61
|
await storage.makeAvailable()
|
|
62
62
|
setups.push({ storage, setup: await _tu.createTestSetup1(storage) })
|
|
63
63
|
}
|
|
@@ -58,7 +58,8 @@ import {
|
|
|
58
58
|
import { Knex, knex as makeKnex } from 'knex'
|
|
59
59
|
|
|
60
60
|
import * as dotenv from 'dotenv'
|
|
61
|
-
import { WalletServicesOptions } from '../../src/sdk'
|
|
61
|
+
import { TrxToken, WalletServicesOptions } from '../../src/sdk'
|
|
62
|
+
import { StorageIdb } from '../../src/storage/StorageIdb'
|
|
62
63
|
dotenv.config()
|
|
63
64
|
|
|
64
65
|
const localMySqlConnection = process.env.MYSQL_CONNECTION || ''
|
|
@@ -830,6 +831,170 @@ export abstract class TestUtilsWalletStorage {
|
|
|
830
831
|
return r
|
|
831
832
|
}
|
|
832
833
|
|
|
834
|
+
static wrapProfiling(o: Object, name: string): Record<string, { count: number; totalMsecs: number }> {
|
|
835
|
+
const getFunctionsNames = (obj: Object) => {
|
|
836
|
+
let fNames: string[] = []
|
|
837
|
+
do {
|
|
838
|
+
fNames = fNames.concat(
|
|
839
|
+
Object.getOwnPropertyNames(obj).filter(p => p !== 'constructor' && typeof obj[p] === 'function')
|
|
840
|
+
)
|
|
841
|
+
} while ((obj = Object.getPrototypeOf(obj)) && obj !== Object.prototype)
|
|
842
|
+
|
|
843
|
+
return fNames
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
const notifyPerformance = (fn, performanceDetails) => {
|
|
847
|
+
setTimeout(() => {
|
|
848
|
+
let { functionName, args, startTime, endTime } = performanceDetails
|
|
849
|
+
let _args = args
|
|
850
|
+
if (Array.isArray(args)) {
|
|
851
|
+
_args = args.map(arg => {
|
|
852
|
+
if (typeof arg === 'function') {
|
|
853
|
+
let fName = arg.name
|
|
854
|
+
if (!fName) {
|
|
855
|
+
fName = 'function'
|
|
856
|
+
} else if (fName === 'callbackWrapper') {
|
|
857
|
+
fName = 'callback'
|
|
858
|
+
}
|
|
859
|
+
arg = `[${fName} Function]`
|
|
860
|
+
}
|
|
861
|
+
return arg
|
|
862
|
+
})
|
|
863
|
+
}
|
|
864
|
+
fn({ functionName, args: _args, startTime, endTime })
|
|
865
|
+
}, 0)
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
const stats: Record<string, { count: number; totalMsecs: number }> = {}
|
|
869
|
+
|
|
870
|
+
function logger(args: { functionName: string; args: any; startTime: number; endTime: number }) {
|
|
871
|
+
let s = stats[args.functionName]
|
|
872
|
+
if (!s) {
|
|
873
|
+
s = { count: 0, totalMsecs: 0 }
|
|
874
|
+
stats[args.functionName] = s
|
|
875
|
+
}
|
|
876
|
+
s.count++
|
|
877
|
+
s.totalMsecs += args.endTime - args.startTime
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
const performanceWrapper = (obj: Object, objectName: string, performanceNotificationCallback: any) => {
|
|
881
|
+
let _notifyPerformance = notifyPerformance.bind(null, performanceNotificationCallback)
|
|
882
|
+
let fNames = getFunctionsNames(obj)
|
|
883
|
+
for (let fName of fNames) {
|
|
884
|
+
let originalFunction = obj[fName]
|
|
885
|
+
let wrapperFunction = (...args) => {
|
|
886
|
+
let callbackFnIndex = -1
|
|
887
|
+
let startTime = Date.now()
|
|
888
|
+
let _callBack = args.filter((arg, i) => {
|
|
889
|
+
let _isFunction = typeof arg === 'function'
|
|
890
|
+
if (_isFunction) {
|
|
891
|
+
callbackFnIndex = i
|
|
892
|
+
}
|
|
893
|
+
return _isFunction
|
|
894
|
+
})[0]
|
|
895
|
+
if (_callBack) {
|
|
896
|
+
let callbackWrapper = (...callbackArgs) => {
|
|
897
|
+
let endTime = Date.now()
|
|
898
|
+
_notifyPerformance({ functionName: `${objectName}.${fName}`, args, startTime, endTime })
|
|
899
|
+
_callBack.apply(null, callbackArgs)
|
|
900
|
+
}
|
|
901
|
+
args[callbackFnIndex] = callbackWrapper
|
|
902
|
+
}
|
|
903
|
+
let originalReturnObject = originalFunction.apply(obj, args)
|
|
904
|
+
let isPromiseType =
|
|
905
|
+
originalReturnObject &&
|
|
906
|
+
typeof originalReturnObject.then === 'function' &&
|
|
907
|
+
typeof originalReturnObject.catch === 'function'
|
|
908
|
+
if (isPromiseType) {
|
|
909
|
+
return originalReturnObject
|
|
910
|
+
.then(resolveArgs => {
|
|
911
|
+
let endTime = Date.now()
|
|
912
|
+
_notifyPerformance({ functionName: `${objectName}.${fName}`, args, startTime, endTime })
|
|
913
|
+
return Promise.resolve(resolveArgs)
|
|
914
|
+
})
|
|
915
|
+
.catch((...rejectArgs) => {
|
|
916
|
+
let endTime = Date.now()
|
|
917
|
+
_notifyPerformance({ functionName: `${objectName}.${fName}`, args, startTime, endTime })
|
|
918
|
+
return Promise.reject(...rejectArgs)
|
|
919
|
+
})
|
|
920
|
+
}
|
|
921
|
+
if (!_callBack && !isPromiseType) {
|
|
922
|
+
let endTime = Date.now()
|
|
923
|
+
_notifyPerformance({ functionName: `${objectName}.${fName}`, args, startTime, endTime })
|
|
924
|
+
}
|
|
925
|
+
return originalReturnObject
|
|
926
|
+
}
|
|
927
|
+
obj[fName] = wrapperFunction
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
return obj
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
const functionNames = getFunctionsNames(o)
|
|
934
|
+
|
|
935
|
+
performanceWrapper(o, name, logger)
|
|
936
|
+
|
|
937
|
+
return stats
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
static async createIdbLegacyWalletCopy(databaseName: string): Promise<TestWalletProviderNoSetup> {
|
|
941
|
+
const chain: sdk.Chain = 'test'
|
|
942
|
+
|
|
943
|
+
const readerFile = await _tu.existingDataFile(`walletLegacyTestData.sqlite`)
|
|
944
|
+
const readerKnex = _tu.createLocalSQLite(readerFile)
|
|
945
|
+
const reader = new StorageKnex({
|
|
946
|
+
chain,
|
|
947
|
+
knex: readerKnex,
|
|
948
|
+
commissionSatoshis: 0,
|
|
949
|
+
commissionPubKeyHex: undefined,
|
|
950
|
+
feeModel: { model: 'sat/kb', value: 1 }
|
|
951
|
+
})
|
|
952
|
+
await reader.makeAvailable()
|
|
953
|
+
|
|
954
|
+
const rootKeyHex = _tu.legacyRootKeyHex
|
|
955
|
+
const identityKey = '03ac2d10bdb0023f4145cc2eba2fcd2ad3070cb2107b0b48170c46a9440e4cc3fe'
|
|
956
|
+
const rootKey = PrivateKey.fromHex(rootKeyHex)
|
|
957
|
+
const keyDeriver = new KeyDeriver(rootKey)
|
|
958
|
+
|
|
959
|
+
const activeStorage = new StorageIdb({
|
|
960
|
+
chain,
|
|
961
|
+
commissionSatoshis: 0,
|
|
962
|
+
commissionPubKeyHex: undefined,
|
|
963
|
+
feeModel: { model: 'sat/kb', value: 1 }
|
|
964
|
+
})
|
|
965
|
+
|
|
966
|
+
await activeStorage.dropAllData()
|
|
967
|
+
await activeStorage.migrate(databaseName, randomBytesHex(33))
|
|
968
|
+
await activeStorage.makeAvailable()
|
|
969
|
+
|
|
970
|
+
const storage = new WalletStorageManager(identityKey, activeStorage)
|
|
971
|
+
await storage.makeAvailable()
|
|
972
|
+
|
|
973
|
+
await storage.syncFromReader(identityKey, new StorageSyncReader({ identityKey }, reader))
|
|
974
|
+
|
|
975
|
+
await reader.destroy()
|
|
976
|
+
|
|
977
|
+
const services = new Services(chain)
|
|
978
|
+
const monopts = Monitor.createDefaultWalletMonitorOptions(chain, storage, services)
|
|
979
|
+
const monitor = new Monitor(monopts)
|
|
980
|
+
const wallet = new Wallet({ chain, keyDeriver, storage, services, monitor })
|
|
981
|
+
const userId = verifyTruthy(await activeStorage.findUserByIdentityKey(identityKey)).userId
|
|
982
|
+
const r: TestWalletProvider<{}> = {
|
|
983
|
+
rootKey,
|
|
984
|
+
identityKey,
|
|
985
|
+
keyDeriver,
|
|
986
|
+
chain,
|
|
987
|
+
activeStorage,
|
|
988
|
+
storage,
|
|
989
|
+
setup: {},
|
|
990
|
+
services,
|
|
991
|
+
monitor,
|
|
992
|
+
wallet,
|
|
993
|
+
userId
|
|
994
|
+
}
|
|
995
|
+
return r
|
|
996
|
+
}
|
|
997
|
+
|
|
833
998
|
static makeSampleCert(subject?: string): {
|
|
834
999
|
cert: WalletCertificate
|
|
835
1000
|
subject: string
|
|
@@ -854,7 +1019,7 @@ export abstract class TestUtilsWalletStorage {
|
|
|
854
1019
|
return { cert, subject, certifier }
|
|
855
1020
|
}
|
|
856
1021
|
|
|
857
|
-
static async insertTestProvenTx(storage: StorageProvider, txid?: string) {
|
|
1022
|
+
static async insertTestProvenTx(storage: StorageProvider, txid?: string, trx?: TrxToken) {
|
|
858
1023
|
const now = new Date()
|
|
859
1024
|
const ptx: TableProvenTx = {
|
|
860
1025
|
created_at: now,
|
|
@@ -868,7 +1033,7 @@ export abstract class TestUtilsWalletStorage {
|
|
|
868
1033
|
blockHash: randomBytesHex(32),
|
|
869
1034
|
merkleRoot: randomBytesHex(32)
|
|
870
1035
|
}
|
|
871
|
-
await storage.insertProvenTx(ptx)
|
|
1036
|
+
await storage.insertProvenTx(ptx, trx)
|
|
872
1037
|
return ptx
|
|
873
1038
|
}
|
|
874
1039
|
|
|
@@ -1038,7 +1203,7 @@ export abstract class TestUtilsWalletStorage {
|
|
|
1038
1203
|
senderIdentityKey: requiredOnly ? undefined : randomBytesHex(32),
|
|
1039
1204
|
derivationPrefix: requiredOnly ? undefined : randomBytesHex(16),
|
|
1040
1205
|
derivationSuffix: requiredOnly ? undefined : randomBytesHex(16),
|
|
1041
|
-
spentBy: undefined, // must be a valid
|
|
1206
|
+
spentBy: undefined, // must be a valid transactionId
|
|
1042
1207
|
sequenceNumber: requiredOnly ? undefined : 42,
|
|
1043
1208
|
spendingDescription: requiredOnly ? undefined : randomBytesHex(16),
|
|
1044
1209
|
scriptLength: requiredOnly ? undefined : 36,
|
|
@@ -1640,6 +1805,24 @@ export interface MockData {
|
|
|
1640
1805
|
|
|
1641
1806
|
export interface TestSetup2 extends MockData {}
|
|
1642
1807
|
|
|
1808
|
+
export interface TestWalletProvider<T> extends TestWalletOnly {
|
|
1809
|
+
activeStorage: StorageProvider
|
|
1810
|
+
setup?: T
|
|
1811
|
+
userId: number
|
|
1812
|
+
|
|
1813
|
+
rootKey: PrivateKey
|
|
1814
|
+
identityKey: string
|
|
1815
|
+
keyDeriver: KeyDeriver
|
|
1816
|
+
chain: sdk.Chain
|
|
1817
|
+
storage: WalletStorageManager
|
|
1818
|
+
services: Services
|
|
1819
|
+
monitor: Monitor
|
|
1820
|
+
wallet: Wallet
|
|
1821
|
+
localStorageIdentityKey?: string
|
|
1822
|
+
clientStorageIdentityKey?: string
|
|
1823
|
+
localBackupStorageIdentityKey?: string
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1643
1826
|
export interface TestWallet<T> extends TestWalletOnly {
|
|
1644
1827
|
activeStorage: StorageKnex
|
|
1645
1828
|
setup?: T
|
|
@@ -1676,6 +1859,7 @@ async function insertEmptySetup(storage: StorageKnex, identityKey: string): Prom
|
|
|
1676
1859
|
export type TestSetup2Wallet = TestWallet<TestSetup2>
|
|
1677
1860
|
export type TestSetup1Wallet = TestWallet<TestSetup1>
|
|
1678
1861
|
export type TestWalletNoSetup = TestWallet<{}>
|
|
1862
|
+
export type TestWalletProviderNoSetup = TestWalletProvider<{}>
|
|
1679
1863
|
|
|
1680
1864
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1681
1865
|
export async function expectToThrowWERR<R>(
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { ListActionsArgs } from '@bsv/sdk'
|
|
2
2
|
import { sdk, StorageProvider } from '../../../src/index.client'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
_tu,
|
|
5
|
+
expectToThrowWERR,
|
|
6
|
+
TestSetup1,
|
|
7
|
+
TestWalletNoSetup,
|
|
8
|
+
TestWalletProviderNoSetup
|
|
9
|
+
} from '../../utils/TestUtilsWalletStorage'
|
|
10
|
+
import path from 'path'
|
|
11
|
+
|
|
12
|
+
import 'fake-indexeddb/auto'
|
|
4
13
|
|
|
5
14
|
describe('listActions tests', () => {
|
|
6
15
|
jest.setTimeout(99999999)
|
|
@@ -10,15 +19,16 @@ describe('listActions tests', () => {
|
|
|
10
19
|
const setups: { setup: TestSetup1; storage: StorageProvider }[] = []
|
|
11
20
|
|
|
12
21
|
const env = _tu.getEnv('test')
|
|
13
|
-
const ctxs:
|
|
22
|
+
const ctxs: TestWalletProviderNoSetup[] = []
|
|
14
23
|
const testName = () => expect.getState().currentTestName || 'test'
|
|
15
|
-
const
|
|
24
|
+
const databaseName = path.parse(expect.getState().testPath!).name
|
|
16
25
|
|
|
17
26
|
beforeAll(async () => {
|
|
18
27
|
if (env.runMySQL) {
|
|
19
|
-
ctxs.push(await _tu.createLegacyWalletMySQLCopy(
|
|
28
|
+
ctxs.push(await _tu.createLegacyWalletMySQLCopy(databaseName))
|
|
20
29
|
}
|
|
21
|
-
ctxs.push(await _tu.
|
|
30
|
+
ctxs.push(await _tu.createIdbLegacyWalletCopy(databaseName))
|
|
31
|
+
ctxs.push(await _tu.createLegacyWalletSQLiteCopy(databaseName))
|
|
22
32
|
})
|
|
23
33
|
|
|
24
34
|
afterAll(async () => {
|