@bsv/wallet-toolbox 1.1.6 → 1.1.8

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 (319) hide show
  1. package/docs/client.md +499 -900
  2. package/docs/monitor.md +29 -69
  3. package/docs/services.md +22 -40
  4. package/docs/setup.md +23 -65
  5. package/docs/storage.md +2163 -489
  6. package/docs/wallet.md +499 -900
  7. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +4 -4
  8. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
  9. package/out/src/monitor/tasks/TaskCheckForProofs.js +2 -2
  10. package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
  11. package/out/src/monitor/tasks/TaskSendWaiting.d.ts +2 -2
  12. package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
  13. package/out/src/monitor/tasks/TaskSendWaiting.js +2 -2
  14. package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
  15. package/out/src/sdk/StorageSyncReader.d.ts +30 -30
  16. package/out/src/sdk/StorageSyncReader.d.ts.map +1 -1
  17. package/out/src/sdk/StorageSyncReaderWriter.d.ts +60 -60
  18. package/out/src/sdk/StorageSyncReaderWriter.d.ts.map +1 -1
  19. package/out/src/sdk/WalletStorage.interfaces.d.ts +36 -36
  20. package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
  21. package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -1
  22. package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
  23. package/out/src/storage/StorageKnex.d.ts +61 -61
  24. package/out/src/storage/StorageKnex.d.ts.map +1 -1
  25. package/out/src/storage/StorageKnex.js +2 -2
  26. package/out/src/storage/StorageKnex.js.map +1 -1
  27. package/out/src/storage/StorageProvider.d.ts +16 -15
  28. package/out/src/storage/StorageProvider.d.ts.map +1 -1
  29. package/out/src/storage/StorageProvider.js +8 -8
  30. package/out/src/storage/StorageProvider.js.map +1 -1
  31. package/out/src/storage/StorageReader.d.ts +21 -21
  32. package/out/src/storage/StorageReader.d.ts.map +1 -1
  33. package/out/src/storage/StorageReader.js.map +1 -1
  34. package/out/src/storage/StorageReaderWriter.d.ts +60 -60
  35. package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
  36. package/out/src/storage/StorageReaderWriter.js.map +1 -1
  37. package/out/src/storage/StorageSyncReader.d.ts +17 -17
  38. package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
  39. package/out/src/storage/StorageSyncReader.js.map +1 -1
  40. package/out/src/storage/WalletStorageManager.d.ts +9 -9
  41. package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
  42. package/out/src/storage/WalletStorageManager.js +2 -2
  43. package/out/src/storage/WalletStorageManager.js.map +1 -1
  44. package/out/src/storage/index.all.d.ts +2 -2
  45. package/out/src/storage/index.all.d.ts.map +1 -1
  46. package/out/src/storage/index.all.js +3 -3
  47. package/out/src/storage/index.all.js.map +1 -1
  48. package/out/src/storage/index.client.d.ts +2 -2
  49. package/out/src/storage/index.client.d.ts.map +1 -1
  50. package/out/src/storage/index.client.js +2 -25
  51. package/out/src/storage/index.client.js.map +1 -1
  52. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +3 -3
  53. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
  54. package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
  55. package/out/src/storage/methods/createAction.d.ts.map +1 -1
  56. package/out/src/storage/methods/createAction.js +1 -1
  57. package/out/src/storage/methods/createAction.js.map +1 -1
  58. package/out/src/storage/methods/getBeefForTransaction.js +2 -2
  59. package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
  60. package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
  61. package/out/src/storage/methods/getSyncChunk.js.map +1 -1
  62. package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
  63. package/out/src/storage/methods/internalizeAction.js +1 -1
  64. package/out/src/storage/methods/internalizeAction.js.map +1 -1
  65. package/out/src/storage/methods/listActions.js.map +1 -1
  66. package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
  67. package/out/src/storage/methods/listCertificates.js.map +1 -1
  68. package/out/src/storage/methods/listOutputs.js.map +1 -1
  69. package/out/src/storage/methods/processAction.d.ts +4 -4
  70. package/out/src/storage/methods/processAction.d.ts.map +1 -1
  71. package/out/src/storage/methods/processAction.js +2 -2
  72. package/out/src/storage/methods/processAction.js.map +1 -1
  73. package/out/src/storage/methods/purgeData.d.ts.map +1 -1
  74. package/out/src/storage/methods/purgeData.js +4 -2
  75. package/out/src/storage/methods/purgeData.js.map +1 -1
  76. package/out/src/storage/methods/reviewStatus.js +1 -1
  77. package/out/src/storage/methods/reviewStatus.js.map +1 -1
  78. package/out/src/storage/remoting/StorageClient.d.ts +11 -11
  79. package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
  80. package/out/src/storage/remoting/StorageClient.js.map +1 -1
  81. package/out/src/storage/schema/entities/Certificate.d.ts +9 -9
  82. package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -1
  83. package/out/src/storage/schema/entities/Certificate.js +5 -5
  84. package/out/src/storage/schema/entities/Certificate.js.map +1 -1
  85. package/out/src/storage/schema/entities/CertificateField.d.ts +9 -9
  86. package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -1
  87. package/out/src/storage/schema/entities/CertificateField.js +5 -5
  88. package/out/src/storage/schema/entities/CertificateField.js.map +1 -1
  89. package/out/src/storage/schema/entities/Commission.d.ts +9 -9
  90. package/out/src/storage/schema/entities/Commission.d.ts.map +1 -1
  91. package/out/src/storage/schema/entities/Commission.js +5 -5
  92. package/out/src/storage/schema/entities/Commission.js.map +1 -1
  93. package/out/src/storage/schema/entities/EntityBase.d.ts +1 -1
  94. package/out/src/storage/schema/entities/MergeEntity.d.ts +6 -7
  95. package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
  96. package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
  97. package/out/src/storage/schema/entities/Output.d.ts +9 -9
  98. package/out/src/storage/schema/entities/Output.d.ts.map +1 -1
  99. package/out/src/storage/schema/entities/Output.js +5 -5
  100. package/out/src/storage/schema/entities/Output.js.map +1 -1
  101. package/out/src/storage/schema/entities/OutputBasket.d.ts +9 -9
  102. package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -1
  103. package/out/src/storage/schema/entities/OutputBasket.js +5 -5
  104. package/out/src/storage/schema/entities/OutputBasket.js.map +1 -1
  105. package/out/src/storage/schema/entities/OutputTag.d.ts +9 -9
  106. package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -1
  107. package/out/src/storage/schema/entities/OutputTag.js +5 -5
  108. package/out/src/storage/schema/entities/OutputTag.js.map +1 -1
  109. package/out/src/storage/schema/entities/OutputTagMap.d.ts +9 -9
  110. package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -1
  111. package/out/src/storage/schema/entities/OutputTagMap.js +5 -5
  112. package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -1
  113. package/out/src/storage/schema/entities/ProvenTx.d.ts +11 -11
  114. package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -1
  115. package/out/src/storage/schema/entities/ProvenTx.js +11 -11
  116. package/out/src/storage/schema/entities/ProvenTx.js.map +1 -1
  117. package/out/src/storage/schema/entities/ProvenTxReq.d.ts +19 -19
  118. package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -1
  119. package/out/src/storage/schema/entities/ProvenTxReq.js +13 -13
  120. package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -1
  121. package/out/src/storage/schema/entities/SyncState.d.ts +11 -11
  122. package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -1
  123. package/out/src/storage/schema/entities/SyncState.js +27 -27
  124. package/out/src/storage/schema/entities/SyncState.js.map +1 -1
  125. package/out/src/storage/schema/entities/Transaction.d.ts +11 -11
  126. package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -1
  127. package/out/src/storage/schema/entities/Transaction.js +6 -6
  128. package/out/src/storage/schema/entities/Transaction.js.map +1 -1
  129. package/out/src/storage/schema/entities/TxLabel.d.ts +9 -9
  130. package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -1
  131. package/out/src/storage/schema/entities/TxLabel.js +5 -5
  132. package/out/src/storage/schema/entities/TxLabel.js.map +1 -1
  133. package/out/src/storage/schema/entities/TxLabelMap.d.ts +9 -9
  134. package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -1
  135. package/out/src/storage/schema/entities/TxLabelMap.js +5 -5
  136. package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -1
  137. package/out/src/storage/schema/entities/User.d.ts +9 -9
  138. package/out/src/storage/schema/entities/User.d.ts.map +1 -1
  139. package/out/src/storage/schema/entities/User.js +5 -5
  140. package/out/src/storage/schema/entities/User.js.map +1 -1
  141. package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js +20 -307
  142. package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -1
  143. package/out/src/storage/schema/entities/__tests/CertificateTests.test.js +17 -158
  144. package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -1
  145. package/out/src/storage/schema/entities/__tests/CommissionTests.test.js +23 -309
  146. package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -1
  147. package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js +19 -306
  148. package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -1
  149. package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js +19 -306
  150. package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -1
  151. package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js +23 -237
  152. package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -1
  153. package/out/src/storage/schema/entities/__tests/OutputTests.test.js +20 -233
  154. package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -1
  155. package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js +27 -98
  156. package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -1
  157. package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +25 -241
  158. package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
  159. package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js +38 -112
  160. package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -1
  161. package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +39 -323
  162. package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -1
  163. package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js +31 -169
  164. package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -1
  165. package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js +16 -159
  166. package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -1
  167. package/out/src/storage/schema/entities/__tests/usersTests.test.js +21 -168
  168. package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -1
  169. package/out/src/storage/schema/tables/Certificate.d.ts +4 -4
  170. package/out/src/storage/schema/tables/Certificate.d.ts.map +1 -1
  171. package/out/src/storage/schema/tables/CertificateField.d.ts +1 -1
  172. package/out/src/storage/schema/tables/CertificateField.d.ts.map +1 -1
  173. package/out/src/storage/schema/tables/Commission.d.ts +1 -1
  174. package/out/src/storage/schema/tables/Commission.d.ts.map +1 -1
  175. package/out/src/storage/schema/tables/MonitorEvent.d.ts +1 -1
  176. package/out/src/storage/schema/tables/MonitorEvent.d.ts.map +1 -1
  177. package/out/src/storage/schema/tables/Output.d.ts +5 -5
  178. package/out/src/storage/schema/tables/Output.d.ts.map +1 -1
  179. package/out/src/storage/schema/tables/OutputBasket.d.ts +1 -1
  180. package/out/src/storage/schema/tables/OutputBasket.d.ts.map +1 -1
  181. package/out/src/storage/schema/tables/OutputTag.d.ts +1 -1
  182. package/out/src/storage/schema/tables/OutputTag.d.ts.map +1 -1
  183. package/out/src/storage/schema/tables/OutputTagMap.d.ts +1 -1
  184. package/out/src/storage/schema/tables/OutputTagMap.d.ts.map +1 -1
  185. package/out/src/storage/schema/tables/ProvenTx.d.ts +1 -1
  186. package/out/src/storage/schema/tables/ProvenTx.d.ts.map +1 -1
  187. package/out/src/storage/schema/tables/ProvenTxReq.d.ts +2 -2
  188. package/out/src/storage/schema/tables/ProvenTxReq.d.ts.map +1 -1
  189. package/out/src/storage/schema/tables/SyncState.d.ts +1 -1
  190. package/out/src/storage/schema/tables/SyncState.d.ts.map +1 -1
  191. package/out/src/storage/schema/tables/{Settings.d.ts → TableSettings.d.ts} +2 -2
  192. package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -0
  193. package/out/src/storage/schema/tables/{Settings.js → TableSettings.js} +1 -1
  194. package/out/src/storage/schema/tables/TableSettings.js.map +1 -0
  195. package/out/src/storage/schema/tables/Transaction.d.ts +1 -1
  196. package/out/src/storage/schema/tables/Transaction.d.ts.map +1 -1
  197. package/out/src/storage/schema/tables/TxLabel.d.ts +1 -1
  198. package/out/src/storage/schema/tables/TxLabel.d.ts.map +1 -1
  199. package/out/src/storage/schema/tables/TxLabelMap.d.ts +1 -1
  200. package/out/src/storage/schema/tables/TxLabelMap.d.ts.map +1 -1
  201. package/out/src/storage/schema/tables/User.d.ts +1 -1
  202. package/out/src/storage/schema/tables/User.d.ts.map +1 -1
  203. package/out/src/storage/schema/tables/index.d.ts +1 -1
  204. package/out/src/storage/schema/tables/index.d.ts.map +1 -1
  205. package/out/src/storage/schema/tables/index.js +1 -1
  206. package/out/src/storage/schema/tables/index.js.map +1 -1
  207. package/out/src/storage/sync/StorageMySQLDojoReader.d.ts +17 -17
  208. package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
  209. package/out/src/storage/sync/StorageMySQLDojoReader.js +2 -2
  210. package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -1
  211. package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -1
  212. package/out/test/Wallet/live/walletLive.man.test.d.ts.map +1 -1
  213. package/out/test/Wallet/live/walletLive.man.test.js +35 -1
  214. package/out/test/Wallet/live/walletLive.man.test.js.map +1 -1
  215. package/out/test/monitor/Monitor.test.js +7 -7
  216. package/out/test/monitor/Monitor.test.js.map +1 -1
  217. package/out/test/storage/StorageMySQLDojoReader.man.test.js +1 -1
  218. package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -1
  219. package/out/test/storage/insert.test.js.map +1 -1
  220. package/out/test/storage/update.test.js.map +1 -1
  221. package/out/test/storage/update2.test.js.map +1 -1
  222. package/out/test/utils/TestUtilsWalletStorage.d.ts +56 -56
  223. package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
  224. package/out/test/utils/TestUtilsWalletStorage.js +11 -4
  225. package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
  226. package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -1
  227. package/out/tsconfig.all.tsbuildinfo +1 -1
  228. package/package.json +2 -2
  229. package/src/monitor/tasks/TaskCheckForProofs.ts +11 -10
  230. package/src/monitor/tasks/TaskSendWaiting.ts +5 -5
  231. package/src/sdk/StorageSyncReader.ts +47 -30
  232. package/src/sdk/StorageSyncReaderWriter.ts +77 -63
  233. package/src/sdk/WalletStorage.interfaces.ts +55 -36
  234. package/src/signer/methods/acquireDirectCertificate.ts +2 -2
  235. package/src/storage/StorageKnex.ts +124 -104
  236. package/src/storage/StorageProvider.ts +43 -30
  237. package/src/storage/StorageReader.ts +36 -21
  238. package/src/storage/StorageReaderWriter.ts +78 -65
  239. package/src/storage/StorageSyncReader.ts +34 -17
  240. package/src/storage/WalletStorageManager.ts +17 -12
  241. package/src/storage/index.all.ts +2 -2
  242. package/src/storage/index.client.ts +2 -2
  243. package/src/storage/methods/attemptToPostReqsToNetwork.ts +3 -3
  244. package/src/storage/methods/createAction.ts +29 -26
  245. package/src/storage/methods/getBeefForTransaction.ts +3 -3
  246. package/src/storage/methods/getSyncChunk.ts +28 -13
  247. package/src/storage/methods/internalizeAction.ts +19 -17
  248. package/src/storage/methods/listActions.ts +5 -5
  249. package/src/storage/methods/listCertificates.ts +2 -2
  250. package/src/storage/methods/listOutputs.ts +5 -5
  251. package/src/storage/methods/processAction.ts +21 -17
  252. package/src/storage/methods/purgeData.ts +20 -12
  253. package/src/storage/methods/reviewStatus.ts +5 -5
  254. package/src/storage/remoting/StorageClient.ts +28 -18
  255. package/src/storage/schema/entities/Certificate.ts +16 -17
  256. package/src/storage/schema/entities/CertificateField.ts +17 -18
  257. package/src/storage/schema/entities/Commission.ts +16 -20
  258. package/src/storage/schema/entities/EntityBase.ts +1 -1
  259. package/src/storage/schema/entities/MergeEntity.ts +7 -7
  260. package/src/storage/schema/entities/Output.ts +16 -20
  261. package/src/storage/schema/entities/OutputBasket.ts +16 -17
  262. package/src/storage/schema/entities/OutputTag.ts +16 -20
  263. package/src/storage/schema/entities/OutputTagMap.ts +17 -18
  264. package/src/storage/schema/entities/ProvenTx.ts +24 -28
  265. package/src/storage/schema/entities/ProvenTxReq.ts +42 -45
  266. package/src/storage/schema/entities/SyncState.ts +61 -38
  267. package/src/storage/schema/entities/Transaction.ts +23 -23
  268. package/src/storage/schema/entities/TxLabel.ts +16 -17
  269. package/src/storage/schema/entities/TxLabelMap.ts +16 -20
  270. package/src/storage/schema/entities/User.ts +15 -19
  271. package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +39 -318
  272. package/src/storage/schema/entities/__tests/CertificateTests.test.ts +29 -169
  273. package/src/storage/schema/entities/__tests/CommissionTests.test.ts +47 -325
  274. package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +35 -316
  275. package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +38 -318
  276. package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +36 -249
  277. package/src/storage/schema/entities/__tests/OutputTests.test.ts +30 -244
  278. package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +35 -101
  279. package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +27 -243
  280. package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +54 -122
  281. package/src/storage/schema/entities/__tests/TransactionTests.test.ts +53 -333
  282. package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +44 -177
  283. package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +19 -163
  284. package/src/storage/schema/entities/__tests/usersTests.test.ts +31 -179
  285. package/src/storage/schema/tables/Certificate.ts +4 -4
  286. package/src/storage/schema/tables/CertificateField.ts +1 -1
  287. package/src/storage/schema/tables/Commission.ts +1 -1
  288. package/src/storage/schema/tables/MonitorEvent.ts +1 -1
  289. package/src/storage/schema/tables/Output.ts +5 -5
  290. package/src/storage/schema/tables/OutputBasket.ts +1 -1
  291. package/src/storage/schema/tables/OutputTag.ts +1 -1
  292. package/src/storage/schema/tables/OutputTagMap.ts +1 -1
  293. package/src/storage/schema/tables/ProvenTx.ts +1 -1
  294. package/src/storage/schema/tables/ProvenTxReq.ts +2 -2
  295. package/src/storage/schema/tables/SyncState.ts +1 -1
  296. package/src/storage/schema/tables/{Settings.ts → TableSettings.ts} +3 -1
  297. package/src/storage/schema/tables/Transaction.ts +1 -1
  298. package/src/storage/schema/tables/TxLabel.ts +1 -1
  299. package/src/storage/schema/tables/TxLabelMap.ts +1 -1
  300. package/src/storage/schema/tables/User.ts +1 -1
  301. package/src/storage/schema/tables/index.ts +1 -1
  302. package/src/storage/sync/StorageMySQLDojoReader.ts +67 -50
  303. package/test/Wallet/certificate/listCertificates.test.ts +12 -8
  304. package/test/Wallet/live/walletLive.man.test.ts +46 -6
  305. package/test/monitor/Monitor.test.ts +8 -8
  306. package/test/storage/StorageMySQLDojoReader.man.test.ts +1 -1
  307. package/test/storage/insert.test.ts +2 -2
  308. package/test/storage/update.test.ts +30 -30
  309. package/test/storage/update2.test.ts +23 -24
  310. package/test/utils/TestUtilsWalletStorage.ts +103 -82
  311. package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +1 -2
  312. package/ts2md.json +12 -6
  313. package/out/src/storage/index.db.d.ts +0 -1
  314. package/out/src/storage/index.db.d.ts.map +0 -1
  315. package/out/src/storage/index.db.js +0 -2
  316. package/out/src/storage/index.db.js.map +0 -1
  317. package/out/src/storage/schema/tables/Settings.d.ts.map +0 -1
  318. package/out/src/storage/schema/tables/Settings.js.map +0 -1
  319. package/src/storage/index.db.ts +0 -0
