@bsv/wallet-toolbox-mobile 2.1.24 → 2.1.25

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.
Files changed (538) hide show
  1. package/out/src/CWIStyleWalletManager.d.ts +33 -7
  2. package/out/src/CWIStyleWalletManager.d.ts.map +1 -1
  3. package/out/src/CWIStyleWalletManager.js +281 -313
  4. package/out/src/CWIStyleWalletManager.js.map +1 -1
  5. package/out/src/SimpleWalletManager.d.ts +12 -2
  6. package/out/src/SimpleWalletManager.d.ts.map +1 -1
  7. package/out/src/SimpleWalletManager.js +46 -30
  8. package/out/src/SimpleWalletManager.js.map +1 -1
  9. package/out/src/Wallet.d.ts +1 -1
  10. package/out/src/Wallet.d.ts.map +1 -1
  11. package/out/src/Wallet.js +102 -100
  12. package/out/src/Wallet.js.map +1 -1
  13. package/out/src/WalletAuthenticationManager.d.ts +1 -1
  14. package/out/src/WalletAuthenticationManager.d.ts.map +1 -1
  15. package/out/src/WalletAuthenticationManager.js +3 -3
  16. package/out/src/WalletAuthenticationManager.js.map +1 -1
  17. package/out/src/WalletLogger.d.ts.map +1 -1
  18. package/out/src/WalletLogger.js +16 -8
  19. package/out/src/WalletLogger.js.map +1 -1
  20. package/out/src/WalletPermissionsManager.d.ts +89 -18
  21. package/out/src/WalletPermissionsManager.d.ts.map +1 -1
  22. package/out/src/WalletPermissionsManager.js +656 -870
  23. package/out/src/WalletPermissionsManager.js.map +1 -1
  24. package/out/src/WalletSettingsManager.d.ts +2 -2
  25. package/out/src/WalletSettingsManager.d.ts.map +1 -1
  26. package/out/src/WalletSettingsManager.js.map +1 -1
  27. package/out/src/mockchain/MockChainMigrations.d.ts +3 -3
  28. package/out/src/mockchain/MockChainMigrations.d.ts.map +1 -1
  29. package/out/src/mockchain/MockChainMigrations.js.map +1 -1
  30. package/out/src/mockchain/MockChainStorage.d.ts.map +1 -1
  31. package/out/src/mockchain/MockChainStorage.js +5 -5
  32. package/out/src/mockchain/MockChainStorage.js.map +1 -1
  33. package/out/src/mockchain/MockChainTracker.d.ts.map +1 -1
  34. package/out/src/mockchain/MockChainTracker.js +10 -10
  35. package/out/src/mockchain/MockChainTracker.js.map +1 -1
  36. package/out/src/mockchain/MockMiner.d.ts.map +1 -1
  37. package/out/src/mockchain/MockMiner.js +3 -3
  38. package/out/src/mockchain/MockMiner.js.map +1 -1
  39. package/out/src/mockchain/MockServices.d.ts +9 -0
  40. package/out/src/mockchain/MockServices.d.ts.map +1 -1
  41. package/out/src/mockchain/MockServices.js +195 -238
  42. package/out/src/mockchain/MockServices.js.map +1 -1
  43. package/out/src/mockchain/merkleTree.d.ts.map +1 -1
  44. package/out/src/mockchain/merkleTree.js +21 -12
  45. package/out/src/mockchain/merkleTree.js.map +1 -1
  46. package/out/src/monitor/Monitor.d.ts +17 -0
  47. package/out/src/monitor/Monitor.d.ts.map +1 -1
  48. package/out/src/monitor/Monitor.js +56 -75
  49. package/out/src/monitor/Monitor.js.map +1 -1
  50. package/out/src/monitor/tasks/TaskArcSSE.d.ts +2 -2
  51. package/out/src/monitor/tasks/TaskArcSSE.d.ts.map +1 -1
  52. package/out/src/monitor/tasks/TaskArcSSE.js +10 -23
  53. package/out/src/monitor/tasks/TaskArcSSE.js.map +1 -1
  54. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +2 -2
  55. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
  56. package/out/src/monitor/tasks/TaskCheckForProofs.js +28 -16
  57. package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
  58. package/out/src/monitor/tasks/TaskCheckNoSends.d.ts +1 -1
  59. package/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +1 -1
  60. package/out/src/monitor/tasks/TaskCheckNoSends.js +1 -2
  61. package/out/src/monitor/tasks/TaskCheckNoSends.js.map +1 -1
  62. package/out/src/monitor/tasks/TaskClock.d.ts +1 -1
  63. package/out/src/monitor/tasks/TaskClock.d.ts.map +1 -1
  64. package/out/src/monitor/tasks/TaskClock.js +0 -1
  65. package/out/src/monitor/tasks/TaskClock.js.map +1 -1
  66. package/out/src/monitor/tasks/TaskFailAbandoned.d.ts +1 -1
  67. package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -1
  68. package/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -1
  69. package/out/src/monitor/tasks/TaskMineBlock.d.ts +1 -1
  70. package/out/src/monitor/tasks/TaskMineBlock.d.ts.map +1 -1
  71. package/out/src/monitor/tasks/TaskMineBlock.js.map +1 -1
  72. package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts +1 -1
  73. package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts.map +1 -1
  74. package/out/src/monitor/tasks/TaskMonitorCallHistory.js +1 -1
  75. package/out/src/monitor/tasks/TaskMonitorCallHistory.js.map +1 -1
  76. package/out/src/monitor/tasks/TaskNewHeader.d.ts +2 -2
  77. package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -1
  78. package/out/src/monitor/tasks/TaskNewHeader.js +7 -5
  79. package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -1
  80. package/out/src/monitor/tasks/TaskPurge.d.ts +1 -1
  81. package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -1
  82. package/out/src/monitor/tasks/TaskPurge.js.map +1 -1
  83. package/out/src/monitor/tasks/TaskReorg.d.ts +1 -1
  84. package/out/src/monitor/tasks/TaskReorg.d.ts.map +1 -1
  85. package/out/src/monitor/tasks/TaskReorg.js +2 -2
  86. package/out/src/monitor/tasks/TaskReorg.js.map +1 -1
  87. package/out/src/monitor/tasks/TaskReviewDoubleSpends.d.ts +1 -1
  88. package/out/src/monitor/tasks/TaskReviewDoubleSpends.d.ts.map +1 -1
  89. package/out/src/monitor/tasks/TaskReviewDoubleSpends.js +10 -10
  90. package/out/src/monitor/tasks/TaskReviewDoubleSpends.js.map +1 -1
  91. package/out/src/monitor/tasks/TaskReviewProvenTxs.d.ts +1 -1
  92. package/out/src/monitor/tasks/TaskReviewProvenTxs.d.ts.map +1 -1
  93. package/out/src/monitor/tasks/TaskReviewProvenTxs.js +2 -2
  94. package/out/src/monitor/tasks/TaskReviewProvenTxs.js.map +1 -1
  95. package/out/src/monitor/tasks/TaskReviewStatus.d.ts +1 -1
  96. package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -1
  97. package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -1
  98. package/out/src/monitor/tasks/TaskReviewUtxos.d.ts +1 -1
  99. package/out/src/monitor/tasks/TaskReviewUtxos.d.ts.map +1 -1
  100. package/out/src/monitor/tasks/TaskReviewUtxos.js.map +1 -1
  101. package/out/src/monitor/tasks/TaskSendWaiting.d.ts +1 -1
  102. package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
  103. package/out/src/monitor/tasks/TaskSendWaiting.js +4 -5
  104. package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
  105. package/out/src/monitor/tasks/TaskUnFail.d.ts +1 -1
  106. package/out/src/monitor/tasks/TaskUnFail.d.ts.map +1 -1
  107. package/out/src/monitor/tasks/TaskUnFail.js +13 -15
  108. package/out/src/monitor/tasks/TaskUnFail.js.map +1 -1
  109. package/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +1 -1
  110. package/out/src/monitor/tasks/WalletMonitorTask.js +3 -1
  111. package/out/src/monitor/tasks/WalletMonitorTask.js.map +1 -1
  112. package/out/src/sdk/CertOpsWallet.d.ts +3 -3
  113. package/out/src/sdk/CertOpsWallet.d.ts.map +1 -1
  114. package/out/src/sdk/PrivilegedKeyManager.d.ts +3 -3
  115. package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -1
  116. package/out/src/sdk/PrivilegedKeyManager.js +26 -21
  117. package/out/src/sdk/PrivilegedKeyManager.js.map +1 -1
  118. package/out/src/sdk/WERR_errors.d.ts.map +1 -1
  119. package/out/src/sdk/WERR_errors.js +5 -5
  120. package/out/src/sdk/WERR_errors.js.map +1 -1
  121. package/out/src/sdk/WalletError.d.ts +1 -1
  122. package/out/src/sdk/WalletError.d.ts.map +1 -1
  123. package/out/src/sdk/WalletError.js +10 -3
  124. package/out/src/sdk/WalletError.js.map +1 -1
  125. package/out/src/sdk/WalletErrorFromJson.d.ts.map +1 -1
  126. package/out/src/sdk/WalletErrorFromJson.js +1 -3
  127. package/out/src/sdk/WalletErrorFromJson.js.map +1 -1
  128. package/out/src/sdk/WalletServices.interfaces.d.ts +19 -19
  129. package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
  130. package/out/src/sdk/types.d.ts +4 -4
  131. package/out/src/sdk/types.d.ts.map +1 -1
  132. package/out/src/sdk/types.js +3 -3
  133. package/out/src/sdk/types.js.map +1 -1
  134. package/out/src/services/ServiceCollection.d.ts +6 -6
  135. package/out/src/services/ServiceCollection.d.ts.map +1 -1
  136. package/out/src/services/ServiceCollection.js +3 -4
  137. package/out/src/services/ServiceCollection.js.map +1 -1
  138. package/out/src/services/Services.d.ts +5 -0
  139. package/out/src/services/Services.d.ts.map +1 -1
  140. package/out/src/services/Services.js +174 -182
  141. package/out/src/services/Services.js.map +1 -1
  142. package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -1
  143. package/out/src/services/chaintracker/ChaintracksChainTracker.js +5 -5
  144. package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -1
  145. package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts +5 -3
  146. package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts.map +1 -1
  147. package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.js.map +1 -1
  148. package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.d.ts.map +1 -1
  149. package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts +20 -10
  150. package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts.map +1 -1
  151. package/out/src/services/chaintracker/chaintracks/Chaintracks.js +228 -221
  152. package/out/src/services/chaintracker/chaintracks/Chaintracks.js.map +1 -1
  153. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -1
  154. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +9 -10
  155. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -1
  156. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.d.ts.map +1 -1
  157. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js +1 -1
  158. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js.map +1 -1
  159. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts +1 -2
  160. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts.map +1 -1
  161. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js +3 -3
  162. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js.map +1 -1
  163. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.d.ts.map +1 -1
  164. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.js.map +1 -1
  165. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.d.ts.map +1 -1
  166. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js +3 -3
  167. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js.map +1 -1
  168. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.d.ts.map +1 -1
  169. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js +1 -1
  170. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js.map +1 -1
  171. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.d.ts.map +1 -1
  172. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js +2 -2
  173. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js.map +1 -1
  174. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts +2 -2
  175. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts.map +1 -1
  176. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js +6 -39
  177. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js.map +1 -1
  178. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts +3 -3
  179. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts.map +1 -1
  180. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js +8 -6
  181. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js.map +1 -1
  182. package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.d.ts.map +1 -1
  183. package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js +9 -16
  184. package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js.map +1 -1
  185. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.d.ts.map +1 -1
  186. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js +34 -22
  187. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js.map +1 -1
  188. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.d.ts.map +1 -1
  189. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js +31 -30
  190. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js.map +1 -1
  191. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts +2 -2
  192. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts.map +1 -1
  193. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js +11 -10
  194. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js.map +1 -1
  195. package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.d.ts.map +1 -1
  196. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts +6 -1
  197. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts.map +1 -1
  198. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js +247 -227
  199. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js.map +1 -1
  200. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.d.ts.map +1 -1
  201. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.js +8 -7
  202. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.js.map +1 -1
  203. package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.d.ts.map +1 -1
  204. package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js +35 -25
  205. package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js.map +1 -1
  206. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts +5 -5
  207. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts.map +1 -1
  208. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js +13 -11
  209. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js.map +1 -1
  210. package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts +0 -1
  211. package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts.map +1 -1
  212. package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js.map +1 -1
  213. package/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts.map +1 -1
  214. package/out/src/services/chaintracker/chaintracks/util/HeightRange.js +21 -13
  215. package/out/src/services/chaintracker/chaintracks/util/HeightRange.js.map +1 -1
  216. package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts +2 -2
  217. package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts.map +1 -1
  218. package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.js.map +1 -1
  219. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts +1 -1
  220. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts.map +1 -1
  221. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js +28 -24
  222. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js.map +1 -1
  223. package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.d.ts.map +1 -1
  224. package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.js.map +1 -1
  225. package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts.map +1 -1
  226. package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js +9 -10
  227. package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js.map +1 -1
  228. package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -1
  229. package/out/src/services/createDefaultWalletServicesOptions.js +3 -3
  230. package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -1
  231. package/out/src/services/providers/ARC.d.ts.map +1 -1
  232. package/out/src/services/providers/ARC.js +7 -14
  233. package/out/src/services/providers/ARC.js.map +1 -1
  234. package/out/src/services/providers/ArcSSEClient.d.ts.map +1 -1
  235. package/out/src/services/providers/ArcSSEClient.js +1 -1
  236. package/out/src/services/providers/ArcSSEClient.js.map +1 -1
  237. package/out/src/services/providers/Bitails.d.ts.map +1 -1
  238. package/out/src/services/providers/Bitails.js +17 -17
  239. package/out/src/services/providers/Bitails.js.map +1 -1
  240. package/out/src/services/providers/SdkWhatsOnChain.d.ts.map +1 -1
  241. package/out/src/services/providers/SdkWhatsOnChain.js.map +1 -1
  242. package/out/src/services/providers/WhatsOnChain.d.ts +2 -0
  243. package/out/src/services/providers/WhatsOnChain.d.ts.map +1 -1
  244. package/out/src/services/providers/WhatsOnChain.js +109 -233
  245. package/out/src/services/providers/WhatsOnChain.js.map +1 -1
  246. package/out/src/services/providers/exchangeRates.d.ts.map +1 -1
  247. package/out/src/services/providers/exchangeRates.js +3 -3
  248. package/out/src/services/providers/exchangeRates.js.map +1 -1
  249. package/out/src/services/providers/getBeefForTxid.d.ts +1 -1
  250. package/out/src/services/providers/getBeefForTxid.d.ts.map +1 -1
  251. package/out/src/services/providers/getBeefForTxid.js.map +1 -1
  252. package/out/src/services/providers/whatsOnChainHelpers.d.ts +68 -0
  253. package/out/src/services/providers/whatsOnChainHelpers.d.ts.map +1 -0
  254. package/out/src/services/providers/whatsOnChainHelpers.js +147 -0
  255. package/out/src/services/providers/whatsOnChainHelpers.js.map +1 -0
  256. package/out/src/signer/WalletSigner.d.ts.map +1 -1
  257. package/out/src/signer/WalletSigner.js.map +1 -1
  258. package/out/src/signer/methods/acquireDirectCertificate.js +1 -1
  259. package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
  260. package/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
  261. package/out/src/signer/methods/buildSignableTransaction.js +21 -13
  262. package/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
  263. package/out/src/signer/methods/completeSignedTransaction.d.ts.map +1 -1
  264. package/out/src/signer/methods/completeSignedTransaction.js +20 -21
  265. package/out/src/signer/methods/completeSignedTransaction.js.map +1 -1
  266. package/out/src/signer/methods/createAction.d.ts.map +1 -1
  267. package/out/src/signer/methods/createAction.js +8 -7
  268. package/out/src/signer/methods/createAction.js.map +1 -1
  269. package/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
  270. package/out/src/signer/methods/internalizeAction.js +8 -6
  271. package/out/src/signer/methods/internalizeAction.js.map +1 -1
  272. package/out/src/signer/methods/proveCertificate.js +1 -1
  273. package/out/src/signer/methods/signAction.d.ts.map +1 -1
  274. package/out/src/signer/methods/signAction.js +8 -10
  275. package/out/src/signer/methods/signAction.js.map +1 -1
  276. package/out/src/storage/StorageProvider.d.ts +10 -0
  277. package/out/src/storage/StorageProvider.d.ts.map +1 -1
  278. package/out/src/storage/StorageProvider.js +152 -182
  279. package/out/src/storage/StorageProvider.js.map +1 -1
  280. package/out/src/storage/StorageReader.d.ts.map +1 -1
  281. package/out/src/storage/StorageReader.js +8 -7
  282. package/out/src/storage/StorageReader.js.map +1 -1
  283. package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
  284. package/out/src/storage/StorageReaderWriter.js +32 -32
  285. package/out/src/storage/StorageReaderWriter.js.map +1 -1
  286. package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
  287. package/out/src/storage/StorageSyncReader.js +3 -3
  288. package/out/src/storage/StorageSyncReader.js.map +1 -1
  289. package/out/src/storage/WalletStorageManager.d.ts +3 -0
  290. package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
  291. package/out/src/storage/WalletStorageManager.js +83 -73
  292. package/out/src/storage/WalletStorageManager.js.map +1 -1
  293. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +83 -0
  294. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
  295. package/out/src/storage/methods/attemptToPostReqsToNetwork.js +224 -61
  296. package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
  297. package/out/src/storage/methods/createAction.d.ts.map +1 -1
  298. package/out/src/storage/methods/createAction.js +230 -270
  299. package/out/src/storage/methods/createAction.js.map +1 -1
  300. package/out/src/storage/methods/generateChange.d.ts.map +1 -1
  301. package/out/src/storage/methods/generateChange.js +99 -80
  302. package/out/src/storage/methods/generateChange.js.map +1 -1
  303. package/out/src/storage/methods/getBeefForTransaction.js +15 -13
  304. package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
  305. package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
  306. package/out/src/storage/methods/getSyncChunk.js +4 -3
  307. package/out/src/storage/methods/getSyncChunk.js.map +1 -1
  308. package/out/src/storage/methods/internalizeAction.js +41 -51
  309. package/out/src/storage/methods/internalizeAction.js.map +1 -1
  310. package/out/src/storage/methods/listCertificates.d.ts +1 -1
  311. package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
  312. package/out/src/storage/methods/listCertificates.js +7 -7
  313. package/out/src/storage/methods/listCertificates.js.map +1 -1
  314. package/out/src/storage/methods/offsetKey.d.ts +1 -1
  315. package/out/src/storage/methods/offsetKey.d.ts.map +1 -1
  316. package/out/src/storage/methods/offsetKey.js +3 -5
  317. package/out/src/storage/methods/offsetKey.js.map +1 -1
  318. package/out/src/storage/methods/processAction.d.ts +0 -11
  319. package/out/src/storage/methods/processAction.d.ts.map +1 -1
  320. package/out/src/storage/methods/processAction.js +90 -83
  321. package/out/src/storage/methods/processAction.js.map +1 -1
  322. package/out/src/storage/methods/utils.d.ts.map +1 -1
  323. package/out/src/storage/methods/utils.js +7 -1
  324. package/out/src/storage/methods/utils.js.map +1 -1
  325. package/out/src/storage/remoting/StorageClient.d.ts +4 -270
  326. package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
  327. package/out/src/storage/remoting/StorageClient.js +16 -423
  328. package/out/src/storage/remoting/StorageClient.js.map +1 -1
  329. package/out/src/storage/remoting/StorageClientBase.d.ts +289 -0
  330. package/out/src/storage/remoting/StorageClientBase.d.ts.map +1 -0
  331. package/out/src/storage/remoting/StorageClientBase.js +375 -0
  332. package/out/src/storage/remoting/StorageClientBase.js.map +1 -0
  333. package/out/src/storage/remoting/StorageMobile.d.ts +7 -275
  334. package/out/src/storage/remoting/StorageMobile.d.ts.map +1 -1
  335. package/out/src/storage/remoting/StorageMobile.js +12 -421
  336. package/out/src/storage/remoting/StorageMobile.js.map +1 -1
  337. package/out/src/storage/remoting/entityValidationHelpers.d.ts +29 -0
  338. package/out/src/storage/remoting/entityValidationHelpers.d.ts.map +1 -0
  339. package/out/src/storage/remoting/entityValidationHelpers.js +91 -0
  340. package/out/src/storage/remoting/entityValidationHelpers.js.map +1 -0
  341. package/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -1
  342. package/out/src/storage/schema/entities/EntityBase.js.map +1 -1
  343. package/out/src/storage/schema/entities/EntityCertificate.d.ts.map +1 -1
  344. package/out/src/storage/schema/entities/EntityCertificate.js +5 -4
  345. package/out/src/storage/schema/entities/EntityCertificate.js.map +1 -1
  346. package/out/src/storage/schema/entities/EntityCertificateField.d.ts.map +1 -1
  347. package/out/src/storage/schema/entities/EntityCertificateField.js +5 -7
  348. package/out/src/storage/schema/entities/EntityCertificateField.js.map +1 -1
  349. package/out/src/storage/schema/entities/EntityCommission.d.ts.map +1 -1
  350. package/out/src/storage/schema/entities/EntityCommission.js +6 -8
  351. package/out/src/storage/schema/entities/EntityCommission.js.map +1 -1
  352. package/out/src/storage/schema/entities/EntityOutput.d.ts.map +1 -1
  353. package/out/src/storage/schema/entities/EntityOutput.js +21 -24
  354. package/out/src/storage/schema/entities/EntityOutput.js.map +1 -1
  355. package/out/src/storage/schema/entities/EntityOutputBasket.d.ts.map +1 -1
  356. package/out/src/storage/schema/entities/EntityOutputBasket.js +6 -6
  357. package/out/src/storage/schema/entities/EntityOutputBasket.js.map +1 -1
  358. package/out/src/storage/schema/entities/EntityOutputTag.d.ts.map +1 -1
  359. package/out/src/storage/schema/entities/EntityOutputTag.js +2 -2
  360. package/out/src/storage/schema/entities/EntityOutputTag.js.map +1 -1
  361. package/out/src/storage/schema/entities/EntityOutputTagMap.d.ts.map +1 -1
  362. package/out/src/storage/schema/entities/EntityOutputTagMap.js +4 -6
  363. package/out/src/storage/schema/entities/EntityOutputTagMap.js.map +1 -1
  364. package/out/src/storage/schema/entities/EntityProvenTx.d.ts +3 -3
  365. package/out/src/storage/schema/entities/EntityProvenTx.d.ts.map +1 -1
  366. package/out/src/storage/schema/entities/EntityProvenTx.js +22 -23
  367. package/out/src/storage/schema/entities/EntityProvenTx.js.map +1 -1
  368. package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts +9 -0
  369. package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts.map +1 -1
  370. package/out/src/storage/schema/entities/EntityProvenTxReq.js +116 -68
  371. package/out/src/storage/schema/entities/EntityProvenTxReq.js.map +1 -1
  372. package/out/src/storage/schema/entities/EntitySyncState.d.ts.map +1 -1
  373. package/out/src/storage/schema/entities/EntitySyncState.js +19 -18
  374. package/out/src/storage/schema/entities/EntitySyncState.js.map +1 -1
  375. package/out/src/storage/schema/entities/EntityTransaction.d.ts.map +1 -1
  376. package/out/src/storage/schema/entities/EntityTransaction.js +25 -26
  377. package/out/src/storage/schema/entities/EntityTransaction.js.map +1 -1
  378. package/out/src/storage/schema/entities/EntityTxLabel.d.ts.map +1 -1
  379. package/out/src/storage/schema/entities/EntityTxLabel.js +2 -2
  380. package/out/src/storage/schema/entities/EntityTxLabel.js.map +1 -1
  381. package/out/src/storage/schema/entities/EntityTxLabelMap.d.ts.map +1 -1
  382. package/out/src/storage/schema/entities/EntityTxLabelMap.js +4 -6
  383. package/out/src/storage/schema/entities/EntityTxLabelMap.js.map +1 -1
  384. package/out/src/storage/schema/entities/EntityUser.d.ts.map +1 -1
  385. package/out/src/storage/schema/entities/EntityUser.js +3 -3
  386. package/out/src/storage/schema/entities/EntityUser.js.map +1 -1
  387. package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
  388. package/out/src/storage/schema/entities/MergeEntity.js +6 -6
  389. package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
  390. package/out/src/storage/schema/tables/TableCertificate.d.ts +2 -1
  391. package/out/src/storage/schema/tables/TableCertificate.d.ts.map +1 -1
  392. package/out/src/storage/schema/tables/TableCertificateField.d.ts +1 -1
  393. package/out/src/storage/schema/tables/TableCertificateField.d.ts.map +1 -1
  394. package/out/src/storage/schema/tables/TableCommission.d.ts +1 -1
  395. package/out/src/storage/schema/tables/TableCommission.d.ts.map +1 -1
  396. package/out/src/storage/schema/tables/TableMonitorEvent.d.ts +1 -1
  397. package/out/src/storage/schema/tables/TableMonitorEvent.d.ts.map +1 -1
  398. package/out/src/storage/schema/tables/TableOutput.d.ts +3 -2
  399. package/out/src/storage/schema/tables/TableOutput.d.ts.map +1 -1
  400. package/out/src/storage/schema/tables/TableOutput.js +1 -1
  401. package/out/src/storage/schema/tables/TableOutput.js.map +1 -1
  402. package/out/src/storage/schema/tables/TableOutputBasket.d.ts +1 -1
  403. package/out/src/storage/schema/tables/TableOutputBasket.d.ts.map +1 -1
  404. package/out/src/storage/schema/tables/TableOutputTag.d.ts +1 -1
  405. package/out/src/storage/schema/tables/TableOutputTag.d.ts.map +1 -1
  406. package/out/src/storage/schema/tables/TableOutputTagMap.d.ts +1 -1
  407. package/out/src/storage/schema/tables/TableOutputTagMap.d.ts.map +1 -1
  408. package/out/src/storage/schema/tables/TableProvenTx.d.ts +1 -1
  409. package/out/src/storage/schema/tables/TableProvenTx.d.ts.map +1 -1
  410. package/out/src/storage/schema/tables/TableProvenTxReq.d.ts +24 -1
  411. package/out/src/storage/schema/tables/TableProvenTxReq.d.ts.map +1 -1
  412. package/out/src/storage/schema/tables/TableSettings.d.ts +1 -1
  413. package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -1
  414. package/out/src/storage/schema/tables/TableSyncState.d.ts +1 -1
  415. package/out/src/storage/schema/tables/TableSyncState.d.ts.map +1 -1
  416. package/out/src/storage/schema/tables/TableTransaction.d.ts +1 -1
  417. package/out/src/storage/schema/tables/TableTransaction.d.ts.map +1 -1
  418. package/out/src/storage/schema/tables/TableTxLabel.d.ts +1 -1
  419. package/out/src/storage/schema/tables/TableTxLabel.d.ts.map +1 -1
  420. package/out/src/storage/schema/tables/TableTxLabelMap.d.ts +1 -1
  421. package/out/src/storage/schema/tables/TableTxLabelMap.d.ts.map +1 -1
  422. package/out/src/storage/schema/tables/TableUser.d.ts +1 -1
  423. package/out/src/storage/schema/tables/TableUser.d.ts.map +1 -1
  424. package/out/src/storage/storageProviderHelpers.d.ts +34 -0
  425. package/out/src/storage/storageProviderHelpers.d.ts.map +1 -0
  426. package/out/src/storage/storageProviderHelpers.js +100 -0
  427. package/out/src/storage/storageProviderHelpers.js.map +1 -0
  428. package/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -1
  429. package/out/src/utility/ScriptTemplateBRC29.js +2 -1
  430. package/out/src/utility/ScriptTemplateBRC29.js.map +1 -1
  431. package/out/src/utility/aggregateResults.d.ts +1 -1
  432. package/out/src/utility/aggregateResults.d.ts.map +1 -1
  433. package/out/src/utility/aggregateResults.js +2 -2
  434. package/out/src/utility/aggregateResults.js.map +1 -1
  435. package/out/src/utility/brc114ActionTimeLabels.d.ts +2 -2
  436. package/out/src/utility/brc114ActionTimeLabels.d.ts.map +1 -1
  437. package/out/src/utility/brc114ActionTimeLabels.js +16 -9
  438. package/out/src/utility/brc114ActionTimeLabels.js.map +1 -1
  439. package/out/src/utility/identityUtils.js +1 -1
  440. package/out/src/utility/identityUtils.js.map +1 -1
  441. package/out/src/utility/parseTxScriptOffsets.d.ts +4 -4
  442. package/out/src/utility/parseTxScriptOffsets.d.ts.map +1 -1
  443. package/out/src/utility/parseTxScriptOffsets.js.map +1 -1
  444. package/out/src/utility/stampLog.d.ts.map +1 -1
  445. package/out/src/utility/stampLog.js +7 -5
  446. package/out/src/utility/stampLog.js.map +1 -1
  447. package/out/src/utility/tscProofToMerklePath.d.ts.map +1 -1
  448. package/out/src/utility/tscProofToMerklePath.js +1 -1
  449. package/out/src/utility/tscProofToMerklePath.js.map +1 -1
  450. package/out/src/utility/utilityHelpers.d.ts +1 -2
  451. package/out/src/utility/utilityHelpers.d.ts.map +1 -1
  452. package/out/src/utility/utilityHelpers.js +10 -10
  453. package/out/src/utility/utilityHelpers.js.map +1 -1
  454. package/out/src/utility/utilityHelpers.noBuffer.d.ts +7 -3
  455. package/out/src/utility/utilityHelpers.noBuffer.d.ts.map +1 -1
  456. package/out/src/utility/utilityHelpers.noBuffer.js +3 -3
  457. package/out/src/utility/utilityHelpers.noBuffer.js.map +1 -1
  458. package/out/src/wab-client/WABClient.d.ts +1 -1
  459. package/out/src/wab-client/WABClient.d.ts.map +1 -1
  460. package/out/src/wab-client/WABClient.js +12 -12
  461. package/out/src/wab-client/WABClient.js.map +1 -1
  462. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +1 -1
  463. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +3 -3
  464. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +1 -1
  465. package/out/tsconfig.mobile.tsbuildinfo +1 -1
  466. package/package.json +7 -6
  467. package/out/src/SetupClient.d.ts +0 -135
  468. package/out/src/SetupClient.d.ts.map +0 -1
  469. package/out/src/SetupClient.js +0 -226
  470. package/out/src/SetupClient.js.map +0 -1
  471. package/out/src/SetupWallet.d.ts +0 -103
  472. package/out/src/SetupWallet.d.ts.map +0 -1
  473. package/out/src/SetupWallet.js +0 -3
  474. package/out/src/SetupWallet.js.map +0 -1
  475. package/out/src/fundWalletP2PKH.d.ts +0 -48
  476. package/out/src/fundWalletP2PKH.d.ts.map +0 -1
  477. package/out/src/fundWalletP2PKH.js +0 -239
  478. package/out/src/fundWalletP2PKH.js.map +0 -1
  479. package/out/src/index.client.d.ts +0 -23
  480. package/out/src/index.client.d.ts.map +0 -1
  481. package/out/src/index.client.js +0 -62
  482. package/out/src/index.client.js.map +0 -1
  483. package/out/src/services/chaintracker/BHServiceClient.d.ts +0 -39
  484. package/out/src/services/chaintracker/BHServiceClient.d.ts.map +0 -1
  485. package/out/src/services/chaintracker/BHServiceClient.js +0 -174
  486. package/out/src/services/chaintracker/BHServiceClient.js.map +0 -1
  487. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.d.ts +0 -5
  488. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.d.ts.map +0 -1
  489. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.js +0 -29
  490. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.js.map +0 -1
  491. package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.d.ts +0 -13
  492. package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.d.ts.map +0 -1
  493. package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.js +0 -27
  494. package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.js.map +0 -1
  495. package/out/src/services/chaintracker/chaintracks/index.client.d.ts +0 -4
  496. package/out/src/services/chaintracker/chaintracks/index.client.d.ts.map +0 -1
  497. package/out/src/services/chaintracker/chaintracks/index.client.js +0 -20
  498. package/out/src/services/chaintracker/chaintracks/index.client.js.map +0 -1
  499. package/out/src/services/chaintracker/index.client.d.ts +0 -4
  500. package/out/src/services/chaintracker/index.client.d.ts.map +0 -1
  501. package/out/src/services/chaintracker/index.client.js +0 -20
  502. package/out/src/services/chaintracker/index.client.js.map +0 -1
  503. package/out/src/storage/StorageIdb.d.ts +0 -218
  504. package/out/src/storage/StorageIdb.d.ts.map +0 -1
  505. package/out/src/storage/StorageIdb.js +0 -2389
  506. package/out/src/storage/StorageIdb.js.map +0 -1
  507. package/out/src/storage/index.client.d.ts +0 -8
  508. package/out/src/storage/index.client.d.ts.map +0 -1
  509. package/out/src/storage/index.client.js +0 -24
  510. package/out/src/storage/index.client.js.map +0 -1
  511. package/out/src/storage/methods/ListActionsSpecOp.d.ts +0 -18
  512. package/out/src/storage/methods/ListActionsSpecOp.d.ts.map +0 -1
  513. package/out/src/storage/methods/ListActionsSpecOp.js +0 -40
  514. package/out/src/storage/methods/ListActionsSpecOp.js.map +0 -1
  515. package/out/src/storage/methods/ListOutputsSpecOp.d.ts +0 -40
  516. package/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +0 -1
  517. package/out/src/storage/methods/ListOutputsSpecOp.js +0 -142
  518. package/out/src/storage/methods/ListOutputsSpecOp.js.map +0 -1
  519. package/out/src/storage/methods/listActionsIdb.d.ts +0 -5
  520. package/out/src/storage/methods/listActionsIdb.d.ts.map +0 -1
  521. package/out/src/storage/methods/listActionsIdb.js +0 -169
  522. package/out/src/storage/methods/listActionsIdb.js.map +0 -1
  523. package/out/src/storage/methods/listOutputsIdb.d.ts +0 -5
  524. package/out/src/storage/methods/listOutputsIdb.d.ts.map +0 -1
  525. package/out/src/storage/methods/listOutputsIdb.js +0 -182
  526. package/out/src/storage/methods/listOutputsIdb.js.map +0 -1
  527. package/out/src/storage/methods/purgeDataIdb.d.ts +0 -4
  528. package/out/src/storage/methods/purgeDataIdb.d.ts.map +0 -1
  529. package/out/src/storage/methods/purgeDataIdb.js +0 -9
  530. package/out/src/storage/methods/purgeDataIdb.js.map +0 -1
  531. package/out/src/storage/methods/reviewStatusIdb.d.ts +0 -20
  532. package/out/src/storage/methods/reviewStatusIdb.d.ts.map +0 -1
  533. package/out/src/storage/methods/reviewStatusIdb.js +0 -35
  534. package/out/src/storage/methods/reviewStatusIdb.js.map +0 -1
  535. package/out/src/storage/schema/StorageIdbSchema.d.ts +0 -133
  536. package/out/src/storage/schema/StorageIdbSchema.d.ts.map +0 -1
  537. package/out/src/storage/schema/StorageIdbSchema.js +0 -3
  538. package/out/src/storage/schema/StorageIdbSchema.js.map +0 -1
