@did-btcr2/method 0.13.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 (310) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +7 -0
  3. package/dist/browser.js +2364 -0
  4. package/dist/browser.js.map +7 -0
  5. package/dist/browser.mjs +2364 -0
  6. package/dist/browser.mjs.map +7 -0
  7. package/dist/cjs/bitcoin/constants.js +20 -0
  8. package/dist/cjs/bitcoin/constants.js.map +1 -0
  9. package/dist/cjs/bitcoin/errors.js +11 -0
  10. package/dist/cjs/bitcoin/errors.js.map +1 -0
  11. package/dist/cjs/bitcoin/index.js +95 -0
  12. package/dist/cjs/bitcoin/index.js.map +1 -0
  13. package/dist/cjs/bitcoin/interface.js +2 -0
  14. package/dist/cjs/bitcoin/interface.js.map +1 -0
  15. package/dist/cjs/bitcoin/network.js +17 -0
  16. package/dist/cjs/bitcoin/network.js.map +1 -0
  17. package/dist/cjs/bitcoin/rest-client.js +289 -0
  18. package/dist/cjs/bitcoin/rest-client.js.map +1 -0
  19. package/dist/cjs/bitcoin/rpc-client.js +722 -0
  20. package/dist/cjs/bitcoin/rpc-client.js.map +1 -0
  21. package/dist/cjs/bitcoin/taproot.js +219 -0
  22. package/dist/cjs/bitcoin/taproot.js.map +1 -0
  23. package/dist/cjs/btcr2/beacon/aggregation/coordinator.js +120 -0
  24. package/dist/cjs/btcr2/beacon/aggregation/coordinator.js.map +1 -0
  25. package/dist/cjs/btcr2/beacon/aggregation/messages/advert.js +24 -0
  26. package/dist/cjs/btcr2/beacon/aggregation/messages/advert.js.map +1 -0
  27. package/dist/cjs/btcr2/beacon/aggregation/messages/base.js +37 -0
  28. package/dist/cjs/btcr2/beacon/aggregation/messages/base.js.map +1 -0
  29. package/dist/cjs/btcr2/beacon/aggregation/messages/cohort-set.js +25 -0
  30. package/dist/cjs/btcr2/beacon/aggregation/messages/cohort-set.js.map +1 -0
  31. package/dist/cjs/btcr2/beacon/aggregation/messages/keygen.js +8 -0
  32. package/dist/cjs/btcr2/beacon/aggregation/messages/keygen.js.map +1 -0
  33. package/dist/cjs/btcr2/beacon/aggregation/messages/opt-in.js +23 -0
  34. package/dist/cjs/btcr2/beacon/aggregation/messages/opt-in.js.map +1 -0
  35. package/dist/cjs/btcr2/beacon/aggregation/messages/sign.js +7 -0
  36. package/dist/cjs/btcr2/beacon/aggregation/messages/sign.js.map +1 -0
  37. package/dist/cjs/btcr2/beacon/aggregation/models/cohort/index.js +92 -0
  38. package/dist/cjs/btcr2/beacon/aggregation/models/cohort/index.js.map +1 -0
  39. package/dist/cjs/btcr2/beacon/aggregation/models/cohort/status.js +8 -0
  40. package/dist/cjs/btcr2/beacon/aggregation/models/cohort/status.js.map +1 -0
  41. package/dist/cjs/btcr2/beacon/aggregation/participant.js +2 -0
  42. package/dist/cjs/btcr2/beacon/aggregation/participant.js.map +1 -0
  43. package/dist/cjs/btcr2/beacon/aggregation/protocol/nostr.js +57 -0
  44. package/dist/cjs/btcr2/beacon/aggregation/protocol/nostr.js.map +1 -0
  45. package/dist/cjs/btcr2/beacon/aggregation/protocol/service.js +2 -0
  46. package/dist/cjs/btcr2/beacon/aggregation/protocol/service.js.map +1 -0
  47. package/dist/cjs/btcr2/beacon/cid-aggregate.js +116 -0
  48. package/dist/cjs/btcr2/beacon/cid-aggregate.js.map +1 -0
  49. package/dist/cjs/btcr2/beacon/factory.js +30 -0
  50. package/dist/cjs/btcr2/beacon/factory.js.map +1 -0
  51. package/dist/cjs/btcr2/beacon/singleton.js +220 -0
  52. package/dist/cjs/btcr2/beacon/singleton.js.map +1 -0
  53. package/dist/cjs/btcr2/beacon/smt-aggregate.js +126 -0
  54. package/dist/cjs/btcr2/beacon/smt-aggregate.js.map +1 -0
  55. package/dist/cjs/btcr2/crud/create.js +102 -0
  56. package/dist/cjs/btcr2/crud/create.js.map +1 -0
  57. package/dist/cjs/btcr2/crud/deactivate.js +14 -0
  58. package/dist/cjs/btcr2/crud/deactivate.js.map +1 -0
  59. package/dist/cjs/btcr2/crud/read.js +686 -0
  60. package/dist/cjs/btcr2/crud/read.js.map +1 -0
  61. package/dist/cjs/btcr2/crud/update.js +195 -0
  62. package/dist/cjs/btcr2/crud/update.js.map +1 -0
  63. package/dist/cjs/btcr2/key-manager/index.js +290 -0
  64. package/dist/cjs/btcr2/key-manager/index.js.map +1 -0
  65. package/dist/cjs/btcr2/key-manager/interface.js +2 -0
  66. package/dist/cjs/btcr2/key-manager/interface.js.map +1 -0
  67. package/dist/cjs/did-btcr2.js +222 -0
  68. package/dist/cjs/did-btcr2.js.map +1 -0
  69. package/dist/cjs/index.js +27 -0
  70. package/dist/cjs/index.js.map +1 -0
  71. package/dist/cjs/interfaces/beacon.js +41 -0
  72. package/dist/cjs/interfaces/beacon.js.map +1 -0
  73. package/dist/cjs/interfaces/crud.js +2 -0
  74. package/dist/cjs/interfaces/crud.js.map +1 -0
  75. package/dist/cjs/interfaces/ibeacon.js +2 -0
  76. package/dist/cjs/interfaces/ibeacon.js.map +1 -0
  77. package/dist/cjs/package.json +1 -0
  78. package/dist/cjs/types/bitcoin.js +62 -0
  79. package/dist/cjs/types/bitcoin.js.map +1 -0
  80. package/dist/cjs/types/crud.js +2 -0
  81. package/dist/cjs/types/crud.js.map +1 -0
  82. package/dist/cjs/utils/appendix.js +221 -0
  83. package/dist/cjs/utils/appendix.js.map +1 -0
  84. package/dist/cjs/utils/beacons.js +206 -0
  85. package/dist/cjs/utils/beacons.js.map +1 -0
  86. package/dist/cjs/utils/did-document-builder.js +61 -0
  87. package/dist/cjs/utils/did-document-builder.js.map +1 -0
  88. package/dist/cjs/utils/did-document.js +380 -0
  89. package/dist/cjs/utils/did-document.js.map +1 -0
  90. package/dist/cjs/utils/general.js +195 -0
  91. package/dist/cjs/utils/general.js.map +1 -0
  92. package/dist/cjs/utils/identifier.js +238 -0
  93. package/dist/cjs/utils/identifier.js.map +1 -0
  94. package/dist/esm/bitcoin/constants.js +20 -0
  95. package/dist/esm/bitcoin/constants.js.map +1 -0
  96. package/dist/esm/bitcoin/errors.js +11 -0
  97. package/dist/esm/bitcoin/errors.js.map +1 -0
  98. package/dist/esm/bitcoin/index.js +95 -0
  99. package/dist/esm/bitcoin/index.js.map +1 -0
  100. package/dist/esm/bitcoin/interface.js +2 -0
  101. package/dist/esm/bitcoin/interface.js.map +1 -0
  102. package/dist/esm/bitcoin/network.js +17 -0
  103. package/dist/esm/bitcoin/network.js.map +1 -0
  104. package/dist/esm/bitcoin/rest-client.js +289 -0
  105. package/dist/esm/bitcoin/rest-client.js.map +1 -0
  106. package/dist/esm/bitcoin/rpc-client.js +722 -0
  107. package/dist/esm/bitcoin/rpc-client.js.map +1 -0
  108. package/dist/esm/bitcoin/taproot.js +219 -0
  109. package/dist/esm/bitcoin/taproot.js.map +1 -0
  110. package/dist/esm/btcr2/beacon/aggregation/coordinator.js +120 -0
  111. package/dist/esm/btcr2/beacon/aggregation/coordinator.js.map +1 -0
  112. package/dist/esm/btcr2/beacon/aggregation/messages/advert.js +24 -0
  113. package/dist/esm/btcr2/beacon/aggregation/messages/advert.js.map +1 -0
  114. package/dist/esm/btcr2/beacon/aggregation/messages/base.js +37 -0
  115. package/dist/esm/btcr2/beacon/aggregation/messages/base.js.map +1 -0
  116. package/dist/esm/btcr2/beacon/aggregation/messages/cohort-set.js +25 -0
  117. package/dist/esm/btcr2/beacon/aggregation/messages/cohort-set.js.map +1 -0
  118. package/dist/esm/btcr2/beacon/aggregation/messages/keygen.js +8 -0
  119. package/dist/esm/btcr2/beacon/aggregation/messages/keygen.js.map +1 -0
  120. package/dist/esm/btcr2/beacon/aggregation/messages/opt-in.js +23 -0
  121. package/dist/esm/btcr2/beacon/aggregation/messages/opt-in.js.map +1 -0
  122. package/dist/esm/btcr2/beacon/aggregation/messages/sign.js +7 -0
  123. package/dist/esm/btcr2/beacon/aggregation/messages/sign.js.map +1 -0
  124. package/dist/esm/btcr2/beacon/aggregation/models/cohort/index.js +92 -0
  125. package/dist/esm/btcr2/beacon/aggregation/models/cohort/index.js.map +1 -0
  126. package/dist/esm/btcr2/beacon/aggregation/models/cohort/status.js +8 -0
  127. package/dist/esm/btcr2/beacon/aggregation/models/cohort/status.js.map +1 -0
  128. package/dist/esm/btcr2/beacon/aggregation/participant.js +2 -0
  129. package/dist/esm/btcr2/beacon/aggregation/participant.js.map +1 -0
  130. package/dist/esm/btcr2/beacon/aggregation/protocol/nostr.js +57 -0
  131. package/dist/esm/btcr2/beacon/aggregation/protocol/nostr.js.map +1 -0
  132. package/dist/esm/btcr2/beacon/aggregation/protocol/service.js +2 -0
  133. package/dist/esm/btcr2/beacon/aggregation/protocol/service.js.map +1 -0
  134. package/dist/esm/btcr2/beacon/cid-aggregate.js +116 -0
  135. package/dist/esm/btcr2/beacon/cid-aggregate.js.map +1 -0
  136. package/dist/esm/btcr2/beacon/factory.js +30 -0
  137. package/dist/esm/btcr2/beacon/factory.js.map +1 -0
  138. package/dist/esm/btcr2/beacon/singleton.js +220 -0
  139. package/dist/esm/btcr2/beacon/singleton.js.map +1 -0
  140. package/dist/esm/btcr2/beacon/smt-aggregate.js +126 -0
  141. package/dist/esm/btcr2/beacon/smt-aggregate.js.map +1 -0
  142. package/dist/esm/btcr2/crud/create.js +102 -0
  143. package/dist/esm/btcr2/crud/create.js.map +1 -0
  144. package/dist/esm/btcr2/crud/deactivate.js +14 -0
  145. package/dist/esm/btcr2/crud/deactivate.js.map +1 -0
  146. package/dist/esm/btcr2/crud/read.js +686 -0
  147. package/dist/esm/btcr2/crud/read.js.map +1 -0
  148. package/dist/esm/btcr2/crud/update.js +195 -0
  149. package/dist/esm/btcr2/crud/update.js.map +1 -0
  150. package/dist/esm/btcr2/key-manager/index.js +290 -0
  151. package/dist/esm/btcr2/key-manager/index.js.map +1 -0
  152. package/dist/esm/btcr2/key-manager/interface.js +2 -0
  153. package/dist/esm/btcr2/key-manager/interface.js.map +1 -0
  154. package/dist/esm/did-btcr2.js +222 -0
  155. package/dist/esm/did-btcr2.js.map +1 -0
  156. package/dist/esm/index.js +27 -0
  157. package/dist/esm/index.js.map +1 -0
  158. package/dist/esm/interfaces/beacon.js +41 -0
  159. package/dist/esm/interfaces/beacon.js.map +1 -0
  160. package/dist/esm/interfaces/crud.js +2 -0
  161. package/dist/esm/interfaces/crud.js.map +1 -0
  162. package/dist/esm/interfaces/ibeacon.js +2 -0
  163. package/dist/esm/interfaces/ibeacon.js.map +1 -0
  164. package/dist/esm/types/bitcoin.js +62 -0
  165. package/dist/esm/types/bitcoin.js.map +1 -0
  166. package/dist/esm/types/crud.js +2 -0
  167. package/dist/esm/types/crud.js.map +1 -0
  168. package/dist/esm/utils/appendix.js +221 -0
  169. package/dist/esm/utils/appendix.js.map +1 -0
  170. package/dist/esm/utils/beacons.js +206 -0
  171. package/dist/esm/utils/beacons.js.map +1 -0
  172. package/dist/esm/utils/did-document-builder.js +61 -0
  173. package/dist/esm/utils/did-document-builder.js.map +1 -0
  174. package/dist/esm/utils/did-document.js +380 -0
  175. package/dist/esm/utils/did-document.js.map +1 -0
  176. package/dist/esm/utils/general.js +195 -0
  177. package/dist/esm/utils/general.js.map +1 -0
  178. package/dist/esm/utils/identifier.js +238 -0
  179. package/dist/esm/utils/identifier.js.map +1 -0
  180. package/dist/types/bitcoin/constants.d.ts +19 -0
  181. package/dist/types/bitcoin/constants.d.ts.map +1 -0
  182. package/dist/types/bitcoin/errors.d.ts +5 -0
  183. package/dist/types/bitcoin/errors.d.ts.map +1 -0
  184. package/dist/types/bitcoin/index.d.ts +75 -0
  185. package/dist/types/bitcoin/index.d.ts.map +1 -0
  186. package/dist/types/bitcoin/interface.d.ts +86 -0
  187. package/dist/types/bitcoin/interface.d.ts.map +1 -0
  188. package/dist/types/bitcoin/network.d.ts +2 -0
  189. package/dist/types/bitcoin/network.d.ts.map +1 -0
  190. package/dist/types/bitcoin/rest-client.d.ts +268 -0
  191. package/dist/types/bitcoin/rest-client.d.ts.map +1 -0
  192. package/dist/types/bitcoin/rpc-client.d.ts +506 -0
  193. package/dist/types/bitcoin/rpc-client.d.ts.map +1 -0
  194. package/dist/types/bitcoin/taproot.d.ts +34 -0
  195. package/dist/types/bitcoin/taproot.d.ts.map +1 -0
  196. package/dist/types/btcr2/beacon/aggregation/coordinator.d.ts +74 -0
  197. package/dist/types/btcr2/beacon/aggregation/coordinator.d.ts.map +1 -0
  198. package/dist/types/btcr2/beacon/aggregation/messages/advert.d.ts +22 -0
  199. package/dist/types/btcr2/beacon/aggregation/messages/advert.d.ts.map +1 -0
  200. package/dist/types/btcr2/beacon/aggregation/messages/base.d.ts +36 -0
  201. package/dist/types/btcr2/beacon/aggregation/messages/base.d.ts.map +1 -0
  202. package/dist/types/btcr2/beacon/aggregation/messages/cohort-set.d.ts +23 -0
  203. package/dist/types/btcr2/beacon/aggregation/messages/cohort-set.d.ts.map +1 -0
  204. package/dist/types/btcr2/beacon/aggregation/messages/keygen.d.ts +6 -0
  205. package/dist/types/btcr2/beacon/aggregation/messages/keygen.d.ts.map +1 -0
  206. package/dist/types/btcr2/beacon/aggregation/messages/opt-in.d.ts +22 -0
  207. package/dist/types/btcr2/beacon/aggregation/messages/opt-in.d.ts.map +1 -0
  208. package/dist/types/btcr2/beacon/aggregation/messages/sign.d.ts +5 -0
  209. package/dist/types/btcr2/beacon/aggregation/messages/sign.d.ts.map +1 -0
  210. package/dist/types/btcr2/beacon/aggregation/models/cohort/index.d.ts +77 -0
  211. package/dist/types/btcr2/beacon/aggregation/models/cohort/index.d.ts.map +1 -0
  212. package/dist/types/btcr2/beacon/aggregation/models/cohort/status.d.ts +7 -0
  213. package/dist/types/btcr2/beacon/aggregation/models/cohort/status.d.ts.map +1 -0
  214. package/dist/types/btcr2/beacon/aggregation/participant.d.ts +1 -0
  215. package/dist/types/btcr2/beacon/aggregation/participant.d.ts.map +1 -0
  216. package/dist/types/btcr2/beacon/aggregation/protocol/nostr.d.ts +36 -0
  217. package/dist/types/btcr2/beacon/aggregation/protocol/nostr.d.ts.map +1 -0
  218. package/dist/types/btcr2/beacon/aggregation/protocol/service.d.ts +6 -0
  219. package/dist/types/btcr2/beacon/aggregation/protocol/service.d.ts.map +1 -0
  220. package/dist/types/btcr2/beacon/cid-aggregate.d.ts +103 -0
  221. package/dist/types/btcr2/beacon/cid-aggregate.d.ts.map +1 -0
  222. package/dist/types/btcr2/beacon/factory.d.ts +17 -0
  223. package/dist/types/btcr2/beacon/factory.d.ts.map +1 -0
  224. package/dist/types/btcr2/beacon/singleton.d.ts +93 -0
  225. package/dist/types/btcr2/beacon/singleton.d.ts.map +1 -0
  226. package/dist/types/btcr2/beacon/smt-aggregate.d.ts +112 -0
  227. package/dist/types/btcr2/beacon/smt-aggregate.d.ts.map +1 -0
  228. package/dist/types/btcr2/crud/create.d.ts +92 -0
  229. package/dist/types/btcr2/crud/create.d.ts.map +1 -0
  230. package/dist/types/btcr2/crud/deactivate.d.ts +13 -0
  231. package/dist/types/btcr2/crud/deactivate.d.ts.map +1 -0
  232. package/dist/types/btcr2/crud/read.d.ts +341 -0
  233. package/dist/types/btcr2/crud/read.d.ts.map +1 -0
  234. package/dist/types/btcr2/crud/update.d.ts +83 -0
  235. package/dist/types/btcr2/crud/update.d.ts.map +1 -0
  236. package/dist/types/btcr2/key-manager/index.d.ts +145 -0
  237. package/dist/types/btcr2/key-manager/index.d.ts.map +1 -0
  238. package/dist/types/btcr2/key-manager/interface.d.ts +113 -0
  239. package/dist/types/btcr2/key-manager/interface.d.ts.map +1 -0
  240. package/dist/types/did-btcr2.d.ts +117 -0
  241. package/dist/types/did-btcr2.d.ts.map +1 -0
  242. package/dist/types/index.d.ts +26 -0
  243. package/dist/types/index.d.ts.map +1 -0
  244. package/dist/types/interfaces/beacon.d.ts +57 -0
  245. package/dist/types/interfaces/beacon.d.ts.map +1 -0
  246. package/dist/types/interfaces/crud.d.ts +35 -0
  247. package/dist/types/interfaces/crud.d.ts.map +1 -0
  248. package/dist/types/interfaces/ibeacon.d.ts +66 -0
  249. package/dist/types/interfaces/ibeacon.d.ts.map +1 -0
  250. package/dist/types/types/bitcoin.d.ts +827 -0
  251. package/dist/types/types/bitcoin.d.ts.map +1 -0
  252. package/dist/types/types/crud.d.ts +38 -0
  253. package/dist/types/types/crud.d.ts.map +1 -0
  254. package/dist/types/utils/appendix.d.ts +118 -0
  255. package/dist/types/utils/appendix.d.ts.map +1 -0
  256. package/dist/types/utils/beacons.d.ts +156 -0
  257. package/dist/types/utils/beacons.d.ts.map +1 -0
  258. package/dist/types/utils/did-document-builder.d.ts +13 -0
  259. package/dist/types/utils/did-document-builder.d.ts.map +1 -0
  260. package/dist/types/utils/did-document.d.ts +211 -0
  261. package/dist/types/utils/did-document.d.ts.map +1 -0
  262. package/dist/types/utils/general.d.ts +85 -0
  263. package/dist/types/utils/general.d.ts.map +1 -0
  264. package/dist/types/utils/identifier.d.ts +59 -0
  265. package/dist/types/utils/identifier.d.ts.map +1 -0
  266. package/package.json +137 -0
  267. package/src/bitcoin/constants.ts +19 -0
  268. package/src/bitcoin/errors.ts +10 -0
  269. package/src/bitcoin/index.ts +154 -0
  270. package/src/bitcoin/interface.ts +160 -0
  271. package/src/bitcoin/network.ts +17 -0
  272. package/src/bitcoin/rest-client.ts +415 -0
  273. package/src/bitcoin/rpc-client.ts +888 -0
  274. package/src/bitcoin/taproot.ts +237 -0
  275. package/src/btcr2/beacon/aggregation/coordinator.ts +135 -0
  276. package/src/btcr2/beacon/aggregation/messages/advert.ts +36 -0
  277. package/src/btcr2/beacon/aggregation/messages/base.ts +59 -0
  278. package/src/btcr2/beacon/aggregation/messages/cohort-set.ts +37 -0
  279. package/src/btcr2/beacon/aggregation/messages/keygen.ts +8 -0
  280. package/src/btcr2/beacon/aggregation/messages/opt-in.ts +35 -0
  281. package/src/btcr2/beacon/aggregation/messages/sign.ts +7 -0
  282. package/src/btcr2/beacon/aggregation/models/cohort/index.ts +112 -0
  283. package/src/btcr2/beacon/aggregation/models/cohort/status.ts +7 -0
  284. package/src/btcr2/beacon/aggregation/participant.ts +0 -0
  285. package/src/btcr2/beacon/aggregation/protocol/nostr.ts +81 -0
  286. package/src/btcr2/beacon/aggregation/protocol/service.ts +6 -0
  287. package/src/btcr2/beacon/cid-aggregate.ts +154 -0
  288. package/src/btcr2/beacon/factory.ts +36 -0
  289. package/src/btcr2/beacon/singleton.ts +257 -0
  290. package/src/btcr2/beacon/smt-aggregate.ts +136 -0
  291. package/src/btcr2/crud/create.ts +160 -0
  292. package/src/btcr2/crud/deactivate.ts +13 -0
  293. package/src/btcr2/crud/read.ts +946 -0
  294. package/src/btcr2/crud/update.ts +277 -0
  295. package/src/btcr2/key-manager/index.ts +364 -0
  296. package/src/btcr2/key-manager/interface.ts +129 -0
  297. package/src/canonicalize.d.ts +6 -0
  298. package/src/did-btcr2.ts +288 -0
  299. package/src/index.ts +34 -0
  300. package/src/interfaces/beacon.ts +68 -0
  301. package/src/interfaces/crud.ts +36 -0
  302. package/src/interfaces/ibeacon.ts +76 -0
  303. package/src/types/bitcoin.ts +1028 -0
  304. package/src/types/crud.ts +41 -0
  305. package/src/utils/appendix.ts +257 -0
  306. package/src/utils/beacons.ts +276 -0
  307. package/src/utils/did-document-builder.ts +73 -0
  308. package/src/utils/did-document.ts +474 -0
  309. package/src/utils/general.ts +204 -0
  310. package/src/utils/identifier.ts +276 -0
