@atomicfinance/bitcoin-dlc-provider 3.6.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/.nvmrc +1 -1
  2. package/.turbo/turbo-build.log +1 -0
  3. package/.turbo/turbo-test.log +0 -0
  4. package/.yalc/@node-dlc/messaging/.nyc_output/2cf48009-1094-4275-bb91-c164c932feb6.json +1 -0
  5. package/.yalc/@node-dlc/messaging/.nyc_output/processinfo/2cf48009-1094-4275-bb91-c164c932feb6.json +1 -0
  6. package/.yalc/@node-dlc/messaging/.nyc_output/processinfo/index.json +1 -0
  7. package/.yalc/@node-dlc/messaging/README.md +24 -0
  8. package/.yalc/@node-dlc/messaging/__tests__/_test-utils.ts +12 -0
  9. package/.yalc/@node-dlc/messaging/__tests__/chain/ChainManager.spec.ts +178 -0
  10. package/.yalc/@node-dlc/messaging/__tests__/compatibility/dlcspecs-compatibility.spec.ts +473 -0
  11. package/.yalc/@node-dlc/messaging/__tests__/compatibility/rust-dlc-cross-language.spec.ts +342 -0
  12. package/.yalc/@node-dlc/messaging/__tests__/compatibility/true-serialization-compatibility.spec.ts +611 -0
  13. package/.yalc/@node-dlc/messaging/__tests__/dlc_message_test.json +155 -0
  14. package/.yalc/@node-dlc/messaging/__tests__/irc/IrcMessage.spec.ts +94 -0
  15. package/.yalc/@node-dlc/messaging/__tests__/messages/AddressCache.spec.ts +79 -0
  16. package/.yalc/@node-dlc/messaging/__tests__/messages/BatchFundingGroup.spec.ts +72 -0
  17. package/.yalc/@node-dlc/messaging/__tests__/messages/CetAdaptorSignatures.spec.ts +57 -0
  18. package/.yalc/@node-dlc/messaging/__tests__/messages/ContractDescriptor.spec.ts +264 -0
  19. package/.yalc/@node-dlc/messaging/__tests__/messages/ContractInfo.spec.ts +419 -0
  20. package/.yalc/@node-dlc/messaging/__tests__/messages/DigitDecompositionEventDescriptor.spec.ts +59 -0
  21. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcAccept.spec.ts +242 -0
  22. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcCancel.spec.ts +42 -0
  23. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcClose.spec.ts +315 -0
  24. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcOffer.spec.ts +527 -0
  25. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcSign.spec.ts +118 -0
  26. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcTransactions.spec.ts +157 -0
  27. package/.yalc/@node-dlc/messaging/__tests__/messages/EnumEventDescriptor.spec.ts +50 -0
  28. package/.yalc/@node-dlc/messaging/__tests__/messages/EventDescriptor.spec.ts +93 -0
  29. package/.yalc/@node-dlc/messaging/__tests__/messages/FundingInput.spec.ts +84 -0
  30. package/.yalc/@node-dlc/messaging/__tests__/messages/FundingSignatures.spec.ts +83 -0
  31. package/.yalc/@node-dlc/messaging/__tests__/messages/NegotiationFields.spec.ts +328 -0
  32. package/.yalc/@node-dlc/messaging/__tests__/messages/NodeAnnouncementMessage.spec.ts +115 -0
  33. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleAnnouncement.spec.ts +415 -0
  34. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleAttestation.spec.ts +326 -0
  35. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleEvent.spec.ts +143 -0
  36. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleEventContainer.spec.ts +95 -0
  37. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleIdentifier.spec.ts +48 -0
  38. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleInfo.spec.ts +116 -0
  39. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderAccept.spec.ts +77 -0
  40. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderNegotiationFields.spec.ts +216 -0
  41. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderOffer.spec.ts +121 -0
  42. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderPositionInfo.spec.ts +75 -0
  43. package/.yalc/@node-dlc/messaging/__tests__/messages/PayoutCurvePiece.spec.ts +220 -0
  44. package/.yalc/@node-dlc/messaging/__tests__/messages/PayoutFunction.spec.ts +101 -0
  45. package/.yalc/@node-dlc/messaging/__tests__/messages/RoundingIntervals.spec.ts +75 -0
  46. package/.yalc/@node-dlc/messaging/__tests__/serialize/F64.spec.ts +260 -0
  47. package/.yalc/@node-dlc/messaging/__tests__/tsconfig.json +8 -0
  48. package/.yalc/@node-dlc/messaging/coverage/lcov-report/base.css +224 -0
  49. package/.yalc/@node-dlc/messaging/coverage/lcov-report/block-navigation.js +79 -0
  50. package/.yalc/@node-dlc/messaging/coverage/lcov-report/favicon.png +0 -0
  51. package/.yalc/@node-dlc/messaging/coverage/lcov-report/index.html +201 -0
  52. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/MessageType.ts.html +494 -0
  53. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/ChainManager.ts.html +1058 -0
  54. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/ChainMemoryStore.ts.html +182 -0
  55. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/index.html +126 -0
  56. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/domain/Address.ts.html +272 -0
  57. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/domain/index.html +111 -0
  58. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/index.html +141 -0
  59. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/index.ts.html +212 -0
  60. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/irc/IrcMessage.ts.html +563 -0
  61. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/irc/index.html +111 -0
  62. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/AddressCache.ts.html +302 -0
  63. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/BatchFundingGroup.ts.html +503 -0
  64. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/CetAdaptorSignatures.ts.html +347 -0
  65. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/CetAdaptorSignaturesV0.ts.html +347 -0
  66. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ContractDescriptor.ts.html +1040 -0
  67. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ContractInfo.ts.html +1382 -0
  68. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcAccept.ts.html +1865 -0
  69. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcCancel.ts.html +251 -0
  70. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcClose.ts.html +986 -0
  71. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcCloseMetadata.ts.html +443 -0
  72. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcIds.ts.html +281 -0
  73. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcInfo.ts.html +323 -0
  74. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcMessage.ts.html +341 -0
  75. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcOffer.ts.html +1895 -0
  76. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcSign.ts.html +1142 -0
  77. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcTransactions.ts.html +719 -0
  78. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/EventDescriptor.ts.html +947 -0
  79. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingInput.ts.html +728 -0
  80. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingSignatures.ts.html +374 -0
  81. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingSignaturesV0.ts.html +374 -0
  82. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/NegotiationFields.ts.html +836 -0
  83. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/NodeAnnouncementMessage.ts.html +515 -0
  84. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAnnouncement.ts.html +608 -0
  85. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAnnouncementV0.ts.html +605 -0
  86. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAttestation.ts.html +956 -0
  87. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAttestationV0.ts.html +770 -0
  88. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEvent.ts.html +830 -0
  89. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventContainer.ts.html +347 -0
  90. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventContainerV0.ts.html +347 -0
  91. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventV0.ts.html +827 -0
  92. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleIdentifier.ts.html +314 -0
  93. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleIdentifierV0.ts.html +314 -0
  94. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleInfo.ts.html +1637 -0
  95. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleInfoV0.ts.html +1631 -0
  96. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderAccept.ts.html +557 -0
  97. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderIrcInfo.ts.html +380 -0
  98. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderMetadata.ts.html +437 -0
  99. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderNegotiationFields.ts.html +551 -0
  100. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderOffer.ts.html +1337 -0
  101. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderPositionInfo.ts.html +590 -0
  102. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/PayoutCurvePiece.ts.html +1427 -0
  103. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/PayoutFunction.ts.html +800 -0
  104. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/RoundingIntervals.ts.html +461 -0
  105. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/RoundingIntervalsV0.ts.html +482 -0
  106. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ScriptWitnessV0.ts.html +269 -0
  107. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/index.html +636 -0
  108. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serde/SerdeUtils.ts.html +1394 -0
  109. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serde/index.html +111 -0
  110. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/F64.ts.html +1136 -0
  111. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/deserializeTlv.ts.html +125 -0
  112. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/getTlv.ts.html +143 -0
  113. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/index.html +141 -0
  114. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/util.ts.html +179 -0
  115. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/validation/index.html +111 -0
  116. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/validation/validate.ts.html +182 -0
  117. package/.yalc/@node-dlc/messaging/coverage/lcov-report/prettify.css +1 -0
  118. package/.yalc/@node-dlc/messaging/coverage/lcov-report/prettify.js +2 -0
  119. package/.yalc/@node-dlc/messaging/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  120. package/.yalc/@node-dlc/messaging/coverage/lcov-report/sorter.js +170 -0
  121. package/.yalc/@node-dlc/messaging/coverage/lcov.info +5394 -0
  122. package/.yalc/@node-dlc/messaging/dist/MessageType.d.ts +100 -0
  123. package/.yalc/@node-dlc/messaging/dist/MessageType.js +117 -0
  124. package/.yalc/@node-dlc/messaging/dist/MessageType.js.map +1 -0
  125. package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.d.ts +50 -0
  126. package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.js +211 -0
  127. package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.js.map +1 -0
  128. package/.yalc/@node-dlc/messaging/dist/chain/ChainMemoryStore.d.ts +14 -0
  129. package/.yalc/@node-dlc/messaging/dist/chain/ChainMemoryStore.js +28 -0
  130. package/.yalc/@node-dlc/messaging/dist/chain/ChainMemoryStore.js.map +1 -0
  131. package/.yalc/@node-dlc/messaging/dist/chain/DlcStore.d.ts +11 -0
  132. package/.yalc/@node-dlc/messaging/dist/chain/DlcStore.js +3 -0
  133. package/.yalc/@node-dlc/messaging/dist/chain/DlcStore.js.map +1 -0
  134. package/.yalc/@node-dlc/messaging/dist/chain/IChainFilterChainClient.d.ts +48 -0
  135. package/.yalc/@node-dlc/messaging/dist/chain/IChainFilterChainClient.js +3 -0
  136. package/.yalc/@node-dlc/messaging/dist/chain/IChainFilterChainClient.js.map +1 -0
  137. package/.yalc/@node-dlc/messaging/dist/domain/Address.d.ts +24 -0
  138. package/.yalc/@node-dlc/messaging/dist/domain/Address.js +46 -0
  139. package/.yalc/@node-dlc/messaging/dist/domain/Address.js.map +1 -0
  140. package/.yalc/@node-dlc/messaging/dist/index.d.ts +44 -0
  141. package/.yalc/@node-dlc/messaging/dist/index.js +63 -0
  142. package/.yalc/@node-dlc/messaging/dist/index.js.map +1 -0
  143. package/.yalc/@node-dlc/messaging/dist/irc/IrcMessage.d.ts +43 -0
  144. package/.yalc/@node-dlc/messaging/dist/irc/IrcMessage.js +116 -0
  145. package/.yalc/@node-dlc/messaging/dist/irc/IrcMessage.js.map +1 -0
  146. package/.yalc/@node-dlc/messaging/dist/messages/AddressCache.d.ts +15 -0
  147. package/.yalc/@node-dlc/messaging/dist/messages/AddressCache.js +51 -0
  148. package/.yalc/@node-dlc/messaging/dist/messages/AddressCache.js.map +1 -0
  149. package/.yalc/@node-dlc/messaging/dist/messages/BatchFundingGroup.d.ts +61 -0
  150. package/.yalc/@node-dlc/messaging/dist/messages/BatchFundingGroup.js +113 -0
  151. package/.yalc/@node-dlc/messaging/dist/messages/BatchFundingGroup.js.map +1 -0
  152. package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignatures.d.ts +40 -0
  153. package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignatures.js +67 -0
  154. package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignatures.js.map +1 -0
  155. package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.d.ts +122 -0
  156. package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.js +222 -0
  157. package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.js.map +1 -0
  158. package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.d.ts +135 -0
  159. package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.js +304 -0
  160. package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.js.map +1 -0
  161. package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.d.ts +145 -0
  162. package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.js +428 -0
  163. package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.js.map +1 -0
  164. package/.yalc/@node-dlc/messaging/dist/messages/DlcCancel.d.ts +31 -0
  165. package/.yalc/@node-dlc/messaging/dist/messages/DlcCancel.js +51 -0
  166. package/.yalc/@node-dlc/messaging/dist/messages/DlcCancel.js.map +1 -0
  167. package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.d.ts +68 -0
  168. package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.js +210 -0
  169. package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.js.map +1 -0
  170. package/.yalc/@node-dlc/messaging/dist/messages/DlcCloseMetadata.d.ts +44 -0
  171. package/.yalc/@node-dlc/messaging/dist/messages/DlcCloseMetadata.js +74 -0
  172. package/.yalc/@node-dlc/messaging/dist/messages/DlcCloseMetadata.js.map +1 -0
  173. package/.yalc/@node-dlc/messaging/dist/messages/DlcIds.d.ts +26 -0
  174. package/.yalc/@node-dlc/messaging/dist/messages/DlcIds.js +58 -0
  175. package/.yalc/@node-dlc/messaging/dist/messages/DlcIds.js.map +1 -0
  176. package/.yalc/@node-dlc/messaging/dist/messages/DlcInfo.d.ts +31 -0
  177. package/.yalc/@node-dlc/messaging/dist/messages/DlcInfo.js +61 -0
  178. package/.yalc/@node-dlc/messaging/dist/messages/DlcInfo.js.map +1 -0
  179. package/.yalc/@node-dlc/messaging/dist/messages/DlcMessage.d.ts +23 -0
  180. package/.yalc/@node-dlc/messaging/dist/messages/DlcMessage.js +54 -0
  181. package/.yalc/@node-dlc/messaging/dist/messages/DlcMessage.js.map +1 -0
  182. package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.d.ts +131 -0
  183. package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.js +418 -0
  184. package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.js.map +1 -0
  185. package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.d.ts +96 -0
  186. package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.js +267 -0
  187. package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.js.map +1 -0
  188. package/.yalc/@node-dlc/messaging/dist/messages/DlcTransactions.d.ts +69 -0
  189. package/.yalc/@node-dlc/messaging/dist/messages/DlcTransactions.js +149 -0
  190. package/.yalc/@node-dlc/messaging/dist/messages/DlcTransactions.js.map +1 -0
  191. package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.d.ts +106 -0
  192. package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.js +209 -0
  193. package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.js.map +1 -0
  194. package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.d.ts +62 -0
  195. package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.js +163 -0
  196. package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.js.map +1 -0
  197. package/.yalc/@node-dlc/messaging/dist/messages/FundingSignatures.d.ts +36 -0
  198. package/.yalc/@node-dlc/messaging/dist/messages/FundingSignatures.js +78 -0
  199. package/.yalc/@node-dlc/messaging/dist/messages/FundingSignatures.js.map +1 -0
  200. package/.yalc/@node-dlc/messaging/dist/messages/IWireMessage.d.ts +6 -0
  201. package/.yalc/@node-dlc/messaging/dist/messages/IWireMessage.js +3 -0
  202. package/.yalc/@node-dlc/messaging/dist/messages/IWireMessage.js.map +1 -0
  203. package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.d.ts +86 -0
  204. package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.js +185 -0
  205. package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.js.map +1 -0
  206. package/.yalc/@node-dlc/messaging/dist/messages/NodeAnnouncementMessage.d.ts +57 -0
  207. package/.yalc/@node-dlc/messaging/dist/messages/NodeAnnouncementMessage.js +127 -0
  208. package/.yalc/@node-dlc/messaging/dist/messages/NodeAnnouncementMessage.js.map +1 -0
  209. package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncement.d.ts +76 -0
  210. package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncement.js +131 -0
  211. package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncement.js.map +1 -0
  212. package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestation.d.ts +68 -0
  213. package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestation.js +239 -0
  214. package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestation.js.map +1 -0
  215. package/.yalc/@node-dlc/messaging/dist/messages/OracleEvent.d.ts +90 -0
  216. package/.yalc/@node-dlc/messaging/dist/messages/OracleEvent.js +189 -0
  217. package/.yalc/@node-dlc/messaging/dist/messages/OracleEvent.js.map +1 -0
  218. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainer.d.ts +32 -0
  219. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainer.js +67 -0
  220. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainer.js.map +1 -0
  221. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifier.d.ts +32 -0
  222. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifier.js +58 -0
  223. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifier.js.map +1 -0
  224. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifierV0.d.ts +32 -0
  225. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifierV0.js +58 -0
  226. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifierV0.js.map +1 -0
  227. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.d.ts +161 -0
  228. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.js +390 -0
  229. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.js.map +1 -0
  230. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.d.ts +161 -0
  231. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.js +387 -0
  232. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.js.map +1 -0
  233. package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.d.ts +65 -0
  234. package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.js +125 -0
  235. package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.js.map +1 -0
  236. package/.yalc/@node-dlc/messaging/dist/messages/OrderIrcInfo.d.ts +42 -0
  237. package/.yalc/@node-dlc/messaging/dist/messages/OrderIrcInfo.js +74 -0
  238. package/.yalc/@node-dlc/messaging/dist/messages/OrderIrcInfo.js.map +1 -0
  239. package/.yalc/@node-dlc/messaging/dist/messages/OrderMetadata.d.ts +56 -0
  240. package/.yalc/@node-dlc/messaging/dist/messages/OrderMetadata.js +87 -0
  241. package/.yalc/@node-dlc/messaging/dist/messages/OrderMetadata.js.map +1 -0
  242. package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.d.ts +69 -0
  243. package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.js +114 -0
  244. package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.js.map +1 -0
  245. package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.d.ts +97 -0
  246. package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.js +296 -0
  247. package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.js.map +1 -0
  248. package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.d.ts +50 -0
  249. package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.js +125 -0
  250. package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.js.map +1 -0
  251. package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.d.ts +129 -0
  252. package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.js +327 -0
  253. package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.js.map +1 -0
  254. package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.d.ts +66 -0
  255. package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.js +170 -0
  256. package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.js.map +1 -0
  257. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.d.ts +52 -0
  258. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.js +95 -0
  259. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.js.map +1 -0
  260. package/.yalc/@node-dlc/messaging/dist/messages/ScriptWitnessV0.d.ts +29 -0
  261. package/.yalc/@node-dlc/messaging/dist/messages/ScriptWitnessV0.js +50 -0
  262. package/.yalc/@node-dlc/messaging/dist/messages/ScriptWitnessV0.js.map +1 -0
  263. package/.yalc/@node-dlc/messaging/dist/messages/Tlv.d.ts +15 -0
  264. package/.yalc/@node-dlc/messaging/dist/messages/Tlv.js +32 -0
  265. package/.yalc/@node-dlc/messaging/dist/messages/Tlv.js.map +1 -0
  266. package/.yalc/@node-dlc/messaging/dist/serialize/F64.d.ts +154 -0
  267. package/.yalc/@node-dlc/messaging/dist/serialize/F64.js +307 -0
  268. package/.yalc/@node-dlc/messaging/dist/serialize/F64.js.map +1 -0
  269. package/.yalc/@node-dlc/messaging/dist/serialize/deserializeTlv.d.ts +9 -0
  270. package/.yalc/@node-dlc/messaging/dist/serialize/deserializeTlv.js +11 -0
  271. package/.yalc/@node-dlc/messaging/dist/serialize/deserializeTlv.js.map +1 -0
  272. package/.yalc/@node-dlc/messaging/dist/serialize/getTlv.d.ts +4 -0
  273. package/.yalc/@node-dlc/messaging/dist/serialize/getTlv.js +23 -0
  274. package/.yalc/@node-dlc/messaging/dist/serialize/getTlv.js.map +1 -0
  275. package/.yalc/@node-dlc/messaging/dist/serialize/readTlvs.d.ts +8 -0
  276. package/.yalc/@node-dlc/messaging/dist/serialize/readTlvs.js +33 -0
  277. package/.yalc/@node-dlc/messaging/dist/serialize/readTlvs.js.map +1 -0
  278. package/.yalc/@node-dlc/messaging/dist/util.d.ts +13 -0
  279. package/.yalc/@node-dlc/messaging/dist/util.js +40 -0
  280. package/.yalc/@node-dlc/messaging/dist/util.js.map +1 -0
  281. package/.yalc/@node-dlc/messaging/dist/validation/validate.d.ts +4 -0
  282. package/.yalc/@node-dlc/messaging/dist/validation/validate.js +31 -0
  283. package/.yalc/@node-dlc/messaging/dist/validation/validate.js.map +1 -0
  284. package/.yalc/@node-dlc/messaging/lib/MessageType.ts +138 -0
  285. package/.yalc/@node-dlc/messaging/lib/chain/ChainManager.ts +326 -0
  286. package/.yalc/@node-dlc/messaging/lib/chain/ChainMemoryStore.ts +34 -0
  287. package/.yalc/@node-dlc/messaging/lib/chain/DlcStore.ts +11 -0
  288. package/.yalc/@node-dlc/messaging/lib/chain/IChainFilterChainClient.ts +57 -0
  289. package/.yalc/@node-dlc/messaging/lib/domain/Address.ts +64 -0
  290. package/.yalc/@node-dlc/messaging/lib/index.ts +44 -0
  291. package/.yalc/@node-dlc/messaging/lib/irc/IrcMessage.ts +161 -0
  292. package/.yalc/@node-dlc/messaging/lib/messages/AddressCache.ts +74 -0
  293. package/.yalc/@node-dlc/messaging/lib/messages/BatchFundingGroup.ts +141 -0
  294. package/.yalc/@node-dlc/messaging/lib/messages/CetAdaptorSignatures.ts +89 -0
  295. package/.yalc/@node-dlc/messaging/lib/messages/ContractDescriptor.ts +318 -0
  296. package/.yalc/@node-dlc/messaging/lib/messages/ContractInfo.ts +434 -0
  297. package/.yalc/@node-dlc/messaging/lib/messages/DlcAccept.ts +595 -0
  298. package/.yalc/@node-dlc/messaging/lib/messages/DlcCancel.ts +57 -0
  299. package/.yalc/@node-dlc/messaging/lib/messages/DlcClose.ts +302 -0
  300. package/.yalc/@node-dlc/messaging/lib/messages/DlcCloseMetadata.ts +121 -0
  301. package/.yalc/@node-dlc/messaging/lib/messages/DlcIds.ts +67 -0
  302. package/.yalc/@node-dlc/messaging/lib/messages/DlcInfo.ts +81 -0
  303. package/.yalc/@node-dlc/messaging/lib/messages/DlcMessage.ts +87 -0
  304. package/.yalc/@node-dlc/messaging/lib/messages/DlcOffer.ts +605 -0
  305. package/.yalc/@node-dlc/messaging/lib/messages/DlcSign.ts +354 -0
  306. package/.yalc/@node-dlc/messaging/lib/messages/DlcTransactions.ts +213 -0
  307. package/.yalc/@node-dlc/messaging/lib/messages/EventDescriptor.ts +289 -0
  308. package/.yalc/@node-dlc/messaging/lib/messages/FundingInput.ts +216 -0
  309. package/.yalc/@node-dlc/messaging/lib/messages/FundingSignatures.ts +98 -0
  310. package/.yalc/@node-dlc/messaging/lib/messages/IWireMessage.ts +6 -0
  311. package/.yalc/@node-dlc/messaging/lib/messages/NegotiationFields.ts +252 -0
  312. package/.yalc/@node-dlc/messaging/lib/messages/NodeAnnouncementMessage.ts +145 -0
  313. package/.yalc/@node-dlc/messaging/lib/messages/OracleAnnouncement.ts +176 -0
  314. package/.yalc/@node-dlc/messaging/lib/messages/OracleAttestation.ts +292 -0
  315. package/.yalc/@node-dlc/messaging/lib/messages/OracleEvent.ts +250 -0
  316. package/.yalc/@node-dlc/messaging/lib/messages/OracleEventContainer.ts +89 -0
  317. package/.yalc/@node-dlc/messaging/lib/messages/OracleIdentifier.ts +78 -0
  318. package/.yalc/@node-dlc/messaging/lib/messages/OracleInfo.ts +519 -0
  319. package/.yalc/@node-dlc/messaging/lib/messages/OrderAccept.ts +159 -0
  320. package/.yalc/@node-dlc/messaging/lib/messages/OrderIrcInfo.ts +100 -0
  321. package/.yalc/@node-dlc/messaging/lib/messages/OrderMetadata.ts +119 -0
  322. package/.yalc/@node-dlc/messaging/lib/messages/OrderNegotiationFields.ts +157 -0
  323. package/.yalc/@node-dlc/messaging/lib/messages/OrderOffer.ts +419 -0
  324. package/.yalc/@node-dlc/messaging/lib/messages/OrderPositionInfo.ts +170 -0
  325. package/.yalc/@node-dlc/messaging/lib/messages/PayoutCurvePiece.ts +449 -0
  326. package/.yalc/@node-dlc/messaging/lib/messages/PayoutFunction.ts +240 -0
  327. package/.yalc/@node-dlc/messaging/lib/messages/RoundingIntervals.ts +127 -0
  328. package/.yalc/@node-dlc/messaging/lib/messages/ScriptWitnessV0.ts +63 -0
  329. package/.yalc/@node-dlc/messaging/lib/messages/Tlv.ts +40 -0
  330. package/.yalc/@node-dlc/messaging/lib/serialize/F64.ts +352 -0
  331. package/.yalc/@node-dlc/messaging/lib/serialize/deserializeTlv.ts +15 -0
  332. package/.yalc/@node-dlc/messaging/lib/serialize/getTlv.ts +21 -0
  333. package/.yalc/@node-dlc/messaging/lib/serialize/readTlvs.ts +37 -0
  334. package/.yalc/@node-dlc/messaging/lib/util.ts +33 -0
  335. package/.yalc/@node-dlc/messaging/lib/validation/validate.ts +34 -0
  336. package/.yalc/@node-dlc/messaging/package.json +42 -0
  337. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_3_of_3_test.json +210 -0
  338. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_3_of_5_test.json +468 -0
  339. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_3_of_5_test.json +1517 -0
  340. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_5_of_5_test.json +545 -0
  341. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_with_diff_3_of_5_test.json +4761 -0
  342. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_with_diff_5_of_5_test.json +2169 -0
  343. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_single_oracle_test.json +164 -0
  344. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/single_oracle_numerical_hyperbola_test.json +502 -0
  345. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/single_oracle_numerical_test.json +262 -0
  346. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_five_oracle_numerical_with_diff_test.json +4382 -0
  347. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_three_oracle_numerical_test.json +324 -0
  348. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_three_oracle_numerical_with_diff_test.json +652 -0
  349. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/two_of_five_oracle_numerical_test.json +1138 -0
  350. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/two_of_five_oracle_numerical_with_diff_test.json +2222 -0
  351. package/.yalc/@node-dlc/messaging/test_vectors/oracle/external_oracle_announcements.json +0 -0
  352. package/.yalc/@node-dlc/messaging/test_vectors/oracle/oracle_message_test_vectors.json +115 -0
  353. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/accept_msg.json +1465 -0
  354. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_fee_test.json +12362 -0
  355. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_fee_test_scripts.json +57 -0
  356. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_test.json +2766 -0
  357. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_tx_test.json +2899 -0
  358. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/offer_msg.json +163 -0
  359. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/offer_msg_disjoint.json +352 -0
  360. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/segment_chunk_msg.json +12635 -0
  361. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/segment_start_msg.json +4022 -0
  362. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/sign_msg.json +383 -0
  363. package/.yalc/@node-dlc/messaging/tsconfig.json +7 -0
  364. package/.yalc/@node-dlc/messaging/yalc.sig +1 -0
  365. package/CHANGELOG.md +83 -0
  366. package/dist/BitcoinDlcProvider.d.ts +17 -16
  367. package/dist/BitcoinDlcProvider.js +375 -317
  368. package/dist/BitcoinDlcProvider.js.map +1 -1
  369. package/dist/utils/Utils.d.ts +6 -6
  370. package/dist/utils/Utils.js +4 -4
  371. package/dist/utils/Utils.js.map +1 -1
  372. package/lib/BitcoinDlcProvider.ts +637 -621
  373. package/lib/utils/Utils.ts +19 -24
  374. package/package.json +13 -11
  375. package/yalc.lock +10 -0
