@bsv/wallet-toolbox 1.1.60 → 1.1.62

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 (471) 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/ARC.test.js +9 -0
  65. package/out/src/services/__tests/ARC.test.js.map +1 -1
  66. package/out/src/services/__tests/bitrails.test.js.map +1 -1
  67. package/out/src/services/__tests/getMerklePath.test.js.map +1 -1
  68. package/out/src/services/__tests/getRawTx.test.js.map +1 -1
  69. package/out/src/services/__tests/verifyBeef.test.js +2 -1
  70. package/out/src/services/__tests/verifyBeef.test.js.map +1 -1
  71. package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -1
  72. package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -1
  73. package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts.map +1 -1
  74. package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js.map +1 -1
  75. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -1
  76. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +1 -3
  77. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -1
  78. package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -1
  79. package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -1
  80. package/out/src/services/providers/ARC.d.ts.map +1 -1
  81. package/out/src/services/providers/ARC.js +2 -3
  82. package/out/src/services/providers/ARC.js.map +1 -1
  83. package/out/src/services/providers/Bitails.d.ts.map +1 -1
  84. package/out/src/services/providers/Bitails.js +62 -134
  85. package/out/src/services/providers/Bitails.js.map +1 -1
  86. package/out/src/services/providers/SdkWhatsOnChain.d.ts.map +1 -1
  87. package/out/src/services/providers/SdkWhatsOnChain.js.map +1 -1
  88. package/out/src/services/providers/WhatsOnChain.d.ts.map +1 -1
  89. package/out/src/services/providers/WhatsOnChain.js +6 -21
  90. package/out/src/services/providers/WhatsOnChain.js.map +1 -1
  91. package/out/src/services/providers/__tests/WhatsOnChain.test.js +1 -2
  92. package/out/src/services/providers/__tests/WhatsOnChain.test.js.map +1 -1
  93. package/out/src/services/providers/echangeRates.d.ts.map +1 -1
  94. package/out/src/services/providers/echangeRates.js.map +1 -1
  95. package/out/src/signer/WalletSigner.d.ts.map +1 -1
  96. package/out/src/signer/WalletSigner.js.map +1 -1
  97. package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -1
  98. package/out/src/signer/methods/acquireDirectCertificate.js +1 -3
  99. package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
  100. package/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
  101. package/out/src/signer/methods/buildSignableTransaction.js +3 -11
  102. package/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
  103. package/out/src/signer/methods/createAction.d.ts.map +1 -1
  104. package/out/src/signer/methods/createAction.js +3 -10
  105. package/out/src/signer/methods/createAction.js.map +1 -1
  106. package/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
  107. package/out/src/signer/methods/internalizeAction.js.map +1 -1
  108. package/out/src/signer/methods/proveCertificate.d.ts.map +1 -1
  109. package/out/src/signer/methods/proveCertificate.js.map +1 -1
  110. package/out/src/signer/methods/signAction.d.ts.map +1 -1
  111. package/out/src/signer/methods/signAction.js +2 -7
  112. package/out/src/signer/methods/signAction.js.map +1 -1
  113. package/out/src/storage/StorageKnex.d.ts.map +1 -1
  114. package/out/src/storage/StorageKnex.js +15 -44
  115. package/out/src/storage/StorageKnex.js.map +1 -1
  116. package/out/src/storage/StorageProvider.d.ts.map +1 -1
  117. package/out/src/storage/StorageProvider.js +9 -34
  118. package/out/src/storage/StorageProvider.js.map +1 -1
  119. package/out/src/storage/StorageReader.d.ts.map +1 -1
  120. package/out/src/storage/StorageReader.js.map +1 -1
  121. package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
  122. package/out/src/storage/StorageReaderWriter.js.map +1 -1
  123. package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
  124. package/out/src/storage/StorageSyncReader.js.map +1 -1
  125. package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
  126. package/out/src/storage/WalletStorageManager.js +5 -10
  127. package/out/src/storage/WalletStorageManager.js.map +1 -1
  128. package/out/src/storage/__test/WalletStorageManager.test.js +2 -8
  129. package/out/src/storage/__test/WalletStorageManager.test.js.map +1 -1
  130. package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js +10 -30
  131. package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js.map +1 -1
  132. package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.d.ts.map +1 -1
  133. package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js +17 -28
  134. package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js.map +1 -1
  135. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
  136. package/out/src/storage/methods/attemptToPostReqsToNetwork.js +6 -20
  137. package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
  138. package/out/src/storage/methods/createAction.d.ts.map +1 -1
  139. package/out/src/storage/methods/createAction.js +4 -9
  140. package/out/src/storage/methods/createAction.js.map +1 -1
  141. package/out/src/storage/methods/generateChange.d.ts.map +1 -1
  142. package/out/src/storage/methods/generateChange.js +7 -18
  143. package/out/src/storage/methods/generateChange.js.map +1 -1
  144. package/out/src/storage/methods/getBeefForTransaction.d.ts.map +1 -1
  145. package/out/src/storage/methods/getBeefForTransaction.js +1 -3
  146. package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
  147. package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
  148. package/out/src/storage/methods/getSyncChunk.js.map +1 -1
  149. package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
  150. package/out/src/storage/methods/internalizeAction.js +2 -9
  151. package/out/src/storage/methods/internalizeAction.js.map +1 -1
  152. package/out/src/storage/methods/listActions.d.ts.map +1 -1
  153. package/out/src/storage/methods/listActions.js +3 -15
  154. package/out/src/storage/methods/listActions.js.map +1 -1
  155. package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
  156. package/out/src/storage/methods/listCertificates.js.map +1 -1
  157. package/out/src/storage/methods/listOutputs.d.ts.map +1 -1
  158. package/out/src/storage/methods/listOutputs.js +5 -12
  159. package/out/src/storage/methods/listOutputs.js.map +1 -1
  160. package/out/src/storage/methods/processAction.d.ts.map +1 -1
  161. package/out/src/storage/methods/processAction.js +4 -10
  162. package/out/src/storage/methods/processAction.js.map +1 -1
  163. package/out/src/storage/methods/purgeData.d.ts.map +1 -1
  164. package/out/src/storage/methods/purgeData.js +8 -32
  165. package/out/src/storage/methods/purgeData.js.map +1 -1
  166. package/out/src/storage/methods/reviewStatus.d.ts.map +1 -1
  167. package/out/src/storage/methods/reviewStatus.js +1 -3
  168. package/out/src/storage/methods/reviewStatus.js.map +1 -1
  169. package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
  170. package/out/src/storage/remoting/StorageClient.js +15 -41
  171. package/out/src/storage/remoting/StorageClient.js.map +1 -1
  172. package/out/src/storage/remoting/StorageServer.d.ts.map +1 -1
  173. package/out/src/storage/remoting/StorageServer.js +2 -5
  174. package/out/src/storage/remoting/StorageServer.js.map +1 -1
  175. package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -1
  176. package/out/src/storage/schema/KnexMigrations.js +24 -130
  177. package/out/src/storage/schema/KnexMigrations.js.map +1 -1
  178. package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -1
  179. package/out/src/storage/schema/entities/Certificate.js +1 -1
  180. package/out/src/storage/schema/entities/Certificate.js.map +1 -1
  181. package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -1
  182. package/out/src/storage/schema/entities/CertificateField.js +2 -5
  183. package/out/src/storage/schema/entities/CertificateField.js.map +1 -1
  184. package/out/src/storage/schema/entities/Commission.d.ts.map +1 -1
  185. package/out/src/storage/schema/entities/Commission.js +2 -5
  186. package/out/src/storage/schema/entities/Commission.js.map +1 -1
  187. package/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -1
  188. package/out/src/storage/schema/entities/EntityBase.js.map +1 -1
  189. package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
  190. package/out/src/storage/schema/entities/MergeEntity.js +14 -9
  191. package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
  192. package/out/src/storage/schema/entities/Output.d.ts.map +1 -1
  193. package/out/src/storage/schema/entities/Output.js +8 -25
  194. package/out/src/storage/schema/entities/Output.js.map +1 -1
  195. package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -1
  196. package/out/src/storage/schema/entities/OutputBasket.js +1 -1
  197. package/out/src/storage/schema/entities/OutputBasket.js.map +1 -1
  198. package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -1
  199. package/out/src/storage/schema/entities/OutputTag.js +1 -1
  200. package/out/src/storage/schema/entities/OutputTag.js.map +1 -1
  201. package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -1
  202. package/out/src/storage/schema/entities/OutputTagMap.js +3 -7
  203. package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -1
  204. package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -1
  205. package/out/src/storage/schema/entities/ProvenTx.js +10 -20
  206. package/out/src/storage/schema/entities/ProvenTx.js.map +1 -1
  207. package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -1
  208. package/out/src/storage/schema/entities/ProvenTxReq.js +8 -18
  209. package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -1
  210. package/out/src/storage/schema/entities/SyncState.d.ts +1 -0
  211. package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -1
  212. package/out/src/storage/schema/entities/SyncState.js +41 -6
  213. package/out/src/storage/schema/entities/SyncState.js.map +1 -1
  214. package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -1
  215. package/out/src/storage/schema/entities/Transaction.js +4 -13
  216. package/out/src/storage/schema/entities/Transaction.js.map +1 -1
  217. package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -1
  218. package/out/src/storage/schema/entities/TxLabel.js +1 -1
  219. package/out/src/storage/schema/entities/TxLabel.js.map +1 -1
  220. package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -1
  221. package/out/src/storage/schema/entities/TxLabelMap.js +3 -9
  222. package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -1
  223. package/out/src/storage/schema/entities/User.d.ts.map +1 -1
  224. package/out/src/storage/schema/entities/User.js +3 -5
  225. package/out/src/storage/schema/entities/User.js.map +1 -1
  226. package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -1
  227. package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -1
  228. package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -1
  229. package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -1
  230. package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -1
  231. package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -1
  232. package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -1
  233. package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -1
  234. package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +1 -2
  235. package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
  236. package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -1
  237. package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +2 -2
  238. package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -1
  239. package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -1
  240. package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -1
  241. package/out/src/storage/schema/entities/__tests/stampLogTests.test.js.map +1 -1
  242. package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -1
  243. package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -1
  244. package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
  245. package/out/src/storage/sync/StorageMySQLDojoReader.js +1 -3
  246. package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -1
  247. package/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -1
  248. package/out/src/utility/ScriptTemplateBRC29.js +1 -2
  249. package/out/src/utility/ScriptTemplateBRC29.js.map +1 -1
  250. package/out/src/utility/stampLog.d.ts.map +1 -1
  251. package/out/src/utility/stampLog.js.map +1 -1
  252. package/out/src/utility/tscProofToMerklePath.d.ts.map +1 -1
  253. package/out/src/utility/tscProofToMerklePath.js.map +1 -1
  254. package/out/src/utility/utilityHelpers.buffer.d.ts.map +1 -1
  255. package/out/src/utility/utilityHelpers.buffer.js.map +1 -1
  256. package/out/src/utility/utilityHelpers.d.ts.map +1 -1
  257. package/out/src/utility/utilityHelpers.js +1 -3
  258. package/out/src/utility/utilityHelpers.js.map +1 -1
  259. package/out/test/Wallet/StorageClient/storageClient.man.test.js.map +1 -1
  260. package/out/test/Wallet/action/internalizeAction.a.test.js.map +1 -1
  261. package/out/test/Wallet/certificate/acquireCertificate.test.js.map +1 -1
  262. package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -1
  263. package/out/test/Wallet/get/getHeaderForHeight.test.js +2 -6
  264. package/out/test/Wallet/get/getHeaderForHeight.test.js.map +1 -1
  265. package/out/test/Wallet/get/getHeight.test.js.map +1 -1
  266. package/out/test/Wallet/get/getKnownTxids.test.js.map +1 -1
  267. package/out/test/Wallet/get/getNetwork.test.js.map +1 -1
  268. package/out/test/Wallet/get/getVersion.test.js.map +1 -1
  269. package/out/test/Wallet/live/walletLive.man.test.d.ts.map +1 -1
  270. package/out/test/Wallet/live/walletLive.man.test.js +3 -9
  271. package/out/test/Wallet/live/walletLive.man.test.js.map +1 -1
  272. package/out/test/Wallet/local/localWallet.man.test.d.ts.map +1 -1
  273. package/out/test/Wallet/local/localWallet.man.test.js +39 -31
  274. package/out/test/Wallet/local/localWallet.man.test.js.map +1 -1
  275. package/out/test/Wallet/specOps/specOps.man.test.js +1 -4
  276. package/out/test/Wallet/specOps/specOps.man.test.js.map +1 -1
  277. package/out/test/Wallet/support/janitor.man.test.js.map +1 -1
  278. package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js.map +1 -1
  279. package/out/test/Wallet/sync/setActive.test.js +73 -50
  280. package/out/test/Wallet/sync/setActive.test.js.map +1 -1
  281. package/out/test/checkDB.d.ts.map +1 -1
  282. package/out/test/checkDB.js.map +1 -1
  283. package/out/test/examples/backup.man.test.d.ts.map +1 -1
  284. package/out/test/examples/backup.man.test.js.map +1 -1
  285. package/out/test/examples/pushdrop.test.d.ts.map +1 -1
  286. package/out/test/examples/pushdrop.test.js +5 -4
  287. package/out/test/examples/pushdrop.test.js.map +1 -1
  288. package/out/test/monitor/Monitor.test.js.map +1 -1
  289. package/out/test/services/Services.test.js.map +1 -1
  290. package/out/test/storage/KnexMigrations.test.js.map +1 -1
  291. package/out/test/storage/StorageMySQLDojoReader.man.test.js +1 -3
  292. package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -1
  293. package/out/test/storage/count.test.js.map +1 -1
  294. package/out/test/storage/find.test.js +5 -10
  295. package/out/test/storage/find.test.js.map +1 -1
  296. package/out/test/storage/findLegacy.test.js.map +1 -1
  297. package/out/test/storage/insert.test.js.map +1 -1
  298. package/out/test/storage/update.test.js +7 -19
  299. package/out/test/storage/update.test.js.map +1 -1
  300. package/out/test/storage/update2.test.js +22 -24
  301. package/out/test/storage/update2.test.js.map +1 -1
  302. package/out/test/utils/TestUtilsWalletStorage.d.ts +3 -1
  303. package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
  304. package/out/test/utils/TestUtilsWalletStorage.js +52 -76
  305. package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
  306. package/out/test/wallet/action/abortAction.test.js.map +1 -1
  307. package/out/test/wallet/action/createAction.test.js +1 -2
  308. package/out/test/wallet/action/createAction.test.js.map +1 -1
  309. package/out/test/wallet/action/createAction2.test.d.ts.map +1 -1
  310. package/out/test/wallet/action/createAction2.test.js +6 -16
  311. package/out/test/wallet/action/createAction2.test.js.map +1 -1
  312. package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -1
  313. package/out/test/wallet/action/internalizeAction.test.js.map +1 -1
  314. package/out/test/wallet/action/relinquishOutput.test.js.map +1 -1
  315. package/out/test/wallet/list/listActions.test.js.map +1 -1
  316. package/out/test/wallet/list/listActions2.test.js.map +1 -1
  317. package/out/test/wallet/list/listCertificates.test.js +2 -6
  318. package/out/test/wallet/list/listCertificates.test.js.map +1 -1
  319. package/out/test/wallet/list/listOutputs.test.js +2 -10
  320. package/out/test/wallet/list/listOutputs.test.js.map +1 -1
  321. package/out/test/wallet/sync/Wallet.sync.test.js +4 -6
  322. package/out/test/wallet/sync/Wallet.sync.test.js.map +1 -1
  323. package/out/tsconfig.all.tsbuildinfo +1 -1
  324. package/package.json +3 -3
  325. package/src/Setup.ts +15 -52
  326. package/src/Wallet.ts +58 -161
  327. package/src/monitor/Monitor.ts +7 -22
  328. package/src/monitor/MonitorDaemon.ts +6 -23
  329. package/src/monitor/tasks/TaskCheckForProofs.ts +4 -23
  330. package/src/monitor/tasks/TaskClock.ts +1 -3
  331. package/src/monitor/tasks/TaskFailAbandoned.ts +1 -3
  332. package/src/monitor/tasks/TaskNewHeader.ts +1 -4
  333. package/src/monitor/tasks/TaskPurge.ts +1 -2
  334. package/src/monitor/tasks/TaskReviewStatus.ts +1 -3
  335. package/src/monitor/tasks/TaskSendWaiting.ts +3 -10
  336. package/src/sdk/CertOps.ts +31 -103
  337. package/src/sdk/PrivilegedKeyManager.ts +18 -48
  338. package/src/sdk/WERR_errors.ts +6 -25
  339. package/src/sdk/WalletError.ts +5 -21
  340. package/src/sdk/WalletServices.interfaces.ts +11 -33
  341. package/src/sdk/WalletStorage.interfaces.ts +25 -91
  342. package/src/sdk/__test/CertificateLifeCycle.test.ts +9 -27
  343. package/src/sdk/__test/PrivilegedKeyManager.test.ts +29 -66
  344. package/src/sdk/types.ts +6 -26
  345. package/src/sdk/validationHelpers.ts +111 -402
  346. package/src/services/Services.ts +51 -114
  347. package/src/services/__tests/ARC.test.ts +14 -1
  348. package/src/services/__tests/bitrails.test.ts +4 -15
  349. package/src/services/__tests/getMerklePath.test.ts +1 -2
  350. package/src/services/__tests/getRawTx.test.ts +1 -3
  351. package/src/services/__tests/verifyBeef.test.ts +2 -1
  352. package/src/services/chaintracker/ChaintracksChainTracker.ts +3 -13
  353. package/src/services/chaintracker/chaintracks/BlockHeaderApi.ts +4 -12
  354. package/src/services/chaintracker/chaintracks/ChaintracksServiceClient.ts +9 -27
  355. package/src/services/createDefaultWalletServicesOptions.ts +2 -5
  356. package/src/services/processingErrors/arcSuccessError.json +76 -0
  357. package/src/services/providers/ARC.ts +6 -25
  358. package/src/services/providers/Bitails.ts +61 -159
  359. package/src/services/providers/SdkWhatsOnChain.ts +4 -17
  360. package/src/services/providers/WhatsOnChain.ts +31 -100
  361. package/src/services/providers/__tests/WhatsOnChain.test.ts +5 -15
  362. package/src/services/providers/echangeRates.ts +7 -22
  363. package/src/signer/WalletSigner.ts +1 -5
  364. package/src/signer/methods/acquireDirectCertificate.ts +1 -4
  365. package/src/signer/methods/buildSignableTransaction.ts +5 -20
  366. package/src/signer/methods/createAction.ts +15 -54
  367. package/src/signer/methods/internalizeAction.ts +10 -39
  368. package/src/signer/methods/proveCertificate.ts +2 -5
  369. package/src/signer/methods/signAction.ts +9 -39
  370. package/src/storage/StorageKnex.ts +166 -499
  371. package/src/storage/StorageProvider.ts +75 -291
  372. package/src/storage/StorageReader.ts +20 -65
  373. package/src/storage/StorageReaderWriter.ts +67 -264
  374. package/src/storage/StorageSyncReader.ts +2 -5
  375. package/src/storage/WalletStorageManager.ts +33 -108
  376. package/src/storage/__test/WalletStorageManager.test.ts +6 -23
  377. package/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.ts +53 -171
  378. package/src/storage/methods/__test/GenerateChange/randomValsUsed1.ts +17 -28
  379. package/src/storage/methods/attemptToPostReqsToNetwork.ts +9 -37
  380. package/src/storage/methods/createAction.ts +45 -181
  381. package/src/storage/methods/generateChange.ts +33 -114
  382. package/src/storage/methods/getBeefForTransaction.ts +7 -37
  383. package/src/storage/methods/getSyncChunk.ts +18 -69
  384. package/src/storage/methods/internalizeAction.ts +18 -70
  385. package/src/storage/methods/listActions.ts +6 -23
  386. package/src/storage/methods/listCertificates.ts +5 -14
  387. package/src/storage/methods/listOutputs.ts +15 -69
  388. package/src/storage/methods/processAction.ts +29 -104
  389. package/src/storage/methods/purgeData.ts +11 -45
  390. package/src/storage/methods/reviewStatus.ts +3 -9
  391. package/src/storage/remoting/StorageClient.ts +43 -146
  392. package/src/storage/remoting/StorageServer.ts +21 -59
  393. package/src/storage/schema/KnexMigrations.ts +34 -165
  394. package/src/storage/schema/entities/Certificate.ts +3 -14
  395. package/src/storage/schema/entities/CertificateField.ts +6 -28
  396. package/src/storage/schema/entities/Commission.ts +6 -23
  397. package/src/storage/schema/entities/EntityBase.ts +1 -6
  398. package/src/storage/schema/entities/MergeEntity.ts +14 -21
  399. package/src/storage/schema/entities/Output.ts +10 -39
  400. package/src/storage/schema/entities/OutputBasket.ts +4 -16
  401. package/src/storage/schema/entities/OutputTag.ts +4 -17
  402. package/src/storage/schema/entities/OutputTagMap.ts +7 -30
  403. package/src/storage/schema/entities/ProvenTx.ts +16 -57
  404. package/src/storage/schema/entities/ProvenTxReq.ts +29 -93
  405. package/src/storage/schema/entities/SyncState.ts +64 -116
  406. package/src/storage/schema/entities/Transaction.ts +10 -35
  407. package/src/storage/schema/entities/TxLabel.ts +4 -17
  408. package/src/storage/schema/entities/TxLabelMap.ts +6 -28
  409. package/src/storage/schema/entities/User.ts +8 -31
  410. package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +23 -54
  411. package/src/storage/schema/entities/__tests/CertificateTests.test.ts +26 -59
  412. package/src/storage/schema/entities/__tests/CommissionTests.test.ts +2 -11
  413. package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +2 -10
  414. package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +2 -10
  415. package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +1 -4
  416. package/src/storage/schema/entities/__tests/OutputTests.test.ts +3 -14
  417. package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +4 -16
  418. package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +5 -18
  419. package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +5 -26
  420. package/src/storage/schema/entities/__tests/TransactionTests.test.ts +12 -48
  421. package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +4 -22
  422. package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +2 -10
  423. package/src/storage/schema/entities/__tests/stampLogTests.test.ts +3 -10
  424. package/src/storage/schema/entities/__tests/usersTests.test.ts +4 -7
  425. package/src/storage/schema/tables/TableSettings.ts +1 -3
  426. package/src/storage/sync/StorageMySQLDojoReader.ts +47 -148
  427. package/src/utility/ScriptTemplateBRC29.ts +2 -11
  428. package/src/utility/stampLog.ts +2 -6
  429. package/src/utility/tscProofToMerklePath.ts +1 -4
  430. package/src/utility/utilityHelpers.buffer.ts +3 -12
  431. package/src/utility/utilityHelpers.ts +14 -49
  432. package/test/Wallet/StorageClient/storageClient.man.test.ts +2 -8
  433. package/test/Wallet/action/internalizeAction.a.test.ts +8 -23
  434. package/test/Wallet/certificate/acquireCertificate.test.ts +10 -24
  435. package/test/Wallet/certificate/listCertificates.test.ts +8 -18
  436. package/test/Wallet/get/getHeaderForHeight.test.ts +4 -15
  437. package/test/Wallet/get/getHeight.test.ts +2 -6
  438. package/test/Wallet/get/getKnownTxids.test.ts +1 -5
  439. package/test/Wallet/get/getNetwork.test.ts +1 -2
  440. package/test/Wallet/get/getVersion.test.ts +1 -2
  441. package/test/Wallet/live/walletLive.man.test.ts +14 -41
  442. package/test/Wallet/local/localWallet.man.test.ts +45 -102
  443. package/test/Wallet/specOps/specOps.man.test.ts +4 -13
  444. package/test/Wallet/support/janitor.man.test.ts +2 -7
  445. package/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.ts +11 -34
  446. package/test/Wallet/sync/setActive.test.ts +75 -61
  447. package/test/checkDB.ts +2 -8
  448. package/test/examples/backup.man.test.ts +2 -9
  449. package/test/examples/pushdrop.test.ts +7 -20
  450. package/test/monitor/Monitor.test.ts +33 -87
  451. package/test/services/Services.test.ts +8 -19
  452. package/test/storage/KnexMigrations.test.ts +3 -18
  453. package/test/storage/StorageMySQLDojoReader.man.test.ts +4 -15
  454. package/test/storage/count.test.ts +7 -24
  455. package/test/storage/find.test.ts +7 -29
  456. package/test/storage/findLegacy.test.ts +2 -5
  457. package/test/storage/insert.test.ts +3 -19
  458. package/test/storage/update.test.ts +47 -179
  459. package/test/storage/update2.test.ts +54 -176
  460. package/test/utils/TestUtilsWalletStorage.ts +139 -372
  461. package/test/wallet/action/abortAction.test.ts +4 -12
  462. package/test/wallet/action/createAction.test.ts +4 -14
  463. package/test/wallet/action/createAction2.test.ts +74 -208
  464. package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +8 -11
  465. package/test/wallet/action/internalizeAction.test.ts +20 -72
  466. package/test/wallet/action/relinquishOutput.test.ts +3 -9
  467. package/test/wallet/list/listActions.test.ts +2 -9
  468. package/test/wallet/list/listActions2.test.ts +8 -34
  469. package/test/wallet/list/listCertificates.test.ts +5 -16
  470. package/test/wallet/list/listOutputs.test.ts +15 -54
  471. package/test/wallet/sync/Wallet.sync.test.ts +18 -49
