@atomicfinance/bitcoin-dlc-provider 3.6.1 → 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 (373) hide show
  1. package/.nvmrc +1 -1
  2. package/.yalc/@node-dlc/messaging/.nyc_output/2cf48009-1094-4275-bb91-c164c932feb6.json +1 -0
  3. package/.yalc/@node-dlc/messaging/.nyc_output/processinfo/2cf48009-1094-4275-bb91-c164c932feb6.json +1 -0
  4. package/.yalc/@node-dlc/messaging/.nyc_output/processinfo/index.json +1 -0
  5. package/.yalc/@node-dlc/messaging/README.md +24 -0
  6. package/.yalc/@node-dlc/messaging/__tests__/_test-utils.ts +12 -0
  7. package/.yalc/@node-dlc/messaging/__tests__/chain/ChainManager.spec.ts +178 -0
  8. package/.yalc/@node-dlc/messaging/__tests__/compatibility/dlcspecs-compatibility.spec.ts +473 -0
  9. package/.yalc/@node-dlc/messaging/__tests__/compatibility/rust-dlc-cross-language.spec.ts +342 -0
  10. package/.yalc/@node-dlc/messaging/__tests__/compatibility/true-serialization-compatibility.spec.ts +611 -0
  11. package/.yalc/@node-dlc/messaging/__tests__/dlc_message_test.json +155 -0
  12. package/.yalc/@node-dlc/messaging/__tests__/irc/IrcMessage.spec.ts +94 -0
  13. package/.yalc/@node-dlc/messaging/__tests__/messages/AddressCache.spec.ts +79 -0
  14. package/.yalc/@node-dlc/messaging/__tests__/messages/BatchFundingGroup.spec.ts +72 -0
  15. package/.yalc/@node-dlc/messaging/__tests__/messages/CetAdaptorSignatures.spec.ts +57 -0
  16. package/.yalc/@node-dlc/messaging/__tests__/messages/ContractDescriptor.spec.ts +264 -0
  17. package/.yalc/@node-dlc/messaging/__tests__/messages/ContractInfo.spec.ts +419 -0
  18. package/.yalc/@node-dlc/messaging/__tests__/messages/DigitDecompositionEventDescriptor.spec.ts +59 -0
  19. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcAccept.spec.ts +242 -0
  20. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcCancel.spec.ts +42 -0
  21. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcClose.spec.ts +315 -0
  22. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcOffer.spec.ts +527 -0
  23. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcSign.spec.ts +118 -0
  24. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcTransactions.spec.ts +157 -0
  25. package/.yalc/@node-dlc/messaging/__tests__/messages/EnumEventDescriptor.spec.ts +50 -0
  26. package/.yalc/@node-dlc/messaging/__tests__/messages/EventDescriptor.spec.ts +93 -0
  27. package/.yalc/@node-dlc/messaging/__tests__/messages/FundingInput.spec.ts +84 -0
  28. package/.yalc/@node-dlc/messaging/__tests__/messages/FundingSignatures.spec.ts +83 -0
  29. package/.yalc/@node-dlc/messaging/__tests__/messages/NegotiationFields.spec.ts +328 -0
  30. package/.yalc/@node-dlc/messaging/__tests__/messages/NodeAnnouncementMessage.spec.ts +115 -0
  31. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleAnnouncement.spec.ts +415 -0
  32. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleAttestation.spec.ts +326 -0
  33. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleEvent.spec.ts +143 -0
  34. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleEventContainer.spec.ts +95 -0
  35. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleIdentifier.spec.ts +48 -0
  36. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleInfo.spec.ts +116 -0
  37. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderAccept.spec.ts +77 -0
  38. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderNegotiationFields.spec.ts +216 -0
  39. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderOffer.spec.ts +121 -0
  40. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderPositionInfo.spec.ts +75 -0
  41. package/.yalc/@node-dlc/messaging/__tests__/messages/PayoutCurvePiece.spec.ts +220 -0
  42. package/.yalc/@node-dlc/messaging/__tests__/messages/PayoutFunction.spec.ts +101 -0
  43. package/.yalc/@node-dlc/messaging/__tests__/messages/RoundingIntervals.spec.ts +75 -0
  44. package/.yalc/@node-dlc/messaging/__tests__/serialize/F64.spec.ts +260 -0
  45. package/.yalc/@node-dlc/messaging/__tests__/tsconfig.json +8 -0
  46. package/.yalc/@node-dlc/messaging/coverage/lcov-report/base.css +224 -0
  47. package/.yalc/@node-dlc/messaging/coverage/lcov-report/block-navigation.js +79 -0
  48. package/.yalc/@node-dlc/messaging/coverage/lcov-report/favicon.png +0 -0
  49. package/.yalc/@node-dlc/messaging/coverage/lcov-report/index.html +201 -0
  50. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/MessageType.ts.html +494 -0
  51. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/ChainManager.ts.html +1058 -0
  52. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/ChainMemoryStore.ts.html +182 -0
  53. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/index.html +126 -0
  54. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/domain/Address.ts.html +272 -0
  55. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/domain/index.html +111 -0
  56. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/index.html +141 -0
  57. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/index.ts.html +212 -0
  58. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/irc/IrcMessage.ts.html +563 -0
  59. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/irc/index.html +111 -0
  60. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/AddressCache.ts.html +302 -0
  61. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/BatchFundingGroup.ts.html +503 -0
  62. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/CetAdaptorSignatures.ts.html +347 -0
  63. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/CetAdaptorSignaturesV0.ts.html +347 -0
  64. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ContractDescriptor.ts.html +1040 -0
  65. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ContractInfo.ts.html +1382 -0
  66. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcAccept.ts.html +1865 -0
  67. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcCancel.ts.html +251 -0
  68. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcClose.ts.html +986 -0
  69. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcCloseMetadata.ts.html +443 -0
  70. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcIds.ts.html +281 -0
  71. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcInfo.ts.html +323 -0
  72. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcMessage.ts.html +341 -0
  73. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcOffer.ts.html +1895 -0
  74. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcSign.ts.html +1142 -0
  75. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcTransactions.ts.html +719 -0
  76. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/EventDescriptor.ts.html +947 -0
  77. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingInput.ts.html +728 -0
  78. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingSignatures.ts.html +374 -0
  79. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingSignaturesV0.ts.html +374 -0
  80. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/NegotiationFields.ts.html +836 -0
  81. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/NodeAnnouncementMessage.ts.html +515 -0
  82. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAnnouncement.ts.html +608 -0
  83. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAnnouncementV0.ts.html +605 -0
  84. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAttestation.ts.html +956 -0
  85. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAttestationV0.ts.html +770 -0
  86. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEvent.ts.html +830 -0
  87. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventContainer.ts.html +347 -0
  88. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventContainerV0.ts.html +347 -0
  89. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventV0.ts.html +827 -0
  90. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleIdentifier.ts.html +314 -0
  91. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleIdentifierV0.ts.html +314 -0
  92. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleInfo.ts.html +1637 -0
  93. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleInfoV0.ts.html +1631 -0
  94. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderAccept.ts.html +557 -0
  95. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderIrcInfo.ts.html +380 -0
  96. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderMetadata.ts.html +437 -0
  97. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderNegotiationFields.ts.html +551 -0
  98. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderOffer.ts.html +1337 -0
  99. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderPositionInfo.ts.html +590 -0
  100. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/PayoutCurvePiece.ts.html +1427 -0
  101. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/PayoutFunction.ts.html +800 -0
  102. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/RoundingIntervals.ts.html +461 -0
  103. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/RoundingIntervalsV0.ts.html +482 -0
  104. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ScriptWitnessV0.ts.html +269 -0
  105. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/index.html +636 -0
  106. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serde/SerdeUtils.ts.html +1394 -0
  107. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serde/index.html +111 -0
  108. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/F64.ts.html +1136 -0
  109. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/deserializeTlv.ts.html +125 -0
  110. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/getTlv.ts.html +143 -0
  111. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/index.html +141 -0
  112. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/util.ts.html +179 -0
  113. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/validation/index.html +111 -0
  114. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/validation/validate.ts.html +182 -0
  115. package/.yalc/@node-dlc/messaging/coverage/lcov-report/prettify.css +1 -0
  116. package/.yalc/@node-dlc/messaging/coverage/lcov-report/prettify.js +2 -0
  117. package/.yalc/@node-dlc/messaging/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  118. package/.yalc/@node-dlc/messaging/coverage/lcov-report/sorter.js +170 -0
  119. package/.yalc/@node-dlc/messaging/coverage/lcov.info +5394 -0
  120. package/.yalc/@node-dlc/messaging/dist/MessageType.d.ts +100 -0
  121. package/.yalc/@node-dlc/messaging/dist/MessageType.js +117 -0
  122. package/.yalc/@node-dlc/messaging/dist/MessageType.js.map +1 -0
  123. package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.d.ts +50 -0
  124. package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.js +211 -0
  125. package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.js.map +1 -0
  126. package/.yalc/@node-dlc/messaging/dist/chain/ChainMemoryStore.d.ts +14 -0
  127. package/.yalc/@node-dlc/messaging/dist/chain/ChainMemoryStore.js +28 -0
  128. package/.yalc/@node-dlc/messaging/dist/chain/ChainMemoryStore.js.map +1 -0
  129. package/.yalc/@node-dlc/messaging/dist/chain/DlcStore.d.ts +11 -0
  130. package/.yalc/@node-dlc/messaging/dist/chain/DlcStore.js +3 -0
  131. package/.yalc/@node-dlc/messaging/dist/chain/DlcStore.js.map +1 -0
  132. package/.yalc/@node-dlc/messaging/dist/chain/IChainFilterChainClient.d.ts +48 -0
  133. package/.yalc/@node-dlc/messaging/dist/chain/IChainFilterChainClient.js +3 -0
  134. package/.yalc/@node-dlc/messaging/dist/chain/IChainFilterChainClient.js.map +1 -0
  135. package/.yalc/@node-dlc/messaging/dist/domain/Address.d.ts +24 -0
  136. package/.yalc/@node-dlc/messaging/dist/domain/Address.js +46 -0
  137. package/.yalc/@node-dlc/messaging/dist/domain/Address.js.map +1 -0
  138. package/.yalc/@node-dlc/messaging/dist/index.d.ts +44 -0
  139. package/.yalc/@node-dlc/messaging/dist/index.js +63 -0
  140. package/.yalc/@node-dlc/messaging/dist/index.js.map +1 -0
  141. package/.yalc/@node-dlc/messaging/dist/irc/IrcMessage.d.ts +43 -0
  142. package/.yalc/@node-dlc/messaging/dist/irc/IrcMessage.js +116 -0
  143. package/.yalc/@node-dlc/messaging/dist/irc/IrcMessage.js.map +1 -0
  144. package/.yalc/@node-dlc/messaging/dist/messages/AddressCache.d.ts +15 -0
  145. package/.yalc/@node-dlc/messaging/dist/messages/AddressCache.js +51 -0
  146. package/.yalc/@node-dlc/messaging/dist/messages/AddressCache.js.map +1 -0
  147. package/.yalc/@node-dlc/messaging/dist/messages/BatchFundingGroup.d.ts +61 -0
  148. package/.yalc/@node-dlc/messaging/dist/messages/BatchFundingGroup.js +113 -0
  149. package/.yalc/@node-dlc/messaging/dist/messages/BatchFundingGroup.js.map +1 -0
  150. package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignatures.d.ts +40 -0
  151. package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignatures.js +67 -0
  152. package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignatures.js.map +1 -0
  153. package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.d.ts +122 -0
  154. package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.js +222 -0
  155. package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.js.map +1 -0
  156. package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.d.ts +135 -0
  157. package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.js +304 -0
  158. package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.js.map +1 -0
  159. package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.d.ts +145 -0
  160. package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.js +428 -0
  161. package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.js.map +1 -0
  162. package/.yalc/@node-dlc/messaging/dist/messages/DlcCancel.d.ts +31 -0
  163. package/.yalc/@node-dlc/messaging/dist/messages/DlcCancel.js +51 -0
  164. package/.yalc/@node-dlc/messaging/dist/messages/DlcCancel.js.map +1 -0
  165. package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.d.ts +68 -0
  166. package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.js +210 -0
  167. package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.js.map +1 -0
  168. package/.yalc/@node-dlc/messaging/dist/messages/DlcCloseMetadata.d.ts +44 -0
  169. package/.yalc/@node-dlc/messaging/dist/messages/DlcCloseMetadata.js +74 -0
  170. package/.yalc/@node-dlc/messaging/dist/messages/DlcCloseMetadata.js.map +1 -0
  171. package/.yalc/@node-dlc/messaging/dist/messages/DlcIds.d.ts +26 -0
  172. package/.yalc/@node-dlc/messaging/dist/messages/DlcIds.js +58 -0
  173. package/.yalc/@node-dlc/messaging/dist/messages/DlcIds.js.map +1 -0
  174. package/.yalc/@node-dlc/messaging/dist/messages/DlcInfo.d.ts +31 -0
  175. package/.yalc/@node-dlc/messaging/dist/messages/DlcInfo.js +61 -0
  176. package/.yalc/@node-dlc/messaging/dist/messages/DlcInfo.js.map +1 -0
  177. package/.yalc/@node-dlc/messaging/dist/messages/DlcMessage.d.ts +23 -0
  178. package/.yalc/@node-dlc/messaging/dist/messages/DlcMessage.js +54 -0
  179. package/.yalc/@node-dlc/messaging/dist/messages/DlcMessage.js.map +1 -0
  180. package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.d.ts +131 -0
  181. package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.js +418 -0
  182. package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.js.map +1 -0
  183. package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.d.ts +96 -0
  184. package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.js +267 -0
  185. package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.js.map +1 -0
  186. package/.yalc/@node-dlc/messaging/dist/messages/DlcTransactions.d.ts +69 -0
  187. package/.yalc/@node-dlc/messaging/dist/messages/DlcTransactions.js +149 -0
  188. package/.yalc/@node-dlc/messaging/dist/messages/DlcTransactions.js.map +1 -0
  189. package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.d.ts +106 -0
  190. package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.js +209 -0
  191. package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.js.map +1 -0
  192. package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.d.ts +62 -0
  193. package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.js +163 -0
  194. package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.js.map +1 -0
  195. package/.yalc/@node-dlc/messaging/dist/messages/FundingSignatures.d.ts +36 -0
  196. package/.yalc/@node-dlc/messaging/dist/messages/FundingSignatures.js +78 -0
  197. package/.yalc/@node-dlc/messaging/dist/messages/FundingSignatures.js.map +1 -0
  198. package/.yalc/@node-dlc/messaging/dist/messages/IWireMessage.d.ts +6 -0
  199. package/.yalc/@node-dlc/messaging/dist/messages/IWireMessage.js +3 -0
  200. package/.yalc/@node-dlc/messaging/dist/messages/IWireMessage.js.map +1 -0
  201. package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.d.ts +86 -0
  202. package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.js +185 -0
  203. package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.js.map +1 -0
  204. package/.yalc/@node-dlc/messaging/dist/messages/NodeAnnouncementMessage.d.ts +57 -0
  205. package/.yalc/@node-dlc/messaging/dist/messages/NodeAnnouncementMessage.js +127 -0
  206. package/.yalc/@node-dlc/messaging/dist/messages/NodeAnnouncementMessage.js.map +1 -0
  207. package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncement.d.ts +76 -0
  208. package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncement.js +131 -0
  209. package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncement.js.map +1 -0
  210. package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestation.d.ts +68 -0
  211. package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestation.js +239 -0
  212. package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestation.js.map +1 -0
  213. package/.yalc/@node-dlc/messaging/dist/messages/OracleEvent.d.ts +90 -0
  214. package/.yalc/@node-dlc/messaging/dist/messages/OracleEvent.js +189 -0
  215. package/.yalc/@node-dlc/messaging/dist/messages/OracleEvent.js.map +1 -0
  216. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainer.d.ts +32 -0
  217. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainer.js +67 -0
  218. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainer.js.map +1 -0
  219. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifier.d.ts +32 -0
  220. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifier.js +58 -0
  221. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifier.js.map +1 -0
  222. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifierV0.d.ts +32 -0
  223. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifierV0.js +58 -0
  224. package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifierV0.js.map +1 -0
  225. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.d.ts +161 -0
  226. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.js +390 -0
  227. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.js.map +1 -0
  228. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.d.ts +161 -0
  229. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.js +387 -0
  230. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.js.map +1 -0
  231. package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.d.ts +65 -0
  232. package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.js +125 -0
  233. package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.js.map +1 -0
  234. package/.yalc/@node-dlc/messaging/dist/messages/OrderIrcInfo.d.ts +42 -0
  235. package/.yalc/@node-dlc/messaging/dist/messages/OrderIrcInfo.js +74 -0
  236. package/.yalc/@node-dlc/messaging/dist/messages/OrderIrcInfo.js.map +1 -0
  237. package/.yalc/@node-dlc/messaging/dist/messages/OrderMetadata.d.ts +56 -0
  238. package/.yalc/@node-dlc/messaging/dist/messages/OrderMetadata.js +87 -0
  239. package/.yalc/@node-dlc/messaging/dist/messages/OrderMetadata.js.map +1 -0
  240. package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.d.ts +69 -0
  241. package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.js +114 -0
  242. package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.js.map +1 -0
  243. package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.d.ts +97 -0
  244. package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.js +296 -0
  245. package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.js.map +1 -0
  246. package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.d.ts +50 -0
  247. package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.js +125 -0
  248. package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.js.map +1 -0
  249. package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.d.ts +129 -0
  250. package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.js +327 -0
  251. package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.js.map +1 -0
  252. package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.d.ts +66 -0
  253. package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.js +170 -0
  254. package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.js.map +1 -0
  255. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.d.ts +52 -0
  256. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.js +95 -0
  257. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.js.map +1 -0
  258. package/.yalc/@node-dlc/messaging/dist/messages/ScriptWitnessV0.d.ts +29 -0
  259. package/.yalc/@node-dlc/messaging/dist/messages/ScriptWitnessV0.js +50 -0
  260. package/.yalc/@node-dlc/messaging/dist/messages/ScriptWitnessV0.js.map +1 -0
  261. package/.yalc/@node-dlc/messaging/dist/messages/Tlv.d.ts +15 -0
  262. package/.yalc/@node-dlc/messaging/dist/messages/Tlv.js +32 -0
  263. package/.yalc/@node-dlc/messaging/dist/messages/Tlv.js.map +1 -0
  264. package/.yalc/@node-dlc/messaging/dist/serialize/F64.d.ts +154 -0
  265. package/.yalc/@node-dlc/messaging/dist/serialize/F64.js +307 -0
  266. package/.yalc/@node-dlc/messaging/dist/serialize/F64.js.map +1 -0
  267. package/.yalc/@node-dlc/messaging/dist/serialize/deserializeTlv.d.ts +9 -0
  268. package/.yalc/@node-dlc/messaging/dist/serialize/deserializeTlv.js +11 -0
  269. package/.yalc/@node-dlc/messaging/dist/serialize/deserializeTlv.js.map +1 -0
  270. package/.yalc/@node-dlc/messaging/dist/serialize/getTlv.d.ts +4 -0
  271. package/.yalc/@node-dlc/messaging/dist/serialize/getTlv.js +23 -0
  272. package/.yalc/@node-dlc/messaging/dist/serialize/getTlv.js.map +1 -0
  273. package/.yalc/@node-dlc/messaging/dist/serialize/readTlvs.d.ts +8 -0
  274. package/.yalc/@node-dlc/messaging/dist/serialize/readTlvs.js +33 -0
  275. package/.yalc/@node-dlc/messaging/dist/serialize/readTlvs.js.map +1 -0
  276. package/.yalc/@node-dlc/messaging/dist/util.d.ts +13 -0
  277. package/.yalc/@node-dlc/messaging/dist/util.js +40 -0
  278. package/.yalc/@node-dlc/messaging/dist/util.js.map +1 -0
  279. package/.yalc/@node-dlc/messaging/dist/validation/validate.d.ts +4 -0
  280. package/.yalc/@node-dlc/messaging/dist/validation/validate.js +31 -0
  281. package/.yalc/@node-dlc/messaging/dist/validation/validate.js.map +1 -0
  282. package/.yalc/@node-dlc/messaging/lib/MessageType.ts +138 -0
  283. package/.yalc/@node-dlc/messaging/lib/chain/ChainManager.ts +326 -0
  284. package/.yalc/@node-dlc/messaging/lib/chain/ChainMemoryStore.ts +34 -0
  285. package/.yalc/@node-dlc/messaging/lib/chain/DlcStore.ts +11 -0
  286. package/.yalc/@node-dlc/messaging/lib/chain/IChainFilterChainClient.ts +57 -0
  287. package/.yalc/@node-dlc/messaging/lib/domain/Address.ts +64 -0
  288. package/.yalc/@node-dlc/messaging/lib/index.ts +44 -0
  289. package/.yalc/@node-dlc/messaging/lib/irc/IrcMessage.ts +161 -0
  290. package/.yalc/@node-dlc/messaging/lib/messages/AddressCache.ts +74 -0
  291. package/.yalc/@node-dlc/messaging/lib/messages/BatchFundingGroup.ts +141 -0
  292. package/.yalc/@node-dlc/messaging/lib/messages/CetAdaptorSignatures.ts +89 -0
  293. package/.yalc/@node-dlc/messaging/lib/messages/ContractDescriptor.ts +318 -0
  294. package/.yalc/@node-dlc/messaging/lib/messages/ContractInfo.ts +434 -0
  295. package/.yalc/@node-dlc/messaging/lib/messages/DlcAccept.ts +595 -0
  296. package/.yalc/@node-dlc/messaging/lib/messages/DlcCancel.ts +57 -0
  297. package/.yalc/@node-dlc/messaging/lib/messages/DlcClose.ts +302 -0
  298. package/.yalc/@node-dlc/messaging/lib/messages/DlcCloseMetadata.ts +121 -0
  299. package/.yalc/@node-dlc/messaging/lib/messages/DlcIds.ts +67 -0
  300. package/.yalc/@node-dlc/messaging/lib/messages/DlcInfo.ts +81 -0
  301. package/.yalc/@node-dlc/messaging/lib/messages/DlcMessage.ts +87 -0
  302. package/.yalc/@node-dlc/messaging/lib/messages/DlcOffer.ts +605 -0
  303. package/.yalc/@node-dlc/messaging/lib/messages/DlcSign.ts +354 -0
  304. package/.yalc/@node-dlc/messaging/lib/messages/DlcTransactions.ts +213 -0
  305. package/.yalc/@node-dlc/messaging/lib/messages/EventDescriptor.ts +289 -0
  306. package/.yalc/@node-dlc/messaging/lib/messages/FundingInput.ts +216 -0
  307. package/.yalc/@node-dlc/messaging/lib/messages/FundingSignatures.ts +98 -0
  308. package/.yalc/@node-dlc/messaging/lib/messages/IWireMessage.ts +6 -0
  309. package/.yalc/@node-dlc/messaging/lib/messages/NegotiationFields.ts +252 -0
  310. package/.yalc/@node-dlc/messaging/lib/messages/NodeAnnouncementMessage.ts +145 -0
  311. package/.yalc/@node-dlc/messaging/lib/messages/OracleAnnouncement.ts +176 -0
  312. package/.yalc/@node-dlc/messaging/lib/messages/OracleAttestation.ts +292 -0
  313. package/.yalc/@node-dlc/messaging/lib/messages/OracleEvent.ts +250 -0
  314. package/.yalc/@node-dlc/messaging/lib/messages/OracleEventContainer.ts +89 -0
  315. package/.yalc/@node-dlc/messaging/lib/messages/OracleIdentifier.ts +78 -0
  316. package/.yalc/@node-dlc/messaging/lib/messages/OracleInfo.ts +519 -0
  317. package/.yalc/@node-dlc/messaging/lib/messages/OrderAccept.ts +159 -0
  318. package/.yalc/@node-dlc/messaging/lib/messages/OrderIrcInfo.ts +100 -0
  319. package/.yalc/@node-dlc/messaging/lib/messages/OrderMetadata.ts +119 -0
  320. package/.yalc/@node-dlc/messaging/lib/messages/OrderNegotiationFields.ts +157 -0
  321. package/.yalc/@node-dlc/messaging/lib/messages/OrderOffer.ts +419 -0
  322. package/.yalc/@node-dlc/messaging/lib/messages/OrderPositionInfo.ts +170 -0
  323. package/.yalc/@node-dlc/messaging/lib/messages/PayoutCurvePiece.ts +449 -0
  324. package/.yalc/@node-dlc/messaging/lib/messages/PayoutFunction.ts +240 -0
  325. package/.yalc/@node-dlc/messaging/lib/messages/RoundingIntervals.ts +127 -0
  326. package/.yalc/@node-dlc/messaging/lib/messages/ScriptWitnessV0.ts +63 -0
  327. package/.yalc/@node-dlc/messaging/lib/messages/Tlv.ts +40 -0
  328. package/.yalc/@node-dlc/messaging/lib/serialize/F64.ts +352 -0
  329. package/.yalc/@node-dlc/messaging/lib/serialize/deserializeTlv.ts +15 -0
  330. package/.yalc/@node-dlc/messaging/lib/serialize/getTlv.ts +21 -0
  331. package/.yalc/@node-dlc/messaging/lib/serialize/readTlvs.ts +37 -0
  332. package/.yalc/@node-dlc/messaging/lib/util.ts +33 -0
  333. package/.yalc/@node-dlc/messaging/lib/validation/validate.ts +34 -0
  334. package/.yalc/@node-dlc/messaging/package.json +42 -0
  335. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_3_of_3_test.json +210 -0
  336. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_3_of_5_test.json +468 -0
  337. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_3_of_5_test.json +1517 -0
  338. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_5_of_5_test.json +545 -0
  339. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_with_diff_3_of_5_test.json +4761 -0
  340. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_with_diff_5_of_5_test.json +2169 -0
  341. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_single_oracle_test.json +164 -0
  342. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/single_oracle_numerical_hyperbola_test.json +502 -0
  343. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/single_oracle_numerical_test.json +262 -0
  344. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_five_oracle_numerical_with_diff_test.json +4382 -0
  345. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_three_oracle_numerical_test.json +324 -0
  346. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_three_oracle_numerical_with_diff_test.json +652 -0
  347. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/two_of_five_oracle_numerical_test.json +1138 -0
  348. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/two_of_five_oracle_numerical_with_diff_test.json +2222 -0
  349. package/.yalc/@node-dlc/messaging/test_vectors/oracle/external_oracle_announcements.json +0 -0
  350. package/.yalc/@node-dlc/messaging/test_vectors/oracle/oracle_message_test_vectors.json +115 -0
  351. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/accept_msg.json +1465 -0
  352. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_fee_test.json +12362 -0
  353. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_fee_test_scripts.json +57 -0
  354. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_test.json +2766 -0
  355. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_tx_test.json +2899 -0
  356. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/offer_msg.json +163 -0
  357. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/offer_msg_disjoint.json +352 -0
  358. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/segment_chunk_msg.json +12635 -0
  359. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/segment_start_msg.json +4022 -0
  360. package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/sign_msg.json +383 -0
  361. package/.yalc/@node-dlc/messaging/tsconfig.json +7 -0
  362. package/.yalc/@node-dlc/messaging/yalc.sig +1 -0
  363. package/CHANGELOG.md +72 -0
  364. package/dist/BitcoinDlcProvider.d.ts +17 -16
  365. package/dist/BitcoinDlcProvider.js +345 -315
  366. package/dist/BitcoinDlcProvider.js.map +1 -1
  367. package/dist/utils/Utils.d.ts +6 -6
  368. package/dist/utils/Utils.js +4 -4
  369. package/dist/utils/Utils.js.map +1 -1
  370. package/lib/BitcoinDlcProvider.ts +624 -612
  371. package/lib/utils/Utils.ts +19 -24
  372. package/package.json +10 -10
  373. package/yalc.lock +10 -0
