@bsv/wallet-toolbox 1.1.60 → 1.1.61

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 (467) hide show
  1. package/.prettierrc +1 -1
  2. package/docs/client.md +39 -5
  3. package/docs/services.md +1 -0
  4. package/docs/setup.md +9 -26
  5. package/docs/storage.md +35 -0
  6. package/docs/wallet.md +39 -5
  7. package/out/src/Setup.d.ts.map +1 -1
  8. package/out/src/Setup.js +6 -16
  9. package/out/src/Setup.js.map +1 -1
  10. package/out/src/Wallet.d.ts.map +1 -1
  11. package/out/src/Wallet.js +4 -11
  12. package/out/src/Wallet.js.map +1 -1
  13. package/out/src/monitor/Monitor.d.ts.map +1 -1
  14. package/out/src/monitor/Monitor.js.map +1 -1
  15. package/out/src/monitor/MonitorDaemon.d.ts.map +1 -1
  16. package/out/src/monitor/MonitorDaemon.js +1 -3
  17. package/out/src/monitor/MonitorDaemon.js.map +1 -1
  18. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
  19. package/out/src/monitor/tasks/TaskCheckForProofs.js +2 -10
  20. package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
  21. package/out/src/monitor/tasks/TaskClock.d.ts.map +1 -1
  22. package/out/src/monitor/tasks/TaskClock.js +1 -1
  23. package/out/src/monitor/tasks/TaskClock.js.map +1 -1
  24. package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -1
  25. package/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -1
  26. package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -1
  27. package/out/src/monitor/tasks/TaskNewHeader.js +1 -2
  28. package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -1
  29. package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -1
  30. package/out/src/monitor/tasks/TaskPurge.js +1 -2
  31. package/out/src/monitor/tasks/TaskPurge.js.map +1 -1
  32. package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -1
  33. package/out/src/monitor/tasks/TaskReviewStatus.js +1 -2
  34. package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -1
  35. package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
  36. package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
  37. package/out/src/sdk/CertOps.d.ts.map +1 -1
  38. package/out/src/sdk/CertOps.js +4 -12
  39. package/out/src/sdk/CertOps.js.map +1 -1
  40. package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -1
  41. package/out/src/sdk/PrivilegedKeyManager.js.map +1 -1
  42. package/out/src/sdk/WERR_errors.d.ts.map +1 -1
  43. package/out/src/sdk/WERR_errors.js.map +1 -1
  44. package/out/src/sdk/WalletError.d.ts.map +1 -1
  45. package/out/src/sdk/WalletError.js +1 -4
  46. package/out/src/sdk/WalletError.js.map +1 -1
  47. package/out/src/sdk/WalletServices.interfaces.d.ts +2 -0
  48. package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
  49. package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
  50. package/out/src/sdk/__test/CertificateLifeCycle.test.js +1 -3
  51. package/out/src/sdk/__test/CertificateLifeCycle.test.js.map +1 -1
  52. package/out/src/sdk/__test/PrivilegedKeyManager.test.js +13 -26
  53. package/out/src/sdk/__test/PrivilegedKeyManager.test.js.map +1 -1
  54. package/out/src/sdk/types.d.ts.map +1 -1
  55. package/out/src/sdk/types.js +2 -10
  56. package/out/src/sdk/types.js.map +1 -1
  57. package/out/src/sdk/validationHelpers.d.ts.map +1 -1
  58. package/out/src/sdk/validationHelpers.js +5 -12
  59. package/out/src/sdk/validationHelpers.js.map +1 -1
  60. package/out/src/services/Services.d.ts +1 -0
  61. package/out/src/services/Services.d.ts.map +1 -1
  62. package/out/src/services/Services.js +29 -38
  63. package/out/src/services/Services.js.map +1 -1
  64. package/out/src/services/__tests/bitrails.test.js.map +1 -1
  65. package/out/src/services/__tests/getMerklePath.test.js.map +1 -1
  66. package/out/src/services/__tests/getRawTx.test.js.map +1 -1
  67. package/out/src/services/__tests/verifyBeef.test.js +2 -1
  68. package/out/src/services/__tests/verifyBeef.test.js.map +1 -1
  69. package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -1
  70. package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -1
  71. package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts.map +1 -1
  72. package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js.map +1 -1
  73. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -1
  74. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +1 -3
  75. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -1
  76. package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -1
  77. package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -1
  78. package/out/src/services/providers/ARC.d.ts.map +1 -1
  79. package/out/src/services/providers/ARC.js +1 -2
  80. package/out/src/services/providers/ARC.js.map +1 -1
  81. package/out/src/services/providers/Bitails.d.ts.map +1 -1
  82. package/out/src/services/providers/Bitails.js +62 -134
  83. package/out/src/services/providers/Bitails.js.map +1 -1
  84. package/out/src/services/providers/SdkWhatsOnChain.d.ts.map +1 -1
  85. package/out/src/services/providers/SdkWhatsOnChain.js.map +1 -1
  86. package/out/src/services/providers/WhatsOnChain.d.ts.map +1 -1
  87. package/out/src/services/providers/WhatsOnChain.js +6 -21
  88. package/out/src/services/providers/WhatsOnChain.js.map +1 -1
  89. package/out/src/services/providers/__tests/WhatsOnChain.test.js +1 -2
  90. package/out/src/services/providers/__tests/WhatsOnChain.test.js.map +1 -1
  91. package/out/src/services/providers/echangeRates.d.ts.map +1 -1
  92. package/out/src/services/providers/echangeRates.js.map +1 -1
  93. package/out/src/signer/WalletSigner.d.ts.map +1 -1
  94. package/out/src/signer/WalletSigner.js.map +1 -1
  95. package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -1
  96. package/out/src/signer/methods/acquireDirectCertificate.js +1 -3
  97. package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
  98. package/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
  99. package/out/src/signer/methods/buildSignableTransaction.js +3 -11
  100. package/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
  101. package/out/src/signer/methods/createAction.d.ts.map +1 -1
  102. package/out/src/signer/methods/createAction.js +3 -10
  103. package/out/src/signer/methods/createAction.js.map +1 -1
  104. package/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
  105. package/out/src/signer/methods/internalizeAction.js.map +1 -1
  106. package/out/src/signer/methods/proveCertificate.d.ts.map +1 -1
  107. package/out/src/signer/methods/proveCertificate.js.map +1 -1
  108. package/out/src/signer/methods/signAction.d.ts.map +1 -1
  109. package/out/src/signer/methods/signAction.js +2 -7
  110. package/out/src/signer/methods/signAction.js.map +1 -1
  111. package/out/src/storage/StorageKnex.d.ts.map +1 -1
  112. package/out/src/storage/StorageKnex.js +15 -44
  113. package/out/src/storage/StorageKnex.js.map +1 -1
  114. package/out/src/storage/StorageProvider.d.ts.map +1 -1
  115. package/out/src/storage/StorageProvider.js +9 -34
  116. package/out/src/storage/StorageProvider.js.map +1 -1
  117. package/out/src/storage/StorageReader.d.ts.map +1 -1
  118. package/out/src/storage/StorageReader.js.map +1 -1
  119. package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
  120. package/out/src/storage/StorageReaderWriter.js.map +1 -1
  121. package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
  122. package/out/src/storage/StorageSyncReader.js.map +1 -1
  123. package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
  124. package/out/src/storage/WalletStorageManager.js +5 -10
  125. package/out/src/storage/WalletStorageManager.js.map +1 -1
  126. package/out/src/storage/__test/WalletStorageManager.test.js +2 -8
  127. package/out/src/storage/__test/WalletStorageManager.test.js.map +1 -1
  128. package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js +10 -30
  129. package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js.map +1 -1
  130. package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.d.ts.map +1 -1
  131. package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js +17 -28
  132. package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js.map +1 -1
  133. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
  134. package/out/src/storage/methods/attemptToPostReqsToNetwork.js +6 -20
  135. package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
  136. package/out/src/storage/methods/createAction.d.ts.map +1 -1
  137. package/out/src/storage/methods/createAction.js +4 -9
  138. package/out/src/storage/methods/createAction.js.map +1 -1
  139. package/out/src/storage/methods/generateChange.d.ts.map +1 -1
  140. package/out/src/storage/methods/generateChange.js +7 -18
  141. package/out/src/storage/methods/generateChange.js.map +1 -1
  142. package/out/src/storage/methods/getBeefForTransaction.d.ts.map +1 -1
  143. package/out/src/storage/methods/getBeefForTransaction.js +1 -3
  144. package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
  145. package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
  146. package/out/src/storage/methods/getSyncChunk.js.map +1 -1
  147. package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
  148. package/out/src/storage/methods/internalizeAction.js +2 -9
  149. package/out/src/storage/methods/internalizeAction.js.map +1 -1
  150. package/out/src/storage/methods/listActions.d.ts.map +1 -1
  151. package/out/src/storage/methods/listActions.js +3 -15
  152. package/out/src/storage/methods/listActions.js.map +1 -1
  153. package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
  154. package/out/src/storage/methods/listCertificates.js.map +1 -1
  155. package/out/src/storage/methods/listOutputs.d.ts.map +1 -1
  156. package/out/src/storage/methods/listOutputs.js +4 -11
  157. package/out/src/storage/methods/listOutputs.js.map +1 -1
  158. package/out/src/storage/methods/processAction.d.ts.map +1 -1
  159. package/out/src/storage/methods/processAction.js +4 -10
  160. package/out/src/storage/methods/processAction.js.map +1 -1
  161. package/out/src/storage/methods/purgeData.d.ts.map +1 -1
  162. package/out/src/storage/methods/purgeData.js +8 -32
  163. package/out/src/storage/methods/purgeData.js.map +1 -1
  164. package/out/src/storage/methods/reviewStatus.d.ts.map +1 -1
  165. package/out/src/storage/methods/reviewStatus.js +1 -3
  166. package/out/src/storage/methods/reviewStatus.js.map +1 -1
  167. package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
  168. package/out/src/storage/remoting/StorageClient.js +15 -41
  169. package/out/src/storage/remoting/StorageClient.js.map +1 -1
  170. package/out/src/storage/remoting/StorageServer.d.ts.map +1 -1
  171. package/out/src/storage/remoting/StorageServer.js +2 -5
  172. package/out/src/storage/remoting/StorageServer.js.map +1 -1
  173. package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -1
  174. package/out/src/storage/schema/KnexMigrations.js +24 -130
  175. package/out/src/storage/schema/KnexMigrations.js.map +1 -1
  176. package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -1
  177. package/out/src/storage/schema/entities/Certificate.js +1 -1
  178. package/out/src/storage/schema/entities/Certificate.js.map +1 -1
  179. package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -1
  180. package/out/src/storage/schema/entities/CertificateField.js +2 -5
  181. package/out/src/storage/schema/entities/CertificateField.js.map +1 -1
  182. package/out/src/storage/schema/entities/Commission.d.ts.map +1 -1
  183. package/out/src/storage/schema/entities/Commission.js +2 -5
  184. package/out/src/storage/schema/entities/Commission.js.map +1 -1
  185. package/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -1
  186. package/out/src/storage/schema/entities/EntityBase.js.map +1 -1
  187. package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
  188. package/out/src/storage/schema/entities/MergeEntity.js +14 -9
  189. package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
  190. package/out/src/storage/schema/entities/Output.d.ts.map +1 -1
  191. package/out/src/storage/schema/entities/Output.js +8 -25
  192. package/out/src/storage/schema/entities/Output.js.map +1 -1
  193. package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -1
  194. package/out/src/storage/schema/entities/OutputBasket.js +1 -1
  195. package/out/src/storage/schema/entities/OutputBasket.js.map +1 -1
  196. package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -1
  197. package/out/src/storage/schema/entities/OutputTag.js +1 -1
  198. package/out/src/storage/schema/entities/OutputTag.js.map +1 -1
  199. package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -1
  200. package/out/src/storage/schema/entities/OutputTagMap.js +3 -7
  201. package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -1
  202. package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -1
  203. package/out/src/storage/schema/entities/ProvenTx.js +10 -20
  204. package/out/src/storage/schema/entities/ProvenTx.js.map +1 -1
  205. package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -1
  206. package/out/src/storage/schema/entities/ProvenTxReq.js +8 -18
  207. package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -1
  208. package/out/src/storage/schema/entities/SyncState.d.ts +1 -0
  209. package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -1
  210. package/out/src/storage/schema/entities/SyncState.js +41 -6
  211. package/out/src/storage/schema/entities/SyncState.js.map +1 -1
  212. package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -1
  213. package/out/src/storage/schema/entities/Transaction.js +4 -13
  214. package/out/src/storage/schema/entities/Transaction.js.map +1 -1
  215. package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -1
  216. package/out/src/storage/schema/entities/TxLabel.js +1 -1
  217. package/out/src/storage/schema/entities/TxLabel.js.map +1 -1
  218. package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -1
  219. package/out/src/storage/schema/entities/TxLabelMap.js +3 -9
  220. package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -1
  221. package/out/src/storage/schema/entities/User.d.ts.map +1 -1
  222. package/out/src/storage/schema/entities/User.js +3 -5
  223. package/out/src/storage/schema/entities/User.js.map +1 -1
  224. package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -1
  225. package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -1
  226. package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -1
  227. package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -1
  228. package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -1
  229. package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -1
  230. package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -1
  231. package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -1
  232. package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +1 -2
  233. package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
  234. package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -1
  235. package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +2 -2
  236. package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -1
  237. package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -1
  238. package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -1
  239. package/out/src/storage/schema/entities/__tests/stampLogTests.test.js.map +1 -1
  240. package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -1
  241. package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -1
  242. package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
  243. package/out/src/storage/sync/StorageMySQLDojoReader.js +1 -3
  244. package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -1
  245. package/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -1
  246. package/out/src/utility/ScriptTemplateBRC29.js +1 -2
  247. package/out/src/utility/ScriptTemplateBRC29.js.map +1 -1
  248. package/out/src/utility/stampLog.d.ts.map +1 -1
  249. package/out/src/utility/stampLog.js.map +1 -1
  250. package/out/src/utility/tscProofToMerklePath.d.ts.map +1 -1
  251. package/out/src/utility/tscProofToMerklePath.js.map +1 -1
  252. package/out/src/utility/utilityHelpers.buffer.d.ts.map +1 -1
  253. package/out/src/utility/utilityHelpers.buffer.js.map +1 -1
  254. package/out/src/utility/utilityHelpers.d.ts.map +1 -1
  255. package/out/src/utility/utilityHelpers.js +1 -3
  256. package/out/src/utility/utilityHelpers.js.map +1 -1
  257. package/out/test/Wallet/StorageClient/storageClient.man.test.js.map +1 -1
  258. package/out/test/Wallet/action/internalizeAction.a.test.js.map +1 -1
  259. package/out/test/Wallet/certificate/acquireCertificate.test.js.map +1 -1
  260. package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -1
  261. package/out/test/Wallet/get/getHeaderForHeight.test.js +2 -6
  262. package/out/test/Wallet/get/getHeaderForHeight.test.js.map +1 -1
  263. package/out/test/Wallet/get/getHeight.test.js.map +1 -1
  264. package/out/test/Wallet/get/getKnownTxids.test.js.map +1 -1
  265. package/out/test/Wallet/get/getNetwork.test.js.map +1 -1
  266. package/out/test/Wallet/get/getVersion.test.js.map +1 -1
  267. package/out/test/Wallet/live/walletLive.man.test.d.ts.map +1 -1
  268. package/out/test/Wallet/live/walletLive.man.test.js +3 -9
  269. package/out/test/Wallet/live/walletLive.man.test.js.map +1 -1
  270. package/out/test/Wallet/local/localWallet.man.test.d.ts.map +1 -1
  271. package/out/test/Wallet/local/localWallet.man.test.js +15 -22
  272. package/out/test/Wallet/local/localWallet.man.test.js.map +1 -1
  273. package/out/test/Wallet/specOps/specOps.man.test.js +1 -4
  274. package/out/test/Wallet/specOps/specOps.man.test.js.map +1 -1
  275. package/out/test/Wallet/support/janitor.man.test.js.map +1 -1
  276. package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js.map +1 -1
  277. package/out/test/Wallet/sync/setActive.test.js +73 -50
  278. package/out/test/Wallet/sync/setActive.test.js.map +1 -1
  279. package/out/test/checkDB.d.ts.map +1 -1
  280. package/out/test/checkDB.js.map +1 -1
  281. package/out/test/examples/backup.man.test.d.ts.map +1 -1
  282. package/out/test/examples/backup.man.test.js.map +1 -1
  283. package/out/test/examples/pushdrop.test.d.ts.map +1 -1
  284. package/out/test/examples/pushdrop.test.js +5 -4
  285. package/out/test/examples/pushdrop.test.js.map +1 -1
  286. package/out/test/monitor/Monitor.test.js.map +1 -1
  287. package/out/test/services/Services.test.js.map +1 -1
  288. package/out/test/storage/KnexMigrations.test.js.map +1 -1
  289. package/out/test/storage/StorageMySQLDojoReader.man.test.js +1 -3
  290. package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -1
  291. package/out/test/storage/count.test.js.map +1 -1
  292. package/out/test/storage/find.test.js +5 -10
  293. package/out/test/storage/find.test.js.map +1 -1
  294. package/out/test/storage/findLegacy.test.js.map +1 -1
  295. package/out/test/storage/insert.test.js.map +1 -1
  296. package/out/test/storage/update.test.js +7 -19
  297. package/out/test/storage/update.test.js.map +1 -1
  298. package/out/test/storage/update2.test.js +22 -24
  299. package/out/test/storage/update2.test.js.map +1 -1
  300. package/out/test/utils/TestUtilsWalletStorage.d.ts +3 -1
  301. package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
  302. package/out/test/utils/TestUtilsWalletStorage.js +52 -76
  303. package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
  304. package/out/test/wallet/action/abortAction.test.js.map +1 -1
  305. package/out/test/wallet/action/createAction.test.js +1 -2
  306. package/out/test/wallet/action/createAction.test.js.map +1 -1
  307. package/out/test/wallet/action/createAction2.test.d.ts.map +1 -1
  308. package/out/test/wallet/action/createAction2.test.js +6 -16
  309. package/out/test/wallet/action/createAction2.test.js.map +1 -1
  310. package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -1
  311. package/out/test/wallet/action/internalizeAction.test.js.map +1 -1
  312. package/out/test/wallet/action/relinquishOutput.test.js.map +1 -1
  313. package/out/test/wallet/list/listActions.test.js.map +1 -1
  314. package/out/test/wallet/list/listActions2.test.js.map +1 -1
  315. package/out/test/wallet/list/listCertificates.test.js +2 -6
  316. package/out/test/wallet/list/listCertificates.test.js.map +1 -1
  317. package/out/test/wallet/list/listOutputs.test.js +2 -10
  318. package/out/test/wallet/list/listOutputs.test.js.map +1 -1
  319. package/out/test/wallet/sync/Wallet.sync.test.js +4 -6
  320. package/out/test/wallet/sync/Wallet.sync.test.js.map +1 -1
  321. package/out/tsconfig.all.tsbuildinfo +1 -1
  322. package/package.json +3 -3
  323. package/src/Setup.ts +15 -52
  324. package/src/Wallet.ts +58 -161
  325. package/src/monitor/Monitor.ts +7 -22
  326. package/src/monitor/MonitorDaemon.ts +6 -23
  327. package/src/monitor/tasks/TaskCheckForProofs.ts +4 -23
  328. package/src/monitor/tasks/TaskClock.ts +1 -3
  329. package/src/monitor/tasks/TaskFailAbandoned.ts +1 -3
  330. package/src/monitor/tasks/TaskNewHeader.ts +1 -4
  331. package/src/monitor/tasks/TaskPurge.ts +1 -2
  332. package/src/monitor/tasks/TaskReviewStatus.ts +1 -3
  333. package/src/monitor/tasks/TaskSendWaiting.ts +3 -10
  334. package/src/sdk/CertOps.ts +31 -103
  335. package/src/sdk/PrivilegedKeyManager.ts +18 -48
  336. package/src/sdk/WERR_errors.ts +6 -25
  337. package/src/sdk/WalletError.ts +5 -21
  338. package/src/sdk/WalletServices.interfaces.ts +11 -33
  339. package/src/sdk/WalletStorage.interfaces.ts +25 -91
  340. package/src/sdk/__test/CertificateLifeCycle.test.ts +9 -27
  341. package/src/sdk/__test/PrivilegedKeyManager.test.ts +29 -66
  342. package/src/sdk/types.ts +6 -26
  343. package/src/sdk/validationHelpers.ts +111 -402
  344. package/src/services/Services.ts +51 -114
  345. package/src/services/__tests/bitrails.test.ts +4 -15
  346. package/src/services/__tests/getMerklePath.test.ts +1 -2
  347. package/src/services/__tests/getRawTx.test.ts +1 -3
  348. package/src/services/__tests/verifyBeef.test.ts +2 -1
  349. package/src/services/chaintracker/ChaintracksChainTracker.ts +3 -13
  350. package/src/services/chaintracker/chaintracks/BlockHeaderApi.ts +4 -12
  351. package/src/services/chaintracker/chaintracks/ChaintracksServiceClient.ts +9 -27
  352. package/src/services/createDefaultWalletServicesOptions.ts +2 -5
  353. package/src/services/providers/ARC.ts +5 -24
  354. package/src/services/providers/Bitails.ts +61 -159
  355. package/src/services/providers/SdkWhatsOnChain.ts +4 -17
  356. package/src/services/providers/WhatsOnChain.ts +31 -100
  357. package/src/services/providers/__tests/WhatsOnChain.test.ts +5 -15
  358. package/src/services/providers/echangeRates.ts +7 -22
  359. package/src/signer/WalletSigner.ts +1 -5
  360. package/src/signer/methods/acquireDirectCertificate.ts +1 -4
  361. package/src/signer/methods/buildSignableTransaction.ts +5 -20
  362. package/src/signer/methods/createAction.ts +15 -54
  363. package/src/signer/methods/internalizeAction.ts +10 -39
  364. package/src/signer/methods/proveCertificate.ts +2 -5
  365. package/src/signer/methods/signAction.ts +9 -39
  366. package/src/storage/StorageKnex.ts +166 -499
  367. package/src/storage/StorageProvider.ts +75 -291
  368. package/src/storage/StorageReader.ts +20 -65
  369. package/src/storage/StorageReaderWriter.ts +67 -264
  370. package/src/storage/StorageSyncReader.ts +2 -5
  371. package/src/storage/WalletStorageManager.ts +33 -108
  372. package/src/storage/__test/WalletStorageManager.test.ts +6 -23
  373. package/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.ts +53 -171
  374. package/src/storage/methods/__test/GenerateChange/randomValsUsed1.ts +17 -28
  375. package/src/storage/methods/attemptToPostReqsToNetwork.ts +9 -37
  376. package/src/storage/methods/createAction.ts +45 -181
  377. package/src/storage/methods/generateChange.ts +33 -114
  378. package/src/storage/methods/getBeefForTransaction.ts +7 -37
  379. package/src/storage/methods/getSyncChunk.ts +18 -69
  380. package/src/storage/methods/internalizeAction.ts +18 -70
  381. package/src/storage/methods/listActions.ts +6 -23
  382. package/src/storage/methods/listCertificates.ts +5 -14
  383. package/src/storage/methods/listOutputs.ts +14 -68
  384. package/src/storage/methods/processAction.ts +29 -104
  385. package/src/storage/methods/purgeData.ts +11 -45
  386. package/src/storage/methods/reviewStatus.ts +3 -9
  387. package/src/storage/remoting/StorageClient.ts +43 -146
  388. package/src/storage/remoting/StorageServer.ts +21 -59
  389. package/src/storage/schema/KnexMigrations.ts +34 -165
  390. package/src/storage/schema/entities/Certificate.ts +3 -14
  391. package/src/storage/schema/entities/CertificateField.ts +6 -28
  392. package/src/storage/schema/entities/Commission.ts +6 -23
  393. package/src/storage/schema/entities/EntityBase.ts +1 -6
  394. package/src/storage/schema/entities/MergeEntity.ts +14 -21
  395. package/src/storage/schema/entities/Output.ts +10 -39
  396. package/src/storage/schema/entities/OutputBasket.ts +4 -16
  397. package/src/storage/schema/entities/OutputTag.ts +4 -17
  398. package/src/storage/schema/entities/OutputTagMap.ts +7 -30
  399. package/src/storage/schema/entities/ProvenTx.ts +16 -57
  400. package/src/storage/schema/entities/ProvenTxReq.ts +29 -93
  401. package/src/storage/schema/entities/SyncState.ts +64 -116
  402. package/src/storage/schema/entities/Transaction.ts +10 -35
  403. package/src/storage/schema/entities/TxLabel.ts +4 -17
  404. package/src/storage/schema/entities/TxLabelMap.ts +6 -28
  405. package/src/storage/schema/entities/User.ts +8 -31
  406. package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +23 -54
  407. package/src/storage/schema/entities/__tests/CertificateTests.test.ts +26 -59
  408. package/src/storage/schema/entities/__tests/CommissionTests.test.ts +2 -11
  409. package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +2 -10
  410. package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +2 -10
  411. package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +1 -4
  412. package/src/storage/schema/entities/__tests/OutputTests.test.ts +3 -14
  413. package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +4 -16
  414. package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +5 -18
  415. package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +5 -26
  416. package/src/storage/schema/entities/__tests/TransactionTests.test.ts +12 -48
  417. package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +4 -22
  418. package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +2 -10
  419. package/src/storage/schema/entities/__tests/stampLogTests.test.ts +3 -10
  420. package/src/storage/schema/entities/__tests/usersTests.test.ts +4 -7
  421. package/src/storage/schema/tables/TableSettings.ts +1 -3
  422. package/src/storage/sync/StorageMySQLDojoReader.ts +47 -148
  423. package/src/utility/ScriptTemplateBRC29.ts +2 -11
  424. package/src/utility/stampLog.ts +2 -6
  425. package/src/utility/tscProofToMerklePath.ts +1 -4
  426. package/src/utility/utilityHelpers.buffer.ts +3 -12
  427. package/src/utility/utilityHelpers.ts +14 -49
  428. package/test/Wallet/StorageClient/storageClient.man.test.ts +2 -8
  429. package/test/Wallet/action/internalizeAction.a.test.ts +8 -23
  430. package/test/Wallet/certificate/acquireCertificate.test.ts +10 -24
  431. package/test/Wallet/certificate/listCertificates.test.ts +8 -18
  432. package/test/Wallet/get/getHeaderForHeight.test.ts +4 -15
  433. package/test/Wallet/get/getHeight.test.ts +2 -6
  434. package/test/Wallet/get/getKnownTxids.test.ts +1 -5
  435. package/test/Wallet/get/getNetwork.test.ts +1 -2
  436. package/test/Wallet/get/getVersion.test.ts +1 -2
  437. package/test/Wallet/live/walletLive.man.test.ts +14 -41
  438. package/test/Wallet/local/localWallet.man.test.ts +26 -99
  439. package/test/Wallet/specOps/specOps.man.test.ts +4 -13
  440. package/test/Wallet/support/janitor.man.test.ts +2 -7
  441. package/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.ts +11 -34
  442. package/test/Wallet/sync/setActive.test.ts +75 -61
  443. package/test/checkDB.ts +2 -8
  444. package/test/examples/backup.man.test.ts +2 -9
  445. package/test/examples/pushdrop.test.ts +7 -20
  446. package/test/monitor/Monitor.test.ts +33 -87
  447. package/test/services/Services.test.ts +8 -19
  448. package/test/storage/KnexMigrations.test.ts +3 -18
  449. package/test/storage/StorageMySQLDojoReader.man.test.ts +4 -15
  450. package/test/storage/count.test.ts +7 -24
  451. package/test/storage/find.test.ts +7 -29
  452. package/test/storage/findLegacy.test.ts +2 -5
  453. package/test/storage/insert.test.ts +3 -19
  454. package/test/storage/update.test.ts +47 -179
  455. package/test/storage/update2.test.ts +54 -176
  456. package/test/utils/TestUtilsWalletStorage.ts +139 -372
  457. package/test/wallet/action/abortAction.test.ts +4 -12
  458. package/test/wallet/action/createAction.test.ts +4 -14
  459. package/test/wallet/action/createAction2.test.ts +74 -208
  460. package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +8 -11
  461. package/test/wallet/action/internalizeAction.test.ts +20 -72
  462. package/test/wallet/action/relinquishOutput.test.ts +3 -9
  463. package/test/wallet/list/listActions.test.ts +2 -9
  464. package/test/wallet/list/listActions2.test.ts +8 -34
  465. package/test/wallet/list/listCertificates.test.ts +5 -16
  466. package/test/wallet/list/listOutputs.test.ts +15 -54
  467. package/test/wallet/sync/Wallet.sync.test.ts +18 -49
