@bsv/wallet-toolbox 1.7.18 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (606) hide show
  1. package/out/src/sdk/validationHelpers.d.ts +303 -0
  2. package/out/src/sdk/validationHelpers.d.ts.map +1 -0
  3. package/out/src/sdk/validationHelpers.js +632 -0
  4. package/out/src/sdk/validationHelpers.js.map +1 -0
  5. package/package.json +9 -2
  6. package/.env.template +0 -22
  7. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -40
  8. package/.github/ISSUE_TEMPLATE/discussion.md +0 -24
  9. package/.github/pull_request_template.md +0 -22
  10. package/.github/workflows/push.yaml +0 -145
  11. package/.prettierrc +0 -10
  12. package/CONTRIBUTING.md +0 -89
  13. package/jest.config.ts +0 -25
  14. package/out/test/Wallet/StorageClient/storageClient.man.test.d.ts +0 -2
  15. package/out/test/Wallet/StorageClient/storageClient.man.test.d.ts.map +0 -1
  16. package/out/test/Wallet/StorageClient/storageClient.man.test.js +0 -64
  17. package/out/test/Wallet/StorageClient/storageClient.man.test.js.map +0 -1
  18. package/out/test/Wallet/action/internalizeAction.a.test.d.ts +0 -2
  19. package/out/test/Wallet/action/internalizeAction.a.test.d.ts.map +0 -1
  20. package/out/test/Wallet/action/internalizeAction.a.test.js +0 -243
  21. package/out/test/Wallet/action/internalizeAction.a.test.js.map +0 -1
  22. package/out/test/Wallet/certificate/acquireCertificate.test.d.ts +0 -2
  23. package/out/test/Wallet/certificate/acquireCertificate.test.d.ts.map +0 -1
  24. package/out/test/Wallet/certificate/acquireCertificate.test.js +0 -210
  25. package/out/test/Wallet/certificate/acquireCertificate.test.js.map +0 -1
  26. package/out/test/Wallet/certificate/listCertificates.test.d.ts +0 -2
  27. package/out/test/Wallet/certificate/listCertificates.test.d.ts.map +0 -1
  28. package/out/test/Wallet/certificate/listCertificates.test.js +0 -305
  29. package/out/test/Wallet/certificate/listCertificates.test.js.map +0 -1
  30. package/out/test/Wallet/get/getHeaderForHeight.test.d.ts +0 -2
  31. package/out/test/Wallet/get/getHeaderForHeight.test.d.ts.map +0 -1
  32. package/out/test/Wallet/get/getHeaderForHeight.test.js +0 -74
  33. package/out/test/Wallet/get/getHeaderForHeight.test.js.map +0 -1
  34. package/out/test/Wallet/get/getHeight.test.d.ts +0 -2
  35. package/out/test/Wallet/get/getHeight.test.d.ts.map +0 -1
  36. package/out/test/Wallet/get/getHeight.test.js +0 -48
  37. package/out/test/Wallet/get/getHeight.test.js.map +0 -1
  38. package/out/test/Wallet/get/getKnownTxids.test.d.ts +0 -2
  39. package/out/test/Wallet/get/getKnownTxids.test.d.ts.map +0 -1
  40. package/out/test/Wallet/get/getKnownTxids.test.js +0 -73
  41. package/out/test/Wallet/get/getKnownTxids.test.js.map +0 -1
  42. package/out/test/Wallet/get/getNetwork.test.d.ts +0 -2
  43. package/out/test/Wallet/get/getNetwork.test.d.ts.map +0 -1
  44. package/out/test/Wallet/get/getNetwork.test.js +0 -26
  45. package/out/test/Wallet/get/getNetwork.test.js.map +0 -1
  46. package/out/test/Wallet/get/getVersion.test.d.ts +0 -2
  47. package/out/test/Wallet/get/getVersion.test.d.ts.map +0 -1
  48. package/out/test/Wallet/get/getVersion.test.js +0 -25
  49. package/out/test/Wallet/get/getVersion.test.js.map +0 -1
  50. package/out/test/Wallet/live/walletLive.man.test.d.ts +0 -26
  51. package/out/test/Wallet/live/walletLive.man.test.d.ts.map +0 -1
  52. package/out/test/Wallet/live/walletLive.man.test.js +0 -417
  53. package/out/test/Wallet/live/walletLive.man.test.js.map +0 -1
  54. package/out/test/Wallet/local/localWallet.man.test.d.ts +0 -2
  55. package/out/test/Wallet/local/localWallet.man.test.d.ts.map +0 -1
  56. package/out/test/Wallet/local/localWallet.man.test.js +0 -83
  57. package/out/test/Wallet/local/localWallet.man.test.js.map +0 -1
  58. package/out/test/Wallet/local/localWallet2.man.test.d.ts +0 -2
  59. package/out/test/Wallet/local/localWallet2.man.test.d.ts.map +0 -1
  60. package/out/test/Wallet/local/localWallet2.man.test.js +0 -284
  61. package/out/test/Wallet/local/localWallet2.man.test.js.map +0 -1
  62. package/out/test/Wallet/signAction/mountaintop.man.test.d.ts +0 -2
  63. package/out/test/Wallet/signAction/mountaintop.man.test.d.ts.map +0 -1
  64. package/out/test/Wallet/signAction/mountaintop.man.test.js +0 -109
  65. package/out/test/Wallet/signAction/mountaintop.man.test.js.map +0 -1
  66. package/out/test/Wallet/specOps/specOps.man.test.d.ts +0 -2
  67. package/out/test/Wallet/specOps/specOps.man.test.d.ts.map +0 -1
  68. package/out/test/Wallet/specOps/specOps.man.test.js +0 -163
  69. package/out/test/Wallet/specOps/specOps.man.test.js.map +0 -1
  70. package/out/test/Wallet/support/janitor.man.test.d.ts +0 -2
  71. package/out/test/Wallet/support/janitor.man.test.d.ts.map +0 -1
  72. package/out/test/Wallet/support/janitor.man.test.js +0 -38
  73. package/out/test/Wallet/support/janitor.man.test.js.map +0 -1
  74. package/out/test/Wallet/support/operations.man.test.d.ts +0 -2
  75. package/out/test/Wallet/support/operations.man.test.d.ts.map +0 -1
  76. package/out/test/Wallet/support/operations.man.test.js +0 -370
  77. package/out/test/Wallet/support/operations.man.test.js.map +0 -1
  78. package/out/test/Wallet/support/reqErrorReview.2025.05.06.man.test.d.ts +0 -2
  79. package/out/test/Wallet/support/reqErrorReview.2025.05.06.man.test.d.ts.map +0 -1
  80. package/out/test/Wallet/support/reqErrorReview.2025.05.06.man.test.js +0 -385
  81. package/out/test/Wallet/support/reqErrorReview.2025.05.06.man.test.js.map +0 -1
  82. package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.d.ts +0 -2
  83. package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.d.ts.map +0 -1
  84. package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js +0 -206
  85. package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js.map +0 -1
  86. package/out/test/Wallet/sync/setActive.test.d.ts +0 -2
  87. package/out/test/Wallet/sync/setActive.test.d.ts.map +0 -1
  88. package/out/test/Wallet/sync/setActive.test.js +0 -161
  89. package/out/test/Wallet/sync/setActive.test.js.map +0 -1
  90. package/out/test/WalletClient/LocalKVStore.man.test.d.ts +0 -2
  91. package/out/test/WalletClient/LocalKVStore.man.test.d.ts.map +0 -1
  92. package/out/test/WalletClient/LocalKVStore.man.test.js +0 -99
  93. package/out/test/WalletClient/LocalKVStore.man.test.js.map +0 -1
  94. package/out/test/WalletClient/WERR.man.test.d.ts +0 -2
  95. package/out/test/WalletClient/WERR.man.test.d.ts.map +0 -1
  96. package/out/test/WalletClient/WERR.man.test.js +0 -34
  97. package/out/test/WalletClient/WERR.man.test.js.map +0 -1
  98. package/out/test/bsv-ts-sdk/LocalKVStore.test.d.ts +0 -2
  99. package/out/test/bsv-ts-sdk/LocalKVStore.test.d.ts.map +0 -1
  100. package/out/test/bsv-ts-sdk/LocalKVStore.test.js +0 -98
  101. package/out/test/bsv-ts-sdk/LocalKVStore.test.js.map +0 -1
  102. package/out/test/checkDB.d.ts +0 -4
  103. package/out/test/checkDB.d.ts.map +0 -1
  104. package/out/test/checkDB.js +0 -55
  105. package/out/test/checkDB.js.map +0 -1
  106. package/out/test/examples/backup.man.test.d.ts +0 -14
  107. package/out/test/examples/backup.man.test.d.ts.map +0 -1
  108. package/out/test/examples/backup.man.test.js +0 -59
  109. package/out/test/examples/backup.man.test.js.map +0 -1
  110. package/out/test/examples/pushdrop.test.d.ts +0 -56
  111. package/out/test/examples/pushdrop.test.d.ts.map +0 -1
  112. package/out/test/examples/pushdrop.test.js +0 -232
  113. package/out/test/examples/pushdrop.test.js.map +0 -1
  114. package/out/test/monitor/Monitor.test.d.ts +0 -2
  115. package/out/test/monitor/Monitor.test.d.ts.map +0 -1
  116. package/out/test/monitor/Monitor.test.js +0 -560
  117. package/out/test/monitor/Monitor.test.js.map +0 -1
  118. package/out/test/services/Services.test.d.ts +0 -2
  119. package/out/test/services/Services.test.d.ts.map +0 -1
  120. package/out/test/services/Services.test.js +0 -246
  121. package/out/test/services/Services.test.js.map +0 -1
  122. package/out/test/storage/KnexMigrations.test.d.ts +0 -2
  123. package/out/test/storage/KnexMigrations.test.d.ts.map +0 -1
  124. package/out/test/storage/KnexMigrations.test.js +0 -81
  125. package/out/test/storage/KnexMigrations.test.js.map +0 -1
  126. package/out/test/storage/StorageMySQLDojoReader.man.test.d.ts +0 -2
  127. package/out/test/storage/StorageMySQLDojoReader.man.test.d.ts.map +0 -1
  128. package/out/test/storage/StorageMySQLDojoReader.man.test.js +0 -86
  129. package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +0 -1
  130. package/out/test/storage/count.test.d.ts +0 -2
  131. package/out/test/storage/count.test.d.ts.map +0 -1
  132. package/out/test/storage/count.test.js +0 -142
  133. package/out/test/storage/count.test.js.map +0 -1
  134. package/out/test/storage/find.test.d.ts +0 -2
  135. package/out/test/storage/find.test.d.ts.map +0 -1
  136. package/out/test/storage/find.test.js +0 -144
  137. package/out/test/storage/find.test.js.map +0 -1
  138. package/out/test/storage/findLegacy.test.d.ts +0 -2
  139. package/out/test/storage/findLegacy.test.d.ts.map +0 -1
  140. package/out/test/storage/findLegacy.test.js +0 -52
  141. package/out/test/storage/findLegacy.test.js.map +0 -1
  142. package/out/test/storage/idb/allocateChange.test.d.ts +0 -2
  143. package/out/test/storage/idb/allocateChange.test.d.ts.map +0 -1
  144. package/out/test/storage/idb/allocateChange.test.js +0 -110
  145. package/out/test/storage/idb/allocateChange.test.js.map +0 -1
  146. package/out/test/storage/idb/count.test.d.ts +0 -2
  147. package/out/test/storage/idb/count.test.d.ts.map +0 -1
  148. package/out/test/storage/idb/count.test.js +0 -129
  149. package/out/test/storage/idb/count.test.js.map +0 -1
  150. package/out/test/storage/idb/find.test.d.ts +0 -2
  151. package/out/test/storage/idb/find.test.d.ts.map +0 -1
  152. package/out/test/storage/idb/find.test.js +0 -131
  153. package/out/test/storage/idb/find.test.js.map +0 -1
  154. package/out/test/storage/idb/idbSpeed.test.d.ts +0 -2
  155. package/out/test/storage/idb/idbSpeed.test.d.ts.map +0 -1
  156. package/out/test/storage/idb/idbSpeed.test.js +0 -30
  157. package/out/test/storage/idb/idbSpeed.test.js.map +0 -1
  158. package/out/test/storage/idb/insert.test.d.ts +0 -2
  159. package/out/test/storage/idb/insert.test.d.ts.map +0 -1
  160. package/out/test/storage/idb/insert.test.js +0 -242
  161. package/out/test/storage/idb/insert.test.js.map +0 -1
  162. package/out/test/storage/idb/transactionAbort.test.d.ts +0 -2
  163. package/out/test/storage/idb/transactionAbort.test.d.ts.map +0 -1
  164. package/out/test/storage/idb/transactionAbort.test.js +0 -97
  165. package/out/test/storage/idb/transactionAbort.test.js.map +0 -1
  166. package/out/test/storage/idb/update.test.d.ts +0 -2
  167. package/out/test/storage/idb/update.test.d.ts.map +0 -1
  168. package/out/test/storage/idb/update.test.js +0 -902
  169. package/out/test/storage/idb/update.test.js.map +0 -1
  170. package/out/test/storage/insert.test.d.ts +0 -2
  171. package/out/test/storage/insert.test.d.ts.map +0 -1
  172. package/out/test/storage/insert.test.js +0 -256
  173. package/out/test/storage/insert.test.js.map +0 -1
  174. package/out/test/storage/update.test.d.ts +0 -2
  175. package/out/test/storage/update.test.d.ts.map +0 -1
  176. package/out/test/storage/update.test.js +0 -919
  177. package/out/test/storage/update.test.js.map +0 -1
  178. package/out/test/storage/update2.test.d.ts +0 -2
  179. package/out/test/storage/update2.test.d.ts.map +0 -1
  180. package/out/test/storage/update2.test.js +0 -767
  181. package/out/test/storage/update2.test.js.map +0 -1
  182. package/out/test/utils/TestUtilsWalletStorage.d.ts +0 -523
  183. package/out/test/utils/TestUtilsWalletStorage.d.ts.map +0 -1
  184. package/out/test/utils/TestUtilsWalletStorage.js +0 -1958
  185. package/out/test/utils/TestUtilsWalletStorage.js.map +0 -1
  186. package/out/test/utils/localWalletMethods.d.ts +0 -33
  187. package/out/test/utils/localWalletMethods.d.ts.map +0 -1
  188. package/out/test/utils/localWalletMethods.js +0 -304
  189. package/out/test/utils/localWalletMethods.js.map +0 -1
  190. package/out/test/wallet/action/abortAction.test.d.ts +0 -2
  191. package/out/test/wallet/action/abortAction.test.d.ts.map +0 -1
  192. package/out/test/wallet/action/abortAction.test.js +0 -44
  193. package/out/test/wallet/action/abortAction.test.js.map +0 -1
  194. package/out/test/wallet/action/createAction.test.d.ts +0 -2
  195. package/out/test/wallet/action/createAction.test.d.ts.map +0 -1
  196. package/out/test/wallet/action/createAction.test.js +0 -272
  197. package/out/test/wallet/action/createAction.test.js.map +0 -1
  198. package/out/test/wallet/action/createAction2.test.d.ts +0 -37
  199. package/out/test/wallet/action/createAction2.test.d.ts.map +0 -1
  200. package/out/test/wallet/action/createAction2.test.js +0 -1143
  201. package/out/test/wallet/action/createAction2.test.js.map +0 -1
  202. package/out/test/wallet/action/createActionToGenerateBeefs.man.test.d.ts +0 -2
  203. package/out/test/wallet/action/createActionToGenerateBeefs.man.test.d.ts.map +0 -1
  204. package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js +0 -273
  205. package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +0 -1
  206. package/out/test/wallet/action/internalizeAction.test.d.ts +0 -2
  207. package/out/test/wallet/action/internalizeAction.test.d.ts.map +0 -1
  208. package/out/test/wallet/action/internalizeAction.test.js +0 -608
  209. package/out/test/wallet/action/internalizeAction.test.js.map +0 -1
  210. package/out/test/wallet/action/relinquishOutput.test.d.ts +0 -2
  211. package/out/test/wallet/action/relinquishOutput.test.d.ts.map +0 -1
  212. package/out/test/wallet/action/relinquishOutput.test.js +0 -31
  213. package/out/test/wallet/action/relinquishOutput.test.js.map +0 -1
  214. package/out/test/wallet/construct/Wallet.constructor.test.d.ts +0 -2
  215. package/out/test/wallet/construct/Wallet.constructor.test.d.ts.map +0 -1
  216. package/out/test/wallet/construct/Wallet.constructor.test.js +0 -49
  217. package/out/test/wallet/construct/Wallet.constructor.test.js.map +0 -1
  218. package/out/test/wallet/list/listActions.test.d.ts +0 -2
  219. package/out/test/wallet/list/listActions.test.d.ts.map +0 -1
  220. package/out/test/wallet/list/listActions.test.js +0 -271
  221. package/out/test/wallet/list/listActions.test.js.map +0 -1
  222. package/out/test/wallet/list/listActions2.test.d.ts +0 -2
  223. package/out/test/wallet/list/listActions2.test.d.ts.map +0 -1
  224. package/out/test/wallet/list/listActions2.test.js +0 -1141
  225. package/out/test/wallet/list/listActions2.test.js.map +0 -1
  226. package/out/test/wallet/list/listCertificates.test.d.ts +0 -2
  227. package/out/test/wallet/list/listCertificates.test.d.ts.map +0 -1
  228. package/out/test/wallet/list/listCertificates.test.js +0 -111
  229. package/out/test/wallet/list/listCertificates.test.js.map +0 -1
  230. package/out/test/wallet/list/listOutputs.test.d.ts +0 -2
  231. package/out/test/wallet/list/listOutputs.test.d.ts.map +0 -1
  232. package/out/test/wallet/list/listOutputs.test.js +0 -424
  233. package/out/test/wallet/list/listOutputs.test.js.map +0 -1
  234. package/out/test/wallet/sync/Wallet.sync.test.d.ts +0 -2
  235. package/out/test/wallet/sync/Wallet.sync.test.d.ts.map +0 -1
  236. package/out/test/wallet/sync/Wallet.sync.test.js +0 -155
  237. package/out/test/wallet/sync/Wallet.sync.test.js.map +0 -1
  238. package/out/tsconfig.all.tsbuildinfo +0 -1
  239. package/src/CWIStyleWalletManager.ts +0 -1999
  240. package/src/Setup.ts +0 -579
  241. package/src/SetupClient.ts +0 -322
  242. package/src/SetupWallet.ts +0 -108
  243. package/src/SimpleWalletManager.ts +0 -526
  244. package/src/Wallet.ts +0 -1169
  245. package/src/WalletAuthenticationManager.ts +0 -153
  246. package/src/WalletLogger.ts +0 -213
  247. package/src/WalletPermissionsManager.ts +0 -3660
  248. package/src/WalletSettingsManager.ts +0 -114
  249. package/src/__tests/CWIStyleWalletManager.test.d.ts.map +0 -1
  250. package/src/__tests/CWIStyleWalletManager.test.js.map +0 -1
  251. package/src/__tests/CWIStyleWalletManager.test.ts +0 -675
  252. package/src/__tests/WalletPermissionsManager.callbacks.test.ts +0 -323
  253. package/src/__tests/WalletPermissionsManager.checks.test.ts +0 -844
  254. package/src/__tests/WalletPermissionsManager.encryption.test.ts +0 -412
  255. package/src/__tests/WalletPermissionsManager.fixtures.ts +0 -307
  256. package/src/__tests/WalletPermissionsManager.flows.test.ts +0 -462
  257. package/src/__tests/WalletPermissionsManager.initialization.test.ts +0 -300
  258. package/src/__tests/WalletPermissionsManager.pmodules.test.ts +0 -798
  259. package/src/__tests/WalletPermissionsManager.proxying.test.ts +0 -724
  260. package/src/__tests/WalletPermissionsManager.tokens.test.ts +0 -503
  261. package/src/index.all.ts +0 -27
  262. package/src/index.client.ts +0 -25
  263. package/src/index.mobile.ts +0 -21
  264. package/src/index.ts +0 -1
  265. package/src/monitor/Monitor.ts +0 -412
  266. package/src/monitor/MonitorDaemon.ts +0 -188
  267. package/src/monitor/README.md +0 -3
  268. package/src/monitor/__test/MonitorDaemon.man.test.ts +0 -45
  269. package/src/monitor/tasks/TaskCheckForProofs.ts +0 -243
  270. package/src/monitor/tasks/TaskCheckNoSends.ts +0 -73
  271. package/src/monitor/tasks/TaskClock.ts +0 -33
  272. package/src/monitor/tasks/TaskFailAbandoned.ts +0 -54
  273. package/src/monitor/tasks/TaskMonitorCallHistory.ts +0 -26
  274. package/src/monitor/tasks/TaskNewHeader.ts +0 -93
  275. package/src/monitor/tasks/TaskPurge.ts +0 -68
  276. package/src/monitor/tasks/TaskReorg.ts +0 -89
  277. package/src/monitor/tasks/TaskReviewStatus.ts +0 -48
  278. package/src/monitor/tasks/TaskSendWaiting.ts +0 -122
  279. package/src/monitor/tasks/TaskSyncWhenIdle.ts +0 -26
  280. package/src/monitor/tasks/TaskUnFail.ts +0 -151
  281. package/src/monitor/tasks/WalletMonitorTask.ts +0 -47
  282. package/src/sdk/CertOpsWallet.ts +0 -18
  283. package/src/sdk/PrivilegedKeyManager.ts +0 -372
  284. package/src/sdk/README.md +0 -13
  285. package/src/sdk/WERR_errors.ts +0 -234
  286. package/src/sdk/WalletError.ts +0 -170
  287. package/src/sdk/WalletErrorFromJson.ts +0 -80
  288. package/src/sdk/WalletServices.interfaces.ts +0 -700
  289. package/src/sdk/WalletSigner.interfaces.ts +0 -11
  290. package/src/sdk/WalletStorage.interfaces.ts +0 -606
  291. package/src/sdk/__test/CertificateLifeCycle.test.ts +0 -131
  292. package/src/sdk/__test/PrivilegedKeyManager.test.ts +0 -738
  293. package/src/sdk/__test/WalletError.test.ts +0 -318
  294. package/src/sdk/__test/validationHelpers.test.ts +0 -21
  295. package/src/sdk/index.ts +0 -10
  296. package/src/sdk/types.ts +0 -226
  297. package/src/services/README.md +0 -11
  298. package/src/services/ServiceCollection.ts +0 -248
  299. package/src/services/Services.ts +0 -603
  300. package/src/services/__tests/ARC.man.test.ts +0 -123
  301. package/src/services/__tests/ARC.timeout.man.test.ts +0 -79
  302. package/src/services/__tests/ArcGorillaPool.man.test.ts +0 -108
  303. package/src/services/__tests/arcServices.test.ts +0 -8
  304. package/src/services/__tests/bitrails.test.ts +0 -56
  305. package/src/services/__tests/getMerklePath.test.ts +0 -15
  306. package/src/services/__tests/getRawTx.test.ts +0 -13
  307. package/src/services/__tests/postBeef.test.ts +0 -104
  308. package/src/services/__tests/verifyBeef.test.ts +0 -50
  309. package/src/services/chaintracker/BHServiceClient.ts +0 -212
  310. package/src/services/chaintracker/ChaintracksChainTracker.ts +0 -71
  311. package/src/services/chaintracker/__tests/ChaintracksChainTracker.test.ts +0 -33
  312. package/src/services/chaintracker/__tests/ChaintracksServiceClient.test.ts +0 -29
  313. package/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.ts +0 -72
  314. package/src/services/chaintracker/chaintracks/Api/BulkIngestorApi.ts +0 -83
  315. package/src/services/chaintracker/chaintracks/Api/BulkStorageApi.ts +0 -92
  316. package/src/services/chaintracker/chaintracks/Api/ChaintracksApi.ts +0 -64
  317. package/src/services/chaintracker/chaintracks/Api/ChaintracksClientApi.ts +0 -189
  318. package/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.ts +0 -18
  319. package/src/services/chaintracker/chaintracks/Api/ChaintracksFsApi.ts +0 -58
  320. package/src/services/chaintracker/chaintracks/Api/ChaintracksStorageApi.ts +0 -386
  321. package/src/services/chaintracker/chaintracks/Api/LiveIngestorApi.ts +0 -25
  322. package/src/services/chaintracker/chaintracks/Chaintracks.ts +0 -609
  323. package/src/services/chaintracker/chaintracks/ChaintracksService.ts +0 -199
  324. package/src/services/chaintracker/chaintracks/ChaintracksServiceClient.ts +0 -154
  325. package/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.ts +0 -176
  326. package/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.ts +0 -174
  327. package/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.ts +0 -18
  328. package/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.ts +0 -113
  329. package/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainWs.ts +0 -81
  330. package/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.ts +0 -86
  331. package/src/services/chaintracker/chaintracks/Ingest/LiveIngestorTeranodeP2P.ts +0 -59
  332. package/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.ts +0 -104
  333. package/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainWs.ts +0 -66
  334. package/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.ts +0 -566
  335. package/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.ts +0 -219
  336. package/src/services/chaintracker/chaintracks/Ingest/__tests/BulkIngestorCDNBabbage.test.ts +0 -54
  337. package/src/services/chaintracker/chaintracks/Ingest/__tests/LiveIngestorWhatsOnChainPoll.test.ts +0 -33
  338. package/src/services/chaintracker/chaintracks/Ingest/__tests/WhatsOnChainServices.test.ts +0 -124
  339. package/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.ts +0 -92
  340. package/src/services/chaintracker/chaintracks/Storage/ChaintracksKnexMigrations.ts +0 -104
  341. package/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.ts +0 -382
  342. package/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.ts +0 -574
  343. package/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.ts +0 -438
  344. package/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageMemory.ts +0 -29
  345. package/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.ts +0 -304
  346. package/src/services/chaintracker/chaintracks/Storage/__tests/ChaintracksStorageIdb.test.ts +0 -102
  347. package/src/services/chaintracker/chaintracks/Storage/__tests/ChaintracksStorageKnex.test.ts +0 -45
  348. package/src/services/chaintracker/chaintracks/__tests/Chaintracks.test.ts +0 -77
  349. package/src/services/chaintracker/chaintracks/__tests/ChaintracksClientApi.test.ts +0 -192
  350. package/src/services/chaintracker/chaintracks/__tests/LocalCdnServer.ts +0 -75
  351. package/src/services/chaintracker/chaintracks/__tests/createIdbChaintracks.test.ts +0 -62
  352. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest349/mainNetBlockHeaders.json +0 -1
  353. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest349/mainNet_0.headers +0 -0
  354. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest349/mainNet_1.headers +0 -0
  355. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest349/mainNet_2.headers +0 -0
  356. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest349/mainNet_3.headers +0 -0
  357. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest379/mainNetBlockHeaders.json +0 -1
  358. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest379/mainNet_0.headers +0 -0
  359. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest379/mainNet_1.headers +0 -0
  360. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest379/mainNet_2.headers +0 -0
  361. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest379/mainNet_3.headers +0 -0
  362. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest399/mainNetBlockHeaders.json +0 -1
  363. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest399/mainNet_0.headers +0 -0
  364. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest399/mainNet_1.headers +0 -0
  365. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest399/mainNet_2.headers +0 -0
  366. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest399/mainNet_3.headers +0 -0
  367. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNetBlockHeaders.json +0 -1
  368. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNet_0.headers +0 -0
  369. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNet_1.headers +0 -0
  370. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNet_2.headers +0 -0
  371. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNet_3.headers +0 -0
  372. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest402/mainNet_4.headers +0 -0
  373. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNetBlockHeaders.json +0 -1
  374. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNet_0.headers +0 -0
  375. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNet_1.headers +0 -0
  376. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNet_2.headers +0 -0
  377. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNet_3.headers +0 -0
  378. package/src/services/chaintracker/chaintracks/__tests/data/cdnTest499/mainNet_4.headers +0 -0
  379. package/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.ts +0 -92
  380. package/src/services/chaintracker/chaintracks/createDefaultKnexChaintracksOptions.ts +0 -111
  381. package/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.ts +0 -91
  382. package/src/services/chaintracker/chaintracks/createIdbChaintracks.ts +0 -60
  383. package/src/services/chaintracker/chaintracks/createKnexChaintracks.ts +0 -65
  384. package/src/services/chaintracker/chaintracks/createNoDbChaintracks.ts +0 -60
  385. package/src/services/chaintracker/chaintracks/index.all.ts +0 -12
  386. package/src/services/chaintracker/chaintracks/index.client.ts +0 -4
  387. package/src/services/chaintracker/chaintracks/index.mobile.ts +0 -37
  388. package/src/services/chaintracker/chaintracks/util/BulkFileDataManager.ts +0 -975
  389. package/src/services/chaintracker/chaintracks/util/BulkFileDataReader.ts +0 -60
  390. package/src/services/chaintracker/chaintracks/util/BulkFilesReader.ts +0 -336
  391. package/src/services/chaintracker/chaintracks/util/BulkHeaderFile.ts +0 -247
  392. package/src/services/chaintracker/chaintracks/util/ChaintracksFetch.ts +0 -69
  393. package/src/services/chaintracker/chaintracks/util/ChaintracksFs.ts +0 -141
  394. package/src/services/chaintracker/chaintracks/util/HeightRange.ts +0 -153
  395. package/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.ts +0 -76
  396. package/src/services/chaintracker/chaintracks/util/__tests/BulkFileDataManager.test.ts +0 -304
  397. package/src/services/chaintracker/chaintracks/util/__tests/ChaintracksFetch.test.ts +0 -60
  398. package/src/services/chaintracker/chaintracks/util/__tests/HeightRange.test.ts +0 -67
  399. package/src/services/chaintracker/chaintracks/util/__tests/SingleWriterMultiReaderLock.test.ts +0 -49
  400. package/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.ts +0 -573
  401. package/src/services/chaintracker/chaintracks/util/dirtyHashes.ts +0 -29
  402. package/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.ts +0 -432
  403. package/src/services/chaintracker/index.all.ts +0 -4
  404. package/src/services/chaintracker/index.client.ts +0 -4
  405. package/src/services/chaintracker/index.mobile.ts +0 -4
  406. package/src/services/createDefaultWalletServicesOptions.ts +0 -77
  407. package/src/services/index.ts +0 -1
  408. package/src/services/processingErrors/arcSuccessError.json +0 -76
  409. package/src/services/providers/ARC.ts +0 -350
  410. package/src/services/providers/Bitails.ts +0 -256
  411. package/src/services/providers/SdkWhatsOnChain.ts +0 -83
  412. package/src/services/providers/WhatsOnChain.ts +0 -883
  413. package/src/services/providers/__tests/WhatsOnChain.test.ts +0 -242
  414. package/src/services/providers/__tests/exchangeRates.test.ts +0 -18
  415. package/src/services/providers/exchangeRates.ts +0 -265
  416. package/src/services/providers/getBeefForTxid.ts +0 -369
  417. package/src/signer/README.md +0 -5
  418. package/src/signer/WalletSigner.ts +0 -17
  419. package/src/signer/methods/acquireDirectCertificate.ts +0 -52
  420. package/src/signer/methods/buildSignableTransaction.ts +0 -183
  421. package/src/signer/methods/completeSignedTransaction.ts +0 -117
  422. package/src/signer/methods/createAction.ts +0 -172
  423. package/src/signer/methods/internalizeAction.ts +0 -106
  424. package/src/signer/methods/proveCertificate.ts +0 -43
  425. package/src/signer/methods/signAction.ts +0 -54
  426. package/src/storage/README.md +0 -14
  427. package/src/storage/StorageIdb.ts +0 -2304
  428. package/src/storage/StorageKnex.ts +0 -1425
  429. package/src/storage/StorageProvider.ts +0 -810
  430. package/src/storage/StorageReader.ts +0 -194
  431. package/src/storage/StorageReaderWriter.ts +0 -432
  432. package/src/storage/StorageSyncReader.ts +0 -34
  433. package/src/storage/WalletStorageManager.ts +0 -943
  434. package/src/storage/__test/StorageIdb.test.ts +0 -43
  435. package/src/storage/__test/WalletStorageManager.test.ts +0 -275
  436. package/src/storage/__test/adminStats.man.test.ts +0 -89
  437. package/src/storage/__test/getBeefForTransaction.test.ts +0 -385
  438. package/src/storage/index.all.ts +0 -11
  439. package/src/storage/index.client.ts +0 -7
  440. package/src/storage/index.mobile.ts +0 -6
  441. package/src/storage/methods/ListActionsSpecOp.ts +0 -70
  442. package/src/storage/methods/ListOutputsSpecOp.ts +0 -129
  443. package/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.ts +0 -1057
  444. package/src/storage/methods/__test/GenerateChange/randomValsUsed1.ts +0 -20
  445. package/src/storage/methods/__test/offsetKey.test.ts +0 -274
  446. package/src/storage/methods/attemptToPostReqsToNetwork.ts +0 -389
  447. package/src/storage/methods/createAction.ts +0 -947
  448. package/src/storage/methods/generateChange.ts +0 -556
  449. package/src/storage/methods/getBeefForTransaction.ts +0 -139
  450. package/src/storage/methods/getSyncChunk.ts +0 -293
  451. package/src/storage/methods/internalizeAction.ts +0 -562
  452. package/src/storage/methods/listActionsIdb.ts +0 -183
  453. package/src/storage/methods/listActionsKnex.ts +0 -226
  454. package/src/storage/methods/listCertificates.ts +0 -73
  455. package/src/storage/methods/listOutputsIdb.ts +0 -203
  456. package/src/storage/methods/listOutputsKnex.ts +0 -263
  457. package/src/storage/methods/offsetKey.ts +0 -89
  458. package/src/storage/methods/processAction.ts +0 -420
  459. package/src/storage/methods/purgeData.ts +0 -251
  460. package/src/storage/methods/purgeDataIdb.ts +0 -10
  461. package/src/storage/methods/reviewStatus.ts +0 -101
  462. package/src/storage/methods/reviewStatusIdb.ts +0 -43
  463. package/src/storage/methods/utils.Buffer.ts +0 -33
  464. package/src/storage/methods/utils.ts +0 -56
  465. package/src/storage/remoting/StorageClient.ts +0 -567
  466. package/src/storage/remoting/StorageMobile.ts +0 -544
  467. package/src/storage/remoting/StorageServer.ts +0 -291
  468. package/src/storage/remoting/__test/StorageClient.test.ts +0 -113
  469. package/src/storage/schema/KnexMigrations.ts +0 -489
  470. package/src/storage/schema/StorageIdbSchema.ts +0 -150
  471. package/src/storage/schema/entities/EntityBase.ts +0 -210
  472. package/src/storage/schema/entities/EntityCertificate.ts +0 -188
  473. package/src/storage/schema/entities/EntityCertificateField.ts +0 -136
  474. package/src/storage/schema/entities/EntityCommission.ts +0 -148
  475. package/src/storage/schema/entities/EntityOutput.ts +0 -290
  476. package/src/storage/schema/entities/EntityOutputBasket.ts +0 -153
  477. package/src/storage/schema/entities/EntityOutputTag.ts +0 -121
  478. package/src/storage/schema/entities/EntityOutputTagMap.ts +0 -123
  479. package/src/storage/schema/entities/EntityProvenTx.ts +0 -319
  480. package/src/storage/schema/entities/EntityProvenTxReq.ts +0 -580
  481. package/src/storage/schema/entities/EntitySyncState.ts +0 -389
  482. package/src/storage/schema/entities/EntityTransaction.ts +0 -306
  483. package/src/storage/schema/entities/EntityTxLabel.ts +0 -121
  484. package/src/storage/schema/entities/EntityTxLabelMap.ts +0 -123
  485. package/src/storage/schema/entities/EntityUser.ts +0 -112
  486. package/src/storage/schema/entities/MergeEntity.ts +0 -73
  487. package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +0 -353
  488. package/src/storage/schema/entities/__tests/CertificateTests.test.ts +0 -354
  489. package/src/storage/schema/entities/__tests/CommissionTests.test.ts +0 -371
  490. package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +0 -278
  491. package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +0 -242
  492. package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +0 -288
  493. package/src/storage/schema/entities/__tests/OutputTests.test.ts +0 -464
  494. package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +0 -340
  495. package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +0 -504
  496. package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +0 -288
  497. package/src/storage/schema/entities/__tests/TransactionTests.test.ts +0 -604
  498. package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +0 -361
  499. package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +0 -198
  500. package/src/storage/schema/entities/__tests/stampLogTests.test.ts +0 -90
  501. package/src/storage/schema/entities/__tests/usersTests.test.ts +0 -340
  502. package/src/storage/schema/entities/index.ts +0 -16
  503. package/src/storage/schema/tables/TableCertificate.ts +0 -21
  504. package/src/storage/schema/tables/TableCertificateField.ts +0 -12
  505. package/src/storage/schema/tables/TableCommission.ts +0 -13
  506. package/src/storage/schema/tables/TableMonitorEvent.ts +0 -9
  507. package/src/storage/schema/tables/TableOutput.ts +0 -64
  508. package/src/storage/schema/tables/TableOutputBasket.ts +0 -12
  509. package/src/storage/schema/tables/TableOutputTag.ts +0 -10
  510. package/src/storage/schema/tables/TableOutputTagMap.ts +0 -9
  511. package/src/storage/schema/tables/TableProvenTx.ts +0 -14
  512. package/src/storage/schema/tables/TableProvenTxReq.ts +0 -65
  513. package/src/storage/schema/tables/TableSettings.ts +0 -17
  514. package/src/storage/schema/tables/TableSyncState.ts +0 -18
  515. package/src/storage/schema/tables/TableTransaction.ts +0 -54
  516. package/src/storage/schema/tables/TableTxLabel.ts +0 -10
  517. package/src/storage/schema/tables/TableTxLabelMap.ts +0 -9
  518. package/src/storage/schema/tables/TableUser.ts +0 -16
  519. package/src/storage/schema/tables/index.ts +0 -16
  520. package/src/storage/sync/StorageMySQLDojoReader.ts +0 -696
  521. package/src/storage/sync/index.ts +0 -1
  522. package/src/utility/Format.ts +0 -133
  523. package/src/utility/README.md +0 -3
  524. package/src/utility/ReaderUint8Array.ts +0 -187
  525. package/src/utility/ScriptTemplateBRC29.ts +0 -73
  526. package/src/utility/__tests/utilityHelpers.noBuffer.test.ts +0 -109
  527. package/src/utility/aggregateResults.ts +0 -68
  528. package/src/utility/identityUtils.ts +0 -159
  529. package/src/utility/index.all.ts +0 -7
  530. package/src/utility/index.client.ts +0 -7
  531. package/src/utility/parseTxScriptOffsets.ts +0 -29
  532. package/src/utility/stampLog.ts +0 -69
  533. package/src/utility/tscProofToMerklePath.ts +0 -48
  534. package/src/utility/utilityHelpers.buffer.ts +0 -34
  535. package/src/utility/utilityHelpers.noBuffer.ts +0 -60
  536. package/src/utility/utilityHelpers.ts +0 -275
  537. package/src/wab-client/WABClient.ts +0 -94
  538. package/src/wab-client/__tests/WABClient.man.test.ts +0 -59
  539. package/src/wab-client/auth-method-interactors/AuthMethodInteractor.ts +0 -47
  540. package/src/wab-client/auth-method-interactors/DevConsoleInteractor.ts +0 -73
  541. package/src/wab-client/auth-method-interactors/PersonaIDInteractor.ts +0 -35
  542. package/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.ts +0 -72
  543. package/syncVersions.js +0 -71
  544. package/test/Wallet/StorageClient/storageClient.man.test.ts +0 -75
  545. package/test/Wallet/action/internalizeAction.a.test.ts +0 -286
  546. package/test/Wallet/certificate/acquireCertificate.test.ts +0 -298
  547. package/test/Wallet/certificate/listCertificates.test.ts +0 -346
  548. package/test/Wallet/get/getHeaderForHeight.test.ts +0 -82
  549. package/test/Wallet/get/getHeight.test.ts +0 -52
  550. package/test/Wallet/get/getKnownTxids.test.ts +0 -86
  551. package/test/Wallet/get/getNetwork.test.ts +0 -27
  552. package/test/Wallet/get/getVersion.test.ts +0 -27
  553. package/test/Wallet/live/walletLive.man.test.ts +0 -521
  554. package/test/Wallet/local/localWallet.man.test.ts +0 -93
  555. package/test/Wallet/local/localWallet2.man.test.ts +0 -277
  556. package/test/Wallet/signAction/mountaintop.man.test.ts +0 -130
  557. package/test/Wallet/specOps/specOps.man.test.ts +0 -220
  558. package/test/Wallet/support/janitor.man.test.ts +0 -40
  559. package/test/Wallet/support/operations.man.test.ts +0 -407
  560. package/test/Wallet/support/reqErrorReview.2025.05.06.man.test.ts +0 -347
  561. package/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.ts +0 -203
  562. package/test/Wallet/sync/setActive.test.ts +0 -170
  563. package/test/WalletClient/LocalKVStore.man.test.ts +0 -114
  564. package/test/WalletClient/WERR.man.test.ts +0 -35
  565. package/test/bsv-ts-sdk/LocalKVStore.test.ts +0 -102
  566. package/test/checkDB.ts +0 -57
  567. package/test/checkdb +0 -0
  568. package/test/examples/backup.man.test.ts +0 -59
  569. package/test/examples/pushdrop.test.ts +0 -282
  570. package/test/monitor/Monitor.test.ts +0 -620
  571. package/test/services/Services.test.ts +0 -263
  572. package/test/storage/KnexMigrations.test.ts +0 -86
  573. package/test/storage/StorageMySQLDojoReader.man.test.ts +0 -60
  574. package/test/storage/count.test.ts +0 -177
  575. package/test/storage/find.test.ts +0 -195
  576. package/test/storage/findLegacy.test.ts +0 -67
  577. package/test/storage/idb/allocateChange.test.ts +0 -251
  578. package/test/storage/idb/count.test.ts +0 -158
  579. package/test/storage/idb/find.test.ts +0 -177
  580. package/test/storage/idb/idbSpeed.test.ts +0 -36
  581. package/test/storage/idb/insert.test.ts +0 -268
  582. package/test/storage/idb/transactionAbort.test.ts +0 -108
  583. package/test/storage/idb/update.test.ts +0 -999
  584. package/test/storage/insert.test.ts +0 -278
  585. package/test/storage/update.test.ts +0 -1021
  586. package/test/storage/update2.test.ts +0 -897
  587. package/test/utils/TestUtilsWalletStorage.ts +0 -2526
  588. package/test/utils/localWalletMethods.ts +0 -363
  589. package/test/utils/removeFailedFromDatabase.sql +0 -17
  590. package/test/wallet/action/abortAction.test.ts +0 -47
  591. package/test/wallet/action/createAction.test.ts +0 -299
  592. package/test/wallet/action/createAction2.test.ts +0 -1273
  593. package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +0 -293
  594. package/test/wallet/action/internalizeAction.test.ts +0 -682
  595. package/test/wallet/action/relinquishOutput.test.ts +0 -37
  596. package/test/wallet/construct/Wallet.constructor.test.ts +0 -57
  597. package/test/wallet/list/listActions.test.ts +0 -279
  598. package/test/wallet/list/listActions2.test.ts +0 -1381
  599. package/test/wallet/list/listCertificates.test.ts +0 -118
  600. package/test/wallet/list/listOutputs.test.ts +0 -447
  601. package/test/wallet/sync/Wallet.sync.test.ts +0 -215
  602. package/ts2md.json +0 -44
  603. package/tsconfig.all.json +0 -31
  604. package/tsconfig.client.json +0 -29
  605. package/tsconfig.json +0 -17
  606. package/tsconfig.mobile.json +0 -28
