@bsv/wallet-toolbox-client 2.1.24 → 3.0.0-alpha.0

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 (588) 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/SetupClient.d.ts +6 -6
  6. package/out/src/SetupClient.d.ts.map +1 -1
  7. package/out/src/SetupClient.js +5 -5
  8. package/out/src/SetupClient.js.map +1 -1
  9. package/out/src/SetupWallet.d.ts.map +1 -1
  10. package/out/src/SimpleWalletManager.d.ts +12 -2
  11. package/out/src/SimpleWalletManager.d.ts.map +1 -1
  12. package/out/src/SimpleWalletManager.js +46 -30
  13. package/out/src/SimpleWalletManager.js.map +1 -1
  14. package/out/src/Wallet.d.ts +1 -1
  15. package/out/src/Wallet.d.ts.map +1 -1
  16. package/out/src/Wallet.js +102 -100
  17. package/out/src/Wallet.js.map +1 -1
  18. package/out/src/WalletAuthenticationManager.d.ts +1 -1
  19. package/out/src/WalletAuthenticationManager.d.ts.map +1 -1
  20. package/out/src/WalletAuthenticationManager.js +3 -3
  21. package/out/src/WalletAuthenticationManager.js.map +1 -1
  22. package/out/src/WalletLogger.d.ts.map +1 -1
  23. package/out/src/WalletLogger.js +16 -8
  24. package/out/src/WalletLogger.js.map +1 -1
  25. package/out/src/WalletPermissionsManager.d.ts +89 -18
  26. package/out/src/WalletPermissionsManager.d.ts.map +1 -1
  27. package/out/src/WalletPermissionsManager.js +656 -870
  28. package/out/src/WalletPermissionsManager.js.map +1 -1
  29. package/out/src/WalletSettingsManager.d.ts +2 -2
  30. package/out/src/WalletSettingsManager.d.ts.map +1 -1
  31. package/out/src/WalletSettingsManager.js.map +1 -1
  32. package/out/src/fundWalletP2PKH.d.ts +2 -2
  33. package/out/src/fundWalletP2PKH.d.ts.map +1 -1
  34. package/out/src/fundWalletP2PKH.js +11 -10
  35. package/out/src/fundWalletP2PKH.js.map +1 -1
  36. package/out/src/mockchain/MockChainMigrations.d.ts +3 -3
  37. package/out/src/mockchain/MockChainMigrations.d.ts.map +1 -1
  38. package/out/src/mockchain/MockChainMigrations.js.map +1 -1
  39. package/out/src/mockchain/MockChainStorage.d.ts.map +1 -1
  40. package/out/src/mockchain/MockChainStorage.js +5 -5
  41. package/out/src/mockchain/MockChainStorage.js.map +1 -1
  42. package/out/src/mockchain/MockChainTracker.d.ts.map +1 -1
  43. package/out/src/mockchain/MockChainTracker.js +10 -10
  44. package/out/src/mockchain/MockChainTracker.js.map +1 -1
  45. package/out/src/mockchain/MockMiner.d.ts.map +1 -1
  46. package/out/src/mockchain/MockMiner.js +3 -3
  47. package/out/src/mockchain/MockMiner.js.map +1 -1
  48. package/out/src/mockchain/MockServices.d.ts +9 -0
  49. package/out/src/mockchain/MockServices.d.ts.map +1 -1
  50. package/out/src/mockchain/MockServices.js +195 -238
  51. package/out/src/mockchain/MockServices.js.map +1 -1
  52. package/out/src/mockchain/merkleTree.d.ts.map +1 -1
  53. package/out/src/mockchain/merkleTree.js +21 -12
  54. package/out/src/mockchain/merkleTree.js.map +1 -1
  55. package/out/src/monitor/LeasedMonitorTask.d.ts +43 -0
  56. package/out/src/monitor/LeasedMonitorTask.d.ts.map +1 -0
  57. package/out/src/monitor/LeasedMonitorTask.js +89 -0
  58. package/out/src/monitor/LeasedMonitorTask.js.map +1 -0
  59. package/out/src/monitor/Monitor.d.ts +24 -0
  60. package/out/src/monitor/Monitor.d.ts.map +1 -1
  61. package/out/src/monitor/Monitor.js +63 -75
  62. package/out/src/monitor/Monitor.js.map +1 -1
  63. package/out/src/monitor/V7LeasedTask.d.ts +43 -0
  64. package/out/src/monitor/V7LeasedTask.d.ts.map +1 -0
  65. package/out/src/monitor/V7LeasedTask.js +89 -0
  66. package/out/src/monitor/V7LeasedTask.js.map +1 -0
  67. package/out/src/monitor/tasks/TaskArcSSE.d.ts +2 -2
  68. package/out/src/monitor/tasks/TaskArcSSE.d.ts.map +1 -1
  69. package/out/src/monitor/tasks/TaskArcSSE.js +10 -23
  70. package/out/src/monitor/tasks/TaskArcSSE.js.map +1 -1
  71. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +4 -2
  72. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
  73. package/out/src/monitor/tasks/TaskCheckForProofs.js +83 -16
  74. package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
  75. package/out/src/monitor/tasks/TaskCheckNoSends.d.ts +1 -1
  76. package/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +1 -1
  77. package/out/src/monitor/tasks/TaskCheckNoSends.js +1 -2
  78. package/out/src/monitor/tasks/TaskCheckNoSends.js.map +1 -1
  79. package/out/src/monitor/tasks/TaskClock.d.ts +1 -1
  80. package/out/src/monitor/tasks/TaskClock.d.ts.map +1 -1
  81. package/out/src/monitor/tasks/TaskClock.js +0 -1
  82. package/out/src/monitor/tasks/TaskClock.js.map +1 -1
  83. package/out/src/monitor/tasks/TaskFailAbandoned.d.ts +1 -1
  84. package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -1
  85. package/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -1
  86. package/out/src/monitor/tasks/TaskMineBlock.d.ts +1 -1
  87. package/out/src/monitor/tasks/TaskMineBlock.d.ts.map +1 -1
  88. package/out/src/monitor/tasks/TaskMineBlock.js.map +1 -1
  89. package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts +1 -1
  90. package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts.map +1 -1
  91. package/out/src/monitor/tasks/TaskMonitorCallHistory.js +1 -1
  92. package/out/src/monitor/tasks/TaskMonitorCallHistory.js.map +1 -1
  93. package/out/src/monitor/tasks/TaskNewHeader.d.ts +2 -2
  94. package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -1
  95. package/out/src/monitor/tasks/TaskNewHeader.js +7 -5
  96. package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -1
  97. package/out/src/monitor/tasks/TaskPurge.d.ts +1 -1
  98. package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -1
  99. package/out/src/monitor/tasks/TaskPurge.js.map +1 -1
  100. package/out/src/monitor/tasks/TaskReorg.d.ts +1 -1
  101. package/out/src/monitor/tasks/TaskReorg.d.ts.map +1 -1
  102. package/out/src/monitor/tasks/TaskReorg.js +2 -2
  103. package/out/src/monitor/tasks/TaskReorg.js.map +1 -1
  104. package/out/src/monitor/tasks/TaskReviewDoubleSpends.d.ts +1 -1
  105. package/out/src/monitor/tasks/TaskReviewDoubleSpends.d.ts.map +1 -1
  106. package/out/src/monitor/tasks/TaskReviewDoubleSpends.js +10 -10
  107. package/out/src/monitor/tasks/TaskReviewDoubleSpends.js.map +1 -1
  108. package/out/src/monitor/tasks/TaskReviewProvenTxs.d.ts +1 -1
  109. package/out/src/monitor/tasks/TaskReviewProvenTxs.d.ts.map +1 -1
  110. package/out/src/monitor/tasks/TaskReviewProvenTxs.js +2 -2
  111. package/out/src/monitor/tasks/TaskReviewProvenTxs.js.map +1 -1
  112. package/out/src/monitor/tasks/TaskReviewStatus.d.ts +1 -1
  113. package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -1
  114. package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -1
  115. package/out/src/monitor/tasks/TaskReviewUtxos.d.ts +1 -1
  116. package/out/src/monitor/tasks/TaskReviewUtxos.d.ts.map +1 -1
  117. package/out/src/monitor/tasks/TaskReviewUtxos.js.map +1 -1
  118. package/out/src/monitor/tasks/TaskSendWaiting.d.ts +1 -1
  119. package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
  120. package/out/src/monitor/tasks/TaskSendWaiting.js +4 -5
  121. package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
  122. package/out/src/monitor/tasks/TaskUnFail.d.ts +1 -1
  123. package/out/src/monitor/tasks/TaskUnFail.d.ts.map +1 -1
  124. package/out/src/monitor/tasks/TaskUnFail.js +13 -15
  125. package/out/src/monitor/tasks/TaskUnFail.js.map +1 -1
  126. package/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +1 -1
  127. package/out/src/monitor/tasks/WalletMonitorTask.js +3 -1
  128. package/out/src/monitor/tasks/WalletMonitorTask.js.map +1 -1
  129. package/out/src/sdk/CertOpsWallet.d.ts +3 -3
  130. package/out/src/sdk/CertOpsWallet.d.ts.map +1 -1
  131. package/out/src/sdk/PrivilegedKeyManager.d.ts +3 -3
  132. package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -1
  133. package/out/src/sdk/PrivilegedKeyManager.js +26 -21
  134. package/out/src/sdk/PrivilegedKeyManager.js.map +1 -1
  135. package/out/src/sdk/WERR_errors.d.ts.map +1 -1
  136. package/out/src/sdk/WERR_errors.js +5 -5
  137. package/out/src/sdk/WERR_errors.js.map +1 -1
  138. package/out/src/sdk/WalletError.d.ts +1 -1
  139. package/out/src/sdk/WalletError.d.ts.map +1 -1
  140. package/out/src/sdk/WalletError.js +10 -3
  141. package/out/src/sdk/WalletError.js.map +1 -1
  142. package/out/src/sdk/WalletErrorFromJson.d.ts.map +1 -1
  143. package/out/src/sdk/WalletErrorFromJson.js +1 -3
  144. package/out/src/sdk/WalletErrorFromJson.js.map +1 -1
  145. package/out/src/sdk/WalletServices.interfaces.d.ts +19 -19
  146. package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
  147. package/out/src/sdk/WalletStorage.interfaces.d.ts +59 -59
  148. package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
  149. package/out/src/sdk/types.d.ts +36 -4
  150. package/out/src/sdk/types.d.ts.map +1 -1
  151. package/out/src/sdk/types.js +53 -4
  152. package/out/src/sdk/types.js.map +1 -1
  153. package/out/src/services/ServiceCollection.d.ts +6 -6
  154. package/out/src/services/ServiceCollection.d.ts.map +1 -1
  155. package/out/src/services/ServiceCollection.js +3 -4
  156. package/out/src/services/ServiceCollection.js.map +1 -1
  157. package/out/src/services/Services.d.ts +5 -0
  158. package/out/src/services/Services.d.ts.map +1 -1
  159. package/out/src/services/Services.js +174 -182
  160. package/out/src/services/Services.js.map +1 -1
  161. package/out/src/services/chaintracker/BHServiceClient.d.ts.map +1 -1
  162. package/out/src/services/chaintracker/BHServiceClient.js +7 -7
  163. package/out/src/services/chaintracker/BHServiceClient.js.map +1 -1
  164. package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -1
  165. package/out/src/services/chaintracker/ChaintracksChainTracker.js +5 -5
  166. package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -1
  167. package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts +5 -3
  168. package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts.map +1 -1
  169. package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.js.map +1 -1
  170. package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.d.ts.map +1 -1
  171. package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts +20 -10
  172. package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts.map +1 -1
  173. package/out/src/services/chaintracker/chaintracks/Chaintracks.js +228 -221
  174. package/out/src/services/chaintracker/chaintracks/Chaintracks.js.map +1 -1
  175. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -1
  176. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +9 -10
  177. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -1
  178. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.d.ts.map +1 -1
  179. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js +1 -1
  180. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js.map +1 -1
  181. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts +1 -2
  182. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts.map +1 -1
  183. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js +3 -3
  184. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js.map +1 -1
  185. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.d.ts.map +1 -1
  186. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.js.map +1 -1
  187. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.d.ts.map +1 -1
  188. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js +3 -3
  189. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js.map +1 -1
  190. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.d.ts.map +1 -1
  191. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js +1 -1
  192. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js.map +1 -1
  193. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.d.ts.map +1 -1
  194. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js +2 -2
  195. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js.map +1 -1
  196. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts +2 -2
  197. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts.map +1 -1
  198. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js +6 -39
  199. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js.map +1 -1
  200. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts +3 -3
  201. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts.map +1 -1
  202. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js +8 -6
  203. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js.map +1 -1
  204. package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.d.ts.map +1 -1
  205. package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js +9 -16
  206. package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js.map +1 -1
  207. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.d.ts.map +1 -1
  208. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js +34 -22
  209. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js.map +1 -1
  210. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.d.ts.map +1 -1
  211. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js +31 -30
  212. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js.map +1 -1
  213. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts +2 -2
  214. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts.map +1 -1
  215. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js +11 -10
  216. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js.map +1 -1
  217. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.d.ts.map +1 -1
  218. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.js.map +1 -1
  219. package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.d.ts.map +1 -1
  220. package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.js.map +1 -1
  221. package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.d.ts.map +1 -1
  222. package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.js.map +1 -1
  223. package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.d.ts.map +1 -1
  224. package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.js.map +1 -1
  225. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts +6 -1
  226. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts.map +1 -1
  227. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js +247 -227
  228. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js.map +1 -1
  229. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.d.ts.map +1 -1
  230. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.js +8 -7
  231. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.js.map +1 -1
  232. package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.d.ts.map +1 -1
  233. package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js +35 -25
  234. package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js.map +1 -1
  235. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts +5 -5
  236. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts.map +1 -1
  237. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js +13 -11
  238. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js.map +1 -1
  239. package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts +0 -1
  240. package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts.map +1 -1
  241. package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js.map +1 -1
  242. package/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts.map +1 -1
  243. package/out/src/services/chaintracker/chaintracks/util/HeightRange.js +21 -13
  244. package/out/src/services/chaintracker/chaintracks/util/HeightRange.js.map +1 -1
  245. package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts +2 -2
  246. package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts.map +1 -1
  247. package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.js.map +1 -1
  248. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts +1 -1
  249. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts.map +1 -1
  250. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js +28 -24
  251. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js.map +1 -1
  252. package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.d.ts.map +1 -1
  253. package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.js.map +1 -1
  254. package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts.map +1 -1
  255. package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js +9 -10
  256. package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js.map +1 -1
  257. package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -1
  258. package/out/src/services/createDefaultWalletServicesOptions.js +3 -3
  259. package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -1
  260. package/out/src/services/providers/ARC.d.ts.map +1 -1
  261. package/out/src/services/providers/ARC.js +7 -14
  262. package/out/src/services/providers/ARC.js.map +1 -1
  263. package/out/src/services/providers/ArcSSEClient.d.ts.map +1 -1
  264. package/out/src/services/providers/ArcSSEClient.js +1 -1
  265. package/out/src/services/providers/ArcSSEClient.js.map +1 -1
  266. package/out/src/services/providers/Bitails.d.ts.map +1 -1
  267. package/out/src/services/providers/Bitails.js +17 -17
  268. package/out/src/services/providers/Bitails.js.map +1 -1
  269. package/out/src/services/providers/SdkWhatsOnChain.d.ts.map +1 -1
  270. package/out/src/services/providers/SdkWhatsOnChain.js.map +1 -1
  271. package/out/src/services/providers/WhatsOnChain.d.ts +2 -0
  272. package/out/src/services/providers/WhatsOnChain.d.ts.map +1 -1
  273. package/out/src/services/providers/WhatsOnChain.js +109 -233
  274. package/out/src/services/providers/WhatsOnChain.js.map +1 -1
  275. package/out/src/services/providers/exchangeRates.d.ts.map +1 -1
  276. package/out/src/services/providers/exchangeRates.js +3 -3
  277. package/out/src/services/providers/exchangeRates.js.map +1 -1
  278. package/out/src/services/providers/getBeefForTxid.d.ts +1 -1
  279. package/out/src/services/providers/getBeefForTxid.d.ts.map +1 -1
  280. package/out/src/services/providers/getBeefForTxid.js.map +1 -1
  281. package/out/src/services/providers/whatsOnChainHelpers.d.ts +68 -0
  282. package/out/src/services/providers/whatsOnChainHelpers.d.ts.map +1 -0
  283. package/out/src/services/providers/whatsOnChainHelpers.js +147 -0
  284. package/out/src/services/providers/whatsOnChainHelpers.js.map +1 -0
  285. package/out/src/signer/WalletSigner.d.ts.map +1 -1
  286. package/out/src/signer/WalletSigner.js.map +1 -1
  287. package/out/src/signer/methods/acquireDirectCertificate.js +1 -1
  288. package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
  289. package/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
  290. package/out/src/signer/methods/buildSignableTransaction.js +21 -13
  291. package/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
  292. package/out/src/signer/methods/completeSignedTransaction.d.ts.map +1 -1
  293. package/out/src/signer/methods/completeSignedTransaction.js +20 -21
  294. package/out/src/signer/methods/completeSignedTransaction.js.map +1 -1
  295. package/out/src/signer/methods/createAction.d.ts.map +1 -1
  296. package/out/src/signer/methods/createAction.js +8 -7
  297. package/out/src/signer/methods/createAction.js.map +1 -1
  298. package/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
  299. package/out/src/signer/methods/internalizeAction.js +8 -6
  300. package/out/src/signer/methods/internalizeAction.js.map +1 -1
  301. package/out/src/signer/methods/proveCertificate.js +1 -1
  302. package/out/src/signer/methods/signAction.d.ts.map +1 -1
  303. package/out/src/signer/methods/signAction.js +8 -10
  304. package/out/src/signer/methods/signAction.js.map +1 -1
  305. package/out/src/storage/StorageIdb.d.ts +16 -1
  306. package/out/src/storage/StorageIdb.d.ts.map +1 -1
  307. package/out/src/storage/StorageIdb.js +544 -1224
  308. package/out/src/storage/StorageIdb.js.map +1 -1
  309. package/out/src/storage/StorageProvider.d.ts +124 -1
  310. package/out/src/storage/StorageProvider.d.ts.map +1 -1
  311. package/out/src/storage/StorageProvider.js +316 -186
  312. package/out/src/storage/StorageProvider.js.map +1 -1
  313. package/out/src/storage/StorageReader.d.ts.map +1 -1
  314. package/out/src/storage/StorageReader.js +8 -7
  315. package/out/src/storage/StorageReader.js.map +1 -1
  316. package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
  317. package/out/src/storage/StorageReaderWriter.js +32 -32
  318. package/out/src/storage/StorageReaderWriter.js.map +1 -1
  319. package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
  320. package/out/src/storage/StorageSyncReader.js +3 -3
  321. package/out/src/storage/StorageSyncReader.js.map +1 -1
  322. package/out/src/storage/WalletStorageManager.d.ts +3 -0
  323. package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
  324. package/out/src/storage/WalletStorageManager.js +83 -73
  325. package/out/src/storage/WalletStorageManager.js.map +1 -1
  326. package/out/src/storage/idbHelpers.d.ts +47 -0
  327. package/out/src/storage/idbHelpers.d.ts.map +1 -0
  328. package/out/src/storage/idbHelpers.js +417 -0
  329. package/out/src/storage/idbHelpers.js.map +1 -0
  330. package/out/src/storage/methods/ListActionsSpecOp.d.ts +6 -1
  331. package/out/src/storage/methods/ListActionsSpecOp.d.ts.map +1 -1
  332. package/out/src/storage/methods/ListActionsSpecOp.js +28 -2
  333. package/out/src/storage/methods/ListActionsSpecOp.js.map +1 -1
  334. package/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +1 -1
  335. package/out/src/storage/methods/ListOutputsSpecOp.js +8 -11
  336. package/out/src/storage/methods/ListOutputsSpecOp.js.map +1 -1
  337. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +83 -0
  338. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
  339. package/out/src/storage/methods/attemptToPostReqsToNetwork.js +338 -63
  340. package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
  341. package/out/src/storage/methods/createAction.d.ts.map +1 -1
  342. package/out/src/storage/methods/createAction.js +251 -274
  343. package/out/src/storage/methods/createAction.js.map +1 -1
  344. package/out/src/storage/methods/generateChange.d.ts.map +1 -1
  345. package/out/src/storage/methods/generateChange.js +99 -80
  346. package/out/src/storage/methods/generateChange.js.map +1 -1
  347. package/out/src/storage/methods/getBeefForTransaction.js +15 -13
  348. package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
  349. package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
  350. package/out/src/storage/methods/getSyncChunk.js +4 -3
  351. package/out/src/storage/methods/getSyncChunk.js.map +1 -1
  352. package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
  353. package/out/src/storage/methods/internalizeAction.js +213 -56
  354. package/out/src/storage/methods/internalizeAction.js.map +1 -1
  355. package/out/src/storage/methods/listActionsIdb.d.ts.map +1 -1
  356. package/out/src/storage/methods/listActionsIdb.js +85 -110
  357. package/out/src/storage/methods/listActionsIdb.js.map +1 -1
  358. package/out/src/storage/methods/listCertificates.d.ts +1 -1
  359. package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
  360. package/out/src/storage/methods/listCertificates.js +7 -7
  361. package/out/src/storage/methods/listCertificates.js.map +1 -1
  362. package/out/src/storage/methods/listOutputsIdb.d.ts.map +1 -1
  363. package/out/src/storage/methods/listOutputsIdb.js +24 -27
  364. package/out/src/storage/methods/listOutputsIdb.js.map +1 -1
  365. package/out/src/storage/methods/offsetKey.d.ts +1 -1
  366. package/out/src/storage/methods/offsetKey.d.ts.map +1 -1
  367. package/out/src/storage/methods/offsetKey.js +3 -5
  368. package/out/src/storage/methods/offsetKey.js.map +1 -1
  369. package/out/src/storage/methods/processAction.d.ts +0 -11
  370. package/out/src/storage/methods/processAction.d.ts.map +1 -1
  371. package/out/src/storage/methods/processAction.js +168 -93
  372. package/out/src/storage/methods/processAction.js.map +1 -1
  373. package/out/src/storage/methods/purgeDataIdb.d.ts.map +1 -1
  374. package/out/src/storage/methods/purgeDataIdb.js +1 -1
  375. package/out/src/storage/methods/purgeDataIdb.js.map +1 -1
  376. package/out/src/storage/methods/reviewStatusIdb.d.ts +1 -1
  377. package/out/src/storage/methods/reviewStatusIdb.d.ts.map +1 -1
  378. package/out/src/storage/methods/reviewStatusIdb.js.map +1 -1
  379. package/out/src/storage/methods/utils.d.ts.map +1 -1
  380. package/out/src/storage/methods/utils.js +7 -1
  381. package/out/src/storage/methods/utils.js.map +1 -1
  382. package/out/src/storage/remoting/StorageClient.d.ts +4 -270
  383. package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
  384. package/out/src/storage/remoting/StorageClient.js +16 -423
  385. package/out/src/storage/remoting/StorageClient.js.map +1 -1
  386. package/out/src/storage/remoting/StorageClientBase.d.ts +289 -0
  387. package/out/src/storage/remoting/StorageClientBase.d.ts.map +1 -0
  388. package/out/src/storage/remoting/StorageClientBase.js +375 -0
  389. package/out/src/storage/remoting/StorageClientBase.js.map +1 -0
  390. package/out/src/storage/remoting/entityValidationHelpers.d.ts +29 -0
  391. package/out/src/storage/remoting/entityValidationHelpers.d.ts.map +1 -0
  392. package/out/src/storage/remoting/entityValidationHelpers.js +91 -0
  393. package/out/src/storage/remoting/entityValidationHelpers.js.map +1 -0
  394. package/out/src/storage/schema/StorageIdbSchema.d.ts +43 -2
  395. package/out/src/storage/schema/StorageIdbSchema.d.ts.map +1 -1
  396. package/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -1
  397. package/out/src/storage/schema/entities/EntityBase.js.map +1 -1
  398. package/out/src/storage/schema/entities/EntityCertificate.d.ts.map +1 -1
  399. package/out/src/storage/schema/entities/EntityCertificate.js +5 -4
  400. package/out/src/storage/schema/entities/EntityCertificate.js.map +1 -1
  401. package/out/src/storage/schema/entities/EntityCertificateField.d.ts.map +1 -1
  402. package/out/src/storage/schema/entities/EntityCertificateField.js +5 -7
  403. package/out/src/storage/schema/entities/EntityCertificateField.js.map +1 -1
  404. package/out/src/storage/schema/entities/EntityCommission.d.ts.map +1 -1
  405. package/out/src/storage/schema/entities/EntityCommission.js +6 -8
  406. package/out/src/storage/schema/entities/EntityCommission.js.map +1 -1
  407. package/out/src/storage/schema/entities/EntityOutput.d.ts.map +1 -1
  408. package/out/src/storage/schema/entities/EntityOutput.js +21 -24
  409. package/out/src/storage/schema/entities/EntityOutput.js.map +1 -1
  410. package/out/src/storage/schema/entities/EntityOutputBasket.d.ts.map +1 -1
  411. package/out/src/storage/schema/entities/EntityOutputBasket.js +6 -6
  412. package/out/src/storage/schema/entities/EntityOutputBasket.js.map +1 -1
  413. package/out/src/storage/schema/entities/EntityOutputTag.d.ts.map +1 -1
  414. package/out/src/storage/schema/entities/EntityOutputTag.js +2 -2
  415. package/out/src/storage/schema/entities/EntityOutputTag.js.map +1 -1
  416. package/out/src/storage/schema/entities/EntityOutputTagMap.d.ts.map +1 -1
  417. package/out/src/storage/schema/entities/EntityOutputTagMap.js +4 -6
  418. package/out/src/storage/schema/entities/EntityOutputTagMap.js.map +1 -1
  419. package/out/src/storage/schema/entities/EntityProvenTx.d.ts +3 -3
  420. package/out/src/storage/schema/entities/EntityProvenTx.d.ts.map +1 -1
  421. package/out/src/storage/schema/entities/EntityProvenTx.js +22 -23
  422. package/out/src/storage/schema/entities/EntityProvenTx.js.map +1 -1
  423. package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts +9 -0
  424. package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts.map +1 -1
  425. package/out/src/storage/schema/entities/EntityProvenTxReq.js +116 -68
  426. package/out/src/storage/schema/entities/EntityProvenTxReq.js.map +1 -1
  427. package/out/src/storage/schema/entities/EntitySyncState.d.ts.map +1 -1
  428. package/out/src/storage/schema/entities/EntitySyncState.js +19 -18
  429. package/out/src/storage/schema/entities/EntitySyncState.js.map +1 -1
  430. package/out/src/storage/schema/entities/EntityTransaction.d.ts.map +1 -1
  431. package/out/src/storage/schema/entities/EntityTransaction.js +25 -26
  432. package/out/src/storage/schema/entities/EntityTransaction.js.map +1 -1
  433. package/out/src/storage/schema/entities/EntityTxLabel.d.ts.map +1 -1
  434. package/out/src/storage/schema/entities/EntityTxLabel.js +2 -2
  435. package/out/src/storage/schema/entities/EntityTxLabel.js.map +1 -1
  436. package/out/src/storage/schema/entities/EntityTxLabelMap.d.ts.map +1 -1
  437. package/out/src/storage/schema/entities/EntityTxLabelMap.js +4 -6
  438. package/out/src/storage/schema/entities/EntityTxLabelMap.js.map +1 -1
  439. package/out/src/storage/schema/entities/EntityUser.d.ts.map +1 -1
  440. package/out/src/storage/schema/entities/EntityUser.js +3 -3
  441. package/out/src/storage/schema/entities/EntityUser.js.map +1 -1
  442. package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
  443. package/out/src/storage/schema/entities/MergeEntity.js +6 -6
  444. package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
  445. package/out/src/storage/schema/monitorLease.d.ts +57 -0
  446. package/out/src/storage/schema/monitorLease.d.ts.map +1 -0
  447. package/out/src/storage/schema/monitorLease.js +101 -0
  448. package/out/src/storage/schema/monitorLease.js.map +1 -0
  449. package/out/src/storage/schema/processingFsm.d.ts +27 -0
  450. package/out/src/storage/schema/processingFsm.d.ts.map +1 -0
  451. package/out/src/storage/schema/processingFsm.js +132 -0
  452. package/out/src/storage/schema/processingFsm.js.map +1 -0
  453. package/out/src/storage/schema/tables/TableAction.d.ts +38 -0
  454. package/out/src/storage/schema/tables/TableAction.d.ts.map +1 -0
  455. package/out/src/storage/schema/tables/TableAction.js +3 -0
  456. package/out/src/storage/schema/tables/TableAction.js.map +1 -0
  457. package/out/src/storage/schema/tables/TableCertificate.d.ts +2 -1
  458. package/out/src/storage/schema/tables/TableCertificate.d.ts.map +1 -1
  459. package/out/src/storage/schema/tables/TableCertificateField.d.ts +1 -1
  460. package/out/src/storage/schema/tables/TableCertificateField.d.ts.map +1 -1
  461. package/out/src/storage/schema/tables/TableChainTip.d.ts +17 -0
  462. package/out/src/storage/schema/tables/TableChainTip.d.ts.map +1 -0
  463. package/out/src/storage/schema/tables/TableChainTip.js +3 -0
  464. package/out/src/storage/schema/tables/TableChainTip.js.map +1 -0
  465. package/out/src/storage/schema/tables/TableCommission.d.ts +1 -1
  466. package/out/src/storage/schema/tables/TableCommission.d.ts.map +1 -1
  467. package/out/src/storage/schema/tables/TableMonitorEvent.d.ts +1 -1
  468. package/out/src/storage/schema/tables/TableMonitorEvent.d.ts.map +1 -1
  469. package/out/src/storage/schema/tables/TableMonitorLease.d.ts +23 -0
  470. package/out/src/storage/schema/tables/TableMonitorLease.d.ts.map +1 -0
  471. package/out/src/storage/schema/tables/TableMonitorLease.js +3 -0
  472. package/out/src/storage/schema/tables/TableMonitorLease.js.map +1 -0
  473. package/out/src/storage/schema/tables/TableOutput.d.ts +10 -2
  474. package/out/src/storage/schema/tables/TableOutput.d.ts.map +1 -1
  475. package/out/src/storage/schema/tables/TableOutput.js +1 -1
  476. package/out/src/storage/schema/tables/TableOutput.js.map +1 -1
  477. package/out/src/storage/schema/tables/TableOutputBasket.d.ts +1 -1
  478. package/out/src/storage/schema/tables/TableOutputBasket.d.ts.map +1 -1
  479. package/out/src/storage/schema/tables/TableOutputTag.d.ts +1 -1
  480. package/out/src/storage/schema/tables/TableOutputTag.d.ts.map +1 -1
  481. package/out/src/storage/schema/tables/TableOutputTagMap.d.ts +1 -1
  482. package/out/src/storage/schema/tables/TableOutputTagMap.d.ts.map +1 -1
  483. package/out/src/storage/schema/tables/TableProvenTx.d.ts +1 -1
  484. package/out/src/storage/schema/tables/TableProvenTx.d.ts.map +1 -1
  485. package/out/src/storage/schema/tables/TableProvenTxReq.d.ts +24 -1
  486. package/out/src/storage/schema/tables/TableProvenTxReq.d.ts.map +1 -1
  487. package/out/src/storage/schema/tables/TableSettings.d.ts +1 -1
  488. package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -1
  489. package/out/src/storage/schema/tables/TableSyncState.d.ts +1 -1
  490. package/out/src/storage/schema/tables/TableSyncState.d.ts.map +1 -1
  491. package/out/src/storage/schema/tables/TableTransaction.d.ts +1 -1
  492. package/out/src/storage/schema/tables/TableTransaction.d.ts.map +1 -1
  493. package/out/src/storage/schema/tables/TableTransactionNew.d.ts +50 -0
  494. package/out/src/storage/schema/tables/TableTransactionNew.d.ts.map +1 -0
  495. package/out/src/storage/schema/tables/TableTransactionNew.js +3 -0
  496. package/out/src/storage/schema/tables/TableTransactionNew.js.map +1 -0
  497. package/out/src/storage/schema/tables/TableTransactionV7.d.ts +50 -0
  498. package/out/src/storage/schema/tables/TableTransactionV7.d.ts.map +1 -0
  499. package/out/src/storage/schema/tables/TableTransactionV7.js +3 -0
  500. package/out/src/storage/schema/tables/TableTransactionV7.js.map +1 -0
  501. package/out/src/storage/schema/tables/TableTxAudit.d.ts +26 -0
  502. package/out/src/storage/schema/tables/TableTxAudit.d.ts.map +1 -0
  503. package/out/src/storage/schema/tables/TableTxAudit.js +3 -0
  504. package/out/src/storage/schema/tables/TableTxAudit.js.map +1 -0
  505. package/out/src/storage/schema/tables/TableTxLabel.d.ts +1 -1
  506. package/out/src/storage/schema/tables/TableTxLabel.d.ts.map +1 -1
  507. package/out/src/storage/schema/tables/TableTxLabelMap.d.ts +1 -1
  508. package/out/src/storage/schema/tables/TableTxLabelMap.d.ts.map +1 -1
  509. package/out/src/storage/schema/tables/TableUser.d.ts +1 -1
  510. package/out/src/storage/schema/tables/TableUser.d.ts.map +1 -1
  511. package/out/src/storage/schema/tables/index.d.ts +5 -0
  512. package/out/src/storage/schema/tables/index.d.ts.map +1 -1
  513. package/out/src/storage/schema/tables/index.js +5 -0
  514. package/out/src/storage/schema/tables/index.js.map +1 -1
  515. package/out/src/storage/schema/transactionCrud.d.ts +41 -0
  516. package/out/src/storage/schema/transactionCrud.d.ts.map +1 -0
  517. package/out/src/storage/schema/transactionCrud.js +205 -0
  518. package/out/src/storage/schema/transactionCrud.js.map +1 -0
  519. package/out/src/storage/schema/transactionService.d.ts +315 -0
  520. package/out/src/storage/schema/transactionService.d.ts.map +1 -0
  521. package/out/src/storage/schema/transactionService.js +783 -0
  522. package/out/src/storage/schema/transactionService.js.map +1 -0
  523. package/out/src/storage/schema/txAudit.d.ts +33 -0
  524. package/out/src/storage/schema/txAudit.d.ts.map +1 -0
  525. package/out/src/storage/schema/txAudit.js +64 -0
  526. package/out/src/storage/schema/txAudit.js.map +1 -0
  527. package/out/src/storage/schema/v7Crud.d.ts +41 -0
  528. package/out/src/storage/schema/v7Crud.d.ts.map +1 -0
  529. package/out/src/storage/schema/v7Crud.js +205 -0
  530. package/out/src/storage/schema/v7Crud.js.map +1 -0
  531. package/out/src/storage/schema/v7Fsm.d.ts +27 -0
  532. package/out/src/storage/schema/v7Fsm.d.ts.map +1 -0
  533. package/out/src/storage/schema/v7Fsm.js +124 -0
  534. package/out/src/storage/schema/v7Fsm.js.map +1 -0
  535. package/out/src/storage/schema/v7MonitorLease.d.ts +57 -0
  536. package/out/src/storage/schema/v7MonitorLease.d.ts.map +1 -0
  537. package/out/src/storage/schema/v7MonitorLease.js +101 -0
  538. package/out/src/storage/schema/v7MonitorLease.js.map +1 -0
  539. package/out/src/storage/schema/v7Service.d.ts +305 -0
  540. package/out/src/storage/schema/v7Service.d.ts.map +1 -0
  541. package/out/src/storage/schema/v7Service.js +757 -0
  542. package/out/src/storage/schema/v7Service.js.map +1 -0
  543. package/out/src/storage/schema/v7TxAudit.d.ts +33 -0
  544. package/out/src/storage/schema/v7TxAudit.d.ts.map +1 -0
  545. package/out/src/storage/schema/v7TxAudit.js +64 -0
  546. package/out/src/storage/schema/v7TxAudit.js.map +1 -0
  547. package/out/src/storage/storageProviderHelpers.d.ts +34 -0
  548. package/out/src/storage/storageProviderHelpers.d.ts.map +1 -0
  549. package/out/src/storage/storageProviderHelpers.js +100 -0
  550. package/out/src/storage/storageProviderHelpers.js.map +1 -0
  551. package/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -1
  552. package/out/src/utility/ScriptTemplateBRC29.js +2 -1
  553. package/out/src/utility/ScriptTemplateBRC29.js.map +1 -1
  554. package/out/src/utility/aggregateResults.d.ts +1 -1
  555. package/out/src/utility/aggregateResults.d.ts.map +1 -1
  556. package/out/src/utility/aggregateResults.js +2 -2
  557. package/out/src/utility/aggregateResults.js.map +1 -1
  558. package/out/src/utility/brc114ActionTimeLabels.d.ts +2 -2
  559. package/out/src/utility/brc114ActionTimeLabels.d.ts.map +1 -1
  560. package/out/src/utility/brc114ActionTimeLabels.js +16 -9
  561. package/out/src/utility/brc114ActionTimeLabels.js.map +1 -1
  562. package/out/src/utility/identityUtils.js +1 -1
  563. package/out/src/utility/identityUtils.js.map +1 -1
  564. package/out/src/utility/parseTxScriptOffsets.d.ts +4 -4
  565. package/out/src/utility/parseTxScriptOffsets.d.ts.map +1 -1
  566. package/out/src/utility/parseTxScriptOffsets.js.map +1 -1
  567. package/out/src/utility/stampLog.d.ts.map +1 -1
  568. package/out/src/utility/stampLog.js +7 -5
  569. package/out/src/utility/stampLog.js.map +1 -1
  570. package/out/src/utility/tscProofToMerklePath.d.ts.map +1 -1
  571. package/out/src/utility/tscProofToMerklePath.js +1 -1
  572. package/out/src/utility/tscProofToMerklePath.js.map +1 -1
  573. package/out/src/utility/utilityHelpers.d.ts +1 -2
  574. package/out/src/utility/utilityHelpers.d.ts.map +1 -1
  575. package/out/src/utility/utilityHelpers.js +10 -10
  576. package/out/src/utility/utilityHelpers.js.map +1 -1
  577. package/out/src/utility/utilityHelpers.noBuffer.d.ts +7 -3
  578. package/out/src/utility/utilityHelpers.noBuffer.d.ts.map +1 -1
  579. package/out/src/utility/utilityHelpers.noBuffer.js +3 -3
  580. package/out/src/utility/utilityHelpers.noBuffer.js.map +1 -1
  581. package/out/src/wab-client/WABClient.d.ts +1 -1
  582. package/out/src/wab-client/WABClient.d.ts.map +1 -1
  583. package/out/src/wab-client/WABClient.js +12 -12
  584. package/out/src/wab-client/WABClient.js.map +1 -1
  585. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +1 -1
  586. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +3 -3
  587. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +1 -1
  588. package/package.json +7 -6
