@bopen-io/wallet-toolbox 1.7.18
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/.claude/settings.local.json +10 -0
- package/.env.template +22 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
- package/.github/ISSUE_TEMPLATE/discussion.md +24 -0
- package/.github/pull_request_template.md +22 -0
- package/.github/workflows/push.yaml +145 -0
- package/.prettierrc +10 -0
- package/CHANGELOG.md +280 -0
- package/CONTRIBUTING.md +89 -0
- package/README.md +43 -0
- package/docs/README.md +85 -0
- package/docs/client.md +19627 -0
- package/docs/monitor.md +953 -0
- package/docs/open-rpc/index.html +46 -0
- package/docs/services.md +6377 -0
- package/docs/setup.md +1268 -0
- package/docs/storage.md +5367 -0
- package/docs/wallet.md +19626 -0
- package/jest.config.ts +25 -0
- package/license.md +28 -0
- package/out/tsconfig.all.tsbuildinfo +1 -0
- package/package.json +63 -0
- package/src/CWIStyleWalletManager.ts +1999 -0
- package/src/Setup.ts +579 -0
- package/src/SetupClient.ts +322 -0
- package/src/SetupWallet.ts +108 -0
- package/src/SimpleWalletManager.ts +526 -0
- package/src/Wallet.ts +1169 -0
- package/src/WalletAuthenticationManager.ts +153 -0
- package/src/WalletLogger.ts +213 -0
- package/src/WalletPermissionsManager.ts +3660 -0
- package/src/WalletSettingsManager.ts +114 -0
- package/src/__tests/CWIStyleWalletManager.test.d.ts.map +1 -0
- package/src/__tests/CWIStyleWalletManager.test.js.map +1 -0
- package/src/__tests/CWIStyleWalletManager.test.ts +675 -0
- package/src/__tests/WalletPermissionsManager.callbacks.test.ts +323 -0
- package/src/__tests/WalletPermissionsManager.checks.test.ts +844 -0
- package/src/__tests/WalletPermissionsManager.encryption.test.ts +412 -0
- package/src/__tests/WalletPermissionsManager.fixtures.ts +307 -0
- package/src/__tests/WalletPermissionsManager.flows.test.ts +462 -0
- package/src/__tests/WalletPermissionsManager.initialization.test.ts +300 -0
- package/src/__tests/WalletPermissionsManager.pmodules.test.ts +798 -0
- package/src/__tests/WalletPermissionsManager.proxying.test.ts +724 -0
- package/src/__tests/WalletPermissionsManager.tokens.test.ts +503 -0
- package/src/index.all.ts +27 -0
- package/src/index.client.ts +25 -0
- package/src/index.mobile.ts +21 -0
- package/src/index.ts +1 -0
- package/src/monitor/Monitor.ts +412 -0
- package/src/monitor/MonitorDaemon.ts +188 -0
- package/src/monitor/README.md +3 -0
- package/src/monitor/__test/MonitorDaemon.man.test.ts +45 -0
- package/src/monitor/tasks/TaskCheckForProofs.ts +243 -0
- package/src/monitor/tasks/TaskCheckNoSends.ts +73 -0
- package/src/monitor/tasks/TaskClock.ts +33 -0
- package/src/monitor/tasks/TaskFailAbandoned.ts +54 -0
- package/src/monitor/tasks/TaskMonitorCallHistory.ts +26 -0
- package/src/monitor/tasks/TaskNewHeader.ts +93 -0
- package/src/monitor/tasks/TaskPurge.ts +68 -0
- package/src/monitor/tasks/TaskReorg.ts +89 -0
- package/src/monitor/tasks/TaskReviewStatus.ts +48 -0
- package/src/monitor/tasks/TaskSendWaiting.ts +122 -0
- package/src/monitor/tasks/TaskSyncWhenIdle.ts +26 -0
- package/src/monitor/tasks/TaskUnFail.ts +151 -0
- package/src/monitor/tasks/WalletMonitorTask.ts +47 -0
- package/src/sdk/CertOpsWallet.ts +18 -0
- package/src/sdk/PrivilegedKeyManager.ts +372 -0
- package/src/sdk/README.md +13 -0
- package/src/sdk/WERR_errors.ts +234 -0
- package/src/sdk/WalletError.ts +170 -0
- package/src/sdk/WalletErrorFromJson.ts +80 -0
- package/src/sdk/WalletServices.interfaces.ts +700 -0
- package/src/sdk/WalletSigner.interfaces.ts +11 -0
- package/src/sdk/WalletStorage.interfaces.ts +606 -0
- package/src/sdk/__test/CertificateLifeCycle.test.ts +131 -0
- package/src/sdk/__test/PrivilegedKeyManager.test.ts +738 -0
- package/src/sdk/__test/WalletError.test.ts +318 -0
- package/src/sdk/__test/validationHelpers.test.ts +21 -0
- package/src/sdk/index.ts +10 -0
- package/src/sdk/types.ts +226 -0
- package/src/services/README.md +11 -0
- package/src/services/ServiceCollection.ts +248 -0
- package/src/services/Services.ts +603 -0
- package/src/services/__tests/ARC.man.test.ts +123 -0
- package/src/services/__tests/ARC.timeout.man.test.ts +79 -0
- package/src/services/__tests/ArcGorillaPool.man.test.ts +108 -0
- package/src/services/__tests/arcServices.test.ts +8 -0
- package/src/services/__tests/bitrails.test.ts +56 -0
- package/src/services/__tests/getMerklePath.test.ts +15 -0
- package/src/services/__tests/getRawTx.test.ts +13 -0
- package/src/services/__tests/postBeef.test.ts +104 -0
- package/src/services/__tests/verifyBeef.test.ts +50 -0
- package/src/services/chaintracker/BHServiceClient.ts +212 -0
- package/src/services/chaintracker/ChaintracksChainTracker.ts +71 -0
- package/src/services/chaintracker/__tests/ChaintracksChainTracker.test.ts +33 -0
- package/src/services/chaintracker/__tests/ChaintracksServiceClient.test.ts +29 -0
- package/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.ts +72 -0
- package/src/services/chaintracker/chaintracks/Api/BulkIngestorApi.ts +83 -0
- package/src/services/chaintracker/chaintracks/Api/BulkStorageApi.ts +92 -0
- package/src/services/chaintracker/chaintracks/Api/ChaintracksApi.ts +64 -0
- package/src/services/chaintracker/chaintracks/Api/ChaintracksClientApi.ts +189 -0
- package/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.ts +18 -0
- package/src/services/chaintracker/chaintracks/Api/ChaintracksFsApi.ts +58 -0
- package/src/services/chaintracker/chaintracks/Api/ChaintracksStorageApi.ts +386 -0
- package/src/services/chaintracker/chaintracks/Api/LiveIngestorApi.ts +25 -0
- package/src/services/chaintracker/chaintracks/Chaintracks.ts +609 -0
- package/src/services/chaintracker/chaintracks/ChaintracksService.ts +199 -0
- package/src/services/chaintracker/chaintracks/ChaintracksServiceClient.ts +154 -0
- package/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.ts +176 -0
- package/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.ts +174 -0
- package/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.ts +18 -0
- package/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.ts +113 -0
- package/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainWs.ts +81 -0
- package/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.ts +86 -0
- package/src/services/chaintracker/chaintracks/Ingest/LiveIngestorTeranodeP2P.ts +59 -0
- package/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.ts +104 -0
- package/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainWs.ts +66 -0
- package/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.ts +566 -0
- package/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.ts +219 -0
- package/src/services/chaintracker/chaintracks/Ingest/__tests/BulkIngestorCDNBabbage.test.ts +54 -0
- package/src/services/chaintracker/chaintracks/Ingest/__tests/LiveIngestorWhatsOnChainPoll.test.ts +33 -0
- package/src/services/chaintracker/chaintracks/Ingest/__tests/WhatsOnChainServices.test.ts +124 -0
- package/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.ts +92 -0
- package/src/services/chaintracker/chaintracks/Storage/ChaintracksKnexMigrations.ts +104 -0
- package/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.ts +382 -0
- package/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.ts +574 -0
- package/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.ts +438 -0
- package/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageMemory.ts +29 -0
- package/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.ts +304 -0
- package/src/services/chaintracker/chaintracks/Storage/__tests/ChaintracksStorageIdb.test.ts +102 -0
- package/src/services/chaintracker/chaintracks/Storage/__tests/ChaintracksStorageKnex.test.ts +45 -0
- package/src/services/chaintracker/chaintracks/__tests/Chaintracks.test.ts +77 -0
- package/src/services/chaintracker/chaintracks/__tests/ChaintracksClientApi.test.ts +192 -0
- package/src/services/chaintracker/chaintracks/__tests/LocalCdnServer.ts +75 -0
- package/src/services/chaintracker/chaintracks/__tests/createIdbChaintracks.test.ts +62 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest349/mainNetBlockHeaders.json +1 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest349/mainNet_0.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest349/mainNet_1.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest349/mainNet_2.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest349/mainNet_3.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest379/mainNetBlockHeaders.json +1 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest379/mainNet_0.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest379/mainNet_1.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest379/mainNet_2.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest379/mainNet_3.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest399/mainNetBlockHeaders.json +1 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest399/mainNet_0.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest399/mainNet_1.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest399/mainNet_2.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest399/mainNet_3.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNetBlockHeaders.json +1 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNet_0.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNet_1.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNet_2.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNet_3.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNet_4.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNetBlockHeaders.json +1 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNet_0.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNet_1.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNet_2.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNet_3.headers +0 -0
- package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNet_4.headers +0 -0
- package/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.ts +92 -0
- package/src/services/chaintracker/chaintracks/createDefaultKnexChaintracksOptions.ts +111 -0
- package/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.ts +91 -0
- package/src/services/chaintracker/chaintracks/createIdbChaintracks.ts +60 -0
- package/src/services/chaintracker/chaintracks/createKnexChaintracks.ts +65 -0
- package/src/services/chaintracker/chaintracks/createNoDbChaintracks.ts +60 -0
- package/src/services/chaintracker/chaintracks/index.all.ts +12 -0
- package/src/services/chaintracker/chaintracks/index.client.ts +4 -0
- package/src/services/chaintracker/chaintracks/index.mobile.ts +37 -0
- package/src/services/chaintracker/chaintracks/util/BulkFileDataManager.ts +975 -0
- package/src/services/chaintracker/chaintracks/util/BulkFileDataReader.ts +60 -0
- package/src/services/chaintracker/chaintracks/util/BulkFilesReader.ts +336 -0
- package/src/services/chaintracker/chaintracks/util/BulkHeaderFile.ts +247 -0
- package/src/services/chaintracker/chaintracks/util/ChaintracksFetch.ts +69 -0
- package/src/services/chaintracker/chaintracks/util/ChaintracksFs.ts +141 -0
- package/src/services/chaintracker/chaintracks/util/HeightRange.ts +153 -0
- package/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.ts +76 -0
- package/src/services/chaintracker/chaintracks/util/__tests/BulkFileDataManager.test.ts +304 -0
- package/src/services/chaintracker/chaintracks/util/__tests/ChaintracksFetch.test.ts +60 -0
- package/src/services/chaintracker/chaintracks/util/__tests/HeightRange.test.ts +67 -0
- package/src/services/chaintracker/chaintracks/util/__tests/SingleWriterMultiReaderLock.test.ts +49 -0
- package/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.ts +573 -0
- package/src/services/chaintracker/chaintracks/util/dirtyHashes.ts +29 -0
- package/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.ts +432 -0
- package/src/services/chaintracker/index.all.ts +4 -0
- package/src/services/chaintracker/index.client.ts +4 -0
- package/src/services/chaintracker/index.mobile.ts +4 -0
- package/src/services/createDefaultWalletServicesOptions.ts +77 -0
- package/src/services/index.ts +1 -0
- package/src/services/processingErrors/arcSuccessError.json +76 -0
- package/src/services/providers/ARC.ts +350 -0
- package/src/services/providers/Bitails.ts +256 -0
- package/src/services/providers/SdkWhatsOnChain.ts +83 -0
- package/src/services/providers/WhatsOnChain.ts +883 -0
- package/src/services/providers/__tests/WhatsOnChain.test.ts +242 -0
- package/src/services/providers/__tests/exchangeRates.test.ts +18 -0
- package/src/services/providers/exchangeRates.ts +265 -0
- package/src/services/providers/getBeefForTxid.ts +369 -0
- package/src/signer/README.md +5 -0
- package/src/signer/WalletSigner.ts +17 -0
- package/src/signer/methods/acquireDirectCertificate.ts +52 -0
- package/src/signer/methods/buildSignableTransaction.ts +183 -0
- package/src/signer/methods/completeSignedTransaction.ts +117 -0
- package/src/signer/methods/createAction.ts +172 -0
- package/src/signer/methods/internalizeAction.ts +106 -0
- package/src/signer/methods/proveCertificate.ts +43 -0
- package/src/signer/methods/signAction.ts +54 -0
- package/src/storage/README.md +14 -0
- package/src/storage/StorageIdb.ts +2304 -0
- package/src/storage/StorageKnex.ts +1425 -0
- package/src/storage/StorageProvider.ts +810 -0
- package/src/storage/StorageReader.ts +194 -0
- package/src/storage/StorageReaderWriter.ts +432 -0
- package/src/storage/StorageSyncReader.ts +34 -0
- package/src/storage/WalletStorageManager.ts +943 -0
- package/src/storage/__test/StorageIdb.test.ts +43 -0
- package/src/storage/__test/WalletStorageManager.test.ts +275 -0
- package/src/storage/__test/adminStats.man.test.ts +89 -0
- package/src/storage/__test/getBeefForTransaction.test.ts +385 -0
- package/src/storage/index.all.ts +11 -0
- package/src/storage/index.client.ts +7 -0
- package/src/storage/index.mobile.ts +6 -0
- package/src/storage/methods/ListActionsSpecOp.ts +70 -0
- package/src/storage/methods/ListOutputsSpecOp.ts +129 -0
- package/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.ts +1057 -0
- package/src/storage/methods/__test/GenerateChange/randomValsUsed1.ts +20 -0
- package/src/storage/methods/__test/offsetKey.test.ts +274 -0
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +389 -0
- package/src/storage/methods/createAction.ts +947 -0
- package/src/storage/methods/generateChange.ts +556 -0
- package/src/storage/methods/getBeefForTransaction.ts +139 -0
- package/src/storage/methods/getSyncChunk.ts +293 -0
- package/src/storage/methods/internalizeAction.ts +562 -0
- package/src/storage/methods/listActionsIdb.ts +183 -0
- package/src/storage/methods/listActionsKnex.ts +226 -0
- package/src/storage/methods/listCertificates.ts +73 -0
- package/src/storage/methods/listOutputsIdb.ts +203 -0
- package/src/storage/methods/listOutputsKnex.ts +263 -0
- package/src/storage/methods/offsetKey.ts +89 -0
- package/src/storage/methods/processAction.ts +420 -0
- package/src/storage/methods/purgeData.ts +251 -0
- package/src/storage/methods/purgeDataIdb.ts +10 -0
- package/src/storage/methods/reviewStatus.ts +101 -0
- package/src/storage/methods/reviewStatusIdb.ts +43 -0
- package/src/storage/methods/utils.Buffer.ts +33 -0
- package/src/storage/methods/utils.ts +56 -0
- package/src/storage/remoting/StorageClient.ts +567 -0
- package/src/storage/remoting/StorageMobile.ts +544 -0
- package/src/storage/remoting/StorageServer.ts +291 -0
- package/src/storage/remoting/__test/StorageClient.test.ts +113 -0
- package/src/storage/schema/KnexMigrations.ts +489 -0
- package/src/storage/schema/StorageIdbSchema.ts +150 -0
- package/src/storage/schema/entities/EntityBase.ts +210 -0
- package/src/storage/schema/entities/EntityCertificate.ts +188 -0
- package/src/storage/schema/entities/EntityCertificateField.ts +136 -0
- package/src/storage/schema/entities/EntityCommission.ts +148 -0
- package/src/storage/schema/entities/EntityOutput.ts +290 -0
- package/src/storage/schema/entities/EntityOutputBasket.ts +153 -0
- package/src/storage/schema/entities/EntityOutputTag.ts +121 -0
- package/src/storage/schema/entities/EntityOutputTagMap.ts +123 -0
- package/src/storage/schema/entities/EntityProvenTx.ts +319 -0
- package/src/storage/schema/entities/EntityProvenTxReq.ts +580 -0
- package/src/storage/schema/entities/EntitySyncState.ts +389 -0
- package/src/storage/schema/entities/EntityTransaction.ts +306 -0
- package/src/storage/schema/entities/EntityTxLabel.ts +121 -0
- package/src/storage/schema/entities/EntityTxLabelMap.ts +123 -0
- package/src/storage/schema/entities/EntityUser.ts +112 -0
- package/src/storage/schema/entities/MergeEntity.ts +73 -0
- package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +353 -0
- package/src/storage/schema/entities/__tests/CertificateTests.test.ts +354 -0
- package/src/storage/schema/entities/__tests/CommissionTests.test.ts +371 -0
- package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +278 -0
- package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +242 -0
- package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +288 -0
- package/src/storage/schema/entities/__tests/OutputTests.test.ts +464 -0
- package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +340 -0
- package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +504 -0
- package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +288 -0
- package/src/storage/schema/entities/__tests/TransactionTests.test.ts +604 -0
- package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +361 -0
- package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +198 -0
- package/src/storage/schema/entities/__tests/stampLogTests.test.ts +90 -0
- package/src/storage/schema/entities/__tests/usersTests.test.ts +340 -0
- package/src/storage/schema/entities/index.ts +16 -0
- package/src/storage/schema/tables/TableCertificate.ts +21 -0
- package/src/storage/schema/tables/TableCertificateField.ts +12 -0
- package/src/storage/schema/tables/TableCommission.ts +13 -0
- package/src/storage/schema/tables/TableMonitorEvent.ts +9 -0
- package/src/storage/schema/tables/TableOutput.ts +64 -0
- package/src/storage/schema/tables/TableOutputBasket.ts +12 -0
- package/src/storage/schema/tables/TableOutputTag.ts +10 -0
- package/src/storage/schema/tables/TableOutputTagMap.ts +9 -0
- package/src/storage/schema/tables/TableProvenTx.ts +14 -0
- package/src/storage/schema/tables/TableProvenTxReq.ts +65 -0
- package/src/storage/schema/tables/TableSettings.ts +17 -0
- package/src/storage/schema/tables/TableSyncState.ts +18 -0
- package/src/storage/schema/tables/TableTransaction.ts +54 -0
- package/src/storage/schema/tables/TableTxLabel.ts +10 -0
- package/src/storage/schema/tables/TableTxLabelMap.ts +9 -0
- package/src/storage/schema/tables/TableUser.ts +16 -0
- package/src/storage/schema/tables/index.ts +16 -0
- package/src/storage/sync/StorageMySQLDojoReader.ts +696 -0
- package/src/storage/sync/index.ts +1 -0
- package/src/utility/Format.ts +133 -0
- package/src/utility/README.md +3 -0
- package/src/utility/ReaderUint8Array.ts +187 -0
- package/src/utility/ScriptTemplateBRC29.ts +73 -0
- package/src/utility/__tests/utilityHelpers.noBuffer.test.ts +109 -0
- package/src/utility/aggregateResults.ts +68 -0
- package/src/utility/identityUtils.ts +159 -0
- package/src/utility/index.all.ts +7 -0
- package/src/utility/index.client.ts +7 -0
- package/src/utility/parseTxScriptOffsets.ts +29 -0
- package/src/utility/stampLog.ts +69 -0
- package/src/utility/tscProofToMerklePath.ts +48 -0
- package/src/utility/utilityHelpers.buffer.ts +34 -0
- package/src/utility/utilityHelpers.noBuffer.ts +60 -0
- package/src/utility/utilityHelpers.ts +275 -0
- package/src/wab-client/WABClient.ts +94 -0
- package/src/wab-client/__tests/WABClient.man.test.ts +59 -0
- package/src/wab-client/auth-method-interactors/AuthMethodInteractor.ts +47 -0
- package/src/wab-client/auth-method-interactors/DevConsoleInteractor.ts +73 -0
- package/src/wab-client/auth-method-interactors/PersonaIDInteractor.ts +35 -0
- package/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.ts +72 -0
- package/syncVersions.js +71 -0
- package/test/Wallet/StorageClient/storageClient.man.test.ts +75 -0
- package/test/Wallet/action/abortAction.test.ts +47 -0
- package/test/Wallet/action/createAction.test.ts +299 -0
- package/test/Wallet/action/createAction2.test.ts +1273 -0
- package/test/Wallet/action/createActionToGenerateBeefs.man.test.ts +293 -0
- package/test/Wallet/action/internalizeAction.a.test.ts +286 -0
- package/test/Wallet/action/internalizeAction.test.ts +682 -0
- package/test/Wallet/action/relinquishOutput.test.ts +37 -0
- package/test/Wallet/certificate/acquireCertificate.test.ts +298 -0
- package/test/Wallet/certificate/listCertificates.test.ts +346 -0
- package/test/Wallet/construct/Wallet.constructor.test.ts +57 -0
- package/test/Wallet/get/getHeaderForHeight.test.ts +82 -0
- package/test/Wallet/get/getHeight.test.ts +52 -0
- package/test/Wallet/get/getKnownTxids.test.ts +86 -0
- package/test/Wallet/get/getNetwork.test.ts +27 -0
- package/test/Wallet/get/getVersion.test.ts +27 -0
- package/test/Wallet/list/listActions.test.ts +279 -0
- package/test/Wallet/list/listActions2.test.ts +1381 -0
- package/test/Wallet/list/listCertificates.test.ts +118 -0
- package/test/Wallet/list/listOutputs.test.ts +447 -0
- package/test/Wallet/live/walletLive.man.test.ts +521 -0
- package/test/Wallet/local/localWallet.man.test.ts +93 -0
- package/test/Wallet/local/localWallet2.man.test.ts +277 -0
- package/test/Wallet/signAction/mountaintop.man.test.ts +130 -0
- package/test/Wallet/specOps/specOps.man.test.ts +220 -0
- package/test/Wallet/support/janitor.man.test.ts +40 -0
- package/test/Wallet/support/operations.man.test.ts +407 -0
- package/test/Wallet/support/reqErrorReview.2025.05.06.man.test.ts +347 -0
- package/test/Wallet/sync/Wallet.sync.test.ts +215 -0
- package/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.ts +203 -0
- package/test/Wallet/sync/setActive.test.ts +170 -0
- package/test/WalletClient/LocalKVStore.man.test.ts +114 -0
- package/test/WalletClient/WERR.man.test.ts +35 -0
- package/test/bsv-ts-sdk/LocalKVStore.test.ts +102 -0
- package/test/checkDB.ts +57 -0
- package/test/checkdb +0 -0
- package/test/examples/backup.man.test.ts +59 -0
- package/test/examples/pushdrop.test.ts +282 -0
- package/test/monitor/Monitor.test.ts +620 -0
- package/test/services/Services.test.ts +263 -0
- package/test/storage/KnexMigrations.test.ts +86 -0
- package/test/storage/StorageMySQLDojoReader.man.test.ts +60 -0
- package/test/storage/count.test.ts +177 -0
- package/test/storage/find.test.ts +195 -0
- package/test/storage/findLegacy.test.ts +67 -0
- 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 +36 -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 +999 -0
- package/test/storage/insert.test.ts +278 -0
- package/test/storage/update.test.ts +1021 -0
- package/test/storage/update2.test.ts +897 -0
- package/test/utils/TestUtilsWalletStorage.ts +2526 -0
- package/test/utils/localWalletMethods.ts +363 -0
- package/test/utils/removeFailedFromDatabase.sql +17 -0
- package/ts2md.json +44 -0
- package/tsconfig.all.json +31 -0
- package/tsconfig.client.json +29 -0
- package/tsconfig.json +17 -0
- package/tsconfig.mobile.json +28 -0
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Transaction,
|
|
3
|
+
AbortActionResult,
|
|
4
|
+
Beef,
|
|
5
|
+
InternalizeActionArgs,
|
|
6
|
+
ListActionsResult,
|
|
7
|
+
ListOutputsResult,
|
|
8
|
+
PubKeyHex,
|
|
9
|
+
ListCertificatesResult,
|
|
10
|
+
TrustSelf,
|
|
11
|
+
RelinquishCertificateArgs,
|
|
12
|
+
RelinquishOutputArgs,
|
|
13
|
+
AbortActionArgs,
|
|
14
|
+
Validation,
|
|
15
|
+
WalletLoggerInterface
|
|
16
|
+
} from '@bsv/sdk'
|
|
17
|
+
import { getBeefForTransaction } from './methods/getBeefForTransaction'
|
|
18
|
+
import { GetReqsAndBeefDetail, GetReqsAndBeefResult, processAction } from './methods/processAction'
|
|
19
|
+
import { attemptToPostReqsToNetwork, PostReqsToNetworkResult } from './methods/attemptToPostReqsToNetwork'
|
|
20
|
+
import { listCertificates } from './methods/listCertificates'
|
|
21
|
+
import { createAction } from './methods/createAction'
|
|
22
|
+
import { internalizeAction } from './methods/internalizeAction'
|
|
23
|
+
import { StorageReaderWriter, StorageReaderWriterOptions } from './StorageReaderWriter'
|
|
24
|
+
import { EntityProvenTx, EntityProvenTxReq, EntitySyncState, EntityTransaction } from './schema/entities'
|
|
25
|
+
import { ServicesCallHistory, WalletServices } from '../sdk/WalletServices.interfaces'
|
|
26
|
+
import {
|
|
27
|
+
AuthId,
|
|
28
|
+
FindCertificatesArgs,
|
|
29
|
+
FindOutputBasketsArgs,
|
|
30
|
+
FindOutputsArgs,
|
|
31
|
+
ProcessSyncChunkResult,
|
|
32
|
+
ProvenOrRawTx,
|
|
33
|
+
PurgeParams,
|
|
34
|
+
PurgeResults,
|
|
35
|
+
RequestSyncChunkArgs,
|
|
36
|
+
StorageCreateActionResult,
|
|
37
|
+
StorageFeeModel,
|
|
38
|
+
StorageGetBeefOptions,
|
|
39
|
+
StorageInternalizeActionResult,
|
|
40
|
+
StorageProcessActionArgs,
|
|
41
|
+
StorageProcessActionResults,
|
|
42
|
+
StorageProvenOrReq,
|
|
43
|
+
SyncChunk,
|
|
44
|
+
TrxToken,
|
|
45
|
+
UpdateProvenTxReqWithNewProvenTxArgs,
|
|
46
|
+
UpdateProvenTxReqWithNewProvenTxResult,
|
|
47
|
+
WalletStorageProvider
|
|
48
|
+
} from '../sdk/WalletStorage.interfaces'
|
|
49
|
+
import { Chain, TransactionStatus } from '../sdk/types'
|
|
50
|
+
import { TableProvenTxReq, TableProvenTxReqDynamics } from '../../src/storage/schema/tables/TableProvenTxReq'
|
|
51
|
+
import { TableOutputBasket } from '../../src/storage/schema/tables/TableOutputBasket'
|
|
52
|
+
import { TableTransaction } from '../../src/storage/schema/tables/TableTransaction'
|
|
53
|
+
import { TableOutput, TableOutputX } from '../../src/storage/schema/tables/TableOutput'
|
|
54
|
+
import { TableOutputTag } from '../../src/storage/schema/tables/TableOutputTag'
|
|
55
|
+
import { TableTxLabel } from '../../src/storage/schema/tables/TableTxLabel'
|
|
56
|
+
import { TableMonitorEvent } from '../../src/storage/schema/tables/TableMonitorEvent'
|
|
57
|
+
import { TableCertificateX } from './schema/tables/TableCertificate'
|
|
58
|
+
import {
|
|
59
|
+
WERR_INTERNAL,
|
|
60
|
+
WERR_INVALID_OPERATION,
|
|
61
|
+
WERR_INVALID_PARAMETER,
|
|
62
|
+
WERR_MISSING_PARAMETER,
|
|
63
|
+
WERR_UNAUTHORIZED
|
|
64
|
+
} from '../sdk/WERR_errors'
|
|
65
|
+
import { verifyId, verifyOne, verifyOneOrNone, verifyTruthy } from '../utility/utilityHelpers'
|
|
66
|
+
import { WalletError } from '../sdk/WalletError'
|
|
67
|
+
import { asArray, asString } from '../utility/utilityHelpers.noBuffer'
|
|
68
|
+
|
|
69
|
+
export abstract class StorageProvider extends StorageReaderWriter implements WalletStorageProvider {
|
|
70
|
+
isDirty = false
|
|
71
|
+
_services?: WalletServices
|
|
72
|
+
feeModel: StorageFeeModel
|
|
73
|
+
commissionSatoshis: number
|
|
74
|
+
commissionPubKeyHex?: PubKeyHex
|
|
75
|
+
maxRecursionDepth?: number
|
|
76
|
+
|
|
77
|
+
static defaultOptions() {
|
|
78
|
+
return {
|
|
79
|
+
feeModel: <StorageFeeModel>{ model: 'sat/kb', value: 1 },
|
|
80
|
+
commissionSatoshis: 0,
|
|
81
|
+
commissionPubKeyHex: undefined
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static createStorageBaseOptions(chain: Chain): StorageProviderOptions {
|
|
86
|
+
const options: StorageProviderOptions = {
|
|
87
|
+
...StorageProvider.defaultOptions(),
|
|
88
|
+
chain
|
|
89
|
+
}
|
|
90
|
+
return options
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
constructor(options: StorageProviderOptions) {
|
|
94
|
+
super(options)
|
|
95
|
+
this.feeModel = options.feeModel
|
|
96
|
+
this.commissionPubKeyHex = options.commissionPubKeyHex
|
|
97
|
+
this.commissionSatoshis = options.commissionSatoshis
|
|
98
|
+
this.maxRecursionDepth = 12
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
abstract reviewStatus(args: { agedLimit: Date; trx?: TrxToken }): Promise<{ log: string }>
|
|
102
|
+
|
|
103
|
+
abstract purgeData(params: PurgeParams, trx?: TrxToken): Promise<PurgeResults>
|
|
104
|
+
|
|
105
|
+
abstract allocateChangeInput(
|
|
106
|
+
userId: number,
|
|
107
|
+
basketId: number,
|
|
108
|
+
targetSatoshis: number,
|
|
109
|
+
exactSatoshis: number | undefined,
|
|
110
|
+
excludeSending: boolean,
|
|
111
|
+
transactionId: number
|
|
112
|
+
): Promise<TableOutput | undefined>
|
|
113
|
+
|
|
114
|
+
abstract getProvenOrRawTx(txid: string, trx?: TrxToken): Promise<ProvenOrRawTx>
|
|
115
|
+
abstract getRawTxOfKnownValidTransaction(
|
|
116
|
+
txid?: string,
|
|
117
|
+
offset?: number,
|
|
118
|
+
length?: number,
|
|
119
|
+
trx?: TrxToken
|
|
120
|
+
): Promise<number[] | undefined>
|
|
121
|
+
|
|
122
|
+
abstract getLabelsForTransactionId(transactionId?: number, trx?: TrxToken): Promise<TableTxLabel[]>
|
|
123
|
+
abstract getTagsForOutputId(outputId: number, trx?: TrxToken): Promise<TableOutputTag[]>
|
|
124
|
+
|
|
125
|
+
abstract listActions(auth: AuthId, args: Validation.ValidListActionsArgs): Promise<ListActionsResult>
|
|
126
|
+
abstract listOutputs(auth: AuthId, args: Validation.ValidListOutputsArgs): Promise<ListOutputsResult>
|
|
127
|
+
|
|
128
|
+
abstract countChangeInputs(userId: number, basketId: number, excludeSending: boolean): Promise<number>
|
|
129
|
+
|
|
130
|
+
abstract findCertificatesAuth(auth: AuthId, args: FindCertificatesArgs): Promise<TableCertificateX[]>
|
|
131
|
+
abstract findOutputBasketsAuth(auth: AuthId, args: FindOutputBasketsArgs): Promise<TableOutputBasket[]>
|
|
132
|
+
abstract findOutputsAuth(auth: AuthId, args: FindOutputsArgs): Promise<TableOutput[]>
|
|
133
|
+
abstract insertCertificateAuth(auth: AuthId, certificate: TableCertificateX): Promise<number>
|
|
134
|
+
|
|
135
|
+
abstract adminStats(adminIdentityKey: string): Promise<AdminStatsResult>
|
|
136
|
+
|
|
137
|
+
override isStorageProvider(): boolean {
|
|
138
|
+
return true
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
setServices(v: WalletServices) {
|
|
142
|
+
this._services = v
|
|
143
|
+
}
|
|
144
|
+
getServices(): WalletServices {
|
|
145
|
+
if (!this._services) throw new WERR_INVALID_OPERATION('Must setServices first.')
|
|
146
|
+
return this._services
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async abortAction(auth: AuthId, args: AbortActionArgs): Promise<AbortActionResult> {
|
|
150
|
+
if (!auth.userId) throw new WERR_INVALID_PARAMETER('auth.userId', 'valid')
|
|
151
|
+
|
|
152
|
+
const userId = auth.userId
|
|
153
|
+
let reference: string | undefined = args.reference
|
|
154
|
+
let txid: string | undefined = undefined
|
|
155
|
+
|
|
156
|
+
const r = await this.transaction(async trx => {
|
|
157
|
+
let tx = verifyOneOrNone(
|
|
158
|
+
await this.findTransactions({
|
|
159
|
+
partial: { reference, userId },
|
|
160
|
+
noRawTx: true,
|
|
161
|
+
trx
|
|
162
|
+
})
|
|
163
|
+
)
|
|
164
|
+
if (!tx && args.reference.length === 64) {
|
|
165
|
+
// reference may also be a txid
|
|
166
|
+
txid = reference
|
|
167
|
+
reference = undefined
|
|
168
|
+
tx = verifyOneOrNone(
|
|
169
|
+
await this.findTransactions({
|
|
170
|
+
partial: { txid, userId },
|
|
171
|
+
noRawTx: true,
|
|
172
|
+
trx
|
|
173
|
+
})
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
const unAbortableStatus: TransactionStatus[] = ['completed', 'failed', 'sending', 'unproven']
|
|
177
|
+
if (!tx || !tx.isOutgoing || -1 < unAbortableStatus.findIndex(s => s === tx.status))
|
|
178
|
+
throw new WERR_INVALID_PARAMETER(
|
|
179
|
+
'reference',
|
|
180
|
+
'an inprocess, outgoing action that has not been signed and shared to the network.'
|
|
181
|
+
)
|
|
182
|
+
await this.updateTransactionStatus('failed', tx.transactionId, userId, reference, trx)
|
|
183
|
+
if (tx.txid) {
|
|
184
|
+
const req = await EntityProvenTxReq.fromStorageTxid(this, tx.txid, trx)
|
|
185
|
+
if (req) {
|
|
186
|
+
req.addHistoryNote({ what: 'abortAction', reference: args.reference })
|
|
187
|
+
req.status = 'invalid'
|
|
188
|
+
await req.updateStorageDynamicProperties(this, trx)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const r: AbortActionResult = {
|
|
192
|
+
aborted: true
|
|
193
|
+
}
|
|
194
|
+
return r
|
|
195
|
+
})
|
|
196
|
+
return r
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async internalizeAction(auth: AuthId, args: InternalizeActionArgs): Promise<StorageInternalizeActionResult> {
|
|
200
|
+
return await internalizeAction(this, auth, args)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Given an array of transaction txids with current ProvenTxReq ready-to-share status,
|
|
205
|
+
* lookup their ProvenTxReqApi req records.
|
|
206
|
+
* For the txids with reqs and status still ready to send construct a single merged beef.
|
|
207
|
+
*
|
|
208
|
+
* @param txids
|
|
209
|
+
* @param knownTxids
|
|
210
|
+
* @param trx
|
|
211
|
+
*/
|
|
212
|
+
async getReqsAndBeefToShareWithWorld(
|
|
213
|
+
txids: string[],
|
|
214
|
+
knownTxids: string[],
|
|
215
|
+
trx?: TrxToken
|
|
216
|
+
): Promise<GetReqsAndBeefResult> {
|
|
217
|
+
const r: GetReqsAndBeefResult = {
|
|
218
|
+
beef: new Beef(),
|
|
219
|
+
details: []
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
for (const txid of txids) {
|
|
223
|
+
const d: GetReqsAndBeefDetail = {
|
|
224
|
+
txid,
|
|
225
|
+
// status: 'readyToSend' | 'alreadySent' | 'error' | 'unknown'
|
|
226
|
+
status: 'unknown'
|
|
227
|
+
// req?: TableProvenTxReq
|
|
228
|
+
// proven?: TableProvenTx
|
|
229
|
+
// error?: string
|
|
230
|
+
}
|
|
231
|
+
r.details.push(d)
|
|
232
|
+
try {
|
|
233
|
+
d.proven = verifyOneOrNone(await this.findProvenTxs({ partial: { txid }, trx }))
|
|
234
|
+
if (d.proven) d.status = 'alreadySent'
|
|
235
|
+
else {
|
|
236
|
+
const alreadySentStatus = ['unmined', 'callback', 'unconfirmed', 'completed']
|
|
237
|
+
const readyToSendStatus = ['sending', 'unsent', 'nosend', 'unprocessed']
|
|
238
|
+
const errorStatus = ['unknown', 'nonfinal', 'invalid', 'doubleSpend']
|
|
239
|
+
|
|
240
|
+
d.req = verifyOneOrNone(await this.findProvenTxReqs({ partial: { txid }, trx }))
|
|
241
|
+
if (!d.req) {
|
|
242
|
+
d.status = 'error'
|
|
243
|
+
d.error = `ERR_UNKNOWN_TXID: ${txid} was not found.`
|
|
244
|
+
} else if (errorStatus.indexOf(d.req.status) > -1) {
|
|
245
|
+
d.status = 'error'
|
|
246
|
+
d.error = `ERR_INVALID_PARAMETER: ${txid} is not ready to send.`
|
|
247
|
+
} else if (alreadySentStatus.indexOf(d.req.status) > -1) {
|
|
248
|
+
d.status = 'alreadySent'
|
|
249
|
+
} else if (readyToSendStatus.indexOf(d.req.status) > -1) {
|
|
250
|
+
if (!d.req.rawTx || !d.req.inputBEEF) {
|
|
251
|
+
d.status = 'error'
|
|
252
|
+
d.error = `ERR_INTERNAL: ${txid} req is missing rawTx or beef.`
|
|
253
|
+
} else d.status = 'readyToSend'
|
|
254
|
+
} else {
|
|
255
|
+
d.status = 'error'
|
|
256
|
+
d.error = `ERR_INTERNAL: ${txid} has unexpected req status ${d.req.status}`
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (d.status === 'readyToSend') {
|
|
260
|
+
await this.mergeReqToBeefToShareExternally(d.req!, r.beef, knownTxids, trx)
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
} catch (eu: unknown) {
|
|
264
|
+
const e = WalletError.fromUnknown(eu)
|
|
265
|
+
d.error = `${e.name}: ${e.message}`
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return r
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
async mergeReqToBeefToShareExternally(
|
|
272
|
+
req: TableProvenTxReq,
|
|
273
|
+
mergeToBeef: Beef,
|
|
274
|
+
knownTxids: string[],
|
|
275
|
+
trx?: TrxToken
|
|
276
|
+
): Promise<void> {
|
|
277
|
+
const { rawTx, inputBEEF: beef } = req
|
|
278
|
+
if (!rawTx || !beef) throw new WERR_INTERNAL(`req rawTx and beef must be valid.`)
|
|
279
|
+
mergeToBeef.mergeRawTx(asArray(rawTx))
|
|
280
|
+
mergeToBeef.mergeBeef(asArray(beef))
|
|
281
|
+
const tx = Transaction.fromBinary(asArray(rawTx))
|
|
282
|
+
for (const input of tx.inputs) {
|
|
283
|
+
if (!input.sourceTXID) throw new WERR_INTERNAL(`req all transaction inputs must have valid sourceTXID`)
|
|
284
|
+
const txid = input.sourceTXID
|
|
285
|
+
const btx = mergeToBeef.findTxid(txid)
|
|
286
|
+
if (!btx) {
|
|
287
|
+
if (knownTxids && knownTxids.indexOf(txid) > -1) mergeToBeef.mergeTxidOnly(txid)
|
|
288
|
+
else await this.getValidBeefForKnownTxid(txid, mergeToBeef, undefined, knownTxids, trx)
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Checks if txid is a known valid ProvenTx and returns it if found.
|
|
295
|
+
* Next checks if txid is a current ProvenTxReq and returns that if found.
|
|
296
|
+
* If `newReq` is provided and an existing ProvenTxReq isn't found,
|
|
297
|
+
* use `newReq` to create a new ProvenTxReq.
|
|
298
|
+
*
|
|
299
|
+
* This is safe "findOrInsert" operation using retry if unique index constraint
|
|
300
|
+
* is violated by a race condition insert.
|
|
301
|
+
*
|
|
302
|
+
* @param txid
|
|
303
|
+
* @param newReq
|
|
304
|
+
* @param trx
|
|
305
|
+
* @returns
|
|
306
|
+
*/
|
|
307
|
+
async getProvenOrReq(txid: string, newReq?: TableProvenTxReq, trx?: TrxToken): Promise<StorageProvenOrReq> {
|
|
308
|
+
if (newReq && txid !== newReq.txid) throw new WERR_INVALID_PARAMETER('newReq', `same txid`)
|
|
309
|
+
|
|
310
|
+
const r: StorageProvenOrReq = { proven: undefined, req: undefined }
|
|
311
|
+
|
|
312
|
+
r.proven = verifyOneOrNone(await this.findProvenTxs({ partial: { txid }, trx }))
|
|
313
|
+
if (r.proven) return r
|
|
314
|
+
|
|
315
|
+
for (let retry = 0; ; retry++) {
|
|
316
|
+
try {
|
|
317
|
+
r.req = verifyOneOrNone(await this.findProvenTxReqs({ partial: { txid }, trx }))
|
|
318
|
+
if (!r.req && !newReq) break
|
|
319
|
+
if (!r.req && newReq) {
|
|
320
|
+
await this.insertProvenTxReq(newReq, trx)
|
|
321
|
+
}
|
|
322
|
+
if (r.req && newReq) {
|
|
323
|
+
// Merge history and notify into existing
|
|
324
|
+
const req1 = new EntityProvenTxReq(r.req)
|
|
325
|
+
req1.mergeHistory(newReq, undefined, true)
|
|
326
|
+
req1.mergeNotifyTransactionIds(newReq)
|
|
327
|
+
await req1.updateStorageDynamicProperties(this, trx)
|
|
328
|
+
}
|
|
329
|
+
break
|
|
330
|
+
} catch (eu: unknown) {
|
|
331
|
+
if (retry > 0) throw eu
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return r
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
async updateTransactionsStatus(transactionIds: number[], status: TransactionStatus, trx?: TrxToken): Promise<void> {
|
|
339
|
+
await this.transaction(async trx => {
|
|
340
|
+
for (const id of transactionIds) {
|
|
341
|
+
await this.updateTransactionStatus(status, id, undefined, undefined, trx)
|
|
342
|
+
}
|
|
343
|
+
}, trx)
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* For all `status` values besides 'failed', just updates the transaction records status property.
|
|
348
|
+
*
|
|
349
|
+
* For 'status' of 'failed', attempts to make outputs previously allocated as inputs to this transaction usable again.
|
|
350
|
+
*
|
|
351
|
+
* @param status
|
|
352
|
+
* @param transactionId
|
|
353
|
+
* @param userId
|
|
354
|
+
* @param reference
|
|
355
|
+
* @param trx
|
|
356
|
+
*/
|
|
357
|
+
async updateTransactionStatus(
|
|
358
|
+
status: TransactionStatus,
|
|
359
|
+
transactionId?: number,
|
|
360
|
+
userId?: number,
|
|
361
|
+
reference?: string,
|
|
362
|
+
trx?: TrxToken
|
|
363
|
+
): Promise<void> {
|
|
364
|
+
if (!transactionId && !(userId && reference))
|
|
365
|
+
throw new WERR_MISSING_PARAMETER('either transactionId or userId and reference')
|
|
366
|
+
|
|
367
|
+
await this.transaction(async trx => {
|
|
368
|
+
const where: Partial<TableTransaction> = {}
|
|
369
|
+
if (transactionId) where.transactionId = transactionId
|
|
370
|
+
if (userId) where.userId = userId
|
|
371
|
+
if (reference) where.reference = reference
|
|
372
|
+
|
|
373
|
+
const tx = verifyOne(await this.findTransactions({ partial: where, noRawTx: true, trx }))
|
|
374
|
+
|
|
375
|
+
//if (tx.status === status)
|
|
376
|
+
// no change required. Assume inputs and outputs spendable and spentBy are valid for status.
|
|
377
|
+
//return
|
|
378
|
+
|
|
379
|
+
// Once completed, this method cannot be used to "uncomplete" transaction.
|
|
380
|
+
if ((status !== 'completed' && tx.status === 'completed') || tx.provenTxId)
|
|
381
|
+
throw new WERR_INVALID_OPERATION('The status of a "completed" transaction cannot be changed.')
|
|
382
|
+
// It is not possible to un-fail a transaction. Information is lost and not recoverable.
|
|
383
|
+
if (status !== 'failed' && tx.status === 'failed')
|
|
384
|
+
throw new WERR_INVALID_OPERATION(`A "failed" transaction may not be un-failed by this method.`)
|
|
385
|
+
|
|
386
|
+
switch (status) {
|
|
387
|
+
case 'failed':
|
|
388
|
+
{
|
|
389
|
+
// Attempt to make outputs previously allocated as inputs to this transaction usable again.
|
|
390
|
+
// Only clear input's spentBy and reset spendable = true if it references this transaction
|
|
391
|
+
const t = new EntityTransaction(tx)
|
|
392
|
+
const inputs = await t.getInputs(this, trx)
|
|
393
|
+
for (const input of inputs) {
|
|
394
|
+
// input is a prior output belonging to userId that reference this transaction either by `spentBy`
|
|
395
|
+
// or by txid and vout.
|
|
396
|
+
await this.updateOutput(verifyId(input.outputId), { spendable: true, spentBy: undefined }, trx)
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
break
|
|
400
|
+
case 'nosend':
|
|
401
|
+
case 'unsigned':
|
|
402
|
+
case 'unprocessed':
|
|
403
|
+
case 'sending':
|
|
404
|
+
case 'unproven':
|
|
405
|
+
case 'completed':
|
|
406
|
+
break
|
|
407
|
+
default:
|
|
408
|
+
throw new WERR_INVALID_PARAMETER('status', `not be ${status}`)
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
await this.updateTransaction(tx.transactionId, { status }, trx)
|
|
412
|
+
}, trx)
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
async createAction(auth: AuthId, args: Validation.ValidCreateActionArgs): Promise<StorageCreateActionResult> {
|
|
416
|
+
if (!auth.userId) throw new WERR_UNAUTHORIZED()
|
|
417
|
+
return await createAction(this, auth, args)
|
|
418
|
+
}
|
|
419
|
+
async processAction(auth: AuthId, args: StorageProcessActionArgs): Promise<StorageProcessActionResults> {
|
|
420
|
+
if (!auth.userId) throw new WERR_UNAUTHORIZED()
|
|
421
|
+
return await processAction(this, auth, args)
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
async attemptToPostReqsToNetwork(
|
|
425
|
+
reqs: EntityProvenTxReq[],
|
|
426
|
+
trx?: TrxToken,
|
|
427
|
+
logger?: WalletLoggerInterface
|
|
428
|
+
): Promise<PostReqsToNetworkResult> {
|
|
429
|
+
return await attemptToPostReqsToNetwork(this, reqs, trx, logger)
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
async listCertificates(auth: AuthId, args: Validation.ValidListCertificatesArgs): Promise<ListCertificatesResult> {
|
|
433
|
+
return await listCertificates(this, auth, args)
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
async verifyKnownValidTransaction(txid: string, trx?: TrxToken): Promise<boolean> {
|
|
437
|
+
const { proven, rawTx } = await this.getProvenOrRawTx(txid, trx)
|
|
438
|
+
return proven != undefined || rawTx != undefined
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
async getValidBeefForKnownTxid(
|
|
442
|
+
txid: string,
|
|
443
|
+
mergeToBeef?: Beef,
|
|
444
|
+
trustSelf?: TrustSelf,
|
|
445
|
+
knownTxids?: string[],
|
|
446
|
+
trx?: TrxToken,
|
|
447
|
+
requiredLevels?: number
|
|
448
|
+
): Promise<Beef> {
|
|
449
|
+
const beef = await this.getValidBeefForTxid(txid, mergeToBeef, trustSelf, knownTxids, trx, requiredLevels)
|
|
450
|
+
if (!beef) throw new WERR_INVALID_PARAMETER('txid', `known to storage. ${txid} is not known.`)
|
|
451
|
+
return beef
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
async getValidBeefForTxid(
|
|
455
|
+
txid: string,
|
|
456
|
+
mergeToBeef?: Beef,
|
|
457
|
+
trustSelf?: TrustSelf,
|
|
458
|
+
knownTxids?: string[],
|
|
459
|
+
trx?: TrxToken,
|
|
460
|
+
requiredLevels?: number
|
|
461
|
+
): Promise<Beef | undefined> {
|
|
462
|
+
const beef = mergeToBeef || new Beef()
|
|
463
|
+
|
|
464
|
+
const r = await this.getProvenOrRawTx(txid, trx)
|
|
465
|
+
if (r.proven) {
|
|
466
|
+
if (requiredLevels) {
|
|
467
|
+
r.rawTx = r.proven.rawTx
|
|
468
|
+
} else {
|
|
469
|
+
if (trustSelf === 'known') beef.mergeTxidOnly(txid)
|
|
470
|
+
else {
|
|
471
|
+
beef.mergeRawTx(r.proven.rawTx)
|
|
472
|
+
const mp = new EntityProvenTx(r.proven).getMerklePath()
|
|
473
|
+
beef.mergeBump(mp)
|
|
474
|
+
return beef
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
if (!r.rawTx) return undefined
|
|
480
|
+
|
|
481
|
+
if (trustSelf === 'known') {
|
|
482
|
+
beef.mergeTxidOnly(txid)
|
|
483
|
+
} else {
|
|
484
|
+
beef.mergeRawTx(r.rawTx)
|
|
485
|
+
if (r.inputBEEF) beef.mergeBeef(r.inputBEEF)
|
|
486
|
+
const tx = Transaction.fromBinary(r.rawTx)
|
|
487
|
+
if (requiredLevels) requiredLevels--
|
|
488
|
+
for (const input of tx.inputs) {
|
|
489
|
+
const btx = beef.findTxid(input.sourceTXID!)
|
|
490
|
+
if (!btx) {
|
|
491
|
+
if (!requiredLevels && knownTxids && knownTxids.indexOf(input.sourceTXID!) > -1)
|
|
492
|
+
beef.mergeTxidOnly(input.sourceTXID!)
|
|
493
|
+
else await this.getValidBeefForKnownTxid(input.sourceTXID!, beef, trustSelf, knownTxids, trx, requiredLevels)
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return beef
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
async getBeefForTransaction(txid: string, options: StorageGetBeefOptions): Promise<Beef> {
|
|
501
|
+
const beef = await getBeefForTransaction(this, txid, options)
|
|
502
|
+
return beef
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
async findMonitorEventById(id: number, trx?: TrxToken): Promise<TableMonitorEvent | undefined> {
|
|
506
|
+
return verifyOneOrNone(await this.findMonitorEvents({ partial: { id }, trx }))
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
async relinquishCertificate(auth: AuthId, args: RelinquishCertificateArgs): Promise<number> {
|
|
510
|
+
const vargs = Validation.validateRelinquishCertificateArgs(args)
|
|
511
|
+
const cert = verifyOne(
|
|
512
|
+
await this.findCertificates({
|
|
513
|
+
partial: {
|
|
514
|
+
certifier: vargs.certifier,
|
|
515
|
+
serialNumber: vargs.serialNumber,
|
|
516
|
+
type: vargs.type
|
|
517
|
+
}
|
|
518
|
+
})
|
|
519
|
+
)
|
|
520
|
+
return await this.updateCertificate(cert.certificateId, {
|
|
521
|
+
isDeleted: true
|
|
522
|
+
})
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
async relinquishOutput(auth: AuthId, args: RelinquishOutputArgs): Promise<number> {
|
|
526
|
+
const vargs = Validation.validateRelinquishOutputArgs(args)
|
|
527
|
+
const { txid, vout } = Validation.parseWalletOutpoint(vargs.output)
|
|
528
|
+
const output = verifyOne(await this.findOutputs({ partial: { txid, vout } }))
|
|
529
|
+
return await this.updateOutput(output.outputId, { basketId: undefined })
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
async processSyncChunk(args: RequestSyncChunkArgs, chunk: SyncChunk): Promise<ProcessSyncChunkResult> {
|
|
533
|
+
const user = verifyTruthy(await this.findUserByIdentityKey(args.identityKey))
|
|
534
|
+
const ss = new EntitySyncState(
|
|
535
|
+
verifyOne(
|
|
536
|
+
await this.findSyncStates({
|
|
537
|
+
partial: {
|
|
538
|
+
storageIdentityKey: args.fromStorageIdentityKey,
|
|
539
|
+
userId: user.userId
|
|
540
|
+
}
|
|
541
|
+
})
|
|
542
|
+
)
|
|
543
|
+
)
|
|
544
|
+
const r = await ss.processSyncChunk(this, args, chunk)
|
|
545
|
+
return r
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Handles storage changes when a valid MerklePath and mined block header are found for a ProvenTxReq txid.
|
|
550
|
+
*
|
|
551
|
+
* Performs the following storage updates (typically):
|
|
552
|
+
* 1. Lookup the exising `ProvenTxReq` record for its rawTx
|
|
553
|
+
* 2. Insert a new ProvenTx record using properties from `args` and rawTx, yielding a new provenTxId
|
|
554
|
+
* 3. Update ProvenTxReq record with status 'completed' and new provenTxId value (and history of status changed)
|
|
555
|
+
* 4. Unpack notify transactionIds from req and update each transaction's status to 'completed', provenTxId value.
|
|
556
|
+
* 5. Update ProvenTxReq history again to record that transactions have been notified.
|
|
557
|
+
* 6. Return results...
|
|
558
|
+
*
|
|
559
|
+
* Alterations of "typically" to handle:
|
|
560
|
+
*/
|
|
561
|
+
async updateProvenTxReqWithNewProvenTx(
|
|
562
|
+
args: UpdateProvenTxReqWithNewProvenTxArgs
|
|
563
|
+
): Promise<UpdateProvenTxReqWithNewProvenTxResult> {
|
|
564
|
+
const req = await EntityProvenTxReq.fromStorageId(this, args.provenTxReqId)
|
|
565
|
+
let proven: EntityProvenTx
|
|
566
|
+
if (req.provenTxId) {
|
|
567
|
+
// Someone beat us to it, grab what we need for results...
|
|
568
|
+
proven = new EntityProvenTx(verifyOne(await this.findProvenTxs({ partial: { txid: args.txid } })))
|
|
569
|
+
} else {
|
|
570
|
+
let isNew: boolean
|
|
571
|
+
;({ proven, isNew } = await this.transaction(async trx => {
|
|
572
|
+
const { proven: api, isNew } = await this.findOrInsertProvenTx(
|
|
573
|
+
{
|
|
574
|
+
created_at: new Date(),
|
|
575
|
+
updated_at: new Date(),
|
|
576
|
+
provenTxId: 0,
|
|
577
|
+
txid: args.txid,
|
|
578
|
+
height: args.height,
|
|
579
|
+
index: args.index,
|
|
580
|
+
merklePath: args.merklePath,
|
|
581
|
+
rawTx: req.rawTx,
|
|
582
|
+
blockHash: args.blockHash,
|
|
583
|
+
merkleRoot: args.merkleRoot
|
|
584
|
+
},
|
|
585
|
+
trx
|
|
586
|
+
)
|
|
587
|
+
proven = new EntityProvenTx(api)
|
|
588
|
+
if (isNew) {
|
|
589
|
+
req.status = 'completed'
|
|
590
|
+
req.provenTxId = proven.provenTxId
|
|
591
|
+
await req.updateStorageDynamicProperties(this, trx)
|
|
592
|
+
// upate the transaction notifications outside of storage transaction....
|
|
593
|
+
}
|
|
594
|
+
return { proven, isNew }
|
|
595
|
+
}))
|
|
596
|
+
if (isNew) {
|
|
597
|
+
const ids = req.notify.transactionIds || []
|
|
598
|
+
if (ids.length > 0) {
|
|
599
|
+
for (const id of ids) {
|
|
600
|
+
try {
|
|
601
|
+
await this.updateTransaction(id, {
|
|
602
|
+
provenTxId: proven.provenTxId,
|
|
603
|
+
status: 'completed'
|
|
604
|
+
})
|
|
605
|
+
req.addHistoryNote({ what: 'notifyTxOfProof', transactionId: id })
|
|
606
|
+
} catch (eu: unknown) {
|
|
607
|
+
const { code, description } = WalletError.fromUnknown(eu)
|
|
608
|
+
const { provenTxId } = proven
|
|
609
|
+
req.addHistoryNote({ what: 'notifyTxOfProofError', id, provenTxId, code, description })
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
await req.updateStorageDynamicProperties(this)
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
const r: UpdateProvenTxReqWithNewProvenTxResult = {
|
|
617
|
+
status: req.status,
|
|
618
|
+
history: req.apiHistory,
|
|
619
|
+
provenTxId: proven.provenTxId
|
|
620
|
+
}
|
|
621
|
+
return r
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* For each spendable output in the 'default' basket of the authenticated user,
|
|
626
|
+
* verify that the output script, satoshis, vout and txid match that of an output
|
|
627
|
+
* still in the mempool of at least one service provider.
|
|
628
|
+
*
|
|
629
|
+
* @returns object with invalidSpendableOutputs array. A good result is an empty array.
|
|
630
|
+
*/
|
|
631
|
+
async confirmSpendableOutputs(): Promise<{
|
|
632
|
+
invalidSpendableOutputs: TableOutput[]
|
|
633
|
+
}> {
|
|
634
|
+
const invalidSpendableOutputs: TableOutput[] = []
|
|
635
|
+
const users = await this.findUsers({ partial: {} })
|
|
636
|
+
for (const { userId } of users) {
|
|
637
|
+
const defaultBasket = verifyOne(await this.findOutputBaskets({ partial: { userId, name: 'default' } }))
|
|
638
|
+
const where: Partial<TableOutput> = {
|
|
639
|
+
userId,
|
|
640
|
+
basketId: defaultBasket.basketId,
|
|
641
|
+
spendable: true
|
|
642
|
+
}
|
|
643
|
+
const outputs = await this.findOutputs({ partial: where })
|
|
644
|
+
const services = this.getServices()
|
|
645
|
+
for (let i = outputs.length - 1; i >= 0; i--) {
|
|
646
|
+
const o = outputs[i]
|
|
647
|
+
const oid = verifyId(o.outputId)
|
|
648
|
+
if (o.spendable) {
|
|
649
|
+
let ok = false
|
|
650
|
+
if (o.lockingScript && o.lockingScript.length > 0) {
|
|
651
|
+
const hash = services.hashOutputScript(asString(o.lockingScript))
|
|
652
|
+
const r = await services.getUtxoStatus(hash, undefined, `${o.txid}.${o.vout}`)
|
|
653
|
+
if (r.isUtxo === true) ok = true
|
|
654
|
+
}
|
|
655
|
+
if (!ok) invalidSpendableOutputs.push(o)
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return { invalidSpendableOutputs }
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
async updateProvenTxReqDynamics(
|
|
663
|
+
id: number,
|
|
664
|
+
update: Partial<TableProvenTxReqDynamics>,
|
|
665
|
+
trx?: TrxToken
|
|
666
|
+
): Promise<number> {
|
|
667
|
+
const partial: Partial<TableProvenTxReq> = {}
|
|
668
|
+
if (update['updated_at']) partial['updated_at'] = update['updated_at']
|
|
669
|
+
if (update['provenTxId']) partial['provenTxId'] = update['provenTxId']
|
|
670
|
+
if (update['status']) partial['status'] = update['status']
|
|
671
|
+
if (Number.isInteger(update['attempts'])) partial['attempts'] = update['attempts']
|
|
672
|
+
if (update['notified'] !== undefined) partial['notified'] = update['notified']
|
|
673
|
+
if (update['batch']) partial['batch'] = update['batch']
|
|
674
|
+
if (update['history']) partial['history'] = update['history']
|
|
675
|
+
if (update['notify']) partial['notify'] = update['notify']
|
|
676
|
+
|
|
677
|
+
return await this.updateProvenTxReq(id, partial, trx)
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
async extendOutput(
|
|
681
|
+
o: TableOutput,
|
|
682
|
+
includeBasket = false,
|
|
683
|
+
includeTags = false,
|
|
684
|
+
trx?: TrxToken
|
|
685
|
+
): Promise<TableOutputX> {
|
|
686
|
+
const ox = o as TableOutputX
|
|
687
|
+
if (includeBasket && ox.basketId) ox.basket = await this.findOutputBasketById(o.basketId!, trx)
|
|
688
|
+
if (includeTags) {
|
|
689
|
+
ox.tags = await this.getTagsForOutputId(o.outputId)
|
|
690
|
+
}
|
|
691
|
+
return o
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
async validateOutputScript(o: TableOutput, trx?: TrxToken): Promise<void> {
|
|
695
|
+
// without offset and length values return what we have (make no changes)
|
|
696
|
+
if (!o.scriptLength || !o.scriptOffset || !o.txid) return
|
|
697
|
+
// if there is an outputScript and its length is the expected length return what we have.
|
|
698
|
+
if (o.lockingScript && o.lockingScript.length === o.scriptLength) return
|
|
699
|
+
|
|
700
|
+
// outputScript is missing or has incorrect length...
|
|
701
|
+
|
|
702
|
+
const script = await this.getRawTxOfKnownValidTransaction(o.txid, o.scriptOffset, o.scriptLength, trx)
|
|
703
|
+
if (!script) return
|
|
704
|
+
o.lockingScript = script
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export interface StorageProviderOptions extends StorageReaderWriterOptions {
|
|
709
|
+
chain: Chain
|
|
710
|
+
feeModel: StorageFeeModel
|
|
711
|
+
/**
|
|
712
|
+
* Transactions created by this Storage can charge a fee per transaction.
|
|
713
|
+
* A value of zero disables commission fees.
|
|
714
|
+
*/
|
|
715
|
+
commissionSatoshis: number
|
|
716
|
+
/**
|
|
717
|
+
* If commissionSatoshis is greater than zero, must be a valid public key hex string.
|
|
718
|
+
* The actual locking script for each commission will use a public key derived
|
|
719
|
+
* from this key by information stored in the commissions table.
|
|
720
|
+
*/
|
|
721
|
+
commissionPubKeyHex?: PubKeyHex
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
export function validateStorageFeeModel(v?: StorageFeeModel): StorageFeeModel {
|
|
725
|
+
const r: StorageFeeModel = {
|
|
726
|
+
model: 'sat/kb',
|
|
727
|
+
value: 1
|
|
728
|
+
}
|
|
729
|
+
if (typeof v === 'object') {
|
|
730
|
+
if (v.model !== 'sat/kb') throw new WERR_INVALID_PARAMETER('StorageFeeModel.model', `"sat/kb"`)
|
|
731
|
+
if (typeof v.value === 'number') {
|
|
732
|
+
r.value = v.value
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
return r
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
export interface StorageAdminStats {
|
|
739
|
+
requestedBy: string
|
|
740
|
+
when: string
|
|
741
|
+
usersDay: number
|
|
742
|
+
usersWeek: number
|
|
743
|
+
usersMonth: number
|
|
744
|
+
usersTotal: number
|
|
745
|
+
transactionsDay: number
|
|
746
|
+
transactionsWeek: number
|
|
747
|
+
transactionsMonth: number
|
|
748
|
+
transactionsTotal: number
|
|
749
|
+
txCompletedDay: number
|
|
750
|
+
txCompletedWeek: number
|
|
751
|
+
txCompletedMonth: number
|
|
752
|
+
txCompletedTotal: number
|
|
753
|
+
txFailedDay: number
|
|
754
|
+
txFailedWeek: number
|
|
755
|
+
txFailedMonth: number
|
|
756
|
+
txFailedTotal: number
|
|
757
|
+
txUnprocessedDay: number
|
|
758
|
+
txUnprocessedWeek: number
|
|
759
|
+
txUnprocessedMonth: number
|
|
760
|
+
txUnprocessedTotal: number
|
|
761
|
+
txSendingDay: number
|
|
762
|
+
txSendingWeek: number
|
|
763
|
+
txSendingMonth: number
|
|
764
|
+
txSendingTotal: number
|
|
765
|
+
txUnprovenDay: number
|
|
766
|
+
txUnprovenWeek: number
|
|
767
|
+
txUnprovenMonth: number
|
|
768
|
+
txUnprovenTotal: number
|
|
769
|
+
txUnsignedDay: number
|
|
770
|
+
txUnsignedWeek: number
|
|
771
|
+
txUnsignedMonth: number
|
|
772
|
+
txUnsignedTotal: number
|
|
773
|
+
txNosendDay: number
|
|
774
|
+
txNosendWeek: number
|
|
775
|
+
txNosendMonth: number
|
|
776
|
+
txNosendTotal: number
|
|
777
|
+
txNonfinalDay: number
|
|
778
|
+
txNonfinalWeek: number
|
|
779
|
+
txNonfinalMonth: number
|
|
780
|
+
txNonfinalTotal: number
|
|
781
|
+
txUnfailDay: number
|
|
782
|
+
txUnfailWeek: number
|
|
783
|
+
txUnfailMonth: number
|
|
784
|
+
txUnfailTotal: number
|
|
785
|
+
satoshisDefaultDay: number
|
|
786
|
+
satoshisDefaultWeek: number
|
|
787
|
+
satoshisDefaultMonth: number
|
|
788
|
+
satoshisDefaultTotal: number
|
|
789
|
+
satoshisOtherDay: number
|
|
790
|
+
satoshisOtherWeek: number
|
|
791
|
+
satoshisOtherMonth: number
|
|
792
|
+
satoshisOtherTotal: number
|
|
793
|
+
basketsDay: number
|
|
794
|
+
basketsWeek: number
|
|
795
|
+
basketsMonth: number
|
|
796
|
+
basketsTotal: number
|
|
797
|
+
labelsDay: number
|
|
798
|
+
labelsWeek: number
|
|
799
|
+
labelsMonth: number
|
|
800
|
+
labelsTotal: number
|
|
801
|
+
tagsDay: number
|
|
802
|
+
tagsWeek: number
|
|
803
|
+
tagsMonth: number
|
|
804
|
+
tagsTotal: number
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
export interface AdminStatsResult extends StorageAdminStats {
|
|
808
|
+
servicesStats?: ServicesCallHistory
|
|
809
|
+
monitorStats?: ServicesCallHistory
|
|
810
|
+
}
|