@@ -1,11 +1,5 @@
1
1
  import { _tu } from '../utils/TestUtilsWalletStorage'
2
- import {
3
- randomBytesBase64,
4
- randomBytesHex,
5
- sdk,
6
- StorageProvider,
7
- TableCommission
8
- } from '../../src/index.client'
2
+ import { randomBytesBase64, randomBytesHex, sdk, StorageProvider, TableCommission } from '../../src/index.client'
9
3
  import { StorageKnex } from '../../src/storage/StorageKnex'
10
4
 
11
5
  describe('insert tests', () => {
@@ -16,12 +10,7 @@ describe('insert tests', () => {
16
10
  const env = _tu.getEnv(chain)
17
11
 
18
12
  beforeAll(async () => {
19
- const localSQLiteFile = await _tu.newTmpFile(
20
- 'inserttest.sqlite',
21
- false,
22
- false,
23
- true
24
- )
13
+ const localSQLiteFile = await _tu.newTmpFile('inserttest.sqlite', false, false, true)
25
14
  const knexSQLite = _tu.createLocalSQLite(localSQLiteFile)
26
15
  storages.push(
27
16
  new StorageKnex({
@@ -121,12 +110,7 @@ describe('insert tests', () => {
121
110
  test('4 insert CertificateField', async () => {
122
111
  for (const storage of storages) {
123
112
  const c = await _tu.insertTestCertificate(storage)
124
- const e = await _tu.insertTestCertificateField(
125
- storage,
126
- c,
127
- 'prize',
128
- 'starship'
129
- )
113
+ const e = await _tu.insertTestCertificateField(storage, c, 'prize', 'starship')
130
114
  expect(e.certificateId).toBe(c.certificateId)
131
115
  expect(e.userId).toBe(c.userId)
132
116
  expect(e.fieldName).toBe('prize')
@@ -1,16 +1,6 @@
1
1
  import { _tu, TestSetup1 } from '../utils/TestUtilsWalletStorage'
2
- import {
3
- sdk,
4
- StorageProvider,
5
- StorageKnex,
6
- verifyOne
7
- } from '../../src/index.all'
8
- import {
9
- normalizeDate,
10
- setLogging,
11
- updateTable,
12
- verifyValues
13
- } from '../utils/TestUtilsWalletStorage'
2
+ import { sdk, StorageProvider, StorageKnex, verifyOne } from '../../src/index.all'
3
+ import { normalizeDate, setLogging, updateTable, verifyValues } from '../utils/TestUtilsWalletStorage'
14
4
  import {
15
5
  TableProvenTx,
16
6
  TableProvenTxReq,
@@ -46,12 +36,7 @@ describe('update tests', () => {
46
36
  storages = []
47
37
  const databaseName = testName()
48
38
 
49
- const localSQLiteFile = await _tu.newTmpFile(
50
- `${databaseName}.sqlite`,
51
- false,
52
- false,
53
- true
54
- )
39
+ const localSQLiteFile = await _tu.newTmpFile(`${databaseName}.sqlite`, false, false, true)
55
40
  const knexSQLite = _tu.createLocalSQLite(localSQLiteFile)
56
41
  storages.push(
57
42
  new StorageKnex({
@@ -124,11 +109,7 @@ describe('update tests', () => {
124
109
  merkleRoot: '1234',
125
110
  rawTx: [4, 3, 2, 1]
126
111
  }
127
- await updateTable(
128
- storage.updateProvenTx.bind(storage),
129
- record[primaryKey],
130
- testValues
131
- )
112
+ await updateTable(storage.updateProvenTx.bind(storage), record[primaryKey], testValues)
132
113
  const updatedTx = verifyOne(
133
114
  await storage.findProvenTxs({
134
115
  partial: { [primaryKey]: record[primaryKey] }
@@ -176,9 +157,7 @@ describe('update tests', () => {
176
157
  partial: { [primaryKey]: record[primaryKey] }
177
158
  })
178
159
  )
179
- expect(new Date(updatedRow[key]).toISOString()).toBe(
180
- validDate.toISOString()
181
- )
160
+ expect(new Date(updatedRow[key]).toISOString()).toBe(validDate.toISOString())
182
161
  }
183
162
  if (Array.isArray(value)) {
184
163
  const validArray = value.map(v => v + 1)
@@ -226,10 +205,7 @@ describe('update tests', () => {
226
205
  notify: JSON.stringify({ email: 'test@example.com', sent: true }),
227
206
  rawTx: [1, 2, 3, 4]
228
207
  }
229
- const r1 = await storage.updateProvenTxReq(
230
- record[primaryKey],
231
- testValues
232
- )
208
+ const r1 = await storage.updateProvenTxReq(record[primaryKey], testValues)
233
209
  expect(r1).toBe(1)
234
210
  const updatedRow = verifyOne(
235
211
  await storage.findProvenTxReqs({
@@ -244,37 +220,22 @@ describe('update tests', () => {
244
220
  expect(normalizedActual).toBe(normalizedExpected)
245
221
  continue
246
222
  }
247
- if (
248
- typeof value === 'string' &&
249
- value.startsWith('{') &&
250
- value.endsWith('}')
251
- ) {
223
+ if (typeof value === 'string' && value.startsWith('{') && value.endsWith('}')) {
252
224
  expect(JSON.parse(actualValue)).toStrictEqual(JSON.parse(value))
253
225
  continue
254
226
  }
255
- if (
256
- typeof value === 'string' ||
257
- typeof value === 'number' ||
258
- typeof value === 'boolean'
259
- ) {
227
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
260
228
  expect(actualValue).toBe(value)
261
229
  continue
262
230
  }
263
- if (
264
- typeof actualValue === 'object' &&
265
- actualValue?.type === 'Buffer'
266
- ) {
231
+ if (typeof actualValue === 'object' && actualValue?.type === 'Buffer') {
267
232
  const actualArray = actualValue.data || actualValue
268
233
  const expectedArray =
269
- Buffer.isBuffer(value) || Array.isArray(value)
270
- ? Array.from(value as ArrayLike<number>)
271
- : value
234
+ Buffer.isBuffer(value) || Array.isArray(value) ? Array.from(value as ArrayLike<number>) : value
272
235
  expect(actualArray).toStrictEqual(expectedArray)
273
236
  continue
274
237
  }
275
- expect(
276
- JSON.stringify({ type: 'Buffer', data: actualValue })
277
- ).toStrictEqual(JSON.stringify(value))
238
+ expect(JSON.stringify({ type: 'Buffer', data: actualValue })).toStrictEqual(JSON.stringify(value))
278
239
  }
279
240
  } catch (error: any) {
280
241
  console.error(
@@ -300,10 +261,7 @@ describe('update tests', () => {
300
261
  updated_at: new Date('2024-12-30T23:05:00Z'),
301
262
  activeStorage: storage.getSettings().storageIdentityKey
302
263
  }
303
- const updateResult = await storage.updateUser(
304
- record[primaryKey],
305
- testValues
306
- )
264
+ const updateResult = await storage.updateUser(record[primaryKey], testValues)
307
265
  expect(updateResult).toBe(1)
308
266
  const updatedRow = verifyOne(
309
267
  await storage.findUsers({
@@ -350,10 +308,7 @@ describe('update tests', () => {
350
308
  signature: 'mockSignature',
351
309
  subject: 'mockSubject'
352
310
  }
353
- const r1 = await storage.updateCertificate(
354
- record[primaryKey],
355
- testValues
356
- )
311
+ const r1 = await storage.updateCertificate(record[primaryKey], testValues)
357
312
  expect(r1).toBe(1)
358
313
  const updatedRow = verifyOne(
359
314
  await storage.findCertificates({
@@ -368,11 +323,7 @@ describe('update tests', () => {
368
323
  expect(normalizedActual).toBe(normalizedExpected)
369
324
  continue
370
325
  }
371
- if (
372
- typeof value === 'string' &&
373
- value.startsWith('{') &&
374
- value.endsWith('}')
375
- ) {
326
+ if (typeof value === 'string' && value.startsWith('{') && value.endsWith('}')) {
376
327
  expect(JSON.parse(actualValue)).toStrictEqual(JSON.parse(value))
377
328
  continue
378
329
  }
@@ -382,9 +333,7 @@ describe('update tests', () => {
382
333
  } else if (value === 0) {
383
334
  expect(actualValue).toBe(false)
384
335
  } else {
385
- throw new Error(
386
- `Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
387
- )
336
+ throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
388
337
  }
389
338
  continue
390
339
  }
@@ -392,21 +341,14 @@ describe('update tests', () => {
392
341
  expect(actualValue).toBe(value)
393
342
  continue
394
343
  }
395
- if (
396
- typeof actualValue === 'object' &&
397
- actualValue?.type === 'Buffer'
398
- ) {
344
+ if (typeof actualValue === 'object' && actualValue?.type === 'Buffer') {
399
345
  const actualArray = actualValue.data || actualValue
400
346
  const expectedArray =
401
- Buffer.isBuffer(value) || Array.isArray(value)
402
- ? Array.from(value as ArrayLike<number>)
403
- : value
347
+ Buffer.isBuffer(value) || Array.isArray(value) ? Array.from(value as ArrayLike<number>) : value
404
348
  expect(actualArray).toStrictEqual(expectedArray)
405
349
  continue
406
350
  }
407
- expect(
408
- JSON.stringify({ type: 'Buffer', data: actualValue })
409
- ).toStrictEqual(JSON.stringify(value))
351
+ expect(JSON.stringify({ type: 'Buffer', data: actualValue })).toStrictEqual(JSON.stringify(value))
410
352
  }
411
353
  } catch (error: any) {
412
354
  console.error(
@@ -489,10 +431,7 @@ describe('update tests', () => {
489
431
  minimumDesiredUTXOValue: 5000,
490
432
  isDeleted: false
491
433
  }
492
- const updateResult = await storage.updateOutputBasket(
493
- record.basketId,
494
- testValues
495
- )
434
+ const updateResult = await storage.updateOutputBasket(record.basketId, testValues)
496
435
  expect(updateResult).toBe(1)
497
436
  const updatedRecords = await storage.findOutputBaskets({
498
437
  partial: { basketId: record.basketId, name: testValues.name }
@@ -509,9 +448,7 @@ describe('update tests', () => {
509
448
  } else if (value === 0) {
510
449
  expect(actualValue).toBe(false)
511
450
  } else {
512
- throw new Error(
513
- `Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
514
- )
451
+ throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
515
452
  }
516
453
  continue
517
454
  }
@@ -555,10 +492,7 @@ describe('update tests', () => {
555
492
  satoshis: 20000,
556
493
  version: 2
557
494
  }
558
- const updateResult = await storage.updateTransaction(
559
- record.transactionId,
560
- testValues
561
- )
495
+ const updateResult = await storage.updateTransaction(record.transactionId, testValues)
562
496
  expect(updateResult).toBe(1)
563
497
  const updatedRecords = await storage.findTransactions({
564
498
  partial: { transactionId: record.transactionId }
@@ -589,9 +523,7 @@ describe('update tests', () => {
589
523
  })
590
524
 
591
525
  test('7a updateTransactionStatus', async () => {
592
- const { activeStorage: storage } = await _tu.createLegacyWalletSQLiteCopy(
593
- 'updateTransactionStatus6a'
594
- )
526
+ const { activeStorage: storage } = await _tu.createLegacyWalletSQLiteCopy('updateTransactionStatus6a')
595
527
 
596
528
  let tx = verifyOne(
597
529
  await storage.findTransactions({
@@ -628,10 +560,7 @@ describe('update tests', () => {
628
560
  isRedeemed: true,
629
561
  lockingScript: [1, 2, 3, 4]
630
562
  }
631
- const updateResult = await storage.updateCommission(
632
- record.commissionId,
633
- testValues
634
- )
563
+ const updateResult = await storage.updateCommission(record.commissionId, testValues)
635
564
  expect(updateResult).toBe(1)
636
565
  const updatedRecords = await storage.findCommissions({
637
566
  partial: { commissionId: record.commissionId }
@@ -649,9 +578,7 @@ describe('update tests', () => {
649
578
  continue
650
579
  }
651
580
  if (Buffer.isBuffer(actualValue) || Array.isArray(actualValue)) {
652
- expect(
653
- JSON.stringify({ type: 'Buffer', data: actualValue })
654
- ).toStrictEqual(JSON.stringify(value))
581
+ expect(JSON.stringify({ type: 'Buffer', data: actualValue })).toStrictEqual(JSON.stringify(value))
655
582
  continue
656
583
  }
657
584
  expect(actualValue).toBe(value)
@@ -675,22 +602,16 @@ describe('update tests', () => {
675
602
  if (!record.transactionId) record.transactionId = 1
676
603
  if (!record.basketId) record.basketId = 1
677
604
  if (!record.userId || !record.transactionId || !record.basketId) {
678
- throw new Error(
679
- `Missing required foreign keys for record ${JSON.stringify(record)}`
680
- )
605
+ throw new Error(`Missing required foreign keys for record ${JSON.stringify(record)}`)
681
606
  }
682
607
  }
683
608
  for (const record of records) {
684
609
  const existingRecords = await storage.findOutputs({ partial: {} })
685
- const usedCombinations = new Set(
686
- existingRecords.map(r => `${r.transactionId}-${r.vout}-${r.userId}`)
687
- )
610
+ const usedCombinations = new Set(existingRecords.map(r => `${r.transactionId}-${r.vout}-${r.userId}`))
688
611
  let testTransactionId = record.transactionId
689
612
  let testVout = record.vout + 1
690
613
  let testUserId = record.userId
691
- while (
692
- usedCombinations.has(`${testTransactionId}-${testVout}-${testUserId}`)
693
- ) {
614
+ while (usedCombinations.has(`${testTransactionId}-${testVout}-${testUserId}`)) {
694
615
  testVout += 1
695
616
  }
696
617
  try {
@@ -721,10 +642,7 @@ describe('update tests', () => {
721
642
  type: 'updated_type',
722
643
  outputDescription: 'outputDescription'
723
644
  }
724
- const updateResult = await storage.updateOutput(
725
- record.outputId,
726
- testValues
727
- )
645
+ const updateResult = await storage.updateOutput(record.outputId, testValues)
728
646
  expect(updateResult).toBe(1)
729
647
  const updatedRecords = await storage.findOutputs({
730
648
  partial: { outputId: record.outputId }
@@ -742,18 +660,13 @@ describe('update tests', () => {
742
660
  continue
743
661
  }
744
662
  if (Buffer.isBuffer(actualValue) || Array.isArray(actualValue)) {
745
- expect(
746
- JSON.stringify({ type: 'Buffer', data: actualValue })
747
- ).toStrictEqual(JSON.stringify(value))
663
+ expect(JSON.stringify({ type: 'Buffer', data: actualValue })).toStrictEqual(JSON.stringify(value))
748
664
  continue
749
665
  }
750
666
  expect(actualValue).toBe(value)
751
667
  }
752
668
  } catch (error: any) {
753
- console.error(
754
- `Error updating or verifying Output record with outputId=${record[primaryKey]}:`,
755
- error.message
756
- )
669
+ console.error(`Error updating or verifying Output record with outputId=${record[primaryKey]}:`, error.message)
757
670
  throw error
758
671
  }
759
672
  }
@@ -768,9 +681,7 @@ describe('update tests', () => {
768
681
  if (!record.userId) record.userId = 1
769
682
  if (!record.tag) record.tag = `default_tag_${record.outputTagId}`
770
683
  if (!record.userId || !record.tag) {
771
- throw new Error(
772
- `Missing required fields for record ${JSON.stringify(record)}`
773
- )
684
+ throw new Error(`Missing required fields for record ${JSON.stringify(record)}`)
774
685
  }
775
686
  }
776
687
  for (const record of records) {
@@ -784,10 +695,7 @@ describe('update tests', () => {
784
695
  isDeleted: false
785
696
  }
786
697
  try {
787
- const updateResult = await storage.updateOutputTag(
788
- record.outputTagId,
789
- testValues
790
- )
698
+ const updateResult = await storage.updateOutputTag(record.outputTagId, testValues)
791
699
  expect(updateResult).toBe(1)
792
700
  const updatedRecords = await storage.findOutputTags({
793
701
  partial: { outputTagId: record.outputTagId }
@@ -804,9 +712,7 @@ describe('update tests', () => {
804
712
  } else if (value === 0) {
805
713
  expect(actualValue).toBe(false)
806
714
  } else {
807
- throw new Error(
808
- `Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
809
- )
715
+ throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
810
716
  }
811
717
  continue
812
718
  }
@@ -834,14 +740,8 @@ describe('update tests', () => {
834
740
  for (const { storage } of setups) {
835
741
  const records = await storage.findOutputTagMaps({ partial: {} })
836
742
  for (const record of records) {
837
- if (!record.outputTagId)
838
- throw new Error(
839
- `Missing outputTagId for record: ${JSON.stringify(record)}`
840
- )
841
- if (!record.outputId)
842
- throw new Error(
843
- `Missing outputId for record: ${JSON.stringify(record)}`
844
- )
743
+ if (!record.outputTagId) throw new Error(`Missing outputTagId for record: ${JSON.stringify(record)}`)
744
+ if (!record.outputId) throw new Error(`Missing outputId for record: ${JSON.stringify(record)}`)
845
745
  try {
846
746
  const testValues: TableOutputTagMap = {
847
747
  outputTagId: record.outputTagId,
@@ -850,11 +750,7 @@ describe('update tests', () => {
850
750
  updated_at: new Date('2024-12-30T23:05:00Z'),
851
751
  isDeleted: false
852
752
  }
853
- const updateResult = await storage.updateOutputTagMap(
854
- record.outputId,
855
- record.outputTagId,
856
- testValues
857
- )
753
+ const updateResult = await storage.updateOutputTagMap(record.outputId, record.outputTagId, testValues)
858
754
  expect(updateResult).toBe(1)
859
755
  const updatedRecords = await storage.findOutputTagMaps({
860
756
  partial: {
@@ -874,9 +770,7 @@ describe('update tests', () => {
874
770
  } else if (value === 0) {
875
771
  expect(actualValue).toBe(false)
876
772
  } else {
877
- throw new Error(
878
- `Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
879
- )
773
+ throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
880
774
  }
881
775
  continue
882
776
  }
@@ -905,9 +799,7 @@ describe('update tests', () => {
905
799
  const records = await storage.findTxLabels({ partial: {} })
906
800
  for (const record of records) {
907
801
  if (!record.userId) {
908
- throw new Error(
909
- `Missing required foreign key userId for record ${JSON.stringify(record)}`
910
- )
802
+ throw new Error(`Missing required foreign key userId for record ${JSON.stringify(record)}`)
911
803
  }
912
804
  }
913
805
  for (const record of records) {
@@ -926,10 +818,7 @@ describe('update tests', () => {
926
818
  if (existingLabel.length > 0) {
927
819
  continue
928
820
  }
929
- const updateResult = await storage.updateTxLabel(
930
- record.txLabelId,
931
- testValues
932
- )
821
+ const updateResult = await storage.updateTxLabel(record.txLabelId, testValues)
933
822
  expect(updateResult).toBe(1)
934
823
  const updatedRecords = await storage.findTxLabels({
935
824
  partial: { txLabelId: record.txLabelId }
@@ -946,9 +835,7 @@ describe('update tests', () => {
946
835
  } else if (value === 0) {
947
836
  expect(actualValue).toBe(false)
948
837
  } else {
949
- throw new Error(
950
- `Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
951
- )
838
+ throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
952
839
  }
953
840
  continue
954
841
  }
@@ -971,9 +858,7 @@ describe('update tests', () => {
971
858
  const records = await storage.findTxLabelMaps({ partial: {} })
972
859
  for (const record of records) {
973
860
  if (!record.transactionId || !record.txLabelId) {
974
- throw new Error(
975
- `Missing required foreign keys for record ${JSON.stringify(record)}`
976
- )
861
+ throw new Error(`Missing required foreign keys for record ${JSON.stringify(record)}`)
977
862
  }
978
863
  }
979
864
  for (const record of records) {
@@ -994,11 +879,7 @@ describe('update tests', () => {
994
879
  continue
995
880
  }
996
881
  try {
997
- const updateResult = await storage.updateTxLabelMap(
998
- record.transactionId,
999
- record.txLabelId,
1000
- testValues
1001
- )
882
+ const updateResult = await storage.updateTxLabelMap(record.transactionId, record.txLabelId, testValues)
1002
883
  expect(updateResult).toBe(1)
1003
884
  const updatedRecords = await storage.findTxLabelMaps({
1004
885
  partial: {
@@ -1044,10 +925,7 @@ describe('update tests', () => {
1044
925
  event: 'updated_event',
1045
926
  details: 'Updated details'
1046
927
  }
1047
- const updateResult = await storage.updateMonitorEvent(
1048
- record.id,
1049
- testValues
1050
- )
928
+ const updateResult = await storage.updateMonitorEvent(record.id, testValues)
1051
929
  expect(updateResult).toBe(1)
1052
930
  const updatedRecords = await storage.findMonitorEvents({
1053
931
  partial: { id: record.id }
@@ -1067,10 +945,7 @@ describe('update tests', () => {
1067
945
  expect(actualValue).toBe(value)
1068
946
  }
1069
947
  } catch (error: any) {
1070
- console.error(
1071
- `Error updating or verifying MonitorEvent record with id=${record[primaryKey]}:`,
1072
- error.message
1073
- )
948
+ console.error(`Error updating or verifying MonitorEvent record with id=${record[primaryKey]}:`, error.message)
1074
949
  throw error
1075
950
  }
1076
951
  }
@@ -1083,9 +958,7 @@ describe('update tests', () => {
1083
958
  const records = await storage.findSyncStates({ partial: {} })
1084
959
  for (const record of records) {
1085
960
  if (!record.userId) {
1086
- throw new Error(
1087
- `Missing required foreign key userId for record ${JSON.stringify(record)}`
1088
- )
961
+ throw new Error(`Missing required foreign key userId for record ${JSON.stringify(record)}`)
1089
962
  }
1090
963
  }
1091
964
  for (const record of records) {
@@ -1105,10 +978,7 @@ describe('update tests', () => {
1105
978
  syncMap: '{}',
1106
979
  when: new Date('2025-01-01T02:00:00.000Z')
1107
980
  }
1108
- const updateResult = await storage.updateSyncState(
1109
- record.syncStateId,
1110
- testValues
1111
- )
981
+ const updateResult = await storage.updateSyncState(record.syncStateId, testValues)
1112
982
  expect(updateResult).toBe(1)
1113
983
  const updatedRecords = await storage.findSyncStates({
1114
984
  partial: { syncStateId: record.syncStateId }
@@ -1125,9 +995,7 @@ describe('update tests', () => {
1125
995
  } else if (value === 0) {
1126
996
  expect(actualValue).toBe(false)
1127
997
  } else {
1128
- throw new Error(
1129
- `Unexpected value for expectedValue: ${value}. Must be 0 or 1.`
1130
- )
998
+ throw new Error(`Unexpected value for expectedValue: ${value}. Must be 0 or 1.`)
1131
999
  }
1132
1000
  continue
1133
1001
  }