@@ -1,1057 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
-
3
- import { Transaction as BsvTransaction, Script } from '@bsv/sdk'
4
- import { randomValsUsed1 } from './randomValsUsed1'
5
- import { sdk } from '../../../../index.client'
6
- import {
7
- generateChangeSdk,
8
- GenerateChangeSdkChangeInput,
9
- generateChangeSdkMakeStorage,
10
- GenerateChangeSdkParams,
11
- GenerateChangeSdkResult
12
- } from '../../generateChange'
13
-
14
- describe('generateChange tests', () => {
15
- jest.setTimeout(99999999)
16
-
17
- test('0 two outputs', async () => {
18
- const params: GenerateChangeSdkParams = {
19
- ...defParams,
20
- fixedOutputs: [
21
- { satoshis: 1234, lockingScriptLength: 1739091 },
22
- { satoshis: 2, lockingScriptLength: 25 }
23
- ]
24
- }
25
- const availableChange: GenerateChangeSdkChangeInput[] = [...defAvailableChange()]
26
-
27
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
28
-
29
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
30
- expect(JSON.stringify(r)).toBe(
31
- '{"allocatedChangeInputs":[{"satoshis":6323,"outputId":15005,"spendable":false}],"changeOutputs":[{"satoshis":1608,"lockingScriptLength":25}],"size":1739330,"fee":3479,"satsPerKb":2}'
32
- )
33
- expectTransactionSize(params, r)
34
- })
35
-
36
- test('0a two outputs exact input', async () => {
37
- const params: GenerateChangeSdkParams = {
38
- ...defParams,
39
- fixedOutputs: [
40
- { satoshis: 1234, lockingScriptLength: 1739091 },
41
- { satoshis: 2, lockingScriptLength: 25 }
42
- ]
43
- }
44
- const availableChange: GenerateChangeSdkChangeInput[] = [...defAvailableChange()]
45
- availableChange[5].satoshis = 4715
46
-
47
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
48
-
49
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
50
- expect(JSON.stringify(r)).toBe(
51
- '{"allocatedChangeInputs":[{"satoshis":4715,"outputId":15027,"spendable":false}],"changeOutputs":[],"size":1739296,"fee":3479,"satsPerKb":2}'
52
- )
53
- expectTransactionSize(params, r)
54
- })
55
-
56
- test('0b two outputs 666666 200 ', async () => {
57
- const params: GenerateChangeSdkParams = {
58
- ...defParams,
59
- fixedOutputs: [
60
- { satoshis: 666666, lockingScriptLength: 197 },
61
- { satoshis: 200, lockingScriptLength: 25 }
62
- ]
63
- }
64
- const availableChange: GenerateChangeSdkChangeInput[] = [...defAvailableChange()]
65
- availableChange[5].satoshis = 4715
66
-
67
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
68
-
69
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
70
- expect(JSON.stringify(r)).toBe(
71
- '{"allocatedChangeInputs":[{"satoshis":1575097,"outputId":15101,"spendable":false}],"changeOutputs":[{"satoshis":908230,"lockingScriptLength":25}],"size":432,"fee":1,"satsPerKb":2}'
72
- )
73
- expectTransactionSize(params, r)
74
- })
75
-
76
- test('0c two outputs 666666 200 two change inputs ', async () => {
77
- const params: GenerateChangeSdkParams = {
78
- ...defParams,
79
- fixedOutputs: [
80
- { satoshis: 666666, lockingScriptLength: 197 },
81
- { satoshis: 200, lockingScriptLength: 25 }
82
- ]
83
- }
84
- const availableChange: GenerateChangeSdkChangeInput[] = [
85
- { satoshis: 191051, outputId: 14101 },
86
- { satoshis: 129470, outputId: 14106 },
87
- { satoshis: 273356, outputId: 14110 },
88
- { satoshis: 65612, outputId: 14120 },
89
- { satoshis: 44778, outputId: 14126 },
90
- { satoshis: 58732, outputId: 14141 },
91
- { satoshis: 160865, outputId: 14142 },
92
- { satoshis: 535280, outputId: 14146 },
93
- { satoshis: 1006, outputId: 14177 },
94
- { satoshis: 1000, outputId: 14178 }
95
- ]
96
-
97
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
98
-
99
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
100
- expect(JSON.stringify(r)).toBe(
101
- '{"allocatedChangeInputs":[{"satoshis":535280,"outputId":14146,"spendable":false},{"satoshis":160865,"outputId":14142,"spendable":false}],"changeOutputs":[{"satoshis":29277,"lockingScriptLength":25}],"size":580,"fee":2,"satsPerKb":2}'
102
- )
103
- expectTransactionSize(params, r)
104
- })
105
-
106
- test('1 two outputs four change outputs', async () => {
107
- const params: GenerateChangeSdkParams = {
108
- ...defParams,
109
- fixedOutputs: [
110
- { satoshis: 1234, lockingScriptLength: 1739091 },
111
- { satoshis: 2, lockingScriptLength: 25 }
112
- ],
113
- targetNetCount: 4
114
- }
115
- const availableChange: GenerateChangeSdkChangeInput[] = [...defAvailableChange()]
116
-
117
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
118
-
119
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
120
- expect(JSON.stringify(r)).toBe(
121
- '{"allocatedChangeInputs":[{"satoshis":10735,"outputId":15106,"spendable":false}],"changeOutputs":[{"satoshis":1237,"lockingScriptLength":25},{"satoshis":1334,"lockingScriptLength":25},{"satoshis":1369,"lockingScriptLength":25},{"satoshis":1008,"lockingScriptLength":25},{"satoshis":1072,"lockingScriptLength":25}],"size":1739466,"fee":3479,"satsPerKb":2}'
122
- )
123
- expectTransactionSize(params, r)
124
- })
125
-
126
- test('2 WERR_INSUFFICIENT_FUNDS', async () => {
127
- const params: GenerateChangeSdkParams = {
128
- ...defParams,
129
- fixedOutputs: [
130
- { satoshis: 1234, lockingScriptLength: 1739091 },
131
- { satoshis: 2, lockingScriptLength: 25 }
132
- ],
133
- targetNetCount: 4
134
- }
135
- const availableChange: GenerateChangeSdkChangeInput[] = defAvailableChange().slice(1, 4)
136
-
137
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
138
-
139
- expectToThrowWERR(sdk.WERR_INSUFFICIENT_FUNDS, () =>
140
- generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
141
- )
142
- })
143
-
144
- test('2a WERR_INSUFFICIENT_FUNDS no inputs', async () => {
145
- const params: GenerateChangeSdkParams = {
146
- ...defParams,
147
- fixedOutputs: [
148
- { satoshis: 1234, lockingScriptLength: 1739091 },
149
- { satoshis: 2, lockingScriptLength: 25 }
150
- ],
151
- targetNetCount: 4
152
- }
153
- const availableChange: GenerateChangeSdkChangeInput[] = []
154
-
155
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
156
-
157
- expectToThrowWERR(sdk.WERR_INSUFFICIENT_FUNDS, () =>
158
- generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
159
- )
160
- })
161
-
162
- test('3 allocate all', async () => {
163
- const params: GenerateChangeSdkParams = {
164
- ...defParams,
165
- fixedOutputs: [
166
- { satoshis: 1234, lockingScriptLength: 39091 },
167
- { satoshis: 2, lockingScriptLength: 25 }
168
- ],
169
- targetNetCount: 4
170
- }
171
- const availableChange: GenerateChangeSdkChangeInput[] = defAvailableChange().slice(1, 4)
172
-
173
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
174
-
175
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
176
- expect(JSON.stringify(r)).toBe(
177
- '{"allocatedChangeInputs":[{"satoshis":1004,"outputId":15011,"spendable":false},{"satoshis":1000,"outputId":15017,"spendable":false}],"changeOutputs":[{"satoshis":689,"lockingScriptLength":25}],"size":39476,"fee":79,"satsPerKb":2}'
178
- )
179
- expectTransactionSize(params, r)
180
- })
181
-
182
- test('4 feeModel 5 sat per kb', async () => {
183
- const params: GenerateChangeSdkParams = {
184
- ...defParams,
185
- fixedOutputs: [
186
- { satoshis: 1234, lockingScriptLength: 39091 },
187
- { satoshis: 2, lockingScriptLength: 25 }
188
- ],
189
- feeModel: { value: 5, model: 'sat/kb' },
190
- targetNetCount: 4
191
- }
192
- const availableChange: GenerateChangeSdkChangeInput[] = defAvailableChange().slice(1, 4)
193
-
194
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
195
-
196
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
197
- expect(JSON.stringify(r)).toBe(
198
- '{"allocatedChangeInputs":[{"satoshis":1004,"outputId":15011,"spendable":false},{"satoshis":1000,"outputId":15017,"spendable":false}],"changeOutputs":[{"satoshis":570,"lockingScriptLength":25}],"size":39476,"fee":198,"satsPerKb":5}'
199
- )
200
- expectTransactionSize(params, r)
201
- })
202
-
203
- test('4a feeModel 1 sat per kb', async () => {
204
- const params: GenerateChangeSdkParams = {
205
- ...defParams,
206
- fixedOutputs: [
207
- { satoshis: 1234, lockingScriptLength: 39091 },
208
- { satoshis: 2, lockingScriptLength: 25 }
209
- ],
210
- feeModel: { value: 1, model: 'sat/kb' },
211
- targetNetCount: 4
212
- }
213
- const availableChange: GenerateChangeSdkChangeInput[] = defAvailableChange().slice(1, 4)
214
-
215
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
216
-
217
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
218
- expect(JSON.stringify(r)).toBe(
219
- '{"allocatedChangeInputs":[{"satoshis":1004,"outputId":15011,"spendable":false},{"satoshis":1000,"outputId":15017,"spendable":false}],"changeOutputs":[{"satoshis":728,"lockingScriptLength":25}],"size":39476,"fee":40,"satsPerKb":1}'
220
- )
221
- expectTransactionSize(params, r)
222
- })
223
-
224
- test('5 one fixedInput', async () => {
225
- const params: GenerateChangeSdkParams = {
226
- ...defParams,
227
- fixedInputs: [{ satoshis: 1234, unlockingScriptLength: 42 }],
228
- fixedOutputs: [
229
- { satoshis: 1234, lockingScriptLength: 1739091 },
230
- { satoshis: 2, lockingScriptLength: 25 }
231
- ],
232
- targetNetCount: 4
233
- }
234
- const availableChange: GenerateChangeSdkChangeInput[] = [...defAvailableChange()]
235
-
236
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
237
-
238
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
239
- expect(JSON.stringify(r)).toBe(
240
- '{"allocatedChangeInputs":[{"satoshis":10735,"outputId":15106,"spendable":false}],"changeOutputs":[{"satoshis":1526,"lockingScriptLength":25},{"satoshis":1738,"lockingScriptLength":25},{"satoshis":1816,"lockingScriptLength":25},{"satoshis":1016,"lockingScriptLength":25},{"satoshis":1157,"lockingScriptLength":25}],"size":1739549,"fee":3480,"satsPerKb":2}'
241
- )
242
- expectTransactionSize(params, r)
243
- })
244
-
245
- test('5a one larger fixedInput', async () => {
246
- const params: GenerateChangeSdkParams = {
247
- ...defParams,
248
- fixedInputs: [{ satoshis: 1234, unlockingScriptLength: 242 }],
249
- fixedOutputs: [
250
- { satoshis: 1234, lockingScriptLength: 1739091 },
251
- { satoshis: 2, lockingScriptLength: 25 }
252
- ],
253
- targetNetCount: 4
254
- }
255
- const availableChange: GenerateChangeSdkChangeInput[] = [...defAvailableChange()]
256
-
257
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
258
-
259
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
260
- expect(JSON.stringify(r)).toBe(
261
- '{"allocatedChangeInputs":[{"satoshis":10735,"outputId":15106,"spendable":false}],"changeOutputs":[{"satoshis":1526,"lockingScriptLength":25},{"satoshis":1738,"lockingScriptLength":25},{"satoshis":1816,"lockingScriptLength":25},{"satoshis":1016,"lockingScriptLength":25},{"satoshis":1157,"lockingScriptLength":25}],"size":1739749,"fee":3480,"satsPerKb":2}'
262
- )
263
- expectTransactionSize(params, r)
264
- })
265
-
266
- test('5b one fixedInput 1001 73', async () => {
267
- const params: GenerateChangeSdkParams = {
268
- ...defParams,
269
- fixedInputs: [{ satoshis: 1001, unlockingScriptLength: 73 }]
270
- }
271
- const availableChange: GenerateChangeSdkChangeInput[] = [...defAvailableChange()]
272
-
273
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
274
-
275
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
276
- expect(JSON.stringify(r)).toBe(
277
- '{"allocatedChangeInputs":[],"changeOutputs":[{"satoshis":1000,"lockingScriptLength":25}],"size":158,"fee":1,"satsPerKb":2}'
278
- )
279
- expectTransactionSize(params, r)
280
- })
281
-
282
- test('6 no fixedOutputs one fixedInput', async () => {
283
- const params: GenerateChangeSdkParams = {
284
- ...defParams,
285
- fixedInputs: [{ satoshis: 1234, unlockingScriptLength: 42 }],
286
- fixedOutputs: [],
287
- targetNetCount: 4
288
- }
289
- const availableChange: GenerateChangeSdkChangeInput[] = [...defAvailableChange()]
290
-
291
- const { allocateChangeInput, releaseChangeInput, getLog } = generateChangeSdkMakeStorage(availableChange)
292
-
293
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
294
- //console.log(getLog())
295
- expect(JSON.stringify(r)).toBe(
296
- '{"allocatedChangeInputs":[{"satoshis":6323,"outputId":15005,"spendable":false}],"changeOutputs":[{"satoshis":1597,"lockingScriptLength":25},{"satoshis":1837,"lockingScriptLength":25},{"satoshis":1925,"lockingScriptLength":25},{"satoshis":1019,"lockingScriptLength":25},{"satoshis":1178,"lockingScriptLength":25}],"size":411,"fee":1,"satsPerKb":2}'
297
- )
298
- expectTransactionSize(params, r)
299
- })
300
-
301
- test('6a no fixedOutputs no fixedInput', async () => {
302
- const params: GenerateChangeSdkParams = {
303
- ...defParams,
304
- fixedInputs: [],
305
- fixedOutputs: [],
306
- targetNetCount: 4
307
- }
308
- const availableChange: GenerateChangeSdkChangeInput[] = [...defAvailableChange()]
309
-
310
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
311
-
312
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
313
- expect(JSON.stringify(r)).toBe(
314
- '{"allocatedChangeInputs":[{"satoshis":6323,"outputId":15005,"spendable":false}],"changeOutputs":[{"satoshis":1309,"lockingScriptLength":25},{"satoshis":1433,"lockingScriptLength":25},{"satoshis":1478,"lockingScriptLength":25},{"satoshis":1009,"lockingScriptLength":25},{"satoshis":1093,"lockingScriptLength":25}],"size":328,"fee":1,"satsPerKb":2}'
315
- )
316
- expectTransactionSize(params, r)
317
- })
318
-
319
- test('7 paramsText4 d4', async () => {
320
- const params: GenerateChangeSdkParams = {
321
- ...defParams,
322
- fixedOutputs: [
323
- { satoshis: 309000, lockingScriptLength: 198 },
324
- { satoshis: 2, lockingScriptLength: 25 }
325
- ]
326
- }
327
- const availableChange: GenerateChangeSdkChangeInput[] = [
328
- { satoshis: 7130, outputId: 15142 },
329
- { satoshis: 474866, outputId: 15332 },
330
- { satoshis: 16411, outputId: 15355 },
331
- { satoshis: 763632, outputId: 15368 },
332
- { satoshis: 18894, outputId: 15371 },
333
- { satoshis: 1574590, outputId: 15420 },
334
- { satoshis: 43207, outputId: 15480 },
335
- { satoshis: 12342, outputId: 15541 },
336
- { satoshis: 123453, outputId: 15548 },
337
- { satoshis: 7890, outputId: 16020 },
338
- { satoshis: 1073, outputId: 16026 }
339
- ]
340
-
341
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
342
-
343
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
344
- expect(JSON.stringify(r)).toBe(
345
- '{"allocatedChangeInputs":[{"satoshis":474866,"outputId":15332,"spendable":false}],"changeOutputs":[{"satoshis":165863,"lockingScriptLength":25}],"size":433,"fee":1,"satsPerKb":2}'
346
- )
347
- expectTransactionSize(params, r)
348
- })
349
-
350
- interface TestCase {
351
- p: GenerateChangeSdkParams
352
- availableChange: GenerateChangeSdkChangeInput[]
353
- }
354
-
355
- const d5: TestCase = {
356
- p: {
357
- fixedInputs: [{ satoshis: 1000, unlockingScriptLength: 72 }],
358
- fixedOutputs: [{ satoshis: 200, lockingScriptLength: 25 }],
359
- feeModel: { model: 'sat/kb', value: 2 },
360
- changeInitialSatoshis: 1000,
361
- changeFirstSatoshis: 285,
362
- changeLockingScriptLength: 25,
363
- changeUnlockingScriptLength: 107
364
- },
365
- availableChange: [
366
- { satoshis: 191051, outputId: 14101 },
367
- { satoshis: 273356, outputId: 14110 },
368
- { satoshis: 65612, outputId: 14120 },
369
- { satoshis: 44778, outputId: 14126 },
370
- { satoshis: 58732, outputId: 14141 },
371
- { satoshis: 160865, outputId: 14142 },
372
- { satoshis: 1006, outputId: 14177 },
373
- { satoshis: 1000, outputId: 14178 },
374
- { satoshis: 1000, outputId: 14180 },
375
- { satoshis: 1000, outputId: 14181 },
376
- { satoshis: 1000, outputId: 14183 },
377
- { satoshis: 1000, outputId: 14185 },
378
- { satoshis: 1000, outputId: 14186 },
379
- { satoshis: 1001, outputId: 14188 },
380
- { satoshis: 1000, outputId: 14189 },
381
- { satoshis: 1000, outputId: 14190 },
382
- { satoshis: 1001, outputId: 14192 },
383
- { satoshis: 1000, outputId: 14195 },
384
- { satoshis: 1000, outputId: 14196 },
385
- { satoshis: 1000, outputId: 14197 },
386
- { satoshis: 1000, outputId: 14198 },
387
- { satoshis: 1000, outputId: 14199 },
388
- { satoshis: 1000, outputId: 14200 },
389
- { satoshis: 1000, outputId: 14201 },
390
- { satoshis: 1000, outputId: 14202 },
391
- { satoshis: 1000, outputId: 14203 },
392
- { satoshis: 1000, outputId: 14204 },
393
- { satoshis: 1000, outputId: 14205 },
394
- { satoshis: 1000, outputId: 14206 },
395
- { satoshis: 1003, outputId: 14207 },
396
- { satoshis: 1001, outputId: 14208 },
397
- { satoshis: 1000, outputId: 14209 },
398
- { satoshis: 1000, outputId: 14210 },
399
- { satoshis: 1006, outputId: 14211 },
400
- { satoshis: 1020, outputId: 14212 },
401
- { satoshis: 1000, outputId: 14213 },
402
- { satoshis: 1000, outputId: 14214 },
403
- { satoshis: 1000, outputId: 14215 },
404
- { satoshis: 1000, outputId: 14216 },
405
- { satoshis: 1002, outputId: 14217 },
406
- { satoshis: 1046, outputId: 14218 },
407
- { satoshis: 1103, outputId: 14219 },
408
- { satoshis: 1001, outputId: 14221 },
409
- { satoshis: 1000, outputId: 14222 },
410
- { satoshis: 1000, outputId: 14223 },
411
- { satoshis: 1000, outputId: 14224 },
412
- { satoshis: 31311, outputId: 14321 },
413
- { satoshis: 1042, outputId: 14656 },
414
- { satoshis: 1099, outputId: 14661 },
415
- { satoshis: 1100, outputId: 14675 },
416
- { satoshis: 1019, outputId: 14676 },
417
- { satoshis: 1040, outputId: 14677 },
418
- { satoshis: 1000, outputId: 14679 },
419
- { satoshis: 1000, outputId: 14680 },
420
- { satoshis: 1001, outputId: 14681 },
421
- { satoshis: 1000, outputId: 14682 },
422
- { satoshis: 1001, outputId: 14683 },
423
- { satoshis: 1002, outputId: 14684 },
424
- { satoshis: 1005, outputId: 14685 },
425
- { satoshis: 1000, outputId: 14686 },
426
- { satoshis: 1007, outputId: 14687 },
427
- { satoshis: 1000, outputId: 14802 },
428
- { satoshis: 1069, outputId: 14803 },
429
- { satoshis: 1231, outputId: 15465 },
430
- { satoshis: 2386, outputId: 15468 },
431
- { satoshis: 1267, outputId: 15471 },
432
- { satoshis: 1283, outputId: 15472 },
433
- { satoshis: 1054, outputId: 15473 },
434
- { satoshis: 2031, outputId: 15475 },
435
- { satoshis: 1065, outputId: 15478 },
436
- { satoshis: 1268, outputId: 15479 },
437
- { satoshis: 1066, outputId: 15480 },
438
- { satoshis: 1065, outputId: 15481 },
439
- { satoshis: 1006, outputId: 15482 },
440
- { satoshis: 999799, outputId: 16338 },
441
- { satoshis: 2021, outputId: 16339 },
442
- { satoshis: 666465, outputId: 16340 },
443
- { satoshis: 5354, outputId: 16341 },
444
- { satoshis: 3132, outputId: 16342 }
445
- ]
446
- }
447
- const d6: TestCase = {
448
- p: {
449
- fixedInputs: [],
450
- fixedOutputs: [
451
- { satoshis: 500, lockingScriptLength: 436 },
452
- { satoshis: 200, lockingScriptLength: 25 }
453
- ],
454
- feeModel: { model: 'sat/kb', value: 2 },
455
- changeInitialSatoshis: 1000,
456
- changeFirstSatoshis: 285,
457
- changeLockingScriptLength: 25,
458
- changeUnlockingScriptLength: 107
459
- },
460
- availableChange: [
461
- { satoshis: 1040, outputId: 16345 },
462
- { satoshis: 1000, outputId: 16346 },
463
- { satoshis: 1023, outputId: 16348 },
464
- { satoshis: 1054, outputId: 16350 },
465
- { satoshis: 1118, outputId: 16353 },
466
- { satoshis: 1000, outputId: 16354 },
467
- { satoshis: 1001, outputId: 16355 },
468
- { satoshis: 1000, outputId: 16356 },
469
- { satoshis: 1005, outputId: 16360 },
470
- { satoshis: 1000, outputId: 16361 },
471
- { satoshis: 375235, outputId: 16362 },
472
- { satoshis: 1000, outputId: 16363 },
473
- { satoshis: 1000, outputId: 16364 },
474
- { satoshis: 45658, outputId: 16365 },
475
- { satoshis: 286834, outputId: 16367 },
476
- { satoshis: 1001, outputId: 16368 },
477
- { satoshis: 1001, outputId: 16369 },
478
- { satoshis: 57051, outputId: 16370 },
479
- { satoshis: 1036, outputId: 16371 },
480
- { satoshis: 16508, outputId: 16372 },
481
- { satoshis: 1000, outputId: 16373 },
482
- { satoshis: 64213, outputId: 16374 },
483
- { satoshis: 1000, outputId: 16376 },
484
- { satoshis: 1000, outputId: 16377 },
485
- { satoshis: 1154, outputId: 16378 },
486
- { satoshis: 1000, outputId: 16380 },
487
- { satoshis: 1008, outputId: 16381 },
488
- { satoshis: 1064, outputId: 16382 },
489
- { satoshis: 1234, outputId: 16383 },
490
- { satoshis: 119205, outputId: 16395 },
491
- { satoshis: 582, outputId: 16397 },
492
- { satoshis: 2384, outputId: 16399 },
493
- { satoshis: 4391, outputId: 16401 },
494
- { satoshis: 600, outputId: 16406 },
495
- { satoshis: 2599799, outputId: 16407 }
496
- ]
497
- }
498
- const d7: TestCase = {
499
- p: {
500
- fixedInputs: [],
501
- fixedOutputs: [
502
- { satoshis: 1570, lockingScriptLength: 25 },
503
- { satoshis: 200, lockingScriptLength: 25 }
504
- ],
505
- feeModel: { model: 'sat/kb', value: 2 },
506
- changeInitialSatoshis: 1000,
507
- changeFirstSatoshis: 285,
508
- changeLockingScriptLength: 25,
509
- changeUnlockingScriptLength: 107
510
- },
511
- availableChange: [
512
- { satoshis: 23082, outputId: 14734 },
513
- { satoshis: 16496, outputId: 14742 },
514
- { satoshis: 270789, outputId: 14744 },
515
- { satoshis: 81520, outputId: 14763 },
516
- { satoshis: 14759, outputId: 14770 },
517
- { satoshis: 390625, outputId: 14774 },
518
- { satoshis: 674234, outputId: 14790 },
519
- { satoshis: 999799, outputId: 14794 },
520
- { satoshis: 1000, outputId: 15583 },
521
- { satoshis: 1000, outputId: 15584 },
522
- { satoshis: 1000, outputId: 15585 },
523
- { satoshis: 1000, outputId: 15586 },
524
- { satoshis: 1000, outputId: 15587 },
525
- { satoshis: 1000, outputId: 15588 },
526
- { satoshis: 1025, outputId: 15589 },
527
- { satoshis: 1000, outputId: 15590 },
528
- { satoshis: 1000, outputId: 15591 },
529
- { satoshis: 1000, outputId: 15593 },
530
- { satoshis: 1000, outputId: 15594 },
531
- { satoshis: 1000, outputId: 15595 },
532
- { satoshis: 1000, outputId: 15596 },
533
- { satoshis: 1000, outputId: 15597 },
534
- { satoshis: 1316, outputId: 15598 },
535
- { satoshis: 1000, outputId: 15599 },
536
- { satoshis: 1000, outputId: 15600 },
537
- { satoshis: 1000, outputId: 15601 },
538
- { satoshis: 1426, outputId: 15602 },
539
- { satoshis: 1000, outputId: 15603 },
540
- { satoshis: 1000, outputId: 15604 },
541
- { satoshis: 1000, outputId: 15605 },
542
- { satoshis: 1000, outputId: 15606 },
543
- { satoshis: 1000, outputId: 15607 },
544
- { satoshis: 1000, outputId: 15608 },
545
- { satoshis: 1000, outputId: 15609 },
546
- { satoshis: 1004, outputId: 15610 },
547
- { satoshis: 1000, outputId: 15611 },
548
- { satoshis: 1013, outputId: 15612 },
549
- { satoshis: 1001, outputId: 15614 },
550
- { satoshis: 1000, outputId: 15615 },
551
- { satoshis: 1000, outputId: 15616 },
552
- { satoshis: 1000, outputId: 15617 },
553
- { satoshis: 1000, outputId: 15618 },
554
- { satoshis: 1000, outputId: 15619 },
555
- { satoshis: 1006, outputId: 15620 },
556
- { satoshis: 1000, outputId: 15621 },
557
- { satoshis: 1000, outputId: 15622 },
558
- { satoshis: 1000, outputId: 15623 },
559
- { satoshis: 1000, outputId: 15624 },
560
- { satoshis: 1032, outputId: 15625 },
561
- { satoshis: 4571, outputId: 15626 },
562
- { satoshis: 1000, outputId: 15628 },
563
- { satoshis: 1000, outputId: 15629 },
564
- { satoshis: 1087, outputId: 15630 },
565
- { satoshis: 1000, outputId: 15631 },
566
- { satoshis: 1000, outputId: 15632 },
567
- { satoshis: 1001, outputId: 15633 },
568
- { satoshis: 1001, outputId: 15634 },
569
- { satoshis: 1000, outputId: 15635 },
570
- { satoshis: 1000, outputId: 15637 },
571
- { satoshis: 1001, outputId: 15638 },
572
- { satoshis: 1000, outputId: 15639 },
573
- { satoshis: 1000, outputId: 15640 },
574
- { satoshis: 1000, outputId: 15641 },
575
- { satoshis: 1000, outputId: 15642 },
576
- { satoshis: 1000, outputId: 15643 },
577
- { satoshis: 1036, outputId: 15644 },
578
- { satoshis: 1000, outputId: 15645 },
579
- { satoshis: 1000, outputId: 15646 },
580
- { satoshis: 1000, outputId: 15647 },
581
- { satoshis: 1000, outputId: 15648 },
582
- { satoshis: 1001, outputId: 15649 },
583
- { satoshis: 1000, outputId: 15650 },
584
- { satoshis: 1050, outputId: 15651 },
585
- { satoshis: 1273, outputId: 15653 },
586
- { satoshis: 1029, outputId: 15654 },
587
- { satoshis: 1524, outputId: 15655 },
588
- { satoshis: 1817, outputId: 15658 },
589
- { satoshis: 1041, outputId: 16409 }
590
- ]
591
- }
592
- const d8: TestCase = {
593
- p: {
594
- fixedInputs: [],
595
- fixedOutputs: [
596
- { satoshis: 1564, lockingScriptLength: 25 },
597
- { satoshis: 200, lockingScriptLength: 25 }
598
- ],
599
- feeModel: { model: 'sat/kb', value: 2 },
600
- changeInitialSatoshis: 1000,
601
- changeFirstSatoshis: 285,
602
- changeLockingScriptLength: 25,
603
- changeUnlockingScriptLength: 107
604
- },
605
- availableChange: [
606
- { satoshis: 23082, outputId: 14734 },
607
- { satoshis: 16496, outputId: 14742 },
608
- { satoshis: 270789, outputId: 14744 },
609
- { satoshis: 81520, outputId: 14763 },
610
- { satoshis: 14759, outputId: 14770 },
611
- { satoshis: 390625, outputId: 14774 },
612
- { satoshis: 674234, outputId: 14790 },
613
- { satoshis: 999799, outputId: 14794 },
614
- { satoshis: 1000, outputId: 15583 },
615
- { satoshis: 1000, outputId: 15584 },
616
- { satoshis: 1000, outputId: 15585 },
617
- { satoshis: 1000, outputId: 15586 },
618
- { satoshis: 1000, outputId: 15587 },
619
- { satoshis: 1000, outputId: 15588 },
620
- { satoshis: 1025, outputId: 15589 },
621
- { satoshis: 1000, outputId: 15590 },
622
- { satoshis: 1000, outputId: 15591 },
623
- { satoshis: 1000, outputId: 15593 },
624
- { satoshis: 1000, outputId: 15594 },
625
- { satoshis: 1000, outputId: 15595 },
626
- { satoshis: 1000, outputId: 15596 },
627
- { satoshis: 1000, outputId: 15597 },
628
- { satoshis: 1316, outputId: 15598 },
629
- { satoshis: 1000, outputId: 15599 },
630
- { satoshis: 1000, outputId: 15600 },
631
- { satoshis: 1000, outputId: 15601 },
632
- { satoshis: 1426, outputId: 15602 },
633
- { satoshis: 1000, outputId: 15603 },
634
- { satoshis: 1000, outputId: 15604 },
635
- { satoshis: 1000, outputId: 15605 },
636
- { satoshis: 1000, outputId: 15606 },
637
- { satoshis: 1000, outputId: 15607 },
638
- { satoshis: 1000, outputId: 15608 },
639
- { satoshis: 1000, outputId: 15609 },
640
- { satoshis: 1004, outputId: 15610 },
641
- { satoshis: 1000, outputId: 15611 },
642
- { satoshis: 1013, outputId: 15612 },
643
- { satoshis: 1001, outputId: 15614 },
644
- { satoshis: 1000, outputId: 15615 },
645
- { satoshis: 1000, outputId: 15616 },
646
- { satoshis: 1000, outputId: 15617 },
647
- { satoshis: 1000, outputId: 15618 },
648
- { satoshis: 1000, outputId: 15619 },
649
- { satoshis: 1006, outputId: 15620 },
650
- { satoshis: 1000, outputId: 15621 },
651
- { satoshis: 1000, outputId: 15622 },
652
- { satoshis: 1000, outputId: 15623 },
653
- { satoshis: 1000, outputId: 15624 },
654
- { satoshis: 1032, outputId: 15625 },
655
- { satoshis: 4571, outputId: 15626 },
656
- { satoshis: 1000, outputId: 15628 },
657
- { satoshis: 1000, outputId: 15629 },
658
- { satoshis: 1087, outputId: 15630 },
659
- { satoshis: 1000, outputId: 15631 },
660
- { satoshis: 1000, outputId: 15632 },
661
- { satoshis: 1001, outputId: 15633 },
662
- { satoshis: 1001, outputId: 15634 },
663
- { satoshis: 1000, outputId: 15635 },
664
- { satoshis: 1000, outputId: 15637 },
665
- { satoshis: 1001, outputId: 15638 },
666
- { satoshis: 1000, outputId: 15639 },
667
- { satoshis: 1000, outputId: 15640 },
668
- { satoshis: 1000, outputId: 15641 },
669
- { satoshis: 1000, outputId: 15642 },
670
- { satoshis: 1000, outputId: 15643 },
671
- { satoshis: 1036, outputId: 15644 },
672
- { satoshis: 1000, outputId: 15645 },
673
- { satoshis: 1000, outputId: 15646 },
674
- { satoshis: 1000, outputId: 15647 },
675
- { satoshis: 1000, outputId: 15648 },
676
- { satoshis: 1001, outputId: 15649 },
677
- { satoshis: 1000, outputId: 15650 },
678
- { satoshis: 1050, outputId: 15651 },
679
- { satoshis: 1273, outputId: 15653 },
680
- { satoshis: 1029, outputId: 15654 },
681
- { satoshis: 1524, outputId: 15655 },
682
- { satoshis: 1817, outputId: 15658 },
683
- { satoshis: 1041, outputId: 16409 }
684
- ]
685
- }
686
- const d9: TestCase = {
687
- p: {
688
- fixedInputs: [],
689
- fixedOutputs: [
690
- { satoshis: 1000, lockingScriptLength: 1136 },
691
- { satoshis: 200, lockingScriptLength: 25 }
692
- ],
693
- feeModel: { model: 'sat/kb', value: 2 },
694
- changeInitialSatoshis: 1000,
695
- changeFirstSatoshis: 285,
696
- changeLockingScriptLength: 25,
697
- changeUnlockingScriptLength: 107
698
- },
699
- availableChange: [
700
- { satoshis: 23082, outputId: 14734 },
701
- { satoshis: 270789, outputId: 14744 },
702
- { satoshis: 81520, outputId: 14763 },
703
- { satoshis: 14759, outputId: 14770 },
704
- { satoshis: 390625, outputId: 14774 },
705
- { satoshis: 674234, outputId: 14790 },
706
- { satoshis: 999799, outputId: 14794 },
707
- { satoshis: 1000, outputId: 15583 },
708
- { satoshis: 1000, outputId: 15584 },
709
- { satoshis: 1000, outputId: 15585 },
710
- { satoshis: 1000, outputId: 15586 },
711
- { satoshis: 1000, outputId: 15587 },
712
- { satoshis: 1000, outputId: 15588 },
713
- { satoshis: 1000, outputId: 15590 },
714
- { satoshis: 1000, outputId: 15591 },
715
- { satoshis: 1000, outputId: 15593 },
716
- { satoshis: 1000, outputId: 15594 },
717
- { satoshis: 1000, outputId: 15595 },
718
- { satoshis: 1000, outputId: 15596 },
719
- { satoshis: 1000, outputId: 15597 },
720
- { satoshis: 1000, outputId: 15599 },
721
- { satoshis: 1000, outputId: 15600 },
722
- { satoshis: 1000, outputId: 15601 },
723
- { satoshis: 1000, outputId: 15603 },
724
- { satoshis: 1000, outputId: 15604 },
725
- { satoshis: 1000, outputId: 15605 },
726
- { satoshis: 1000, outputId: 15606 },
727
- { satoshis: 1000, outputId: 15607 },
728
- { satoshis: 1000, outputId: 15608 },
729
- { satoshis: 1000, outputId: 15609 },
730
- { satoshis: 1004, outputId: 15610 },
731
- { satoshis: 1000, outputId: 15611 },
732
- { satoshis: 1001, outputId: 15614 },
733
- { satoshis: 1000, outputId: 15615 },
734
- { satoshis: 1000, outputId: 15616 },
735
- { satoshis: 1000, outputId: 15617 },
736
- { satoshis: 1000, outputId: 15618 },
737
- { satoshis: 1000, outputId: 15619 },
738
- { satoshis: 1006, outputId: 15620 },
739
- { satoshis: 1000, outputId: 15621 },
740
- { satoshis: 1000, outputId: 15622 },
741
- { satoshis: 1000, outputId: 15623 },
742
- { satoshis: 1000, outputId: 15624 },
743
- { satoshis: 4571, outputId: 15626 },
744
- { satoshis: 1000, outputId: 15628 },
745
- { satoshis: 1000, outputId: 15629 },
746
- { satoshis: 1000, outputId: 15631 },
747
- { satoshis: 1000, outputId: 15632 },
748
- { satoshis: 1001, outputId: 15633 },
749
- { satoshis: 1001, outputId: 15634 },
750
- { satoshis: 1000, outputId: 15635 },
751
- { satoshis: 1000, outputId: 15637 },
752
- { satoshis: 1001, outputId: 15638 },
753
- { satoshis: 1000, outputId: 15639 },
754
- { satoshis: 1000, outputId: 15640 },
755
- { satoshis: 1000, outputId: 15641 },
756
- { satoshis: 1000, outputId: 15642 },
757
- { satoshis: 1000, outputId: 15643 },
758
- { satoshis: 1000, outputId: 15645 },
759
- { satoshis: 1000, outputId: 15646 },
760
- { satoshis: 1000, outputId: 15647 },
761
- { satoshis: 1000, outputId: 15648 },
762
- { satoshis: 1001, outputId: 15649 },
763
- { satoshis: 1000, outputId: 15650 },
764
- { satoshis: 604, outputId: 16421 },
765
- { satoshis: 958, outputId: 16429 },
766
- { satoshis: 724, outputId: 16431 },
767
- { satoshis: 413, outputId: 16433 },
768
- { satoshis: 915, outputId: 16439 },
769
- { satoshis: 842, outputId: 16441 },
770
- { satoshis: 348, outputId: 16451 },
771
- { satoshis: 339, outputId: 16453 },
772
- { satoshis: 334, outputId: 16455 },
773
- { satoshis: 331, outputId: 16457 },
774
- { satoshis: 330, outputId: 16459 },
775
- { satoshis: 327, outputId: 16461 },
776
- { satoshis: 323, outputId: 16463 },
777
- { satoshis: 311, outputId: 16465 }
778
- ]
779
- }
780
- const d10: TestCase = {
781
- p: {
782
- fixedInputs: [],
783
- fixedOutputs: [
784
- { satoshis: 1, lockingScriptLength: 25 },
785
- { satoshis: 200, lockingScriptLength: 25 }
786
- ],
787
- feeModel: { model: 'sat/kb', value: 110 },
788
- changeInitialSatoshis: 1000,
789
- changeFirstSatoshis: 285,
790
- changeLockingScriptLength: 25,
791
- changeUnlockingScriptLength: 107
792
- },
793
- availableChange: [
794
- { satoshis: 268076, outputId: 16671 },
795
- { satoshis: 2999799, outputId: 16677 },
796
- { satoshis: 14030, outputId: 21194 },
797
- { satoshis: 100925, outputId: 21224 }
798
- ]
799
- }
800
- const d11: TestCase = {
801
- p: {
802
- fixedInputs: [],
803
- fixedOutputs: [
804
- { satoshis: 1, lockingScriptLength: 25 },
805
- { satoshis: 200, lockingScriptLength: 25 }
806
- ],
807
- feeModel: { model: 'sat/kb', value: 110 },
808
- changeInitialSatoshis: 1000,
809
- changeFirstSatoshis: 285,
810
- changeLockingScriptLength: 25,
811
- changeUnlockingScriptLength: 107
812
- },
813
- availableChange: [
814
- { satoshis: 268076, outputId: 16671 },
815
- { satoshis: 2999799, outputId: 16677 },
816
- { satoshis: 1396, outputId: 21307 },
817
- { satoshis: 1023, outputId: 21308 },
818
- { satoshis: 1000, outputId: 21309 },
819
- { satoshis: 1000, outputId: 21310 },
820
- { satoshis: 1000, outputId: 21311 },
821
- { satoshis: 1220, outputId: 21312 },
822
- { satoshis: 5573, outputId: 21313 },
823
- { satoshis: 1000, outputId: 21314 },
824
- { satoshis: 1000, outputId: 21315 },
825
- { satoshis: 5926, outputId: 21316 },
826
- { satoshis: 30814, outputId: 21317 },
827
- { satoshis: 24441, outputId: 21318 },
828
- { satoshis: 285, outputId: 21319 },
829
- { satoshis: 1325, outputId: 21320 },
830
- { satoshis: 1000, outputId: 21321 },
831
- { satoshis: 1002, outputId: 21322 },
832
- { satoshis: 1000, outputId: 21324 },
833
- { satoshis: 1057, outputId: 21325 },
834
- { satoshis: 1000, outputId: 21326 },
835
- { satoshis: 1159, outputId: 21327 },
836
- { satoshis: 1061, outputId: 21328 },
837
- { satoshis: 1000, outputId: 21329 },
838
- { satoshis: 1000, outputId: 21330 },
839
- { satoshis: 1000, outputId: 21331 },
840
- { satoshis: 8873, outputId: 21332 },
841
- { satoshis: 1001, outputId: 21333 },
842
- { satoshis: 1011, outputId: 21334 },
843
- { satoshis: 1000, outputId: 21335 },
844
- { satoshis: 13699, outputId: 21336 }
845
- ]
846
- }
847
- const d12: TestCase = {
848
- p: {
849
- fixedInputs: [],
850
- fixedOutputs: [
851
- { satoshis: 1, lockingScriptLength: 25 },
852
- { satoshis: 200, lockingScriptLength: 25 }
853
- ],
854
- feeModel: { model: 'sat/kb', value: 110 },
855
- changeInitialSatoshis: 1000,
856
- changeFirstSatoshis: 285,
857
- changeLockingScriptLength: 25,
858
- changeUnlockingScriptLength: 107
859
- },
860
- availableChange: [
861
- { satoshis: 268076, outputId: 16671 },
862
- { satoshis: 2999799, outputId: 16677 },
863
- { satoshis: 14030, outputId: 21194 },
864
- { satoshis: 100925, outputId: 21224 }
865
- ]
866
- }
867
- const d13: TestCase = {
868
- p: {
869
- fixedInputs: [],
870
- fixedOutputs: [
871
- { satoshis: 500, lockingScriptLength: 194 },
872
- { satoshis: 2, lockingScriptLength: 25 }
873
- ],
874
- feeModel: { model: 'sat/kb', value: 2 },
875
- changeInitialSatoshis: 1000,
876
- changeFirstSatoshis: 285,
877
- changeLockingScriptLength: 25,
878
- changeUnlockingScriptLength: 107
879
- },
880
- availableChange: [
881
- { satoshis: 285, outputId: 16190 },
882
- { satoshis: 1012, outputId: 18487 },
883
- { satoshis: 1013, outputId: 18488 },
884
- { satoshis: 1000, outputId: 18489 },
885
- { satoshis: 1087, outputId: 18490 },
886
- { satoshis: 290, outputId: 18491 },
887
- { satoshis: 1034, outputId: 18492 }
888
- ]
889
- }
890
- const d14: TestCase = {
891
- p: {
892
- fixedInputs: [],
893
- fixedOutputs: [{ satoshis: 3, lockingScriptLength: 141 }],
894
- feeModel: { model: 'sat/kb', value: 2 },
895
- changeInitialSatoshis: 1000,
896
- changeFirstSatoshis: 285,
897
- changeLockingScriptLength: 25,
898
- changeUnlockingScriptLength: 107,
899
- targetNetCount: 22
900
- },
901
- availableChange: [
902
- { satoshis: 995, outputId: 16190 },
903
- { satoshis: 1000, outputId: 18487 },
904
- { satoshis: 1000, outputId: 18488 },
905
- { satoshis: 1000, outputId: 18489 },
906
- { satoshis: 1000, outputId: 18490 },
907
- { satoshis: 1000, outputId: 18491 },
908
- { satoshis: 1000, outputId: 18492 },
909
- { satoshis: 1000, outputId: 18493 },
910
- { satoshis: 1000, outputId: 18494 },
911
- { satoshis: 1000, outputId: 18495 },
912
- { satoshis: 100, outputId: 18496 }
913
- ]
914
- }
915
-
916
- const test8Cases = [
917
- {
918
- n: 14,
919
- d: d14,
920
- er: '{"allocatedChangeInputs":[{"satoshis":1000,"outputId":18495,"spendable":false}],"changeOutputs":[{"satoshis":996,"lockingScriptLength":25}],"size":342,"fee":1,"satsPerKb":2}'
921
- },
922
- {
923
- n: 13,
924
- d: d13,
925
- er: '{"allocatedChangeInputs":[{"satoshis":1000,"outputId":18489,"spendable":false}],"changeOutputs":[{"satoshis":497,"lockingScriptLength":25}],"size":429,"fee":1,"satsPerKb":2}'
926
- },
927
- {
928
- n: 12,
929
- d: d12,
930
- er: '{"allocatedChangeInputs":[{"satoshis":14030,"outputId":21194,"spendable":false}],"changeOutputs":[{"satoshis":13800,"lockingScriptLength":25}],"size":260,"fee":29,"satsPerKb":110}'
931
- },
932
- {
933
- n: 11,
934
- d: d11,
935
- er: '{"allocatedChangeInputs":[{"satoshis":285,"outputId":21319,"spendable":false},{"satoshis":1000,"outputId":21309,"spendable":false}],"changeOutputs":[{"satoshis":1039,"lockingScriptLength":25}],"size":408,"fee":45,"satsPerKb":110}'
936
- },
937
- {
938
- n: 10,
939
- d: d10,
940
- er: '{"allocatedChangeInputs":[{"satoshis":14030,"outputId":21194,"spendable":false}],"changeOutputs":[{"satoshis":13800,"lockingScriptLength":25}],"size":260,"fee":29,"satsPerKb":110}'
941
- },
942
- {
943
- n: 9,
944
- d: d9,
945
- er: '{"allocatedChangeInputs":[{"satoshis":4571,"outputId":15626,"spendable":false}],"changeOutputs":[{"satoshis":3368,"lockingScriptLength":25}],"size":1373,"fee":3,"satsPerKb":2}'
946
- },
947
- {
948
- n: 8,
949
- d: d8,
950
- er: '{"allocatedChangeInputs":[{"satoshis":1817,"outputId":15658,"spendable":false}],"changeOutputs":[{"satoshis":52,"lockingScriptLength":25}],"size":260,"fee":1,"satsPerKb":2}'
951
- },
952
- {
953
- n: 7,
954
- d: d7,
955
- er: '{"allocatedChangeInputs":[{"satoshis":1817,"outputId":15658,"spendable":false}],"changeOutputs":[{"satoshis":46,"lockingScriptLength":25}],"size":260,"fee":1,"satsPerKb":2}'
956
- },
957
- {
958
- n: 6,
959
- d: d6,
960
- er: '{"allocatedChangeInputs":[{"satoshis":1000,"outputId":16346,"spendable":false}],"changeOutputs":[{"satoshis":298,"lockingScriptLength":25}],"size":673,"fee":2,"satsPerKb":2}'
961
- },
962
- {
963
- n: 5,
964
- d: d5,
965
- er: '{"allocatedChangeInputs":[],"changeOutputs":[{"satoshis":799,"lockingScriptLength":25}],"size":191,"fee":1,"satsPerKb":2}'
966
- }
967
- ]
968
-
969
- test('8 paramsText d5 d6 d7 d8 d9 d10 d11 d12 d13 d14', async () => {
970
- for (const { n, d, er } of test8Cases) {
971
- const params: GenerateChangeSdkParams = { ...d.p }
972
- const availableChange: GenerateChangeSdkChangeInput[] = [...d.availableChange]
973
-
974
- const { allocateChangeInput, releaseChangeInput } = generateChangeSdkMakeStorage(availableChange)
975
-
976
- const r = await generateChangeSdk(params, allocateChangeInput, releaseChangeInput)
977
- expect(JSON.stringify(r)).toBe(er)
978
- expectTransactionSize(params, r)
979
- }
980
- })
981
- })
982
-
983
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
984
- async function expectToThrowWERR<R>(expectedClass: new (...args: any[]) => any, fn: () => Promise<R>): Promise<void> {
985
- try {
986
- await fn()
987
- } catch (eu: unknown) {
988
- const e = sdk.WalletError.fromUnknown(eu)
989
- expect(e.name).toBe(expectedClass.name)
990
- expect(e.isError).toBe(true)
991
- return
992
- }
993
- throw new Error(`${expectedClass.name} was not thrown`)
994
- }
995
-
996
- function makeTransaction(params: GenerateChangeSdkParams, results: GenerateChangeSdkResult): BsvTransaction {
997
- const tx = new BsvTransaction()
998
- for (const i of params.fixedInputs) {
999
- tx.inputs.push({
1000
- unlockingScript: Script.fromBinary(Array(i.unlockingScriptLength).fill(0)),
1001
- sourceOutputIndex: 0,
1002
- sourceTXID: '00'.repeat(32)
1003
- })
1004
- }
1005
- for (const i of results.allocatedChangeInputs) {
1006
- tx.inputs.push({
1007
- unlockingScript: Script.fromBinary(Array(params.changeUnlockingScriptLength).fill(0)),
1008
- sourceOutputIndex: 0,
1009
- sourceTXID: '00'.repeat(32)
1010
- })
1011
- }
1012
- for (const o of params.fixedOutputs) {
1013
- tx.outputs.push({
1014
- lockingScript: Script.fromBinary(Array(o.lockingScriptLength).fill(0)),
1015
- satoshis: o.satoshis
1016
- })
1017
- }
1018
- for (const o of results.changeOutputs) {
1019
- tx.outputs.push({
1020
- lockingScript: Script.fromBinary(Array(o.lockingScriptLength).fill(0)),
1021
- satoshis: o.satoshis
1022
- })
1023
- }
1024
- return tx
1025
- }
1026
-
1027
- function expectTransactionSize(params: GenerateChangeSdkParams, results: GenerateChangeSdkResult) {
1028
- const tx = makeTransaction(params, results)
1029
- const size = tx.toBinary().length
1030
- if (size !== results.size) throw new sdk.WERR_INTERNAL(`expectTransaction actual ${size} expected ${results.size}`)
1031
- }
1032
-
1033
- const defParams: GenerateChangeSdkParams = {
1034
- fixedInputs: [],
1035
- fixedOutputs: [],
1036
- feeModel: { model: 'sat/kb', value: 2 },
1037
- changeInitialSatoshis: 1000,
1038
- changeFirstSatoshis: 285,
1039
- changeLockingScriptLength: 25,
1040
- changeUnlockingScriptLength: 107,
1041
- randomVals: [...randomValsUsed1]
1042
- }
1043
-
1044
- const _defAvailableChange: GenerateChangeSdkChangeInput[] = [
1045
- { satoshis: 6323, outputId: 15005 },
1046
- { satoshis: 1004, outputId: 15011 },
1047
- { satoshis: 1000, outputId: 15013 },
1048
- { satoshis: 1000, outputId: 15017 },
1049
- { satoshis: 1000, outputId: 15023 },
1050
- { satoshis: 1000, outputId: 15027 },
1051
- { satoshis: 1000, outputId: 15034 },
1052
- { satoshis: 1575097, outputId: 15101 },
1053
- { satoshis: 16417, outputId: 15103 },
1054
- { satoshis: 3377, outputId: 15104 },
1055
- { satoshis: 10735, outputId: 15106 }
1056
- ]
1057
- const defAvailableChange = (): GenerateChangeSdkChangeInput[] => JSON.parse(JSON.stringify(_defAvailableChange))