@@ -0,0 +1,390 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OracleInfoV0 = exports.OracleInfo = exports.MultiOracleInfo = exports.SingleOracleInfo = exports.OracleParams = void 0;
4
+ const bufio_1 = require("@node-dlc/bufio");
5
+ const MessageType_1 = require("../MessageType");
6
+ const getTlv_1 = require("../serialize/getTlv");
7
+ const OracleAnnouncement_1 = require("./OracleAnnouncement");
8
+ /**
9
+ * OracleParams describe allowed differences between oracles in
10
+ * numerical outcome contracts, as per rust-dlc specification.
11
+ */
12
+ class OracleParams {
13
+ constructor() {
14
+ this.type = OracleParams.type;
15
+ }
16
+ /**
17
+ * Creates an OracleParams from JSON data
18
+ * @param json JSON object representing oracle params
19
+ */
20
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
21
+ static fromJSON(json) {
22
+ const instance = new OracleParams();
23
+ instance.maxErrorExp = json.maxErrorExp || json.max_error_exp || 0;
24
+ instance.minFailExp = json.minFailExp || json.min_fail_exp || 0;
25
+ instance.maximizeCoverage =
26
+ json.maximizeCoverage || json.maximize_coverage || false;
27
+ return instance;
28
+ }
29
+ /**
30
+ * Deserializes oracle_params_v0 message
31
+ */
32
+ static deserialize(buf) {
33
+ const instance = new OracleParams();
34
+ const reader = new bufio_1.BufferReader(buf);
35
+ reader.readBigSize(); // read type
36
+ instance.length = reader.readBigSize();
37
+ instance.maxErrorExp = reader.readUInt16BE();
38
+ instance.minFailExp = reader.readUInt16BE();
39
+ instance.maximizeCoverage = reader.readUInt8() === 1;
40
+ return instance;
41
+ }
42
+ /**
43
+ * Deserializes oracle params body without TLV wrapper (for optional deserialization)
44
+ */
45
+ static deserializeBody(buf) {
46
+ const instance = new OracleParams();
47
+ const reader = new bufio_1.BufferReader(buf);
48
+ // No type/length to read - just the body content
49
+ instance.maxErrorExp = reader.readUInt16BE();
50
+ instance.minFailExp = reader.readUInt16BE();
51
+ instance.maximizeCoverage = reader.readUInt8() === 1;
52
+ return instance;
53
+ }
54
+ validate() {
55
+ if (this.maxErrorExp < 0) {
56
+ throw new Error('maxErrorExp must be greater than or equal to 0');
57
+ }
58
+ if (this.minFailExp < 0) {
59
+ throw new Error('minFailExp must be greater than or equal to 0');
60
+ }
61
+ if (this.maxErrorExp >= this.minFailExp) {
62
+ throw new Error('maxErrorExp must be less than minFailExp');
63
+ }
64
+ }
65
+ toJSON() {
66
+ return {
67
+ maxErrorExp: this.maxErrorExp,
68
+ minFailExp: this.minFailExp,
69
+ maximizeCoverage: this.maximizeCoverage,
70
+ };
71
+ }
72
+ serialize() {
73
+ const writer = new bufio_1.BufferWriter();
74
+ writer.writeBigSize(this.type);
75
+ const dataWriter = new bufio_1.BufferWriter();
76
+ dataWriter.writeUInt16BE(this.maxErrorExp);
77
+ dataWriter.writeUInt16BE(this.minFailExp);
78
+ dataWriter.writeUInt8(this.maximizeCoverage ? 1 : 0);
79
+ writer.writeBigSize(dataWriter.size);
80
+ writer.writeBytes(dataWriter.toBuffer());
81
+ return writer.toBuffer();
82
+ }
83
+ /**
84
+ * Serializes the oracle params body without TLV wrapper (for optional serialization)
85
+ */
86
+ serializeBody() {
87
+ const writer = new bufio_1.BufferWriter();
88
+ writer.writeUInt16BE(this.maxErrorExp);
89
+ writer.writeUInt16BE(this.minFailExp);
90
+ writer.writeUInt8(this.maximizeCoverage ? 1 : 0);
91
+ return writer.toBuffer();
92
+ }
93
+ }
94
+ exports.OracleParams = OracleParams;
95
+ OracleParams.type = MessageType_1.MessageType.OracleParamsV0;
96
+ /**
97
+ * SingleOracleInfo contains information about a single oracle.
98
+ */
99
+ class SingleOracleInfo {
100
+ constructor() {
101
+ this.type = SingleOracleInfo.type;
102
+ }
103
+ /**
104
+ * Creates a SingleOracleInfo from JSON data
105
+ * @param json JSON object representing single oracle info
106
+ */
107
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
108
+ static fromJSON(json) {
109
+ const instance = new SingleOracleInfo();
110
+ const announcementData = json.announcement || json.oracleAnnouncement;
111
+ if (!announcementData) {
112
+ throw new Error('announcement or oracleAnnouncement is required for single oracle info');
113
+ }
114
+ // Parse announcement using proper fromJSON method
115
+ instance.announcement = OracleAnnouncement_1.OracleAnnouncement.fromJSON(announcementData);
116
+ return instance;
117
+ }
118
+ /**
119
+ * Deserializes single oracle info
120
+ */
121
+ static deserialize(buf) {
122
+ const instance = new SingleOracleInfo();
123
+ const reader = new bufio_1.BufferReader(buf);
124
+ // Read the type and length that serialize() writes
125
+ reader.readBigSize(); // read type
126
+ instance.length = reader.readBigSize(); // read length
127
+ // Read the announcement data
128
+ instance.announcement = OracleAnnouncement_1.OracleAnnouncement.deserialize(reader.readBytes(Number(instance.length)));
129
+ return instance;
130
+ }
131
+ /**
132
+ * Returns the closest maturity date amongst all events
133
+ */
134
+ getClosestMaturityDate() {
135
+ return this.announcement.oracleEvent.eventMaturityEpoch;
136
+ }
137
+ validate() {
138
+ this.announcement.validate();
139
+ }
140
+ toJSON() {
141
+ // Return enum variant format for Rust compatibility
142
+ return {
143
+ single: {
144
+ oracleAnnouncement: this.announcement.toJSON(),
145
+ },
146
+ };
147
+ }
148
+ serialize() {
149
+ const writer = new bufio_1.BufferWriter();
150
+ writer.writeBigSize(this.type);
151
+ const dataWriter = new bufio_1.BufferWriter();
152
+ dataWriter.writeBytes(this.announcement.serialize());
153
+ writer.writeBigSize(dataWriter.size);
154
+ writer.writeBytes(dataWriter.toBuffer());
155
+ return writer.toBuffer();
156
+ }
157
+ /**
158
+ * Serializes the body without TLV wrapper (for embedding in ContractInfo)
159
+ * This matches rust-dlc behavior where OracleInfo.write() doesn't add type_id
160
+ */
161
+ serializeBody() {
162
+ return this.announcement.serialize();
163
+ }
164
+ /**
165
+ * Deserializes the body without TLV wrapper (for embedding in ContractInfo)
166
+ * This matches rust-dlc behavior where OracleInfo is read without type_id
167
+ */
168
+ static deserializeBody(buf) {
169
+ const instance = new SingleOracleInfo();
170
+ // No type/length to read - just the announcement data directly
171
+ instance.announcement = OracleAnnouncement_1.OracleAnnouncement.deserialize(buf);
172
+ return instance;
173
+ }
174
+ }
175
+ exports.SingleOracleInfo = SingleOracleInfo;
176
+ SingleOracleInfo.type = MessageType_1.MessageType.SingleOracleInfo;
177
+ /**
178
+ * MultiOracleInfo contains information about multiple oracles used in multi-oracle based contracts.
179
+ */
180
+ class MultiOracleInfo {
181
+ constructor() {
182
+ this.type = MultiOracleInfo.type;
183
+ /** The set of oracle announcements. */
184
+ this.announcements = [];
185
+ }
186
+ /**
187
+ * Creates a MultiOracleInfo from JSON data
188
+ * @param json JSON object representing multi oracle info
189
+ */
190
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
191
+ static fromJSON(json) {
192
+ const instance = new MultiOracleInfo();
193
+ instance.threshold = json.threshold || 1;
194
+ // Parse oracle announcements using proper fromJSON method
195
+ const announcements = json.oracleAnnouncements || json.oracle_announcements || [];
196
+ instance.announcements = announcements.map((announcementJson) => OracleAnnouncement_1.OracleAnnouncement.fromJSON(announcementJson));
197
+ // Parse oracle params if present (null means explicitly absent)
198
+ const oracleParamsData = json.oracleParams || json.oracle_params;
199
+ if (oracleParamsData !== null && oracleParamsData !== undefined) {
200
+ // Create OracleParams from JSON data using the fromJSON method
201
+ instance.oracleParams = OracleParams.fromJSON(oracleParamsData);
202
+ }
203
+ else {
204
+ // Explicitly null/undefined - will serialize as 00 (not present)
205
+ instance.oracleParams = undefined;
206
+ }
207
+ return instance;
208
+ }
209
+ /**
210
+ * Deserializes multi oracle info
211
+ */
212
+ static deserialize(buf) {
213
+ const instance = new MultiOracleInfo();
214
+ const reader = new bufio_1.BufferReader(buf);
215
+ // Read the type and length that serialize() writes
216
+ reader.readBigSize(); // read type
217
+ instance.length = reader.readBigSize(); // read length
218
+ // In rust-dlc format, MultiOracleInfo body is: threshold + announcements + optional oracle params
219
+ instance.threshold = reader.readUInt16BE();
220
+ const numAnnouncements = Number(reader.readBigSize()); // Changed from readUInt16BE to readBigSize to match rust-dlc vec_cb
221
+ for (let i = 0; i < numAnnouncements; i++) {
222
+ instance.announcements.push(OracleAnnouncement_1.OracleAnnouncement.deserialize((0, getTlv_1.getTlv)(reader)));
223
+ }
224
+ // Optional oracle params using Optional sub-type format
225
+ const oracleParamsData = reader.readOptional();
226
+ if (oracleParamsData) {
227
+ instance.oracleParams = OracleParams.deserializeBody(oracleParamsData);
228
+ }
229
+ return instance;
230
+ }
231
+ validate() {
232
+ if (this.threshold <= 0) {
233
+ throw new Error('threshold must be greater than 0');
234
+ }
235
+ if (this.threshold > this.announcements.length) {
236
+ throw new Error('threshold cannot be greater than number of announcements');
237
+ }
238
+ if (this.announcements.length === 0) {
239
+ throw new Error('must have at least one announcement');
240
+ }
241
+ // Validate all announcements
242
+ this.announcements.forEach((announcement) => announcement.validate());
243
+ // Validate oracle params if present
244
+ if (this.oracleParams) {
245
+ this.oracleParams.validate();
246
+ }
247
+ }
248
+ /**
249
+ * Returns the closest maturity date amongst all events
250
+ */
251
+ getClosestMaturityDate() {
252
+ return Math.min(...this.announcements.map((a) => a.oracleEvent.eventMaturityEpoch));
253
+ }
254
+ toJSON() {
255
+ // Return enum variant format for Rust compatibility
256
+ return {
257
+ multi: {
258
+ threshold: this.threshold,
259
+ oracleAnnouncements: this.announcements.map((a) => a.toJSON()),
260
+ oracleParams: this.oracleParams?.toJSON(),
261
+ },
262
+ };
263
+ }
264
+ serialize() {
265
+ const writer = new bufio_1.BufferWriter();
266
+ // writer.writeBigSize(this.type);
267
+ const dataWriter = new bufio_1.BufferWriter();
268
+ dataWriter.writeUInt16BE(this.threshold);
269
+ dataWriter.writeBigSize(this.announcements.length); // Changed from writeUInt16BE to writeBigSize to match rust-dlc vec_cb
270
+ for (const announcement of this.announcements) {
271
+ dataWriter.writeBytes(announcement.serialize());
272
+ }
273
+ // Use Optional serialization for oracle params (body content only, not TLV wrapped)
274
+ const oracleParamsData = this.oracleParams
275
+ ? this.oracleParams.serializeBody()
276
+ : null;
277
+ dataWriter.writeOptional(oracleParamsData);
278
+ // writer.writeBigSize(dataWriter.size);
279
+ writer.writeBytes(dataWriter.toBuffer());
280
+ return writer.toBuffer();
281
+ }
282
+ /**
283
+ * Serializes the body without TLV wrapper (for embedding in ContractInfo)
284
+ * This matches rust-dlc behavior where OracleInfo.write() doesn't add type_id
285
+ */
286
+ serializeBody() {
287
+ const writer = new bufio_1.BufferWriter();
288
+ writer.writeUInt16BE(this.threshold);
289
+ writer.writeBigSize(this.announcements.length); // Changed from writeUInt16BE to writeBigSize to match rust-dlc vec_cb
290
+ for (const announcement of this.announcements) {
291
+ writer.writeBytes(announcement.serialize());
292
+ }
293
+ // Use Optional serialization for oracle params (body content only, not TLV wrapped)
294
+ const oracleParamsData = this.oracleParams
295
+ ? this.oracleParams.serializeBody()
296
+ : null;
297
+ writer.writeOptional(oracleParamsData);
298
+ return writer.toBuffer();
299
+ }
300
+ /**
301
+ * Deserializes the body without TLV wrapper (for embedding in ContractInfo)
302
+ * This matches rust-dlc behavior where OracleInfo is read without type_id
303
+ */
304
+ static deserializeBody(buf) {
305
+ const instance = new MultiOracleInfo();
306
+ const reader = new bufio_1.BufferReader(buf);
307
+ // No type/length to read - directly read the multi-oracle body
308
+ instance.threshold = reader.readUInt16BE();
309
+ const numAnnouncements = Number(reader.readBigSize()); // BigSize for announcements count
310
+ for (let i = 0; i < numAnnouncements; i++) {
311
+ instance.announcements.push(OracleAnnouncement_1.OracleAnnouncement.deserialize((0, getTlv_1.getTlv)(reader)));
312
+ }
313
+ // Optional oracle params using Optional sub-type format
314
+ const oracleParamsData = reader.readOptional();
315
+ if (oracleParamsData) {
316
+ instance.oracleParams = OracleParams.deserializeBody(oracleParamsData);
317
+ }
318
+ return instance;
319
+ }
320
+ }
321
+ exports.MultiOracleInfo = MultiOracleInfo;
322
+ MultiOracleInfo.type = MessageType_1.MessageType.MultiOracleInfo;
323
+ /**
324
+ * OracleInfo contains information about the oracles to be used in
325
+ * executing a DLC. Updated to support both single and multi-oracle
326
+ * patterns as per rust-dlc specification.
327
+ */
328
+ class OracleInfo {
329
+ static deserialize(buf) {
330
+ const reader = new bufio_1.BufferReader(buf);
331
+ const type = Number(reader.readBigSize());
332
+ switch (type) {
333
+ case MessageType_1.MessageType.SingleOracleInfo:
334
+ return SingleOracleInfo.deserialize(buf);
335
+ case MessageType_1.MessageType.MultiOracleInfo:
336
+ return MultiOracleInfo.deserialize(buf);
337
+ default:
338
+ throw new Error(`Unknown oracle info type: ${type}`);
339
+ }
340
+ }
341
+ /**
342
+ * Creates an OracleInfo from JSON data (e.g., from test vectors)
343
+ * @param json JSON object representing oracle info
344
+ */
345
+ static fromJSON(json) {
346
+ if (!json) {
347
+ throw new Error('oracleInfo is required');
348
+ }
349
+ // Handle direct single oracle (legacy format)
350
+ if (json.announcement) {
351
+ return SingleOracleInfo.fromJSON(json);
352
+ }
353
+ // Handle wrapped single oracle
354
+ else if (json.single) {
355
+ return SingleOracleInfo.fromJSON(json.single);
356
+ }
357
+ // Handle multi oracle
358
+ else if (json.multi) {
359
+ return MultiOracleInfo.fromJSON(json.multi);
360
+ }
361
+ else {
362
+ throw new Error('oracleInfo must have either announcement, single, or multi');
363
+ }
364
+ }
365
+ /**
366
+ * Returns the closest maturity date amongst all events
367
+ */
368
+ getClosestMaturityDate() {
369
+ if (this instanceof SingleOracleInfo) {
370
+ return this.announcement.oracleEvent.eventMaturityEpoch;
371
+ }
372
+ else if (this instanceof MultiOracleInfo) {
373
+ return this.getClosestMaturityDate();
374
+ }
375
+ throw new Error('Unknown oracle info type');
376
+ }
377
+ }
378
+ exports.OracleInfo = OracleInfo;
379
+ // For backward compatibility, keep the V0 class as alias to SingleOracleInfo
380
+ class OracleInfoV0 extends SingleOracleInfo {
381
+ /**
382
+ * Creates an OracleInfoV0 from JSON data (alias for SingleOracleInfo.fromJSON)
383
+ * @param json JSON object representing oracle info
384
+ */
385
+ static fromJSON(json) {
386
+ return SingleOracleInfo.fromJSON(json);
387
+ }
388
+ }
389
+ exports.OracleInfoV0 = OracleInfoV0;
390
+ //# sourceMappingURL=OracleInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OracleInfo.js","sourceRoot":"","sources":["../../lib/messages/OracleInfo.ts"],"names":[],"mappings":";;;AAAA,2CAA6D;AAE7D,gDAA6C;AAC7C,gDAA6C;AAE7C,6DAG8B;AAE9B;;;GAGG;AACH,MAAa,YAAY;IAAzB;QAgDS,SAAI,GAAG,YAAY,CAAC,IAAI,CAAC;IAyDlC,CAAC;IAtGC;;;OAGG;IACH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I,KAAK,CACb,4DAA4D,CAC7D,CAAC;SACH;IACH,CAAC;IAQD;;OAEG;IACI,sBAAsB;QAC3B,IAAI,IAAI,YAAY,gBAAgB,EAAE;YACpC,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,kBAAkB,CAAC;SACzD;aAAM,IAAI,IAAI,YAAY,eAAe,EAAE;YAC1C,OAAO,IAAI,CAAC,sBAAsB,EAAE,CAAC;SACtC;QACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;CACF;AA3DD,gCA2DC;AAED,6EAA6E;AAC7E,MAAa,YAAa,SAAQ,gBAAgB;IAChD;;;OAGG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAS;QAC9B,OAAO,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAiB,CAAC;IACzD,CAAC;CACF;AARD,oCAQC"}
@@ -0,0 +1,161 @@
1
+ /// <reference types="node" />
2
+ import { MessageType } from '../MessageType';
3
+ import { IDlcMessage } from './DlcMessage';
4
+ import { OracleAnnouncement, OracleAnnouncementJSON } from './OracleAnnouncement';
5
+ /**
6
+ * OracleParams describe allowed differences between oracles in
7
+ * numerical outcome contracts, as per rust-dlc specification.
8
+ */
9
+ export declare class OracleParams implements IDlcMessage {
10
+ static type: MessageType;
11
+ /**
12
+ * Creates an OracleParams from JSON data
13
+ * @param json JSON object representing oracle params
14
+ */
15
+ static fromJSON(json: any): OracleParams;
16
+ /**
17
+ * Deserializes oracle_params_v0 message
18
+ */
19
+ static deserialize(buf: Buffer): OracleParams;
20
+ /**
21
+ * Deserializes oracle params body without TLV wrapper (for optional deserialization)
22
+ */
23
+ static deserializeBody(buf: Buffer): OracleParams;
24
+ type: MessageType;
25
+ length: bigint;
26
+ /** The maximum allowed difference between oracle expressed as a power of 2. */
27
+ maxErrorExp: number;
28
+ /** The minimum allowed difference that should be supported by the contract expressed as a power of 2. */
29
+ minFailExp: number;
30
+ /** Whether to maximize coverage of the interval between maxErrorExp and minFailExp. */
31
+ maximizeCoverage: boolean;
32
+ validate(): void;
33
+ toJSON(): OracleParamsJSON;
34
+ serialize(): Buffer;
35
+ /**
36
+ * Serializes the oracle params body without TLV wrapper (for optional serialization)
37
+ */
38
+ serializeBody(): Buffer;
39
+ }
40
+ /**
41
+ * SingleOracleInfo contains information about a single oracle.
42
+ */
43
+ export declare class SingleOracleInfo implements IDlcMessage {
44
+ static type: MessageType;
45
+ /**
46
+ * Creates a SingleOracleInfo from JSON data
47
+ * @param json JSON object representing single oracle info
48
+ */
49
+ static fromJSON(json: any): SingleOracleInfo;
50
+ /**
51
+ * Deserializes single oracle info
52
+ */
53
+ static deserialize(buf: Buffer): SingleOracleInfo;
54
+ type: MessageType;
55
+ length: bigint;
56
+ /** The oracle announcement from the oracle. */
57
+ announcement: OracleAnnouncement;
58
+ /**
59
+ * Returns the closest maturity date amongst all events
60
+ */
61
+ getClosestMaturityDate(): number;
62
+ validate(): void;
63
+ toJSON(): SingleOracleInfoJSON;
64
+ serialize(): Buffer;
65
+ /**
66
+ * Serializes the body without TLV wrapper (for embedding in ContractInfo)
67
+ * This matches rust-dlc behavior where OracleInfo.write() doesn't add type_id
68
+ */
69
+ serializeBody(): Buffer;
70
+ /**
71
+ * Deserializes the body without TLV wrapper (for embedding in ContractInfo)
72
+ * This matches rust-dlc behavior where OracleInfo is read without type_id
73
+ */
74
+ static deserializeBody(buf: Buffer): SingleOracleInfo;
75
+ }
76
+ /**
77
+ * MultiOracleInfo contains information about multiple oracles used in multi-oracle based contracts.
78
+ */
79
+ export declare class MultiOracleInfo implements IDlcMessage {
80
+ static type: MessageType;
81
+ /**
82
+ * Creates a MultiOracleInfo from JSON data
83
+ * @param json JSON object representing multi oracle info
84
+ */
85
+ static fromJSON(json: any): MultiOracleInfo;
86
+ /**
87
+ * Deserializes multi oracle info
88
+ */
89
+ static deserialize(buf: Buffer): MultiOracleInfo;
90
+ type: MessageType;
91
+ length: bigint;
92
+ /** The threshold to be used for the contract (e.g. 2 of 3). */
93
+ threshold: number;
94
+ /** The set of oracle announcements. */
95
+ announcements: OracleAnnouncement[];
96
+ /** The parameters to be used when allowing differences between oracle outcomes in numerical outcome contracts. */
97
+ oracleParams?: OracleParams;
98
+ validate(): void;
99
+ /**
100
+ * Returns the closest maturity date amongst all events
101
+ */
102
+ getClosestMaturityDate(): number;
103
+ toJSON(): MultiOracleInfoJSON;
104
+ serialize(): Buffer;
105
+ /**
106
+ * Serializes the body without TLV wrapper (for embedding in ContractInfo)
107
+ * This matches rust-dlc behavior where OracleInfo.write() doesn't add type_id
108
+ */
109
+ serializeBody(): Buffer;
110
+ /**
111
+ * Deserializes the body without TLV wrapper (for embedding in ContractInfo)
112
+ * This matches rust-dlc behavior where OracleInfo is read without type_id
113
+ */
114
+ static deserializeBody(buf: Buffer): MultiOracleInfo;
115
+ }
116
+ /**
117
+ * OracleInfo contains information about the oracles to be used in
118
+ * executing a DLC. Updated to support both single and multi-oracle
119
+ * patterns as per rust-dlc specification.
120
+ */
121
+ export declare abstract class OracleInfo implements IDlcMessage {
122
+ static deserialize(buf: Buffer): SingleOracleInfo | MultiOracleInfo;
123
+ /**
124
+ * Creates an OracleInfo from JSON data (e.g., from test vectors)
125
+ * @param json JSON object representing oracle info
126
+ */
127
+ static fromJSON(json: any): OracleInfo;
128
+ abstract type: number;
129
+ abstract validate(): void;
130
+ abstract toJSON(): SingleOracleInfoJSON | MultiOracleInfoJSON;
131
+ abstract serialize(): Buffer;
132
+ abstract serializeBody(): Buffer;
133
+ /**
134
+ * Returns the closest maturity date amongst all events
135
+ */
136
+ getClosestMaturityDate(): number;
137
+ }
138
+ export declare class OracleInfoV0 extends SingleOracleInfo {
139
+ /**
140
+ * Creates an OracleInfoV0 from JSON data (alias for SingleOracleInfo.fromJSON)
141
+ * @param json JSON object representing oracle info
142
+ */
143
+ static fromJSON(json: any): OracleInfoV0;
144
+ }
145
+ export interface OracleParamsJSON {
146
+ type?: number;
147
+ maxErrorExp: number;
148
+ minFailExp: number;
149
+ maximizeCoverage: boolean;
150
+ }
151
+ export interface SingleOracleInfoJSON {
152
+ type?: number;
153
+ announcement: OracleAnnouncementJSON;
154
+ }
155
+ export interface MultiOracleInfoJSON {
156
+ type?: number;
157
+ threshold: number;
158
+ announcements: OracleAnnouncementJSON[];
159
+ oracleParams?: OracleParamsJSON;
160
+ }
161
+ export type OracleInfoV0JSON = SingleOracleInfoJSON;