@@ -1,8 +1,5 @@
1
1
  import { createSyncMap, sdk, TableCertificate } from '../../../../../src'
2
- import {
3
- TestUtilsWalletStorage as _tu,
4
- TestWalletNoSetup
5
- } from '../../../../../test/utils/TestUtilsWalletStorage'
2
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
6
3
  import { EntityCertificate } from '../../../../../src/storage/schema/entities/Certificate'
7
4
 
8
5
  describe('Certificate class method tests', () => {
@@ -41,14 +38,10 @@ describe('Certificate class method tests', () => {
41
38
  userId: 1,
42
39
  type: Buffer.from('exampleType').toString('base64'), // Base64-encoded string
43
40
  serialNumber: Buffer.from('serial123').toString('base64'), // Base64-encoded string
44
- certifier:
45
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234', // PubKeyHex
46
- subject:
47
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // PubKeyHex
48
- revocationOutpoint:
49
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0', // OutpointString
50
- signature:
51
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // HexString
41
+ certifier: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234', // PubKeyHex
42
+ subject: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // PubKeyHex
43
+ revocationOutpoint: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0', // OutpointString
44
+ signature: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // HexString
52
45
  isDeleted: false
53
46
  }
54
47
 
@@ -76,14 +69,10 @@ describe('Certificate class method tests', () => {
76
69
  userId: 1,
77
70
  type: Buffer.from('exampleType1').toString('base64'), // Unique Base64-encoded string
78
71
  serialNumber: Buffer.from('serial123-1').toString('base64'), // Unique Base64-encoded string
79
- certifier:
80
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234', // Same PubKeyHex
81
- subject:
82
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // Same PubKeyHex
83
- revocationOutpoint:
84
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0', // Same OutpointString
85
- signature:
86
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // Same HexString
72
+ certifier: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234', // Same PubKeyHex
73
+ subject: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // Same PubKeyHex
74
+ revocationOutpoint: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0', // Same OutpointString
75
+ signature: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // Same HexString
87
76
  isDeleted: false
88
77
  }
89
78
  const certificateData2: TableCertificate = {
@@ -93,14 +82,10 @@ describe('Certificate class method tests', () => {
93
82
  userId: 1,
94
83
  type: Buffer.from('exampleType2').toString('base64'), // Unique Base64-encoded string
95
84
  serialNumber: Buffer.from('serial123-2').toString('base64'), // Unique Base64-encoded string
96
- certifier:
97
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // Same PubKeyHex
98
- subject:
99
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // Same PubKeyHex
100
- revocationOutpoint:
101
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:1', // Unique OutpointString
102
- signature:
103
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // Same HexString
85
+ certifier: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // Same PubKeyHex
86
+ subject: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678', // Same PubKeyHex
87
+ revocationOutpoint: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:1', // Unique OutpointString
88
+ signature: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // Same HexString
104
89
  isDeleted: false
105
90
  }
106
91
 
@@ -147,14 +132,10 @@ describe('Certificate class method tests', () => {
147
132
  userId: 1,
148
133
  type: Buffer.from('exampleTypeMerge').toString('base64'),
149
134
  serialNumber: Buffer.from('serialMerge123').toString('base64'),
150
- certifier:
151
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234',
152
- subject:
153
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678',
154
- revocationOutpoint:
155
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0',
156
- signature:
157
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
135
+ certifier: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234',
136
+ subject: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678',
137
+ revocationOutpoint: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0',
138
+ signature: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
158
139
  isDeleted: false
159
140
  }
160
141
 
@@ -230,14 +211,10 @@ describe('Certificate class method tests', () => {
230
211
  userId: 1,
231
212
  type: 'exampleType',
232
213
  serialNumber: 'exampleSerialNumber',
233
- certifier:
234
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234',
235
- subject:
236
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678',
237
- revocationOutpoint:
238
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0',
239
- signature:
240
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
214
+ certifier: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef1234',
215
+ subject: '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678',
216
+ revocationOutpoint: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0',
217
+ signature: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
241
218
  isDeleted: false
242
219
  }
243
220
 
@@ -278,16 +255,10 @@ describe('Certificate class method tests', () => {
278
255
 
279
256
  // Verify that the entity is not updated
280
257
  expect(entity.type).toBe('exampleType')
281
- expect(entity.subject).toBe(
282
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678'
283
- )
258
+ expect(entity.subject).toBe('02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678')
284
259
  expect(entity.serialNumber).toBe('exampleSerialNumber')
285
- expect(entity.revocationOutpoint).toBe(
286
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0'
287
- )
288
- expect(entity.signature).toBe(
289
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890'
290
- )
260
+ expect(entity.revocationOutpoint).toBe('abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0')
261
+ expect(entity.signature).toBe('abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890')
291
262
  expect(entity.isDeleted).toBe(0)
292
263
 
293
264
  // Verify that the database is not updated
@@ -297,16 +268,12 @@ describe('Certificate class method tests', () => {
297
268
  expect(unchangedRecord.length).toBe(1)
298
269
  expect(unchangedRecord[0]).toBeDefined()
299
270
  expect(unchangedRecord[0].type).toBe('exampleType')
300
- expect(unchangedRecord[0].subject).toBe(
301
- '02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678'
302
- )
271
+ expect(unchangedRecord[0].subject).toBe('02c123eabcdeff1234567890abcdef1234567890abcdef1234567890abcdef5678')
303
272
  expect(unchangedRecord[0].serialNumber).toBe('exampleSerialNumber')
304
273
  expect(unchangedRecord[0].revocationOutpoint).toBe(
305
274
  'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:0'
306
275
  )
307
- expect(unchangedRecord[0].signature).toBe(
308
- 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890'
309
- )
276
+ expect(unchangedRecord[0].signature).toBe('abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890')
310
277
  expect(unchangedRecord[0].isDeleted).toBe(false)
311
278
  }
312
279
  })
@@ -1,14 +1,5 @@
1
- import {
2
- createSyncMap,
3
- sdk,
4
- SyncMap,
5
- TableCommission,
6
- TableTransaction
7
- } from '../../../../../src'
8
- import {
9
- TestUtilsWalletStorage as _tu,
10
- TestWalletNoSetup
11
- } from '../../../../../test/utils/TestUtilsWalletStorage'
1
+ import { createSyncMap, sdk, SyncMap, TableCommission, TableTransaction } from '../../../../../src'
2
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
12
3
  import { EntityCommission } from '../../../../../src/storage/schema/entities/Commission'
13
4
 
14
5
  describe('Commission class method tests', () => {
@@ -1,13 +1,5 @@
1
- import {
2
- createSyncMap,
3
- sdk,
4
- SyncMap,
5
- TableOutputBasket
6
- } from '../../../../../src'
7
- import {
8
- TestUtilsWalletStorage as _tu,
9
- TestWalletNoSetup
10
- } from '../../../../../test/utils/TestUtilsWalletStorage'
1
+ import { createSyncMap, sdk, SyncMap, TableOutputBasket } from '../../../../../src'
2
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
11
3
  import { EntityOutputBasket } from '../../../../../src/storage/schema/entities/OutputBasket'
12
4
 
13
5
  describe('OutputBasket class method tests', () => {
@@ -1,14 +1,6 @@
1
1
  import * as bsv from '@bsv/sdk'
2
- import {
3
- createSyncMap,
4
- sdk,
5
- SyncMap,
6
- TableOutputTagMap
7
- } from '../../../../../src'
8
- import {
9
- TestUtilsWalletStorage as _tu,
10
- TestWalletNoSetup
11
- } from '../../../../../test/utils/TestUtilsWalletStorage'
2
+ import { createSyncMap, sdk, SyncMap, TableOutputTagMap } from '../../../../../src'
3
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
12
4
  import { EntityOutputTagMap } from '../../../../../src/storage/schema/entities/OutputTagMap'
13
5
 
14
6
  describe('OutputTagMap class method tests', () => {
@@ -1,8 +1,5 @@
1
1
  import { createSyncMap, sdk, SyncMap, TableOutputTag } from '../../../../../src'
2
- import {
3
- TestUtilsWalletStorage as _tu,
4
- TestWalletNoSetup
5
- } from '../../../../../test/utils/TestUtilsWalletStorage'
2
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
6
3
  import { EntityOutputTag } from '../../../../../src/storage/schema/entities/OutputTag'
7
4
 
8
5
  describe('OutputTag class method tests', () => {
@@ -1,8 +1,5 @@
1
1
  import { createSyncMap, sdk, SyncMap, TableOutput } from '../../../../../src'
2
- import {
3
- TestUtilsWalletStorage as _tu,
4
- TestWalletNoSetup
5
- } from '../../../../../test/utils/TestUtilsWalletStorage'
2
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
6
3
  import { EntityOutput } from '../../../../../src/storage/schema/entities/Output'
7
4
 
8
5
  describe('Output class method tests', () => {
@@ -270,9 +267,7 @@ describe('Output class method tests', () => {
270
267
 
271
268
  // Handle undefined lockingScript gracefully
272
269
  if (updatedRecord[0].lockingScript) {
273
- expect(Buffer.from(updatedRecord[0].lockingScript).toJSON().data).toEqual(
274
- [4, 5, 6]
275
- )
270
+ expect(Buffer.from(updatedRecord[0].lockingScript).toJSON().data).toEqual([4, 5, 6])
276
271
  } else {
277
272
  throw new Error('lockingScript is undefined')
278
273
  }
@@ -327,13 +322,7 @@ describe('Output class method tests', () => {
327
322
  syncMap.outputBasket.idMap[1] = 1
328
323
 
329
324
  // Call mergeExisting
330
- const wasMergedRaw = await entity.mergeExisting(
331
- ctx.activeStorage,
332
- undefined,
333
- earlierData,
334
- syncMap,
335
- undefined
336
- )
325
+ const wasMergedRaw = await entity.mergeExisting(ctx.activeStorage, undefined, earlierData, syncMap, undefined)
337
326
 
338
327
  const wasMerged = Boolean(wasMergedRaw)
339
328
 
@@ -1,18 +1,7 @@
1
1
  import * as bsv from '@bsv/sdk'
2
- import {
3
- createSyncMap,
4
- sdk,
5
- SyncMap,
6
- TableProvenTxReq
7
- } from '../../../../../src'
8
- import {
9
- TestUtilsWalletStorage as _tu,
10
- TestWalletNoSetup
11
- } from '../../../../../test/utils/TestUtilsWalletStorage'
12
- import {
13
- EntityProvenTxReq,
14
- ProvenTxReqHistorySummaryApi
15
- } from '../../../../../src/storage/schema/entities/ProvenTxReq'
2
+ import { createSyncMap, sdk, SyncMap, TableProvenTxReq } from '../../../../../src'
3
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
4
+ import { EntityProvenTxReq, ProvenTxReqHistorySummaryApi } from '../../../../../src/storage/schema/entities/ProvenTxReq'
16
5
 
17
6
  describe('ProvenTxReq class method tests', () => {
18
7
  jest.setTimeout(99999999)
@@ -333,8 +322,7 @@ describe('ProvenTxReq class method tests', () => {
333
322
  const ctx = ctxs[0]
334
323
 
335
324
  // Fetch terminal statuses if they are stored in the database or available via context
336
- const terminalStatuses: sdk.ProvenTxReqStatus[] =
337
- sdk.ProvenTxReqTerminalStatus
325
+ const terminalStatuses: sdk.ProvenTxReqStatus[] = sdk.ProvenTxReqTerminalStatus
338
326
 
339
327
  // Test cases for valid and invalid statuses
340
328
  const testCases: { status: sdk.ProvenTxReqStatus; expected: boolean }[] = [
@@ -1,9 +1,6 @@
1
1
  import * as bsv from '@bsv/sdk'
2
2
  import { createSyncMap, sdk, SyncMap } from '../../../../../src'
3
- import {
4
- TestUtilsWalletStorage as _tu,
5
- TestWalletNoSetup
6
- } from '../../../../../test/utils/TestUtilsWalletStorage'
3
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
7
4
  import { EntityProvenTx } from '../../../../../src/storage/schema/entities/ProvenTx'
8
5
 
9
6
  describe('ProvenTx class method tests', () => {
@@ -33,8 +30,7 @@ describe('ProvenTx class method tests', () => {
33
30
 
34
31
  test('0_fromTxid: valid txid with rawTx and Merkle proof (real database)', async () => {
35
32
  const ctx = ctxs[0]
36
- const txid =
37
- '2795b293c698b2244147aaba745db887a632d21990c474df46d842ec3e52f122' // Using a valid txid from the table
33
+ const txid = '2795b293c698b2244147aaba745db887a632d21990c474df46d842ec3e52f122' // Using a valid txid from the table
38
34
 
39
35
  // Fetch the rawTx and Merkle proof data directly from the database
40
36
  const provenTxRecord = await ctx.activeStorage.findProvenTxs({
@@ -202,8 +198,7 @@ describe('ProvenTx class method tests', () => {
202
198
  provenTx.provenTxId = 2
203
199
  provenTx.created_at = new Date('2025-02-01T00:00:00Z')
204
200
  provenTx.updated_at = new Date('2025-02-02T00:00:00Z')
205
- provenTx.txid =
206
- 'a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7'
201
+ provenTx.txid = 'a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7'
207
202
  provenTx.height = 456
208
203
  provenTx.index = 1
209
204
  provenTx.merklePath = [0x07, 0x08, 0x09]
@@ -215,9 +210,7 @@ describe('ProvenTx class method tests', () => {
215
210
  expect(provenTx.provenTxId).toBe(2)
216
211
  expect(provenTx.created_at).toEqual(new Date('2025-02-01T00:00:00Z'))
217
212
  expect(provenTx.updated_at).toEqual(new Date('2025-02-02T00:00:00Z'))
218
- expect(provenTx.txid).toBe(
219
- 'a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7'
220
- )
213
+ expect(provenTx.txid).toBe('a3b2f0935c7b5bb7a841a09e535c13be86f4df0e7a91cebdc33812bfcc0eb9d7')
221
214
  expect(provenTx.height).toBe(456)
222
215
  expect(provenTx.index).toBe(1)
223
216
  expect(provenTx.merklePath).toEqual([0x07, 0x08, 0x09])
@@ -469,13 +462,7 @@ describe('ProvenTx class method tests', () => {
469
462
  const mockTrx: sdk.TrxToken = {}
470
463
 
471
464
  // Call the mergeExisting method
472
- const result = await provenTx.mergeExisting(
473
- mockStorage,
474
- new Date(),
475
- provenTx.toApi(),
476
- mockSyncMap,
477
- mockTrx
478
- )
465
+ const result = await provenTx.mergeExisting(mockStorage, new Date(), provenTx.toApi(), mockSyncMap, mockTrx)
479
466
 
480
467
  // Assert that it always returns false
481
468
  expect(result).toBe(false)
@@ -1,15 +1,6 @@
1
1
  import { EntitySyncState } from '../../../../../src/storage/schema/entities/SyncState'
2
- import {
3
- createSyncMap,
4
- EntityStorage,
5
- sdk,
6
- SyncMap,
7
- TableSyncState
8
- } from '../../../../../src'
9
- import {
10
- TestUtilsWalletStorage as _tu,
11
- TestWalletNoSetup
12
- } from '../../../../../test/utils/TestUtilsWalletStorage'
2
+ import { createSyncMap, EntityStorage, sdk, SyncMap, TableSyncState } from '../../../../../src'
3
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
13
4
 
14
5
  describe('SyncState class method tests', () => {
15
6
  jest.setTimeout(99999999)
@@ -173,11 +164,7 @@ describe('SyncState class method tests', () => {
173
164
  toStorageIdentityKey: 'toKey'
174
165
  }
175
166
 
176
- const result = await syncState.processSyncChunk(
177
- ctx.activeStorage,
178
- args,
179
- chunk
180
- )
167
+ const result = await syncState.processSyncChunk(ctx.activeStorage, args, chunk)
181
168
 
182
169
  expect(result.done).toBe(true)
183
170
  expect(result.updates).toBe(0)
@@ -285,9 +272,7 @@ describe('SyncState class method tests', () => {
285
272
 
286
273
  const syncMap = createSyncMap()
287
274
 
288
- await expect(
289
- syncState.mergeNew(mockStorage, 1, syncMap, undefined)
290
- ).resolves.toBeUndefined()
275
+ await expect(syncState.mergeNew(mockStorage, 1, syncMap, undefined)).resolves.toBeUndefined()
291
276
  })
292
277
 
293
278
  // Test: mergeExisting method (always returns false)
@@ -297,13 +282,7 @@ describe('SyncState class method tests', () => {
297
282
 
298
283
  const syncMap = createSyncMap()
299
284
 
300
- const result = await syncState.mergeExisting(
301
- mockStorage,
302
- new Date(),
303
- {} as TableSyncState,
304
- syncMap,
305
- undefined
306
- )
285
+ const result = await syncState.mergeExisting(mockStorage, new Date(), {} as TableSyncState, syncMap, undefined)
307
286
  expect(result).toBe(false)
308
287
  })
309
288
  })
@@ -1,15 +1,7 @@
1
1
  import { Knex } from 'knex'
2
2
  import * as bsv from '@bsv/sdk'
3
- import {
4
- createSyncMap,
5
- sdk,
6
- SyncMap,
7
- TableTransaction
8
- } from '../../../../../src'
9
- import {
10
- TestUtilsWalletStorage as _tu,
11
- TestWalletNoSetup
12
- } from '../../../../../test/utils/TestUtilsWalletStorage'
3
+ import { createSyncMap, sdk, SyncMap, TableTransaction } from '../../../../../src'
4
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
13
5
  import { EntityTransaction } from '../../../../../src/storage/schema/entities/Transaction'
14
6
 
15
7
  describe('Transaction class method tests', () => {
@@ -166,11 +158,7 @@ describe('Transaction class method tests', () => {
166
158
  test('6_getInputs_combines_spentBy_and_rawTx_inputs', async () => {
167
159
  for (const { activeStorage } of ctxs) {
168
160
  // Insert the transaction into the database
169
- const txData = await _tu.insertTestTransaction(
170
- activeStorage,
171
- undefined,
172
- true
173
- )
161
+ const txData = await _tu.insertTestTransaction(activeStorage, undefined, true)
174
162
  const tx = new EntityTransaction(txData.tx)
175
163
 
176
164
  // Assign rawTx to simulate transaction inputs
@@ -217,11 +205,7 @@ describe('Transaction class method tests', () => {
217
205
  test('9_mergeExisting_updates_when_ei_updated_at_is_newer', async () => {
218
206
  for (const { activeStorage } of ctxs) {
219
207
  // Insert a test transaction into the database
220
- const txData = await _tu.insertTestTransaction(
221
- activeStorage,
222
- undefined,
223
- true
224
- )
208
+ const txData = await _tu.insertTestTransaction(activeStorage, undefined, true)
225
209
 
226
210
  // Create the `Transaction` instance with an earlier updated_at timestamp
227
211
  const tx = new EntityTransaction({
@@ -240,13 +224,10 @@ describe('Transaction class method tests', () => {
240
224
  syncMap.transaction.idMap = { 456: 123 }
241
225
  syncMap.transaction.count = 1
242
226
 
227
+ const expectedMergeUpdatedAt = Math.max(ei.updated_at.getTime(), tx.updated_at.getTime())
228
+
243
229
  // Execute `mergeExisting`
244
- const result = await tx.mergeExisting(
245
- activeStorage,
246
- new Date(),
247
- ei,
248
- syncMap
249
- )
230
+ const result = await tx.mergeExisting(activeStorage, new Date(), ei, syncMap)
250
231
 
251
232
  // Validate the result and check that the transaction was updated in the database
252
233
  expect(result).toBe(true)
@@ -257,9 +238,8 @@ describe('Transaction class method tests', () => {
257
238
 
258
239
  expect(updatedTx[0]?.txid).toBe('newTxId')
259
240
  // Currently expecting current time and date, but should be the updated_at from the incoming entity
260
- const now = Date.now()
261
241
  const updatedAtTime = updatedTx[0]?.updated_at.getTime()
262
- expect(Math.abs(now - updatedAtTime)).toBeLessThan(5000) // Allow a 5-second tolerance
242
+ expect(updatedAtTime).toBe(expectedMergeUpdatedAt)
263
243
  }
264
244
  })
265
245
 
@@ -274,11 +254,7 @@ describe('Transaction class method tests', () => {
274
254
  test('11_getInputs_handles_storage_lookups_and_input_merging', async () => {
275
255
  for (const { activeStorage } of ctxs) {
276
256
  // Insert a test transaction into the database
277
- const { tx } = await _tu.insertTestTransaction(
278
- activeStorage,
279
- undefined,
280
- true
281
- )
257
+ const { tx } = await _tu.insertTestTransaction(activeStorage, undefined, true)
282
258
 
283
259
  // Create a Transaction instance with the inserted transaction's data
284
260
  const transaction = new EntityTransaction(tx)
@@ -377,11 +353,7 @@ describe('Transaction class method tests', () => {
377
353
  test('18_getInputs_merges_known_inputs_correctly', async () => {
378
354
  for (const { activeStorage } of ctxs) {
379
355
  // Step 1: Insert a Transaction
380
- const { tx } = await _tu.insertTestTransaction(
381
- activeStorage,
382
- undefined,
383
- true
384
- )
356
+ const { tx } = await _tu.insertTestTransaction(activeStorage, undefined, true)
385
357
 
386
358
  // Step 2: Insert outputs associated with the transaction
387
359
  const output1 = await _tu.insertTestOutput(activeStorage, tx, 0, 100) // vout = 0
@@ -455,11 +427,7 @@ describe('Transaction class method tests', () => {
455
427
  test('25_equals_returns_false_for_mismatched_other_properties', async () => {
456
428
  for (const { activeStorage } of ctxs) {
457
429
  // Insert a test transaction to use as the baseline
458
- const txData = await _tu.insertTestTransaction(
459
- activeStorage,
460
- undefined,
461
- true
462
- )
430
+ const txData = await _tu.insertTestTransaction(activeStorage, undefined, true)
463
431
 
464
432
  const syncMap = createSyncMap()
465
433
  syncMap.transaction.idMap = {
@@ -501,11 +469,7 @@ describe('Transaction class method tests', () => {
501
469
  test('26_getInputs_handles_known_and_unknown_inputs', async () => {
502
470
  for (const { activeStorage } of ctxs) {
503
471
  // Step 1: Insert a Transaction into the database
504
- const { tx } = await _tu.insertTestTransaction(
505
- activeStorage,
506
- undefined,
507
- true
508
- )
472
+ const { tx } = await _tu.insertTestTransaction(activeStorage, undefined, true)
509
473
 
510
474
  // Step 2: Insert test outputs associated with the transaction
511
475
  const output1 = await _tu.insertTestOutput(activeStorage, tx, 0, 100) // vout = 0, satoshis = 100
@@ -1,14 +1,6 @@
1
1
  import { EntityTxLabelMap } from '../../../../../src/storage/schema/entities/TxLabelMap'
2
- import {
3
- createSyncMap,
4
- sdk,
5
- SyncMap,
6
- TableTxLabelMap
7
- } from '../../../../../src'
8
- import {
9
- TestUtilsWalletStorage as _tu,
10
- TestWalletNoSetup
11
- } from '../../../../../test/utils/TestUtilsWalletStorage'
2
+ import { createSyncMap, sdk, SyncMap, TableTxLabelMap } from '../../../../../src'
3
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
12
4
  import { EntityTransaction } from '../../../../../src/storage/schema/entities/Transaction'
13
5
  import { EntityTxLabel } from '../../../../../src/storage/schema/entities/TxLabel'
14
6
 
@@ -143,12 +135,7 @@ describe('TxLabelMap Class Tests', () => {
143
135
  txLabelId: 456
144
136
  }
145
137
 
146
- const result = await EntityTxLabelMap.mergeFind(
147
- storage,
148
- 1,
149
- ei as TableTxLabelMap,
150
- syncMap
151
- )
138
+ const result = await EntityTxLabelMap.mergeFind(storage, 1, ei as TableTxLabelMap, syncMap)
152
139
  expect(result.found).toBe(true)
153
140
  expect(result.eo.transactionId).toBe(999)
154
141
  expect(result.eo.txLabelId).toBe(888)
@@ -209,12 +196,7 @@ describe('TxLabelMap Class Tests', () => {
209
196
  txLabel: { idMap: { 456: 888 } }
210
197
  }
211
198
 
212
- const result = await txLabelMap.mergeExisting(
213
- storage,
214
- new Date(),
215
- ei,
216
- syncMap
217
- )
199
+ const result = await txLabelMap.mergeExisting(storage, new Date(), ei, syncMap)
218
200
  expect(result).toBe(true)
219
201
  expect(storage.updateTxLabelMap).toHaveBeenCalledWith(
220
202
  123,
@@ -1,9 +1,6 @@
1
1
  import { EntityTxLabel } from '../../../../../src/storage/schema/entities/TxLabel'
2
2
  import { createSyncMap, sdk, SyncMap, TableTxLabel } from '../../../../../src'
3
- import {
4
- TestUtilsWalletStorage as _tu,
5
- TestWalletNoSetup
6
- } from '../../../../../test/utils/TestUtilsWalletStorage'
3
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
7
4
 
8
5
  describe('TxLabel Class Tests', () => {
9
6
  jest.setTimeout(99999999) // Extend timeout for database operations
@@ -116,12 +113,7 @@ describe('TxLabel Class Tests', () => {
116
113
  updated_at: new Date('2023-01-01')
117
114
  }
118
115
 
119
- const result = await txLabel.mergeExisting(
120
- activeStorage,
121
- undefined,
122
- olderEi,
123
- {} as any
124
- )
116
+ const result = await txLabel.mergeExisting(activeStorage, undefined, olderEi, {} as any)
125
117
 
126
118
  const reloadedTxLabel = await activeStorage.findTxLabelById(txLabel.id)
127
119
 
@@ -1,8 +1,5 @@
1
1
  import { stampLog, stampLogFormat } from '../../../../../src/utility/stampLog'
2
- import {
3
- TestUtilsWalletStorage as _tu,
4
- TestWalletNoSetup
5
- } from '../../../../../test/utils/TestUtilsWalletStorage'
2
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
6
3
 
7
4
  describe('stampLog and stampLogFormat Tests', () => {
8
5
  jest.setTimeout(99999999)
@@ -27,9 +24,7 @@ describe('stampLog and stampLogFormat Tests', () => {
27
24
  const lineToAdd = 'Event 2'
28
25
  const updatedLog = stampLog(initialLog, lineToAdd)
29
26
  expect(updatedLog).toContain('Event 2')
30
- expect(updatedLog).toMatch(
31
- /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z Event 2\n$/
32
- )
27
+ expect(updatedLog).toMatch(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z Event 2\n$/)
33
28
  }
34
29
  })
35
30
 
@@ -40,9 +35,7 @@ describe('stampLog and stampLogFormat Tests', () => {
40
35
  const lineToAdd = 'Event 2'
41
36
  const updatedLog = stampLog(initialLog, lineToAdd)
42
37
  expect(updatedLog).toContain('Event 2')
43
- expect(updatedLog).toMatch(
44
- /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z Event 2\n$/
45
- )
38
+ expect(updatedLog).toMatch(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z Event 2\n$/)
46
39
  }
47
40
  })
48
41
 
@@ -1,9 +1,6 @@
1
1
  import { EntityUser } from '../../../../../src/storage/schema/entities/User'
2
2
  import { createSyncMap, sdk, SyncMap, TableUser } from '../../../../../src'
3
- import {
4
- TestUtilsWalletStorage as _tu,
5
- TestWalletNoSetup
6
- } from '../../../../../test/utils/TestUtilsWalletStorage'
3
+ import { TestUtilsWalletStorage as _tu, TestWalletNoSetup } from '../../../../../test/utils/TestUtilsWalletStorage'
7
4
  describe('User class method tests', () => {
8
5
  jest.setTimeout(99999999) // Extend timeout for database operations
9
6
 
@@ -336,8 +333,8 @@ describe('User class method tests', () => {
336
333
  const trx = undefined // Optional transaction token, set as undefined.
337
334
 
338
335
  // The method should throw an error when called
339
- await expect(
340
- user.mergeNew(storage as any, userId, syncMap as any, trx)
341
- ).rejects.toThrowError('a sync chunk merge must never create a new user')
336
+ await expect(user.mergeNew(storage as any, userId, syncMap as any, trx)).rejects.toThrowError(
337
+ 'a sync chunk merge must never create a new user'
338
+ )
342
339
  })
343
340
  })
@@ -1,8 +1,6 @@
1
1
  import { sdk } from '../../../index.client'
2
2
 
3
- export interface TableSettings
4
- extends sdk.StorageIdentity,
5
- sdk.EntityTimeStamp {
3
+ export interface TableSettings extends sdk.StorageIdentity, sdk.EntityTimeStamp {
6
4
  created_at: Date
7
5
  updated_at: Date
8
6
  /**