mainnet-js 0.5.8 → 1.0.0-rc.1

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 (686) hide show
  1. package/dist/index.html +9 -1
  2. package/dist/mainnet-1.0.0-rc.1.js +2928 -0
  3. package/dist/module/chain.d.ts +1 -0
  4. package/dist/module/chain.d.ts.map +1 -0
  5. package/dist/module/cli.d.ts +1 -0
  6. package/dist/module/cli.d.ts.map +1 -0
  7. package/dist/module/cli.js +2 -2
  8. package/dist/module/cli.js.map +1 -1
  9. package/dist/module/constant.d.ts +1 -0
  10. package/dist/module/constant.d.ts.map +1 -0
  11. package/dist/module/db/ExchangeRateProvider.d.ts +2 -1
  12. package/dist/module/db/ExchangeRateProvider.d.ts.map +1 -0
  13. package/dist/module/db/IndexedDBProvider.d.ts +3 -2
  14. package/dist/module/db/IndexedDBProvider.d.ts.map +1 -0
  15. package/dist/module/db/SqlProvider.d.ts +7 -8
  16. package/dist/module/db/SqlProvider.d.ts.map +1 -0
  17. package/dist/module/db/SqlProvider.js +10 -8
  18. package/dist/module/db/SqlProvider.js.map +1 -1
  19. package/dist/module/db/StorageProvider.d.ts +2 -1
  20. package/dist/module/db/StorageProvider.d.ts.map +1 -0
  21. package/dist/module/db/getStorageProvider.d.ts +3 -0
  22. package/dist/module/db/getStorageProvider.d.ts.map +1 -0
  23. package/dist/module/db/getStorageProvider.js +19 -0
  24. package/dist/module/db/getStorageProvider.js.map +1 -0
  25. package/dist/module/db/index.d.ts +4 -3
  26. package/dist/module/db/index.d.ts.map +1 -0
  27. package/dist/module/db/index.js +2 -2
  28. package/dist/module/db/index.js.map +1 -1
  29. package/dist/module/db/interface.d.ts +1 -0
  30. package/dist/module/db/interface.d.ts.map +1 -0
  31. package/dist/module/db/util.d.ts +2 -3
  32. package/dist/module/db/util.d.ts.map +1 -0
  33. package/dist/module/db/util.js +0 -17
  34. package/dist/module/db/util.js.map +1 -1
  35. package/dist/module/enum.d.ts +1 -0
  36. package/dist/module/enum.d.ts.map +1 -0
  37. package/dist/module/history/electrumTransformer.d.ts +3 -2
  38. package/dist/module/history/electrumTransformer.d.ts.map +1 -0
  39. package/dist/module/history/electrumTransformer.js +16 -14
  40. package/dist/module/history/electrumTransformer.js.map +1 -1
  41. package/dist/module/history/interface.d.ts +2 -1
  42. package/dist/module/history/interface.d.ts.map +1 -0
  43. package/dist/module/index.d.ts +26 -21
  44. package/dist/module/index.d.ts.map +1 -0
  45. package/dist/module/index.js +25 -17
  46. package/dist/module/index.js.map +1 -1
  47. package/dist/module/interface.d.ts +14 -0
  48. package/dist/module/interface.d.ts.map +1 -0
  49. package/dist/module/interface.js +5 -0
  50. package/dist/module/interface.js.map +1 -1
  51. package/dist/module/message/index.d.ts +3 -2
  52. package/dist/module/message/index.d.ts.map +1 -0
  53. package/dist/module/message/index.js +2 -2
  54. package/dist/module/message/index.js.map +1 -1
  55. package/dist/module/message/interface.d.ts +1 -0
  56. package/dist/module/message/interface.d.ts.map +1 -0
  57. package/dist/module/message/signed.d.ts +2 -1
  58. package/dist/module/message/signed.d.ts.map +1 -0
  59. package/dist/module/message/signed.js +10 -4
  60. package/dist/module/message/signed.js.map +1 -1
  61. package/dist/module/mine/index.d.ts +2 -1
  62. package/dist/module/mine/index.d.ts.map +1 -0
  63. package/dist/module/mine/index.js +1 -1
  64. package/dist/module/mine/index.js.map +1 -1
  65. package/dist/module/mine/mine.d.ts +1 -0
  66. package/dist/module/mine/mine.d.ts.map +1 -0
  67. package/dist/module/mine/mine.js +3 -3
  68. package/dist/module/mine/mine.js.map +1 -1
  69. package/dist/module/network/Connection.d.ts +3 -2
  70. package/dist/module/network/Connection.d.ts.map +1 -0
  71. package/dist/module/network/Connection.js +3 -3
  72. package/dist/module/network/Connection.js.map +1 -1
  73. package/dist/module/network/ElectrumNetworkProvider.d.ts +8 -5
  74. package/dist/module/network/ElectrumNetworkProvider.d.ts.map +1 -0
  75. package/dist/module/network/ElectrumNetworkProvider.js +59 -13
  76. package/dist/module/network/ElectrumNetworkProvider.js.map +1 -1
  77. package/dist/module/network/NetworkProvider.d.ts +2 -1
  78. package/dist/module/network/NetworkProvider.d.ts.map +1 -0
  79. package/dist/module/network/configuration.d.ts +8 -10
  80. package/dist/module/network/configuration.d.ts.map +1 -0
  81. package/dist/module/network/configuration.js +29 -17
  82. package/dist/module/network/configuration.js.map +1 -1
  83. package/dist/module/network/constant.d.ts +1 -0
  84. package/dist/module/network/constant.d.ts.map +1 -0
  85. package/dist/module/network/constant.js +8 -4
  86. package/dist/module/network/constant.js.map +1 -1
  87. package/dist/module/network/default.d.ts +4 -3
  88. package/dist/module/network/default.d.ts.map +1 -0
  89. package/dist/module/network/default.js +7 -7
  90. package/dist/module/network/default.js.map +1 -1
  91. package/dist/module/network/getRelayFeeCache.d.ts +2 -1
  92. package/dist/module/network/getRelayFeeCache.d.ts.map +1 -0
  93. package/dist/module/network/getRelayFeeCache.js +2 -2
  94. package/dist/module/network/getRelayFeeCache.js.map +1 -1
  95. package/dist/module/network/index.d.ts +3 -2
  96. package/dist/module/network/index.d.ts.map +1 -0
  97. package/dist/module/network/index.js +2 -2
  98. package/dist/module/network/index.js.map +1 -1
  99. package/dist/module/network/interface.d.ts +1 -0
  100. package/dist/module/network/interface.d.ts.map +1 -0
  101. package/dist/module/network/util.d.ts +2 -1
  102. package/dist/module/network/util.d.ts.map +1 -0
  103. package/dist/module/qr/Qr.d.ts +2 -1
  104. package/dist/module/qr/Qr.d.ts.map +1 -0
  105. package/dist/module/qr/Qr.js +2 -2
  106. package/dist/module/qr/Qr.js.map +1 -1
  107. package/dist/module/qr/interface.d.ts +1 -0
  108. package/dist/module/qr/interface.d.ts.map +1 -0
  109. package/dist/module/rate/ExchangeRate.d.ts +1 -0
  110. package/dist/module/rate/ExchangeRate.d.ts.map +1 -0
  111. package/dist/module/rate/ExchangeRate.js +5 -5
  112. package/dist/module/rate/ExchangeRate.js.map +1 -1
  113. package/dist/module/slp/GsppProvider.d.ts +4 -3
  114. package/dist/module/slp/GsppProvider.d.ts.map +1 -0
  115. package/dist/module/slp/GsppProvider.js +7 -7
  116. package/dist/module/slp/GsppProvider.js.map +1 -1
  117. package/dist/module/slp/SlpDbProvider.d.ts +4 -3
  118. package/dist/module/slp/SlpDbProvider.d.ts.map +1 -0
  119. package/dist/module/slp/SlpDbProvider.js +8 -8
  120. package/dist/module/slp/SlpDbProvider.js.map +1 -1
  121. package/dist/module/slp/SlpDbTemplates.d.ts +1 -0
  122. package/dist/module/slp/SlpDbTemplates.d.ts.map +1 -0
  123. package/dist/module/slp/SlpLibAuth.d.ts +7 -14
  124. package/dist/module/slp/SlpLibAuth.d.ts.map +1 -0
  125. package/dist/module/slp/SlpLibAuth.js +48 -39
  126. package/dist/module/slp/SlpLibAuth.js.map +1 -1
  127. package/dist/module/slp/SlpProvider.d.ts +2 -1
  128. package/dist/module/slp/SlpProvider.d.ts.map +1 -0
  129. package/dist/module/slp/SlpProvider.js.map +1 -1
  130. package/dist/module/slp/index.d.ts +5 -4
  131. package/dist/module/slp/index.d.ts.map +1 -0
  132. package/dist/module/slp/index.js +3 -3
  133. package/dist/module/slp/index.js.map +1 -1
  134. package/dist/module/slp/interface.d.ts +2 -1
  135. package/dist/module/slp/interface.d.ts.map +1 -0
  136. package/dist/module/test/axios.d.ts +3 -0
  137. package/dist/module/test/axios.d.ts.map +1 -0
  138. package/dist/module/test/axios.js +35 -0
  139. package/dist/module/test/axios.js.map +1 -0
  140. package/dist/module/test/expect.d.ts +6 -1
  141. package/dist/module/test/expect.d.ts.map +1 -0
  142. package/dist/module/test/expect.js +22 -1
  143. package/dist/module/test/expect.js.map +1 -1
  144. package/dist/module/transaction/Wif.d.ts +19 -16
  145. package/dist/module/transaction/Wif.d.ts.map +1 -0
  146. package/dist/module/transaction/Wif.js +152 -55
  147. package/dist/module/transaction/Wif.js.map +1 -1
  148. package/dist/module/transaction/allocateFee.d.ts +5 -4
  149. package/dist/module/transaction/allocateFee.d.ts.map +1 -0
  150. package/dist/module/transaction/allocateFee.js +11 -8
  151. package/dist/module/transaction/allocateFee.js.map +1 -1
  152. package/dist/module/util/amountInSatoshi.d.ts +1 -0
  153. package/dist/module/util/amountInSatoshi.d.ts.map +1 -0
  154. package/dist/module/util/amountInSatoshi.js +4 -4
  155. package/dist/module/util/amountInSatoshi.js.map +1 -1
  156. package/dist/module/util/asSendRequestObject.d.ts +3 -2
  157. package/dist/module/util/asSendRequestObject.d.ts.map +1 -0
  158. package/dist/module/util/asSendRequestObject.js +6 -3
  159. package/dist/module/util/asSendRequestObject.js.map +1 -1
  160. package/dist/module/util/balanceObjectFromSatoshi.d.ts +1 -0
  161. package/dist/module/util/balanceObjectFromSatoshi.d.ts.map +1 -0
  162. package/dist/module/util/balanceObjectFromSatoshi.js +5 -5
  163. package/dist/module/util/balanceObjectFromSatoshi.js.map +1 -1
  164. package/dist/module/util/base64.d.ts +2 -1
  165. package/dist/module/util/base64.d.ts.map +1 -0
  166. package/dist/module/util/base64.js +5 -25
  167. package/dist/module/util/base64.js.map +1 -1
  168. package/dist/module/util/bchaddr.d.ts +1 -0
  169. package/dist/module/util/bchaddr.d.ts.map +1 -0
  170. package/dist/module/util/browserNotSupported.d.ts +1 -0
  171. package/dist/module/util/browserNotSupported.d.ts.map +1 -0
  172. package/dist/module/util/browserNotSupported.js +1 -1
  173. package/dist/module/util/browserNotSupported.js.map +1 -1
  174. package/dist/module/util/checkForEmptySeed.d.ts +1 -0
  175. package/dist/module/util/checkForEmptySeed.d.ts.map +1 -0
  176. package/dist/module/util/checkWifNetwork.d.ts +2 -1
  177. package/dist/module/util/checkWifNetwork.d.ts.map +1 -0
  178. package/dist/module/util/checkWifNetwork.js +1 -1
  179. package/dist/module/util/checkWifNetwork.js.map +1 -1
  180. package/dist/module/util/convert.d.ts +1 -0
  181. package/dist/module/util/convert.d.ts.map +1 -0
  182. package/dist/module/util/convert.js +2 -2
  183. package/dist/module/util/convert.js.map +1 -1
  184. package/dist/module/util/delay.d.ts +1 -0
  185. package/dist/module/util/delay.d.ts.map +1 -0
  186. package/dist/module/util/deriveCashaddr.d.ts +6 -1
  187. package/dist/module/util/deriveCashaddr.d.ts.map +1 -0
  188. package/dist/module/util/deriveCashaddr.js +85 -6
  189. package/dist/module/util/deriveCashaddr.js.map +1 -1
  190. package/dist/module/util/deriveLockscript.d.ts +1 -0
  191. package/dist/module/util/deriveLockscript.d.ts.map +1 -0
  192. package/dist/module/util/deriveNetwork.d.ts +1 -0
  193. package/dist/module/util/deriveNetwork.d.ts.map +1 -0
  194. package/dist/module/util/deriveNetwork.js +2 -2
  195. package/dist/module/util/deriveNetwork.js.map +1 -1
  196. package/dist/module/util/derivePublicKeyHash.d.ts +3 -1
  197. package/dist/module/util/derivePublicKeyHash.d.ts.map +1 -0
  198. package/dist/module/util/derivePublicKeyHash.js +1 -1
  199. package/dist/module/util/derivePublicKeyHash.js.map +1 -1
  200. package/dist/module/util/eventsource.d.ts +1 -0
  201. package/dist/module/util/eventsource.d.ts.map +1 -0
  202. package/dist/module/util/eventsource.js +3 -2
  203. package/dist/module/util/eventsource.js.map +1 -1
  204. package/dist/module/util/floor.d.ts +1 -0
  205. package/dist/module/util/floor.d.ts.map +1 -0
  206. package/dist/module/util/getAddrsByXpubKey.d.ts +8 -8
  207. package/dist/module/util/getAddrsByXpubKey.d.ts.map +1 -0
  208. package/dist/module/util/getAddrsByXpubKey.js +17 -21
  209. package/dist/module/util/getAddrsByXpubKey.js.map +1 -1
  210. package/dist/module/util/getRuntimePlatform.d.ts +1 -0
  211. package/dist/module/util/getRuntimePlatform.d.ts.map +1 -0
  212. package/dist/module/util/getUsdRate.d.ts +1 -0
  213. package/dist/module/util/getUsdRate.d.ts.map +1 -0
  214. package/dist/module/util/getUsdRate.js +1 -1
  215. package/dist/module/util/getUsdRate.js.map +1 -1
  216. package/dist/module/util/getXPubKey.d.ts +2 -1
  217. package/dist/module/util/getXPubKey.d.ts.map +1 -0
  218. package/dist/module/util/getXPubKey.js +6 -7
  219. package/dist/module/util/getXPubKey.js.map +1 -1
  220. package/dist/module/util/hash160.d.ts +2 -1
  221. package/dist/module/util/hash160.d.ts.map +1 -0
  222. package/dist/module/util/hash160.js +2 -4
  223. package/dist/module/util/hash160.js.map +1 -1
  224. package/dist/module/util/index.d.ts +21 -20
  225. package/dist/module/util/index.d.ts.map +1 -0
  226. package/dist/module/util/index.js +20 -20
  227. package/dist/module/util/index.js.map +1 -1
  228. package/dist/module/util/randomBytes.d.ts +3 -1
  229. package/dist/module/util/randomBytes.d.ts.map +1 -0
  230. package/dist/module/util/randomBytes.js +2 -3
  231. package/dist/module/util/randomBytes.js.map +1 -1
  232. package/dist/module/util/randomInt.d.ts +1 -0
  233. package/dist/module/util/randomInt.d.ts.map +1 -0
  234. package/dist/module/util/randomValues.d.ts +1 -0
  235. package/dist/module/util/randomValues.d.ts.map +1 -0
  236. package/dist/module/util/randomValues.js +7 -7
  237. package/dist/module/util/randomValues.js.map +1 -1
  238. package/dist/module/util/sanitizeAddress.d.ts +1 -0
  239. package/dist/module/util/sanitizeAddress.d.ts.map +1 -0
  240. package/dist/module/util/sanitizeAddress.js +1 -1
  241. package/dist/module/util/sanitizeAddress.js.map +1 -1
  242. package/dist/module/util/sanitizeUnit.d.ts +2 -1
  243. package/dist/module/util/sanitizeUnit.d.ts.map +1 -0
  244. package/dist/module/util/satoshiToAmount.d.ts +1 -0
  245. package/dist/module/util/satoshiToAmount.d.ts.map +1 -0
  246. package/dist/module/util/satoshiToAmount.js +4 -4
  247. package/dist/module/util/satoshiToAmount.js.map +1 -1
  248. package/dist/module/util/sumSendRequestAmounts.d.ts +3 -2
  249. package/dist/module/util/sumSendRequestAmounts.d.ts.map +1 -0
  250. package/dist/module/util/sumSendRequestAmounts.js +5 -2
  251. package/dist/module/util/sumSendRequestAmounts.js.map +1 -1
  252. package/dist/module/util/sumUtxoValue.d.ts +4 -2
  253. package/dist/module/util/sumUtxoValue.d.ts.map +1 -0
  254. package/dist/module/util/sumUtxoValue.js +17 -3
  255. package/dist/module/util/sumUtxoValue.js.map +1 -1
  256. package/dist/module/util/transaction.d.ts +2 -0
  257. package/dist/module/util/transaction.d.ts.map +1 -0
  258. package/dist/module/util/transaction.js +7 -0
  259. package/dist/module/util/transaction.js.map +1 -0
  260. package/dist/module/wallet/Base.d.ts +8 -7
  261. package/dist/module/wallet/Base.d.ts.map +1 -0
  262. package/dist/module/wallet/Base.js +7 -7
  263. package/dist/module/wallet/Base.js.map +1 -1
  264. package/dist/module/wallet/Bcmr.d.ts +88 -0
  265. package/dist/module/wallet/Bcmr.d.ts.map +1 -0
  266. package/dist/module/wallet/Bcmr.js +281 -0
  267. package/dist/module/wallet/Bcmr.js.map +1 -0
  268. package/dist/module/wallet/Slp.d.ts +6 -5
  269. package/dist/module/wallet/Slp.d.ts.map +1 -0
  270. package/dist/module/wallet/Slp.js +15 -15
  271. package/dist/module/wallet/Slp.js.map +1 -1
  272. package/dist/module/wallet/Util.d.ts +3 -2
  273. package/dist/module/wallet/Util.d.ts.map +1 -0
  274. package/dist/module/wallet/Util.js +9 -14
  275. package/dist/module/wallet/Util.js.map +1 -1
  276. package/dist/module/wallet/Wif.d.ts +124 -20
  277. package/dist/module/wallet/Wif.d.ts.map +1 -0
  278. package/dist/module/wallet/Wif.js +406 -74
  279. package/dist/module/wallet/Wif.js.map +1 -1
  280. package/dist/module/wallet/bcmr-v1.schema.d.ts +623 -0
  281. package/dist/module/wallet/bcmr-v1.schema.d.ts.map +1 -0
  282. package/dist/module/wallet/bcmr-v1.schema.js +2 -0
  283. package/dist/module/wallet/bcmr-v1.schema.js.map +1 -0
  284. package/dist/module/wallet/createWallet.d.ts +3 -2
  285. package/dist/module/wallet/createWallet.d.ts.map +1 -0
  286. package/dist/module/wallet/createWallet.js +3 -3
  287. package/dist/module/wallet/createWallet.js.map +1 -1
  288. package/dist/module/wallet/enum.d.ts +1 -0
  289. package/dist/module/wallet/enum.d.ts.map +1 -0
  290. package/dist/module/wallet/interface.d.ts +10 -6
  291. package/dist/module/wallet/interface.d.ts.map +1 -0
  292. package/dist/module/wallet/model.d.ts +81 -5
  293. package/dist/module/wallet/model.d.ts.map +1 -0
  294. package/dist/module/wallet/model.js +102 -17
  295. package/dist/module/wallet/model.js.map +1 -1
  296. package/dist/module/webhook/Webhook.d.ts +3 -2
  297. package/dist/module/webhook/Webhook.d.ts.map +1 -0
  298. package/dist/module/webhook/Webhook.js +4 -1
  299. package/dist/module/webhook/Webhook.js.map +1 -1
  300. package/dist/module/webhook/WebhookBch.d.ts +4 -3
  301. package/dist/module/webhook/WebhookBch.d.ts.map +1 -0
  302. package/dist/module/webhook/WebhookBch.js +4 -4
  303. package/dist/module/webhook/WebhookBch.js.map +1 -1
  304. package/dist/module/webhook/WebhookSlp.d.ts +5 -4
  305. package/dist/module/webhook/WebhookSlp.d.ts.map +1 -0
  306. package/dist/module/webhook/WebhookSlp.js +4 -4
  307. package/dist/module/webhook/WebhookSlp.js.map +1 -1
  308. package/dist/module/webhook/WebhookWorker.d.ts +3 -2
  309. package/dist/module/webhook/WebhookWorker.d.ts.map +1 -0
  310. package/dist/module/webhook/WebhookWorker.js +1 -1
  311. package/dist/module/webhook/WebhookWorker.js.map +1 -1
  312. package/dist/module/webhook/index.d.ts +6 -5
  313. package/dist/module/webhook/index.d.ts.map +1 -0
  314. package/dist/module/webhook/index.js +5 -5
  315. package/dist/module/webhook/index.js.map +1 -1
  316. package/dist/module/webhook/interface.d.ts +1 -0
  317. package/dist/module/webhook/interface.d.ts.map +1 -0
  318. package/dist/tsconfig.tsbuildinfo +1 -1
  319. package/package.json +9 -9
  320. package/polyfill/{bip39.browser.js → bip39.browser.cjs} +1 -0
  321. package/polyfill/{util.js → util.cjs} +0 -0
  322. package/src/Wallet.test.headless.js +6 -6
  323. package/src/Wallet.test.ts +69 -1
  324. package/src/cli.ts +3 -3
  325. package/src/db/ExchangeRateProvider.ts +1 -1
  326. package/src/db/IndexedDBProvider.test.ts +0 -1
  327. package/src/db/IndexedDBProvider.ts +2 -2
  328. package/src/db/SqlProvider.ts +14 -12
  329. package/src/db/StorageProvider.ts +1 -1
  330. package/src/db/getStorageProvider.ts +20 -0
  331. package/src/db/index.ts +3 -3
  332. package/src/db/util.ts +1 -20
  333. package/src/history/electrumTransformer.test.ts +1 -2
  334. package/src/history/electrumTransformer.ts +19 -18
  335. package/src/history/interface.ts +1 -1
  336. package/src/index.ts +29 -21
  337. package/src/interface.ts +15 -0
  338. package/src/message/index.ts +2 -2
  339. package/src/message/signed.test.ts +4 -4
  340. package/src/message/signed.ts +23 -6
  341. package/src/mine/index.ts +1 -1
  342. package/src/mine/mine.ts +3 -3
  343. package/src/network/Connection.ts +5 -5
  344. package/src/network/ElectrumNetworkProvider.ts +85 -20
  345. package/src/network/NetworkProvider.ts +1 -1
  346. package/src/network/configuration.test.ts +33 -8
  347. package/src/network/configuration.ts +33 -18
  348. package/src/network/constant.ts +9 -4
  349. package/src/network/default.ts +13 -10
  350. package/src/network/getRelayFeeCache.ts +3 -3
  351. package/src/network/index.ts +6 -2
  352. package/src/network/util.ts +1 -1
  353. package/src/qr/Qr.ts +3 -3
  354. package/src/rate/ExchangeRate.ts +14 -15
  355. package/src/slp/GsppProvider.test.ts +2 -2
  356. package/src/slp/GsppProvider.ts +11 -8
  357. package/src/slp/SlpDbProvider.test.ts +1 -1
  358. package/src/slp/SlpDbProvider.ts +12 -9
  359. package/src/slp/SlpLibAuth.test.ts +1 -1
  360. package/src/slp/SlpLibAuth.ts +52 -42
  361. package/src/slp/SlpProvider.ts +6 -1
  362. package/src/slp/index.ts +4 -4
  363. package/src/slp/interface.ts +1 -1
  364. package/src/test/axios.ts +47 -0
  365. package/src/test/expect.ts +27 -2
  366. package/src/transaction/Wif.ts +203 -77
  367. package/src/transaction/allocateFee.ts +32 -14
  368. package/src/util/amountInSatoshi.ts +4 -4
  369. package/src/util/asSendRequestObject.ts +42 -30
  370. package/src/util/balanceObjectFromSatoshi.ts +5 -5
  371. package/src/util/base64.ts +5 -24
  372. package/src/util/browserNotSupported.ts +1 -1
  373. package/src/util/checkWifNetwork.ts +1 -1
  374. package/src/util/convert.ts +2 -2
  375. package/src/util/deriveCashaddr.test.ts +43 -0
  376. package/src/util/deriveCashaddr.ts +123 -7
  377. package/src/util/deriveNetwork.ts +2 -2
  378. package/src/util/derivePublicKeyHash.test.ts +3 -0
  379. package/src/util/derivePublicKeyHash.ts +18 -5
  380. package/src/util/eventsource.ts +4 -2
  381. package/src/util/getAddrsByXpubKey.test.ts +5 -5
  382. package/src/util/getAddrsByXpubKey.ts +23 -28
  383. package/src/util/getUsdRate.ts +1 -1
  384. package/src/util/getXPubKey.ts +5 -7
  385. package/src/util/hash160.test.ts +2 -2
  386. package/src/util/hash160.ts +2 -4
  387. package/src/util/index.ts +26 -20
  388. package/src/util/randomBytes.ts +2 -3
  389. package/src/util/randomValues.ts +8 -8
  390. package/src/util/sanitizeAddress.ts +1 -1
  391. package/src/util/sanitizeUnit.ts +1 -1
  392. package/src/util/satoshiToAmount.ts +4 -4
  393. package/src/util/sumSendRequestAmounts.ts +10 -4
  394. package/src/util/sumUtxoValue.ts +19 -7
  395. package/src/util/transaction.ts +10 -0
  396. package/src/wallet/Base.ts +11 -11
  397. package/src/wallet/Bcmr.test.headless.js +353 -0
  398. package/src/wallet/Bcmr.test.ts +610 -0
  399. package/src/wallet/Bcmr.ts +390 -0
  400. package/src/wallet/Cashtokens.test.headless.js +467 -0
  401. package/src/wallet/Cashtokens.test.ts +475 -0
  402. package/src/wallet/Slp.test.headless.js +6 -8
  403. package/src/wallet/Slp.test.ts +2 -2
  404. package/src/wallet/Slp.ts +26 -22
  405. package/src/wallet/Util.ts +9 -20
  406. package/src/wallet/Wif.test.ts +20 -21
  407. package/src/wallet/Wif.ts +534 -99
  408. package/src/wallet/bcmr-v1.schema.ts +639 -0
  409. package/src/wallet/createWallet.test.ts +1 -0
  410. package/src/wallet/createWallet.ts +4 -4
  411. package/src/wallet/interface.ts +9 -6
  412. package/src/wallet/model.ts +190 -19
  413. package/src/webhook/Webhook.ts +7 -3
  414. package/src/webhook/WebhookBch.ts +7 -7
  415. package/src/webhook/WebhookSlp.test.ts +2 -2
  416. package/src/webhook/WebhookSlp.ts +6 -6
  417. package/src/webhook/WebhookWorker.ts +2 -2
  418. package/src/webhook/index.ts +5 -5
  419. package/tsconfig.browser.json +0 -3
  420. package/tsconfig.json +17 -5
  421. package/{webpack.config.js → webpack.config.cjs} +46 -14
  422. package/dist/main/chain.d.ts +0 -3
  423. package/dist/main/chain.js +0 -7
  424. package/dist/main/chain.js.map +0 -1
  425. package/dist/main/cli.d.ts +0 -1
  426. package/dist/main/cli.js +0 -35
  427. package/dist/main/cli.js.map +0 -1
  428. package/dist/main/constant.d.ts +0 -5
  429. package/dist/main/constant.js +0 -27
  430. package/dist/main/constant.js.map +0 -1
  431. package/dist/main/db/ExchangeRateProvider.d.ts +0 -11
  432. package/dist/main/db/ExchangeRateProvider.js +0 -47
  433. package/dist/main/db/ExchangeRateProvider.js.map +0 -1
  434. package/dist/main/db/IndexedDBProvider.d.ts +0 -15
  435. package/dist/main/db/IndexedDBProvider.js +0 -86
  436. package/dist/main/db/IndexedDBProvider.js.map +0 -1
  437. package/dist/main/db/SqlProvider.d.ts +0 -41
  438. package/dist/main/db/SqlProvider.js +0 -217
  439. package/dist/main/db/SqlProvider.js.map +0 -1
  440. package/dist/main/db/StorageProvider.d.ts +0 -52
  441. package/dist/main/db/StorageProvider.js +0 -3
  442. package/dist/main/db/StorageProvider.js.map +0 -1
  443. package/dist/main/db/index.d.ts +0 -3
  444. package/dist/main/db/index.js +0 -11
  445. package/dist/main/db/index.js.map +0 -1
  446. package/dist/main/db/interface.d.ts +0 -22
  447. package/dist/main/db/interface.js +0 -3
  448. package/dist/main/db/interface.js.map +0 -1
  449. package/dist/main/db/util.d.ts +0 -5
  450. package/dist/main/db/util.js +0 -53
  451. package/dist/main/db/util.js.map +0 -1
  452. package/dist/main/enum.d.ts +0 -33
  453. package/dist/main/enum.js +0 -39
  454. package/dist/main/enum.js.map +0 -1
  455. package/dist/main/history/electrumTransformer.d.ts +0 -4
  456. package/dist/main/history/electrumTransformer.js +0 -214
  457. package/dist/main/history/electrumTransformer.js.map +0 -1
  458. package/dist/main/history/interface.d.ts +0 -16
  459. package/dist/main/history/interface.js +0 -3
  460. package/dist/main/history/interface.js.map +0 -1
  461. package/dist/main/index.d.ts +0 -24
  462. package/dist/main/index.js +0 -62
  463. package/dist/main/index.js.map +0 -1
  464. package/dist/main/interface.d.ts +0 -31
  465. package/dist/main/interface.js +0 -12
  466. package/dist/main/interface.js.map +0 -1
  467. package/dist/main/message/index.d.ts +0 -2
  468. package/dist/main/message/index.js +0 -15
  469. package/dist/main/message/index.js.map +0 -1
  470. package/dist/main/message/interface.d.ts +0 -29
  471. package/dist/main/message/interface.js +0 -6
  472. package/dist/main/message/interface.js.map +0 -1
  473. package/dist/main/message/signed.d.ts +0 -33
  474. package/dist/main/message/signed.js +0 -141
  475. package/dist/main/message/signed.js.map +0 -1
  476. package/dist/main/mine/index.d.ts +0 -1
  477. package/dist/main/mine/index.js +0 -14
  478. package/dist/main/mine/index.js.map +0 -1
  479. package/dist/main/mine/mine.d.ts +0 -13
  480. package/dist/main/mine/mine.js +0 -37
  481. package/dist/main/mine/mine.js.map +0 -1
  482. package/dist/main/network/Connection.d.ts +0 -14
  483. package/dist/main/network/Connection.js +0 -71
  484. package/dist/main/network/Connection.js.map +0 -1
  485. package/dist/main/network/ElectrumNetworkProvider.d.ts +0 -49
  486. package/dist/main/network/ElectrumNetworkProvider.js +0 -338
  487. package/dist/main/network/ElectrumNetworkProvider.js.map +0 -1
  488. package/dist/main/network/NetworkProvider.d.ts +0 -107
  489. package/dist/main/network/NetworkProvider.js +0 -3
  490. package/dist/main/network/NetworkProvider.js.map +0 -1
  491. package/dist/main/network/configuration.d.ts +0 -12
  492. package/dist/main/network/configuration.js +0 -79
  493. package/dist/main/network/configuration.js.map +0 -1
  494. package/dist/main/network/constant.d.ts +0 -35
  495. package/dist/main/network/constant.js +0 -55
  496. package/dist/main/network/constant.js.map +0 -1
  497. package/dist/main/network/default.d.ts +0 -7
  498. package/dist/main/network/default.js +0 -107
  499. package/dist/main/network/default.js.map +0 -1
  500. package/dist/main/network/getRelayFeeCache.d.ts +0 -2
  501. package/dist/main/network/getRelayFeeCache.js +0 -27
  502. package/dist/main/network/getRelayFeeCache.js.map +0 -1
  503. package/dist/main/network/index.d.ts +0 -2
  504. package/dist/main/network/index.js +0 -10
  505. package/dist/main/network/index.js.map +0 -1
  506. package/dist/main/network/interface.d.ts +0 -60
  507. package/dist/main/network/interface.js +0 -3
  508. package/dist/main/network/interface.js.map +0 -1
  509. package/dist/main/network/util.d.ts +0 -2
  510. package/dist/main/network/util.js +0 -32
  511. package/dist/main/network/util.js.map +0 -1
  512. package/dist/main/qr/Qr.d.ts +0 -8
  513. package/dist/main/qr/Qr.js +0 -26
  514. package/dist/main/qr/Qr.js.map +0 -1
  515. package/dist/main/qr/interface.d.ts +0 -5
  516. package/dist/main/qr/interface.js +0 -3
  517. package/dist/main/qr/interface.js.map +0 -1
  518. package/dist/main/rate/ExchangeRate.d.ts +0 -19
  519. package/dist/main/rate/ExchangeRate.js +0 -147
  520. package/dist/main/rate/ExchangeRate.js.map +0 -1
  521. package/dist/main/slp/GsppProvider.d.ts +0 -54
  522. package/dist/main/slp/GsppProvider.js +0 -214
  523. package/dist/main/slp/GsppProvider.js.map +0 -1
  524. package/dist/main/slp/SlpDbProvider.d.ts +0 -51
  525. package/dist/main/slp/SlpDbProvider.js +0 -182
  526. package/dist/main/slp/SlpDbProvider.js.map +0 -1
  527. package/dist/main/slp/SlpDbTemplates.d.ts +0 -312
  528. package/dist/main/slp/SlpDbTemplates.js +0 -387
  529. package/dist/main/slp/SlpDbTemplates.js.map +0 -1
  530. package/dist/main/slp/SlpLibAuth.d.ts +0 -217
  531. package/dist/main/slp/SlpLibAuth.js +0 -452
  532. package/dist/main/slp/SlpLibAuth.js.map +0 -1
  533. package/dist/main/slp/SlpProvider.d.ts +0 -23
  534. package/dist/main/slp/SlpProvider.js +0 -39
  535. package/dist/main/slp/SlpProvider.js.map +0 -1
  536. package/dist/main/slp/index.d.ts +0 -5
  537. package/dist/main/slp/index.js +0 -24
  538. package/dist/main/slp/index.js.map +0 -1
  539. package/dist/main/slp/interface.d.ts +0 -113
  540. package/dist/main/slp/interface.js +0 -10
  541. package/dist/main/slp/interface.js.map +0 -1
  542. package/dist/main/test/expect.d.ts +0 -7
  543. package/dist/main/test/expect.js +0 -31
  544. package/dist/main/test/expect.js.map +0 -1
  545. package/dist/main/transaction/Wif.d.ts +0 -42
  546. package/dist/main/transaction/Wif.js +0 -214
  547. package/dist/main/transaction/Wif.js.map +0 -1
  548. package/dist/main/transaction/allocateFee.d.ts +0 -7
  549. package/dist/main/transaction/allocateFee.js +0 -118
  550. package/dist/main/transaction/allocateFee.js.map +0 -1
  551. package/dist/main/util/amountInSatoshi.d.ts +0 -9
  552. package/dist/main/util/amountInSatoshi.js +0 -38
  553. package/dist/main/util/amountInSatoshi.js.map +0 -1
  554. package/dist/main/util/asSendRequestObject.d.ts +0 -2
  555. package/dist/main/util/asSendRequestObject.js +0 -57
  556. package/dist/main/util/asSendRequestObject.js.map +0 -1
  557. package/dist/main/util/balanceObjectFromSatoshi.d.ts +0 -8
  558. package/dist/main/util/balanceObjectFromSatoshi.js +0 -62
  559. package/dist/main/util/balanceObjectFromSatoshi.js.map +0 -1
  560. package/dist/main/util/base64.d.ts +0 -2
  561. package/dist/main/util/base64.js +0 -36
  562. package/dist/main/util/base64.js.map +0 -1
  563. package/dist/main/util/bchaddr.d.ts +0 -1
  564. package/dist/main/util/bchaddr.js +0 -24
  565. package/dist/main/util/bchaddr.js.map +0 -1
  566. package/dist/main/util/browserNotSupported.d.ts +0 -1
  567. package/dist/main/util/browserNotSupported.js +0 -11
  568. package/dist/main/util/browserNotSupported.js.map +0 -1
  569. package/dist/main/util/checkForEmptySeed.d.ts +0 -2
  570. package/dist/main/util/checkForEmptySeed.js +0 -12
  571. package/dist/main/util/checkForEmptySeed.js.map +0 -1
  572. package/dist/main/util/checkWifNetwork.d.ts +0 -2
  573. package/dist/main/util/checkWifNetwork.js +0 -16
  574. package/dist/main/util/checkWifNetwork.js.map +0 -1
  575. package/dist/main/util/convert.d.ts +0 -15
  576. package/dist/main/util/convert.js +0 -24
  577. package/dist/main/util/convert.js.map +0 -1
  578. package/dist/main/util/delay.d.ts +0 -1
  579. package/dist/main/util/delay.js +0 -8
  580. package/dist/main/util/delay.js.map +0 -1
  581. package/dist/main/util/deriveCashaddr.d.ts +0 -2
  582. package/dist/main/util/deriveCashaddr.js +0 -13
  583. package/dist/main/util/deriveCashaddr.js.map +0 -1
  584. package/dist/main/util/deriveLockscript.d.ts +0 -8
  585. package/dist/main/util/deriveLockscript.js +0 -19
  586. package/dist/main/util/deriveLockscript.js.map +0 -1
  587. package/dist/main/util/deriveNetwork.d.ts +0 -1
  588. package/dist/main/util/deriveNetwork.js +0 -23
  589. package/dist/main/util/deriveNetwork.js.map +0 -1
  590. package/dist/main/util/derivePublicKeyHash.d.ts +0 -16
  591. package/dist/main/util/derivePublicKeyHash.js +0 -49
  592. package/dist/main/util/derivePublicKeyHash.js.map +0 -1
  593. package/dist/main/util/eventsource.d.ts +0 -2
  594. package/dist/main/util/eventsource.js +0 -12
  595. package/dist/main/util/eventsource.js.map +0 -1
  596. package/dist/main/util/floor.d.ts +0 -1
  597. package/dist/main/util/floor.js +0 -9
  598. package/dist/main/util/floor.js.map +0 -1
  599. package/dist/main/util/getAddrsByXpubKey.d.ts +0 -22
  600. package/dist/main/util/getAddrsByXpubKey.js +0 -79
  601. package/dist/main/util/getAddrsByXpubKey.js.map +0 -1
  602. package/dist/main/util/getRuntimePlatform.d.ts +0 -6
  603. package/dist/main/util/getRuntimePlatform.js +0 -34
  604. package/dist/main/util/getRuntimePlatform.js.map +0 -1
  605. package/dist/main/util/getUsdRate.d.ts +0 -1
  606. package/dist/main/util/getUsdRate.js +0 -9
  607. package/dist/main/util/getUsdRate.js.map +0 -1
  608. package/dist/main/util/getXPubKey.d.ts +0 -1
  609. package/dist/main/util/getXPubKey.js +0 -26
  610. package/dist/main/util/getXPubKey.js.map +0 -1
  611. package/dist/main/util/hash160.d.ts +0 -8
  612. package/dist/main/util/hash160.js +0 -18
  613. package/dist/main/util/hash160.js.map +0 -1
  614. package/dist/main/util/index.d.ts +0 -21
  615. package/dist/main/util/index.js +0 -72
  616. package/dist/main/util/index.js.map +0 -1
  617. package/dist/main/util/randomBytes.d.ts +0 -1
  618. package/dist/main/util/randomBytes.js +0 -18
  619. package/dist/main/util/randomBytes.js.map +0 -1
  620. package/dist/main/util/randomInt.d.ts +0 -1
  621. package/dist/main/util/randomInt.js +0 -9
  622. package/dist/main/util/randomInt.js.map +0 -1
  623. package/dist/main/util/randomValues.d.ts +0 -1
  624. package/dist/main/util/randomValues.js +0 -15
  625. package/dist/main/util/randomValues.js.map +0 -1
  626. package/dist/main/util/sanitizeAddress.d.ts +0 -1
  627. package/dist/main/util/sanitizeAddress.js +0 -15
  628. package/dist/main/util/sanitizeAddress.js.map +0 -1
  629. package/dist/main/util/sanitizeUnit.d.ts +0 -2
  630. package/dist/main/util/sanitizeUnit.js +0 -13
  631. package/dist/main/util/sanitizeUnit.js.map +0 -1
  632. package/dist/main/util/satoshiToAmount.d.ts +0 -9
  633. package/dist/main/util/satoshiToAmount.js +0 -41
  634. package/dist/main/util/satoshiToAmount.js.map +0 -1
  635. package/dist/main/util/sumSendRequestAmounts.d.ts +0 -2
  636. package/dist/main/util/sumSendRequestAmounts.js +0 -31
  637. package/dist/main/util/sumSendRequestAmounts.js.map +0 -1
  638. package/dist/main/util/sumUtxoValue.d.ts +0 -2
  639. package/dist/main/util/sumUtxoValue.js +0 -17
  640. package/dist/main/util/sumUtxoValue.js.map +0 -1
  641. package/dist/main/wallet/Base.d.ts +0 -202
  642. package/dist/main/wallet/Base.js +0 -438
  643. package/dist/main/wallet/Base.js.map +0 -1
  644. package/dist/main/wallet/Slp.d.ts +0 -430
  645. package/dist/main/wallet/Slp.js +0 -775
  646. package/dist/main/wallet/Slp.js.map +0 -1
  647. package/dist/main/wallet/Util.d.ts +0 -69
  648. package/dist/main/wallet/Util.js +0 -182
  649. package/dist/main/wallet/Util.js.map +0 -1
  650. package/dist/main/wallet/Wif.d.ts +0 -255
  651. package/dist/main/wallet/Wif.js +0 -1067
  652. package/dist/main/wallet/Wif.js.map +0 -1
  653. package/dist/main/wallet/createWallet.d.ts +0 -69
  654. package/dist/main/wallet/createWallet.js +0 -244
  655. package/dist/main/wallet/createWallet.js.map +0 -1
  656. package/dist/main/wallet/enum.d.ts +0 -16
  657. package/dist/main/wallet/enum.js +0 -22
  658. package/dist/main/wallet/enum.js.map +0 -1
  659. package/dist/main/wallet/interface.d.ts +0 -76
  660. package/dist/main/wallet/interface.js +0 -3
  661. package/dist/main/wallet/interface.js.map +0 -1
  662. package/dist/main/wallet/model.d.ts +0 -88
  663. package/dist/main/wallet/model.js +0 -129
  664. package/dist/main/wallet/model.js.map +0 -1
  665. package/dist/main/webhook/Webhook.d.ts +0 -40
  666. package/dist/main/webhook/Webhook.js +0 -82
  667. package/dist/main/webhook/Webhook.js.map +0 -1
  668. package/dist/main/webhook/WebhookBch.d.ts +0 -13
  669. package/dist/main/webhook/WebhookBch.js +0 -148
  670. package/dist/main/webhook/WebhookBch.js.map +0 -1
  671. package/dist/main/webhook/WebhookSlp.d.ts +0 -14
  672. package/dist/main/webhook/WebhookSlp.js +0 -107
  673. package/dist/main/webhook/WebhookSlp.js.map +0 -1
  674. package/dist/main/webhook/WebhookWorker.d.ts +0 -22
  675. package/dist/main/webhook/WebhookWorker.js +0 -100
  676. package/dist/main/webhook/WebhookWorker.js.map +0 -1
  677. package/dist/main/webhook/index.d.ts +0 -5
  678. package/dist/main/webhook/index.js +0 -23
  679. package/dist/main/webhook/index.js.map +0 -1
  680. package/dist/main/webhook/interface.d.ts +0 -8
  681. package/dist/main/webhook/interface.js +0 -3
  682. package/dist/main/webhook/interface.js.map +0 -1
  683. package/dist/mainnet-0.5.8.js +0 -2
  684. package/dist/mainnet-0.5.8.js.LICENSE.txt +0 -48
  685. package/dist/tsconfig.browser.tsbuildinfo +0 -1
  686. package/jest.config.js +0 -23
