@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.
- package/.nvmrc +1 -1
- package/.turbo/turbo-build.log +1 -0
- package/.turbo/turbo-test.log +0 -0
- package/.yalc/@node-dlc/messaging/.nyc_output/2cf48009-1094-4275-bb91-c164c932feb6.json +1 -0
- package/.yalc/@node-dlc/messaging/.nyc_output/processinfo/2cf48009-1094-4275-bb91-c164c932feb6.json +1 -0
- package/.yalc/@node-dlc/messaging/.nyc_output/processinfo/index.json +1 -0
- package/.yalc/@node-dlc/messaging/README.md +24 -0
- package/.yalc/@node-dlc/messaging/__tests__/_test-utils.ts +12 -0
- package/.yalc/@node-dlc/messaging/__tests__/chain/ChainManager.spec.ts +178 -0
- package/.yalc/@node-dlc/messaging/__tests__/compatibility/dlcspecs-compatibility.spec.ts +473 -0
- package/.yalc/@node-dlc/messaging/__tests__/compatibility/rust-dlc-cross-language.spec.ts +342 -0
- package/.yalc/@node-dlc/messaging/__tests__/compatibility/true-serialization-compatibility.spec.ts +611 -0
- package/.yalc/@node-dlc/messaging/__tests__/dlc_message_test.json +155 -0
- package/.yalc/@node-dlc/messaging/__tests__/irc/IrcMessage.spec.ts +94 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/AddressCache.spec.ts +79 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/BatchFundingGroup.spec.ts +72 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/CetAdaptorSignatures.spec.ts +57 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/ContractDescriptor.spec.ts +264 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/ContractInfo.spec.ts +419 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/DigitDecompositionEventDescriptor.spec.ts +59 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/DlcAccept.spec.ts +242 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/DlcCancel.spec.ts +42 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/DlcClose.spec.ts +315 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/DlcOffer.spec.ts +527 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/DlcSign.spec.ts +118 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/DlcTransactions.spec.ts +157 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/EnumEventDescriptor.spec.ts +50 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/EventDescriptor.spec.ts +93 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/FundingInput.spec.ts +84 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/FundingSignatures.spec.ts +83 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/NegotiationFields.spec.ts +328 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/NodeAnnouncementMessage.spec.ts +115 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/OracleAnnouncement.spec.ts +415 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/OracleAttestation.spec.ts +326 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/OracleEvent.spec.ts +143 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/OracleEventContainer.spec.ts +95 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/OracleIdentifier.spec.ts +48 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/OracleInfo.spec.ts +116 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/OrderAccept.spec.ts +77 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/OrderNegotiationFields.spec.ts +216 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/OrderOffer.spec.ts +121 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/OrderPositionInfo.spec.ts +75 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/PayoutCurvePiece.spec.ts +220 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/PayoutFunction.spec.ts +101 -0
- package/.yalc/@node-dlc/messaging/__tests__/messages/RoundingIntervals.spec.ts +75 -0
- package/.yalc/@node-dlc/messaging/__tests__/serialize/F64.spec.ts +260 -0
- package/.yalc/@node-dlc/messaging/__tests__/tsconfig.json +8 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/base.css +224 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/block-navigation.js +79 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/favicon.png +0 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/index.html +201 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/MessageType.ts.html +494 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/ChainManager.ts.html +1058 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/ChainMemoryStore.ts.html +182 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/index.html +126 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/domain/Address.ts.html +272 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/domain/index.html +111 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/index.html +141 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/index.ts.html +212 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/irc/IrcMessage.ts.html +563 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/irc/index.html +111 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/AddressCache.ts.html +302 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/BatchFundingGroup.ts.html +503 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/CetAdaptorSignatures.ts.html +347 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/CetAdaptorSignaturesV0.ts.html +347 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ContractDescriptor.ts.html +1040 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ContractInfo.ts.html +1382 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcAccept.ts.html +1865 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcCancel.ts.html +251 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcClose.ts.html +986 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcCloseMetadata.ts.html +443 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcIds.ts.html +281 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcInfo.ts.html +323 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcMessage.ts.html +341 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcOffer.ts.html +1895 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcSign.ts.html +1142 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcTransactions.ts.html +719 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/EventDescriptor.ts.html +947 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingInput.ts.html +728 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingSignatures.ts.html +374 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingSignaturesV0.ts.html +374 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/NegotiationFields.ts.html +836 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/NodeAnnouncementMessage.ts.html +515 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAnnouncement.ts.html +608 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAnnouncementV0.ts.html +605 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAttestation.ts.html +956 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAttestationV0.ts.html +770 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEvent.ts.html +830 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventContainer.ts.html +347 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventContainerV0.ts.html +347 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventV0.ts.html +827 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleIdentifier.ts.html +314 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleIdentifierV0.ts.html +314 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleInfo.ts.html +1637 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleInfoV0.ts.html +1631 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderAccept.ts.html +557 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderIrcInfo.ts.html +380 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderMetadata.ts.html +437 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderNegotiationFields.ts.html +551 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderOffer.ts.html +1337 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderPositionInfo.ts.html +590 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/PayoutCurvePiece.ts.html +1427 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/PayoutFunction.ts.html +800 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/RoundingIntervals.ts.html +461 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/RoundingIntervalsV0.ts.html +482 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ScriptWitnessV0.ts.html +269 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/index.html +636 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serde/SerdeUtils.ts.html +1394 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serde/index.html +111 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/F64.ts.html +1136 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/deserializeTlv.ts.html +125 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/getTlv.ts.html +143 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/index.html +141 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/util.ts.html +179 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/validation/index.html +111 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/validation/validate.ts.html +182 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/prettify.css +1 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/prettify.js +2 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov-report/sorter.js +170 -0
- package/.yalc/@node-dlc/messaging/coverage/lcov.info +5394 -0
- package/.yalc/@node-dlc/messaging/dist/MessageType.d.ts +100 -0
- package/.yalc/@node-dlc/messaging/dist/MessageType.js +117 -0
- package/.yalc/@node-dlc/messaging/dist/MessageType.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.d.ts +50 -0
- package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.js +211 -0
- package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/chain/ChainMemoryStore.d.ts +14 -0
- package/.yalc/@node-dlc/messaging/dist/chain/ChainMemoryStore.js +28 -0
- package/.yalc/@node-dlc/messaging/dist/chain/ChainMemoryStore.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/chain/DlcStore.d.ts +11 -0
- package/.yalc/@node-dlc/messaging/dist/chain/DlcStore.js +3 -0
- package/.yalc/@node-dlc/messaging/dist/chain/DlcStore.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/chain/IChainFilterChainClient.d.ts +48 -0
- package/.yalc/@node-dlc/messaging/dist/chain/IChainFilterChainClient.js +3 -0
- package/.yalc/@node-dlc/messaging/dist/chain/IChainFilterChainClient.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/domain/Address.d.ts +24 -0
- package/.yalc/@node-dlc/messaging/dist/domain/Address.js +46 -0
- package/.yalc/@node-dlc/messaging/dist/domain/Address.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/index.d.ts +44 -0
- package/.yalc/@node-dlc/messaging/dist/index.js +63 -0
- package/.yalc/@node-dlc/messaging/dist/index.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/irc/IrcMessage.d.ts +43 -0
- package/.yalc/@node-dlc/messaging/dist/irc/IrcMessage.js +116 -0
- package/.yalc/@node-dlc/messaging/dist/irc/IrcMessage.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/AddressCache.d.ts +15 -0
- package/.yalc/@node-dlc/messaging/dist/messages/AddressCache.js +51 -0
- package/.yalc/@node-dlc/messaging/dist/messages/AddressCache.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/BatchFundingGroup.d.ts +61 -0
- package/.yalc/@node-dlc/messaging/dist/messages/BatchFundingGroup.js +113 -0
- package/.yalc/@node-dlc/messaging/dist/messages/BatchFundingGroup.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignatures.d.ts +40 -0
- package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignatures.js +67 -0
- package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignatures.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.d.ts +122 -0
- package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.js +222 -0
- package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.d.ts +135 -0
- package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.js +304 -0
- package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.d.ts +145 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.js +428 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcCancel.d.ts +31 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcCancel.js +51 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcCancel.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.d.ts +68 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.js +210 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcCloseMetadata.d.ts +44 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcCloseMetadata.js +74 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcCloseMetadata.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcIds.d.ts +26 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcIds.js +58 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcIds.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcInfo.d.ts +31 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcInfo.js +61 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcInfo.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcMessage.d.ts +23 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcMessage.js +54 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcMessage.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.d.ts +131 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.js +418 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.d.ts +96 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.js +267 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcTransactions.d.ts +69 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcTransactions.js +149 -0
- package/.yalc/@node-dlc/messaging/dist/messages/DlcTransactions.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.d.ts +106 -0
- package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.js +209 -0
- package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.d.ts +62 -0
- package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.js +163 -0
- package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/FundingSignatures.d.ts +36 -0
- package/.yalc/@node-dlc/messaging/dist/messages/FundingSignatures.js +78 -0
- package/.yalc/@node-dlc/messaging/dist/messages/FundingSignatures.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/IWireMessage.d.ts +6 -0
- package/.yalc/@node-dlc/messaging/dist/messages/IWireMessage.js +3 -0
- package/.yalc/@node-dlc/messaging/dist/messages/IWireMessage.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.d.ts +86 -0
- package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.js +185 -0
- package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/NodeAnnouncementMessage.d.ts +57 -0
- package/.yalc/@node-dlc/messaging/dist/messages/NodeAnnouncementMessage.js +127 -0
- package/.yalc/@node-dlc/messaging/dist/messages/NodeAnnouncementMessage.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncement.d.ts +76 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncement.js +131 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncement.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestation.d.ts +68 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestation.js +239 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestation.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleEvent.d.ts +90 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleEvent.js +189 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleEvent.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainer.d.ts +32 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainer.js +67 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainer.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifier.d.ts +32 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifier.js +58 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifier.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifierV0.d.ts +32 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifierV0.js +58 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleIdentifierV0.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.d.ts +161 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.js +390 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.d.ts +161 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.js +387 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.d.ts +65 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.js +125 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderIrcInfo.d.ts +42 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderIrcInfo.js +74 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderIrcInfo.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderMetadata.d.ts +56 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderMetadata.js +87 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderMetadata.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.d.ts +69 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.js +114 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.d.ts +97 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.js +296 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.d.ts +50 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.js +125 -0
- package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.d.ts +129 -0
- package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.js +327 -0
- package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.d.ts +66 -0
- package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.js +170 -0
- package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.d.ts +52 -0
- package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.js +95 -0
- package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/ScriptWitnessV0.d.ts +29 -0
- package/.yalc/@node-dlc/messaging/dist/messages/ScriptWitnessV0.js +50 -0
- package/.yalc/@node-dlc/messaging/dist/messages/ScriptWitnessV0.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/messages/Tlv.d.ts +15 -0
- package/.yalc/@node-dlc/messaging/dist/messages/Tlv.js +32 -0
- package/.yalc/@node-dlc/messaging/dist/messages/Tlv.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/F64.d.ts +154 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/F64.js +307 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/F64.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/deserializeTlv.d.ts +9 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/deserializeTlv.js +11 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/deserializeTlv.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/getTlv.d.ts +4 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/getTlv.js +23 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/getTlv.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/readTlvs.d.ts +8 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/readTlvs.js +33 -0
- package/.yalc/@node-dlc/messaging/dist/serialize/readTlvs.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/util.d.ts +13 -0
- package/.yalc/@node-dlc/messaging/dist/util.js +40 -0
- package/.yalc/@node-dlc/messaging/dist/util.js.map +1 -0
- package/.yalc/@node-dlc/messaging/dist/validation/validate.d.ts +4 -0
- package/.yalc/@node-dlc/messaging/dist/validation/validate.js +31 -0
- package/.yalc/@node-dlc/messaging/dist/validation/validate.js.map +1 -0
- package/.yalc/@node-dlc/messaging/lib/MessageType.ts +138 -0
- package/.yalc/@node-dlc/messaging/lib/chain/ChainManager.ts +326 -0
- package/.yalc/@node-dlc/messaging/lib/chain/ChainMemoryStore.ts +34 -0
- package/.yalc/@node-dlc/messaging/lib/chain/DlcStore.ts +11 -0
- package/.yalc/@node-dlc/messaging/lib/chain/IChainFilterChainClient.ts +57 -0
- package/.yalc/@node-dlc/messaging/lib/domain/Address.ts +64 -0
- package/.yalc/@node-dlc/messaging/lib/index.ts +44 -0
- package/.yalc/@node-dlc/messaging/lib/irc/IrcMessage.ts +161 -0
- package/.yalc/@node-dlc/messaging/lib/messages/AddressCache.ts +74 -0
- package/.yalc/@node-dlc/messaging/lib/messages/BatchFundingGroup.ts +141 -0
- package/.yalc/@node-dlc/messaging/lib/messages/CetAdaptorSignatures.ts +89 -0
- package/.yalc/@node-dlc/messaging/lib/messages/ContractDescriptor.ts +318 -0
- package/.yalc/@node-dlc/messaging/lib/messages/ContractInfo.ts +434 -0
- package/.yalc/@node-dlc/messaging/lib/messages/DlcAccept.ts +595 -0
- package/.yalc/@node-dlc/messaging/lib/messages/DlcCancel.ts +57 -0
- package/.yalc/@node-dlc/messaging/lib/messages/DlcClose.ts +302 -0
- package/.yalc/@node-dlc/messaging/lib/messages/DlcCloseMetadata.ts +121 -0
- package/.yalc/@node-dlc/messaging/lib/messages/DlcIds.ts +67 -0
- package/.yalc/@node-dlc/messaging/lib/messages/DlcInfo.ts +81 -0
- package/.yalc/@node-dlc/messaging/lib/messages/DlcMessage.ts +87 -0
- package/.yalc/@node-dlc/messaging/lib/messages/DlcOffer.ts +605 -0
- package/.yalc/@node-dlc/messaging/lib/messages/DlcSign.ts +354 -0
- package/.yalc/@node-dlc/messaging/lib/messages/DlcTransactions.ts +213 -0
- package/.yalc/@node-dlc/messaging/lib/messages/EventDescriptor.ts +289 -0
- package/.yalc/@node-dlc/messaging/lib/messages/FundingInput.ts +216 -0
- package/.yalc/@node-dlc/messaging/lib/messages/FundingSignatures.ts +98 -0
- package/.yalc/@node-dlc/messaging/lib/messages/IWireMessage.ts +6 -0
- package/.yalc/@node-dlc/messaging/lib/messages/NegotiationFields.ts +252 -0
- package/.yalc/@node-dlc/messaging/lib/messages/NodeAnnouncementMessage.ts +145 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OracleAnnouncement.ts +176 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OracleAttestation.ts +292 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OracleEvent.ts +250 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OracleEventContainer.ts +89 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OracleIdentifier.ts +78 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OracleInfo.ts +519 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OrderAccept.ts +159 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OrderIrcInfo.ts +100 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OrderMetadata.ts +119 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OrderNegotiationFields.ts +157 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OrderOffer.ts +419 -0
- package/.yalc/@node-dlc/messaging/lib/messages/OrderPositionInfo.ts +170 -0
- package/.yalc/@node-dlc/messaging/lib/messages/PayoutCurvePiece.ts +449 -0
- package/.yalc/@node-dlc/messaging/lib/messages/PayoutFunction.ts +240 -0
- package/.yalc/@node-dlc/messaging/lib/messages/RoundingIntervals.ts +127 -0
- package/.yalc/@node-dlc/messaging/lib/messages/ScriptWitnessV0.ts +63 -0
- package/.yalc/@node-dlc/messaging/lib/messages/Tlv.ts +40 -0
- package/.yalc/@node-dlc/messaging/lib/serialize/F64.ts +352 -0
- package/.yalc/@node-dlc/messaging/lib/serialize/deserializeTlv.ts +15 -0
- package/.yalc/@node-dlc/messaging/lib/serialize/getTlv.ts +21 -0
- package/.yalc/@node-dlc/messaging/lib/serialize/readTlvs.ts +37 -0
- package/.yalc/@node-dlc/messaging/lib/util.ts +33 -0
- package/.yalc/@node-dlc/messaging/lib/validation/validate.ts +34 -0
- package/.yalc/@node-dlc/messaging/package.json +42 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_3_of_3_test.json +210 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_3_of_5_test.json +468 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_3_of_5_test.json +1517 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_5_of_5_test.json +545 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_with_diff_3_of_5_test.json +4761 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_with_diff_5_of_5_test.json +2169 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_single_oracle_test.json +164 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/single_oracle_numerical_hyperbola_test.json +502 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/single_oracle_numerical_test.json +262 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_five_oracle_numerical_with_diff_test.json +4382 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_three_oracle_numerical_test.json +324 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_three_oracle_numerical_with_diff_test.json +652 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/two_of_five_oracle_numerical_test.json +1138 -0
- package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/two_of_five_oracle_numerical_with_diff_test.json +2222 -0
- package/.yalc/@node-dlc/messaging/test_vectors/oracle/external_oracle_announcements.json +0 -0
- package/.yalc/@node-dlc/messaging/test_vectors/oracle/oracle_message_test_vectors.json +115 -0
- package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/accept_msg.json +1465 -0
- package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_fee_test.json +12362 -0
- package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_fee_test_scripts.json +57 -0
- package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_test.json +2766 -0
- package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/dlc_tx_test.json +2899 -0
- package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/offer_msg.json +163 -0
- package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/offer_msg_disjoint.json +352 -0
- package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/segment_chunk_msg.json +12635 -0
- package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/segment_start_msg.json +4022 -0
- package/.yalc/@node-dlc/messaging/test_vectors/rust-dlc/sign_msg.json +383 -0
- package/.yalc/@node-dlc/messaging/tsconfig.json +7 -0
- package/.yalc/@node-dlc/messaging/yalc.sig +1 -0
- package/CHANGELOG.md +83 -0
- package/dist/BitcoinDlcProvider.d.ts +17 -16
- package/dist/BitcoinDlcProvider.js +375 -317
- package/dist/BitcoinDlcProvider.js.map +1 -1
- package/dist/utils/Utils.d.ts +6 -6
- package/dist/utils/Utils.js +4 -4
- package/dist/utils/Utils.js.map +1 -1
- package/lib/BitcoinDlcProvider.ts +637 -621
- package/lib/utils/Utils.ts +19 -24
- package/package.json +13 -11
- package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,CAAC,OAAO,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,MAAM;QACX,OAAO;YACL,qBAAqB,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC3D,eAAe,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC;YAClD,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;SACvC,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,SAAS;QACd,MAAM,MAAM,GAAG,IAAI,oBAAY,EAAE,CAAC;QAClC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE/B,MAAM,UAAU,GAAG,IAAI,oBAAY,EAAE,CAAC;QACtC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5C,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC;QAEpD,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEzC,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;;AAhJH,gDAiJC;AAhJe,uBAAI,GAAG,yBAAW,CAAC,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { MessageType } from '../MessageType';
|
|
3
|
+
import { IDlcMessage } from './DlcMessage';
|
|
4
|
+
import { OracleAnnouncement } from './OracleAnnouncement';
|
|
5
|
+
/**
|
|
6
|
+
* Oracle attestation providing signatures over an outcome value.
|
|
7
|
+
* This represents the oracle's actual attestation to a specific outcome.
|
|
8
|
+
* Updated to match rust-dlc specification with 2-byte count prefixes.
|
|
9
|
+
*
|
|
10
|
+
* An attestation from an oracle providing signatures over an outcome value.
|
|
11
|
+
* This is what the oracle publishes when they want to attest to a specific outcome.
|
|
12
|
+
*/
|
|
13
|
+
export declare class OracleAttestation implements IDlcMessage {
|
|
14
|
+
static type: MessageType;
|
|
15
|
+
/**
|
|
16
|
+
* Deserializes an oracle_attestation message
|
|
17
|
+
* @param buf
|
|
18
|
+
*/
|
|
19
|
+
static deserialize(buf: Buffer): OracleAttestation;
|
|
20
|
+
/**
|
|
21
|
+
* The type for oracle_attestation message. oracle_attestation = 55400
|
|
22
|
+
*/
|
|
23
|
+
type: MessageType;
|
|
24
|
+
length: bigint;
|
|
25
|
+
/** The identifier of the announcement. */
|
|
26
|
+
eventId: string;
|
|
27
|
+
/** The public key of the oracle (32 bytes, x-only). */
|
|
28
|
+
oraclePubkey: Buffer;
|
|
29
|
+
/** The signatures over the event outcome (64 bytes each, Schnorr format). */
|
|
30
|
+
signatures: Buffer[];
|
|
31
|
+
/** The set of strings representing the outcome value. */
|
|
32
|
+
outcomes: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Validates the oracle attestation according to rust-dlc specification.
|
|
35
|
+
* This includes validating signatures and ensuring consistency with announcement.
|
|
36
|
+
* @param announcement The corresponding oracle announcement for validation (optional)
|
|
37
|
+
* @throws Will throw an error if validation fails
|
|
38
|
+
*/
|
|
39
|
+
validate(announcement?: OracleAnnouncement): void;
|
|
40
|
+
/**
|
|
41
|
+
* Validates the attestation against the corresponding oracle announcement.
|
|
42
|
+
* This ensures the attestation is consistent with the original announcement.
|
|
43
|
+
* @param announcement The oracle announcement to validate against
|
|
44
|
+
* @throws Will throw an error if validation fails
|
|
45
|
+
*/
|
|
46
|
+
private validateAgainstAnnouncement;
|
|
47
|
+
/**
|
|
48
|
+
* Returns the nonces used by the oracle to sign the event outcome.
|
|
49
|
+
* This is used for finding the matching oracle announcement.
|
|
50
|
+
* The nonce is extracted from the first 32 bytes of each signature.
|
|
51
|
+
*/
|
|
52
|
+
getNonces(): Buffer[];
|
|
53
|
+
/**
|
|
54
|
+
* Converts oracle_attestation to JSON
|
|
55
|
+
*/
|
|
56
|
+
toJSON(): OracleAttestationJSON;
|
|
57
|
+
/**
|
|
58
|
+
* Serializes the oracle_attestation message into a Buffer
|
|
59
|
+
*/
|
|
60
|
+
serialize(): Buffer;
|
|
61
|
+
}
|
|
62
|
+
export interface OracleAttestationJSON {
|
|
63
|
+
type: number;
|
|
64
|
+
eventId: string;
|
|
65
|
+
oraclePubkey: string;
|
|
66
|
+
signatures: string[];
|
|
67
|
+
outcomes: string[];
|
|
68
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OracleAttestation = void 0;
|
|
4
|
+
const bufio_1 = require("@node-dlc/bufio");
|
|
5
|
+
const bip_schnorr_1 = require("bip-schnorr");
|
|
6
|
+
const MessageType_1 = require("../MessageType");
|
|
7
|
+
/**
|
|
8
|
+
* Oracle attestation providing signatures over an outcome value.
|
|
9
|
+
* This represents the oracle's actual attestation to a specific outcome.
|
|
10
|
+
* Updated to match rust-dlc specification with 2-byte count prefixes.
|
|
11
|
+
*
|
|
12
|
+
* An attestation from an oracle providing signatures over an outcome value.
|
|
13
|
+
* This is what the oracle publishes when they want to attest to a specific outcome.
|
|
14
|
+
*/
|
|
15
|
+
class OracleAttestation {
|
|
16
|
+
constructor() {
|
|
17
|
+
/**
|
|
18
|
+
* The type for oracle_attestation message. oracle_attestation = 55400
|
|
19
|
+
*/
|
|
20
|
+
this.type = OracleAttestation.type;
|
|
21
|
+
/** The signatures over the event outcome (64 bytes each, Schnorr format). */
|
|
22
|
+
this.signatures = [];
|
|
23
|
+
/** The set of strings representing the outcome value. */
|
|
24
|
+
this.outcomes = [];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Deserializes an oracle_attestation message
|
|
28
|
+
* @param buf
|
|
29
|
+
*/
|
|
30
|
+
static deserialize(buf) {
|
|
31
|
+
const instance = new OracleAttestation();
|
|
32
|
+
const reader = new bufio_1.BufferReader(buf);
|
|
33
|
+
reader.readBigSize(); // read type
|
|
34
|
+
instance.length = reader.readBigSize();
|
|
35
|
+
// Detect format: old rust-dlc 0.4.0 (no event_id) vs new rust-dlc (with event_id)
|
|
36
|
+
const currentPos = reader.position;
|
|
37
|
+
try {
|
|
38
|
+
// Try reading as new format (with event_id)
|
|
39
|
+
const eventIdLength = reader.readBigSize();
|
|
40
|
+
// If event ID length is reasonable (0-100 bytes), assume new format
|
|
41
|
+
if (eventIdLength >= BigInt('0') && eventIdLength <= BigInt('100')) {
|
|
42
|
+
if (eventIdLength === BigInt('0')) {
|
|
43
|
+
instance.eventId = '';
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const eventIdBuf = reader.readBytes(Number(eventIdLength));
|
|
47
|
+
instance.eventId = eventIdBuf.toString();
|
|
48
|
+
}
|
|
49
|
+
instance.oraclePubkey = reader.readBytes(32);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Event ID length is unreasonable, probably old format without event_id
|
|
53
|
+
reader.position = currentPos;
|
|
54
|
+
instance.eventId = ''; // Default empty event ID for old format
|
|
55
|
+
instance.oraclePubkey = reader.readBytes(32);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
// If reading fails, assume old format without event_id
|
|
60
|
+
reader.position = currentPos;
|
|
61
|
+
instance.eventId = ''; // Default empty event ID for old format
|
|
62
|
+
instance.oraclePubkey = reader.readBytes(32);
|
|
63
|
+
}
|
|
64
|
+
const numSignatures = reader.readUInt16BE();
|
|
65
|
+
for (let i = 0; i < numSignatures; i++) {
|
|
66
|
+
const signature = reader.readBytes(64);
|
|
67
|
+
instance.signatures.push(signature);
|
|
68
|
+
}
|
|
69
|
+
// Handle both rust-dlc format (with u16 count prefix) and DLCSpecs format (no count prefix)
|
|
70
|
+
// Try to detect format by checking if next 2 bytes look like a reasonable outcome count
|
|
71
|
+
if (!reader.eof) {
|
|
72
|
+
const currentPos = reader.position;
|
|
73
|
+
try {
|
|
74
|
+
// Try reading as rust-dlc format (with u16 count prefix)
|
|
75
|
+
const numOutcomes = reader.readUInt16BE();
|
|
76
|
+
// Validate that this looks like a reasonable count
|
|
77
|
+
// If it's > 1000 or the remaining bytes can't accommodate this many outcomes,
|
|
78
|
+
// it's probably not a count prefix
|
|
79
|
+
const remainingBytes = reader.buffer.length - reader.position;
|
|
80
|
+
if (numOutcomes > 0 &&
|
|
81
|
+
numOutcomes <= 1000 &&
|
|
82
|
+
remainingBytes >= numOutcomes * 2) {
|
|
83
|
+
// Looks like rust-dlc format with u16 count prefix
|
|
84
|
+
for (let i = 0; i < numOutcomes; i++) {
|
|
85
|
+
const outcomeLen = reader.readBigSize();
|
|
86
|
+
const outcomeBuf = reader.readBytes(Number(outcomeLen));
|
|
87
|
+
instance.outcomes.push(outcomeBuf.toString());
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// Reset and try DLCSpecs format (no count prefix)
|
|
92
|
+
reader.position = currentPos;
|
|
93
|
+
while (!reader.eof) {
|
|
94
|
+
const outcomeLen = reader.readBigSize();
|
|
95
|
+
const outcomeBuf = reader.readBytes(Number(outcomeLen));
|
|
96
|
+
instance.outcomes.push(outcomeBuf.toString());
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
// If reading as rust-dlc format fails, reset and try DLCSpecs format
|
|
102
|
+
reader.position = currentPos;
|
|
103
|
+
while (!reader.eof) {
|
|
104
|
+
const outcomeLen = reader.readBigSize();
|
|
105
|
+
const outcomeBuf = reader.readBytes(Number(outcomeLen));
|
|
106
|
+
instance.outcomes.push(outcomeBuf.toString());
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return instance;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Validates the oracle attestation according to rust-dlc specification.
|
|
114
|
+
* This includes validating signatures and ensuring consistency with announcement.
|
|
115
|
+
* @param announcement The corresponding oracle announcement for validation (optional)
|
|
116
|
+
* @throws Will throw an error if validation fails
|
|
117
|
+
*/
|
|
118
|
+
validate(announcement) {
|
|
119
|
+
// Basic structure validation
|
|
120
|
+
if (this.signatures.length !== this.outcomes.length) {
|
|
121
|
+
throw new Error('Number of signatures must match number of outcomes');
|
|
122
|
+
}
|
|
123
|
+
if (this.signatures.length === 0) {
|
|
124
|
+
throw new Error('Must have at least one signature and outcome');
|
|
125
|
+
}
|
|
126
|
+
// Validate event ID
|
|
127
|
+
if (!this.eventId || this.eventId.length === 0) {
|
|
128
|
+
throw new Error('Event ID cannot be empty');
|
|
129
|
+
}
|
|
130
|
+
// Validate oracle public key format
|
|
131
|
+
if (!this.oraclePubkey || this.oraclePubkey.length !== 32) {
|
|
132
|
+
throw new Error('Oracle public key must be 32 bytes (x-only format)');
|
|
133
|
+
}
|
|
134
|
+
// Validate signature formats
|
|
135
|
+
this.signatures.forEach((sig, index) => {
|
|
136
|
+
if (!sig || sig.length !== 64) {
|
|
137
|
+
throw new Error(`Signature at index ${index} must be 64 bytes (Schnorr format)`);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
// Validate outcomes are not empty
|
|
141
|
+
this.outcomes.forEach((outcome, index) => {
|
|
142
|
+
if (!outcome || outcome.length === 0) {
|
|
143
|
+
throw new Error(`Outcome at index ${index} cannot be empty`);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
// Verify signatures over outcomes using tagged hash
|
|
147
|
+
this.signatures.forEach((sig, index) => {
|
|
148
|
+
const outcome = this.outcomes[index];
|
|
149
|
+
try {
|
|
150
|
+
const msg = bip_schnorr_1.math.taggedHash('DLC/oracle/attestation/v0', outcome);
|
|
151
|
+
(0, bip_schnorr_1.verify)(this.oraclePubkey, msg, sig);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
throw new Error(`Invalid signature for outcome "${outcome}" at index ${index}: ${error.message}`);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
// If announcement is provided, validate consistency
|
|
158
|
+
if (announcement) {
|
|
159
|
+
this.validateAgainstAnnouncement(announcement);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Validates the attestation against the corresponding oracle announcement.
|
|
164
|
+
* This ensures the attestation is consistent with the original announcement.
|
|
165
|
+
* @param announcement The oracle announcement to validate against
|
|
166
|
+
* @throws Will throw an error if validation fails
|
|
167
|
+
*/
|
|
168
|
+
validateAgainstAnnouncement(announcement) {
|
|
169
|
+
// Validate oracle public key matches announcement
|
|
170
|
+
if (!this.oraclePubkey.equals(announcement.oraclePubkey)) {
|
|
171
|
+
throw new Error('Oracle public key must match announcement');
|
|
172
|
+
}
|
|
173
|
+
// Validate event ID matches
|
|
174
|
+
if (this.eventId !== announcement.getEventId()) {
|
|
175
|
+
throw new Error('Event ID must match announcement');
|
|
176
|
+
}
|
|
177
|
+
// Validate that the number of signatures matches the number of nonces in announcement
|
|
178
|
+
const announcementNonces = announcement.getNonces();
|
|
179
|
+
if (this.signatures.length !== announcementNonces.length) {
|
|
180
|
+
throw new Error('Number of signatures must match number of nonces in announcement');
|
|
181
|
+
}
|
|
182
|
+
// Extract nonces from signatures (first 32 bytes) and compare with announcement nonces
|
|
183
|
+
// This validates that the signatures were created using the committed nonces
|
|
184
|
+
this.signatures.forEach((sig, index) => {
|
|
185
|
+
const nonceFromSig = sig.slice(0, 32);
|
|
186
|
+
const expectedNonce = announcementNonces[index];
|
|
187
|
+
if (!nonceFromSig.equals(expectedNonce)) {
|
|
188
|
+
throw new Error(`Signature nonce mismatch at index ${index}: signature was not created with announced nonce`);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Returns the nonces used by the oracle to sign the event outcome.
|
|
194
|
+
* This is used for finding the matching oracle announcement.
|
|
195
|
+
* The nonce is extracted from the first 32 bytes of each signature.
|
|
196
|
+
*/
|
|
197
|
+
getNonces() {
|
|
198
|
+
return this.signatures.map((sig) => sig.slice(0, 32));
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Converts oracle_attestation to JSON
|
|
202
|
+
*/
|
|
203
|
+
toJSON() {
|
|
204
|
+
return {
|
|
205
|
+
type: this.type,
|
|
206
|
+
eventId: this.eventId,
|
|
207
|
+
oraclePubkey: this.oraclePubkey.toString('hex'),
|
|
208
|
+
signatures: this.signatures.map((sig) => sig.toString('hex')),
|
|
209
|
+
outcomes: this.outcomes,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Serializes the oracle_attestation message into a Buffer
|
|
214
|
+
*/
|
|
215
|
+
serialize() {
|
|
216
|
+
const writer = new bufio_1.BufferWriter();
|
|
217
|
+
writer.writeBigSize(this.type);
|
|
218
|
+
const dataWriter = new bufio_1.BufferWriter();
|
|
219
|
+
dataWriter.writeBigSize(this.eventId.length);
|
|
220
|
+
dataWriter.writeBytes(Buffer.from(this.eventId));
|
|
221
|
+
dataWriter.writeBytes(this.oraclePubkey);
|
|
222
|
+
dataWriter.writeUInt16BE(this.signatures.length);
|
|
223
|
+
for (const signature of this.signatures) {
|
|
224
|
+
dataWriter.writeBytes(signature);
|
|
225
|
+
}
|
|
226
|
+
// Write outcomes with u16 count prefix (matching rust-dlc format)
|
|
227
|
+
dataWriter.writeUInt16BE(this.outcomes.length);
|
|
228
|
+
for (const outcome of this.outcomes) {
|
|
229
|
+
dataWriter.writeBigSize(outcome.length);
|
|
230
|
+
dataWriter.writeBytes(Buffer.from(outcome));
|
|
231
|
+
}
|
|
232
|
+
writer.writeBigSize(dataWriter.size);
|
|
233
|
+
writer.writeBytes(dataWriter.toBuffer());
|
|
234
|
+
return writer.toBuffer();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.OracleAttestation = OracleAttestation;
|
|
238
|
+
OracleAttestation.type = MessageType_1.MessageType.OracleAttestation;
|
|
239
|
+
//# sourceMappingURL=OracleAttestation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OracleAttestation.js","sourceRoot":"","sources":["../../lib/messages/OracleAttestation.ts"],"names":[],"mappings":";;;AAAA,2CAA6D;AAC7D,6CAA2C;AAE3C,gDAA6C;AAI7C;;;;;;;GAOG;AACH,MAAa,iBAAiB;IAA9B;QAkGE;;WAEG;QACI,SAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC;QAUrC,6EAA6E;QACtE,eAAU,GAAa,EAAE,CAAC;QAEjC,yDAAyD;QAClD,aAAQ,GAAa,EAAE,CAAC;IAyJjC,CAAC;IAzQC;;;OAGG;IACI,MAAM,CAAC,WAAW,CAAC,GAAW;QACnC,MAAM,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,IAAI,oBAAY,CAAC,GAAG,CAAC,CAAC;QAErC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,YAAY;QAClC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QAEvC,kFAAkF;QAClF,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC;QAEnC,IAAI;YACF,4CAA4C;YAC5C,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;YAE3C,oEAAoE;YACpE,IAAI,aAAa,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,aAAa,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE;gBAClE,IAAI,aAAa,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE;oBACjC,QAAQ,CAAC,OAAO,GAAG,EAAE,CAAC;iBACvB;qBAAM;oBACL,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;oBAC3D,QAAQ,CAAC,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,C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;QAClE,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC/C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;YACnC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACxC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;SAC7C;QAED,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEzC,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;;AA3QH,8CA4QC;AA3Qe,sBAAI,GAAG,yBAAW,CAAC,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { MessageType } from '../MessageType';
|
|
3
|
+
import { IDlcMessage } from './DlcMessage';
|
|
4
|
+
import { DigitDecompositionEventDescriptor, EnumEventDescriptor, EventDescriptor, IDigitDecompositionEventDescriptorJSON, IEnumEventDescriptorJSON } from './EventDescriptor';
|
|
5
|
+
/**
|
|
6
|
+
* Oracle event containing information about an event and the way that the
|
|
7
|
+
* oracle will attest to it. Updated to be rust-dlc compliant.
|
|
8
|
+
*
|
|
9
|
+
* For users to be able to create DLCs based on a given event, they also
|
|
10
|
+
* need to obtain information about the oracle and the time at which it
|
|
11
|
+
* plans on releasing a signature over the event outcome. OracleEvent
|
|
12
|
+
* messages contain such information, which includes:
|
|
13
|
+
* - the nonce(s) that will be used to sign the event outcome(s)
|
|
14
|
+
* - the earliest time (UTC) at which it plans on releasing a signature
|
|
15
|
+
* over the event outcome, in epoch seconds
|
|
16
|
+
* - the event descriptor
|
|
17
|
+
* - the event ID which can be a name or categorization associated with
|
|
18
|
+
* the event by the oracle
|
|
19
|
+
*/
|
|
20
|
+
export declare class OracleEvent implements IDlcMessage {
|
|
21
|
+
static type: MessageType;
|
|
22
|
+
/**
|
|
23
|
+
* Creates an OracleEvent from JSON data
|
|
24
|
+
* @param json JSON object representing oracle event
|
|
25
|
+
*/
|
|
26
|
+
static fromJSON(json: any): OracleEvent;
|
|
27
|
+
/**
|
|
28
|
+
* Deserializes an oracle_event message
|
|
29
|
+
* @param buf
|
|
30
|
+
*/
|
|
31
|
+
static deserialize(buf: Buffer): OracleEvent;
|
|
32
|
+
/**
|
|
33
|
+
* The type for oracle_event message. oracle_event = 55330
|
|
34
|
+
*/
|
|
35
|
+
type: MessageType;
|
|
36
|
+
length: bigint;
|
|
37
|
+
/** The nonces that the oracle will use to attest to the event outcome. */
|
|
38
|
+
oracleNonces: Buffer[];
|
|
39
|
+
/** The expected maturity of the contract (Unix timestamp). */
|
|
40
|
+
eventMaturityEpoch: number;
|
|
41
|
+
/** The description of the event. */
|
|
42
|
+
eventDescriptor: EventDescriptor;
|
|
43
|
+
/** The ID of the event. */
|
|
44
|
+
eventId: string;
|
|
45
|
+
/**
|
|
46
|
+
* Validates correctness of all fields in the message according to rust-dlc specification.
|
|
47
|
+
* This includes validating that the number of nonces matches the expected count for the event type.
|
|
48
|
+
* https://github.com/discreetlogcontracts/dlcspecs/blob/master/Oracle.md
|
|
49
|
+
* @throws Will throw an error if validation fails
|
|
50
|
+
*/
|
|
51
|
+
validate(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the expected number of nonces based on the event descriptor type.
|
|
54
|
+
* This matches the rust-dlc validation logic.
|
|
55
|
+
*/
|
|
56
|
+
private getExpectedNonceCount;
|
|
57
|
+
/**
|
|
58
|
+
* Returns whether this event is for enumerated outcomes.
|
|
59
|
+
*/
|
|
60
|
+
isEnumEvent(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Returns whether this event is for numerical outcomes.
|
|
63
|
+
*/
|
|
64
|
+
isDigitDecompositionEvent(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the event descriptor as EnumEventDescriptor if it's an enum event.
|
|
67
|
+
* @throws Error if not an enum event
|
|
68
|
+
*/
|
|
69
|
+
getEnumEventDescriptor(): EnumEventDescriptor;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the event descriptor as DigitDecompositionEventDescriptor if it's a numerical event.
|
|
72
|
+
* @throws Error if not a numerical event
|
|
73
|
+
*/
|
|
74
|
+
getDigitDecompositionEventDescriptor(): DigitDecompositionEventDescriptor;
|
|
75
|
+
/**
|
|
76
|
+
* Converts oracle_event to JSON
|
|
77
|
+
*/
|
|
78
|
+
toJSON(): IOracleEventJSON;
|
|
79
|
+
/**
|
|
80
|
+
* Serializes the oracle_event message into a Buffer
|
|
81
|
+
*/
|
|
82
|
+
serialize(): Buffer;
|
|
83
|
+
}
|
|
84
|
+
export interface IOracleEventJSON {
|
|
85
|
+
type?: number;
|
|
86
|
+
oracleNonces: string[];
|
|
87
|
+
eventMaturityEpoch: number;
|
|
88
|
+
eventDescriptor: IEnumEventDescriptorJSON | IDigitDecompositionEventDescriptorJSON;
|
|
89
|
+
eventId: string;
|
|
90
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OracleEvent = 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 EventDescriptor_1 = require("./EventDescriptor");
|
|
8
|
+
/**
|
|
9
|
+
* Oracle event containing information about an event and the way that the
|
|
10
|
+
* oracle will attest to it. Updated to be rust-dlc compliant.
|
|
11
|
+
*
|
|
12
|
+
* For users to be able to create DLCs based on a given event, they also
|
|
13
|
+
* need to obtain information about the oracle and the time at which it
|
|
14
|
+
* plans on releasing a signature over the event outcome. OracleEvent
|
|
15
|
+
* messages contain such information, which includes:
|
|
16
|
+
* - the nonce(s) that will be used to sign the event outcome(s)
|
|
17
|
+
* - the earliest time (UTC) at which it plans on releasing a signature
|
|
18
|
+
* over the event outcome, in epoch seconds
|
|
19
|
+
* - the event descriptor
|
|
20
|
+
* - the event ID which can be a name or categorization associated with
|
|
21
|
+
* the event by the oracle
|
|
22
|
+
*/
|
|
23
|
+
class OracleEvent {
|
|
24
|
+
constructor() {
|
|
25
|
+
/**
|
|
26
|
+
* The type for oracle_event message. oracle_event = 55330
|
|
27
|
+
*/
|
|
28
|
+
this.type = OracleEvent.type;
|
|
29
|
+
/** The nonces that the oracle will use to attest to the event outcome. */
|
|
30
|
+
this.oracleNonces = [];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates an OracleEvent from JSON data
|
|
34
|
+
* @param json JSON object representing oracle event
|
|
35
|
+
*/
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
37
|
+
static fromJSON(json) {
|
|
38
|
+
const instance = new OracleEvent();
|
|
39
|
+
// Parse oracle nonces array
|
|
40
|
+
const nonces = json.oracleNonces || json.oracle_nonces || [];
|
|
41
|
+
instance.oracleNonces = nonces.map((nonce) => Buffer.from(nonce, 'hex'));
|
|
42
|
+
instance.eventMaturityEpoch =
|
|
43
|
+
json.eventMaturityEpoch || json.event_maturity_epoch || 0;
|
|
44
|
+
// Parse event descriptor
|
|
45
|
+
instance.eventDescriptor = EventDescriptor_1.EventDescriptor.fromJSON(json.eventDescriptor || json.event_descriptor);
|
|
46
|
+
instance.eventId = json.eventId || json.event_id || '';
|
|
47
|
+
return instance;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Deserializes an oracle_event message
|
|
51
|
+
* @param buf
|
|
52
|
+
*/
|
|
53
|
+
static deserialize(buf) {
|
|
54
|
+
const instance = new OracleEvent();
|
|
55
|
+
const reader = new bufio_1.BufferReader(buf);
|
|
56
|
+
reader.readBigSize(); // read type
|
|
57
|
+
instance.length = reader.readBigSize();
|
|
58
|
+
const nonceCount = reader.readUInt16BE();
|
|
59
|
+
for (let i = 0; i < nonceCount; i++) {
|
|
60
|
+
instance.oracleNonces.push(reader.readBytes(32));
|
|
61
|
+
}
|
|
62
|
+
instance.eventMaturityEpoch = reader.readUInt32BE();
|
|
63
|
+
instance.eventDescriptor = EventDescriptor_1.EventDescriptor.deserialize((0, getTlv_1.getTlv)(reader));
|
|
64
|
+
const eventIdLength = reader.readBigSize();
|
|
65
|
+
const eventIdBuf = reader.readBytes(Number(eventIdLength));
|
|
66
|
+
instance.eventId = eventIdBuf.toString();
|
|
67
|
+
return instance;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Validates correctness of all fields in the message according to rust-dlc specification.
|
|
71
|
+
* This includes validating that the number of nonces matches the expected count for the event type.
|
|
72
|
+
* https://github.com/discreetlogcontracts/dlcspecs/blob/master/Oracle.md
|
|
73
|
+
* @throws Will throw an error if validation fails
|
|
74
|
+
*/
|
|
75
|
+
validate() {
|
|
76
|
+
// Validate event maturity epoch
|
|
77
|
+
if (this.eventMaturityEpoch < 0) {
|
|
78
|
+
throw new Error('eventMaturityEpoch must be greater than or equal to 0');
|
|
79
|
+
}
|
|
80
|
+
// Validate event ID
|
|
81
|
+
if (!this.eventId || this.eventId.length === 0) {
|
|
82
|
+
throw new Error('eventId cannot be empty');
|
|
83
|
+
}
|
|
84
|
+
// Validate oracle nonces (must be 32 bytes each)
|
|
85
|
+
if (this.oracleNonces.length === 0) {
|
|
86
|
+
throw new Error('Must have at least one oracle nonce');
|
|
87
|
+
}
|
|
88
|
+
this.oracleNonces.forEach((nonce, index) => {
|
|
89
|
+
if (!nonce || nonce.length !== 32) {
|
|
90
|
+
throw new Error(`Oracle nonce at index ${index} must be 32 bytes`);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
// Validate expected number of nonces based on event descriptor type
|
|
94
|
+
const expectedNbNonces = this.getExpectedNonceCount();
|
|
95
|
+
if (expectedNbNonces !== this.oracleNonces.length) {
|
|
96
|
+
throw new Error(`OracleEvent nonce count mismatch: expected ${expectedNbNonces}, got ${this.oracleNonces.length}`);
|
|
97
|
+
}
|
|
98
|
+
// Validate the event descriptor itself
|
|
99
|
+
if (this.eventDescriptor instanceof EventDescriptor_1.DigitDecompositionEventDescriptor) {
|
|
100
|
+
this.eventDescriptor.validate();
|
|
101
|
+
}
|
|
102
|
+
// EnumEventDescriptorV0 doesn't have validation requirements beyond basic structure
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Returns the expected number of nonces based on the event descriptor type.
|
|
106
|
+
* This matches the rust-dlc validation logic.
|
|
107
|
+
*/
|
|
108
|
+
getExpectedNonceCount() {
|
|
109
|
+
if (this.eventDescriptor instanceof EventDescriptor_1.EnumEventDescriptor) {
|
|
110
|
+
// Enum events require exactly 1 nonce
|
|
111
|
+
return 1;
|
|
112
|
+
}
|
|
113
|
+
else if (this.eventDescriptor instanceof EventDescriptor_1.DigitDecompositionEventDescriptor) {
|
|
114
|
+
// Digit decomposition events require nbDigits nonces, plus 1 if signed
|
|
115
|
+
const descriptor = this.eventDescriptor;
|
|
116
|
+
return descriptor.isSigned
|
|
117
|
+
? descriptor.nbDigits + 1
|
|
118
|
+
: descriptor.nbDigits;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
throw new Error('Unknown event descriptor type');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Returns whether this event is for enumerated outcomes.
|
|
126
|
+
*/
|
|
127
|
+
isEnumEvent() {
|
|
128
|
+
return this.eventDescriptor instanceof EventDescriptor_1.EnumEventDescriptor;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Returns whether this event is for numerical outcomes.
|
|
132
|
+
*/
|
|
133
|
+
isDigitDecompositionEvent() {
|
|
134
|
+
return this.eventDescriptor instanceof EventDescriptor_1.DigitDecompositionEventDescriptor;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Returns the event descriptor as EnumEventDescriptor if it's an enum event.
|
|
138
|
+
* @throws Error if not an enum event
|
|
139
|
+
*/
|
|
140
|
+
getEnumEventDescriptor() {
|
|
141
|
+
if (!this.isEnumEvent()) {
|
|
142
|
+
throw new Error('Event is not an enum event');
|
|
143
|
+
}
|
|
144
|
+
return this.eventDescriptor;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Returns the event descriptor as DigitDecompositionEventDescriptor if it's a numerical event.
|
|
148
|
+
* @throws Error if not a numerical event
|
|
149
|
+
*/
|
|
150
|
+
getDigitDecompositionEventDescriptor() {
|
|
151
|
+
if (!this.isDigitDecompositionEvent()) {
|
|
152
|
+
throw new Error('Event is not a digit decomposition event');
|
|
153
|
+
}
|
|
154
|
+
return this.eventDescriptor;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Converts oracle_event to JSON
|
|
158
|
+
*/
|
|
159
|
+
toJSON() {
|
|
160
|
+
return {
|
|
161
|
+
oracleNonces: this.oracleNonces.map((oracle) => oracle.toString('hex')),
|
|
162
|
+
eventMaturityEpoch: this.eventMaturityEpoch,
|
|
163
|
+
eventDescriptor: this.eventDescriptor.toJSON(),
|
|
164
|
+
eventId: this.eventId,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Serializes the oracle_event message into a Buffer
|
|
169
|
+
*/
|
|
170
|
+
serialize() {
|
|
171
|
+
const writer = new bufio_1.BufferWriter();
|
|
172
|
+
writer.writeBigSize(this.type);
|
|
173
|
+
const dataWriter = new bufio_1.BufferWriter();
|
|
174
|
+
dataWriter.writeUInt16BE(this.oracleNonces.length);
|
|
175
|
+
for (const nonce of this.oracleNonces) {
|
|
176
|
+
dataWriter.writeBytes(nonce);
|
|
177
|
+
}
|
|
178
|
+
dataWriter.writeUInt32BE(this.eventMaturityEpoch);
|
|
179
|
+
dataWriter.writeBytes(this.eventDescriptor.serialize());
|
|
180
|
+
dataWriter.writeBigSize(this.eventId.length);
|
|
181
|
+
dataWriter.writeBytes(Buffer.from(this.eventId));
|
|
182
|
+
writer.writeBigSize(dataWriter.size);
|
|
183
|
+
writer.writeBytes(dataWriter.toBuffer());
|
|
184
|
+
return writer.toBuffer();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.OracleEvent = OracleEvent;
|
|
188
|
+
OracleEvent.type = MessageType_1.MessageType.OracleEvent;
|
|
189
|
+
//# sourceMappingURL=OracleEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OracleEvent.js","sourceRoot":"","sources":["../../lib/messages/OracleEvent.ts"],"names":[],"mappings":";;;AAAA,2CAA6D;AAE7D,gDAA6C;AAC7C,gDAA6C;AAE7C,uDAM2B;AAE3B;;;;;;;;;;;;;;GAcG;AACH,MAAa,WAAW;IAAxB;QAuDE;;WAEG;QACI,SAAI,GAAG,WAAW,CAAC,IAAI,CAAC;QAI/B,0EAA0E;QACnE,iBAAY,GAAa,EAAE,CAAC;IAoJrC,CAAC;IAhNC;;;OAGG;IACH,iHAAiH;IAC1G,MAAM,CAAC,QAAQ,CAAC,IAAS;QAC9B,MAAM,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;QAEnC,4BAA4B;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC;QAC7D,QAAQ,CAAC,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,EAAE,CACnD,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAC1B,CAAC;QAEF,QAAQ,CAAC,kBAAkB;YACzB,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,oBAAoB,IAAI,CAAC,CAAC;QAE5D,yBAAyB;QACzB,QAAQ,CAAC,eAAe,GAAG,iCAAe,CAAC,QAAQ,CACjD,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,gBAAgB,CAC9C,CAAC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,CAAC,YAAY,EAAE;YACrC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SAC9B;QAED,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAClD,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC,CAAC;QACxD,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7C,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAEjD,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEzC,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;;AAlNH,kCAmNC;AAlNe,gBAAI,GAAG,yBAAW,CAAC,WAAW,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { MessageType } from '../MessageType';
|
|
3
|
+
import { IDlcMessage } from './DlcMessage';
|
|
4
|
+
import { OracleAnnouncement } from './OracleAnnouncement';
|
|
5
|
+
import { OracleAttestation } from './OracleAttestation';
|
|
6
|
+
/**
|
|
7
|
+
* OracleEventContainer contains information about the oracles to be used in
|
|
8
|
+
* executing a DLC.
|
|
9
|
+
*/
|
|
10
|
+
export declare class OracleEventContainer implements IDlcMessage {
|
|
11
|
+
static type: MessageType;
|
|
12
|
+
/**
|
|
13
|
+
* Deserializes an oracle_info_v0 message
|
|
14
|
+
* @param buf
|
|
15
|
+
*/
|
|
16
|
+
static deserialize(buf: Buffer): OracleEventContainer;
|
|
17
|
+
/**
|
|
18
|
+
* The type for oracle_info_v0 message. oracle_info_v0 = 42770
|
|
19
|
+
*/
|
|
20
|
+
type: MessageType;
|
|
21
|
+
length: bigint;
|
|
22
|
+
oracleName: string;
|
|
23
|
+
uri: string;
|
|
24
|
+
announcement: OracleAnnouncement;
|
|
25
|
+
attestation: OracleAttestation;
|
|
26
|
+
outcome: string;
|
|
27
|
+
validate(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Serializes the oracle_info_v0 message into a Buffer
|
|
30
|
+
*/
|
|
31
|
+
serialize(): Buffer;
|
|
32
|
+
}
|