@@ -0,0 +1,506 @@
1
+ import { default as RpcClient } from 'bitcoin-core';
2
+ import { AddMultiSigAddressParams, BitcoinSignature, BlockHashOptions, BlockHeader, BlockResponse, BumpFeeOptions, BumpFeeResult, ChainInfo, CreateMultisigParams, CreateMultiSigResult, CreateRawTxInputs, CreateRawTxOutputs, CreateWalletDescriptorOptions, CreateWalletDescriptorsResult, CreateWalletParams, CreateWalletResult, DecodedRawTransaction, DerivedAddresses, FeeEstimateMode, FundRawTxOptions, FundRawTxResult, GetBlockParams, GetUTXOsResult, IClientConfig, ImportDescriptorRequest, ImportMultiOptions, ImportMultiRequest, ImportMultiResult, ListTransactionsParams, ListTransactionsResult, ListUnspentParams, MemoryStats, MempoolContent, MempoolInfo, MiningInfo, Outpoint, PeerInfo, RawTransactionResponse, RawTransactionV2, ReturnFormatOptions, RpcClientConfig, ScanBlocksParams, ScriptDecoded, SendAllParams, SendAllResult, SendManyParams, SignedRawTx, UnspentTxInfo, ValidateAddressResult, VerbosityLevel, WalletTransaction } from '../types/bitcoin.js';
3
+ import { IBitcoinRpc } from './interface.js';
4
+ /**
5
+ * Encapsulates a {@link RpcClient | Client} object from {@link https://www.npmjs.com/package/bitcoin-core | `bitcoin-core`}.
6
+ * Implements a strongly-typed {@link IBitcoinRpc | IBitcoinRpc interface} for added expresivity and developer support.
7
+ * @class BitcoinRpc
8
+ * @type {BitcoinRpc}
9
+ */
10
+ export default class BitcoinRpc implements IBitcoinRpc {
11
+ /**
12
+ * The encapsulated {@link RpcClientConfig} object.
13
+ * @private
14
+ * @type {RpcClient} An instance of the Client class from {@link https://www.npmjs.com/package/bitcoin-core | `bitcoin-core`}.
15
+ * See {@link https://github.com/ruimarinho/bitcoin-core/blob/master/src/index.d.ts#L64 | `Client`} for more information.
16
+ */
17
+ private _client;
18
+ /**
19
+ * The encapsulated {@link RpcClientConfig} object.
20
+ * @private
21
+ * @type {RpcClientConfig} ClientConfig from {@link https://www.npmjs.com/package/bitcoin-core | `bitcoin-core`}.
22
+ * See {@link https://github.com/ruimarinho/bitcoin-core/blob/master/src/index.d.ts#L39 | `ClientConfig`} for more information.
23
+ */
24
+ private _config;
25
+ /**
26
+ * Constructs a new {@link BitcoinRpc} instance from a new {@link RpcClient | RpcClient}.
27
+ * @param {RpcClientConfig} config The bitcoin-core client instance.
28
+ * @example
29
+ * ```
30
+ * import BitcoinRpc from '@did-btcr2/method';
31
+ * const bob = BitcoinRpc.connect(); // To use default polar config, pass no args. Polar must run locally.
32
+ * ```
33
+ */
34
+ constructor(config: RpcClientConfig);
35
+ /**
36
+ * Get the config for the current BitcoinRpc object.
37
+ * @returns {RpcClientConfig} The encapsulated {@link RpcClientConfig} object.
38
+ * @example
39
+ * ```
40
+ * import BitcoinRpc from '@did-btcr2/method';
41
+ * const alice = BitcoinRpc.connect();
42
+ * const config = alice.config;
43
+ * ```
44
+ */
45
+ get config(): RpcClientConfig;
46
+ /**
47
+ * Get the client for the current BitcoinRpc object.
48
+ * @returns {RpcClient} The encapsulated {@link RpcClient} object.
49
+ * @example
50
+ * ```
51
+ * const alice = BitcoinRpc.connect();
52
+ * const config = alice.client;
53
+ * ```
54
+ */
55
+ get client(): RpcClient;
56
+ /**
57
+ * Static method initializes a new BitcoinRpc client with the given configuration.
58
+ * The RpcClient returned by this method does not have any named methods.
59
+ * Use this method to create and pass a new RpcClient instance to a BitcoinRpc constructor.
60
+ *
61
+ * @param {IClientConfig} config The configuration object for the client (optional).
62
+ * @returns {RpcClient} A new RpcClient instance.
63
+ * @example
64
+ * ```
65
+ * const options: IClientConfig = {
66
+ * host: 'http://localhost:18443',
67
+ * username: 'alice',
68
+ * password: 'alicepass',
69
+ * version: '28.1.0',
70
+ * }
71
+ * const aliceClient = BitcoinRpc.initialize(options); // Client config required
72
+ * const alice = new BitcoinRpc(aliceClient);
73
+ * ```
74
+ */
75
+ static initialize(config?: IClientConfig): RpcClient;
76
+ /**
77
+ * Static method connects to a bitcoin node running the bitcoin core daemon (bitcoind).
78
+ * To use default polar config, do not pass a config. See {@link DEFAULT_RPC_CLIENT_CONFIG} for default config.
79
+ * @required A locally running {@link https://github.com/jamaljsr/polar | Polar Lightning} regtest node.
80
+ *
81
+ * @param {?RpcClientConfig} config The configuration object for the client (optional).
82
+ * @returns A new {@link BitcoinRpc} instance.
83
+ * @example
84
+ * ```
85
+ * const alice = BitcoinRpc.connect();
86
+ * ```
87
+ */
88
+ static connect(config?: RpcClientConfig): BitcoinRpc;
89
+ /**
90
+ * Check if the given error is a JSON-RPC error.
91
+ * @param {unknown} e The error to check.
92
+ * @returns {boolean} True if the error is a JSON-RPC error, false otherwise.
93
+ */
94
+ isJsonRpcError(e: unknown): e is Error & {
95
+ name: 'RpcError';
96
+ code?: number;
97
+ };
98
+ /**
99
+ * Executes a JSON-RPC command on the bitcoind node.
100
+ * @param {MethodNameInLowerCase} method The name of the method to call.
101
+ * @param {Array<any>} parameters The parameters to pass to the method.
102
+ * @returns {Promise<T>} A promise resolving to the result of the command.
103
+ */
104
+ private executeRpc;
105
+ /**
106
+ * Handle errors that occur while executing commands.
107
+ * @param methods An array of {@link BatchOption} objects.
108
+ * @param error The error that was thrown.
109
+ * @throws Throws a {@link BitcoinRpcError} with the error message.
110
+ */
111
+ private handleError;
112
+ /**
113
+ * TODO: Comments
114
+ */
115
+ getUnspentTransactionOutputs(outpoints: Outpoint[]): Promise<GetUTXOsResult>;
116
+ /**
117
+ * TODO: Comments
118
+ */
119
+ getTransactionByHash(hash: string, options?: ReturnFormatOptions): Promise<string>;
120
+ /**
121
+ * TODO: Comments
122
+ */
123
+ getBlockHeadersByHash(hash: string, count: number, options?: ReturnFormatOptions): Promise<BlockHeader[]>;
124
+ /**
125
+ * TODO: Comments
126
+ */
127
+ getMemoryPoolContent(): Promise<MempoolContent>;
128
+ /**
129
+ * TODO: Comments
130
+ */
131
+ getMemoryPoolInformation(): Promise<MempoolInfo>;
132
+ /**
133
+ * Alias for `getblock <hash> 2`
134
+ */
135
+ getBlockByHash(hash: string, options?: BlockHashOptions): Promise<BlockHeader>;
136
+ /**
137
+ * TODO: Comments
138
+ */
139
+ abandonTransaction(txid: string): Promise<void>;
140
+ /**
141
+ * TODO: Comments
142
+ */
143
+ abortRescan(): Promise<void>;
144
+ /**
145
+ * TODO: Comments
146
+ */
147
+ addMultiSigAddress(params: AddMultiSigAddressParams): Promise<string>;
148
+ /**
149
+ * TODO: Comments
150
+ */
151
+ addWitnessAddress(address: string): Promise<void>;
152
+ /**
153
+ * TODO: Comments
154
+ */
155
+ backupWallet(destination: string): Promise<void>;
156
+ /**
157
+ * TODO: Comments
158
+ */
159
+ bumpFee(txid: string, options?: BumpFeeOptions): Promise<BumpFeeResult>;
160
+ /**
161
+ * TODO: Comments
162
+ */
163
+ createMultiSig(nrequired: number, keys: string[]): Promise<CreateMultiSigResult>;
164
+ /**
165
+ * TODO: Comments
166
+ */
167
+ createWallet(params: CreateWalletParams): Promise<CreateWalletResult>;
168
+ /**
169
+ * TODO: Comments
170
+ */
171
+ decodeScript(hexstring: string): Promise<ScriptDecoded>;
172
+ /**
173
+ * TODO: Comments
174
+ */
175
+ getBestBlockHash(): Promise<string>;
176
+ /**
177
+ * Returns the block data associated with a `blockhash` of a valid block.
178
+ * @param {GetBlockParams} params See {@link GetBlockParams} for details.
179
+ * @param {?string} params.blockhash The blockhash of the block to query.
180
+ * @param {?number} params.height The block height of the block to query.
181
+ * @param {?VerbosityLevel} params.verbosity The verbosity level. See {@link VerbosityLevel}.
182
+ * @returns {BlockResponse} A promise resolving to a {@link BlockResponse} formatted depending on `verbosity` level.
183
+ * @throws {BitcoinRpcError} If neither `blockhash` nor `height` is provided.
184
+ */
185
+ getBlock({ blockhash, height, verbosity }: GetBlockParams): Promise<BlockResponse | undefined>;
186
+ /**
187
+ * Returns the blockheight of the most-work fully-validated chain. The genesis block has height 0.
188
+ * @returns {Blockheight} The number of the blockheight with the most-work of the fully-validated chain.
189
+ */
190
+ getBlockCount(): Promise<number>;
191
+ /**
192
+ * Returns the blockhash of the block at the given height in the active chain.
193
+ */
194
+ getBlockHash(height: number): Promise<string>;
195
+ /**
196
+ * TODO: Comments
197
+ */
198
+ getBlockHeader(hash: string, verbose?: boolean): Promise<string | BlockHeader>;
199
+ /**
200
+ * TODO: Comments
201
+ */
202
+ getBlockchainInfo(): Promise<ChainInfo>;
203
+ /**
204
+ * TODO: Comments
205
+ */
206
+ getInfo(...args: any[]): Promise<void>;
207
+ /**
208
+ * TODO: Comments
209
+ */
210
+ getMemoryInfo(mode?: 'stats' | 'mallocinfo'): Promise<MemoryStats | string>;
211
+ /**
212
+ * TODO: Comments
213
+ */
214
+ scanBlocks(params: ScanBlocksParams): Promise<any>;
215
+ /**
216
+ * TODO: Comments
217
+ */
218
+ fundRawTransaction(hexstring: string, options: FundRawTxOptions): Promise<FundRawTxResult>;
219
+ /**
220
+ * Sign inputs for raw transaction (serialized, hex-encoded).
221
+ * The second optional argument (may be null) is an array of previous transaction outputs that
222
+ * this transaction depends on but may not yet be in the block chain.
223
+ * Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
224
+ * @param {string} hexstring The hex-encoded transaction to send.
225
+ */
226
+ signRawTransaction(hexstring: string): Promise<SignedRawTx>;
227
+ /**
228
+ * Submit a raw transaction (serialized, hex-encoded) to local node and network.
229
+ *
230
+ * The transaction will be sent unconditionally to all peers, so using sendrawtransaction
231
+ * for manual rebroadcast may degrade privacy by leaking the transaction's origin, as
232
+ * nodes will normally not rebroadcast non-wallet transactions already in their mempool.
233
+ *
234
+ * @param {string} hexstring The hex-encoded transaction to send.
235
+ * @param {numbner} [maxfeerate] If not passed, default is 0.10.
236
+ * @returns {Promise<string>} A promise resolving to the transaction hash in hex.
237
+ */
238
+ sendRawTransaction(hexstring: string, maxfeerate?: number | string, maxBurnAmount?: number | string): Promise<string>;
239
+ /**
240
+ * Combines calls to `signRawTransaction` and `sendRawTransaction`.
241
+ * @param {string} params.hexstring The hex-encoded transaction to send.
242
+ * @returns {Promise<string>} A promise resolving to the transaction hash in hex.
243
+ */
244
+ signAndSendRawTransaction(hexstring: string): Promise<string>;
245
+ /**
246
+ * Combines calls to `createRawTransaction`, `signRawTransaction` and `sendRawTransaction`.
247
+ * @param {CreateRawTxInputs[]} inputs The inputs to the transaction (required).
248
+ * @param {CreateRawTxOutputs[]} outputs The outputs of the transaction (required).
249
+ * @returns {Promise<string>} A promise resolving to the transaction hash in hex.
250
+ */
251
+ createSignSendRawTransaction(inputs: CreateRawTxInputs[], outputs: CreateRawTxOutputs[]): Promise<string>;
252
+ /**
253
+ * TODO: Comments
254
+ */
255
+ listTransactions(params: ListTransactionsParams): Promise<ListTransactionsResult>;
256
+ /**
257
+ * TODO: Comments
258
+ */
259
+ decodeRawTransaction(hexstring: string): Promise<DecodedRawTransaction>;
260
+ /**
261
+ * TODO: Comments
262
+ */
263
+ combineRawTransaction(txs: string[]): Promise<string>;
264
+ /**
265
+ * Create a transaction spending the given inputs and creating new outputs.
266
+ * Outputs can be addresses or data.
267
+ * Returns hex-encoded raw transaction.
268
+ * Note that the transaction's inputs are not signed, and
269
+ * it is not stored in the wallet or transmitted to the network.
270
+ * @param {TxInForCreateRaw[]} inputs The inputs to the transaction (required).
271
+ * @param {CreateRawTxOutputs[]} outputs The outputs of the transaction (required).
272
+ * @param {number} [locktime] The locktime of the transaction (optional).
273
+ * @param {boolean} [replacable] Whether the transaction is replaceable (optional).
274
+ * @returns {string} The hex-encoded raw transaction.
275
+ */
276
+ createRawTransaction(inputs: CreateRawTxInputs[], outputs: CreateRawTxOutputs[], locktime?: number, replacable?: boolean): Promise<string>;
277
+ /**
278
+ * Creates a multi-signature address with n signature of m keys required.
279
+ *
280
+ * @param {CreateMultisigParams} params The parameters for the createMultisig command.
281
+ * @param {number} params.nrequired The number of required signatures out of the n keys (required).
282
+ * @param {string[]} params.keys The hex-encoded public keys (required).
283
+ * @param {?string} params.address_type The address type to use (optional, options=["legacy", "p2sh-segwit", "bech32"], default="legacy").
284
+ * @returns {CreateMultiSigResult} json object with the address and redeemScript.
285
+ *
286
+ * @example Create a multisig address from 2 public keys
287
+ * ```
288
+ * const bob = BitcoinRpc.connect();
289
+ * const keys = [
290
+ * '03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd',
291
+ * '03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626'
292
+ * ];
293
+ * const multisig = await bob.createMultisig({ nrequired: 2, keys });
294
+ * ```
295
+ */
296
+ createMultisig({ nrequired, keys, address_type }: CreateMultisigParams): Promise<CreateMultiSigResult>;
297
+ /**
298
+ * TODO: Comments
299
+ */
300
+ getDescriptorInfo(descriptor: string): Promise<any>;
301
+ /**
302
+ * TODO: Comments
303
+ */
304
+ signMessageWithPrivkey(privkey: string, message: string): Promise<BitcoinSignature>;
305
+ /**
306
+ * TODO: Comments
307
+ */
308
+ validateAddress(address: string): Promise<ValidateAddressResult>;
309
+ /**
310
+ * TODO: Comments
311
+ */
312
+ verifyMessage(address: string, signature: string, message: string): Promise<boolean>;
313
+ /**
314
+ * Derives one or more addresses corresponding to an output descriptor.
315
+ * Examples of output descriptors are:
316
+ * pkh(<pubkey>) P2PKH outputs for the given pubkey
317
+ * wpkh(<pubkey>) Native segwit P2PKH outputs for the given pubkey
318
+ * sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys
319
+ * raw(<hex script>) Outputs whose output script equals the specified hex-encoded bytes
320
+ * tr(<pubkey>,multi_a(<n>,<pubkey>,<pubkey>,...)) P2TR-multisig outputs for the given threshold and pubkeys
321
+ *
322
+ * In the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one
323
+ * or more path elements separated by "/", where "h" represents a hardened child key.
324
+ *
325
+ * See {@link https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md | github.com/bitcoin/bitcoin/descriptors.md}
326
+ * for more information.
327
+ * @async
328
+ * @param {string} descriptor The descriptor.
329
+ * @param {Array<number>} range If descriptor is ranged, must specify end or [begin,end] to derive.
330
+ * @returns {Array<DerivedAddresses>} a list of derived addresses
331
+ * @example First three native segwit receive addresses
332
+ * ```
333
+ * const bitcoind = BitcoinRpc.connect()
334
+ * const addresses = bitcoind.deriveAddresses("wpkh([d34db33f/84h/0h/0h]xpub6DJ2dN.../0/*)#cjjspncu", [0,2])
335
+ * ```
336
+ */
337
+ deriveAddresses(descriptor: string, range?: Array<number>): Promise<Array<DerivedAddresses>>;
338
+ /**
339
+ * TODO: Comments
340
+ */
341
+ addMultisigAddress(): Promise<any>;
342
+ /**
343
+ * Creates the wallet's descriptor for the given address type. The address type must be one that the
344
+ * wallet does not already have a descriptor for. Requires wallet passphrase to be set with walletpassphrase call
345
+ * if wallet is encrypted.
346
+ * @param type The address type the descriptor will produce. Options are "legacy", "p2sh-segwit", "bech32", and "bech32m". (string, required)
347
+ * @param options Options object that can be used to pass named arguments, listed below. (json object, optional)
348
+ * @param options.internal Whether to only make one descriptor that is internal (if parameter is true) or external (if parameter is false)
349
+ * (boolean, optional, default=Both external and internal will be generated unless this parameter is specified)
350
+ * @param options.hdkey The HD key that the wallet knows the private key of, listed using 'gethdkeys', to use for this descriptor's key.
351
+ * (string, optional, default=The HD key used by all other active descriptors)
352
+ * @returns A {@link CreateWalletDescriptorsResult} response object
353
+ */
354
+ createWalletDescriptor(type: string, options: CreateWalletDescriptorOptions): Promise<CreateWalletDescriptorsResult>;
355
+ /**
356
+ * TODO: Comments
357
+ */
358
+ getBalance(): Promise<any>;
359
+ /**
360
+ * TODO: Comments
361
+ */
362
+ getNewAddress(account?: string): Promise<string>;
363
+ /**
364
+ * TODO: Comments
365
+ */
366
+ importAddress(script: string, label?: string, rescan?: boolean, p2sh?: boolean): Promise<void>;
367
+ /**
368
+ * Import descriptors.
369
+ *
370
+ * This will trigger a rescan of the blockchain based on the earliest timestamp of all descriptors being imported.
371
+ * Requires a new wallet backup. Note: This call can take over an hour to complete if using an early timestamp;
372
+ * during that time, other rpc calls may report that the imported keys, addresses or scripts exist but related
373
+ * transactions are still missing. The rescan is significantly faster if block filters are available
374
+ * (using startup option "-blockfilterindex=1").
375
+ *
376
+ * @param requests Array of {@link ImportDescriptorRequest} objects to be imported
377
+ * @returns Array of {@link ImportDescriptorResult} objects
378
+ * @returns
379
+ */
380
+ importDescriptors(requests: Array<ImportDescriptorRequest>): Promise<any>;
381
+ /**
382
+ * TODO: Comments
383
+ */
384
+ importMulti(requests: ImportMultiRequest[], options?: ImportMultiOptions): Promise<Array<ImportMultiResult>>;
385
+ /**
386
+ * TODO: Comments
387
+ */
388
+ listUnspent(params: ListUnspentParams): Promise<UnspentTxInfo[]>;
389
+ /**
390
+ * TODO: Comments
391
+ */
392
+ rescanBlockchain(): Promise<any>;
393
+ /**
394
+ * Send an amount to a given address.
395
+ * @async
396
+ * @param {string} address The address to send to.
397
+ * @param {number} amount The amount to send in BTC.
398
+ * @returns {Promise<SendToAddressResult>} A promise resolving to the transaction id.
399
+ */
400
+ sendToAddress(address: string, amount: number): Promise<RawTransactionV2>;
401
+ /**
402
+ * TODO: Comments
403
+ */
404
+ signMessage(): Promise<any>;
405
+ /**
406
+ * TODO: Comments
407
+ */
408
+ signRawTransactionWithWallet(): Promise<any>;
409
+ /**
410
+ * TODO: Comments
411
+ */
412
+ send(): Promise<any>;
413
+ /**
414
+ * @warning EXPERIMENTAL this call may be changed in future releases.
415
+ *
416
+ * Spend the value of all (or specific) confirmed UTXOs & unconfirmed change in the wallet to one or
417
+ * more recipients. Unconfirmed inbound UTXOs and locked UTXOs will not be spent. Sendall will respect the
418
+ * avoid_reuse wallet flag. If your wallet contains many small inputs, either because it received tiny payments or as
419
+ * a result of accumulating change, consider using `send_max` to exclude inputs that are worth less than the fees
420
+ * needed to spend them.
421
+ *
422
+ * @param {SendAllParams} params The parameters for the sendAll command.
423
+ * @param {Recipients} params.recipients The recipient destination addresses.
424
+ * Each address may only appear once. Optionally some recipients can be specified with an
425
+ * amount to perform payments, but at least one address must appear without a specified amount.
426
+ * @param {SendAllOptions} params.options Options object that can be used to pass named arguments.
427
+ * @param {} params.options.conf_target Confirmation target in blocks. numeric, optional, default=wallet -txconfirmtarget.
428
+ * @param estimate_mode The fee estimate mode, must be one of (case insensitive). string, optional, default="unset".
429
+ * See {@link FeeEstimateMode} for possible values.
430
+ * @param fee_rate Specify a fee rate in sat/vB. numeric or string, optional, default=not set,
431
+ * falls back to wallet fee estimation
432
+ * @param options: Options object that can be used to pass named arguments. json object, optional
433
+ *
434
+ * @returns A promise resolving to a {@link SendAllResult} object
435
+ *
436
+ * @example
437
+ * Spend all UTXOs from the wallet with a fee rate of 1 sat/vB using named arguments
438
+ * const bob = BitcoinRpc.connect({
439
+ * username: 'bob',
440
+ * password: 'bobpass',
441
+ * host: 'http://127.0.0.1:18443',
442
+ * allowDefaultWallet: true,
443
+ * version: '28.1.0'
444
+ * });
445
+ * const sendall = await bob.sendAll({
446
+ * recipients: [
447
+ * 'bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl',
448
+ * 'bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3'
449
+ * ],
450
+ * options: { fee_rate: 1.1 }
451
+ * });
452
+ */
453
+ sendAll(params: SendAllParams): Promise<SendAllResult>;
454
+ /**
455
+ * TODO: Comments
456
+ */
457
+ sendMany(params: SendManyParams): Promise<string>;
458
+ /**
459
+ * Get detailed information about in-wallet transaction <txid>.
460
+ * @param txid: The transaction id. (string, required)
461
+ * @param {boolean} include_watchonly Whether to include watch-only addresses in balance calculation and details.
462
+ * @returns {WalletTransaction} A promise resolving to a {@link WalletTransaction} object.
463
+ */
464
+ getTransaction(txid: string, include_watchonly?: boolean): Promise<WalletTransaction>;
465
+ /**
466
+ * Get detailed information about a transaction.
467
+ *
468
+ * By default, this call only returns a transaction if it is in the mempool. If -txindex is enabled
469
+ * and no blockhash argument is passed, it will return the transaction if it is in the mempool or any block.
470
+ * If a blockhash argument is passed, it will return the transaction if the specified block is available and
471
+ * the transaction is in that block.
472
+ * @async
473
+ * @param {string} txid The transaction id (required).
474
+ * @param {?VerbosityLevel} verbosity Response format: 0 (hex), 1 (json) or 2 (jsonext).
475
+ * @param {?string} blockhash The block in which to look for the transaction (optional).
476
+ * @returns {GetRawTransaction} A promise resolving to data about a transaction in the form specified by verbosity.
477
+ */
478
+ getRawTransaction(txid: string, verbosity?: VerbosityLevel, blockhash?: string): Promise<RawTransactionResponse>;
479
+ /**
480
+ * Get detailed information about multiple transactions. An extension of {@link getRawTransaction}.
481
+ *
482
+ * @async
483
+ * @param {Array<string>} txids An array of transaction ids.
484
+ * @param {?VerbosityLevel} verbosity Response format: 0 (hex), 1 (json) or 2 (jsonext).
485
+ * @returns {Promise<Array<RawTransactionResponse>>}
486
+ */
487
+ getRawTransactions(txids: string[], verbosity?: VerbosityLevel): Promise<RawTransactionResponse[]>;
488
+ clearBanned(): Promise<void>;
489
+ disconnectNode(address?: string, nodeid?: number): Promise<void>;
490
+ dumpPrivKey(address: string): Promise<string>;
491
+ dumpWallet(filename: string): Promise<{
492
+ filename: string;
493
+ }>;
494
+ encryptWallet(passphrase: string): Promise<void>;
495
+ estimateSmartFee(conf_target: number, estimate_mode?: FeeEstimateMode): Promise<{
496
+ feerate?: number;
497
+ errors?: string[];
498
+ blocks?: number;
499
+ }>;
500
+ getConnectionCount(): Promise<number>;
501
+ getDifficulty(): Promise<number>;
502
+ getMempoolInfo(): Promise<MempoolInfo>;
503
+ getMiningInfo(): Promise<MiningInfo>;
504
+ getPeerInfo(): Promise<PeerInfo[]>;
505
+ walletLock(passphrase: string, timeout: number): Promise<void>;
506
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../src/bitcoin/rpc-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,wBAAwB,EAExB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,aAAa,EAKb,cAAc,EACd,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,6BAA6B,EAC7B,6BAA6B,EAC7B,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,WAAW,EAEX,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,sBAAsB,EAGtB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,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C;IAIlC,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/D"}
@@ -0,0 +1,34 @@
1
+ import { payments } from 'bitcoinjs-lib';
2
+ /**
3
+ * TapRootMultiSig: builds Taproot outputs and trees for multisig and MuSig branches
4
+ */
5
+ export declare class TapRootMultiSig {
6
+ readonly points: Uint8Array[];
7
+ readonly k: number;
8
+ readonly defaultInternalPubkey: Uint8Array;
9
+ constructor(points: Uint8Array[], k: number);
10
+ /**
11
+ * Single multisig leaf as the only script path
12
+ */
13
+ singleLeaf(locktime?: number, sequence?: number): payments.Payment;
14
+ /**
15
+ * All k-of-n multisig combinations as separate leaf scripts, combined into one tree
16
+ */
17
+ multiLeafTree(locktime?: number, sequence?: number): payments.Payment;
18
+ /**
19
+ * MuSig key-path scripts for each k-of-n combination in the script tree
20
+ */
21
+ musigTree(): payments.Payment;
22
+ /**
23
+ * A two-branch tree: one branch is the singleLeaf script, the other is the muSig tree
24
+ */
25
+ musigAndSingleLeafTree(locktime?: number, sequence?: number): payments.Payment;
26
+ /**
27
+ * Nested tree of singleLeaf, multiLeafTree, and musigTree
28
+ */
29
+ everythingTree(locktime?: number, sequence?: number): payments.Payment;
30
+ /**
31
+ * Degrading multisig: k-of-n initially, then (k-1)-of-n after delay, ... until 1-of-n
32
+ */
33
+ degradingMultisigTree(sequenceBlockInterval?: number, sequenceTimeInterval?: number): payments.Payment;
34
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taproot.d.ts","sourceRoot":"","sources":["../../../src/bitcoin/taproot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,eAAe,CAAC;AAsG1D;;GAEG;AACH,qBAAa,eAAe;IAC1B,SAAgB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrC,SAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAgB,qBAAqB,EAAE,UAAU,CAAC;gBAEtC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,MAAM;IAU3C;;OAEG;IACH,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAQ/C;;OAEG;IACH,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAYlD;;OAEG;IACH,SAAS;IAYT;;OAEG;IACH,sBAAsB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAgB3D;;OAEG;IACH,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAyBnD;;OAEG;IACH,qBAAqB,CACnB,qBAAqB,CAAC,EAAE,MAAM,EAC9B,oBAAoB,CAAC,EAAE,MAAM;CAsBhC"}
@@ -0,0 +1,74 @@
1
+ import { Musig2Cohort } from './models/cohort/index.js';
2
+ import { ProtocolService } from './protocol/service.js';
3
+ /**
4
+ * The BeaconCoordinator class is responsible for managing the coordination of beacon aggregation.
5
+ * @class BeaconCoordinator
6
+ * @type {BeaconCoordinator}
7
+ */
8
+ export declare class BeaconCoordinator {
9
+ /**
10
+ * The name of the BeaconCoordinator service.
11
+ * @type {string}
12
+ */
13
+ name: string;
14
+ /**
15
+ * The DID of the BeaconCoordinator.
16
+ * @type {Array<string>}
17
+ */
18
+ did: string;
19
+ /**
20
+ * The protocol service used for communication.
21
+ * @type {ProtocolService}
22
+ */
23
+ protocol: ProtocolService;
24
+ /**
25
+ * List of subscribers to the BeaconCoordinator service.
26
+ * @type {Array<string>}
27
+ */
28
+ cohorts: Array<Musig2Cohort>;
29
+ /**
30
+ * List of subscribers to the BeaconCoordinator service.
31
+ * @type {Array<string>}
32
+ */
33
+ private subscribers;
34
+ /**
35
+ * Constructs a new BeaconCoordinator instance.
36
+ * @param {ProtocolService} protocol The protocol service used for communication.
37
+ * @param {string} [did] Optional DID to use for the coordinator. If not provided, a new DID will be generated.
38
+ */
39
+ constructor(protocol: ProtocolService, did?: string);
40
+ /**
41
+ * Sets up the BeaconCoordinator by registering message handlers and optionally generating a DID.
42
+ * @returns {void}
43
+ */
44
+ setup(did?: string): void;
45
+ /**
46
+ * Initializes the BeaconCoordinator by setting up the protocol and starting it.
47
+ * @param {string} [did] Optional DID to use for the coordinator. If not provided, the existing DID will be used.
48
+ */
49
+ initialize(did?: string): Promise<void>;
50
+ /**
51
+ * Handles subscription requests from other participants.
52
+ * @param {Base} message The message containing the subscription request.
53
+ * @returns {Promise<void>}
54
+ */
55
+ private _handleSubscribe;
56
+ /**
57
+ * Handles opt-in requests from participants to join a cohort.
58
+ * @param {any} message The message containing the opt-in request.
59
+ * @returns {Promise<void>}
60
+ */
61
+ private _handleOptIn;
62
+ /**
63
+ * Starts the key generation process for a cohort once it has enough participants.
64
+ * @param {Musig2Cohort} cohort The cohort for which to start key generation.
65
+ * @returns {Promise<void>}
66
+ */
67
+ private _startKeyGeneration;
68
+ /**
69
+ * Accepts a subscription request from a participant.
70
+ * @param {string} sender The DID of the participant requesting the subscription.
71
+ * @returns {Promise<void>}
72
+ */
73
+ acceptSubscription(sender: string): Promise<void>;
74
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../../../src/btcr2/beacon/aggregation/coordinator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B;;;OAGG;IACI,IAAI,EAAE,MAAM,CAAuB;IAE1C;;;OAGG;IACI,GAAG,EAAE,MAAM,CAAM;IAExB;;;OAGG;IACI,QAAQ,EAAE,eAAe,CAAC;IAEjC;;;OAGG;IACI,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAM;IAEzC;;;OAGG;IACH,OAAO,CAAC,WAAW,CAAgB;IAEnC;;;;OAIG;gBAES,QAAQ,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,MAAM;IAKnD;;;OAGG;IACI,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAShC;;;OAGG;IACG,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7C;;;;OAIG;YACW,gBAAgB;IAQ9B;;;;OAIG;YACW,YAAY;IAgB1B;;;;OAIG;YACW,mBAAmB;IAIjC;;;;OAIG;IACU,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAS/D"}
@@ -0,0 +1,22 @@
1
+ import { BaseMessage } from './base.js';
2
+ export type Advert = {
3
+ type?: 'BEACON_ADVERT';
4
+ to: string;
5
+ from: string;
6
+ cohortId: string;
7
+ cohortSize: number;
8
+ network: string;
9
+ threadId?: string;
10
+ };
11
+ export declare class AdvertMessage extends BaseMessage {
12
+ cohortId: string;
13
+ cohortSize: number;
14
+ network: string;
15
+ constructor({ type, to, from, threadId, cohortId, cohortSize, network }: Advert);
16
+ /**
17
+ * Initializes an AdvertMessage from a given Advert object.
18
+ * @param {Advert} data - The Advert object to initialize the AdvertMessage.
19
+ * @returns {object} The serialized AdvertMessage.
20
+ */
21
+ static initialize(data: Advert): AdvertMessage;
22
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advert.d.ts","sourceRoot":"","sources":["../../../../../../src/btcr2/beacon/aggregation/messages/advert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,qBAAa,aAAc,SAAQ,WAAW;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAY;gBAEtB,EAAE,IAAsB,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,MAAM;IAOjG;;;;OAIG;WACW,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa;CAMtD"}