@@ -0,0 +1,131 @@
1
+ /// <reference types="node" />
2
+ import { BitcoinNetwork } from 'bitcoin-networks';
3
+ import { MessageType } from '../MessageType';
4
+ import { BatchFundingGroup, IBatchFundingGroupJSON } from './BatchFundingGroup';
5
+ import { ContractInfo, IDisjointContractInfoJSON, ISingleContractInfoJSON } from './ContractInfo';
6
+ import { IDlcMessage } from './DlcMessage';
7
+ import { FundingInput, IFundingInputJSON } from './FundingInput';
8
+ import { IOrderIrcInfoJSON, OrderIrcInfo } from './OrderIrcInfo';
9
+ import { IOrderMetadataJSON, OrderMetadata } from './OrderMetadata';
10
+ import { IOrderPositionInfoJSON, OrderPositionInfo } from './OrderPositionInfo';
11
+ export declare const LOCKTIME_THRESHOLD = 500000000;
12
+ /**
13
+ * DlcOffer message contains information about a node and indicates its
14
+ * desire to enter into a new contract. This is the first step toward
15
+ * creating the funding transaction and CETs.
16
+ * Updated to support dlcspecs PR #163 format.
17
+ */
18
+ export declare class DlcOffer implements IDlcMessage {
19
+ static type: MessageType;
20
+ /**
21
+ * Creates a DlcOffer from JSON data (e.g., from test vectors)
22
+ * Handles both our internal format and external test vector formats
23
+ * @param json JSON object representing a DLC offer
24
+ */
25
+ static fromJSON(json: any): DlcOffer;
26
+ /**
27
+ * Deserializes an offer_dlc message with backward compatibility
28
+ * Detects old format (without protocol_version) vs new format (with protocol_version)
29
+ * @param buf
30
+ */
31
+ static deserialize(buf: Buffer): DlcOffer;
32
+ /**
33
+ * The type for offer_dlc message. offer_dlc = 42778
34
+ */
35
+ type: MessageType;
36
+ protocolVersion: number;
37
+ temporaryContractId: Buffer;
38
+ contractFlags: Buffer;
39
+ chainHash: Buffer;
40
+ contractInfo: ContractInfo;
41
+ fundingPubkey: Buffer;
42
+ payoutSpk: Buffer;
43
+ payoutSerialId: bigint;
44
+ offerCollateral: bigint;
45
+ fundingInputs: FundingInput[];
46
+ changeSpk: Buffer;
47
+ changeSerialId: bigint;
48
+ fundOutputSerialId: bigint;
49
+ feeRatePerVb: bigint;
50
+ cetLocktime: number;
51
+ refundLocktime: number;
52
+ metadata?: OrderMetadata;
53
+ ircInfo?: OrderIrcInfo;
54
+ positionInfo?: OrderPositionInfo;
55
+ batchFundingGroups?: BatchFundingGroup[];
56
+ unknownTlvs?: Array<{
57
+ type: number;
58
+ data: Buffer;
59
+ }>;
60
+ /**
61
+ * Get funding, change and payout address from DlcOffer
62
+ * @param network Bitcoin Network
63
+ * @returns {IDlcOfferAddresses}
64
+ */
65
+ getAddresses(network: BitcoinNetwork): IDlcOfferAddresses;
66
+ /**
67
+ * Validates correctness of all fields in DlcOffer
68
+ * Updated validation rules as per dlcspecs PR #163
69
+ * @throws Will throw an error if validation fails
70
+ */
71
+ validate(): void;
72
+ /**
73
+ * Converts dlc_offer to JSON (canonical rust-dlc format)
74
+ */
75
+ toJSON(): IDlcOfferJSON;
76
+ /**
77
+ * Serializes the offer_dlc message into a Buffer
78
+ * Updated serialization format as per dlcspecs PR #163
79
+ */
80
+ serialize(): Buffer;
81
+ }
82
+ export interface IDlcOfferJSON {
83
+ type?: number;
84
+ protocolVersion: number;
85
+ temporaryContractId: string;
86
+ contractFlags: number;
87
+ chainHash: string;
88
+ contractInfo: ISingleContractInfoJSON | IDisjointContractInfoJSON;
89
+ fundingPubkey: string;
90
+ payoutSpk: string;
91
+ payoutSerialId: number;
92
+ offerCollateral: number;
93
+ fundingInputs: IFundingInputJSON[];
94
+ changeSpk: string;
95
+ changeSerialId: number;
96
+ fundOutputSerialId: number;
97
+ feeRatePerVb: number;
98
+ cetLocktime: number;
99
+ refundLocktime: number;
100
+ serialized?: string;
101
+ tlvs?: (IOrderMetadataJSON | IOrderIrcInfoJSON | IOrderPositionInfoJSON | IBatchFundingGroupJSON | any)[];
102
+ }
103
+ export interface IDlcOfferAddresses {
104
+ fundingAddress: string;
105
+ changeAddress: string;
106
+ payoutAddress: string;
107
+ }
108
+ export declare class DlcOfferContainer {
109
+ private offers;
110
+ /**
111
+ * Adds a DlcOffer to the container.
112
+ * @param offer The DlcOffer to add.
113
+ */
114
+ addOffer(offer: DlcOffer): void;
115
+ /**
116
+ * Returns all DlcOffers in the container.
117
+ * @returns An array of DlcOffer instances.
118
+ */
119
+ getOffers(): DlcOffer[];
120
+ /**
121
+ * Serializes all DlcOffers in the container to a Buffer.
122
+ * @returns A Buffer containing the serialized DlcOffers.
123
+ */
124
+ serialize(): Buffer;
125
+ /**
126
+ * Deserializes a Buffer into a DlcOfferContainer with DlcOffers.
127
+ * @param buf The Buffer to deserialize.
128
+ * @returns A DlcOfferContainer instance.
129
+ */
130
+ static deserialize(buf: Buffer): DlcOfferContainer;
131
+ }
@@ -0,0 +1,418 @@
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.DlcOfferContainer = exports.DlcOffer = exports.LOCKTIME_THRESHOLD = void 0;
7
+ const bitcoin_1 = require("@node-dlc/bitcoin");
8
+ const bufio_1 = require("@node-dlc/bufio");
9
+ const crypto_1 = require("@node-dlc/crypto");
10
+ const bitcoinjs_lib_1 = require("bitcoinjs-lib");
11
+ const secp256k1_1 = __importDefault(require("secp256k1"));
12
+ const MessageType_1 = require("../MessageType");
13
+ const deserializeTlv_1 = require("../serialize/deserializeTlv");
14
+ const getTlv_1 = require("../serialize/getTlv");
15
+ const util_1 = require("../util");
16
+ const BatchFundingGroup_1 = require("./BatchFundingGroup");
17
+ const ContractInfo_1 = require("./ContractInfo");
18
+ const FundingInput_1 = require("./FundingInput");
19
+ const OrderIrcInfo_1 = require("./OrderIrcInfo");
20
+ const OrderMetadata_1 = require("./OrderMetadata");
21
+ const OrderPositionInfo_1 = require("./OrderPositionInfo");
22
+ exports.LOCKTIME_THRESHOLD = 500000000;
23
+ /**
24
+ * DlcOffer message contains information about a node and indicates its
25
+ * desire to enter into a new contract. This is the first step toward
26
+ * creating the funding transaction and CETs.
27
+ * Updated to support dlcspecs PR #163 format.
28
+ */
29
+ class DlcOffer {
30
+ constructor() {
31
+ /**
32
+ * The type for offer_dlc message. offer_dlc = 42778
33
+ */
34
+ this.type = DlcOffer.type;
35
+ // New fields as per dlcspecs PR #163
36
+ this.protocolVersion = MessageType_1.PROTOCOL_VERSION; // Default to current protocol version
37
+ this.fundingInputs = [];
38
+ }
39
+ /**
40
+ * Creates a DlcOffer from JSON data (e.g., from test vectors)
41
+ * Handles both our internal format and external test vector formats
42
+ * @param json JSON object representing a DLC offer
43
+ */
44
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
45
+ static fromJSON(json) {
46
+ const instance = new DlcOffer();
47
+ // Basic fields with field name variations
48
+ instance.protocolVersion =
49
+ json.protocolVersion || json.protocol_version || MessageType_1.PROTOCOL_VERSION;
50
+ instance.contractFlags = Buffer.from(json.contractFlags || json.contract_flags || '00', 'hex');
51
+ instance.chainHash = Buffer.from(json.chainHash || json.chain_hash, 'hex');
52
+ instance.temporaryContractId = Buffer.from(json.temporaryContractId || json.temporary_contract_id, 'hex');
53
+ instance.fundingPubkey = Buffer.from(json.fundingPubkey || json.fundingPubKey || json.funding_pubkey, 'hex');
54
+ instance.payoutSpk = Buffer.from(json.payoutSpk || json.payoutSPK || json.payout_spk, 'hex');
55
+ // Use toBigInt helper to handle BigInt values from json-bigint
56
+ instance.payoutSerialId = (0, util_1.toBigInt)(json.payoutSerialId || json.payout_serial_id);
57
+ instance.offerCollateral = (0, util_1.toBigInt)(json.offerCollateral ||
58
+ json.offerCollateralSatoshis ||
59
+ json.offer_collateral);
60
+ instance.changeSpk = Buffer.from(json.changeSpk || json.changeSPK || json.change_spk, 'hex');
61
+ instance.changeSerialId = (0, util_1.toBigInt)(json.changeSerialId || json.change_serial_id);
62
+ instance.fundOutputSerialId = (0, util_1.toBigInt)(json.fundOutputSerialId || json.fund_output_serial_id);
63
+ instance.feeRatePerVb = (0, util_1.toBigInt)(json.feeRatePerVb || json.fee_rate_per_vb);
64
+ instance.cetLocktime = json.cetLocktime || json.cet_locktime || 0;
65
+ instance.refundLocktime = json.refundLocktime || json.refund_locktime || 0;
66
+ // Use ContractInfo.fromJSON() - proper delegation
67
+ instance.contractInfo = ContractInfo_1.ContractInfo.fromJSON(json.contractInfo || json.contract_info);
68
+ // Use FundingInput.fromJSON() for each funding input - proper delegation
69
+ instance.fundingInputs = (json.fundingInputs || json.funding_inputs || [])
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
+ .map((inputJson) => FundingInput_1.FundingInput.fromJSON(inputJson));
72
+ return instance;
73
+ }
74
+ /**
75
+ * Deserializes an offer_dlc message with backward compatibility
76
+ * Detects old format (without protocol_version) vs new format (with protocol_version)
77
+ * @param buf
78
+ */
79
+ static deserialize(buf) {
80
+ const instance = new DlcOffer();
81
+ const reader = new bufio_1.BufferReader(buf);
82
+ const type = reader.readUInt16BE(); // read type
83
+ // Validate type matches expected DlcOffer type
84
+ if (type !== MessageType_1.MessageType.DlcOffer) {
85
+ throw new Error(`Invalid message type. Expected ${MessageType_1.MessageType.DlcOffer}, got ${type}`);
86
+ }
87
+ // BACKWARD COMPATIBILITY: Detect old vs new format
88
+ // New format: [type][protocol_version: 4 bytes][contract_flags: 1 byte][chain_hash: 32 bytes]
89
+ // Old format: [type][contract_flags: 1 byte][chain_hash: 32 bytes]
90
+ const nextBytes = reader.buffer.subarray(reader.position, reader.position + 5);
91
+ const possibleProtocolVersion = nextBytes.readUInt32BE(0);
92
+ const possibleContractFlags = nextBytes.readUInt8(4);
93
+ // Heuristic: protocol_version should be 1, contract_flags should be 0
94
+ // If first 4 bytes are reasonable protocol version (1-10) and next byte is 0, assume new format
95
+ const isNewFormat = possibleProtocolVersion >= 1 &&
96
+ possibleProtocolVersion <= 10 &&
97
+ possibleContractFlags === 0;
98
+ if (isNewFormat) {
99
+ // New format with protocol_version
100
+ instance.protocolVersion = reader.readUInt32BE();
101
+ instance.contractFlags = reader.readBytes(1);
102
+ }
103
+ else {
104
+ // Old format without protocol_version
105
+ instance.protocolVersion = 1; // Default to version 1
106
+ instance.contractFlags = reader.readBytes(1);
107
+ }
108
+ instance.chainHash = reader.readBytes(32);
109
+ instance.temporaryContractId = reader.readBytes(32);
110
+ // ContractInfo is serialized as sibling type in dlcspecs PR #163 format
111
+ instance.contractInfo = ContractInfo_1.ContractInfo.deserialize(reader.buffer.subarray(reader.position));
112
+ // Skip past the ContractInfo we just read
113
+ const contractInfoLength = instance.contractInfo.serialize().length;
114
+ reader.position += contractInfoLength;
115
+ instance.fundingPubkey = reader.readBytes(33);
116
+ const payoutSpkLen = reader.readUInt16BE();
117
+ instance.payoutSpk = reader.readBytes(payoutSpkLen);
118
+ instance.payoutSerialId = reader.readUInt64BE();
119
+ instance.offerCollateral = reader.readUInt64BE();
120
+ // Changed from u16 to bigsize as per dlcspecs PR #163
121
+ const fundingInputsLen = Number(reader.readBigSize());
122
+ for (let i = 0; i < fundingInputsLen; i++) {
123
+ // FundingInput body is serialized directly without TLV wrapper in rust-dlc format
124
+ const fundingInput = FundingInput_1.FundingInput.deserializeBody(reader.buffer.subarray(reader.position));
125
+ instance.fundingInputs.push(fundingInput);
126
+ // Skip past the FundingInput we just read
127
+ const fundingInputLength = fundingInput.serializeBody().length;
128
+ reader.position += fundingInputLength;
129
+ }
130
+ const changeSpkLen = reader.readUInt16BE();
131
+ instance.changeSpk = reader.readBytes(changeSpkLen);
132
+ instance.changeSerialId = reader.readUInt64BE();
133
+ instance.fundOutputSerialId = reader.readUInt64BE();
134
+ instance.feeRatePerVb = reader.readUInt64BE();
135
+ instance.cetLocktime = reader.readUInt32BE();
136
+ instance.refundLocktime = reader.readUInt32BE();
137
+ // Parse TLV stream as per dlcspecs PR #163
138
+ while (!reader.eof) {
139
+ const buf = (0, getTlv_1.getTlv)(reader);
140
+ const tlvReader = new bufio_1.BufferReader(buf);
141
+ const { type } = (0, deserializeTlv_1.deserializeTlv)(tlvReader);
142
+ switch (Number(type)) {
143
+ case MessageType_1.MessageType.OrderMetadataV0:
144
+ instance.metadata = OrderMetadata_1.OrderMetadataV0.deserialize(buf);
145
+ break;
146
+ case MessageType_1.MessageType.OrderIrcInfoV0:
147
+ instance.ircInfo = OrderIrcInfo_1.OrderIrcInfoV0.deserialize(buf);
148
+ break;
149
+ case MessageType_1.MessageType.OrderPositionInfoV0:
150
+ instance.positionInfo = OrderPositionInfo_1.OrderPositionInfo.deserialize(buf);
151
+ break;
152
+ case MessageType_1.MessageType.BatchFundingGroup:
153
+ if (!instance.batchFundingGroups) {
154
+ instance.batchFundingGroups = [];
155
+ }
156
+ instance.batchFundingGroups.push(BatchFundingGroup_1.BatchFundingGroup.deserialize(buf));
157
+ break;
158
+ default:
159
+ // Store unknown TLVs for future compatibility
160
+ if (!instance.unknownTlvs) {
161
+ instance.unknownTlvs = [];
162
+ }
163
+ instance.unknownTlvs.push({ type: Number(type), data: buf });
164
+ break;
165
+ }
166
+ }
167
+ return instance;
168
+ }
169
+ /**
170
+ * Get funding, change and payout address from DlcOffer
171
+ * @param network Bitcoin Network
172
+ * @returns {IDlcOfferAddresses}
173
+ */
174
+ getAddresses(network) {
175
+ const fundingSPK = bitcoin_1.Script.p2wpkhLock((0, crypto_1.hash160)(this.fundingPubkey))
176
+ .serialize()
177
+ .slice(1);
178
+ const fundingAddress = bitcoinjs_lib_1.address.fromOutputScript(fundingSPK, network);
179
+ const changeAddress = bitcoinjs_lib_1.address.fromOutputScript(this.changeSpk, network);
180
+ const payoutAddress = bitcoinjs_lib_1.address.fromOutputScript(this.payoutSpk, network);
181
+ return {
182
+ fundingAddress,
183
+ changeAddress,
184
+ payoutAddress,
185
+ };
186
+ }
187
+ /**
188
+ * Validates correctness of all fields in DlcOffer
189
+ * Updated validation rules as per dlcspecs PR #163
190
+ * @throws Will throw an error if validation fails
191
+ */
192
+ validate() {
193
+ // 1. Type is set automatically in class
194
+ // 2. protocol_version validation
195
+ if (this.protocolVersion !== MessageType_1.PROTOCOL_VERSION) {
196
+ throw new Error(`Unsupported protocol version: ${this.protocolVersion}, expected: ${MessageType_1.PROTOCOL_VERSION}`);
197
+ }
198
+ // 3. temporary_contract_id validation
199
+ if (!this.temporaryContractId || this.temporaryContractId.length !== 32) {
200
+ throw new Error('temporaryContractId must be 32 bytes');
201
+ }
202
+ // 4. contract_flags field is ignored
203
+ // 5. chain_hash must be validated as input by end user
204
+ // 6. payout_spk and change_spk must be standard script pubkeys
205
+ try {
206
+ bitcoinjs_lib_1.address.fromOutputScript(this.payoutSpk);
207
+ }
208
+ catch (e) {
209
+ throw new Error('DlcOffer payoutSpk is invalid');
210
+ }
211
+ try {
212
+ bitcoinjs_lib_1.address.fromOutputScript(this.changeSpk);
213
+ }
214
+ catch (e) {
215
+ throw new Error('DlcOffer changeSpk is invalid');
216
+ }
217
+ // 7. funding_pubkey must be a valid secp256k1 pubkey in compressed format
218
+ // https://github.com/bitcoin/bips/blob/master/bip-0137.mediawiki#background-on-ecdsa-signatures
219
+ if (secp256k1_1.default.publicKeyVerify(Buffer.from(this.fundingPubkey))) {
220
+ if (this.fundingPubkey[0] != 0x02 && this.fundingPubkey[0] != 0x03) {
221
+ throw new Error('fundingPubkey must be in compressed format');
222
+ }
223
+ }
224
+ else {
225
+ throw new Error('fundingPubkey is not a valid secp256k1 key');
226
+ }
227
+ // 8. offer_collateral must be greater than or equal to 1000
228
+ if (this.offerCollateral < 1000) {
229
+ throw new Error('offer_collateral must be greater than or equal to 1000');
230
+ }
231
+ if (this.cetLocktime < 0) {
232
+ throw new Error('cet_locktime must be greater than or equal to 0');
233
+ }
234
+ if (this.refundLocktime < 0) {
235
+ throw new Error('refund_locktime must be greater than or equal to 0');
236
+ }
237
+ // 9. cet_locktime and refund_locktime must either both be unix timestamps, or both be block heights.
238
+ // https://en.bitcoin.it/wiki/NLockTime
239
+ // https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki#detailed-specification
240
+ // https://github.com/bitcoin/bitcoin/blob/master/src/script/script.h#L39
241
+ if (!((this.cetLocktime < exports.LOCKTIME_THRESHOLD &&
242
+ this.refundLocktime < exports.LOCKTIME_THRESHOLD) ||
243
+ (this.cetLocktime >= exports.LOCKTIME_THRESHOLD &&
244
+ this.refundLocktime >= exports.LOCKTIME_THRESHOLD))) {
245
+ throw new Error('cetLocktime and refundLocktime must be in same units');
246
+ }
247
+ // 10. cetLocktime must be less than refundLocktime
248
+ if (this.cetLocktime >= this.refundLocktime) {
249
+ throw new Error('cetLocktime must be less than refundLocktime');
250
+ }
251
+ // 11. inputSerialId must be unique for each input
252
+ const inputSerialIds = this.fundingInputs.map((input) => input.inputSerialId);
253
+ if (new Set(inputSerialIds).size !== inputSerialIds.length) {
254
+ throw new Error('inputSerialIds must be unique');
255
+ }
256
+ // 12. changeSerialId and fundOutputSerialID must be different
257
+ if (this.changeSerialId === this.fundOutputSerialId) {
258
+ throw new Error('changeSerialId and fundOutputSerialId must be different');
259
+ }
260
+ // validate contractInfo
261
+ this.contractInfo.validate();
262
+ // totalCollateral should be > offerCollateral (logical validation)
263
+ if (this.contractInfo.getTotalCollateral() <= this.offerCollateral) {
264
+ throw new Error('totalCollateral should be greater than offerCollateral');
265
+ }
266
+ // validate funding amount
267
+ const fundingAmount = this.fundingInputs.reduce((acc, fundingInput) => {
268
+ const input = fundingInput;
269
+ return acc + input.prevTx.outputs[input.prevTxVout].value.sats;
270
+ }, BigInt(0));
271
+ if (this.offerCollateral >= fundingAmount) {
272
+ throw new Error('fundingAmount must be greater than offerCollateral');
273
+ }
274
+ }
275
+ /**
276
+ * Converts dlc_offer to JSON (canonical rust-dlc format)
277
+ */
278
+ toJSON() {
279
+ const tlvs = [];
280
+ if (this.metadata)
281
+ tlvs.push(this.metadata.toJSON());
282
+ if (this.ircInfo)
283
+ tlvs.push(this.ircInfo.toJSON());
284
+ if (this.positionInfo)
285
+ tlvs.push(this.positionInfo.toJSON());
286
+ if (this.batchFundingGroups)
287
+ this.batchFundingGroups.forEach((fundingInfo) => tlvs.push(fundingInfo.toJSON()));
288
+ // Include unknown TLVs for debugging
289
+ if (this.unknownTlvs) {
290
+ this.unknownTlvs.forEach((tlv) => tlvs.push({ type: tlv.type, data: tlv.data.toString('hex') }));
291
+ }
292
+ // Return canonical rust-dlc format only
293
+ return {
294
+ protocolVersion: this.protocolVersion,
295
+ temporaryContractId: this.temporaryContractId.toString('hex'),
296
+ contractFlags: Number(this.contractFlags[0]),
297
+ chainHash: this.chainHash.toString('hex'),
298
+ contractInfo: this.contractInfo.toJSON(),
299
+ fundingPubkey: this.fundingPubkey.toString('hex'),
300
+ payoutSpk: this.payoutSpk.toString('hex'),
301
+ payoutSerialId: (0, util_1.bigIntToNumber)(this.payoutSerialId),
302
+ offerCollateral: (0, util_1.bigIntToNumber)(this.offerCollateral),
303
+ fundingInputs: this.fundingInputs.map((input) => input.toJSON()),
304
+ changeSpk: this.changeSpk.toString('hex'),
305
+ changeSerialId: (0, util_1.bigIntToNumber)(this.changeSerialId),
306
+ fundOutputSerialId: (0, util_1.bigIntToNumber)(this.fundOutputSerialId),
307
+ feeRatePerVb: (0, util_1.bigIntToNumber)(this.feeRatePerVb),
308
+ cetLocktime: this.cetLocktime,
309
+ refundLocktime: this.refundLocktime,
310
+ }; // Allow different field names from interface
311
+ }
312
+ /**
313
+ * Serializes the offer_dlc message into a Buffer
314
+ * Updated serialization format as per dlcspecs PR #163
315
+ */
316
+ serialize() {
317
+ const writer = new bufio_1.BufferWriter();
318
+ writer.writeUInt16BE(this.type);
319
+ // New fields as per dlcspecs PR #163
320
+ writer.writeUInt32BE(this.protocolVersion);
321
+ writer.writeBytes(this.contractFlags);
322
+ writer.writeBytes(this.chainHash);
323
+ writer.writeBytes(this.temporaryContractId); // New field
324
+ writer.writeBytes(this.contractInfo.serialize());
325
+ writer.writeBytes(this.fundingPubkey);
326
+ writer.writeUInt16BE(this.payoutSpk.length);
327
+ writer.writeBytes(this.payoutSpk);
328
+ writer.writeUInt64BE(this.payoutSerialId);
329
+ writer.writeUInt64BE(this.offerCollateral);
330
+ // Changed from u16 to bigsize as per dlcspecs PR #163
331
+ writer.writeBigSize(this.fundingInputs.length);
332
+ for (const fundingInput of this.fundingInputs) {
333
+ // Use serializeBody() to match rust-dlc behavior - funding inputs in vec are serialized without TLV wrapper
334
+ writer.writeBytes(fundingInput.serializeBody());
335
+ }
336
+ writer.writeUInt16BE(this.changeSpk.length);
337
+ writer.writeBytes(this.changeSpk);
338
+ writer.writeUInt64BE(this.changeSerialId);
339
+ writer.writeUInt64BE(this.fundOutputSerialId);
340
+ writer.writeUInt64BE(this.feeRatePerVb);
341
+ writer.writeUInt32BE(this.cetLocktime);
342
+ writer.writeUInt32BE(this.refundLocktime);
343
+ // TLV stream as per dlcspecs PR #163
344
+ if (this.metadata)
345
+ writer.writeBytes(this.metadata.serialize());
346
+ if (this.ircInfo)
347
+ writer.writeBytes(this.ircInfo.serialize());
348
+ if (this.positionInfo)
349
+ writer.writeBytes(this.positionInfo.serialize());
350
+ if (this.batchFundingGroups)
351
+ this.batchFundingGroups.forEach((fundingInfo) => writer.writeBytes(fundingInfo.serialize()));
352
+ // Write unknown TLVs for forward compatibility
353
+ if (this.unknownTlvs) {
354
+ this.unknownTlvs.forEach((tlv) => {
355
+ writer.writeBytes(tlv.data);
356
+ });
357
+ }
358
+ return writer.toBuffer();
359
+ }
360
+ }
361
+ exports.DlcOffer = DlcOffer;
362
+ DlcOffer.type = MessageType_1.MessageType.DlcOffer;
363
+ class DlcOfferContainer {
364
+ constructor() {
365
+ this.offers = [];
366
+ }
367
+ /**
368
+ * Adds a DlcOffer to the container.
369
+ * @param offer The DlcOffer to add.
370
+ */
371
+ addOffer(offer) {
372
+ this.offers.push(offer);
373
+ }
374
+ /**
375
+ * Returns all DlcOffers in the container.
376
+ * @returns An array of DlcOffer instances.
377
+ */
378
+ getOffers() {
379
+ return this.offers;
380
+ }
381
+ /**
382
+ * Serializes all DlcOffers in the container to a Buffer.
383
+ * @returns A Buffer containing the serialized DlcOffers.
384
+ */
385
+ serialize() {
386
+ const writer = new bufio_1.BufferWriter();
387
+ // Write the number of offers in the container first.
388
+ writer.writeBigSize(this.offers.length);
389
+ // Serialize each offer and write it.
390
+ this.offers.forEach((offer) => {
391
+ const serializedOffer = offer.serialize();
392
+ // Optionally, write the length of the serialized offer for easier deserialization.
393
+ writer.writeBigSize(serializedOffer.length);
394
+ writer.writeBytes(serializedOffer);
395
+ });
396
+ return writer.toBuffer();
397
+ }
398
+ /**
399
+ * Deserializes a Buffer into a DlcOfferContainer with DlcOffers.
400
+ * @param buf The Buffer to deserialize.
401
+ * @returns A DlcOfferContainer instance.
402
+ */
403
+ static deserialize(buf) {
404
+ const reader = new bufio_1.BufferReader(buf);
405
+ const container = new DlcOfferContainer();
406
+ const offersCount = reader.readBigSize();
407
+ for (let i = 0; i < offersCount; i++) {
408
+ // Optionally, read the length of the serialized offer if it was written during serialization.
409
+ const offerLength = reader.readBigSize();
410
+ const offerBuf = reader.readBytes(Number(offerLength));
411
+ const offer = DlcOffer.deserialize(offerBuf);
412
+ container.addOffer(offer);
413
+ }
414
+ return container;
415
+ }
416
+ }
417
+ exports.DlcOfferContainer = DlcOfferContainer;
418
+ //# sourceMappingURL=DlcOffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DlcOffer.js","sourceRoot":"","sources":["../../lib/messages/DlcOffer.ts"],"names":[],"mappings":";;;;;;AAAA,+CAA2C;AAC3C,2CAA6D;AAC7D,6CAA2C;AAE3C,iDAAwC;AACxC,0DAAkC;AAElC,gDAA+D;AAC/D,gEAA6D;AAC7D,gDAA6C;AAC7C,kCAAmD;AACnD,2DAAgF;AAChF,iDAIwB;AAExB,iDAAiE;AACjE,iDAIwB;AACxB,mDAIyB;AACzB,2DAAgF;AAEnE,QAAA,kBAAkB,GAAG,SAAS,CAAC;AAE5C;;;;;GAKG;AACH,MAAa,QAAQ;IAArB;QAgME;;WAEG;QACI,SAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAE5B,qCAAqC;QAC9B,oBAAe,GAAW,8BAAgB,CAAC,CAAC,sCAAsC;QAmBlF,kBAAa,GAAmB,EAAE,CAAC;IAiQ5C,CAAC;IAvdC;;;;OAIG;IACH,iHAAiH;IAC1G,MAAM,CAAC,QAAQ,CAAC,IAAS;QAC9B,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAEhC,0CAA0C;QAC1C,QAAQ,CAAC,eAAe;YACtB,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,gBAAgB,IAAI,8BAAgB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AK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE;YACpC,8FAA8F;YAC9F,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;YACzC,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;YACvD,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC7C,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC3B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAvDD,8CAuDC"}
@@ -0,0 +1,96 @@
1
+ /// <reference types="node" />
2
+ import { MessageType } from '../MessageType';
3
+ import { BatchFundingGroup } from './BatchFundingGroup';
4
+ import { CetAdaptorSignatures, ICetAdaptorSignaturesJSON } from './CetAdaptorSignatures';
5
+ import { IDlcMessage } from './DlcMessage';
6
+ import { FundingSignatures, IFundingSignaturesJSON } from './FundingSignatures';
7
+ /**
8
+ * DlcSign gives all of the initiator's signatures, which allows the
9
+ * receiver to broadcast the funding transaction with both parties being
10
+ * fully committed to all closing transactions.
11
+ * Updated to support dlcspecs PR #163 format.
12
+ */
13
+ export declare class DlcSign implements IDlcMessage {
14
+ static type: MessageType;
15
+ /**
16
+ * Creates a DlcSign from JSON data (e.g., from test vectors)
17
+ * Handles both our internal format and external test vector formats
18
+ * @param json JSON object representing a DLC sign
19
+ */
20
+ static fromJSON(json: any): DlcSign;
21
+ /**
22
+ * Parses CetAdaptorSignatures from JSON
23
+ * @param cetSigsJson JSON object representing CET adaptor signatures
24
+ */
25
+ private static parseCetAdaptorSignaturesFromJSON;
26
+ /**
27
+ * Parses FundingSignatures from JSON
28
+ * @param fundingSigsJson JSON object representing funding signatures
29
+ */
30
+ private static parseFundingSignaturesFromJSON;
31
+ /**
32
+ * Deserializes a sign_dlc message
33
+ * @param buf
34
+ */
35
+ static deserialize(buf: Buffer): DlcSign;
36
+ /**
37
+ * The type for sign_dlc message. sign_dlc = 42782
38
+ */
39
+ type: MessageType;
40
+ protocolVersion: number;
41
+ contractId: Buffer;
42
+ cetAdaptorSignatures: CetAdaptorSignatures;
43
+ refundSignature: Buffer;
44
+ fundingSignatures: FundingSignatures;
45
+ batchFundingGroups?: BatchFundingGroup[];
46
+ unknownTlvs?: Array<{
47
+ type: number;
48
+ data: Buffer;
49
+ }>;
50
+ /**
51
+ * Validates correctness of all fields
52
+ * Updated validation rules as per dlcspecs PR #163
53
+ * @throws Will throw an error if validation fails
54
+ */
55
+ validate(): void;
56
+ /**
57
+ * Converts sign_dlc to JSON (canonical rust-dlc format)
58
+ */
59
+ toJSON(): IDlcSignJSON;
60
+ /**
61
+ * Serializes the sign_dlc message into a Buffer
62
+ * Updated serialization format as per dlcspecs PR #163
63
+ */
64
+ serialize(): Buffer;
65
+ }
66
+ export interface IDlcSignJSON {
67
+ protocolVersion: number;
68
+ contractId: string;
69
+ cetAdaptorSignatures: ICetAdaptorSignaturesJSON;
70
+ refundSignature: string;
71
+ fundingSignatures: IFundingSignaturesJSON;
72
+ }
73
+ export declare class DlcSignContainer {
74
+ private signs;
75
+ /**
76
+ * Adds a DlcSign to the container.
77
+ * @param sign The DlcSign to add.
78
+ */
79
+ addSign(sign: DlcSign): void;
80
+ /**
81
+ * Returns all DlcSigns in the container.
82
+ * @returns An array of DlcSign instances.
83
+ */
84
+ getSigns(): DlcSign[];
85
+ /**
86
+ * Serializes all DlcSigns in the container to a Buffer.
87
+ * @returns A Buffer containing the serialized DlcSigns.
88
+ */
89
+ serialize(): Buffer;
90
+ /**
91
+ * Deserializes a Buffer into a DlcSignContainer with DlcSigns.
92
+ * @param buf The Buffer to deserialize.
93
+ * @returns A DlcSignContainer instance.
94
+ */
95
+ static deserialize(buf: Buffer): DlcSignContainer;
96
+ }