@@ -1,2389 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StorageIdb = void 0;
4
- const idb_1 = require("idb");
5
- const utilityHelpers_1 = require("../utility/utilityHelpers");
6
- const StorageProvider_1 = require("./StorageProvider");
7
- const listActionsIdb_1 = require("./methods/listActionsIdb");
8
- const listOutputsIdb_1 = require("./methods/listOutputsIdb");
9
- const reviewStatusIdb_1 = require("./methods/reviewStatusIdb");
10
- const purgeDataIdb_1 = require("./methods/purgeDataIdb");
11
- const WERR_errors_1 = require("../sdk/WERR_errors");
12
- /**
13
- * This class implements the `StorageProvider` interface using IndexedDB,
14
- * via the promises wrapper package `idb`.
15
- */
16
- class StorageIdb extends StorageProvider_1.StorageProvider {
17
- constructor(options) {
18
- super(options);
19
- this.allStores = [
20
- 'certificates',
21
- 'certificate_fields',
22
- 'commissions',
23
- 'monitor_events',
24
- 'outputs',
25
- 'output_baskets',
26
- 'output_tags',
27
- 'output_tags_map',
28
- 'proven_txs',
29
- 'proven_tx_reqs',
30
- 'sync_states',
31
- 'transactions',
32
- 'tx_labels',
33
- 'tx_labels_map',
34
- 'users'
35
- ];
36
- this.dbName = `wallet-toolbox-${this.chain}net`;
37
- }
38
- /**
39
- * This method must be called at least once before any other method accesses the database,
40
- * and each time the schema may have updated.
41
- *
42
- * If the database has already been created in this context, `storageName` and `storageIdentityKey`
43
- * are ignored.
44
- *
45
- * @param storageName
46
- * @param storageIdentityKey
47
- * @returns
48
- */
49
- async migrate(storageName, storageIdentityKey) {
50
- const db = await this.verifyDB(storageName, storageIdentityKey);
51
- return db.version.toString();
52
- }
53
- /**
54
- * Following initial database initialization, this method verfies that db is ready for use.
55
- *
56
- * @throws `WERR_INVALID_OPERATION` if the database has not been initialized by a call to `migrate`.
57
- *
58
- * @param storageName
59
- * @param storageIdentityKey
60
- *
61
- * @returns
62
- */
63
- async verifyDB(storageName, storageIdentityKey) {
64
- if (this.db)
65
- return this.db;
66
- this.db = await this.initDB(storageName, storageIdentityKey);
67
- this._settings = (await this.db.getAll('settings'))[0];
68
- this.whenLastAccess = new Date();
69
- return this.db;
70
- }
71
- /**
72
- * Convert the standard optional `TrxToken` parameter into either a direct knex database instance,
73
- * or a Knex.Transaction as appropriate.
74
- */
75
- toDbTrx(stores, mode, trx) {
76
- if (trx) {
77
- const t = trx;
78
- return t;
79
- }
80
- else {
81
- if (!this.db)
82
- throw new Error('not initialized');
83
- const db = this.db;
84
- const trx = db.transaction(stores || this.allStores, mode || 'readwrite');
85
- this.whenLastAccess = new Date();
86
- return trx;
87
- }
88
- }
89
- /**
90
- * Called by `makeAvailable` to return storage `TableSettings`.
91
- * Since this is the first async method that must be called by all clients,
92
- * it is where async initialization occurs.
93
- *
94
- * After initialization, cached settings are returned.
95
- *
96
- * @param trx
97
- */
98
- async readSettings(trx) {
99
- await this.verifyDB();
100
- return this._settings;
101
- }
102
- async initDB(storageName, storageIdentityKey) {
103
- const chain = this.chain;
104
- const maxOutputScript = 1024;
105
- const db = await (0, idb_1.openDB)(this.dbName, 1, {
106
- upgrade(db, oldVersion, newVersion, transaction) {
107
- if (!db.objectStoreNames.contains('proven_txs')) {
108
- // proven_txs object store
109
- const provenTxsStore = db.createObjectStore('proven_txs', {
110
- keyPath: 'provenTxId',
111
- autoIncrement: true
112
- });
113
- provenTxsStore.createIndex('txid', 'txid', { unique: true });
114
- }
115
- if (!db.objectStoreNames.contains('proven_tx_reqs')) {
116
- // proven_tx_reqs object store
117
- const provenTxReqsStore = db.createObjectStore('proven_tx_reqs', {
118
- keyPath: 'provenTxReqId',
119
- autoIncrement: true
120
- });
121
- provenTxReqsStore.createIndex('provenTxId', 'provenTxId');
122
- provenTxReqsStore.createIndex('txid', 'txid', { unique: true });
123
- provenTxReqsStore.createIndex('status', 'status');
124
- provenTxReqsStore.createIndex('batch', 'batch');
125
- }
126
- if (!db.objectStoreNames.contains('users')) {
127
- const users = db.createObjectStore('users', {
128
- keyPath: 'userId',
129
- autoIncrement: true
130
- });
131
- users.createIndex('identityKey', 'identityKey', { unique: true });
132
- }
133
- if (!db.objectStoreNames.contains('certificates')) {
134
- // certificates object store
135
- const certificatesStore = db.createObjectStore('certificates', {
136
- keyPath: 'certificateId',
137
- autoIncrement: true
138
- });
139
- certificatesStore.createIndex('userId', 'userId');
140
- certificatesStore.createIndex('userId_type_certifier_serialNumber', ['userId', 'type', 'certifier', 'serialNumber'], { unique: true });
141
- }
142
- if (!db.objectStoreNames.contains('certificate_fields')) {
143
- // certificate_fields object store
144
- const certificateFieldsStore = db.createObjectStore('certificate_fields', {
145
- keyPath: ['certificateId', 'fieldName'] // Composite key
146
- });
147
- certificateFieldsStore.createIndex('userId', 'userId');
148
- certificateFieldsStore.createIndex('certificateId', 'certificateId');
149
- }
150
- if (!db.objectStoreNames.contains('output_baskets')) {
151
- // output_baskets object store
152
- const outputBasketsStore = db.createObjectStore('output_baskets', {
153
- keyPath: 'basketId',
154
- autoIncrement: true
155
- });
156
- outputBasketsStore.createIndex('userId', 'userId');
157
- outputBasketsStore.createIndex('name_userId', ['name', 'userId'], { unique: true });
158
- }
159
- if (!db.objectStoreNames.contains('transactions')) {
160
- // transactions object store
161
- const transactionsStore = db.createObjectStore('transactions', {
162
- keyPath: 'transactionId',
163
- autoIncrement: true
164
- });
165
- transactionsStore.createIndex('userId', 'userId');
166
- transactionsStore.createIndex('status', 'status');
167
- transactionsStore.createIndex('status_userId', ['status', 'userId']);
168
- transactionsStore.createIndex('provenTxId', 'provenTxId');
169
- transactionsStore.createIndex('reference', 'reference', { unique: true });
170
- }
171
- if (!db.objectStoreNames.contains('commissions')) {
172
- // commissions object store
173
- const commissionsStore = db.createObjectStore('commissions', {
174
- keyPath: 'commissionId',
175
- autoIncrement: true
176
- });
177
- commissionsStore.createIndex('userId', 'userId');
178
- commissionsStore.createIndex('transactionId', 'transactionId', { unique: true });
179
- }
180
- if (!db.objectStoreNames.contains('outputs')) {
181
- // outputs object store
182
- const outputsStore = db.createObjectStore('outputs', {
183
- keyPath: 'outputId',
184
- autoIncrement: true
185
- });
186
- outputsStore.createIndex('userId', 'userId');
187
- outputsStore.createIndex('transactionId', 'transactionId');
188
- outputsStore.createIndex('basketId', 'basketId');
189
- outputsStore.createIndex('spentBy', 'spentBy');
190
- outputsStore.createIndex('transactionId_vout_userId', ['transactionId', 'vout', 'userId'], { unique: true });
191
- }
192
- if (!db.objectStoreNames.contains('output_tags')) {
193
- // output_tags object store
194
- const outputTagsStore = db.createObjectStore('output_tags', {
195
- keyPath: 'outputTagId',
196
- autoIncrement: true
197
- });
198
- outputTagsStore.createIndex('userId', 'userId');
199
- outputTagsStore.createIndex('tag_userId', ['tag', 'userId'], { unique: true });
200
- }
201
- if (!db.objectStoreNames.contains('output_tags_map')) {
202
- // output_tags_map object store
203
- const outputTagsMapStore = db.createObjectStore('output_tags_map', {
204
- keyPath: ['outputTagId', 'outputId']
205
- });
206
- outputTagsMapStore.createIndex('outputTagId', 'outputTagId');
207
- outputTagsMapStore.createIndex('outputId', 'outputId');
208
- }
209
- if (!db.objectStoreNames.contains('tx_labels')) {
210
- // tx_labels object store
211
- const txLabelsStore = db.createObjectStore('tx_labels', {
212
- keyPath: 'txLabelId',
213
- autoIncrement: true
214
- });
215
- txLabelsStore.createIndex('userId', 'userId');
216
- txLabelsStore.createIndex('label_userId', ['label', 'userId'], { unique: true });
217
- }
218
- if (!db.objectStoreNames.contains('tx_labels_map')) {
219
- // tx_labels_map object store
220
- const txLabelsMapStore = db.createObjectStore('tx_labels_map', {
221
- keyPath: ['txLabelId', 'transactionId']
222
- });
223
- txLabelsMapStore.createIndex('txLabelId', 'txLabelId');
224
- txLabelsMapStore.createIndex('transactionId', 'transactionId');
225
- }
226
- if (!db.objectStoreNames.contains('monitor_events')) {
227
- // monitor_events object store
228
- const monitorEventsStore = db.createObjectStore('monitor_events', {
229
- keyPath: 'id',
230
- autoIncrement: true
231
- });
232
- }
233
- if (!db.objectStoreNames.contains('sync_states')) {
234
- // sync_states object store
235
- const syncStatesStore = db.createObjectStore('sync_states', {
236
- keyPath: 'syncStateId',
237
- autoIncrement: true
238
- });
239
- syncStatesStore.createIndex('userId', 'userId');
240
- syncStatesStore.createIndex('refNum', 'refNum', { unique: true });
241
- syncStatesStore.createIndex('status', 'status');
242
- }
243
- if (!db.objectStoreNames.contains('settings')) {
244
- if (!storageName || !storageIdentityKey) {
245
- throw new WERR_errors_1.WERR_INVALID_OPERATION('migrate must be called before first access');
246
- }
247
- const settings = db.createObjectStore('settings', {
248
- keyPath: 'storageIdentityKey'
249
- });
250
- const s = {
251
- created_at: new Date(),
252
- updated_at: new Date(),
253
- storageIdentityKey,
254
- storageName,
255
- chain,
256
- dbtype: 'IndexedDB',
257
- maxOutputScript
258
- };
259
- settings.put(s);
260
- }
261
- }
262
- });
263
- return db;
264
- }
265
- //
266
- // StorageProvider abstract methods
267
- //
268
- async reviewStatus(args) {
269
- return await (0, reviewStatusIdb_1.reviewStatusIdb)(this, args);
270
- }
271
- async purgeData(params, trx) {
272
- return await (0, purgeDataIdb_1.purgeDataIdb)(this, params, trx);
273
- }
274
- /**
275
- * Proceeds in three stages:
276
- * 1. Find an output that exactly funds the transaction (if exactSatoshis is not undefined).
277
- * 2. Find an output that overfunds by the least amount (targetSatoshis).
278
- * 3. Find an output that comes as close to funding as possible (targetSatoshis).
279
- * 4. Return undefined if no output is found.
280
- *
281
- * Outputs must belong to userId and basketId and have spendable true.
282
- * Their corresponding transaction must have status of 'completed', 'unproven', or 'sending' (if excludeSending is false).
283
- *
284
- * @param userId
285
- * @param basketId
286
- * @param targetSatoshis
287
- * @param exactSatoshis
288
- * @param excludeSending
289
- * @param transactionId
290
- * @returns next funding output to add to transaction or undefined if there are none.
291
- */
292
- async allocateChangeInput(userId, basketId, targetSatoshis, exactSatoshis, excludeSending, transactionId) {
293
- const dbTrx = this.toDbTrx(['outputs', 'transactions', 'proven_txs', 'proven_tx_reqs'], 'readwrite');
294
- try {
295
- const txStatus = ['completed', 'unproven'];
296
- if (!excludeSending)
297
- txStatus.push('sending');
298
- const args = {
299
- partial: { userId, basketId, spendable: true },
300
- txStatus,
301
- // Skip per-output script hydration during the candidate scan — we only need
302
- // the locking script for the one we actually pick below. Matches Knex's
303
- // pattern: SELECT candidates cheaply, hydrate the chosen output explicitly.
304
- noScript: true,
305
- trx: dbTrx
306
- };
307
- const outputs = await this.findOutputs(args);
308
- let output;
309
- let scores = [];
310
- for (const o of outputs) {
311
- if (exactSatoshis && o.satoshis === exactSatoshis) {
312
- output = o;
313
- break;
314
- }
315
- const score = o.satoshis - targetSatoshis;
316
- scores.push({ output: o, score });
317
- }
318
- if (!output) {
319
- // sort scores increasing by score property
320
- scores = scores.sort((a, b) => a.score - b.score);
321
- // find the first score that is greater than or equal to 0
322
- const o = scores.find(s => s.score >= 0);
323
- if (o) {
324
- // stage 2 satisfied (minimally funded)
325
- output = o.output;
326
- }
327
- else if (scores.length > 0) {
328
- // stage 3 satisfied (minimally under-funded)
329
- output = scores.slice(-1)[0].output;
330
- }
331
- else {
332
- // no available funding outputs
333
- output = undefined;
334
- }
335
- }
336
- if (output) {
337
- // mark output as spent by transactionId
338
- await this.updateOutput(output.outputId, { spendable: false, spentBy: transactionId }, dbTrx);
339
- // Hydrate the locking script for the chosen output. Identical to Knex canon at
340
- // StorageKnex.allocateChangeInput: required when the script was offloaded into
341
- // rawTx storage due to exceeding maxOutputScript.
342
- await this.validateOutputScript(output, dbTrx);
343
- }
344
- return output;
345
- }
346
- finally {
347
- await dbTrx.done;
348
- }
349
- }
350
- async getProvenOrRawTx(txid, trx) {
351
- const r = {
352
- proven: undefined,
353
- rawTx: undefined,
354
- inputBEEF: undefined
355
- };
356
- r.proven = (0, utilityHelpers_1.verifyOneOrNone)(await this.findProvenTxs({ partial: { txid: txid }, trx }));
357
- if (!r.proven) {
358
- const req = (0, utilityHelpers_1.verifyOneOrNone)(await this.findProvenTxReqs({ partial: { txid: txid }, trx }));
359
- if (req && ['unsent', 'unmined', 'unconfirmed', 'sending', 'nosend', 'completed'].includes(req.status)) {
360
- r.rawTx = req.rawTx;
361
- r.inputBEEF = req.inputBEEF;
362
- }
363
- }
364
- return r;
365
- }
366
- async getRawTxOfKnownValidTransaction(txid, offset, length, trx) {
367
- if (!txid)
368
- return undefined;
369
- if (!this.isAvailable())
370
- await this.makeAvailable();
371
- let rawTx = undefined;
372
- const sliceRequested = offset !== undefined && length !== undefined && Number.isInteger(offset) && Number.isInteger(length);
373
- // Slice path uses an extended status set that includes 'unfail' — matches Knex
374
- // canon at StorageKnex.ts:131. The non-slice path continues to delegate to
375
- // getProvenOrRawTx which uses the narrower set.
376
- if (sliceRequested) {
377
- const proven = (0, utilityHelpers_1.verifyOneOrNone)(await this.findProvenTxs({ partial: { txid }, trx }));
378
- if (proven) {
379
- rawTx = proven.rawTx;
380
- }
381
- else {
382
- const req = (0, utilityHelpers_1.verifyOneOrNone)(await this.findProvenTxReqs({ partial: { txid }, trx }));
383
- if (req && ['unsent', 'nosend', 'sending', 'unmined', 'completed', 'unfail'].includes(req.status)) {
384
- rawTx = req.rawTx;
385
- }
386
- }
387
- }
388
- else {
389
- const r = await this.getProvenOrRawTx(txid, trx);
390
- if (r.proven)
391
- rawTx = r.proven.rawTx;
392
- else
393
- rawTx = r.rawTx;
394
- }
395
- if (rawTx && sliceRequested) {
396
- rawTx = rawTx.slice(offset, offset + length);
397
- }
398
- return rawTx;
399
- }
400
- async getLabelsForTransactionId(transactionId, trx) {
401
- const maps = await this.findTxLabelMaps({ partial: { transactionId, isDeleted: false }, trx });
402
- const labelIds = maps.map(m => m.txLabelId);
403
- const labels = [];
404
- for (const txLabelId of labelIds) {
405
- // verifyOneOrNone: a map row may reference a label that was later soft-deleted.
406
- // Knex/Bun drop it via JOIN; we must do the same silently or we'd break the whole
407
- // listActions response. Skip + log so persistent orphans still produce a signal.
408
- const label = (0, utilityHelpers_1.verifyOneOrNone)(await this.findTxLabels({ partial: { txLabelId, isDeleted: false }, trx }));
409
- if (label)
410
- labels.push(label);
411
- else
412
- console.debug(`[StorageIdb] orphan tx_labels_map row skipped: transactionId=${transactionId} txLabelId=${txLabelId}`);
413
- }
414
- return labels;
415
- }
416
- async getTagsForOutputId(outputId, trx) {
417
- const maps = await this.findOutputTagMaps({ partial: { outputId, isDeleted: false }, trx });
418
- const tagIds = maps.map(m => m.outputTagId);
419
- const tags = [];
420
- for (const outputTagId of tagIds) {
421
- const tag = (0, utilityHelpers_1.verifyOneOrNone)(await this.findOutputTags({ partial: { outputTagId, isDeleted: false }, trx }));
422
- if (tag)
423
- tags.push(tag);
424
- else
425
- console.debug(`[StorageIdb] orphan output_tags_map row skipped: outputId=${outputId} outputTagId=${outputTagId}`);
426
- }
427
- return tags;
428
- }
429
- async listActions(auth, vargs) {
430
- if (!auth.userId)
431
- throw new WERR_errors_1.WERR_UNAUTHORIZED();
432
- return await (0, listActionsIdb_1.listActionsIdb)(this, auth, vargs);
433
- }
434
- async listOutputs(auth, vargs) {
435
- if (!auth.userId)
436
- throw new WERR_errors_1.WERR_UNAUTHORIZED();
437
- return await (0, listOutputsIdb_1.listOutputsIdb)(this, auth, vargs);
438
- }
439
- async countChangeInputs(userId, basketId, excludeSending) {
440
- const txStatus = ['completed', 'unproven'];
441
- if (!excludeSending)
442
- txStatus.push('sending');
443
- const args = { partial: { userId, basketId }, txStatus };
444
- let count = 0;
445
- await this.filterOutputs(args, r => {
446
- count++;
447
- });
448
- return count;
449
- }
450
- async findCertificatesAuth(auth, args) {
451
- if (!auth.userId || (args.partial.userId && args.partial.userId !== auth.userId))
452
- throw new WERR_errors_1.WERR_UNAUTHORIZED();
453
- args.partial.userId = auth.userId;
454
- return await this.findCertificates(args);
455
- }
456
- async findOutputBasketsAuth(auth, args) {
457
- if (!auth.userId || (args.partial.userId && args.partial.userId !== auth.userId))
458
- throw new WERR_errors_1.WERR_UNAUTHORIZED();
459
- args.partial.userId = auth.userId;
460
- return await this.findOutputBaskets(args);
461
- }
462
- async findOutputsAuth(auth, args) {
463
- if (!auth.userId || (args.partial.userId && args.partial.userId !== auth.userId))
464
- throw new WERR_errors_1.WERR_UNAUTHORIZED();
465
- args.partial.userId = auth.userId;
466
- return await this.findOutputs(args);
467
- }
468
- async insertCertificateAuth(auth, certificate) {
469
- if (!auth.userId || (certificate.userId && certificate.userId !== auth.userId))
470
- throw new WERR_errors_1.WERR_UNAUTHORIZED();
471
- certificate.userId = auth.userId;
472
- return await this.insertCertificate(certificate);
473
- }
474
- //
475
- // StorageReaderWriter abstract methods
476
- //
477
- async dropAllData() {
478
- await (0, idb_1.deleteDB)(this.dbName);
479
- }
480
- /**
481
- * Reject undefined values in a `partial` filter argument. Matches
482
- * Knex behavior (which throws `Undefined binding(s) detected`) so that
483
- * callers can't pass an unmapped idMap lookup through as a silent
484
- * match-anything. Omit the key to skip filtering on it; pass null if
485
- * you need IS NULL semantics (only meaningful for nullable columns).
486
- */
487
- assertNoUndefinedInPartial(partial) {
488
- if (!partial)
489
- return;
490
- for (const k of Object.keys(partial)) {
491
- if (partial[k] === undefined) {
492
- throw new WERR_errors_1.WERR_INVALID_PARAMETER(`args.partial.${k}`, `not undefined. Passing undefined as a filter value is not supported — omit the key to skip filtering. Matches Knex semantics.`);
493
- }
494
- }
495
- }
496
- async filterOutputTagMaps(args, filtered, userId) {
497
- var _a, _b, _c, _d;
498
- this.assertNoUndefinedInPartial(args.partial);
499
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
500
- let skipped = 0;
501
- let count = 0;
502
- const dbTrx = this.toDbTrx(['output_tags_map', 'output_tags'], 'readonly', args.trx);
503
- let cursor;
504
- if (((_b = args.partial) === null || _b === void 0 ? void 0 : _b.outputTagId) !== undefined) {
505
- cursor = await dbTrx.objectStore('output_tags_map').index('outputTagId').openCursor(args.partial.outputTagId);
506
- }
507
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.outputId) !== undefined) {
508
- cursor = await dbTrx.objectStore('output_tags_map').index('outputId').openCursor(args.partial.outputId);
509
- }
510
- else {
511
- cursor = await dbTrx.objectStore('output_tags_map').openCursor();
512
- }
513
- let firstTime = true;
514
- while (cursor) {
515
- if (!firstTime)
516
- cursor = await cursor.continue();
517
- if (!cursor)
518
- break;
519
- firstTime = false;
520
- const r = cursor.value;
521
- if (args.since && args.since > r.updated_at)
522
- continue;
523
- if (args.tagIds && !args.tagIds.includes(r.outputTagId))
524
- continue;
525
- if (args.partial) {
526
- if (args.partial.outputTagId !== undefined && r.outputTagId !== args.partial.outputTagId)
527
- continue;
528
- if (args.partial.outputId !== undefined && r.outputId !== args.partial.outputId)
529
- continue;
530
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
531
- continue;
532
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
533
- continue;
534
- if (args.partial.isDeleted !== undefined && r.isDeleted !== args.partial.isDeleted)
535
- continue;
536
- }
537
- if (userId !== undefined) {
538
- const tagsForUser = await this.countOutputTags({ partial: { userId, outputTagId: r.outputTagId }, trx: dbTrx });
539
- if (tagsForUser === 0)
540
- continue;
541
- }
542
- if (skipped < offset) {
543
- skipped++;
544
- continue;
545
- }
546
- filtered(r);
547
- count++;
548
- if (((_d = args.paged) === null || _d === void 0 ? void 0 : _d.limit) && count >= args.paged.limit)
549
- break;
550
- }
551
- if (!args.trx)
552
- await dbTrx.done;
553
- }
554
- async findOutputTagMaps(args) {
555
- const results = [];
556
- await this.filterOutputTagMaps(args, r => {
557
- results.push(this.validateEntity(r));
558
- });
559
- return results;
560
- }
561
- async filterProvenTxReqs(args, filtered, userId) {
562
- var _a, _b, _c, _d, _e, _f, _g;
563
- this.assertNoUndefinedInPartial(args.partial);
564
- if (args.partial.rawTx)
565
- throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx', `undefined. ProvenTxReqs may not be found by rawTx value.`);
566
- if (args.partial.inputBEEF)
567
- throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.inputBEEF', `undefined. ProvenTxReqs may not be found by inputBEEF value.`);
568
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
569
- let skipped = 0;
570
- let count = 0;
571
- const dbTrx = this.toDbTrx(['proven_tx_reqs', 'transactions'], 'readonly', args.trx);
572
- const direction = args.orderDescending ? 'prev' : 'next';
573
- let cursor;
574
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.provenTxReqId) {
575
- cursor = await dbTrx.objectStore('proven_tx_reqs').openCursor(args.partial.provenTxReqId, direction);
576
- }
577
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.provenTxId) !== undefined) {
578
- cursor = await dbTrx
579
- .objectStore('proven_tx_reqs')
580
- .index('provenTxId')
581
- .openCursor(args.partial.provenTxId, direction);
582
- }
583
- else if (((_d = args.partial) === null || _d === void 0 ? void 0 : _d.txid) !== undefined) {
584
- cursor = await dbTrx.objectStore('proven_tx_reqs').index('txid').openCursor(args.partial.txid, direction);
585
- }
586
- else if (((_e = args.partial) === null || _e === void 0 ? void 0 : _e.status) !== undefined) {
587
- cursor = await dbTrx.objectStore('proven_tx_reqs').index('status').openCursor(args.partial.status, direction);
588
- }
589
- else if (((_f = args.partial) === null || _f === void 0 ? void 0 : _f.batch) !== undefined) {
590
- cursor = await dbTrx.objectStore('proven_tx_reqs').index('batch').openCursor(args.partial.batch, direction);
591
- }
592
- else {
593
- cursor = await dbTrx.objectStore('proven_tx_reqs').openCursor(null, direction);
594
- }
595
- let firstTime = true;
596
- while (cursor) {
597
- if (!firstTime)
598
- cursor = await cursor.continue();
599
- if (!cursor)
600
- break;
601
- firstTime = false;
602
- const r = cursor.value;
603
- if (args.since && args.since > r.updated_at)
604
- continue;
605
- if (args.partial) {
606
- if (args.partial.provenTxReqId !== undefined && r.provenTxReqId !== args.partial.provenTxReqId)
607
- continue;
608
- if (args.partial.provenTxId !== undefined && r.provenTxId !== args.partial.provenTxId)
609
- continue;
610
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
611
- continue;
612
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
613
- continue;
614
- if (args.partial.status !== undefined && r.status !== args.partial.status)
615
- continue;
616
- if (args.partial.attempts !== undefined && r.attempts !== args.partial.attempts)
617
- continue;
618
- if (args.partial.notified !== undefined && r.notified !== args.partial.notified)
619
- continue;
620
- if (args.partial.txid !== undefined && r.txid !== args.partial.txid)
621
- continue;
622
- if (args.partial.batch !== undefined && r.batch !== args.partial.batch)
623
- continue;
624
- if (args.partial.history !== undefined && r.history !== args.partial.history)
625
- continue;
626
- if (args.partial.notify !== undefined && r.notify !== args.partial.notify)
627
- continue;
628
- }
629
- if (args.status && args.status.length > 0 && !args.status.includes(r.status))
630
- continue;
631
- if (args.txids && args.txids.length > 0 && !args.txids.includes(r.txid))
632
- continue;
633
- if (userId !== undefined) {
634
- const txsForUser = await this.countTransactions({ partial: { userId, txid: r.txid }, trx: dbTrx });
635
- if (txsForUser === 0)
636
- continue;
637
- }
638
- if (skipped < offset) {
639
- skipped++;
640
- continue;
641
- }
642
- filtered(r);
643
- count++;
644
- if (((_g = args.paged) === null || _g === void 0 ? void 0 : _g.limit) && count >= args.paged.limit)
645
- break;
646
- }
647
- if (!args.trx)
648
- await dbTrx.done;
649
- }
650
- async findProvenTxReqs(args) {
651
- const results = [];
652
- await this.filterProvenTxReqs(args, r => {
653
- results.push(this.validateEntity(r));
654
- });
655
- return results;
656
- }
657
- async filterProvenTxs(args, filtered, userId) {
658
- var _a, _b, _c, _d;
659
- this.assertNoUndefinedInPartial(args.partial);
660
- if (args.partial.rawTx)
661
- throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx', `undefined. ProvenTxs may not be found by rawTx value.`);
662
- if (args.partial.merklePath)
663
- throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.merklePath', `undefined. ProvenTxs may not be found by merklePath value.`);
664
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
665
- let skipped = 0;
666
- let count = 0;
667
- const dbTrx = this.toDbTrx(['proven_txs', 'transactions'], 'readonly', args.trx);
668
- const direction = args.orderDescending ? 'prev' : 'next';
669
- let cursor;
670
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.provenTxId) {
671
- cursor = await dbTrx.objectStore('proven_txs').openCursor(args.partial.provenTxId, direction);
672
- }
673
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.txid) !== undefined) {
674
- cursor = await dbTrx.objectStore('proven_txs').index('txid').openCursor(args.partial.txid, direction);
675
- }
676
- else {
677
- cursor = await dbTrx.objectStore('proven_txs').openCursor(null, direction);
678
- }
679
- let firstTime = true;
680
- while (cursor) {
681
- if (!firstTime)
682
- cursor = await cursor.continue();
683
- if (!cursor)
684
- break;
685
- firstTime = false;
686
- const r = cursor.value;
687
- if (args.since && args.since > r.updated_at)
688
- continue;
689
- if (args.partial) {
690
- if (args.partial.provenTxId !== undefined && r.provenTxId !== args.partial.provenTxId)
691
- continue;
692
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
693
- continue;
694
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
695
- continue;
696
- if (args.partial.txid !== undefined && r.txid !== args.partial.txid)
697
- continue;
698
- if (args.partial.height !== undefined && r.height !== args.partial.height)
699
- continue;
700
- if (args.partial.index !== undefined && r.index !== args.partial.index)
701
- continue;
702
- if (args.partial.blockHash !== undefined && r.blockHash !== args.partial.blockHash)
703
- continue;
704
- if (args.partial.merkleRoot !== undefined && r.merkleRoot !== args.partial.merkleRoot)
705
- continue;
706
- }
707
- if (userId !== undefined) {
708
- const count = await this.countTransactions({ partial: { userId, provenTxId: r.provenTxId }, trx: dbTrx });
709
- if (count === 0)
710
- continue;
711
- }
712
- if (skipped < offset) {
713
- skipped++;
714
- continue;
715
- }
716
- filtered(r);
717
- count++;
718
- if (((_d = args.paged) === null || _d === void 0 ? void 0 : _d.limit) && count >= args.paged.limit)
719
- break;
720
- }
721
- if (!args.trx)
722
- await dbTrx.done;
723
- }
724
- async findProvenTxs(args) {
725
- const results = [];
726
- await this.filterProvenTxs(args, r => {
727
- results.push(this.validateEntity(r));
728
- });
729
- return results;
730
- }
731
- async filterTxLabelMaps(args, filtered, userId) {
732
- var _a, _b, _c, _d;
733
- this.assertNoUndefinedInPartial(args.partial);
734
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
735
- let skipped = 0;
736
- let count = 0;
737
- const dbTrx = this.toDbTrx(['tx_labels_map', 'tx_labels'], 'readonly', args.trx);
738
- let cursor;
739
- if (((_b = args.partial) === null || _b === void 0 ? void 0 : _b.transactionId) !== undefined) {
740
- cursor = await dbTrx.objectStore('tx_labels_map').index('transactionId').openCursor(args.partial.transactionId);
741
- }
742
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.txLabelId) !== undefined) {
743
- cursor = await dbTrx.objectStore('tx_labels_map').index('txLabelId').openCursor(args.partial.txLabelId);
744
- }
745
- else {
746
- cursor = await dbTrx.objectStore('tx_labels_map').openCursor();
747
- }
748
- let firstTime = true;
749
- while (cursor) {
750
- if (!firstTime)
751
- cursor = await cursor.continue();
752
- if (!cursor)
753
- break;
754
- firstTime = false;
755
- const r = cursor.value;
756
- if (args.since && args.since > r.updated_at)
757
- continue;
758
- if (args.partial) {
759
- if (args.partial.txLabelId !== undefined && r.txLabelId !== args.partial.txLabelId)
760
- continue;
761
- if (args.partial.transactionId !== undefined && r.transactionId !== args.partial.transactionId)
762
- continue;
763
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
764
- continue;
765
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
766
- continue;
767
- if (args.partial.isDeleted !== undefined && r.isDeleted !== args.partial.isDeleted)
768
- continue;
769
- }
770
- if (userId !== undefined) {
771
- const count = await this.countTxLabels({ partial: { userId, txLabelId: r.txLabelId }, trx: dbTrx });
772
- if (count === 0)
773
- continue;
774
- }
775
- if (skipped < offset) {
776
- skipped++;
777
- continue;
778
- }
779
- filtered(r);
780
- count++;
781
- if (((_d = args.paged) === null || _d === void 0 ? void 0 : _d.limit) && count >= args.paged.limit)
782
- break;
783
- }
784
- if (!args.trx)
785
- await dbTrx.done;
786
- }
787
- async findTxLabelMaps(args) {
788
- const results = [];
789
- await this.filterTxLabelMaps(args, r => {
790
- results.push(this.validateEntity(r));
791
- });
792
- return results;
793
- }
794
- async countOutputTagMaps(args) {
795
- let count = 0;
796
- await this.filterOutputTagMaps(args, () => {
797
- count++;
798
- });
799
- return count;
800
- }
801
- async countProvenTxReqs(args) {
802
- let count = 0;
803
- await this.filterProvenTxReqs(args, () => {
804
- count++;
805
- });
806
- return count;
807
- }
808
- async countProvenTxs(args) {
809
- let count = 0;
810
- await this.filterProvenTxs(args, () => {
811
- count++;
812
- });
813
- return count;
814
- }
815
- async countTxLabelMaps(args) {
816
- let count = 0;
817
- await this.filterTxLabelMaps(args, () => {
818
- count++;
819
- });
820
- return count;
821
- }
822
- async insertCertificate(certificate, trx) {
823
- const e = await this.validateEntityForInsert(certificate, trx, undefined, ['isDeleted']);
824
- // Strip non-schema runtime fields before insert. Matches Knex canon.
825
- if (e.logger)
826
- delete e.logger;
827
- const fields = e.fields;
828
- if (e.fields)
829
- delete e.fields;
830
- if (e.certificateId === 0)
831
- delete e.certificateId;
832
- const dbTrx = this.toDbTrx(['certificates', 'certificate_fields'], 'readwrite', trx);
833
- const store = dbTrx.objectStore('certificates');
834
- try {
835
- const id = Number(await store.add(e));
836
- certificate.certificateId = id;
837
- if (fields) {
838
- for (const field of fields) {
839
- field.certificateId = certificate.certificateId;
840
- field.userId = certificate.userId;
841
- await this.insertCertificateField(field, dbTrx);
842
- }
843
- }
844
- }
845
- finally {
846
- if (!trx)
847
- await dbTrx.done;
848
- }
849
- return certificate.certificateId;
850
- }
851
- async insertCertificateField(certificateField, trx) {
852
- const e = await this.validateEntityForInsert(certificateField, trx);
853
- const dbTrx = this.toDbTrx(['certificate_fields'], 'readwrite', trx);
854
- const store = dbTrx.objectStore('certificate_fields');
855
- try {
856
- await store.add(e);
857
- }
858
- finally {
859
- if (!trx)
860
- await dbTrx.done;
861
- }
862
- }
863
- async insertCommission(commission, trx) {
864
- const e = await this.validateEntityForInsert(commission, trx);
865
- if (e.commissionId === 0)
866
- delete e.commissionId;
867
- const dbTrx = this.toDbTrx(['commissions'], 'readwrite', trx);
868
- const store = dbTrx.objectStore('commissions');
869
- try {
870
- const id = Number(await store.add(e));
871
- commission.commissionId = id;
872
- }
873
- finally {
874
- if (!trx)
875
- await dbTrx.done;
876
- }
877
- return commission.commissionId;
878
- }
879
- async insertMonitorEvent(event, trx) {
880
- const e = await this.validateEntityForInsert(event, trx);
881
- if (e.id === 0)
882
- delete e.id;
883
- const dbTrx = this.toDbTrx(['monitor_events'], 'readwrite', trx);
884
- const store = dbTrx.objectStore('monitor_events');
885
- try {
886
- const id = Number(await store.add(e));
887
- event.id = id;
888
- }
889
- finally {
890
- if (!trx)
891
- await dbTrx.done;
892
- }
893
- return event.id;
894
- }
895
- async insertOutput(output, trx) {
896
- const e = await this.validateEntityForInsert(output, trx);
897
- if (e.outputId === 0)
898
- delete e.outputId;
899
- const dbTrx = this.toDbTrx(['outputs'], 'readwrite', trx);
900
- const store = dbTrx.objectStore('outputs');
901
- try {
902
- const id = Number(await store.add(e));
903
- output.outputId = id;
904
- }
905
- finally {
906
- if (!trx)
907
- await dbTrx.done;
908
- }
909
- return output.outputId;
910
- }
911
- async insertOutputBasket(basket, trx) {
912
- const e = await this.validateEntityForInsert(basket, trx, undefined, ['isDeleted']);
913
- if (e.basketId === 0)
914
- delete e.basketId;
915
- const dbTrx = this.toDbTrx(['output_baskets'], 'readwrite', trx);
916
- const store = dbTrx.objectStore('output_baskets');
917
- try {
918
- const id = Number(await store.add(e));
919
- basket.basketId = id;
920
- }
921
- finally {
922
- if (!trx)
923
- await dbTrx.done;
924
- }
925
- return basket.basketId;
926
- }
927
- async insertOutputTag(tag, trx) {
928
- const e = await this.validateEntityForInsert(tag, trx, undefined, ['isDeleted']);
929
- if (e.outputTagId === 0)
930
- delete e.outputTagId;
931
- const dbTrx = this.toDbTrx(['output_tags'], 'readwrite', trx);
932
- const store = dbTrx.objectStore('output_tags');
933
- try {
934
- const id = Number(await store.add(e));
935
- tag.outputTagId = id;
936
- }
937
- finally {
938
- if (!trx)
939
- await dbTrx.done;
940
- }
941
- return tag.outputTagId;
942
- }
943
- async insertOutputTagMap(tagMap, trx) {
944
- const e = await this.validateEntityForInsert(tagMap, trx, undefined, ['isDeleted']);
945
- const dbTrx = this.toDbTrx(['output_tags_map'], 'readwrite', trx);
946
- const store = dbTrx.objectStore('output_tags_map');
947
- try {
948
- await store.add(e);
949
- }
950
- finally {
951
- if (!trx)
952
- await dbTrx.done;
953
- }
954
- }
955
- async insertProvenTx(tx, trx) {
956
- const e = await this.validateEntityForInsert(tx, trx);
957
- if (e.provenTxId === 0)
958
- delete e.provenTxId;
959
- const dbTrx = this.toDbTrx(['proven_txs'], 'readwrite', trx);
960
- const store = dbTrx.objectStore('proven_txs');
961
- try {
962
- const id = Number(await store.add(e));
963
- tx.provenTxId = id;
964
- }
965
- finally {
966
- if (!trx)
967
- await dbTrx.done;
968
- }
969
- return tx.provenTxId;
970
- }
971
- async insertProvenTxReq(tx, trx) {
972
- const e = await this.validateEntityForInsert(tx, trx);
973
- if (e.provenTxReqId === 0)
974
- delete e.provenTxReqId;
975
- const dbTrx = this.toDbTrx(['proven_tx_reqs'], 'readwrite', trx);
976
- const store = dbTrx.objectStore('proven_tx_reqs');
977
- try {
978
- const id = Number(await store.add(e));
979
- tx.provenTxReqId = id;
980
- }
981
- finally {
982
- if (!trx)
983
- await dbTrx.done;
984
- }
985
- return tx.provenTxReqId;
986
- }
987
- async insertSyncState(syncState, trx) {
988
- const e = await this.validateEntityForInsert(syncState, trx, ['when'], ['init']);
989
- if (e.syncStateId === 0)
990
- delete e.syncStateId;
991
- const dbTrx = this.toDbTrx(['sync_states'], 'readwrite', trx);
992
- const store = dbTrx.objectStore('sync_states');
993
- try {
994
- const id = Number(await store.add(e));
995
- syncState.syncStateId = id;
996
- }
997
- finally {
998
- if (!trx)
999
- await dbTrx.done;
1000
- }
1001
- return syncState.syncStateId;
1002
- }
1003
- async insertTransaction(tx, trx) {
1004
- const e = await this.validateEntityForInsert(tx, trx);
1005
- if (e.transactionId === 0)
1006
- delete e.transactionId;
1007
- const dbTrx = this.toDbTrx(['transactions'], 'readwrite', trx);
1008
- const store = dbTrx.objectStore('transactions');
1009
- try {
1010
- const id = Number(await store.add(e));
1011
- tx.transactionId = id;
1012
- }
1013
- finally {
1014
- if (!trx)
1015
- await dbTrx.done;
1016
- }
1017
- return tx.transactionId;
1018
- }
1019
- async insertTxLabel(label, trx) {
1020
- const e = await this.validateEntityForInsert(label, trx, undefined, ['isDeleted']);
1021
- if (e.txLabelId === 0)
1022
- delete e.txLabelId;
1023
- const dbTrx = this.toDbTrx(['tx_labels'], 'readwrite', trx);
1024
- const store = dbTrx.objectStore('tx_labels');
1025
- try {
1026
- const id = Number(await store.add(e));
1027
- label.txLabelId = id;
1028
- }
1029
- finally {
1030
- if (!trx)
1031
- await dbTrx.done;
1032
- }
1033
- return label.txLabelId;
1034
- }
1035
- async insertTxLabelMap(labelMap, trx) {
1036
- const e = await this.validateEntityForInsert(labelMap, trx, undefined, ['isDeleted']);
1037
- const dbTrx = this.toDbTrx(['tx_labels_map'], 'readwrite', trx);
1038
- const store = dbTrx.objectStore('tx_labels_map');
1039
- try {
1040
- await store.add(e);
1041
- }
1042
- finally {
1043
- if (!trx)
1044
- await dbTrx.done;
1045
- }
1046
- }
1047
- async insertUser(user, trx) {
1048
- const e = await this.validateEntityForInsert(user, trx);
1049
- if (e.userId === 0)
1050
- delete e.userId;
1051
- const dbTrx = this.toDbTrx(['users'], 'readwrite', trx);
1052
- const store = dbTrx.objectStore('users');
1053
- try {
1054
- const id = Number(await store.add(e));
1055
- user.userId = id;
1056
- }
1057
- finally {
1058
- if (!trx)
1059
- await dbTrx.done;
1060
- }
1061
- return user.userId;
1062
- }
1063
- async updateIdb(id, update, keyProp, storeName, trx) {
1064
- if (update[keyProp] !== undefined && (Array.isArray(id) || update[keyProp] !== id)) {
1065
- throw new WERR_errors_1.WERR_INVALID_PARAMETER(`update.${keyProp}`, `undefined`);
1066
- }
1067
- const u = this.validatePartialForUpdate(update);
1068
- const dbTrx = this.toDbTrx([storeName], 'readwrite', trx);
1069
- const store = dbTrx.objectStore(storeName);
1070
- const ids = Array.isArray(id) ? id : [id];
1071
- let updated = 0;
1072
- try {
1073
- for (const i of ids) {
1074
- const e = await store.get(i);
1075
- // Match Knex/Bun semantics: missing rows produce a 0-row result, not an error.
1076
- // Caller receives the true updated count and can decide how to react.
1077
- if (!e)
1078
- continue;
1079
- const v = {
1080
- ...e,
1081
- ...u
1082
- };
1083
- const uid = await store.put(v);
1084
- if (uid !== i)
1085
- throw new WERR_errors_1.WERR_INTERNAL(`updated id ${uid} does not match original ${id}`);
1086
- updated++;
1087
- }
1088
- }
1089
- finally {
1090
- if (!trx)
1091
- await dbTrx.done;
1092
- }
1093
- return updated;
1094
- }
1095
- async updateIdbKey(key, update, keyProps, storeName, trx) {
1096
- if (key.length !== keyProps.length)
1097
- throw new WERR_errors_1.WERR_INTERNAL(`key.length ${key.length} !== keyProps.length ${keyProps.length}`);
1098
- for (let i = 0; i < key.length; i++) {
1099
- if (update[keyProps[i]] !== undefined && update[keyProps[i]] !== key[i]) {
1100
- throw new WERR_errors_1.WERR_INVALID_PARAMETER(`update.${keyProps[i]}`, `undefined`);
1101
- }
1102
- }
1103
- const u = this.validatePartialForUpdate(update);
1104
- const dbTrx = this.toDbTrx([storeName], 'readwrite', trx);
1105
- const store = dbTrx.objectStore(storeName);
1106
- try {
1107
- const e = await store.get(key);
1108
- if (!e)
1109
- throw new WERR_errors_1.WERR_INVALID_PARAMETER('key', `an existing record to update ${keyProps.join(',')} ${key.join(',')} not found`);
1110
- const v = {
1111
- ...e,
1112
- ...u
1113
- };
1114
- const uid = await store.put(v);
1115
- for (let i = 0; i < key.length; i++) {
1116
- if (uid[i] !== key[i])
1117
- throw new WERR_errors_1.WERR_INTERNAL(`updated key ${uid[i]} does not match original ${key[i]}`);
1118
- }
1119
- }
1120
- finally {
1121
- if (!trx)
1122
- await dbTrx.done;
1123
- }
1124
- return 1;
1125
- }
1126
- async updateCertificate(id, update, trx) {
1127
- return this.updateIdb(id, update, 'certificateId', 'certificates', trx);
1128
- }
1129
- async updateCertificateField(certificateId, fieldName, update, trx) {
1130
- return this.updateIdbKey([certificateId, fieldName], update, ['certificateId', 'fieldName'], 'certificate_fields', trx);
1131
- }
1132
- async updateCommission(id, update, trx) {
1133
- return this.updateIdb(id, update, 'commissionId', 'commissions', trx);
1134
- }
1135
- async updateMonitorEvent(id, update, trx) {
1136
- return this.updateIdb(id, update, 'id', 'monitor_events', trx);
1137
- }
1138
- async updateOutput(id, update, trx) {
1139
- return this.updateIdb(id, update, 'outputId', 'outputs', trx);
1140
- }
1141
- async updateOutputBasket(id, update, trx) {
1142
- return this.updateIdb(id, update, 'basketId', 'output_baskets', trx);
1143
- }
1144
- async updateOutputTag(id, update, trx) {
1145
- return this.updateIdb(id, update, 'outputTagId', 'output_tags', trx);
1146
- }
1147
- async updateProvenTx(id, update, trx) {
1148
- return this.updateIdb(id, update, 'provenTxId', 'proven_txs', trx);
1149
- }
1150
- async updateProvenTxReq(id, update, trx) {
1151
- return this.updateIdb(id, update, 'provenTxReqId', 'proven_tx_reqs', trx);
1152
- }
1153
- async updateSyncState(id, update, trx) {
1154
- return this.updateIdb(id, update, 'syncStateId', 'sync_states', trx);
1155
- }
1156
- async updateTransaction(id, update, trx) {
1157
- return this.updateIdb(id, update, 'transactionId', 'transactions', trx);
1158
- }
1159
- async updateTxLabel(id, update, trx) {
1160
- return this.updateIdb(id, update, 'txLabelId', 'tx_labels', trx);
1161
- }
1162
- async updateUser(id, update, trx) {
1163
- return this.updateIdb(id, update, 'userId', 'users', trx);
1164
- }
1165
- async updateOutputTagMap(outputId, tagId, update, trx) {
1166
- return this.updateIdbKey([tagId, outputId], update, ['outputTagId', 'outputId'], 'output_tags_map', trx);
1167
- }
1168
- async updateTxLabelMap(transactionId, txLabelId, update, trx) {
1169
- return this.updateIdbKey([txLabelId, transactionId], update, ['txLabelId', 'transactionId'], 'tx_labels_map', trx);
1170
- }
1171
- //
1172
- // StorageReader abstract methods
1173
- //
1174
- async destroy() {
1175
- if (this.db) {
1176
- this.db.close();
1177
- }
1178
- this.db = undefined;
1179
- this._settings = undefined;
1180
- }
1181
- /**
1182
- * @param scope
1183
- * @param trx
1184
- * @returns
1185
- */
1186
- async transaction(scope, trx) {
1187
- if (trx)
1188
- return await scope(trx);
1189
- const stores = this.allStores;
1190
- const db = await this.verifyDB();
1191
- const tx = db.transaction(stores, 'readwrite');
1192
- try {
1193
- const r = await scope(tx);
1194
- await tx.done;
1195
- return r;
1196
- }
1197
- catch (err) {
1198
- tx.abort();
1199
- await tx.done;
1200
- throw err;
1201
- }
1202
- }
1203
- async filterCertificateFields(args, filtered) {
1204
- var _a, _b, _c, _d;
1205
- this.assertNoUndefinedInPartial(args.partial);
1206
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
1207
- let skipped = 0;
1208
- let count = 0;
1209
- const dbTrx = this.toDbTrx(['certificate_fields'], 'readonly', args.trx);
1210
- let cursor;
1211
- if (((_b = args.partial) === null || _b === void 0 ? void 0 : _b.certificateId) !== undefined) {
1212
- cursor = await dbTrx
1213
- .objectStore('certificate_fields')
1214
- .index('certificateId')
1215
- .openCursor(args.partial.certificateId);
1216
- }
1217
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.userId) !== undefined) {
1218
- cursor = await dbTrx.objectStore('certificate_fields').index('userId').openCursor(args.partial.userId);
1219
- }
1220
- else {
1221
- cursor = await dbTrx.objectStore('certificate_fields').openCursor();
1222
- }
1223
- let firstTime = true;
1224
- while (cursor) {
1225
- if (!firstTime)
1226
- cursor = await cursor.continue();
1227
- if (!cursor)
1228
- break;
1229
- firstTime = false;
1230
- const r = cursor.value;
1231
- if (args.since && args.since > r.updated_at)
1232
- continue;
1233
- if (args.partial) {
1234
- if (args.partial.userId !== undefined && r.userId !== args.partial.userId)
1235
- continue;
1236
- if (args.partial.certificateId !== undefined && r.certificateId !== args.partial.certificateId)
1237
- continue;
1238
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
1239
- continue;
1240
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
1241
- continue;
1242
- if (args.partial.fieldName !== undefined && r.fieldName !== args.partial.fieldName)
1243
- continue;
1244
- if (args.partial.fieldValue !== undefined && r.fieldValue !== args.partial.fieldValue)
1245
- continue;
1246
- if (args.partial.masterKey !== undefined && r.masterKey !== args.partial.masterKey)
1247
- continue;
1248
- }
1249
- if (skipped < offset) {
1250
- skipped++;
1251
- continue;
1252
- }
1253
- filtered(r);
1254
- count++;
1255
- if (((_d = args.paged) === null || _d === void 0 ? void 0 : _d.limit) && count >= args.paged.limit)
1256
- break;
1257
- }
1258
- if (!args.trx)
1259
- await dbTrx.done;
1260
- }
1261
- async findCertificateFields(args) {
1262
- const result = [];
1263
- await this.filterCertificateFields(args, r => {
1264
- result.push(this.validateEntity(r));
1265
- });
1266
- return result;
1267
- }
1268
- async filterCertificates(args, filtered) {
1269
- var _a, _b, _c, _d, _e, _f, _g;
1270
- this.assertNoUndefinedInPartial(args.partial);
1271
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
1272
- let skipped = 0;
1273
- let count = 0;
1274
- const dbTrx = this.toDbTrx(['certificates'], 'readonly', args.trx);
1275
- let cursor;
1276
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.certificateId) {
1277
- cursor = await dbTrx.objectStore('certificates').openCursor(args.partial.certificateId);
1278
- }
1279
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.userId) !== undefined) {
1280
- if (((_d = args.partial) === null || _d === void 0 ? void 0 : _d.type) && ((_e = args.partial) === null || _e === void 0 ? void 0 : _e.certifier) && ((_f = args.partial) === null || _f === void 0 ? void 0 : _f.serialNumber)) {
1281
- cursor = await dbTrx
1282
- .objectStore('certificates')
1283
- .index('userId_type_certifier_serialNumber')
1284
- .openCursor([args.partial.userId, args.partial.type, args.partial.certifier, args.partial.serialNumber]);
1285
- }
1286
- else {
1287
- cursor = await dbTrx.objectStore('certificates').index('userId').openCursor(args.partial.userId);
1288
- }
1289
- }
1290
- else {
1291
- cursor = await dbTrx.objectStore('certificates').openCursor();
1292
- }
1293
- let firstTime = true;
1294
- while (cursor) {
1295
- if (!firstTime)
1296
- cursor = await cursor.continue();
1297
- if (!cursor)
1298
- break;
1299
- firstTime = false;
1300
- const r = cursor.value;
1301
- if (args.since && args.since > r.updated_at)
1302
- continue;
1303
- if (args.certifiers && !args.certifiers.includes(r.certifier))
1304
- continue;
1305
- if (args.types && !args.types.includes(r.type))
1306
- continue;
1307
- if (args.partial) {
1308
- if (args.partial.userId !== undefined && r.userId !== args.partial.userId)
1309
- continue;
1310
- if (args.partial.certificateId !== undefined && r.certificateId !== args.partial.certificateId)
1311
- continue;
1312
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
1313
- continue;
1314
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
1315
- continue;
1316
- if (args.partial.type !== undefined && r.type !== args.partial.type)
1317
- continue;
1318
- if (args.partial.serialNumber !== undefined && r.serialNumber !== args.partial.serialNumber)
1319
- continue;
1320
- if (args.partial.certifier !== undefined && r.certifier !== args.partial.certifier)
1321
- continue;
1322
- if (args.partial.subject !== undefined && r.subject !== args.partial.subject)
1323
- continue;
1324
- if (args.partial.verifier !== undefined && r.verifier !== args.partial.verifier)
1325
- continue;
1326
- if (args.partial.revocationOutpoint !== undefined && r.revocationOutpoint !== args.partial.revocationOutpoint)
1327
- continue;
1328
- if (args.partial.signature !== undefined && r.signature !== args.partial.signature)
1329
- continue;
1330
- if (args.partial.isDeleted !== undefined && r.isDeleted !== args.partial.isDeleted)
1331
- continue;
1332
- }
1333
- if (skipped < offset) {
1334
- skipped++;
1335
- continue;
1336
- }
1337
- filtered(r);
1338
- count++;
1339
- if (((_g = args.paged) === null || _g === void 0 ? void 0 : _g.limit) && count >= args.paged.limit)
1340
- break;
1341
- }
1342
- if (!args.trx)
1343
- await dbTrx.done;
1344
- }
1345
- async findCertificates(args) {
1346
- const result = [];
1347
- await this.filterCertificates(args, r => {
1348
- result.push(this.validateEntity(r));
1349
- });
1350
- if (args.includeFields) {
1351
- for (const c of result) {
1352
- const fields = await this.findCertificateFields({ partial: { certificateId: c.certificateId }, trx: args.trx });
1353
- c.fields = fields;
1354
- }
1355
- }
1356
- return result;
1357
- }
1358
- async filterCommissions(args, filtered) {
1359
- var _a, _b, _c, _d, _e;
1360
- this.assertNoUndefinedInPartial(args.partial);
1361
- if (args.partial.lockingScript)
1362
- throw new WERR_errors_1.WERR_INVALID_PARAMETER('partial.lockingScript', `undefined. Commissions may not be found by lockingScript value.`);
1363
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
1364
- let skipped = 0;
1365
- let count = 0;
1366
- const dbTrx = this.toDbTrx(['commissions'], 'readonly', args.trx);
1367
- let cursor;
1368
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.commissionId) {
1369
- cursor = await dbTrx.objectStore('commissions').openCursor(args.partial.commissionId);
1370
- }
1371
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.userId) !== undefined) {
1372
- cursor = await dbTrx.objectStore('commissions').index('userId').openCursor(args.partial.userId);
1373
- }
1374
- else if (((_d = args.partial) === null || _d === void 0 ? void 0 : _d.transactionId) !== undefined) {
1375
- cursor = await dbTrx.objectStore('commissions').index('transactionId').openCursor(args.partial.transactionId);
1376
- }
1377
- else {
1378
- cursor = await dbTrx.objectStore('commissions').openCursor();
1379
- }
1380
- let firstTime = true;
1381
- while (cursor) {
1382
- if (!firstTime)
1383
- cursor = await cursor.continue();
1384
- if (!cursor)
1385
- break;
1386
- firstTime = false;
1387
- const r = cursor.value;
1388
- if (args.since && args.since > r.updated_at)
1389
- continue;
1390
- if (args.partial) {
1391
- if (args.partial.commissionId !== undefined && r.commissionId !== args.partial.commissionId)
1392
- continue;
1393
- if (args.partial.transactionId !== undefined && r.transactionId !== args.partial.transactionId)
1394
- continue;
1395
- if (args.partial.userId !== undefined && r.userId !== args.partial.userId)
1396
- continue;
1397
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
1398
- continue;
1399
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
1400
- continue;
1401
- if (args.partial.satoshis !== undefined && r.satoshis !== args.partial.satoshis)
1402
- continue;
1403
- if (args.partial.keyOffset !== undefined && r.keyOffset !== args.partial.keyOffset)
1404
- continue;
1405
- if (args.partial.isRedeemed !== undefined && r.isRedeemed !== args.partial.isRedeemed)
1406
- continue;
1407
- }
1408
- if (skipped < offset) {
1409
- skipped++;
1410
- continue;
1411
- }
1412
- filtered(r);
1413
- count++;
1414
- if (((_e = args.paged) === null || _e === void 0 ? void 0 : _e.limit) && count >= args.paged.limit)
1415
- break;
1416
- }
1417
- if (!args.trx)
1418
- await dbTrx.done;
1419
- }
1420
- async findCommissions(args) {
1421
- const result = [];
1422
- await this.filterCommissions(args, r => {
1423
- result.push(this.validateEntity(r));
1424
- });
1425
- return result;
1426
- }
1427
- async filterMonitorEvents(args, filtered) {
1428
- var _a, _b, _c;
1429
- this.assertNoUndefinedInPartial(args.partial);
1430
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
1431
- let skipped = 0;
1432
- let count = 0;
1433
- const dbTrx = this.toDbTrx(['monitor_events'], 'readonly', args.trx);
1434
- let cursor;
1435
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.id) {
1436
- cursor = await dbTrx.objectStore('monitor_events').openCursor(args.partial.id);
1437
- }
1438
- else {
1439
- cursor = await dbTrx.objectStore('monitor_events').openCursor();
1440
- }
1441
- let firstTime = true;
1442
- while (cursor) {
1443
- if (!firstTime)
1444
- cursor = await cursor.continue();
1445
- if (!cursor)
1446
- break;
1447
- firstTime = false;
1448
- const r = cursor.value;
1449
- if (args.since && args.since > r.updated_at)
1450
- continue;
1451
- if (args.partial) {
1452
- if (args.partial.id !== undefined && r.id !== args.partial.id)
1453
- continue;
1454
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
1455
- continue;
1456
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
1457
- continue;
1458
- if (args.partial.event !== undefined && r.event !== args.partial.event)
1459
- continue;
1460
- if (args.partial.details !== undefined && r.details !== args.partial.details)
1461
- continue;
1462
- }
1463
- if (skipped < offset) {
1464
- skipped++;
1465
- continue;
1466
- }
1467
- filtered(r);
1468
- count++;
1469
- if (((_c = args.paged) === null || _c === void 0 ? void 0 : _c.limit) && count >= args.paged.limit)
1470
- break;
1471
- }
1472
- if (!args.trx)
1473
- await dbTrx.done;
1474
- }
1475
- async findMonitorEvents(args) {
1476
- const result = [];
1477
- await this.filterMonitorEvents(args, r => {
1478
- result.push(this.validateEntity(r));
1479
- });
1480
- return result;
1481
- }
1482
- async filterOutputBaskets(args, filtered) {
1483
- var _a, _b, _c, _d, _e;
1484
- this.assertNoUndefinedInPartial(args.partial);
1485
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
1486
- let skipped = 0;
1487
- let count = 0;
1488
- const dbTrx = this.toDbTrx(['output_baskets'], 'readonly', args.trx);
1489
- let cursor;
1490
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.basketId) {
1491
- cursor = await dbTrx.objectStore('output_baskets').openCursor(args.partial.basketId);
1492
- }
1493
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.userId) !== undefined) {
1494
- if (((_d = args.partial) === null || _d === void 0 ? void 0 : _d.name) !== undefined) {
1495
- cursor = await dbTrx
1496
- .objectStore('output_baskets')
1497
- .index('name_userId')
1498
- .openCursor([args.partial.name, args.partial.userId]);
1499
- }
1500
- else {
1501
- cursor = await dbTrx.objectStore('output_baskets').index('userId').openCursor(args.partial.userId);
1502
- }
1503
- }
1504
- else {
1505
- cursor = await dbTrx.objectStore('output_baskets').openCursor();
1506
- }
1507
- let firstTime = true;
1508
- while (cursor) {
1509
- if (!firstTime)
1510
- cursor = await cursor.continue();
1511
- if (!cursor)
1512
- break;
1513
- firstTime = false;
1514
- const r = cursor.value;
1515
- if (args.since && args.since > r.updated_at)
1516
- continue;
1517
- if (args.partial) {
1518
- if (args.partial.basketId !== undefined && r.basketId !== args.partial.basketId)
1519
- continue;
1520
- if (args.partial.userId !== undefined && r.userId !== args.partial.userId)
1521
- continue;
1522
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
1523
- continue;
1524
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
1525
- continue;
1526
- if (args.partial.name !== undefined && r.name !== args.partial.name)
1527
- continue;
1528
- if (args.partial.numberOfDesiredUTXOs !== undefined &&
1529
- r.numberOfDesiredUTXOs !== args.partial.numberOfDesiredUTXOs)
1530
- continue;
1531
- if (args.partial.minimumDesiredUTXOValue !== undefined &&
1532
- r.numberOfDesiredSatoshis !== args.partial.minimumDesiredUTXOValue)
1533
- continue;
1534
- if (args.partial.isDeleted !== undefined && r.isDeleted !== args.partial.isDeleted)
1535
- continue;
1536
- }
1537
- if (skipped < offset) {
1538
- skipped++;
1539
- continue;
1540
- }
1541
- filtered(r);
1542
- count++;
1543
- if (((_e = args.paged) === null || _e === void 0 ? void 0 : _e.limit) && count >= args.paged.limit)
1544
- break;
1545
- }
1546
- if (!args.trx)
1547
- await dbTrx.done;
1548
- }
1549
- async findOutputBaskets(args) {
1550
- const result = [];
1551
- await this.filterOutputBaskets(args, r => {
1552
- result.push(this.validateEntity(r));
1553
- });
1554
- return result;
1555
- }
1556
- async filterOutputs(args, filtered, tagIds, isQueryModeAll) {
1557
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1558
- this.assertNoUndefinedInPartial(args.partial);
1559
- // args.txStatus
1560
- // args.noScript
1561
- if (args.partial.lockingScript)
1562
- throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.lockingScript', `undefined. Outputs may not be found by lockingScript value.`);
1563
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
1564
- let skipped = 0;
1565
- let count = 0;
1566
- const stores = ['outputs'];
1567
- if (tagIds && tagIds.length > 0) {
1568
- stores.push('output_tags_map');
1569
- }
1570
- if (args.txStatus) {
1571
- stores.push('transactions');
1572
- }
1573
- const dbTrx = this.toDbTrx(stores, 'readonly', args.trx);
1574
- const direction = args.orderDescending ? 'prev' : 'next';
1575
- let cursor;
1576
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.outputId) {
1577
- cursor = await dbTrx.objectStore('outputs').openCursor(args.partial.outputId, direction);
1578
- }
1579
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.userId) !== undefined) {
1580
- if (((_d = args.partial) === null || _d === void 0 ? void 0 : _d.transactionId) && ((_e = args.partial) === null || _e === void 0 ? void 0 : _e.vout) !== undefined) {
1581
- cursor = await dbTrx
1582
- .objectStore('outputs')
1583
- .index('transactionId_vout_userId')
1584
- .openCursor([args.partial.transactionId, args.partial.vout, args.partial.userId], direction);
1585
- }
1586
- else {
1587
- cursor = await dbTrx.objectStore('outputs').index('userId').openCursor(args.partial.userId, direction);
1588
- }
1589
- }
1590
- else if (((_f = args.partial) === null || _f === void 0 ? void 0 : _f.transactionId) !== undefined) {
1591
- cursor = await dbTrx
1592
- .objectStore('outputs')
1593
- .index('transactionId')
1594
- .openCursor(args.partial.transactionId, direction);
1595
- }
1596
- else if (((_g = args.partial) === null || _g === void 0 ? void 0 : _g.basketId) !== undefined) {
1597
- cursor = await dbTrx.objectStore('outputs').index('basketId').openCursor(args.partial.basketId, direction);
1598
- }
1599
- else if (((_h = args.partial) === null || _h === void 0 ? void 0 : _h.spentBy) !== undefined) {
1600
- cursor = await dbTrx.objectStore('outputs').index('spentBy').openCursor(args.partial.spentBy, direction);
1601
- }
1602
- else {
1603
- cursor = await dbTrx.objectStore('outputs').openCursor(null, direction);
1604
- }
1605
- let firstTime = true;
1606
- while (cursor) {
1607
- if (!firstTime)
1608
- cursor = await cursor.continue();
1609
- if (!cursor)
1610
- break;
1611
- firstTime = false;
1612
- const r = cursor.value;
1613
- if (args.since && args.since > r.updated_at)
1614
- continue;
1615
- if (args.partial) {
1616
- if (args.partial.outputId !== undefined && r.outputId !== args.partial.outputId)
1617
- continue;
1618
- if (args.partial.userId !== undefined && r.userId !== args.partial.userId)
1619
- continue;
1620
- if (args.partial.transactionId !== undefined && r.transactionId !== args.partial.transactionId)
1621
- continue;
1622
- if (args.partial.basketId !== undefined && r.basketId !== args.partial.basketId)
1623
- continue;
1624
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
1625
- continue;
1626
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
1627
- continue;
1628
- if (args.partial.spendable !== undefined && r.spendable !== args.partial.spendable)
1629
- continue;
1630
- if (args.partial.change !== undefined && r.change !== args.partial.change)
1631
- continue;
1632
- if (args.partial.outputDescription !== undefined && r.outputDescription !== args.partial.outputDescription)
1633
- continue;
1634
- if (args.partial.vout !== undefined && r.vout !== args.partial.vout)
1635
- continue;
1636
- if (args.partial.satoshis !== undefined && r.satoshis !== args.partial.satoshis)
1637
- continue;
1638
- if (args.partial.providedBy !== undefined && r.providedBy !== args.partial.providedBy)
1639
- continue;
1640
- if (args.partial.purpose !== undefined && r.purpose !== args.partial.purpose)
1641
- continue;
1642
- if (args.partial.type !== undefined && r.type !== args.partial.type)
1643
- continue;
1644
- if (args.partial.txid !== undefined && r.txid !== args.partial.txid)
1645
- continue;
1646
- if (args.partial.senderIdentityKey !== undefined && r.senderIdentityKey !== args.partial.senderIdentityKey)
1647
- continue;
1648
- if (args.partial.derivationPrefix !== undefined && r.derivationPrefix !== args.partial.derivationPrefix)
1649
- continue;
1650
- if (args.partial.derivationSuffix !== undefined && r.derivationSuffix !== args.partial.derivationSuffix)
1651
- continue;
1652
- if (args.partial.customInstructions !== undefined && r.customInstructions !== args.partial.customInstructions)
1653
- continue;
1654
- if (args.partial.spentBy !== undefined && r.spentBy !== args.partial.spentBy)
1655
- continue;
1656
- if (args.partial.sequenceNumber !== undefined && r.sequenceNumber !== args.partial.sequenceNumber)
1657
- continue;
1658
- if (args.partial.scriptLength !== undefined && r.scriptLength !== args.partial.scriptLength)
1659
- continue;
1660
- if (args.partial.scriptOffset !== undefined && r.scriptOffset !== args.partial.scriptOffset)
1661
- continue;
1662
- }
1663
- if (args.txStatus !== undefined && args.txStatus.length > 0) {
1664
- const count = await this.countTransactions({
1665
- partial: { transactionId: r.transactionId },
1666
- status: args.txStatus,
1667
- trx: dbTrx
1668
- });
1669
- if (count === 0)
1670
- continue;
1671
- }
1672
- if (tagIds && tagIds.length > 0) {
1673
- let ids = [...tagIds];
1674
- await this.filterOutputTagMaps({ partial: { outputId: r.outputId }, trx: dbTrx }, tm => {
1675
- if (ids.length > 0) {
1676
- const i = ids.indexOf(tm.outputTagId);
1677
- if (i >= 0) {
1678
- if (isQueryModeAll) {
1679
- ids.splice(i, 1);
1680
- }
1681
- else {
1682
- ids = [];
1683
- }
1684
- }
1685
- }
1686
- });
1687
- if (ids.length > 0)
1688
- continue;
1689
- }
1690
- if (skipped < offset) {
1691
- skipped++;
1692
- continue;
1693
- }
1694
- if (args.noScript === true) {
1695
- r.script = undefined;
1696
- }
1697
- filtered(r);
1698
- count++;
1699
- if (((_j = args.paged) === null || _j === void 0 ? void 0 : _j.limit) && count >= args.paged.limit)
1700
- break;
1701
- }
1702
- if (!args.trx)
1703
- await dbTrx.done;
1704
- }
1705
- async findOutputs(args, tagIds, isQueryModeAll) {
1706
- const results = [];
1707
- await this.filterOutputs(args, r => {
1708
- results.push(this.validateEntity(r));
1709
- }, tagIds, isQueryModeAll);
1710
- for (const o of results) {
1711
- // noScript skips the rawTx-slice re-hydration but does not wipe script already
1712
- // on the row — parity with Knex/Bun, which simply don't SELECT the column.
1713
- if (!args.noScript)
1714
- await this.validateOutputScript(o, args.trx);
1715
- }
1716
- return results;
1717
- }
1718
- async filterOutputTags(args, filtered) {
1719
- var _a, _b, _c, _d, _e;
1720
- this.assertNoUndefinedInPartial(args.partial);
1721
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
1722
- let skipped = 0;
1723
- let count = 0;
1724
- const dbTrx = this.toDbTrx(['output_tags'], 'readonly', args.trx);
1725
- let cursor;
1726
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.outputTagId) {
1727
- cursor = await dbTrx.objectStore('output_tags').openCursor(args.partial.outputTagId);
1728
- }
1729
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.userId) !== undefined) {
1730
- if (((_d = args.partial) === null || _d === void 0 ? void 0 : _d.tag) !== undefined) {
1731
- cursor = await dbTrx
1732
- .objectStore('output_tags')
1733
- .index('tag_userId')
1734
- .openCursor([args.partial.tag, args.partial.userId]);
1735
- }
1736
- else {
1737
- cursor = await dbTrx.objectStore('output_tags').index('userId').openCursor(args.partial.userId);
1738
- }
1739
- }
1740
- else {
1741
- cursor = await dbTrx.objectStore('output_tags').openCursor();
1742
- }
1743
- let firstTime = true;
1744
- while (cursor) {
1745
- if (!firstTime)
1746
- cursor = await cursor.continue();
1747
- if (!cursor)
1748
- break;
1749
- firstTime = false;
1750
- const r = cursor.value;
1751
- if (args.since && args.since > r.updated_at)
1752
- continue;
1753
- if (args.partial) {
1754
- if (args.partial.outputTagId !== undefined && r.outputTagId !== args.partial.outputTagId)
1755
- continue;
1756
- if (args.partial.userId !== undefined && r.userId !== args.partial.userId)
1757
- continue;
1758
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
1759
- continue;
1760
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
1761
- continue;
1762
- if (args.partial.tag !== undefined && r.tag !== args.partial.tag)
1763
- continue;
1764
- if (args.partial.isDeleted !== undefined && r.isDeleted !== args.partial.isDeleted)
1765
- continue;
1766
- }
1767
- if (skipped < offset) {
1768
- skipped++;
1769
- continue;
1770
- }
1771
- filtered(r);
1772
- count++;
1773
- if (((_e = args.paged) === null || _e === void 0 ? void 0 : _e.limit) && count >= args.paged.limit)
1774
- break;
1775
- }
1776
- if (!args.trx)
1777
- await dbTrx.done;
1778
- }
1779
- async findOutputTags(args) {
1780
- const result = [];
1781
- await this.filterOutputTags(args, r => {
1782
- result.push(this.validateEntity(r));
1783
- });
1784
- return result;
1785
- }
1786
- async filterSyncStates(args, filtered) {
1787
- var _a, _b, _c, _d, _e, _f, _g;
1788
- this.assertNoUndefinedInPartial(args.partial);
1789
- if (args.partial.syncMap)
1790
- throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.syncMap', `undefined. SyncStates may not be found by syncMap value.`);
1791
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
1792
- let skipped = 0;
1793
- let count = 0;
1794
- const dbTrx = this.toDbTrx(['sync_states'], 'readonly', args.trx);
1795
- let cursor;
1796
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.syncStateId) {
1797
- cursor = await dbTrx.objectStore('sync_states').openCursor(args.partial.syncStateId);
1798
- }
1799
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.userId) !== undefined) {
1800
- cursor = await dbTrx.objectStore('sync_states').index('userId').openCursor(args.partial.userId);
1801
- }
1802
- else if (((_d = args.partial) === null || _d === void 0 ? void 0 : _d.refNum) !== undefined) {
1803
- cursor = await dbTrx.objectStore('sync_states').index('refNum').openCursor(args.partial.refNum);
1804
- }
1805
- else if (((_e = args.partial) === null || _e === void 0 ? void 0 : _e.status) !== undefined) {
1806
- cursor = await dbTrx.objectStore('sync_states').index('status').openCursor(args.partial.status);
1807
- }
1808
- else {
1809
- cursor = await dbTrx.objectStore('sync_states').openCursor();
1810
- }
1811
- let firstTime = true;
1812
- while (cursor) {
1813
- if (!firstTime)
1814
- cursor = await cursor.continue();
1815
- if (!cursor)
1816
- break;
1817
- firstTime = false;
1818
- const r = cursor.value;
1819
- if (args.since && args.since > r.updated_at)
1820
- continue;
1821
- if (args.partial) {
1822
- if (args.partial.syncStateId !== undefined && r.syncStateId !== args.partial.syncStateId)
1823
- continue;
1824
- if (args.partial.userId !== undefined && r.userId !== args.partial.userId)
1825
- continue;
1826
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
1827
- continue;
1828
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
1829
- continue;
1830
- if (args.partial.storageIdentityKey !== undefined && r.storageIdentityKey !== args.partial.storageIdentityKey)
1831
- continue;
1832
- if (args.partial.storageName !== undefined && r.storageName !== args.partial.storageName)
1833
- continue;
1834
- if (args.partial.status !== undefined && r.status !== args.partial.status)
1835
- continue;
1836
- if (args.partial.init !== undefined && r.init !== args.partial.init)
1837
- continue;
1838
- if (args.partial.refNum !== undefined && r.refNum !== args.partial.refNum)
1839
- continue;
1840
- if (args.partial.when !== undefined && ((_f = r.when) === null || _f === void 0 ? void 0 : _f.getTime()) !== args.partial.when.getTime())
1841
- continue;
1842
- if (args.partial.satoshis !== undefined && r.satoshis !== args.partial.satoshis)
1843
- continue;
1844
- if (args.partial.errorLocal !== undefined && r.errorLocale !== args.partial.errorLocal)
1845
- continue;
1846
- if (args.partial.errorOther !== undefined && r.errorOther !== args.partial.errorOther)
1847
- continue;
1848
- }
1849
- if (skipped < offset) {
1850
- skipped++;
1851
- continue;
1852
- }
1853
- filtered(r);
1854
- count++;
1855
- if (((_g = args.paged) === null || _g === void 0 ? void 0 : _g.limit) && count >= args.paged.limit)
1856
- break;
1857
- }
1858
- if (!args.trx)
1859
- await dbTrx.done;
1860
- }
1861
- async findSyncStates(args) {
1862
- const result = [];
1863
- await this.filterSyncStates(args, r => {
1864
- result.push(this.validateEntity(r));
1865
- });
1866
- return result;
1867
- }
1868
- async filterTransactions(args, filtered, labelIds, isQueryModeAll) {
1869
- var _a, _b, _c, _d, _e, _f, _g, _h;
1870
- this.assertNoUndefinedInPartial(args.partial);
1871
- if (args.partial.rawTx)
1872
- throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx', `undefined. Transactions may not be found by rawTx value.`);
1873
- if (args.partial.inputBEEF)
1874
- throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.inputBEEF', `undefined. Transactions may not be found by inputBEEF value.`);
1875
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
1876
- let skipped = 0;
1877
- let count = 0;
1878
- const stores = ['transactions'];
1879
- if (labelIds && labelIds.length > 0) {
1880
- stores.push('tx_labels_map');
1881
- }
1882
- const dbTrx = this.toDbTrx(stores, 'readonly', args.trx);
1883
- const direction = args.orderDescending ? 'prev' : 'next';
1884
- let cursor;
1885
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.transactionId) {
1886
- cursor = await dbTrx.objectStore('transactions').openCursor(args.partial.transactionId, direction);
1887
- }
1888
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.userId) !== undefined) {
1889
- if (((_d = args.partial) === null || _d === void 0 ? void 0 : _d.status) !== undefined) {
1890
- cursor = await dbTrx
1891
- .objectStore('transactions')
1892
- .index('status_userId')
1893
- .openCursor([args.partial.status, args.partial.userId], direction);
1894
- }
1895
- else {
1896
- cursor = await dbTrx.objectStore('transactions').index('userId').openCursor(args.partial.userId, direction);
1897
- }
1898
- }
1899
- else if (((_e = args.partial) === null || _e === void 0 ? void 0 : _e.status) !== undefined) {
1900
- cursor = await dbTrx.objectStore('transactions').index('status').openCursor(args.partial.status, direction);
1901
- }
1902
- else if (((_f = args.partial) === null || _f === void 0 ? void 0 : _f.provenTxId) !== undefined) {
1903
- cursor = await dbTrx
1904
- .objectStore('transactions')
1905
- .index('provenTxId')
1906
- .openCursor(args.partial.provenTxId, direction);
1907
- }
1908
- else if (((_g = args.partial) === null || _g === void 0 ? void 0 : _g.reference) !== undefined) {
1909
- cursor = await dbTrx.objectStore('transactions').index('reference').openCursor(args.partial.reference, direction);
1910
- }
1911
- else {
1912
- cursor = await dbTrx.objectStore('transactions').openCursor(null, direction);
1913
- }
1914
- let firstTime = true;
1915
- while (cursor) {
1916
- if (!firstTime)
1917
- cursor = await cursor.continue();
1918
- if (!cursor)
1919
- break;
1920
- firstTime = false;
1921
- const r = cursor.value;
1922
- if (args.since && args.since > r.updated_at)
1923
- continue;
1924
- if (args.from && r.created_at.getTime() < args.from.getTime())
1925
- continue;
1926
- if (args.to && r.created_at.getTime() >= args.to.getTime())
1927
- continue;
1928
- if (args.status && args.status.length > 0 && !args.status.includes(r.status))
1929
- continue;
1930
- if (args.partial) {
1931
- if (args.partial.transactionId !== undefined && r.transactionId !== args.partial.transactionId)
1932
- continue;
1933
- if (args.partial.userId !== undefined && r.userId !== args.partial.userId)
1934
- continue;
1935
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
1936
- continue;
1937
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
1938
- continue;
1939
- if (args.partial.provenTxId !== undefined && r.provenTxId !== args.partial.provenTxId)
1940
- continue;
1941
- if (args.partial.status !== undefined && r.status !== args.partial.status)
1942
- continue;
1943
- if (args.partial.reference !== undefined && r.reference !== args.partial.reference)
1944
- continue;
1945
- if (args.partial.isOutgoing !== undefined && r.isOutgoing !== args.partial.isOutgoing)
1946
- continue;
1947
- if (args.partial.satoshis !== undefined && r.satoshis !== args.partial.satoshis)
1948
- continue;
1949
- if (args.partial.description !== undefined && r.description !== args.partial.description)
1950
- continue;
1951
- if (args.partial.version !== undefined && r.version !== args.partial.version)
1952
- continue;
1953
- if (args.partial.lockTime !== undefined && r.lockTime !== args.partial.lockTime)
1954
- continue;
1955
- if (args.partial.txid !== undefined && r.txid !== args.partial.txid)
1956
- continue;
1957
- }
1958
- if (labelIds && labelIds.length > 0) {
1959
- let ids = [...labelIds];
1960
- await this.filterTxLabelMaps({ partial: { transactionId: r.transactionId }, trx: dbTrx }, lm => {
1961
- if (ids.length > 0) {
1962
- const i = ids.indexOf(lm.txLabelId);
1963
- if (i >= 0) {
1964
- if (isQueryModeAll) {
1965
- ids.splice(i, 1);
1966
- }
1967
- else {
1968
- ids = [];
1969
- }
1970
- }
1971
- }
1972
- });
1973
- if (ids.length > 0)
1974
- continue;
1975
- }
1976
- if (skipped < offset) {
1977
- skipped++;
1978
- continue;
1979
- }
1980
- filtered(r);
1981
- count++;
1982
- if (((_h = args.paged) === null || _h === void 0 ? void 0 : _h.limit) && count >= args.paged.limit)
1983
- break;
1984
- }
1985
- if (!args.trx)
1986
- await dbTrx.done;
1987
- }
1988
- async findTransactions(args, labelIds, isQueryModeAll) {
1989
- const results = [];
1990
- await this.filterTransactions(args, r => {
1991
- results.push(this.validateEntity(r));
1992
- }, labelIds, isQueryModeAll);
1993
- for (const t of results) {
1994
- // noRawTx skips rawTx re-hydration but does not wipe inputBEEF — Knex's
1995
- // transactionColumnsWithoutRawTx only strips rawTx, and callers such as
1996
- // getReqsAndBeefToShareWithWorld legitimately need inputBEEF when noRawTx is set.
1997
- if (!args.noRawTx)
1998
- await this.validateRawTransaction(t, args.trx);
1999
- else
2000
- t.rawTx = undefined;
2001
- }
2002
- return results;
2003
- }
2004
- async filterTxLabels(args, filtered) {
2005
- var _a, _b, _c, _d, _e;
2006
- this.assertNoUndefinedInPartial(args.partial);
2007
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
2008
- let skipped = 0;
2009
- let count = 0;
2010
- const dbTrx = this.toDbTrx(['tx_labels'], 'readonly', args.trx);
2011
- let cursor;
2012
- if ((_b = args.partial) === null || _b === void 0 ? void 0 : _b.txLabelId) {
2013
- cursor = await dbTrx.objectStore('tx_labels').openCursor(args.partial.txLabelId);
2014
- }
2015
- else if (((_c = args.partial) === null || _c === void 0 ? void 0 : _c.userId) !== undefined) {
2016
- if (((_d = args.partial) === null || _d === void 0 ? void 0 : _d.label) !== undefined) {
2017
- cursor = await dbTrx
2018
- .objectStore('tx_labels')
2019
- .index('label_userId')
2020
- .openCursor([args.partial.label, args.partial.userId]);
2021
- }
2022
- else {
2023
- cursor = await dbTrx.objectStore('tx_labels').index('userId').openCursor(args.partial.userId);
2024
- }
2025
- }
2026
- else {
2027
- cursor = await dbTrx.objectStore('tx_labels').openCursor();
2028
- }
2029
- let firstTime = true;
2030
- while (cursor) {
2031
- if (!firstTime)
2032
- cursor = await cursor.continue();
2033
- if (!cursor)
2034
- break;
2035
- firstTime = false;
2036
- const r = cursor.value;
2037
- if (args.since && args.since > r.updated_at)
2038
- continue;
2039
- if (args.partial) {
2040
- if (args.partial.txLabelId !== undefined && r.txLabelId !== args.partial.txLabelId)
2041
- continue;
2042
- if (args.partial.userId !== undefined && r.userId !== args.partial.userId)
2043
- continue;
2044
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
2045
- continue;
2046
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
2047
- continue;
2048
- if (args.partial.label !== undefined && r.label !== args.partial.label)
2049
- continue;
2050
- if (args.partial.isDeleted !== undefined && r.isDeleted !== args.partial.isDeleted)
2051
- continue;
2052
- }
2053
- if (skipped < offset) {
2054
- skipped++;
2055
- continue;
2056
- }
2057
- filtered(r);
2058
- count++;
2059
- if (((_e = args.paged) === null || _e === void 0 ? void 0 : _e.limit) && count >= args.paged.limit)
2060
- break;
2061
- }
2062
- if (!args.trx)
2063
- await dbTrx.done;
2064
- }
2065
- async findTxLabels(args) {
2066
- const result = [];
2067
- await this.filterTxLabels(args, r => {
2068
- result.push(this.validateEntity(r));
2069
- });
2070
- return result;
2071
- }
2072
- async filterUsers(args, filtered) {
2073
- var _a, _b;
2074
- this.assertNoUndefinedInPartial(args.partial);
2075
- const offset = ((_a = args.paged) === null || _a === void 0 ? void 0 : _a.offset) || 0;
2076
- let skipped = 0;
2077
- let count = 0;
2078
- const dbTrx = this.toDbTrx(['users'], 'readonly', args.trx);
2079
- let cursor = await dbTrx.objectStore('users').openCursor();
2080
- let firstTime = true;
2081
- while (cursor) {
2082
- if (!firstTime)
2083
- cursor = await cursor.continue();
2084
- if (!cursor)
2085
- break;
2086
- firstTime = false;
2087
- const r = cursor.value;
2088
- if (args.since && args.since > r.updated_at)
2089
- continue;
2090
- if (args.partial) {
2091
- if (args.partial.userId !== undefined && r.userId !== args.partial.userId)
2092
- continue;
2093
- if (args.partial.created_at !== undefined && r.created_at.getTime() !== args.partial.created_at.getTime())
2094
- continue;
2095
- if (args.partial.updated_at !== undefined && r.updated_at.getTime() !== args.partial.updated_at.getTime())
2096
- continue;
2097
- if (args.partial.identityKey !== undefined && r.identityKey !== args.partial.identityKey)
2098
- continue;
2099
- if (args.partial.activeStorage !== undefined && r.activeStorage !== args.partial.activeStorage)
2100
- continue;
2101
- }
2102
- if (skipped < offset) {
2103
- skipped++;
2104
- continue;
2105
- }
2106
- filtered(r);
2107
- count++;
2108
- if (((_b = args.paged) === null || _b === void 0 ? void 0 : _b.limit) && count >= args.paged.limit)
2109
- break;
2110
- }
2111
- if (!args.trx)
2112
- await dbTrx.done;
2113
- }
2114
- async findUsers(args) {
2115
- const result = [];
2116
- await this.filterUsers(args, r => {
2117
- result.push(this.validateEntity(r));
2118
- });
2119
- return result;
2120
- }
2121
- async countCertificateFields(args) {
2122
- let count = 0;
2123
- await this.filterCertificateFields(args, () => {
2124
- count++;
2125
- });
2126
- return count;
2127
- }
2128
- async countCertificates(args) {
2129
- let count = 0;
2130
- await this.filterCertificates(args, () => {
2131
- count++;
2132
- });
2133
- return count;
2134
- }
2135
- async countCommissions(args) {
2136
- let count = 0;
2137
- await this.filterCommissions(args, () => {
2138
- count++;
2139
- });
2140
- return count;
2141
- }
2142
- async countMonitorEvents(args) {
2143
- let count = 0;
2144
- await this.filterMonitorEvents(args, () => {
2145
- count++;
2146
- });
2147
- return count;
2148
- }
2149
- async countOutputBaskets(args) {
2150
- let count = 0;
2151
- await this.filterOutputBaskets(args, () => {
2152
- count++;
2153
- });
2154
- return count;
2155
- }
2156
- async countOutputs(args, tagIds, isQueryModeAll) {
2157
- let count = 0;
2158
- await this.filterOutputs({ ...args, noScript: true }, () => {
2159
- count++;
2160
- }, tagIds, isQueryModeAll);
2161
- return count;
2162
- }
2163
- async countOutputTags(args) {
2164
- let count = 0;
2165
- await this.filterOutputTags(args, () => {
2166
- count++;
2167
- });
2168
- return count;
2169
- }
2170
- async countSyncStates(args) {
2171
- let count = 0;
2172
- await this.filterSyncStates(args, () => {
2173
- count++;
2174
- });
2175
- return count;
2176
- }
2177
- async countTransactions(args, labelIds, isQueryModeAll) {
2178
- let count = 0;
2179
- await this.filterTransactions({ ...args, noRawTx: true }, () => {
2180
- count++;
2181
- }, labelIds, isQueryModeAll);
2182
- return count;
2183
- }
2184
- async countTxLabels(args) {
2185
- let count = 0;
2186
- await this.filterTxLabels(args, () => {
2187
- count++;
2188
- });
2189
- return count;
2190
- }
2191
- async countUsers(args) {
2192
- let count = 0;
2193
- await this.filterUsers(args, () => {
2194
- count++;
2195
- });
2196
- return count;
2197
- }
2198
- async getProvenTxsForUser(args) {
2199
- const results = [];
2200
- const fargs = {
2201
- partial: {},
2202
- since: args.since,
2203
- paged: args.paged,
2204
- trx: args.trx
2205
- };
2206
- await this.filterProvenTxs(fargs, r => {
2207
- results.push(this.validateEntity(r));
2208
- }, args.userId);
2209
- return results;
2210
- }
2211
- async getProvenTxReqsForUser(args) {
2212
- const results = [];
2213
- const fargs = {
2214
- partial: {},
2215
- since: args.since,
2216
- paged: args.paged,
2217
- trx: args.trx
2218
- };
2219
- await this.filterProvenTxReqs(fargs, r => {
2220
- results.push(this.validateEntity(r));
2221
- }, args.userId);
2222
- return results;
2223
- }
2224
- async getTxLabelMapsForUser(args) {
2225
- const results = [];
2226
- const fargs = {
2227
- partial: {},
2228
- since: args.since,
2229
- paged: args.paged,
2230
- trx: args.trx
2231
- };
2232
- await this.filterTxLabelMaps(fargs, r => {
2233
- results.push(this.validateEntity(r));
2234
- }, args.userId);
2235
- return results;
2236
- }
2237
- async getOutputTagMapsForUser(args) {
2238
- const results = [];
2239
- const fargs = {
2240
- partial: {},
2241
- since: args.since,
2242
- paged: args.paged,
2243
- trx: args.trx
2244
- };
2245
- await this.filterOutputTagMaps(fargs, r => {
2246
- results.push(this.validateEntity(r));
2247
- }, args.userId);
2248
- return results;
2249
- }
2250
- async verifyReadyForDatabaseAccess(trx) {
2251
- if (!this._settings) {
2252
- this._settings = await this.readSettings();
2253
- }
2254
- return this._settings.dbtype;
2255
- }
2256
- /**
2257
- * Helper to force uniform behavior across database engines.
2258
- * Use to process all individual records with time stamps or number[] retreived from database.
2259
- */
2260
- validateEntity(entity, dateFields, booleanFields) {
2261
- entity.created_at = this.validateDate(entity.created_at);
2262
- entity.updated_at = this.validateDate(entity.updated_at);
2263
- if (dateFields) {
2264
- for (const df of dateFields) {
2265
- if (entity[df])
2266
- entity[df] = this.validateDate(entity[df]);
2267
- }
2268
- }
2269
- if (booleanFields) {
2270
- for (const df of booleanFields) {
2271
- if (entity[df] !== undefined)
2272
- entity[df] = !!entity[df];
2273
- }
2274
- }
2275
- for (const key of Object.keys(entity)) {
2276
- const val = entity[key];
2277
- if (val === null) {
2278
- entity[key] = undefined;
2279
- }
2280
- else if (val instanceof Uint8Array) {
2281
- entity[key] = Array.from(val);
2282
- }
2283
- }
2284
- return entity;
2285
- }
2286
- /**
2287
- * Helper to force uniform behavior across database engines.
2288
- * Use to process all arrays of records with time stamps retreived from database.
2289
- * @returns input `entities` array with contained values validated.
2290
- */
2291
- validateEntities(entities, dateFields, booleanFields) {
2292
- for (let i = 0; i < entities.length; i++) {
2293
- entities[i] = this.validateEntity(entities[i], dateFields, booleanFields);
2294
- }
2295
- return entities;
2296
- }
2297
- /**
2298
- * Helper to force uniform behavior across database engines.
2299
- * Use to process the update template for entities being updated.
2300
- */
2301
- validatePartialForUpdate(update, dateFields, booleanFields) {
2302
- if (!this.dbtype)
2303
- throw new WERR_errors_1.WERR_INTERNAL('must call verifyReadyForDatabaseAccess first');
2304
- const v = { ...update };
2305
- if (v.created_at)
2306
- v.created_at = this.validateEntityDate(v.created_at);
2307
- if (v.updated_at)
2308
- v.updated_at = this.validateEntityDate(v.updated_at);
2309
- if (!v.created_at)
2310
- delete v.created_at;
2311
- if (!v.updated_at)
2312
- v.updated_at = this.validateEntityDate(new Date());
2313
- if (dateFields) {
2314
- for (const df of dateFields) {
2315
- if (v[df])
2316
- v[df] = this.validateOptionalEntityDate(v[df]);
2317
- }
2318
- }
2319
- if (booleanFields) {
2320
- for (const df of booleanFields) {
2321
- if (update[df] !== undefined)
2322
- update[df] = !!update[df] ? 1 : 0;
2323
- }
2324
- }
2325
- for (const key of Object.keys(v)) {
2326
- const val = v[key];
2327
- if (Array.isArray(val) && (val.length === 0 || Number.isInteger(val[0]))) {
2328
- v[key] = Uint8Array.from(val);
2329
- }
2330
- else if (val === null) {
2331
- v[key] = undefined;
2332
- }
2333
- }
2334
- this.isDirty = true;
2335
- return v;
2336
- }
2337
- /**
2338
- * Helper to force uniform behavior across database engines.
2339
- * Use to process new entities being inserted into the database.
2340
- */
2341
- async validateEntityForInsert(entity, trx, dateFields, booleanFields) {
2342
- await this.verifyReadyForDatabaseAccess(trx);
2343
- const v = { ...entity };
2344
- v.created_at = this.validateOptionalEntityDate(v.created_at, true);
2345
- v.updated_at = this.validateOptionalEntityDate(v.updated_at, true);
2346
- if (!v.created_at)
2347
- delete v.created_at;
2348
- if (!v.updated_at)
2349
- delete v.updated_at;
2350
- if (dateFields) {
2351
- for (const df of dateFields) {
2352
- if (v[df])
2353
- v[df] = this.validateOptionalEntityDate(v[df]);
2354
- }
2355
- }
2356
- if (booleanFields) {
2357
- for (const df of booleanFields) {
2358
- if (entity[df] !== undefined)
2359
- entity[df] = !!entity[df] ? 1 : 0;
2360
- }
2361
- }
2362
- for (const key of Object.keys(v)) {
2363
- const val = v[key];
2364
- if (Array.isArray(val) && (val.length === 0 || Number.isInteger(val[0]))) {
2365
- v[key] = Uint8Array.from(val);
2366
- }
2367
- else if (val === null) {
2368
- v[key] = undefined;
2369
- }
2370
- }
2371
- this.isDirty = true;
2372
- return v;
2373
- }
2374
- async validateRawTransaction(t, trx) {
2375
- // if there is no txid or there is a rawTransaction return what we have.
2376
- if (t.rawTx || !t.txid)
2377
- return;
2378
- // rawTransaction is missing, see if we moved it ...
2379
- const rawTx = await this.getRawTxOfKnownValidTransaction(t.txid, undefined, undefined, trx);
2380
- if (!rawTx)
2381
- return;
2382
- t.rawTx = rawTx;
2383
- }
2384
- async adminStats(adminIdentityKey) {
2385
- throw new Error('Method intentionally not implemented for personal storage.');
2386
- }
2387
- }
2388
- exports.StorageIdb = StorageIdb;
2389
- //# sourceMappingURL=StorageIdb.js.map