@@ -2,53 +2,53 @@ import { MerklePath } from '@bsv/sdk'
2
2
  import {
3
3
  arraysEqual,
4
4
  asString,
5
- entity,
6
5
  sdk,
7
6
  StorageProvider,
8
- table,
7
+ TableProvenTxReq,
8
+ TableProvenTxReqDynamics,
9
9
  verifyId,
10
10
  verifyOne,
11
11
  verifyOneOrNone,
12
12
  verifyTruthy,
13
13
  WalletStorageManager
14
14
  } from '../../../index.client'
15
- import { EntityBase } from '.'
15
+ import { EntityBase, EntityStorage, SyncMap } from '.'
16
16
 
17
17
  import { StorageProcessActionArgs } from '../../../sdk'
18
18
 
19
- export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
19
+ export class EntityProvenTxReq extends EntityBase<TableProvenTxReq> {
20
20
  static async fromStorageTxid(
21
- storage: entity.EntityStorage,
21
+ storage: EntityStorage,
22
22
  txid: string,
23
23
  trx?: sdk.TrxToken
24
- ): Promise<ProvenTxReq | undefined> {
24
+ ): Promise<EntityProvenTxReq | undefined> {
25
25
  const reqApi = verifyOneOrNone(
26
26
  await storage.findProvenTxReqs({ partial: { txid }, trx })
27
27
  )
28
28
  if (!reqApi) return undefined
29
- return new ProvenTxReq(reqApi)
29
+ return new EntityProvenTxReq(reqApi)
30
30
  }
31
31
 
32
32
  static async fromStorageId(
33
- storage: entity.EntityStorage,
33
+ storage: EntityStorage,
34
34
  id: number,
35
35
  trx?: sdk.TrxToken
36
- ): Promise<ProvenTxReq> {
36
+ ): Promise<EntityProvenTxReq> {
37
37
  const reqApi = verifyOneOrNone(
38
38
  await storage.findProvenTxReqs({ partial: { provenTxReqId: id }, trx })
39
39
  )
40
40
  if (!reqApi)
41
41
  throw new sdk.WERR_INTERNAL(`proven_tx_reqs with id ${id} is missing.`)
42
- return new ProvenTxReq(reqApi)
42
+ return new EntityProvenTxReq(reqApi)
43
43
  }
44
44
 
45
45
  static fromTxid(
46
46
  txid: string,
47
47
  rawTx: number[],
48
48
  inputBEEF?: number[]
49
- ): ProvenTxReq {
49
+ ): EntityProvenTxReq {
50
50
  const now = new Date()
51
- return new ProvenTxReq({
51
+ return new EntityProvenTxReq({
52
52
  provenTxReqId: 0,
53
53
  created_at: now,
54
54
  updated_at: now,
@@ -118,7 +118,7 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
118
118
  }
119
119
 
120
120
  async refreshFromStorage(
121
- storage: entity.EntityStorage | WalletStorageManager
121
+ storage: EntityStorage | WalletStorageManager
122
122
  ): Promise<void> {
123
123
  const newApi = verifyOne(
124
124
  await storage.findProvenTxReqs({ partial: { provenTxReqId: this.id } })
@@ -127,7 +127,7 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
127
127
  this.unpackApi()
128
128
  }
129
129
 
130
- constructor(api?: table.ProvenTxReq) {
130
+ constructor(api?: TableProvenTxReq) {
131
131
  const now = new Date()
132
132
  super(
133
133
  api || {
@@ -294,18 +294,18 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
294
294
  }
295
295
 
296
296
  /**
297
- * Updates database record with current state of this entity.
297
+ * Updates database record with current state of this EntityUser
298
298
 
299
299
  * @param storage
300
300
  * @param trx
301
301
  */
302
- async updateStorage(storage: entity.EntityStorage, trx?: sdk.TrxToken) {
302
+ async updateStorage(storage: EntityStorage, trx?: sdk.TrxToken) {
303
303
  this.updated_at = new Date()
304
304
  this.updateApi()
305
305
  if (this.id === 0) {
306
306
  await storage.insertProvenTxReq(this.api)
307
307
  }
308
- const update: Partial<table.ProvenTxReq> = { ...this.api }
308
+ const update: Partial<TableProvenTxReq> = { ...this.api }
309
309
  await storage.updateProvenTxReq(this.id, update, trx)
310
310
  }
311
311
 
@@ -329,7 +329,7 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
329
329
  ) {
330
330
  this.updated_at = new Date()
331
331
  this.updateApi()
332
- const update: Partial<table.ProvenTxReqDynamics> = {
332
+ const update: Partial<TableProvenTxReqDynamics> = {
333
333
  updated_at: this.api.updated_at,
334
334
  provenTxId: this.api.provenTxId,
335
335
  status: this.api.status,
@@ -351,19 +351,19 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
351
351
  }
352
352
 
353
353
  async insertOrMerge(
354
- storage: entity.EntityStorage,
354
+ storage: EntityStorage,
355
355
  trx?: sdk.TrxToken
356
- ): Promise<ProvenTxReq> {
357
- const req = await storage.transaction<ProvenTxReq>(async trx => {
356
+ ): Promise<EntityProvenTxReq> {
357
+ const req = await storage.transaction<EntityProvenTxReq>(async trx => {
358
358
  let reqApi0 = this.toApi()
359
359
  const { req: reqApi1, isNew } = await storage.findOrInsertProvenTxReq(
360
360
  reqApi0,
361
361
  trx
362
362
  )
363
363
  if (isNew) {
364
- return new entity.ProvenTxReq(reqApi1)
364
+ return new EntityProvenTxReq(reqApi1)
365
365
  } else {
366
- const req = new ProvenTxReq(reqApi1)
366
+ const req = new EntityProvenTxReq(reqApi1)
367
367
  req.mergeNotifyTransactionIds(reqApi0)
368
368
  req.mergeHistory(reqApi0)
369
369
  await req.updateStorage(storage, trx)
@@ -457,7 +457,7 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
457
457
  this.api.provenTxReqId = v
458
458
  }
459
459
  override get entityName(): string {
460
- return 'ProvenTxReq'
460
+ return 'provenTxReq'
461
461
  }
462
462
  override get entityTable(): string {
463
463
  return 'proven_tx_reqs'
@@ -467,8 +467,8 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
467
467
  * 'convergent' equality must satisfy (A sync B) equals (B sync A)
468
468
  */
469
469
  override equals(
470
- ei: table.ProvenTxReq,
471
- syncMap?: entity.SyncMap | undefined
470
+ ei: TableProvenTxReq,
471
+ syncMap?: SyncMap | undefined
472
472
  ): boolean {
473
473
  const eo = this.toApi()
474
474
  if (
@@ -513,23 +513,23 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
513
513
  }
514
514
 
515
515
  static async mergeFind(
516
- storage: entity.EntityStorage,
516
+ storage: EntityStorage,
517
517
  userId: number,
518
- ei: table.ProvenTxReq,
519
- syncMap: entity.SyncMap,
518
+ ei: TableProvenTxReq,
519
+ syncMap: SyncMap,
520
520
  trx?: sdk.TrxToken
521
- ): Promise<{ found: boolean; eo: ProvenTxReq; eiId: number }> {
521
+ ): Promise<{ found: boolean; eo: EntityProvenTxReq; eiId: number }> {
522
522
  const ef = verifyOneOrNone(
523
523
  await storage.findProvenTxReqs({ partial: { txid: ei.txid }, trx })
524
524
  )
525
525
  return {
526
526
  found: !!ef,
527
- eo: new ProvenTxReq(ef || { ...ei }),
527
+ eo: new EntityProvenTxReq(ef || { ...ei }),
528
528
  eiId: verifyId(ei.provenTxReqId)
529
529
  }
530
530
  }
531
531
 
532
- mapNotifyTransactionIds(syncMap: entity.SyncMap): void {
532
+ mapNotifyTransactionIds(syncMap: SyncMap): void {
533
533
  // Map external notification transaction ids to local ids
534
534
  const externalIds = this.notify.transactionIds || []
535
535
  this.notify.transactionIds = []
@@ -542,12 +542,9 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
542
542
  }
543
543
  }
544
544
 
545
- mergeNotifyTransactionIds(
546
- ei: table.ProvenTxReq,
547
- syncMap?: entity.SyncMap
548
- ): void {
545
+ mergeNotifyTransactionIds(ei: TableProvenTxReq, syncMap?: SyncMap): void {
549
546
  // Map external notification transaction ids to local ids and merge them if they exist.
550
- const eie = new ProvenTxReq(ei)
547
+ const eie = new EntityProvenTxReq(ei)
551
548
  if (eie.notify.transactionIds) {
552
549
  this.notify.transactionIds ||= []
553
550
  for (const transactionId of eie.notify.transactionIds) {
@@ -563,11 +560,11 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
563
560
 
564
561
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
565
562
  mergeHistory(
566
- ei: table.ProvenTxReq,
567
- syncMap?: entity.SyncMap,
563
+ ei: TableProvenTxReq,
564
+ syncMap?: SyncMap,
568
565
  noDupes?: boolean
569
566
  ): void {
570
- const eie = new ProvenTxReq(ei)
567
+ const eie = new EntityProvenTxReq(ei)
571
568
  if (eie.history.notes) {
572
569
  for (const [k, v] of Object.entries(eie.history.notes)) {
573
570
  this.addHistoryNote(v, new Date(k), noDupes)
@@ -580,9 +577,9 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
580
577
  }
581
578
 
582
579
  override async mergeNew(
583
- storage: entity.EntityStorage,
580
+ storage: EntityStorage,
584
581
  userId: number,
585
- syncMap: entity.SyncMap,
582
+ syncMap: SyncMap,
586
583
  trx?: sdk.TrxToken
587
584
  ): Promise<void> {
588
585
  if (this.provenTxId)
@@ -605,10 +602,10 @@ export class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
605
602
  * On terminal failure: `doubleSpend` trumps `invalid` as it contains more data.
606
603
  */
607
604
  override async mergeExisting(
608
- storage: entity.EntityStorage,
605
+ storage: EntityStorage,
609
606
  since: Date | undefined,
610
- ei: table.ProvenTxReq,
611
- syncMap: entity.SyncMap,
607
+ ei: TableProvenTxReq,
608
+ syncMap: SyncMap,
612
609
  trx?: sdk.TrxToken
613
610
  ): Promise<boolean> {
614
611
  if (!this.batch && ei.batch) this.batch = ei.batch
@@ -1,24 +1,38 @@
1
1
  import {
2
2
  createSyncMap,
3
3
  EntityBase,
4
+ EntityCertificate,
5
+ EntityCertificateField,
6
+ EntityCommission,
7
+ EntityOutput,
8
+ EntityOutputBasket,
9
+ EntityOutputTag,
10
+ EntityOutputTagMap,
11
+ EntityProvenTx,
12
+ EntityProvenTxReq,
13
+ EntityStorage,
4
14
  EntitySyncMap,
15
+ EntityTransaction,
16
+ EntityTxLabel,
17
+ EntityTxLabelMap,
18
+ EntityUser,
5
19
  MergeEntity,
6
20
  SyncError,
7
21
  SyncMap
8
22
  } from '.'
9
23
  import {
10
- entity,
11
24
  maxDate,
12
25
  sdk,
13
- table,
26
+ TableSettings,
27
+ TableSyncState,
14
28
  verifyId,
15
29
  verifyOne,
16
30
  verifyOneOrNone,
17
31
  verifyTruthy
18
32
  } from '../../../index.client'
19
33
 
20
- export class SyncState extends EntityBase<table.SyncState> {
21
- constructor(api?: table.SyncState) {
34
+ export class EntitySyncState extends EntityBase<TableSyncState> {
35
+ constructor(api?: TableSyncState) {
22
36
  const now = new Date()
23
37
  super(
24
38
  api || {
@@ -48,7 +62,7 @@ export class SyncState extends EntityBase<table.SyncState> {
48
62
  this.validateSyncMap(this.syncMap)
49
63
  }
50
64
 
51
- validateSyncMap(sm: entity.SyncMap) {
65
+ validateSyncMap(sm: SyncMap) {
52
66
  for (const key of Object.keys(sm)) {
53
67
  const esm: EntitySyncMap = sm[key]
54
68
  if (typeof esm.maxUpdated_at === 'string')
@@ -59,8 +73,8 @@ export class SyncState extends EntityBase<table.SyncState> {
59
73
  static async fromStorage(
60
74
  storage: sdk.WalletStorageSync,
61
75
  userIdentityKey: string,
62
- remoteSettings: table.Settings
63
- ): Promise<entity.SyncState> {
76
+ remoteSettings: TableSettings
77
+ ): Promise<EntitySyncState> {
64
78
  const { user } = verifyTruthy(
65
79
  await storage.findOrInsertUser(userIdentityKey)
66
80
  )
@@ -71,7 +85,7 @@ export class SyncState extends EntityBase<table.SyncState> {
71
85
  remoteSettings.storageName
72
86
  )
73
87
  )
74
- const ss = new SyncState(api)
88
+ const ss = new EntitySyncState(api)
75
89
  return ss
76
90
  }
77
91
 
@@ -82,7 +96,7 @@ export class SyncState extends EntityBase<table.SyncState> {
82
96
  * @param trx
83
97
  */
84
98
  async updateStorage(
85
- storage: entity.EntityStorage,
99
+ storage: EntityStorage,
86
100
  notSyncMap?: boolean,
87
101
  trx?: sdk.TrxToken
88
102
  ) {
@@ -91,7 +105,7 @@ export class SyncState extends EntityBase<table.SyncState> {
91
105
  if (this.id === 0) {
92
106
  await storage.insertSyncState(this.api)
93
107
  } else {
94
- const update: Partial<table.SyncState> = { ...this.api }
108
+ const update: Partial<TableSyncState> = { ...this.api }
95
109
  if (notSyncMap) delete update.syncMap
96
110
  delete update.created_at
97
111
  await storage.updateSyncState(verifyId(this.id), update, trx)
@@ -183,7 +197,7 @@ export class SyncState extends EntityBase<table.SyncState> {
183
197
  this.api.syncStateId = id
184
198
  }
185
199
  override get entityName(): string {
186
- return 'table.SyncState'
200
+ return 'syncState'
187
201
  }
188
202
  override get entityTable(): string {
189
203
  return 'sync_states'
@@ -209,30 +223,39 @@ export class SyncState extends EntityBase<table.SyncState> {
209
223
  * @param iSyncMap
210
224
  */
211
225
  mergeSyncMap(iSyncMap: SyncMap) {
212
- SyncState.mergeIdMap(iSyncMap.provenTx.idMap!, this.syncMap.provenTx.idMap!)
213
- SyncState.mergeIdMap(
226
+ EntitySyncState.mergeIdMap(
227
+ iSyncMap.provenTx.idMap!,
228
+ this.syncMap.provenTx.idMap!
229
+ )
230
+ EntitySyncState.mergeIdMap(
214
231
  iSyncMap.outputBasket.idMap!,
215
232
  this.syncMap.outputBasket.idMap!
216
233
  )
217
- SyncState.mergeIdMap(
234
+ EntitySyncState.mergeIdMap(
218
235
  iSyncMap.transaction.idMap!,
219
236
  this.syncMap.transaction.idMap!
220
237
  )
221
- SyncState.mergeIdMap(
238
+ EntitySyncState.mergeIdMap(
222
239
  iSyncMap.provenTxReq.idMap!,
223
240
  this.syncMap.provenTxReq.idMap!
224
241
  )
225
- SyncState.mergeIdMap(iSyncMap.txLabel.idMap!, this.syncMap.txLabel.idMap!)
226
- SyncState.mergeIdMap(iSyncMap.output.idMap!, this.syncMap.output.idMap!)
227
- SyncState.mergeIdMap(
242
+ EntitySyncState.mergeIdMap(
243
+ iSyncMap.txLabel.idMap!,
244
+ this.syncMap.txLabel.idMap!
245
+ )
246
+ EntitySyncState.mergeIdMap(
247
+ iSyncMap.output.idMap!,
248
+ this.syncMap.output.idMap!
249
+ )
250
+ EntitySyncState.mergeIdMap(
228
251
  iSyncMap.outputTag.idMap!,
229
252
  this.syncMap.outputTag.idMap!
230
253
  )
231
- SyncState.mergeIdMap(
254
+ EntitySyncState.mergeIdMap(
232
255
  iSyncMap.certificate.idMap!,
233
256
  this.syncMap.certificate.idMap!
234
257
  )
235
- SyncState.mergeIdMap(
258
+ EntitySyncState.mergeIdMap(
236
259
  iSyncMap.commission.idMap!,
237
260
  this.syncMap.commission.idMap!
238
261
  )
@@ -257,21 +280,21 @@ export class SyncState extends EntityBase<table.SyncState> {
257
280
  return JSON.stringify(es)
258
281
  }
259
282
 
260
- override equals(ei: table.SyncState, syncMap?: SyncMap | undefined): boolean {
283
+ override equals(ei: TableSyncState, syncMap?: SyncMap | undefined): boolean {
261
284
  return false
262
285
  }
263
286
 
264
287
  override async mergeNew(
265
- storage: entity.EntityStorage,
288
+ storage: EntityStorage,
266
289
  userId: number,
267
290
  syncMap: SyncMap,
268
291
  trx?: sdk.TrxToken
269
292
  ): Promise<void> {}
270
293
 
271
294
  override async mergeExisting(
272
- storage: entity.EntityStorage,
295
+ storage: EntityStorage,
273
296
  since: Date | undefined,
274
- ei: table.SyncState,
297
+ ei: TableSyncState,
275
298
  syncMap: SyncMap,
276
299
  trx?: sdk.TrxToken
277
300
  ): Promise<boolean> {
@@ -313,7 +336,7 @@ export class SyncState extends EntityBase<table.SyncState> {
313
336
  }
314
337
 
315
338
  async processSyncChunk(
316
- writer: entity.EntityStorage,
339
+ writer: EntityStorage,
317
340
  args: sdk.RequestSyncChunkArgs,
318
341
  chunk: sdk.SyncChunk
319
342
  ): Promise<{
@@ -325,62 +348,62 @@ export class SyncState extends EntityBase<table.SyncState> {
325
348
  const mes = [
326
349
  new MergeEntity(
327
350
  chunk.provenTxs,
328
- entity.ProvenTx.mergeFind,
351
+ EntityProvenTx.mergeFind,
329
352
  this.syncMap.provenTx
330
353
  ),
331
354
  new MergeEntity(
332
355
  chunk.outputBaskets,
333
- entity.OutputBasket.mergeFind,
356
+ EntityOutputBasket.mergeFind,
334
357
  this.syncMap.outputBasket
335
358
  ),
336
359
  new MergeEntity(
337
360
  chunk.outputTags,
338
- entity.OutputTag.mergeFind,
361
+ EntityOutputTag.mergeFind,
339
362
  this.syncMap.outputTag
340
363
  ),
341
364
  new MergeEntity(
342
365
  chunk.txLabels,
343
- entity.TxLabel.mergeFind,
366
+ EntityTxLabel.mergeFind,
344
367
  this.syncMap.txLabel
345
368
  ),
346
369
  new MergeEntity(
347
370
  chunk.transactions,
348
- entity.Transaction.mergeFind,
371
+ EntityTransaction.mergeFind,
349
372
  this.syncMap.transaction
350
373
  ),
351
374
  new MergeEntity(
352
375
  chunk.outputs,
353
- entity.Output.mergeFind,
376
+ EntityOutput.mergeFind,
354
377
  this.syncMap.output
355
378
  ),
356
379
  new MergeEntity(
357
380
  chunk.txLabelMaps,
358
- entity.TxLabelMap.mergeFind,
381
+ EntityTxLabelMap.mergeFind,
359
382
  this.syncMap.txLabelMap
360
383
  ),
361
384
  new MergeEntity(
362
385
  chunk.outputTagMaps,
363
- entity.OutputTagMap.mergeFind,
386
+ EntityOutputTagMap.mergeFind,
364
387
  this.syncMap.outputTagMap
365
388
  ),
366
389
  new MergeEntity(
367
390
  chunk.certificates,
368
- entity.Certificate.mergeFind,
391
+ EntityCertificate.mergeFind,
369
392
  this.syncMap.certificate
370
393
  ),
371
394
  new MergeEntity(
372
395
  chunk.certificateFields,
373
- entity.CertificateField.mergeFind,
396
+ EntityCertificateField.mergeFind,
374
397
  this.syncMap.certificateField
375
398
  ),
376
399
  new MergeEntity(
377
400
  chunk.commissions,
378
- entity.Commission.mergeFind,
401
+ EntityCommission.mergeFind,
379
402
  this.syncMap.commission
380
403
  ),
381
404
  new MergeEntity(
382
405
  chunk.provenTxReqs,
383
- entity.ProvenTxReq.mergeFind,
406
+ EntityProvenTxReq.mergeFind,
384
407
  this.syncMap.provenTxReq
385
408
  )
386
409
  ]
@@ -393,7 +416,7 @@ export class SyncState extends EntityBase<table.SyncState> {
393
416
  // Merge User
394
417
  if (chunk.user) {
395
418
  const ei = chunk.user
396
- const { found, eo } = await entity.User.mergeFind(writer, this.userId, ei)
419
+ const { found, eo } = await EntityUser.mergeFind(writer, this.userId, ei)
397
420
  if (found) {
398
421
  if (await eo.mergeExisting(writer, args.since, ei)) {
399
422
  maxUpdated_at = maxDate(maxUpdated_at, ei.updated_at)
@@ -1,16 +1,16 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  import { Transaction as BsvTransaction, TransactionInput } from '@bsv/sdk'
3
3
  import {
4
- entity,
5
4
  optionalArraysEqual,
6
5
  sdk,
7
- table,
6
+ TableOutput,
7
+ TableTransaction,
8
8
  verifyId,
9
9
  verifyOneOrNone
10
10
  } from '../../../index.client'
11
- import { EntityBase } from '.'
11
+ import { EntityBase, EntityProvenTx, EntityStorage, SyncMap } from '.'
12
12
 
13
- export class Transaction extends EntityBase<table.Transaction> {
13
+ export class EntityTransaction extends EntityBase<TableTransaction> {
14
14
  /**
15
15
  * @returns @bsv/sdk Transaction object from parsed rawTx.
16
16
  * If rawTx is undefined, returns undefined.
@@ -36,9 +36,9 @@ export class Transaction extends EntityBase<table.Transaction> {
36
36
  * Not all transaction inputs correspond to prior storage outputs.
37
37
  */
38
38
  async getInputs(
39
- storage: entity.EntityStorage,
39
+ storage: EntityStorage,
40
40
  trx?: sdk.TrxToken
41
- ): Promise<table.Output[]> {
41
+ ): Promise<TableOutput[]> {
42
42
  const inputs = await storage.findOutputs({
43
43
  partial: { userId: this.userId, spentBy: this.id },
44
44
  trx
@@ -62,7 +62,7 @@ export class Transaction extends EntityBase<table.Transaction> {
62
62
  return inputs
63
63
  }
64
64
 
65
- constructor(api?: table.Transaction) {
65
+ constructor(api?: TableTransaction) {
66
66
  const now = new Date()
67
67
  super(
68
68
  api || {
@@ -202,15 +202,15 @@ export class Transaction extends EntityBase<table.Transaction> {
202
202
  this.api.transactionId = v
203
203
  }
204
204
  override get entityName(): string {
205
- return 'ojoTransaction'
205
+ return 'transaction'
206
206
  }
207
207
  override get entityTable(): string {
208
208
  return 'transactions'
209
209
  }
210
210
 
211
211
  override equals(
212
- ei: table.Transaction,
213
- syncMap?: entity.SyncMap | undefined
212
+ ei: TableTransaction,
213
+ syncMap?: SyncMap | undefined
214
214
  ): boolean {
215
215
  const eo = this.toApi()
216
216
 
@@ -251,12 +251,12 @@ export class Transaction extends EntityBase<table.Transaction> {
251
251
  }
252
252
 
253
253
  static async mergeFind(
254
- storage: entity.EntityStorage,
254
+ storage: EntityStorage,
255
255
  userId: number,
256
- ei: table.Transaction,
257
- syncMap: entity.SyncMap,
256
+ ei: TableTransaction,
257
+ syncMap: SyncMap,
258
258
  trx?: sdk.TrxToken
259
- ): Promise<{ found: boolean; eo: entity.Transaction; eiId: number }> {
259
+ ): Promise<{ found: boolean; eo: EntityTransaction; eiId: number }> {
260
260
  const ef = verifyOneOrNone(
261
261
  await storage.findTransactions({
262
262
  partial: { reference: ei.reference, userId },
@@ -265,15 +265,15 @@ export class Transaction extends EntityBase<table.Transaction> {
265
265
  )
266
266
  return {
267
267
  found: !!ef,
268
- eo: new entity.Transaction(ef || { ...ei }),
268
+ eo: new EntityTransaction(ef || { ...ei }),
269
269
  eiId: verifyId(ei.transactionId)
270
270
  }
271
271
  }
272
272
 
273
273
  override async mergeNew(
274
- storage: entity.EntityStorage,
274
+ storage: EntityStorage,
275
275
  userId: number,
276
- syncMap: entity.SyncMap,
276
+ syncMap: SyncMap,
277
277
  trx?: sdk.TrxToken
278
278
  ): Promise<void> {
279
279
  if (this.provenTxId)
@@ -284,10 +284,10 @@ export class Transaction extends EntityBase<table.Transaction> {
284
284
  }
285
285
 
286
286
  override async mergeExisting(
287
- storage: entity.EntityStorage,
287
+ storage: EntityStorage,
288
288
  since: Date | undefined,
289
- ei: table.Transaction,
290
- syncMap: entity.SyncMap,
289
+ ei: TableTransaction,
290
+ syncMap: SyncMap,
291
291
  trx?: sdk.TrxToken
292
292
  ): Promise<boolean> {
293
293
  let wasMerged = false
@@ -318,9 +318,9 @@ export class Transaction extends EntityBase<table.Transaction> {
318
318
  }
319
319
 
320
320
  async getProvenTx(
321
- storage: entity.EntityStorage,
321
+ storage: EntityStorage,
322
322
  trx?: sdk.TrxToken
323
- ): Promise<entity.ProvenTx | undefined> {
323
+ ): Promise<EntityProvenTx | undefined> {
324
324
  if (!this.provenTxId) return undefined
325
325
  const p = verifyOneOrNone(
326
326
  await storage.findProvenTxs({
@@ -329,6 +329,6 @@ export class Transaction extends EntityBase<table.Transaction> {
329
329
  })
330
330
  )
331
331
  if (!p) return undefined
332
- return new entity.ProvenTx(p)
332
+ return new EntityProvenTx(p)
333
333
  }
334
334
  }