@@ -1,775 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.RegTestWatchSlp = exports.TestNetWatchSlp = exports.WatchSlp = exports.RegTestWifSlp = exports.TestNetWifSlp = exports.WifSlp = exports.RegTestSlp = exports.TestNetSlp = exports.Slp = void 0;
7
- const Wif_1 = require("../wallet/Wif");
8
- const interface_1 = require("../slp/interface");
9
- const SlpDbProvider_1 = require("../slp/SlpDbProvider");
10
- const Qr_1 = require("../qr/Qr");
11
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
12
- const getRelayFeeCache_1 = require("../network/getRelayFeeCache");
13
- const Wif_2 = require("../transaction/Wif");
14
- const SlpLibAuth_1 = require("../slp/SlpLibAuth");
15
- const libauth_1 = require("@bitauth/libauth");
16
- const bchaddr_1 = require("../util/bchaddr");
17
- const GsppProvider_1 = require("../slp/GsppProvider");
18
- const delay_1 = require("../util/delay");
19
- const Util_1 = require("./Util");
20
- const index_1 = require("../index");
21
- const enum_1 = require("./enum");
22
- /**
23
- * Class to manage an slp enabled wallet.
24
- */
25
- class Slp {
26
- /**
27
- * Initializes an Slp Wallet.
28
- *
29
- * @param wallet A non-slp wallet object
30
- */
31
- constructor(wallet) {
32
- // a loookup table of spent inputs to keep track of NFT parent token consumption. related to a bug in SLPDB
33
- this.spentParentUtxos = [];
34
- this.slpaddr = (0, bchaddr_1.toSlpAddress)(wallet.cashaddr);
35
- this.wallet = wallet;
36
- let provider = Slp.defaultProvider;
37
- if (index_1.Mainnet.getRuntimePlatform() === index_1.Mainnet.RuntimePlatform.node &&
38
- process.env.SLP_PROVIDER)
39
- provider = process.env.SLP_PROVIDER;
40
- if (provider === "gspp") {
41
- this.provider = new GsppProvider_1.GsppProvider(this.wallet.network);
42
- }
43
- else {
44
- // provider === "slpdb"
45
- this.provider = new SlpDbProvider_1.SlpDbProvider(this.wallet.network);
46
- }
47
- }
48
- static get walletType() {
49
- return Wif_1.Wallet;
50
- }
51
- /**
52
- * setProvider - sets the provider to fetch slp data from
53
- */
54
- setProvider(provider) {
55
- return (this.provider = provider);
56
- }
57
- /**
58
- * getDepositAddress - get the slp deposit address
59
- *
60
- * a high-level function,
61
- *
62
- * @see {@link https://rest-unstable.mainnet.cash/api-docs/#/wallet%2Fslp/slpDepositAddress|/wallet/slp/deposit_address} for REST endpoint
63
- *
64
- * @returns The the slp address as a string
65
- */
66
- getDepositAddress() {
67
- return this.slpaddr;
68
- }
69
- /**
70
- * getDepositQr - get an slp address qrcode, encoded for display on the web
71
- *
72
- * a high-level function
73
- *
74
- * @see {@link https://rest-unstable.mainnet.cash/api-docs/#/wallet%2Fslp/slpDepositQr|/wallet/slp/deposit_qr} for REST endpoint
75
- *
76
- * @returns The qrcode for the slp address
77
- */
78
- getDepositQr() {
79
- const result = (0, Qr_1.qrAddress)(this.slpaddr);
80
- result.alt = "A Bitcoin Cash Simple Ledger Protocol QR Code";
81
- return result;
82
- }
83
- /**
84
- * getTokenInfo - get data associated with a token
85
- *
86
- * a high-level function
87
- *
88
- * @see {@link https://rest-unstable.mainnet.cash/api-docs/#/wallet%2Fslp/slpTokenInfo|/wallet/slp/token_info} for REST endpoint
89
- *
90
- * @param tokenId The tokenId to request information about
91
- *
92
- * @returns Promise to the slp token info or undefined.
93
- */
94
- getTokenInfo(tokenId) {
95
- return this.provider.SlpTokenInfo(tokenId);
96
- }
97
- /**
98
- * getSlpOutpoints - get a list of SLP unspent outpoints
99
- *
100
- * an intermediate function contributing to the output of wallet.getUtxos() and /wallet/utxos for slp enabled wallets
101
- *
102
- * @param slpaddr The slpaddr to request slp unspent outpoints for
103
- *
104
- * @returns Promise to a list of slp unspent outpoints
105
- */
106
- async getSlpOutpoints() {
107
- return this.provider.SlpOutpoints(this.slpaddr);
108
- }
109
- /**
110
- * getSlpUtxos - get a list of SLP unspent outputs
111
- *
112
- * @returns Promise to a list of slp unspent outputs
113
- */
114
- async getSlpUtxos() {
115
- return this.provider.SlpUtxos(this.slpaddr);
116
- }
117
- /**
118
- * getFormattedSlpUtxos - get a list of unspent outputs
119
- *
120
- * an intermediate function
121
- *
122
- * @returns Promise to a list of slp formatted unspent outputs
123
- */
124
- async getFormattedSlpUtxos() {
125
- const utxos = await this.getSlpUtxos();
126
- return utxos.map((val) => {
127
- let utxo = {};
128
- utxo.ticker = val.ticker;
129
- utxo.tokenId = val.tokenId;
130
- utxo.value = val.value.toString();
131
- utxo.satoshis = val.satoshis;
132
- utxo.decimals = val.decimals;
133
- utxo.txId = val.txid;
134
- utxo.index = val.vout;
135
- utxo.utxoId = utxo.txId + ":" + utxo.index;
136
- utxo.type = val.type;
137
- return utxo;
138
- });
139
- }
140
- /**
141
- * getBatonUtxos - get a list of baton unspent outputs
142
- *
143
- * an intermediate function
144
- *
145
- * @param tokenId The id of the slp token
146
- *
147
- * @returns Promise to a list of slp unspent outputs
148
- */
149
- async getBatonUtxos(tokenId) {
150
- return this.provider.SlpBatonUtxos(this.slpaddr, tokenId);
151
- }
152
- /**
153
- * getHistory - get a transaction history for a particular address
154
- *
155
- * an intermediate function
156
- *
157
- * @param tokenId The id of the slp token
158
- *
159
- * @returns Promise to a list of transactions
160
- */
161
- async getHistory(tokenId) {
162
- return this.provider.SlpAddressTransactionHistory(this.slpaddr, tokenId);
163
- }
164
- /**
165
- * getLastTransaction - get a last SLP token transaction of a particular address
166
- *
167
- * @param {boolean} [confirmedOnly=false] When confirmedOnly is true, results will be limited to only transactions included in a block.
168
- *
169
- * @returns Promise to the transaction hex or error
170
- */
171
- async getLastTransaction(confirmedOnly = false) {
172
- let history = await this.getHistory();
173
- if (confirmedOnly) {
174
- history = history.filter((val) => val.height > 0);
175
- }
176
- const [lastTx] = history.slice(-1);
177
- return this.wallet.provider.getRawTransactionObject(lastTx.tx_hash);
178
- }
179
- /**
180
- * getBalance - get a token balance for a particular address
181
- *
182
- * a high-level function, see also /wallet/slp/balance REST endpoint
183
- *
184
- * @param tokenId The id of the slp token
185
- *
186
- * @returns Promise to an SlpTokenBalance
187
- */
188
- async getBalance(tokenId) {
189
- if (!tokenId) {
190
- throw new Error(`Invalid tokenId ${tokenId}`);
191
- }
192
- return this.provider.SlpTokenBalance(this.slpaddr, tokenId);
193
- }
194
- /**
195
- * getAllBalances - get all token balances for a particular address
196
- *
197
- * a high-level function, see also /wallet/slp/all_balances REST endpoint
198
- *
199
- * @returns Promise to an array of SlpTokenBalance
200
- */
201
- async getAllBalances() {
202
- return this.provider.SlpAllTokenBalances(this.slpaddr);
203
- }
204
- /**
205
- * watchBalance - set up a callback to be called upon wallet's slp balance change
206
- *
207
- * can be cancelled by calling the function returned from this one
208
- *
209
- * @param callback The callback function to be called each time the balance changes
210
- * @param tokenId Specific token id to watch
211
- *
212
- * @returns A function to cancel the watching
213
- */
214
- watchBalance(callback, tokenId) {
215
- return this.provider.SlpWatchBalance(callback, this.slpaddr, tokenId);
216
- }
217
- /**
218
- * waitForBalance - wait for address balance to be greater than or equal to the target value
219
- *
220
- * This call halts the program execution
221
- *
222
- * @param value Target balance value
223
- * @param tokenId Specific token id to watch
224
- *
225
- * @returns Actual token balance after reaching or surpassing the target value
226
- */
227
- async waitForBalance(value, tokenId) {
228
- return this.provider.SlpWaitForBalance(value, this.slpaddr, tokenId);
229
- }
230
- /**
231
- * watchBalance - set up a callback to be called upon wallet's slp transactions occurring
232
- *
233
- * can be cancelled by calling the function returned from this one
234
- *
235
- * @param callback The callback function to be called each time the balance changes
236
- * @param tokenId Specific token id to watch, optional
237
- *
238
- * @returns A function to cancel the watching
239
- */
240
- watchTransactions(callback, tokenId) {
241
- return this.provider.SlpWatchTransactions(callback, this.slpaddr, tokenId);
242
- }
243
- /**
244
- * waitForBalance - wait for the next SLP transaction to occur
245
- *
246
- * This call halts the program execution
247
- *
248
- * @param tokenId Specific token id to watch, optional
249
- *
250
- * @returns Transaction object
251
- */
252
- async waitForTransaction(tokenId) {
253
- return this.provider.SlpWaitForTransaction(this.slpaddr, tokenId);
254
- }
255
- /**
256
- * genesis - create a new Type1 SLP token
257
- *
258
- * @param options Token creation options @see SlpGenesisOptions
259
- *
260
- * @returns Token Id and new token balance
261
- */
262
- async genesis(options) {
263
- let result = await this._processGenesis(options);
264
- return {
265
- tokenId: result,
266
- balance: await this.getBalance(result),
267
- };
268
- }
269
- /**
270
- * nftParentGenesis - create a new NFT Parent token
271
- *
272
- * @param options Token creation options @see SlpGenesisOptions
273
- *
274
- * @returns Token Id and new token balance
275
- */
276
- async nftParentGenesis(options) {
277
- options.type = interface_1.SlpTokenType.NftParent;
278
- let result = await this._processGenesis(options);
279
- return {
280
- tokenId: result,
281
- balance: await this.getBalance(result),
282
- };
283
- }
284
- /**
285
- * nftParentGenesis - create a new NFT Child token
286
- *
287
- * @param parentTokenId Parent token id, at least one is required and will be spent in the child genesis process
288
- * @param options Token creation options @see SlpGenesisOptions
289
- *
290
- * @returns Token Id and new token balance
291
- */
292
- async nftChildGenesis(options) {
293
- if (!options.parentTokenId) {
294
- throw new Error(`The 'parentTokenId' was not set or invalid ${options.parentTokenId}`);
295
- }
296
- let parentUtxos = await this.provider.SlpSpendableUtxos(this.slpaddr, options.parentTokenId);
297
- parentUtxos = parentUtxos.filter((val) => this.spentParentUtxos.indexOf(`${val.txid}:${val.vout}`) === -1);
298
- parentUtxos = parentUtxos.sort((a, b) => a.value.comparedTo(b.value));
299
- if (!parentUtxos.length) {
300
- throw new Error(`You do not own any NFT parent tokens with id ${options.parentTokenId}`);
301
- }
302
- if (parentUtxos[0].type !== interface_1.SlpTokenType.NftParent) {
303
- throw new Error(`The 'parentTokenId' is not of type ${interface_1.SlpTokenType.NftParent}`);
304
- }
305
- // we are about to spend exactly 1 NFT parent
306
- // if we do not have it, we have to make one by splitting
307
- if (parentUtxos[0].value.isGreaterThan(new bignumber_js_1.default(1))) {
308
- await this.send([
309
- {
310
- slpaddr: this.slpaddr,
311
- tokenId: options.parentTokenId,
312
- value: new bignumber_js_1.default(1),
313
- },
314
- ]);
315
- return await this.nftChildGenesis(options);
316
- }
317
- options.type = interface_1.SlpTokenType.NftChild;
318
- options.endBaton = true;
319
- options.initialAmount = 1;
320
- options.decimals = 0;
321
- let result = await this._processGenesis(options, [parentUtxos[0]]);
322
- const tx = (await this.wallet.provider.getRawTransactionObject(result));
323
- tx.vin.forEach((val) => this.spentParentUtxos.push(`${val.txid}:${val.vout}`));
324
- return {
325
- tokenId: result,
326
- balance: await this.getBalance(result),
327
- };
328
- }
329
- /**
330
- * _processGenesis - prepare the genesis transaction with given parameters
331
- *
332
- * a private utility wrapper to pre-process transactions
333
- *
334
- * @param options genesis options to controll the process
335
- *
336
- * @returns the created tokenId (which is genesis transaction id) and token balance
337
- */
338
- async _processGenesis(options, ensureInputs = []) {
339
- options = this.substituteOptionals(options);
340
- let slpOutputsResult = await (0, SlpLibAuth_1.SlpGetGenesisOutputs)(options);
341
- let fundingBchUtxos = await this.wallet
342
- .slpAware(true)
343
- .getAddressUtxos(this.wallet.cashaddr);
344
- fundingBchUtxos = [...ensureInputs, ...fundingBchUtxos];
345
- return this.processSlpTransaction(fundingBchUtxos, slpOutputsResult);
346
- }
347
- /**
348
- * sendMax - send the maximum spendable amount for a token to an slpaddr.
349
- *
350
- * a high-level function, see also /wallet/slp/send_max REST endpoint
351
- *
352
- * @param slpaddr destination SLP address
353
- * @param tokenId the id of the token to be spent
354
- *
355
- * @returns transaction id and token balance
356
- */
357
- async sendMax(slpaddr, tokenId) {
358
- const balance = await this.getBalance(tokenId);
359
- const requests = [balance].map((val) => ({
360
- slpaddr: slpaddr,
361
- value: val.value,
362
- ticker: val.ticker,
363
- tokenId: val.tokenId,
364
- }));
365
- return this.send(requests);
366
- }
367
- /**
368
- * explorerUrl Web url to a transaction on a block explorer
369
- *
370
- * @param txId transaction Id
371
- * @returns Url string
372
- */
373
- explorerUrl(txId) {
374
- const explorerUrlMap = {
375
- mainnet: "https://simpleledger.info/#tx/",
376
- testnet: "https://testnet.simpleledger.info/#tx/",
377
- regtest: "",
378
- };
379
- return explorerUrlMap[this.wallet.network] + txId;
380
- }
381
- /**
382
- * send - attempt to process a list of slp send requests.
383
- *
384
- * a high-level function, see also /wallet/slp/send REST endpoint
385
- *
386
- * @param [requests] list of send requests
387
- *
388
- * @returns transaction id and token balance
389
- */
390
- async send(requests) {
391
- let [actualTokenId, result] = await this._processSendRequests(requests);
392
- return {
393
- txId: result,
394
- balance: await this.getBalance(actualTokenId),
395
- explorerUrl: this.explorerUrl(result),
396
- };
397
- }
398
- /**
399
- * _processSendRequests - given a list of sendRequests, estimate fees, build the transaction and submit it.
400
- *
401
- * A private utility wrapper to pre-process transactions
402
- *
403
- * Unstable - behavior may change without notice.
404
- *
405
- * @param {SlpSendRequest[]} sendRequests
406
- */
407
- async _processSendRequests(sendRequests) {
408
- if (!sendRequests.length) {
409
- throw Error("Empty send requests");
410
- }
411
- if (sendRequests.length > 19) {
412
- throw Error("Too many send requests in one transaction");
413
- }
414
- const uniqueTokenIds = new Set(sendRequests.map((val) => val.tokenId));
415
- if (uniqueTokenIds.size > 1) {
416
- throw Error("You have two different token types with the same ticker. Pass tokenId parameter");
417
- }
418
- const tokenId = sendRequests[0].tokenId;
419
- if (!tokenId.match(/^[0-9a-fA-F]{64}$/)) {
420
- throw new Error("Invalid tokenId, must be 64 character long hexadecimal string");
421
- }
422
- const slpUtxos = await this.provider.SlpSpendableUtxos(this.slpaddr, tokenId);
423
- let slpOutputsResult = await (0, SlpLibAuth_1.SlpGetSendOutputs)(this.slpaddr, slpUtxos, sendRequests);
424
- let fundingBchUtxos = await this.wallet
425
- .slpAware(true)
426
- .getAddressUtxos(this.wallet.cashaddr);
427
- let slpToBchUtxos = slpOutputsResult.FundingSlpUtxos.map((val) => val);
428
- fundingBchUtxos = [...slpToBchUtxos, ...fundingBchUtxos];
429
- const actualTokenId = slpUtxos[0].tokenId;
430
- return [
431
- actualTokenId,
432
- await this.processSlpTransaction(fundingBchUtxos, slpOutputsResult, actualTokenId),
433
- ];
434
- }
435
- /**
436
- * mint - create new tokens to increase the circulation supply.
437
- *
438
- * a high-level function, see also /wallet/slp/mint endpoint
439
- *
440
- * @param value amount to mint
441
- * @param tokenId the tokenId of the slp being minted
442
- * @param endBaton boolean indicating whether the token should continue to be "mintable"
443
- *
444
- * @returns transaction id and token balance
445
- */
446
- async mint(options) {
447
- let [actualTokenId, result] = await this._processMint(options);
448
- return {
449
- txId: result,
450
- balance: await this.getBalance(actualTokenId),
451
- };
452
- }
453
- /**
454
- * _processMint - given mint parameters, prepare the transaction
455
- *
456
- * a private utility wrapper to pre-process transactions
457
- *
458
- * @param value amount to mint
459
- * @param tokenId the tokenId of the slp being minted
460
- * @param endBaton boolean indicating whether the token should continue to be "mintable"
461
- *
462
- * @returns the tokenId and minting transaction id
463
- */
464
- async _processMint(options) {
465
- options = this.substituteOptionals(options);
466
- options.value = new bignumber_js_1.default(options.value);
467
- if (options.value.isLessThanOrEqualTo(0) &&
468
- options.batonReceiverSlpAddr === this.slpaddr) {
469
- throw Error("Mint amount should be greater than zero");
470
- }
471
- const slpBatonUtxos = await this.getBatonUtxos(options.tokenId);
472
- if (!slpBatonUtxos.length) {
473
- throw Error(`You do not possess the minting baton for ${options.tokenId}`);
474
- }
475
- let slpOutputsResult = await (0, SlpLibAuth_1.SlpGetMintOutputs)(options, slpBatonUtxos);
476
- let bchUtxos = await this.wallet
477
- .slpAware(true)
478
- .getAddressUtxos(this.wallet.cashaddr);
479
- let fundingBchUtxos = bchUtxos;
480
- let slpToBchUtxos = slpOutputsResult.FundingSlpUtxos.map((val) => val);
481
- fundingBchUtxos = [...slpToBchUtxos, ...fundingBchUtxos];
482
- return [
483
- options.tokenId,
484
- await this.processSlpTransaction(fundingBchUtxos, slpOutputsResult, options.tokenId),
485
- ];
486
- }
487
- /**
488
- * processSlpTransaction - process the prepared SLP transaction and submit it to the network
489
- *
490
- * @param fundingBchUtxos ensure these BCH utxos to be spent in the process
491
- * @param slpOutputsResult prepared SLP outputs to be added to transaction
492
- *
493
- * @returns the tokenId and minting transaction id
494
- */
495
- async processSlpTransaction(fundingBchUtxos, slpOutputsResult, tokenId) {
496
- if (!this.wallet.privateKey) {
497
- throw new Error(`Wallet ${this.wallet.name} is missing either a network or private key`);
498
- }
499
- if (!fundingBchUtxos.length) {
500
- throw new Error("No bch available to fund this transaction");
501
- }
502
- const bestHeight = await this.wallet.provider.getBlockHeight();
503
- const relayFeePerByteInSatoshi = await (0, getRelayFeeCache_1.getRelayFeeCache)(this.wallet.provider);
504
- const feeEstimate = await (0, Wif_2.getFeeAmount)({
505
- utxos: fundingBchUtxos,
506
- sendRequests: slpOutputsResult.BchSendRequests,
507
- privateKey: this.wallet.privateKey,
508
- relayFeePerByteInSatoshi: relayFeePerByteInSatoshi,
509
- slpOutputs: slpOutputsResult.SlpOutputs,
510
- feePaidBy: enum_1.FeePaidByEnum.change,
511
- });
512
- const bchSpendAmount = slpOutputsResult.BchSendRequests.map((val) => val.value).reduce((a, b) => a + b, 0);
513
- let fundingUtxos = await (0, Wif_2.getSuitableUtxos)(fundingBchUtxos, BigInt(bchSpendAmount) + BigInt(feeEstimate), bestHeight, enum_1.FeePaidByEnum.change);
514
- if (fundingUtxos.length === 0) {
515
- throw Error("The available inputs couldn't satisfy the request with fees");
516
- }
517
- const fee = await (0, Wif_2.getFeeAmount)({
518
- utxos: fundingUtxos,
519
- sendRequests: slpOutputsResult.BchSendRequests,
520
- privateKey: this.wallet.privateKey,
521
- relayFeePerByteInSatoshi: relayFeePerByteInSatoshi,
522
- slpOutputs: slpOutputsResult.SlpOutputs,
523
- feePaidBy: enum_1.FeePaidByEnum.change,
524
- });
525
- const encodedTransaction = await (0, Wif_2.buildEncodedTransaction)(fundingUtxos, slpOutputsResult.BchSendRequests, this.wallet.privateKey, fee, false, slpOutputsResult.SlpOutputs);
526
- return this._submitTransaction(encodedTransaction, tokenId);
527
- }
528
- /**
529
- * _submitTransaction - transform binary transaction to hex and submit it to the network provider
530
- *
531
- * a private utility wrapper submit raw transactions
532
- *
533
- * @param transaction raw transaction
534
- *
535
- * @returns the transaction id of the broadcasted transaction
536
- */
537
- async _submitTransaction(transaction, tokenId) {
538
- let rawTransaction = (0, libauth_1.binToHex)(transaction);
539
- const slpPromise = new Promise(async (resolve) => {
540
- const txHash = await Util_1.Util.getTransactionHash(rawTransaction);
541
- const cancelWatchFn = this.provider.SlpWatchTransactions(async (tx) => {
542
- if (tx.tx_hash === txHash) {
543
- cancelWatchFn();
544
- resolve(txHash);
545
- }
546
- }, undefined, tokenId || txHash);
547
- });
548
- const bchPromise = this.wallet.provider.sendRawTransaction(rawTransaction, true);
549
- const [_, txHash] = await Promise.all([slpPromise, bchPromise]);
550
- // allow for indexer processing, delay value is a bit arbitrary
551
- await (0, delay_1.delay)(100);
552
- return txHash;
553
- }
554
- /**
555
- * substituteOptionals - substitute optional fields with default values
556
- *
557
- * will ensure that baton and token receiver are intialized as SLP address of this wallet if absent
558
- * will ensure that baton will not be ended if endBaton is undefined
559
- * a private utility wrapper substitute optionals
560
- *
561
- * @param options genesis or mint options to substitute values int
562
- *
563
- * @returns options with relevant values substituted/initialized
564
- */
565
- substituteOptionals(options) {
566
- if (!options.batonReceiverSlpAddr) {
567
- options.batonReceiverSlpAddr = this.slpaddr;
568
- }
569
- if (!options.tokenReceiverSlpAddr) {
570
- options.tokenReceiverSlpAddr = this.slpaddr;
571
- }
572
- if (options.endBaton === undefined) {
573
- options.endBaton = false;
574
- }
575
- return options;
576
- }
577
- //#region Convenience methods to initialize Slp aware BCH wallet.
578
- /**
579
- * fromId - create an SLP aware wallet from encoded walletId string
580
- *
581
- * @param walletId walletId options to steer the creation process
582
- *
583
- * @returns wallet instantiated accordingly to the walletId rules
584
- */
585
- static async fromId(walletId) {
586
- const wallet = await this.walletType.fromId(walletId);
587
- wallet._slpAware = true;
588
- return wallet;
589
- }
590
- /**
591
- * named - create an SLP aware named wallet
592
- *
593
- * @param name user friendly wallet alias
594
- * @param dbName name under which the wallet will be stored in the database
595
- * @param force force recreate wallet in the database if a record already exist
596
- *
597
- * @returns instantiated wallet
598
- */
599
- static async named(name, dbName, force) {
600
- const wallet = await this.walletType.named(name, dbName, force);
601
- wallet.derivationPath = "m/44'/245'/0'/0/0";
602
- wallet._slpAware = true;
603
- return wallet;
604
- }
605
- /**
606
- * fromSeed - create an SLP aware wallet using the seed phrase and derivation path
607
- *
608
- * unless specified the derivation path m/44'/245'/0'/0/0 will be userd
609
- * this derivation path is standard for Electron Cash SLP and other SLP enabled wallets
610
- *
611
- * @param seed BIP39 12 word seed phrase
612
- * @param derivationPath BIP44 HD wallet derivation path to get a single the private key from hierarchy
613
- *
614
- * @returns instantiated wallet
615
- */
616
- static async fromSeed(seed, derivationPath = "m/44'/245'/0'/0/0") {
617
- const wallet = await this.walletType.fromSeed(seed, derivationPath);
618
- wallet._slpAware = true;
619
- return wallet;
620
- }
621
- /**
622
- * newRandom - create an SLP aware random wallet
623
- *
624
- * if `name` parameter is specified, the wallet will also be persisted to DB
625
- *
626
- * @param name user friendly wallet alias
627
- * @param dbName name under which the wallet will be stored in the database
628
- *
629
- * @returns instantiated wallet
630
- */
631
- static async newRandom(name = "", dbName) {
632
- const wallet = await this.walletType.newRandom(name, dbName);
633
- wallet.derivationPath = "m/44'/245'/0'/0/0";
634
- wallet._slpAware = true;
635
- return wallet;
636
- }
637
- /**
638
- * fromWIF - create an SLP aware wallet using the private key supplied in `Wallet Import Format`
639
- *
640
- * @param wif WIF encoded private key string
641
- *
642
- * @returns instantiated wallet
643
- */
644
- static async fromWIF(wif) {
645
- const wallet = await this.walletType.fromWIF(wif);
646
- wallet.derivationPath = "m/44'/245'/0'/0/0";
647
- wallet._slpAware = true;
648
- return wallet;
649
- }
650
- /**
651
- * watchOnly - create an SLP aware watch-only wallet
652
- *
653
- * such kind of wallet does not have a private key and is unable to spend any funds
654
- * however it still allows to use many utility functions such as getting and watching balance, etc.
655
- *
656
- * @param address cashaddress or slpaddress of a wallet
657
- *
658
- * @returns instantiated wallet
659
- */
660
- static async watchOnly(address) {
661
- const wallet = await this.walletType.watchOnly((0, bchaddr_1.toCashAddress)(address));
662
- wallet.derivationPath = "m/44'/245'/0'/0/0";
663
- wallet._slpAware = true;
664
- return wallet;
665
- }
666
- /**
667
- * fromCashaddr - create an SLP aware watch-only wallet in the network derived from the address
668
- *
669
- * such kind of wallet does not have a private key and is unable to spend any funds
670
- * however it still allows to use many utility functions such as getting and watching balance, etc.
671
- *
672
- * @param address cashaddress of a wallet
673
- *
674
- * @returns instantiated wallet
675
- */
676
- static async fromCashaddr(address) {
677
- const wallet = await this.walletType.fromCashaddr(address);
678
- wallet.derivationPath = "m/44'/245'/0'/0/0";
679
- wallet._slpAware = true;
680
- return wallet;
681
- }
682
- /**
683
- * fromSlpaddr - create an SLP aware watch-only wallet in the network derived from the address
684
- *
685
- * such kind of wallet does not have a private key and is unable to spend any funds
686
- * however it still allows to use many utility functions such as getting and watching balance, etc.
687
- *
688
- * @param address slpaddress of a wallet
689
- *
690
- * @returns instantiated wallet
691
- */
692
- static async fromSlpaddr(address) {
693
- const wallet = await this.walletType.fromSlpaddr(address);
694
- wallet.derivationPath = "m/44'/245'/0'/0/0";
695
- wallet._slpAware = true;
696
- return wallet;
697
- }
698
- }
699
- exports.Slp = Slp;
700
- Slp.defaultProvider = "slpdb";
701
- //#region Specific wallet classes
702
- /**
703
- * Class to manage an slp enabled testnet wallet.
704
- */
705
- class TestNetSlp extends Slp {
706
- static get walletType() {
707
- return Wif_1.TestNetWallet;
708
- }
709
- }
710
- exports.TestNetSlp = TestNetSlp;
711
- /**
712
- * Class to manage an slp enabled regtest wallet.
713
- */
714
- class RegTestSlp extends Slp {
715
- static get walletType() {
716
- return Wif_1.RegTestWallet;
717
- }
718
- }
719
- exports.RegTestSlp = RegTestSlp;
720
- /**
721
- * Class to manage a bitcoin cash wif wallet.
722
- */
723
- class WifSlp extends Slp {
724
- static get walletType() {
725
- return Wif_1.WifWallet;
726
- }
727
- }
728
- exports.WifSlp = WifSlp;
729
- /**
730
- * Class to manage a testnet wif wallet.
731
- */
732
- class TestNetWifSlp extends Slp {
733
- static get walletType() {
734
- return Wif_1.TestNetWifWallet;
735
- }
736
- }
737
- exports.TestNetWifSlp = TestNetWifSlp;
738
- /**
739
- * Class to manage a regtest wif wallet.
740
- */
741
- class RegTestWifSlp extends Slp {
742
- static get walletType() {
743
- return Wif_1.RegTestWifWallet;
744
- }
745
- }
746
- exports.RegTestWifSlp = RegTestWifSlp;
747
- /**
748
- * Class to manage a bitcoin cash watch wallet.
749
- */
750
- class WatchSlp extends Slp {
751
- static get walletType() {
752
- return Wif_1.WatchWallet;
753
- }
754
- }
755
- exports.WatchSlp = WatchSlp;
756
- /**
757
- * Class to manage a testnet watch wallet.
758
- */
759
- class TestNetWatchSlp extends Slp {
760
- static get walletType() {
761
- return Wif_1.TestNetWatchWallet;
762
- }
763
- }
764
- exports.TestNetWatchSlp = TestNetWatchSlp;
765
- /**
766
- * Class to manage a regtest watch wallet.
767
- */
768
- class RegTestWatchSlp extends Slp {
769
- static get walletType() {
770
- return Wif_1.RegTestWatchWallet;
771
- }
772
- }
773
- exports.RegTestWatchSlp = RegTestWatchSlp;
774
- //#endregion
775
- //# sourceMappingURL=Slp.js.map