@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,16 +1,6 @@
1
- import {
2
- Beef,
3
- CreateActionArgs,
4
- InternalizeActionArgs,
5
- P2PKH,
6
- WalletProtocol
7
- } from '@bsv/sdk'
1
+ import { Beef, CreateActionArgs, InternalizeActionArgs, P2PKH, WalletProtocol } from '@bsv/sdk'
8
2
  import { sdk } from '../../../src/index.all'
9
- import {
10
- _tu,
11
- expectToThrowWERR,
12
- TestWalletNoSetup
13
- } from '../../utils/TestUtilsWalletStorage'
3
+ import { _tu, expectToThrowWERR, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
14
4
 
15
5
  describe('internalizeAction tests', () => {
16
6
  jest.setTimeout(99999999)
@@ -21,13 +11,8 @@ describe('internalizeAction tests', () => {
21
11
  const useSharedCtxs = true
22
12
 
23
13
  beforeAll(async () => {
24
- if (env.runMySQL)
25
- gctxs.push(
26
- await _tu.createLegacyWalletMySQLCopy('actionInternalizeActionTests')
27
- )
28
- gctxs.push(
29
- await _tu.createLegacyWalletSQLiteCopy('actionInternalizeActionTests')
30
- )
14
+ if (env.runMySQL) gctxs.push(await _tu.createLegacyWalletMySQLCopy('actionInternalizeActionTests'))
15
+ gctxs.push(await _tu.createLegacyWalletSQLiteCopy('actionInternalizeActionTests'))
31
16
  })
32
17
 
33
18
  afterAll(async () => {
@@ -51,9 +36,7 @@ describe('internalizeAction tests', () => {
51
36
  ]
52
37
 
53
38
  for (const args of invalidArgs) {
54
- await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () =>
55
- wallet.internalizeAction(args)
56
- )
39
+ await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () => wallet.internalizeAction(args))
57
40
  }
58
41
  }
59
42
  })
@@ -62,13 +45,8 @@ describe('internalizeAction tests', () => {
62
45
  const ctxs: TestWalletNoSetup[] = []
63
46
  if (useSharedCtxs) ctxs.push(...gctxs)
64
47
  else {
65
- if (env.runMySQL)
66
- ctxs.push(
67
- await _tu.createLegacyWalletMySQLCopy('actionInternalizeAction1Tests')
68
- )
69
- ctxs.push(
70
- await _tu.createLegacyWalletSQLiteCopy('actionInternalizeAction1Tests')
71
- )
48
+ if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('actionInternalizeAction1Tests'))
49
+ ctxs.push(await _tu.createLegacyWalletSQLiteCopy('actionInternalizeAction1Tests'))
72
50
  }
73
51
  for (const { wallet } of ctxs) {
74
52
  const root = '02135476'
@@ -133,9 +111,7 @@ describe('internalizeAction tests', () => {
133
111
  expect(ro[0].satoshis).toBe(outputSatoshis)
134
112
 
135
113
  // Validate custom instructions and tags
136
- expect(ro[0].customInstructions).toBe(
137
- JSON.stringify({ root, repeat: 8 })
138
- )
114
+ expect(ro[0].customInstructions).toBe(JSON.stringify({ root, repeat: 8 }))
139
115
  const rtm = await fred.activeStorage.findOutputTagMaps({
140
116
  partial: { outputId: 1 }
141
117
  })
@@ -167,13 +143,8 @@ describe('internalizeAction tests', () => {
167
143
  const ctxs: TestWalletNoSetup[] = []
168
144
  if (useSharedCtxs) ctxs.push(...gctxs)
169
145
  else {
170
- if (env.runMySQL)
171
- ctxs.push(
172
- await _tu.createLegacyWalletMySQLCopy('actionInternalizeAction2Tests')
173
- )
174
- ctxs.push(
175
- await _tu.createLegacyWalletSQLiteCopy('actionInternalizeAction2Tests')
176
- )
146
+ if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('actionInternalizeAction2Tests'))
147
+ ctxs.push(await _tu.createLegacyWalletSQLiteCopy('actionInternalizeAction2Tests'))
177
148
  }
178
149
  for (const { wallet } of ctxs) {
179
150
  const root = '02135476'
@@ -255,9 +226,7 @@ describe('internalizeAction tests', () => {
255
226
  expect(ro[0].satoshis).toBe(outputSatoshis1)
256
227
 
257
228
  // Validate custom instructions and tags
258
- expect(ro[0].customInstructions).toBe(
259
- JSON.stringify({ root, repeat: 8 })
260
- )
229
+ expect(ro[0].customInstructions).toBe(JSON.stringify({ root, repeat: 8 }))
261
230
  const rtm = await fred.activeStorage.findOutputTagMaps({
262
231
  partial: { outputId: 1 }
263
232
  })
@@ -277,9 +246,7 @@ describe('internalizeAction tests', () => {
277
246
  expect(ro[0].basketId).toBe(2)
278
247
  expect(ro[0].satoshis).toBe(outputSatoshis2)
279
248
 
280
- expect(ro[0].customInstructions).toBe(
281
- JSON.stringify({ root, repeat: 8 })
282
- )
249
+ expect(ro[0].customInstructions).toBe(JSON.stringify({ root, repeat: 8 }))
283
250
  const rtm = await fred.activeStorage.findOutputTagMaps({
284
251
  partial: { outputId: 2 }
285
252
  })
@@ -311,13 +278,8 @@ describe('internalizeAction tests', () => {
311
278
  const ctxs: TestWalletNoSetup[] = []
312
279
  if (useSharedCtxs) ctxs.push(...gctxs)
313
280
  else {
314
- if (env.runMySQL)
315
- ctxs.push(
316
- await _tu.createLegacyWalletMySQLCopy('actionInternalizeAction3Tests')
317
- )
318
- ctxs.push(
319
- await _tu.createLegacyWalletSQLiteCopy('actionInternalizeAction3Tests')
320
- )
281
+ if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('actionInternalizeAction3Tests'))
282
+ ctxs.push(await _tu.createLegacyWalletSQLiteCopy('actionInternalizeAction3Tests'))
321
283
  }
322
284
  for (const { wallet, identityKey: senderIdentityKey } of ctxs) {
323
285
  const fred = await _tu.createSQLiteTestWallet({
@@ -407,13 +369,8 @@ describe('internalizeAction tests', () => {
407
369
  const ctxs: TestWalletNoSetup[] = []
408
370
  if (useSharedCtxs) ctxs.push(...gctxs)
409
371
  else {
410
- if (env.runMySQL)
411
- ctxs.push(
412
- await _tu.createLegacyWalletMySQLCopy('actionInternalizeAction4Tests')
413
- )
414
- ctxs.push(
415
- await _tu.createLegacyWalletSQLiteCopy('actionInternalizeAction4Tests')
416
- )
372
+ if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('actionInternalizeAction4Tests'))
373
+ ctxs.push(await _tu.createLegacyWalletSQLiteCopy('actionInternalizeAction4Tests'))
417
374
  }
418
375
  for (const { wallet, identityKey: senderIdentityKey } of ctxs) {
419
376
  const fred = await _tu.createSQLiteTestWallet({
@@ -529,13 +486,8 @@ describe('internalizeAction tests', () => {
529
486
 
530
487
  test('5_internalize 2 wallet payments and 2 basket insertions in receiving wallet with checks', async () => {
531
488
  const ctxs: TestWalletNoSetup[] = []
532
- if (env.runMySQL)
533
- ctxs.push(
534
- await _tu.createLegacyWalletMySQLCopy('actionInternalizeAction5Tests')
535
- )
536
- ctxs.push(
537
- await _tu.createLegacyWalletSQLiteCopy('actionInternalizeAction5Tests')
538
- )
489
+ if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('actionInternalizeAction5Tests'))
490
+ ctxs.push(await _tu.createLegacyWalletSQLiteCopy('actionInternalizeAction5Tests'))
539
491
  for (const { wallet, identityKey: senderIdentityKey } of ctxs) {
540
492
  const fred = await _tu.createSQLiteTestWallet({
541
493
  chain: 'test',
@@ -678,9 +630,7 @@ describe('internalizeAction tests', () => {
678
630
  expect(ro[0].basketId).toBe(2)
679
631
  expect(ro[0].satoshis).toBe(outputSatoshis3)
680
632
 
681
- expect(ro[0].customInstructions).toBe(
682
- `3rd payment ${JSON.stringify({ root, repeat: 8 })}`
683
- )
633
+ expect(ro[0].customInstructions).toBe(`3rd payment ${JSON.stringify({ root, repeat: 8 })}`)
684
634
  const rtm = await fred.activeStorage.findOutputTagMaps({
685
635
  partial: { outputId: 3 }
686
636
  })
@@ -700,9 +650,7 @@ describe('internalizeAction tests', () => {
700
650
  expect(ro[0].basketId).toBe(2)
701
651
  expect(ro[0].satoshis).toBe(outputSatoshis4)
702
652
 
703
- expect(ro[0].customInstructions).toBe(
704
- `4th payment ${JSON.stringify({ root, repeat: 8 })}`
705
- )
653
+ expect(ro[0].customInstructions).toBe(`4th payment ${JSON.stringify({ root, repeat: 8 })}`)
706
654
  const rtm = await fred.activeStorage.findOutputTagMaps({
707
655
  partial: { outputId: 4 }
708
656
  })
@@ -1,10 +1,6 @@
1
1
  import { RelinquishOutputArgs } from '@bsv/sdk'
2
2
  import { sdk, StorageKnex } from '../../../src/index.all'
3
- import {
4
- _tu,
5
- expectToThrowWERR,
6
- TestWalletNoSetup
7
- } from '../../utils/TestUtilsWalletStorage'
3
+ import { _tu, expectToThrowWERR, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
8
4
  import { getBeefForTransaction } from '../../../src/storage/methods/getBeefForTransaction'
9
5
 
10
6
  describe('RelinquishOutputArgs tests', () => {
@@ -14,8 +10,7 @@ describe('RelinquishOutputArgs tests', () => {
14
10
  const ctxs: TestWalletNoSetup[] = []
15
11
 
16
12
  beforeAll(async () => {
17
- if (env.runMySQL)
18
- ctxs.push(await _tu.createLegacyWalletMySQLCopy('relinquishActionTests'))
13
+ if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('relinquishActionTests'))
19
14
  ctxs.push(await _tu.createLegacyWalletSQLiteCopy('relinquishActionTests'))
20
15
  })
21
16
 
@@ -26,8 +21,7 @@ describe('RelinquishOutputArgs tests', () => {
26
21
  })
27
22
 
28
23
  test('1_default', async () => {
29
- const outputTxid =
30
- '2795b293c698b2244147aaba745db887a632d21990c474df46d842ec3e52f122'
24
+ const outputTxid = '2795b293c698b2244147aaba745db887a632d21990c474df46d842ec3e52f122'
31
25
  const expectedResult = { relinquished: true }
32
26
 
33
27
  for (const { wallet, activeStorage: storage } of ctxs) {
@@ -1,11 +1,6 @@
1
1
  import { ListActionsArgs } from '@bsv/sdk'
2
2
  import { sdk, StorageProvider } from '../../../src/index.client'
3
- import {
4
- _tu,
5
- expectToThrowWERR,
6
- TestSetup1,
7
- TestWalletNoSetup
8
- } from '../../utils/TestUtilsWalletStorage'
3
+ import { _tu, expectToThrowWERR, TestSetup1, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
9
4
 
10
5
  describe('listActions tests', () => {
11
6
  jest.setTimeout(99999999)
@@ -40,9 +35,7 @@ describe('listActions tests', () => {
40
35
  ]
41
36
 
42
37
  for (const args of invalidArgs) {
43
- await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () =>
44
- wallet.listActions(args)
45
- )
38
+ await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () => wallet.listActions(args))
46
39
  }
47
40
  }
48
41
  })
@@ -1,11 +1,6 @@
1
1
  import * as bsv from '@bsv/sdk'
2
2
  import { sdk, StorageProvider } from '../../../src/index.client'
3
- import {
4
- _tu,
5
- expectToThrowWERR,
6
- MockData,
7
- TestWalletNoSetup
8
- } from '../../utils/TestUtilsWalletStorage'
3
+ import { _tu, expectToThrowWERR, MockData, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
9
4
 
10
5
  const env = _tu.getEnv('test')
11
6
  const testName = () => expect.getState().currentTestName || 'test'
@@ -119,10 +114,7 @@ describe('listActions2 single action tests', () => {
119
114
  labels: ['']
120
115
  }
121
116
 
122
- await expectToThrowWERR(
123
- sdk.WERR_INVALID_PARAMETER,
124
- async () => await wallet.listActions(args)
125
- )
117
+ await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, async () => await wallet.listActions(args))
126
118
  }
127
119
  })
128
120
 
@@ -132,10 +124,7 @@ describe('listActions2 single action tests', () => {
132
124
  labels: [' ']
133
125
  }
134
126
 
135
- await expectToThrowWERR(
136
- sdk.WERR_INVALID_PARAMETER,
137
- async () => await wallet.listActions(args)
138
- )
127
+ await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, async () => await wallet.listActions(args))
139
128
  }
140
129
  })
141
130
 
@@ -174,10 +163,7 @@ describe('listActions2 single action tests', () => {
174
163
  labels: [maxLengthSpacesLabel]
175
164
  }
176
165
 
177
- await expectToThrowWERR(
178
- sdk.WERR_INVALID_PARAMETER,
179
- async () => await wallet.listActions(args)
180
- )
166
+ await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, async () => await wallet.listActions(args))
181
167
  }
182
168
  })
183
169
 
@@ -236,10 +222,7 @@ describe('listActions2 single action tests', () => {
236
222
  labels: [exceedingMaximumEmojisLabel]
237
223
  }
238
224
 
239
- await expectToThrowWERR(
240
- sdk.WERR_INVALID_PARAMETER,
241
- async () => await wallet.listActions(args)
242
- )
225
+ await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, async () => await wallet.listActions(args))
243
226
  }
244
227
  })
245
228
 
@@ -887,10 +870,7 @@ describe('listActions2 single action tests', () => {
887
870
  limit: 0
888
871
  }
889
872
 
890
- await expectToThrowWERR(
891
- sdk.WERR_INVALID_PARAMETER,
892
- async () => await wallet.listActions(args)
893
- )
873
+ await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, async () => await wallet.listActions(args))
894
874
  }
895
875
  })
896
876
 
@@ -901,10 +881,7 @@ describe('listActions2 single action tests', () => {
901
881
  limit: 10001
902
882
  }
903
883
 
904
- await expectToThrowWERR(
905
- sdk.WERR_INVALID_PARAMETER,
906
- async () => await wallet.listActions(args)
907
- )
884
+ await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, async () => await wallet.listActions(args))
908
885
  }
909
886
  })
910
887
 
@@ -1006,10 +983,7 @@ describe('listActions2 single action tests', () => {
1006
983
  offset: -1
1007
984
  }
1008
985
 
1009
- await expectToThrowWERR(
1010
- sdk.WERR_INVALID_PARAMETER,
1011
- async () => await wallet.listActions(args)
1012
- )
986
+ await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, async () => await wallet.listActions(args))
1013
987
  }
1014
988
  })
1015
989
 
@@ -1,10 +1,6 @@
1
1
  import { ListCertificatesArgs } from '@bsv/sdk'
2
2
  import { sdk } from '../../../src/index.client'
3
- import {
4
- _tu,
5
- expectToThrowWERR,
6
- TestWalletNoSetup
7
- } from '../../utils/TestUtilsWalletStorage'
3
+ import { _tu, expectToThrowWERR, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
8
4
 
9
5
  describe('listCertificates tests', () => {
10
6
  jest.setTimeout(99999999)
@@ -13,8 +9,7 @@ describe('listCertificates tests', () => {
13
9
  const ctxs: TestWalletNoSetup[] = []
14
10
 
15
11
  beforeAll(async () => {
16
- if (env.runMySQL)
17
- ctxs.push(await _tu.createLegacyWalletMySQLCopy('listCertificatesTests'))
12
+ if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('listCertificatesTests'))
18
13
  ctxs.push(await _tu.createLegacyWalletSQLiteCopy('listCertificatesTests'))
19
14
  })
20
15
 
@@ -35,9 +30,7 @@ describe('listCertificates tests', () => {
35
30
  ]
36
31
 
37
32
  for (const args of invalidArgs) {
38
- await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () =>
39
- wallet.listCertificates(args)
40
- )
33
+ await expectToThrowWERR(sdk.WERR_INVALID_PARAMETER, () => wallet.listCertificates(args))
41
34
  }
42
35
  }
43
36
  })
@@ -47,9 +40,7 @@ describe('listCertificates tests', () => {
47
40
  const tcs: { args: ListCertificatesArgs; count: number }[] = [
48
41
  {
49
42
  args: {
50
- certifiers: [
51
- '02cf6cdf466951d8dfc9e7c9367511d0007ed6fba35ed42d425cc412fd6cfd4a17'
52
- ],
43
+ certifiers: ['02cf6cdf466951d8dfc9e7c9367511d0007ed6fba35ed42d425cc412fd6cfd4a17'],
53
44
  types: [],
54
45
  limit: 1
55
46
  },
@@ -57,9 +48,7 @@ describe('listCertificates tests', () => {
57
48
  },
58
49
  {
59
50
  args: {
60
- certifiers: [
61
- '02CF6CDF466951D8DFC9E7C9367511D0007ED6FBA35ED42D425CC412FD6CFD4A17'
62
- ],
51
+ certifiers: ['02CF6CDF466951D8DFC9E7C9367511D0007ED6FBA35ED42D425CC412FD6CFD4A17'],
63
52
  types: [],
64
53
  limit: 10
65
54
  },
@@ -8,11 +8,7 @@ import {
8
8
  OutputTagStringUnder300Bytes
9
9
  } from '@bsv/sdk'
10
10
  import { sdk, StorageKnex } from '../../../src/index.all'
11
- import {
12
- _tu,
13
- expectToThrowWERR,
14
- TestWalletNoSetup
15
- } from '../../utils/TestUtilsWalletStorage'
11
+ import { _tu, expectToThrowWERR, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
16
12
 
17
13
  const noLog = true
18
14
 
@@ -26,8 +22,7 @@ describe('listOutputs test', () => {
26
22
  const ctxs: TestWalletNoSetup[] = []
27
23
 
28
24
  beforeAll(async () => {
29
- if (env.runMySQL)
30
- ctxs.push(await _tu.createLegacyWalletMySQLCopy('listOutputsTests'))
25
+ if (env.runMySQL) ctxs.push(await _tu.createLegacyWalletMySQLCopy('listOutputsTests'))
31
26
  ctxs.push(await _tu.createLegacyWalletSQLiteCopy('listOutputsTests'))
32
27
  })
33
28
 
@@ -44,12 +39,9 @@ describe('listOutputs test', () => {
44
39
  for (const o of r.outputs) {
45
40
  log += `${i++} ${o.outpoint} ${o.satoshis} ${o.spendable}\n`
46
41
  if (o.tags && o.tags.length > 0) log += ` tags: ${o.tags?.join(',')}\n`
47
- if (o.labels && o.labels.length > 0)
48
- log += ` labels: ${o.labels?.join(',')}\n`
49
- if (o.customInstructions)
50
- log += ` customInstructions: ${o.customInstructions}\n`
51
- if (o.lockingScript)
52
- log += ` lockingScript: ${o.lockingScript.length} ${truncate(o.lockingScript)}\n`
42
+ if (o.labels && o.labels.length > 0) log += ` labels: ${o.labels?.join(',')}\n`
43
+ if (o.customInstructions) log += ` customInstructions: ${o.customInstructions}\n`
44
+ if (o.lockingScript) log += ` lockingScript: ${o.lockingScript.length} ${truncate(o.lockingScript)}\n`
53
45
  }
54
46
  if (r.BEEF) {
55
47
  const beef = Beef.fromBinary(r.BEEF)
@@ -82,13 +74,9 @@ describe('listOutputs test', () => {
82
74
 
83
75
  for (const args of invalidArgs) {
84
76
  for (const originator of invalidOriginators) {
85
- if (!noLog)
86
- console.log('Testing args:', args, 'with originator:', originator)
77
+ if (!noLog) console.log('Testing args:', args, 'with originator:', originator)
87
78
  try {
88
- await wallet.listOutputs(
89
- args,
90
- originator as OriginatorDomainNameStringUnder250Bytes
91
- )
79
+ await wallet.listOutputs(args, originator as OriginatorDomainNameStringUnder250Bytes)
92
80
  throw new Error('Expected method to throw.')
93
81
  } catch (e) {
94
82
  const error = e as Error
@@ -119,24 +107,11 @@ describe('listOutputs test', () => {
119
107
  seekPermission: true
120
108
  }
121
109
 
122
- const validOriginators = [
123
- 'example.com',
124
- 'localhost',
125
- 'subdomain.example.com'
126
- ]
110
+ const validOriginators = ['example.com', 'localhost', 'subdomain.example.com']
127
111
 
128
112
  for (const originator of validOriginators) {
129
- if (!noLog)
130
- console.log(
131
- 'Testing args:',
132
- validArgs,
133
- 'with originator:',
134
- originator
135
- )
136
- const result = await wallet.listOutputs(
137
- validArgs,
138
- originator as OriginatorDomainNameStringUnder250Bytes
139
- )
113
+ if (!noLog) console.log('Testing args:', validArgs, 'with originator:', originator)
114
+ const result = await wallet.listOutputs(validArgs, originator as OriginatorDomainNameStringUnder250Bytes)
140
115
  if (!noLog) console.log('Result:', result)
141
116
  expect(result.totalOutputs).toBeGreaterThanOrEqual(0)
142
117
  }
@@ -173,16 +148,9 @@ describe('listOutputs test', () => {
173
148
  const args: ListOutputsArgs = {
174
149
  basket: 'default'
175
150
  }
176
- const validOriginators = [
177
- 'example.com',
178
- 'localhost',
179
- 'subdomain.example.com'
180
- ]
151
+ const validOriginators = ['example.com', 'localhost', 'subdomain.example.com']
181
152
  for (const originator of validOriginators) {
182
- const result = await wallet.listOutputs(
183
- args,
184
- originator as OriginatorDomainNameStringUnder250Bytes
185
- )
153
+ const result = await wallet.listOutputs(args, originator as OriginatorDomainNameStringUnder250Bytes)
186
154
  }
187
155
  const r = await wallet.listOutputs(args)
188
156
  log += logResult(r)
@@ -300,11 +268,7 @@ describe('listOutputs test', () => {
300
268
  const r = await wallet.listOutputs(args)
301
269
  log += logResult(r)
302
270
  expect(r.BEEF).toBeTruthy()
303
- expect(
304
- await Beef.fromBinary(r.BEEF || []).verify(
305
- await services.getChainTracker()
306
- )
307
- ).toBe(true)
271
+ expect(await Beef.fromBinary(r.BEEF || []).verify(await services.getChainTracker())).toBe(true)
308
272
  if (!noLog) console.log(log)
309
273
  }
310
274
  }
@@ -350,9 +314,7 @@ describe('listOutputs test', () => {
350
314
  let i = 0
351
315
  for (const a of r.outputs) {
352
316
  expect(Array.isArray(a.tags)).toBe(true)
353
- expect(
354
- a.tags?.indexOf('babbage_action_originator projectbabbage.com')
355
- ).toBeGreaterThan(-1)
317
+ expect(a.tags?.indexOf('babbage_action_originator projectbabbage.com')).toBeGreaterThan(-1)
356
318
  log += `${i++} ${a.labels?.join(',')}\n`
357
319
  }
358
320
  if (!noLog) console.log(log)
@@ -409,8 +371,7 @@ describe('listOutputs test', () => {
409
371
  r.outputs.forEach((o, index) => {
410
372
  log += `totalOutputs=${0} outputs=${r.outputs.length}\n`
411
373
  expect(Array.isArray(o.tags)).toBe(true)
412
- const missingTags =
413
- args.tags?.filter(tag => !o.tags?.includes(tag)) || []
374
+ const missingTags = args.tags?.filter(tag => !o.tags?.includes(tag)) || []
414
375
  if (missingTags.length > 0) {
415
376
  console.error(`Output ${index} is missing tags:`, missingTags)
416
377
  }
@@ -1,13 +1,6 @@
1
- import {
2
- verifyOne,
3
- verifyOneOrNone,
4
- verifyTruthy,
5
- wait,
6
- Wallet,
7
- WalletStorageManager
8
- } from '../../../src/index.client'
1
+ import { verifyOne, verifyOneOrNone, verifyTruthy, wait, Wallet, WalletStorageManager } from '../../../src/index.client'
9
2
  import { StorageKnex } from '../../../src/storage/StorageKnex'
10
- import { _tu, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
3
+ import { _tu, logger, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
11
4
 
12
5
  describe('Wallet sync tests', () => {
13
6
  jest.setTimeout(99999999)
@@ -24,12 +17,7 @@ describe('Wallet sync tests', () => {
24
17
  storage: storageManager,
25
18
  activeStorage: storage
26
19
  } = await _tu.createLegacyWalletSQLiteCopy('walletSyncTest1aSource')
27
- const localSQLiteFile = await _tu.newTmpFile(
28
- 'walleltSyncTest0tmp.sqlite',
29
- true,
30
- false,
31
- false
32
- )
20
+ const localSQLiteFile = await _tu.newTmpFile('walleltSyncTest0tmp.sqlite', true, false, false)
33
21
  const knexSQLite = _tu.createLocalSQLite(localSQLiteFile)
34
22
  const tmpStore = new StorageKnex({
35
23
  ...StorageKnex.defaultOptions(),
@@ -68,12 +56,11 @@ describe('Wallet sync tests', () => {
68
56
  test('1a setActive to backup and back to original without backup first', async () => {
69
57
  // wallet will be the original active wallet, a backup is added, then setActive is used to initiate backup in each direction.
70
58
  const ctx = await _tu.createLegacyWalletSQLiteCopy('walletSyncTest1aSource')
71
- const { activeStorage: backup, wallet: backupWallet } =
72
- await _tu.createSQLiteTestWallet({
73
- databaseName: 'walletSyncTest1aBackup',
74
- rootKeyHex: ctx.rootKey.toHex(),
75
- dropAll: true
76
- })
59
+ const { activeStorage: backup, wallet: backupWallet } = await _tu.createSQLiteTestWallet({
60
+ databaseName: 'walletSyncTest1aBackup',
61
+ rootKeyHex: ctx.rootKey.toHex(),
62
+ dropAll: true
63
+ })
77
64
  await ctx.storage.addWalletStorageProvider(backup)
78
65
 
79
66
  await setActiveTwice(ctx, false, backup, backupWallet)
@@ -108,11 +95,7 @@ async function setActiveTwice(
108
95
  backup: StorageKnex,
109
96
  backupWallet?: Wallet
110
97
  ) {
111
- const {
112
- storage: storageManager,
113
- activeStorage: original,
114
- userId: originalUserId
115
- } = ctx
98
+ const { storage: storageManager, activeStorage: original, userId: originalUserId } = ctx
116
99
 
117
100
  if (withBackupFirst) {
118
101
  if (storageManager.isActiveEnabled) await storageManager.updateBackups()
@@ -123,8 +106,7 @@ async function setActiveTwice(
123
106
  }
124
107
 
125
108
  const backupIdentityKey = (await backup.makeAvailable()).storageIdentityKey
126
- const originalIdentityKey = (await original.makeAvailable())
127
- .storageIdentityKey
109
+ const originalIdentityKey = (await original.makeAvailable()).storageIdentityKey
128
110
  expect(backupIdentityKey).not.toBe(originalIdentityKey)
129
111
 
130
112
  const originalAuth = { ...(await storageManager.getAuth()) }
@@ -133,41 +115,32 @@ async function setActiveTwice(
133
115
  partial: { userId: originalAuth.userId }
134
116
  })
135
117
 
136
- const originalUserBefore = verifyTruthy(
137
- await original.findUserById(originalAuth.userId!)
138
- )
118
+ const originalUserBefore = verifyTruthy(await original.findUserById(originalAuth.userId!))
139
119
  const backupUserBefore = verifyOneOrNone(
140
120
  await backup.findUsers({
141
121
  partial: { identityKey: originalAuth.identityKey }
142
122
  })
143
123
  )
144
124
 
145
- expect(
146
- originalUserBefore.activeStorage === undefined ||
147
- originalUserBefore.activeStorage === originalIdentityKey
148
- )
125
+ expect(originalUserBefore.activeStorage === undefined || originalUserBefore.activeStorage === originalIdentityKey)
149
126
 
150
127
  let now = Date.now()
151
128
 
152
129
  expect(originalUserBefore.updated_at.getTime()).toBeLessThan(now)
153
- expect(!backupUserBefore || backupUserBefore.updated_at.getTime() < now).toBe(
154
- true
155
- )
130
+ expect(!backupUserBefore || backupUserBefore.updated_at.getTime() < now).toBe(true)
156
131
 
157
132
  expect(storageManager.getActiveStore()).toBe(originalIdentityKey)
158
133
  expect(storageManager.getActiveUser().activeStorage).toBe(originalIdentityKey)
159
134
 
160
135
  // sync to backup and make it active.
161
136
  const log = await storageManager.setActive(backupIdentityKey)
162
- console.log(log)
137
+ logger(log)
163
138
 
164
139
  expect(storageManager.getActiveStore()).toBe(backupIdentityKey)
165
140
  expect(storageManager.getActiveUser().activeStorage).toBe(backupIdentityKey)
166
141
  expect(storageManager.getBackupStores()).toEqual([originalIdentityKey])
167
142
 
168
- let originalUserAfter = verifyTruthy(
169
- await original.findUserById(originalAuth.userId!)
170
- )
143
+ let originalUserAfter = verifyTruthy(await original.findUserById(originalAuth.userId!))
171
144
  let backupUserAfter = verifyOne(
172
145
  await backup.findUsers({
173
146
  partial: { identityKey: originalAuth.identityKey }
@@ -205,14 +178,10 @@ async function setActiveTwice(
205
178
  now = Date.now()
206
179
 
207
180
  // sync back to original and make it active.
208
- const log2 = await storageManager.setActive(
209
- original.getSettings().storageIdentityKey
210
- )
211
- console.log(log2)
181
+ const log2 = await storageManager.setActive(original.getSettings().storageIdentityKey)
182
+ logger(log2)
212
183
 
213
- originalUserAfter = verifyTruthy(
214
- await original.findUserById(originalAuth.userId!)
215
- )
184
+ originalUserAfter = verifyTruthy(await original.findUserById(originalAuth.userId!))
216
185
  backupUserAfter = verifyOne(
217
186
  await backup.findUsers({
218
187
  partial: { identityKey: originalAuth.identityKey }