@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.
- package/.nvmrc +1 -1
- 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 +72 -0
- package/dist/BitcoinDlcProvider.d.ts +17 -16
- package/dist/BitcoinDlcProvider.js +345 -315
- 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 +624 -612
- package/lib/utils/Utils.ts +19 -24
- package/package.json +10 -10
- package/yalc.lock +10 -0
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
import { Script } from '@node-dlc/bitcoin';
|
|
2
|
+
import { BufferReader, BufferWriter } from '@node-dlc/bufio';
|
|
3
|
+
import { hash160 } from '@node-dlc/crypto';
|
|
4
|
+
import { BitcoinNetwork } from 'bitcoin-networks';
|
|
5
|
+
import { address } from 'bitcoinjs-lib';
|
|
6
|
+
import secp256k1 from 'secp256k1';
|
|
7
|
+
|
|
8
|
+
import { MessageType, PROTOCOL_VERSION } from '../MessageType';
|
|
9
|
+
import { deserializeTlv } from '../serialize/deserializeTlv';
|
|
10
|
+
import { getTlv } from '../serialize/getTlv';
|
|
11
|
+
import { bigIntToNumber, toBigInt } from '../util';
|
|
12
|
+
import { BatchFundingGroup, IBatchFundingGroupJSON } from './BatchFundingGroup';
|
|
13
|
+
import {
|
|
14
|
+
ContractInfo,
|
|
15
|
+
IDisjointContractInfoJSON,
|
|
16
|
+
ISingleContractInfoJSON,
|
|
17
|
+
} from './ContractInfo';
|
|
18
|
+
import { IDlcMessage } from './DlcMessage';
|
|
19
|
+
import { FundingInput, IFundingInputJSON } from './FundingInput';
|
|
20
|
+
import {
|
|
21
|
+
IOrderIrcInfoJSON,
|
|
22
|
+
OrderIrcInfo,
|
|
23
|
+
OrderIrcInfoV0,
|
|
24
|
+
} from './OrderIrcInfo';
|
|
25
|
+
import {
|
|
26
|
+
IOrderMetadataJSON,
|
|
27
|
+
OrderMetadata,
|
|
28
|
+
OrderMetadataV0,
|
|
29
|
+
} from './OrderMetadata';
|
|
30
|
+
import { IOrderPositionInfoJSON, OrderPositionInfo } from './OrderPositionInfo';
|
|
31
|
+
|
|
32
|
+
export const LOCKTIME_THRESHOLD = 500000000;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* DlcOffer message contains information about a node and indicates its
|
|
36
|
+
* desire to enter into a new contract. This is the first step toward
|
|
37
|
+
* creating the funding transaction and CETs.
|
|
38
|
+
* Updated to support dlcspecs PR #163 format.
|
|
39
|
+
*/
|
|
40
|
+
export class DlcOffer implements IDlcMessage {
|
|
41
|
+
public static type = MessageType.DlcOffer;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Creates a DlcOffer from JSON data (e.g., from test vectors)
|
|
45
|
+
* Handles both our internal format and external test vector formats
|
|
46
|
+
* @param json JSON object representing a DLC offer
|
|
47
|
+
*/
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
49
|
+
public static fromJSON(json: any): DlcOffer {
|
|
50
|
+
const instance = new DlcOffer();
|
|
51
|
+
|
|
52
|
+
// Basic fields with field name variations
|
|
53
|
+
instance.protocolVersion =
|
|
54
|
+
json.protocolVersion || json.protocol_version || PROTOCOL_VERSION;
|
|
55
|
+
instance.contractFlags = Buffer.from(
|
|
56
|
+
json.contractFlags || json.contract_flags || '00',
|
|
57
|
+
'hex',
|
|
58
|
+
);
|
|
59
|
+
instance.chainHash = Buffer.from(json.chainHash || json.chain_hash, 'hex');
|
|
60
|
+
instance.temporaryContractId = Buffer.from(
|
|
61
|
+
json.temporaryContractId || json.temporary_contract_id,
|
|
62
|
+
'hex',
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
instance.fundingPubkey = Buffer.from(
|
|
66
|
+
json.fundingPubkey || json.fundingPubKey || json.funding_pubkey,
|
|
67
|
+
'hex',
|
|
68
|
+
);
|
|
69
|
+
instance.payoutSpk = Buffer.from(
|
|
70
|
+
json.payoutSpk || json.payoutSPK || json.payout_spk,
|
|
71
|
+
'hex',
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
// Use toBigInt helper to handle BigInt values from json-bigint
|
|
75
|
+
instance.payoutSerialId = toBigInt(
|
|
76
|
+
json.payoutSerialId || json.payout_serial_id,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
instance.offerCollateral = toBigInt(
|
|
80
|
+
json.offerCollateral ||
|
|
81
|
+
json.offerCollateralSatoshis ||
|
|
82
|
+
json.offer_collateral,
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
instance.changeSpk = Buffer.from(
|
|
86
|
+
json.changeSpk || json.changeSPK || json.change_spk,
|
|
87
|
+
'hex',
|
|
88
|
+
);
|
|
89
|
+
instance.changeSerialId = toBigInt(
|
|
90
|
+
json.changeSerialId || json.change_serial_id,
|
|
91
|
+
);
|
|
92
|
+
instance.fundOutputSerialId = toBigInt(
|
|
93
|
+
json.fundOutputSerialId || json.fund_output_serial_id,
|
|
94
|
+
);
|
|
95
|
+
instance.feeRatePerVb = toBigInt(json.feeRatePerVb || json.fee_rate_per_vb);
|
|
96
|
+
instance.cetLocktime = json.cetLocktime || json.cet_locktime || 0;
|
|
97
|
+
instance.refundLocktime = json.refundLocktime || json.refund_locktime || 0;
|
|
98
|
+
|
|
99
|
+
// Use ContractInfo.fromJSON() - proper delegation
|
|
100
|
+
instance.contractInfo = ContractInfo.fromJSON(
|
|
101
|
+
json.contractInfo || json.contract_info,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
// Use FundingInput.fromJSON() for each funding input - proper delegation
|
|
105
|
+
instance.fundingInputs = (json.fundingInputs || json.funding_inputs || [])
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
|
+
.map((inputJson: any) => FundingInput.fromJSON(inputJson));
|
|
108
|
+
|
|
109
|
+
return instance;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Deserializes an offer_dlc message with backward compatibility
|
|
114
|
+
* Detects old format (without protocol_version) vs new format (with protocol_version)
|
|
115
|
+
* @param buf
|
|
116
|
+
*/
|
|
117
|
+
public static deserialize(buf: Buffer): DlcOffer {
|
|
118
|
+
const instance = new DlcOffer();
|
|
119
|
+
const reader = new BufferReader(buf);
|
|
120
|
+
|
|
121
|
+
const type = reader.readUInt16BE(); // read type
|
|
122
|
+
|
|
123
|
+
// Validate type matches expected DlcOffer type
|
|
124
|
+
if (type !== MessageType.DlcOffer) {
|
|
125
|
+
throw new Error(
|
|
126
|
+
`Invalid message type. Expected ${MessageType.DlcOffer}, got ${type}`,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// BACKWARD COMPATIBILITY: Detect old vs new format
|
|
131
|
+
// New format: [type][protocol_version: 4 bytes][contract_flags: 1 byte][chain_hash: 32 bytes]
|
|
132
|
+
// Old format: [type][contract_flags: 1 byte][chain_hash: 32 bytes]
|
|
133
|
+
|
|
134
|
+
const nextBytes = reader.buffer.subarray(
|
|
135
|
+
reader.position,
|
|
136
|
+
reader.position + 5,
|
|
137
|
+
);
|
|
138
|
+
const possibleProtocolVersion = nextBytes.readUInt32BE(0);
|
|
139
|
+
const possibleContractFlags = nextBytes.readUInt8(4);
|
|
140
|
+
|
|
141
|
+
// Heuristic: protocol_version should be 1, contract_flags should be 0
|
|
142
|
+
// If first 4 bytes are reasonable protocol version (1-10) and next byte is 0, assume new format
|
|
143
|
+
const isNewFormat =
|
|
144
|
+
possibleProtocolVersion >= 1 &&
|
|
145
|
+
possibleProtocolVersion <= 10 &&
|
|
146
|
+
possibleContractFlags === 0;
|
|
147
|
+
|
|
148
|
+
if (isNewFormat) {
|
|
149
|
+
// New format with protocol_version
|
|
150
|
+
instance.protocolVersion = reader.readUInt32BE();
|
|
151
|
+
instance.contractFlags = reader.readBytes(1);
|
|
152
|
+
} else {
|
|
153
|
+
// Old format without protocol_version
|
|
154
|
+
instance.protocolVersion = 1; // Default to version 1
|
|
155
|
+
instance.contractFlags = reader.readBytes(1);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
instance.chainHash = reader.readBytes(32);
|
|
159
|
+
instance.temporaryContractId = reader.readBytes(32);
|
|
160
|
+
|
|
161
|
+
// ContractInfo is serialized as sibling type in dlcspecs PR #163 format
|
|
162
|
+
instance.contractInfo = ContractInfo.deserialize(
|
|
163
|
+
reader.buffer.subarray(reader.position),
|
|
164
|
+
);
|
|
165
|
+
// Skip past the ContractInfo we just read
|
|
166
|
+
const contractInfoLength = instance.contractInfo.serialize().length;
|
|
167
|
+
reader.position += contractInfoLength;
|
|
168
|
+
instance.fundingPubkey = reader.readBytes(33);
|
|
169
|
+
const payoutSpkLen = reader.readUInt16BE();
|
|
170
|
+
instance.payoutSpk = reader.readBytes(payoutSpkLen);
|
|
171
|
+
instance.payoutSerialId = reader.readUInt64BE();
|
|
172
|
+
instance.offerCollateral = reader.readUInt64BE();
|
|
173
|
+
|
|
174
|
+
// Changed from u16 to bigsize as per dlcspecs PR #163
|
|
175
|
+
const fundingInputsLen = Number(reader.readBigSize());
|
|
176
|
+
|
|
177
|
+
for (let i = 0; i < fundingInputsLen; i++) {
|
|
178
|
+
// FundingInput body is serialized directly without TLV wrapper in rust-dlc format
|
|
179
|
+
const fundingInput = FundingInput.deserializeBody(
|
|
180
|
+
reader.buffer.subarray(reader.position),
|
|
181
|
+
);
|
|
182
|
+
instance.fundingInputs.push(fundingInput);
|
|
183
|
+
|
|
184
|
+
// Skip past the FundingInput we just read
|
|
185
|
+
const fundingInputLength = fundingInput.serializeBody().length;
|
|
186
|
+
reader.position += fundingInputLength;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const changeSpkLen = reader.readUInt16BE();
|
|
190
|
+
instance.changeSpk = reader.readBytes(changeSpkLen);
|
|
191
|
+
instance.changeSerialId = reader.readUInt64BE();
|
|
192
|
+
instance.fundOutputSerialId = reader.readUInt64BE();
|
|
193
|
+
instance.feeRatePerVb = reader.readUInt64BE();
|
|
194
|
+
instance.cetLocktime = reader.readUInt32BE();
|
|
195
|
+
instance.refundLocktime = reader.readUInt32BE();
|
|
196
|
+
|
|
197
|
+
// Parse TLV stream as per dlcspecs PR #163
|
|
198
|
+
while (!reader.eof) {
|
|
199
|
+
const buf = getTlv(reader);
|
|
200
|
+
const tlvReader = new BufferReader(buf);
|
|
201
|
+
const { type } = deserializeTlv(tlvReader);
|
|
202
|
+
|
|
203
|
+
switch (Number(type)) {
|
|
204
|
+
case MessageType.OrderMetadataV0:
|
|
205
|
+
instance.metadata = OrderMetadataV0.deserialize(buf);
|
|
206
|
+
break;
|
|
207
|
+
case MessageType.OrderIrcInfoV0:
|
|
208
|
+
instance.ircInfo = OrderIrcInfoV0.deserialize(buf);
|
|
209
|
+
break;
|
|
210
|
+
case MessageType.OrderPositionInfoV0:
|
|
211
|
+
instance.positionInfo = OrderPositionInfo.deserialize(buf);
|
|
212
|
+
break;
|
|
213
|
+
case MessageType.BatchFundingGroup:
|
|
214
|
+
if (!instance.batchFundingGroups) {
|
|
215
|
+
instance.batchFundingGroups = [];
|
|
216
|
+
}
|
|
217
|
+
instance.batchFundingGroups.push(BatchFundingGroup.deserialize(buf));
|
|
218
|
+
break;
|
|
219
|
+
default:
|
|
220
|
+
// Store unknown TLVs for future compatibility
|
|
221
|
+
if (!instance.unknownTlvs) {
|
|
222
|
+
instance.unknownTlvs = [];
|
|
223
|
+
}
|
|
224
|
+
instance.unknownTlvs.push({ type: Number(type), data: buf });
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return instance;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* The type for offer_dlc message. offer_dlc = 42778
|
|
234
|
+
*/
|
|
235
|
+
public type = DlcOffer.type;
|
|
236
|
+
|
|
237
|
+
// New fields as per dlcspecs PR #163
|
|
238
|
+
public protocolVersion: number = PROTOCOL_VERSION; // Default to current protocol version
|
|
239
|
+
|
|
240
|
+
public temporaryContractId: Buffer; // New field for contract identification
|
|
241
|
+
|
|
242
|
+
// Existing fields
|
|
243
|
+
public contractFlags: Buffer;
|
|
244
|
+
|
|
245
|
+
public chainHash: Buffer;
|
|
246
|
+
|
|
247
|
+
public contractInfo: ContractInfo;
|
|
248
|
+
|
|
249
|
+
public fundingPubkey: Buffer;
|
|
250
|
+
|
|
251
|
+
public payoutSpk: Buffer;
|
|
252
|
+
|
|
253
|
+
public payoutSerialId: bigint;
|
|
254
|
+
|
|
255
|
+
public offerCollateral: bigint;
|
|
256
|
+
|
|
257
|
+
public fundingInputs: FundingInput[] = [];
|
|
258
|
+
|
|
259
|
+
public changeSpk: Buffer;
|
|
260
|
+
|
|
261
|
+
public changeSerialId: bigint;
|
|
262
|
+
|
|
263
|
+
public fundOutputSerialId: bigint;
|
|
264
|
+
|
|
265
|
+
public feeRatePerVb: bigint;
|
|
266
|
+
|
|
267
|
+
public cetLocktime: number;
|
|
268
|
+
|
|
269
|
+
public refundLocktime: number;
|
|
270
|
+
|
|
271
|
+
public metadata?: OrderMetadata;
|
|
272
|
+
|
|
273
|
+
public ircInfo?: OrderIrcInfo;
|
|
274
|
+
|
|
275
|
+
public positionInfo?: OrderPositionInfo;
|
|
276
|
+
|
|
277
|
+
public batchFundingGroups?: BatchFundingGroup[];
|
|
278
|
+
|
|
279
|
+
// Store unknown TLVs for forward compatibility
|
|
280
|
+
public unknownTlvs?: Array<{ type: number; data: Buffer }>;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Get funding, change and payout address from DlcOffer
|
|
284
|
+
* @param network Bitcoin Network
|
|
285
|
+
* @returns {IDlcOfferAddresses}
|
|
286
|
+
*/
|
|
287
|
+
public getAddresses(network: BitcoinNetwork): IDlcOfferAddresses {
|
|
288
|
+
const fundingSPK = Script.p2wpkhLock(hash160(this.fundingPubkey))
|
|
289
|
+
.serialize()
|
|
290
|
+
.slice(1);
|
|
291
|
+
const fundingAddress = address.fromOutputScript(fundingSPK, network);
|
|
292
|
+
const changeAddress = address.fromOutputScript(this.changeSpk, network);
|
|
293
|
+
const payoutAddress = address.fromOutputScript(this.payoutSpk, network);
|
|
294
|
+
|
|
295
|
+
return {
|
|
296
|
+
fundingAddress,
|
|
297
|
+
changeAddress,
|
|
298
|
+
payoutAddress,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Validates correctness of all fields in DlcOffer
|
|
304
|
+
* Updated validation rules as per dlcspecs PR #163
|
|
305
|
+
* @throws Will throw an error if validation fails
|
|
306
|
+
*/
|
|
307
|
+
public validate(): void {
|
|
308
|
+
// 1. Type is set automatically in class
|
|
309
|
+
// 2. protocol_version validation
|
|
310
|
+
if (this.protocolVersion !== PROTOCOL_VERSION) {
|
|
311
|
+
throw new Error(
|
|
312
|
+
`Unsupported protocol version: ${this.protocolVersion}, expected: ${PROTOCOL_VERSION}`,
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// 3. temporary_contract_id validation
|
|
317
|
+
if (!this.temporaryContractId || this.temporaryContractId.length !== 32) {
|
|
318
|
+
throw new Error('temporaryContractId must be 32 bytes');
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// 4. contract_flags field is ignored
|
|
322
|
+
// 5. chain_hash must be validated as input by end user
|
|
323
|
+
// 6. payout_spk and change_spk must be standard script pubkeys
|
|
324
|
+
|
|
325
|
+
try {
|
|
326
|
+
address.fromOutputScript(this.payoutSpk);
|
|
327
|
+
} catch (e) {
|
|
328
|
+
throw new Error('DlcOffer payoutSpk is invalid');
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
try {
|
|
332
|
+
address.fromOutputScript(this.changeSpk);
|
|
333
|
+
} catch (e) {
|
|
334
|
+
throw new Error('DlcOffer changeSpk is invalid');
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// 7. funding_pubkey must be a valid secp256k1 pubkey in compressed format
|
|
338
|
+
// https://github.com/bitcoin/bips/blob/master/bip-0137.mediawiki#background-on-ecdsa-signatures
|
|
339
|
+
|
|
340
|
+
if (secp256k1.publicKeyVerify(Buffer.from(this.fundingPubkey))) {
|
|
341
|
+
if (this.fundingPubkey[0] != 0x02 && this.fundingPubkey[0] != 0x03) {
|
|
342
|
+
throw new Error('fundingPubkey must be in compressed format');
|
|
343
|
+
}
|
|
344
|
+
} else {
|
|
345
|
+
throw new Error('fundingPubkey is not a valid secp256k1 key');
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// 8. offer_collateral must be greater than or equal to 1000
|
|
349
|
+
if (this.offerCollateral < 1000) {
|
|
350
|
+
throw new Error('offer_collateral must be greater than or equal to 1000');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (this.cetLocktime < 0) {
|
|
354
|
+
throw new Error('cet_locktime must be greater than or equal to 0');
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (this.refundLocktime < 0) {
|
|
358
|
+
throw new Error('refund_locktime must be greater than or equal to 0');
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// 9. cet_locktime and refund_locktime must either both be unix timestamps, or both be block heights.
|
|
362
|
+
// https://en.bitcoin.it/wiki/NLockTime
|
|
363
|
+
// https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki#detailed-specification
|
|
364
|
+
// https://github.com/bitcoin/bitcoin/blob/master/src/script/script.h#L39
|
|
365
|
+
if (
|
|
366
|
+
!(
|
|
367
|
+
(this.cetLocktime < LOCKTIME_THRESHOLD &&
|
|
368
|
+
this.refundLocktime < LOCKTIME_THRESHOLD) ||
|
|
369
|
+
(this.cetLocktime >= LOCKTIME_THRESHOLD &&
|
|
370
|
+
this.refundLocktime >= LOCKTIME_THRESHOLD)
|
|
371
|
+
)
|
|
372
|
+
) {
|
|
373
|
+
throw new Error('cetLocktime and refundLocktime must be in same units');
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// 10. cetLocktime must be less than refundLocktime
|
|
377
|
+
if (this.cetLocktime >= this.refundLocktime) {
|
|
378
|
+
throw new Error('cetLocktime must be less than refundLocktime');
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// 11. inputSerialId must be unique for each input
|
|
382
|
+
|
|
383
|
+
const inputSerialIds = this.fundingInputs.map(
|
|
384
|
+
(input: FundingInput) => input.inputSerialId,
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
if (new Set(inputSerialIds).size !== inputSerialIds.length) {
|
|
388
|
+
throw new Error('inputSerialIds must be unique');
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// 12. changeSerialId and fundOutputSerialID must be different
|
|
392
|
+
|
|
393
|
+
if (this.changeSerialId === this.fundOutputSerialId) {
|
|
394
|
+
throw new Error(
|
|
395
|
+
'changeSerialId and fundOutputSerialId must be different',
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// validate contractInfo
|
|
400
|
+
this.contractInfo.validate();
|
|
401
|
+
|
|
402
|
+
// totalCollateral should be > offerCollateral (logical validation)
|
|
403
|
+
if (this.contractInfo.getTotalCollateral() <= this.offerCollateral) {
|
|
404
|
+
throw new Error('totalCollateral should be greater than offerCollateral');
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// validate funding amount
|
|
408
|
+
const fundingAmount = this.fundingInputs.reduce((acc, fundingInput) => {
|
|
409
|
+
const input = fundingInput as FundingInput;
|
|
410
|
+
return acc + input.prevTx.outputs[input.prevTxVout].value.sats;
|
|
411
|
+
}, BigInt(0));
|
|
412
|
+
if (this.offerCollateral >= fundingAmount) {
|
|
413
|
+
throw new Error('fundingAmount must be greater than offerCollateral');
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Converts dlc_offer to JSON (canonical rust-dlc format)
|
|
419
|
+
*/
|
|
420
|
+
public toJSON(): IDlcOfferJSON {
|
|
421
|
+
const tlvs = [];
|
|
422
|
+
|
|
423
|
+
if (this.metadata) tlvs.push(this.metadata.toJSON());
|
|
424
|
+
if (this.ircInfo) tlvs.push(this.ircInfo.toJSON());
|
|
425
|
+
if (this.positionInfo) tlvs.push(this.positionInfo.toJSON());
|
|
426
|
+
if (this.batchFundingGroups)
|
|
427
|
+
this.batchFundingGroups.forEach((fundingInfo) =>
|
|
428
|
+
tlvs.push(fundingInfo.toJSON()),
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
// Include unknown TLVs for debugging
|
|
432
|
+
if (this.unknownTlvs) {
|
|
433
|
+
this.unknownTlvs.forEach((tlv) =>
|
|
434
|
+
tlvs.push({ type: tlv.type, data: tlv.data.toString('hex') }),
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// Return canonical rust-dlc format only
|
|
439
|
+
return {
|
|
440
|
+
protocolVersion: this.protocolVersion,
|
|
441
|
+
temporaryContractId: this.temporaryContractId.toString('hex'),
|
|
442
|
+
contractFlags: Number(this.contractFlags[0]),
|
|
443
|
+
chainHash: this.chainHash.toString('hex'),
|
|
444
|
+
contractInfo: this.contractInfo.toJSON(),
|
|
445
|
+
fundingPubkey: this.fundingPubkey.toString('hex'), // lowercase 'k'
|
|
446
|
+
payoutSpk: this.payoutSpk.toString('hex'), // lowercase
|
|
447
|
+
payoutSerialId: bigIntToNumber(this.payoutSerialId),
|
|
448
|
+
offerCollateral: bigIntToNumber(this.offerCollateral), // no "Satoshis"
|
|
449
|
+
fundingInputs: this.fundingInputs.map((input) => input.toJSON()),
|
|
450
|
+
changeSpk: this.changeSpk.toString('hex'), // lowercase
|
|
451
|
+
changeSerialId: bigIntToNumber(this.changeSerialId),
|
|
452
|
+
fundOutputSerialId: bigIntToNumber(this.fundOutputSerialId),
|
|
453
|
+
feeRatePerVb: bigIntToNumber(this.feeRatePerVb),
|
|
454
|
+
cetLocktime: this.cetLocktime,
|
|
455
|
+
refundLocktime: this.refundLocktime,
|
|
456
|
+
} as any; // Allow different field names from interface
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Serializes the offer_dlc message into a Buffer
|
|
461
|
+
* Updated serialization format as per dlcspecs PR #163
|
|
462
|
+
*/
|
|
463
|
+
public serialize(): Buffer {
|
|
464
|
+
const writer = new BufferWriter();
|
|
465
|
+
writer.writeUInt16BE(this.type);
|
|
466
|
+
|
|
467
|
+
// New fields as per dlcspecs PR #163
|
|
468
|
+
writer.writeUInt32BE(this.protocolVersion);
|
|
469
|
+
writer.writeBytes(this.contractFlags);
|
|
470
|
+
writer.writeBytes(this.chainHash);
|
|
471
|
+
writer.writeBytes(this.temporaryContractId); // New field
|
|
472
|
+
|
|
473
|
+
writer.writeBytes(this.contractInfo.serialize());
|
|
474
|
+
writer.writeBytes(this.fundingPubkey);
|
|
475
|
+
writer.writeUInt16BE(this.payoutSpk.length);
|
|
476
|
+
writer.writeBytes(this.payoutSpk);
|
|
477
|
+
writer.writeUInt64BE(this.payoutSerialId);
|
|
478
|
+
writer.writeUInt64BE(this.offerCollateral);
|
|
479
|
+
|
|
480
|
+
// Changed from u16 to bigsize as per dlcspecs PR #163
|
|
481
|
+
writer.writeBigSize(this.fundingInputs.length);
|
|
482
|
+
|
|
483
|
+
for (const fundingInput of this.fundingInputs) {
|
|
484
|
+
// Use serializeBody() to match rust-dlc behavior - funding inputs in vec are serialized without TLV wrapper
|
|
485
|
+
writer.writeBytes(fundingInput.serializeBody());
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
writer.writeUInt16BE(this.changeSpk.length);
|
|
489
|
+
writer.writeBytes(this.changeSpk);
|
|
490
|
+
writer.writeUInt64BE(this.changeSerialId);
|
|
491
|
+
writer.writeUInt64BE(this.fundOutputSerialId);
|
|
492
|
+
writer.writeUInt64BE(this.feeRatePerVb);
|
|
493
|
+
writer.writeUInt32BE(this.cetLocktime);
|
|
494
|
+
writer.writeUInt32BE(this.refundLocktime);
|
|
495
|
+
|
|
496
|
+
// TLV stream as per dlcspecs PR #163
|
|
497
|
+
if (this.metadata) writer.writeBytes(this.metadata.serialize());
|
|
498
|
+
if (this.ircInfo) writer.writeBytes(this.ircInfo.serialize());
|
|
499
|
+
if (this.positionInfo) writer.writeBytes(this.positionInfo.serialize());
|
|
500
|
+
if (this.batchFundingGroups)
|
|
501
|
+
this.batchFundingGroups.forEach((fundingInfo) =>
|
|
502
|
+
writer.writeBytes(fundingInfo.serialize()),
|
|
503
|
+
);
|
|
504
|
+
|
|
505
|
+
// Write unknown TLVs for forward compatibility
|
|
506
|
+
if (this.unknownTlvs) {
|
|
507
|
+
this.unknownTlvs.forEach((tlv) => {
|
|
508
|
+
writer.writeBytes(tlv.data);
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
return writer.toBuffer();
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export interface IDlcOfferJSON {
|
|
517
|
+
type?: number; // Made optional for rust-dlc compatibility
|
|
518
|
+
protocolVersion: number;
|
|
519
|
+
temporaryContractId: string;
|
|
520
|
+
contractFlags: number;
|
|
521
|
+
chainHash: string;
|
|
522
|
+
contractInfo: ISingleContractInfoJSON | IDisjointContractInfoJSON;
|
|
523
|
+
fundingPubkey: string;
|
|
524
|
+
payoutSpk: string;
|
|
525
|
+
payoutSerialId: number;
|
|
526
|
+
offerCollateral: number;
|
|
527
|
+
fundingInputs: IFundingInputJSON[];
|
|
528
|
+
changeSpk: string;
|
|
529
|
+
changeSerialId: number;
|
|
530
|
+
fundOutputSerialId: number;
|
|
531
|
+
feeRatePerVb: number;
|
|
532
|
+
cetLocktime: number;
|
|
533
|
+
refundLocktime: number;
|
|
534
|
+
serialized?: string; // Made optional - hex serialization for compatibility testing
|
|
535
|
+
tlvs?: (
|
|
536
|
+
| IOrderMetadataJSON
|
|
537
|
+
| IOrderIrcInfoJSON
|
|
538
|
+
| IOrderPositionInfoJSON
|
|
539
|
+
| IBatchFundingGroupJSON
|
|
540
|
+
| any
|
|
541
|
+
)[]; // Made optional - for unknown TLVs
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export interface IDlcOfferAddresses {
|
|
545
|
+
fundingAddress: string;
|
|
546
|
+
changeAddress: string;
|
|
547
|
+
payoutAddress: string;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
export class DlcOfferContainer {
|
|
551
|
+
private offers: DlcOffer[] = [];
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Adds a DlcOffer to the container.
|
|
555
|
+
* @param offer The DlcOffer to add.
|
|
556
|
+
*/
|
|
557
|
+
public addOffer(offer: DlcOffer): void {
|
|
558
|
+
this.offers.push(offer);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Returns all DlcOffers in the container.
|
|
563
|
+
* @returns An array of DlcOffer instances.
|
|
564
|
+
*/
|
|
565
|
+
public getOffers(): DlcOffer[] {
|
|
566
|
+
return this.offers;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Serializes all DlcOffers in the container to a Buffer.
|
|
571
|
+
* @returns A Buffer containing the serialized DlcOffers.
|
|
572
|
+
*/
|
|
573
|
+
public serialize(): Buffer {
|
|
574
|
+
const writer = new BufferWriter();
|
|
575
|
+
// Write the number of offers in the container first.
|
|
576
|
+
writer.writeBigSize(this.offers.length);
|
|
577
|
+
// Serialize each offer and write it.
|
|
578
|
+
this.offers.forEach((offer) => {
|
|
579
|
+
const serializedOffer = offer.serialize();
|
|
580
|
+
// Optionally, write the length of the serialized offer for easier deserialization.
|
|
581
|
+
writer.writeBigSize(serializedOffer.length);
|
|
582
|
+
writer.writeBytes(serializedOffer);
|
|
583
|
+
});
|
|
584
|
+
return writer.toBuffer();
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Deserializes a Buffer into a DlcOfferContainer with DlcOffers.
|
|
589
|
+
* @param buf The Buffer to deserialize.
|
|
590
|
+
* @returns A DlcOfferContainer instance.
|
|
591
|
+
*/
|
|
592
|
+
public static deserialize(buf: Buffer): DlcOfferContainer {
|
|
593
|
+
const reader = new BufferReader(buf);
|
|
594
|
+
const container = new DlcOfferContainer();
|
|
595
|
+
const offersCount = reader.readBigSize();
|
|
596
|
+
for (let i = 0; i < offersCount; i++) {
|
|
597
|
+
// Optionally, read the length of the serialized offer if it was written during serialization.
|
|
598
|
+
const offerLength = reader.readBigSize();
|
|
599
|
+
const offerBuf = reader.readBytes(Number(offerLength));
|
|
600
|
+
const offer = DlcOffer.deserialize(offerBuf);
|
|
601
|
+
container.addOffer(offer);
|
|
602
|
+
}
|
|
603
|
+
return container;
|
|
604
|
+
}
|
|
605
|
+
}
|