@@ -26,7 +26,7 @@ class Chaintracks {
26
26
  this.log = () => { };
27
27
  // Collection of all long running "threads": main thread (liveHeaders consumer / monitor) and each live header ingestor.
28
28
  this.promises = [];
29
- this.callbacks = { header: [], reorg: [] };
29
+ this.callbacks = { header: {}, reorg: {} };
30
30
  this.baseHeaders = [];
31
31
  this.liveHeaders = [];
32
32
  this.addLiveRecursionLimit = 11;
@@ -38,19 +38,21 @@ class Chaintracks {
38
38
  this.lastPresentHeightMsecs = 0;
39
39
  this.lastPresentHeightMaxAge = 60 * 1000; // 1 minute, in milliseconds
40
40
  this.lock = new SingleWriterMultiReaderLock_1.SingleWriterMultiReaderLock();
41
- if (!options.storage)
41
+ if (options.storage == null)
42
42
  throw new Error('storage is required.');
43
- if (!options.bulkIngestors || options.bulkIngestors.length < 1)
43
+ if (!options.bulkIngestors || options.bulkIngestors.length < 1) {
44
44
  throw new Error('At least one bulk ingestor is required.');
45
- if (!options.liveIngestors || options.liveIngestors.length < 1)
45
+ }
46
+ if (!options.liveIngestors || options.liveIngestors.length < 1) {
46
47
  throw new Error('At least one live ingestor is required.');
48
+ }
47
49
  this.chain = options.chain;
48
50
  this.readonly = options.readonly;
49
51
  this.storage = options.storage;
50
52
  this.bulkIngestors = options.bulkIngestors;
51
53
  this.liveIngestors = options.liveIngestors;
52
54
  this.addLiveRecursionLimit = options.addLiveRecursionLimit;
53
- if (options.logging)
55
+ if (options.logging != null)
54
56
  this.log = options.logging;
55
57
  this.storage.log = this.log;
56
58
  this.log(`New ChaintracksBase Instance Constructed ${options.chain}Net`);
@@ -78,7 +80,7 @@ class Chaintracks {
78
80
  console.error(uerr);
79
81
  }
80
82
  }
81
- const presentHeight = presentHeights.length ? Math.max(...presentHeights) : undefined;
83
+ const presentHeight = (presentHeights.length > 0) ? Math.max(...presentHeights) : undefined;
82
84
  if (!presentHeight)
83
85
  throw new Error('At least one bulk ingestor must implement getPresentHeight.');
84
86
  this.lastPresentHeight = presentHeight;
@@ -101,9 +103,9 @@ class Chaintracks {
101
103
  async unsubscribe(subscriptionId) {
102
104
  let success = true;
103
105
  if (this.callbacks.header[subscriptionId])
104
- delete this.callbacks.header[subscriptionId];
106
+ this.callbacks.header[subscriptionId] = null;
105
107
  else if (this.callbacks.reorg[subscriptionId])
106
- delete this.callbacks.reorg[subscriptionId];
108
+ this.callbacks.reorg[subscriptionId] = null;
107
109
  else
108
110
  success = false;
109
111
  return success;
@@ -148,15 +150,15 @@ class Chaintracks {
148
150
  // Start mai loop to shift out liveHeaders...once sync'd, will set `available` true.
149
151
  this.promises.push(this.mainThreadShiftLiveHeaders());
150
152
  // Wait for the main thread to finish initial sync.
151
- while (!this.available && !this.startupError) {
153
+ while (!this.available && (this.startupError == null)) {
152
154
  await (0, utilityHelpers_1.wait)(100);
153
155
  }
154
- if (this.startupError)
156
+ if (this.startupError != null)
155
157
  throw this.startupError;
156
158
  });
157
159
  }
158
160
  async startPromises() {
159
- if (this.promises.length > 0 || this.stopMainThread !== true)
161
+ if (this.promises.length > 0 || !this.stopMainThread)
160
162
  return;
161
163
  }
162
164
  async destroy() {
@@ -179,40 +181,39 @@ class Chaintracks {
179
181
  });
180
182
  }
181
183
  async listening() {
182
- return this.makeAvailable();
184
+ return await this.makeAvailable();
183
185
  }
184
186
  async isListening() {
185
187
  return this.available;
186
188
  }
187
189
  async isSynchronized() {
188
190
  await this.makeAvailable();
189
- // TODO add synchronized flag... false while bulksyncing...
190
191
  return true;
191
192
  }
192
193
  async findHeaderForHeight(height) {
193
194
  await this.makeAvailable();
194
- return this.lock.withReadLock(async () => this.findHeaderForHeightNoLock(height));
195
+ return await this.lock.withReadLock(async () => await this.findHeaderForHeightNoLock(height));
195
196
  }
196
197
  async findHeaderForHeightNoLock(height) {
197
198
  return await this.storage.findHeaderForHeightOrUndefined(height);
198
199
  }
199
200
  async findHeaderForBlockHash(hash) {
200
201
  await this.makeAvailable();
201
- return this.lock.withReadLock(async () => this.findHeaderForBlockHashNoLock(hash));
202
+ return await this.lock.withReadLock(async () => await this.findHeaderForBlockHashNoLock(hash));
202
203
  }
203
204
  async findHeaderForBlockHashNoLock(hash) {
204
205
  return (await this.storage.findLiveHeaderForBlockHash(hash)) || undefined;
205
206
  }
206
207
  async isValidRootForHeight(root, height) {
207
208
  const r = await this.findHeaderForHeight(height);
208
- if (!r)
209
+ if (r == null)
209
210
  return false;
210
211
  const isValid = root === r.merkleRoot;
211
212
  return isValid;
212
213
  }
213
214
  async getInfo() {
214
215
  await this.makeAvailable();
215
- return this.lock.withReadLock(async () => this.getInfoNoLock());
216
+ return await this.lock.withReadLock(async () => await this.getInfoNoLock());
216
217
  }
217
218
  async getInfoNoLock() {
218
219
  const liveRange = await this.storage.findLiveHeightRange();
@@ -229,15 +230,15 @@ class Chaintracks {
229
230
  }
230
231
  async getHeaders(height, count) {
231
232
  await this.makeAvailable();
232
- return this.lock.withReadLock(async () => (0, utilityHelpers_noBuffer_1.asString)(await this.storage.getHeadersUint8Array(height, count)));
233
+ return await this.lock.withReadLock(async () => (0, utilityHelpers_noBuffer_1.asString)(await this.storage.getHeadersUint8Array(height, count)));
233
234
  }
234
235
  async findChainTipHeader() {
235
236
  await this.makeAvailable();
236
- return this.lock.withReadLock(async () => await this.storage.findChainTipHeader());
237
+ return await this.lock.withReadLock(async () => await this.storage.findChainTipHeader());
237
238
  }
238
239
  async findChainTipHash() {
239
240
  await this.makeAvailable();
240
- return this.lock.withReadLock(async () => await this.storage.findChainTipHash());
241
+ return await this.lock.withReadLock(async () => await this.storage.findChainTipHash());
241
242
  }
242
243
  async findLiveHeaderForBlockHash(hash) {
243
244
  await this.makeAvailable();
@@ -255,7 +256,7 @@ class Chaintracks {
255
256
  let h = await this.findChainTipHeader();
256
257
  while (h.height > 0) {
257
258
  const hp = await this.findHeaderForHeight(h.height - 1);
258
- if (!hp || hp.hash !== h.previousHash)
259
+ if ((hp === null || hp === void 0 ? void 0 : hp.hash) !== h.previousHash)
259
260
  throw new Error(`validation fails at height ${h.height}`);
260
261
  h = hp;
261
262
  if (10000 * Math.floor(h.height / 10000) === h.height)
@@ -281,46 +282,17 @@ class Chaintracks {
281
282
  let after = before;
282
283
  let added = HeightRange_1.HeightRange.empty;
283
284
  const maxSyncRounds = Math.max(1, this.bulkIngestors.length * 2);
284
- let done = false;
285
- for (let round = 1; !done && round <= maxSyncRounds; round++) {
286
- let bulkSyncError;
287
- let roundMadeProgress = false;
288
- let roundHadSuccess = false;
289
- for (const bulk of this.bulkIngestors) {
290
- try {
291
- const beforeBulkMax = before.bulk.maxHeight;
292
- const beforeLiveRange = HeightRange_1.HeightRange.from(newLiveHeaders);
293
- const r = await bulk.synchronize(presentHeight, before, newLiveHeaders);
294
- roundHadSuccess = true;
295
- newLiveHeaders = r.liveHeaders;
296
- after = await this.storage.getAvailableHeightRanges();
297
- added = after.bulk.above(before.bulk);
298
- const afterLiveRange = HeightRange_1.HeightRange.from(newLiveHeaders);
299
- if (after.bulk.maxHeight > beforeBulkMax || afterLiveRange.maxHeight > beforeLiveRange.maxHeight) {
300
- roundMadeProgress = true;
301
- }
302
- before = after;
303
- this.log(`Bulk Ingestor: ${added.length} added with ${newLiveHeaders.length} live headers from ${bulk.constructor.name}`);
304
- if (r.done) {
305
- done = true;
306
- break;
307
- }
308
- }
309
- catch (eu) {
310
- const e = (bulkSyncError = WalletError_1.WalletError.fromUnknown(eu));
311
- this.log(`bulk sync error: ${e.message}`);
312
- if (!this.available)
313
- // During initial startup, bulk ingestors must be available.
314
- break;
315
- }
316
- }
317
- if (!this.available && bulkSyncError && !roundHadSuccess) {
318
- this.startupError = bulkSyncError;
285
+ for (let round = 1; round <= maxSyncRounds; round++) {
286
+ const result = await this.runBulkSyncRound(before, presentHeight, newLiveHeaders);
287
+ after = result.after;
288
+ newLiveHeaders = result.newLiveHeaders;
289
+ added = after.bulk.above(before.bulk);
290
+ before = after;
291
+ if (this.startupError != null)
319
292
  break;
320
- }
321
- if (done)
293
+ if (result.done)
322
294
  break;
323
- if (!roundMadeProgress) {
295
+ if (!result.madeProgress) {
324
296
  this.log(`Bulk sync stalled after round ${round}. Deferring further bulk sync attempts to continue live header processing.`);
325
297
  break;
326
298
  }
@@ -328,7 +300,7 @@ class Chaintracks {
328
300
  this.log(`Bulk sync paused after ${maxSyncRounds} rounds to avoid runaway retries. Will retry in a later sync cycle.`);
329
301
  }
330
302
  }
331
- if (!this.startupError) {
303
+ if (this.startupError == null) {
332
304
  this.liveHeaders.unshift(...newLiveHeaders);
333
305
  added = after.bulk.above(initialRanges.bulk);
334
306
  this.log(`syncBulkStorage done
@@ -339,10 +311,47 @@ class Chaintracks {
339
311
  `);
340
312
  }
341
313
  }
314
+ async runBulkSyncRound(before, presentHeight, newLiveHeaders) {
315
+ let after = before;
316
+ let bulkSyncError;
317
+ let madeProgress = false;
318
+ let hadSuccess = false;
319
+ let done = false;
320
+ for (const bulk of this.bulkIngestors) {
321
+ try {
322
+ const beforeBulkMax = before.bulk.maxHeight;
323
+ const beforeLiveRange = HeightRange_1.HeightRange.from(newLiveHeaders);
324
+ const r = await bulk.synchronize(presentHeight, before, newLiveHeaders);
325
+ hadSuccess = true;
326
+ newLiveHeaders = r.liveHeaders;
327
+ after = await this.storage.getAvailableHeightRanges();
328
+ const added = after.bulk.above(before.bulk);
329
+ const afterLiveRange = HeightRange_1.HeightRange.from(newLiveHeaders);
330
+ if (after.bulk.maxHeight > beforeBulkMax || afterLiveRange.maxHeight > beforeLiveRange.maxHeight)
331
+ madeProgress = true;
332
+ before = after;
333
+ this.log(`Bulk Ingestor: ${added.length} added with ${newLiveHeaders.length} live headers from ${bulk.constructor.name}`);
334
+ if (r.done) {
335
+ done = true;
336
+ break;
337
+ }
338
+ }
339
+ catch (error_) {
340
+ const e = (bulkSyncError = WalletError_1.WalletError.fromUnknown(error_));
341
+ this.log(`bulk sync error: ${e.message}`);
342
+ // During initial startup, bulk ingestors must be available.
343
+ if (!this.available)
344
+ break;
345
+ }
346
+ }
347
+ if (!this.available && (bulkSyncError != null) && !hadSuccess)
348
+ this.startupError = bulkSyncError;
349
+ return { after, newLiveHeaders, done, madeProgress };
350
+ }
342
351
  async getMissingBlockHeader(hash) {
343
352
  for (const live of this.liveIngestors) {
344
353
  const header = await live.getHeaderByHash(hash);
345
- if (header)
354
+ if (header != null)
346
355
  return header;
347
356
  }
348
357
  return undefined;
@@ -359,36 +368,36 @@ class Chaintracks {
359
368
  if (this.invalidInsertHeaderResult(ihr))
360
369
  return ihr;
361
370
  if (this.subscriberCallbacksEnabled && ihr.added && ihr.isActiveTip) {
362
- // If a new active chaintip has been added, notify subscribed event listeners...
363
- for (const id in this.callbacks.header) {
364
- const addListener = this.callbacks.header[id];
365
- if (addListener) {
366
- try {
367
- addListener(header);
368
- }
369
- catch (_a) {
370
- /* ignore all errors thrown */
371
- }
371
+ this.notifyHeaderListeners(header);
372
+ if (ihr.reorgDepth > 0 && (ihr.priorTip != null)) {
373
+ this.notifyReorgListeners(ihr, header);
374
+ }
375
+ }
376
+ return ihr;
377
+ }
378
+ notifyHeaderListeners(header) {
379
+ for (const id in this.callbacks.header) {
380
+ const listener = this.callbacks.header[id];
381
+ if (listener != null) {
382
+ try {
383
+ listener(header);
372
384
  }
385
+ catch ( /* ignore all errors thrown */_a) { /* ignore all errors thrown */ }
373
386
  }
374
- if (ihr.reorgDepth > 0 && ihr.priorTip) {
375
- // If the new header was also a reorg, notify subscribed event listeners...
376
- for (const id in this.callbacks.reorg) {
377
- const reorgListener = this.callbacks.reorg[id];
378
- if (reorgListener) {
379
- try {
380
- const priorTip = { ...ihr.priorTip };
381
- const deactivated = ihr.deactivatedHeaders.map(lbh => ({ ...lbh }));
382
- reorgListener(ihr.reorgDepth, priorTip, header, deactivated);
383
- }
384
- catch (_b) {
385
- /* ignore all errors thrown */
386
- }
387
- }
387
+ }
388
+ }
389
+ notifyReorgListeners(ihr, header) {
390
+ const priorTip = { ...ihr.priorTip };
391
+ const deactivated = ihr.deactivatedHeaders.map(lbh => ({ ...lbh }));
392
+ for (const id in this.callbacks.reorg) {
393
+ const listener = this.callbacks.reorg[id];
394
+ if (listener != null) {
395
+ try {
396
+ listener(ihr.reorgDepth, priorTip, header, deactivated);
388
397
  }
398
+ catch ( /* ignore all errors thrown */_a) { /* ignore all errors thrown */ }
389
399
  }
390
400
  }
391
- return ihr;
392
401
  }
393
402
  /**
394
403
  * Long running method terminated by setting `stopMainThread` false.
@@ -404,161 +413,159 @@ class Chaintracks {
404
413
  */
405
414
  async mainThreadShiftLiveHeaders() {
406
415
  this.stopMainThread = false;
407
- let lastSyncCheck = Date.now();
416
+ let lastSyncCheck = 0;
408
417
  let lastBulkSync = Date.now();
409
418
  const cdnSyncRepeatMsecs = 24 * 60 * 60 * 1000; // 24 hours
410
419
  const syncCheckRepeatMsecs = 30 * 60 * 1000; // 30 minutes
411
420
  while (!this.stopMainThread) {
412
421
  try {
413
- // Review the need for bulk sync...
414
422
  const now = Date.now();
415
423
  lastSyncCheck = now;
416
- const presentHeight = await this.getPresentHeight();
417
- const before = await this.storage.getAvailableHeightRanges();
418
- // Skip bulk sync if within less than half the recursion limit of present height
419
- let skipBulkSync = !before.live.isEmpty && before.live.maxHeight >= presentHeight - this.addLiveRecursionLimit / 2;
420
- if (skipBulkSync && now - lastBulkSync > cdnSyncRepeatMsecs) {
421
- // If we haven't re-synced in a long time, do it just to check for a CDN update.
422
- skipBulkSync = false;
424
+ lastBulkSync = await this.runBulkSyncIfNeeded(now, lastBulkSync, cdnSyncRepeatMsecs);
425
+ await this.processLiveHeaderQueue(lastSyncCheck, syncCheckRepeatMsecs);
426
+ }
427
+ catch (error_) {
428
+ const e = WalletError_1.WalletError.fromUnknown(error_);
429
+ if (this.available) {
430
+ this.log(`Error occurred during chaintracks main thread processing: ${e.stack || e.message}`);
423
431
  }
424
- this.log(`Chaintracks Update Services: Bulk Header Sync Review
432
+ else {
433
+ this.startupError = e;
434
+ this.stopMainThread = true;
435
+ }
436
+ }
437
+ }
438
+ }
439
+ /** Returns (potentially updated) lastBulkSync timestamp. */
440
+ async runBulkSyncIfNeeded(now, lastBulkSync, cdnSyncRepeatMsecs) {
441
+ const presentHeight = await this.getPresentHeight();
442
+ const before = await this.storage.getAvailableHeightRanges();
443
+ let skipBulkSync = !before.live.isEmpty && before.live.maxHeight >= presentHeight - this.addLiveRecursionLimit / 2;
444
+ // If we haven't re-synced in a long time, do it just to check for a CDN update.
445
+ if (skipBulkSync && now - lastBulkSync > cdnSyncRepeatMsecs)
446
+ skipBulkSync = false;
447
+ this.log(`Chaintracks Update Services: Bulk Header Sync Review
425
448
  presentHeight=${presentHeight} addLiveRecursionLimit=${this.addLiveRecursionLimit}
426
449
  Before synchronize: bulk ${before.bulk}, live ${before.live}
427
450
  ${skipBulkSync ? 'Skipping' : 'Starting'} syncBulkStorage.
428
451
  `);
429
- if (!skipBulkSync) {
430
- // Bring bulk storage up-to-date and (re-)initialize liveHeaders
431
- lastBulkSync = now;
432
- if (this.available)
433
- // Once available, initial write lock is released, take a new one to update bulk storage.
434
- await this.syncBulkStorage(presentHeight, before);
435
- else
436
- // While still not available, the makeAvailable write lock is held.
437
- await this.syncBulkStorageNoLock(presentHeight, before);
438
- if (this.startupError)
439
- throw this.startupError;
452
+ if (!skipBulkSync) {
453
+ // Once available, the initial write lock is released; take a new one to update bulk storage.
454
+ // While not yet available, the makeAvailable write lock is still held.
455
+ if (this.available)
456
+ await this.syncBulkStorage(presentHeight, before);
457
+ else
458
+ await this.syncBulkStorageNoLock(presentHeight, before);
459
+ if (this.startupError != null)
460
+ throw this.startupError;
461
+ return now;
462
+ }
463
+ return lastBulkSync;
464
+ }
465
+ async processLiveHeaderQueue(lastSyncCheck, syncCheckRepeatMsecs) {
466
+ let count = 0;
467
+ let liveHeaderDupes = 0;
468
+ let needSyncCheck = false;
469
+ while (!needSyncCheck && !this.stopMainThread) {
470
+ const liveHeader = this.liveHeaders.shift();
471
+ if (liveHeader != null) {
472
+ const result = await this.processOneLiveHeader(liveHeader);
473
+ if (result.needSyncCheck) {
474
+ needSyncCheck = true;
475
+ continue;
440
476
  }
441
- let count = 0;
442
- let liveHeaderDupes = 0;
443
- let needSyncCheck = false;
444
- for (; !needSyncCheck && !this.stopMainThread;) {
445
- let header = this.liveHeaders.shift();
446
- if (header) {
447
- // Process a "live" block header...
448
- let recursions = this.addLiveRecursionLimit;
449
- for (; !needSyncCheck && !this.stopMainThread;) {
450
- //console.log(`Processing liveHeader: height: ${header.height} hash: ${header.hash} ${new Date().toISOString()}`)
451
- const ihr = await this.addLiveHeader(header);
452
- if (this.invalidInsertHeaderResult(ihr)) {
453
- this.log(`Ignoring liveHeader ${header.height} ${header.hash} due to invalid insert result.`);
454
- needSyncCheck = true;
455
- }
456
- else if (ihr.noPrev) {
457
- // Previous header is unknown, request it by hash from the network and try adding it first...
458
- if (recursions-- <= 0) {
459
- // Ignore this header...
460
- this.log(`Ignoring liveHeader ${header.height} ${header.hash} addLiveRecursionLimit=${this.addLiveRecursionLimit} exceeded.`);
461
- needSyncCheck = true;
462
- }
463
- else {
464
- const hash = header.previousHash;
465
- const prevHeader = await this.getMissingBlockHeader(hash);
466
- if (!prevHeader) {
467
- this.log(`Ignoring liveHeader ${header.height} ${header.hash} failed to find previous header by hash ${(0, utilityHelpers_noBuffer_1.asString)(hash)}`);
468
- needSyncCheck = true;
469
- }
470
- else {
471
- // Switch to trying to add prevHeader, unshifting current header to try it again after prevHeader exists.
472
- this.liveHeaders.unshift(header);
473
- header = prevHeader;
474
- }
475
- }
476
- }
477
- else {
478
- if (this.subscriberCallbacksEnabled)
479
- this.log(`addLiveHeader ${header.height}${ihr.added ? ' added' : ''}${ihr.dupe ? ' dupe' : ''}${ihr.isActiveTip ? ' isActiveTip' : ''}${ihr.reorgDepth ? ' reorg depth ' + ihr.reorgDepth : ''}${ihr.noPrev ? ' noPrev' : ''}${ihr.noActiveAncestor || ihr.noTip || ihr.badPrev ? ' error' : ''}`);
480
- if (ihr.dupe) {
481
- liveHeaderDupes++;
482
- }
483
- // Header wasn't invalid and previous header is known. If it was successfully added, count it as a win.
484
- if (ihr.added) {
485
- count++;
486
- }
487
- break;
488
- }
489
- }
490
- }
491
- else {
492
- // There are no liveHeaders currently to process, check the out-of-band baseHeaders channel (`addHeader` method called by a client).
493
- const bheader = this.baseHeaders.shift();
494
- if (bheader) {
495
- const prev = await this.storage.findLiveHeaderForBlockHash(bheader.previousHash);
496
- if (!prev) {
497
- // Ignoring attempt to add a baseHeader with unknown previous hash, no attempt made to find previous header(s).
498
- this.log(`Ignoring header with unknown previousHash ${bheader.previousHash} in live storage.`);
499
- // Does not trigger a re-sync.
500
- }
501
- else {
502
- const header = {
503
- ...bheader,
504
- height: prev.height + 1,
505
- hash: (0, blockHeaderUtilities_1.blockHash)(bheader)
506
- };
507
- const ihr = await this.addLiveHeader(header);
508
- if (this.invalidInsertHeaderResult(ihr)) {
509
- this.log(`Ignoring invalid baseHeader ${header.height} ${header.hash}.`);
510
- }
511
- else {
512
- if (this.subscriberCallbacksEnabled)
513
- this.log(`addBaseHeader ${header.height}${ihr.added ? ' added' : ''}${ihr.dupe ? ' dupe' : ''}${ihr.isActiveTip ? ' isActiveTip' : ''}${ihr.reorgDepth ? ' reorg depth ' + ihr.reorgDepth : ''}${ihr.noPrev ? ' noPrev' : ''}${ihr.noActiveAncestor || ihr.noTip || ihr.badPrev ? ' error' : ''}`);
514
- // baseHeader was successfully added.
515
- if (ihr.added) {
516
- count++;
517
- }
518
- }
519
- }
520
- }
521
- else {
522
- // There are no liveHeaders and no baseHeaders to add,
523
- if (count > 0) {
524
- if (liveHeaderDupes > 0) {
525
- this.log(`${liveHeaderDupes} duplicate headers ignored.`);
526
- liveHeaderDupes = 0;
527
- }
528
- const updated = await this.storage.getAvailableHeightRanges();
529
- this.log(`After adding ${count} live headers
530
- After live: bulk ${updated.bulk}, live ${updated.live}
531
- `);
532
- count = 0;
533
- }
534
- if (!this.subscriberCallbacksEnabled) {
535
- const live = await this.storage.findLiveHeightRange();
536
- if (!live.isEmpty) {
537
- this.subscriberCallbacksEnabled = true;
538
- this.log(`listening at height of ${live.maxHeight}`);
539
- }
540
- }
541
- if (!this.available) {
542
- this.available = true;
543
- }
544
- needSyncCheck = Date.now() - lastSyncCheck > syncCheckRepeatMsecs;
545
- // If we aren't going to review sync, wait before checking input queues again
546
- if (!needSyncCheck)
547
- await (0, utilityHelpers_1.wait)(1000);
477
+ if (result.dupe)
478
+ liveHeaderDupes++;
479
+ if (result.added)
480
+ count++;
481
+ }
482
+ else {
483
+ const bheader = this.baseHeaders.shift();
484
+ if (bheader != null) {
485
+ const added = await this.processOneBaseHeader(bheader);
486
+ if (added)
487
+ count++;
488
+ }
489
+ else {
490
+ // No live or base headers queued — idle path.
491
+ if (count > 0) {
492
+ if (liveHeaderDupes > 0) {
493
+ this.log(`${liveHeaderDupes} duplicate headers ignored.`);
494
+ liveHeaderDupes = 0;
548
495
  }
496
+ const updated = await this.storage.getAvailableHeightRanges();
497
+ this.log(`After adding ${count} live headers\n After live: bulk ${updated.bulk}, live ${updated.live}\n`);
498
+ count = 0;
549
499
  }
500
+ await this.checkAndEnableSubscribers();
501
+ if (!this.available)
502
+ this.available = true;
503
+ needSyncCheck = Date.now() - lastSyncCheck > syncCheckRepeatMsecs;
504
+ if (!needSyncCheck)
505
+ await (0, utilityHelpers_1.wait)(1000);
550
506
  }
551
507
  }
552
- catch (eu) {
553
- const e = WalletError_1.WalletError.fromUnknown(eu);
554
- if (!this.available) {
555
- this.startupError = e;
556
- this.stopMainThread = true;
508
+ }
509
+ }
510
+ formatIhrLog(prefix, header, ihr) {
511
+ return `${prefix} ${header.height}${ihr.added ? ' added' : ''}${ihr.dupe ? ' dupe' : ''}${ihr.isActiveTip ? ' isActiveTip' : ''}${ihr.reorgDepth ? ' reorg depth ' + ihr.reorgDepth : ''}${ihr.noPrev ? ' noPrev' : ''}${ihr.noActiveAncestor || ihr.noTip || ihr.badPrev ? ' error' : ''}`;
512
+ }
513
+ async processOneLiveHeader(startHeader) {
514
+ let header = startHeader;
515
+ let recursions = this.addLiveRecursionLimit;
516
+ while (!this.stopMainThread) {
517
+ const ihr = await this.addLiveHeader(header);
518
+ if (this.invalidInsertHeaderResult(ihr)) {
519
+ this.log(`Ignoring liveHeader ${header.height} ${header.hash} due to invalid insert result.`);
520
+ return { needSyncCheck: true, dupe: false, added: false };
521
+ }
522
+ if (ihr.noPrev) {
523
+ // Previous header is unknown; request it by hash from the network and try adding it first.
524
+ if (recursions-- <= 0) {
525
+ this.log(`Ignoring liveHeader ${header.height} ${header.hash} addLiveRecursionLimit=${this.addLiveRecursionLimit} exceeded.`);
526
+ return { needSyncCheck: true, dupe: false, added: false };
557
527
  }
558
- else {
559
- this.log(`Error occurred during chaintracks main thread processing: ${e.stack || e.message}`);
528
+ const prevHeader = await this.getMissingBlockHeader(header.previousHash);
529
+ if (prevHeader == null) {
530
+ this.log(`Ignoring liveHeader ${header.height} ${header.hash} failed to find previous header by hash ${(0, utilityHelpers_noBuffer_1.asString)(header.previousHash)}`);
531
+ return { needSyncCheck: true, dupe: false, added: false };
560
532
  }
533
+ // Retry adding prevHeader first; then re-queue current header.
534
+ this.liveHeaders.unshift(header);
535
+ header = prevHeader;
561
536
  }
537
+ else {
538
+ if (this.subscriberCallbacksEnabled)
539
+ this.log(this.formatIhrLog('addLiveHeader', header, ihr));
540
+ return { needSyncCheck: false, dupe: ihr.dupe, added: ihr.added };
541
+ }
542
+ }
543
+ return { needSyncCheck: false, dupe: false, added: false };
544
+ }
545
+ async processOneBaseHeader(bheader) {
546
+ const prev = await this.storage.findLiveHeaderForBlockHash(bheader.previousHash);
547
+ if (prev == null) {
548
+ // Unknown previous hash — ignore without triggering a re-sync.
549
+ this.log(`Ignoring header with unknown previousHash ${bheader.previousHash} in live storage.`);
550
+ return false;
551
+ }
552
+ const header = { ...bheader, height: prev.height + 1, hash: (0, blockHeaderUtilities_1.blockHash)(bheader) };
553
+ const ihr = await this.addLiveHeader(header);
554
+ if (this.invalidInsertHeaderResult(ihr)) {
555
+ this.log(`Ignoring invalid baseHeader ${header.height} ${header.hash}.`);
556
+ return false;
557
+ }
558
+ if (this.subscriberCallbacksEnabled)
559
+ this.log(this.formatIhrLog('addBaseHeader', header, ihr));
560
+ return ihr.added;
561
+ }
562
+ async checkAndEnableSubscribers() {
563
+ if (this.subscriberCallbacksEnabled)
564
+ return;
565
+ const live = await this.storage.findLiveHeightRange();
566
+ if (!live.isEmpty) {
567
+ this.subscriberCallbacksEnabled = true;
568
+ this.log(`listening at height of ${live.maxHeight}`);
562
569
  }
563
570
  }
564
571
  }