@node-dlc/messaging
Advanced tools
Comparing version 0.23.3 to 0.23.4
import { Value } from '@node-dlc/bitcoin'; | ||
import { BufferReader } from '@node-lightning/bufio'; | ||
import { expect } from 'chai'; | ||
import { BatchFundingGroup } from '../../lib'; | ||
import { deserializeTlv } from '../../lib/serialize/deserializeTlv'; | ||
import { getTlv } from '../../lib/serialize/getTlv'; | ||
@@ -52,2 +55,22 @@ describe('BatchFundingGroup TLV', () => { | ||
}); | ||
it('should serialize and deserialize with empty contract ids', () => { | ||
const batchFundingGroup = new BatchFundingGroup(); | ||
const eventIds = ['event1', 'event2', 'event3']; | ||
batchFundingGroup.eventIds = eventIds; | ||
batchFundingGroup.allocatedCollateral = Value.fromBitcoin(0.5); | ||
batchFundingGroup.tempContractIds = []; | ||
batchFundingGroup.contractIds = []; | ||
const deserialized = BatchFundingGroup.deserialize( | ||
batchFundingGroup.serialize(), | ||
); | ||
expect(deserialized.eventIds).to.deep.equal(eventIds); | ||
expect(batchFundingGroup.serialize()).to.deep.equal( | ||
deserialized.serialize(), | ||
); | ||
}); | ||
}); |
import { BitcoinNetworks } from 'bitcoin-networks'; | ||
import { expect } from 'chai'; | ||
import { OrderPositionInfoV0 } from '../../lib'; | ||
import { ContractInfo } from '../../lib/messages/ContractInfo'; | ||
import { | ||
BatchFundingGroup, | ||
OrderIrcInfoV0, | ||
OrderMetadataV0, | ||
OrderPositionInfoV0, | ||
} from '../../lib'; | ||
import { ContractInfo, ContractInfoV0 } from '../../lib/messages/ContractInfo'; | ||
import { | ||
DlcOffer, | ||
@@ -433,2 +438,91 @@ DlcOfferContainer, | ||
}); | ||
describe('TLVs', () => { | ||
it('should deserialize with all TLV types present', () => { | ||
const contractFlags = Buffer.from('00', 'hex'); | ||
const chainHash = Buffer.from( | ||
'06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f', | ||
'hex', | ||
); | ||
const contractInfo = ContractInfoV0.deserialize( | ||
Buffer.from( | ||
'fdd82efd03e80000000000fe502bfda7209c0015fda72684000300fe00f3e2a30000fda72816000200fe00f3e2a30000fe000ea79ffe00f3e2a30000fe000ea79ffe00f3e2a30000fda7281a0002fe000ea79ffe00f3e2a30000fe000f47c8fe00fe502b0000fe000f47c8fe00fe502b0000fda7281a0002fe000f47c8fe00fe502b0000fe001ffffffe00fe502b0000fe001ffffffe00fe502b0000fda7240e000200fd8235fe000b71b0fd411afda712fd033afdd824fd03340c9050848d0ae5294a88020f45ee3c920dcf5c050effa1894480f1c7d6c8fb24ffb379ba9b87f6b4279b104761c776126f85400ea9bb6c6c91c8953af92ae686c3d07289c2ade25405c1c421b38c9322cd73fb2c89f42ce0730a35fae1f8875dfdd822fd02ce001536393424064fae281c59dfce1842dbdb1a696f34620611d25035ed53b8f79f07a855f3c3b2d300d4bfdce1e325b6a59a60272276d89f283db41ca90e3aedbb522fa3c1f8bc08de68c4c5b6ce177f0c62c683fca22b61eccb41fb06bb6e8881d3c23b4d88536e68d65de66e8a7d1c2ec0e6316fdc0d25c4cf42ebaf1775b168fdc847c824efd6f6ae43d9ba0e973de205979971020ebec4919c97cae238513e41e2bc759cd11d213ca2a118e948e0c380eb8bdcf4bcb5eebce6e57c2b22c10fd7083e53643d29206ff66ca5e02485c710e57a1a2de36612323cb7d6ddd1521b4128ce0fb18ff87dda1b796cefa1ec25e89e26f964a0bb6b78423cdf2dbf60df41f6187bdb7e01aeb6c53d7ccb608cc5afbd469e8b45017e1c34bf94dbfb58f3b9a363d4c89bb3ca7f060540b6b03ea6e296381c781fe70d9343aefa095dfdd39dc65f6f748a7a23d4b293ad36e2df52fd988d7a6327088afb483c45b4d21a8e13ef3bec9324cd8b8945dc3c7c534c2c742bd3ecd45bd2c50b78707ea43752ced2620e3cf429ab93c07e137ccf1662376e1d3290818a2020033911deeedc0fe8322091d5bb7b959723c15cb20b7fd2d71abded50cfd4b4db89076d87ad2a0171de9bac64d34e18b7c741618a4e68ca2431631c6fd88b5b90a1d007cc7ac22597df943df27b23d53a1e3a6fe01f5f230a8eb6ae8c7f4c1d40e63d2765250b66f468692bf1b0afa7d7e2ccc8cdc7ca6d691f3327aa3b5b27440ecf3cdcc0da0a9be605f3b4518685624688aa3da90e6a74041cf9330dda94f44d8aabf904e2e31fa54c0503289729cf92bbd63aaf56f97df7baa5a3b677cce06edf54602242671f18695728b465e95fa997a8a4852727e5416433970b902f918485554577129f130b177b7f9d958936c8adf69711e0369f07e8ce92cba06f6e0d91c3f32a8634e52b67046313fdd80a0e00020004626974730000000000151561746f6d69632d656e67696e652d74726164652d31', | ||
'hex', | ||
), | ||
); | ||
const fundingPubkey = Buffer.from( | ||
'03636a2812026c6ea83a6eb27f579ae588aa48dd221fafa049e6613e48ff03953a', | ||
'hex', | ||
); | ||
const payoutSPK = Buffer.from( | ||
'0014ecf78cf9c4e3cf16b5dccdbd013a7b84cd530d0c', | ||
'hex', | ||
); | ||
const payoutSerialId = BigInt(29829); | ||
const offerCollateralSatoshis = BigInt(16649967); | ||
const fundingInput = FundingInputV0.deserialize( | ||
Buffer.from( | ||
'fda714fd01fd0000000000a34e3b01e70200000000010369a13b156aff1cf5027140f45d41840c5c552b6d1c512cbb3b1610b850e47ae40000000000feffffff55767d33c145aea3efe723d9803916340fd013ee4f5ad8491e88d38bf8cd180e0000000000feffffff6bab2f95d6b0ca6abf8e8adbec1e70a79bc553c433e1d942f49084f1a1b73bb70100000000feffffff0100e1f50500000000160014bc32a8067fe02ea3a0d1b0daf42e17dd4039992d02473044022055662f02effb509e37bc074c6915eddb09658e6d388e545270ad08ce0bf339a702204b54713323a9bf37e575d4f3349080e4fae1a50762ab2d572967d185a0d16e8901210293914f759527e8e47770750242e7198738705b3a4b2de4f672456497aebf00820247304402202f9d4f5dc184868f866f978f7b4433167d4f50d13329a91eef5f6feec1974019022059b38836960fc3d45fc60021fd2215ad54d2a50224f523e110d48ab63dec4e61012102248d7ea318582d01f9f4c5267a18e28b9a4c03f69877075451f37f4c38af529e0247304402202b592244c641b678d13b059b822754b8f532c0d8ba7ece9a1c3b199b7acea27e02202c506668a40278075d4c6ad68bab0fa8db26fcd1b458aa5becc8a3c845cd86d701210230dbeb555b88731390f0431d3b329002c057cec662d80a8b47f5560433f2efd63104000000000000ffffffff006c0000', | ||
'hex', | ||
), | ||
); | ||
const changeSPK = Buffer.from( | ||
'0014a734d87e6d29d79422f7e5ea7a7709f65dac60e9', | ||
'hex', | ||
); | ||
const changeSerialId = BigInt(94880); | ||
const fundOutputSerialId = BigInt(44394); | ||
const feeRatePerVb = BigInt(45); | ||
const cetLocktime = 1712689645; | ||
const refundLocktime = 1719255498; | ||
const metadata = OrderMetadataV0.deserialize( | ||
Buffer.from('fdf5360f06656e67696e650000000000000000', 'hex'), | ||
); | ||
const ircInfo = OrderIrcInfoV0.deserialize( | ||
Buffer.from( | ||
'fdf53832104130346a7a504b4b726a6751456f506802dff1fe9bd33ce81881120be26c27d443247bfd3398866a7dc071867e94ff69c9', | ||
'hex', | ||
), | ||
); | ||
const positionInfo = OrderPositionInfoV0.deserialize( | ||
Buffer.from( | ||
'fdf53a32010000000000001b121561746f6d69632d656e67696e652d74726164652d310000000000fe502b0000000000000000000000', | ||
'hex', | ||
), | ||
); | ||
const batchFundingGroup = BatchFundingGroup.deserialize( | ||
BatchFundingGroup.deserialize( | ||
Buffer.from( | ||
'fdff967900000000000005f5e100051561746f6d69632d656e67696e652d74726164652d311561746f6d69632d656e67696e652d74726164652d321561746f6d69632d656e67696e652d74726164652d331561746f6d69632d656e67696e652d74726164652d341561746f6d69632d656e67696e652d74726164652d35', | ||
'hex', | ||
), | ||
).serialize(), | ||
); | ||
const dlcOffer = new DlcOfferV0(); | ||
dlcOffer.contractFlags = contractFlags; | ||
dlcOffer.chainHash = chainHash; | ||
dlcOffer.contractInfo = contractInfo; | ||
dlcOffer.fundingPubKey = fundingPubkey; | ||
dlcOffer.payoutSPK = payoutSPK; | ||
dlcOffer.payoutSerialId = payoutSerialId; | ||
dlcOffer.offerCollateralSatoshis = offerCollateralSatoshis; | ||
dlcOffer.fundingInputs = [fundingInput]; | ||
dlcOffer.changeSPK = changeSPK; | ||
dlcOffer.changeSerialId = changeSerialId; | ||
dlcOffer.fundOutputSerialId = fundOutputSerialId; | ||
dlcOffer.feeRatePerVb = feeRatePerVb; | ||
dlcOffer.cetLocktime = cetLocktime; | ||
dlcOffer.refundLocktime = refundLocktime; | ||
dlcOffer.metadata = metadata; | ||
dlcOffer.ircInfo = ircInfo; | ||
dlcOffer.positionInfo = positionInfo; | ||
dlcOffer.batchFundingGroups = [batchFundingGroup]; | ||
expect(dlcOffer.toJSON()).to.deep.equal( | ||
DlcOfferV0.deserialize(dlcOffer.serialize()).toJSON(), | ||
); | ||
}); | ||
}); | ||
}); |
@@ -1,1 +0,1 @@ | ||
{"processes":{"6866ee3c-078d-4c12-a387-5b58becbb427":{"parent":null,"children":[]}},"files":{"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/chain/ChainManager.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcTransactions.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/MessageType.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/util.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/chain/ChainMemoryStore.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/irc/IrcMessage.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/AddressCache.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/index.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/chain/DlcStore.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/chain/IChainFilterChainClient.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/domain/Address.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/BatchFundingGroup.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/CetAdaptorSignaturesV0.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/ContractDescriptor.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/serialize/getTlv.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/PayoutFunction.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/PayoutCurvePiece.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/RoundingIntervalsV0.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/ContractInfo.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcMessage.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcAccept.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/serialize/deserializeTlv.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/FundingInput.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/NegotiationFields.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcClose.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/FundingSignaturesV0.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/ScriptWitnessV0.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcOffer.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderIrcInfo.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderMetadata.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderPositionInfo.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcSign.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/NodeAnnouncementMessage.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleAnnouncementV0.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleEventV0.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/EventDescriptor.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleAttestationV0.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderAccept.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderNegotiationFields.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderOffer.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/validation/validate.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleInfoV0.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcCancel.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcCloseMetadata.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcIds.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcInfo.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleEventContainerV0.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleIdentifierV0.ts":["6866ee3c-078d-4c12-a387-5b58becbb427"]},"externalIds":{}} | ||
{"processes":{"92c9257a-aed5-4c1f-acb6-27a508a33a02":{"parent":null,"children":[]}},"files":{"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/chain/ChainManager.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcTransactions.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/MessageType.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/util.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/chain/ChainMemoryStore.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/irc/IrcMessage.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/AddressCache.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/index.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/chain/DlcStore.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/chain/IChainFilterChainClient.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/domain/Address.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/BatchFundingGroup.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/CetAdaptorSignaturesV0.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/ContractDescriptor.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/serialize/getTlv.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/PayoutFunction.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/PayoutCurvePiece.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/RoundingIntervalsV0.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/ContractInfo.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcMessage.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcAccept.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/serialize/deserializeTlv.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/FundingInput.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/NegotiationFields.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcClose.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/FundingSignaturesV0.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/ScriptWitnessV0.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcOffer.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderIrcInfo.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderMetadata.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderPositionInfo.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcSign.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/NodeAnnouncementMessage.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleAnnouncementV0.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleEventV0.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/EventDescriptor.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleAttestationV0.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderAccept.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderNegotiationFields.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OrderOffer.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/validation/validate.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleInfoV0.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcCancel.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcCloseMetadata.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcIds.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/DlcInfo.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleEventContainerV0.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/messaging/lib/messages/OracleIdentifierV0.ts":["92c9257a-aed5-4c1f-acb6-27a508a33a02"]},"externalIds":{}} |
@@ -41,2 +41,3 @@ /// <reference types="node" /> | ||
type: MessageType; | ||
length: bigint; | ||
tempContractIds: Buffer[]; | ||
@@ -43,0 +44,0 @@ contractIds: Buffer[]; |
@@ -50,2 +50,3 @@ "use strict"; | ||
reader.readBigSize(); // read type | ||
instance.length = reader.readBigSize(); | ||
const tempContractIdsCount = reader.readBigSize(); | ||
@@ -64,4 +65,5 @@ for (let i = 0; i < Number(tempContractIdsCount); i++) { | ||
for (let i = 0; i < Number(eventIdsCount); i++) { | ||
const length = reader.readBigSize(); | ||
instance.eventIds.push(reader.readBytes(Number(length)).toString()); | ||
const eventIdLength = reader.readBigSize(); | ||
const eventIdBuf = reader.readBytes(Number(eventIdLength)); | ||
instance.eventIds.push(eventIdBuf.toString()); | ||
} | ||
@@ -88,19 +90,22 @@ return instance; | ||
writer.writeBigSize(this.type); | ||
writer.writeBigSize(this.tempContractIds.length); | ||
const dataWriter = new bufio_1.BufferWriter(); | ||
dataWriter.writeBigSize(this.tempContractIds.length); | ||
this.tempContractIds.forEach((id) => { | ||
writer.writeBigSize(id.length); | ||
writer.writeBytes(id); | ||
dataWriter.writeBigSize(id.length); | ||
dataWriter.writeBytes(id); | ||
}); | ||
writer.writeBigSize(this.contractIds.length); | ||
dataWriter.writeBigSize(this.contractIds.length); | ||
this.contractIds.forEach((id) => { | ||
writer.writeBigSize(id.length); | ||
writer.writeBytes(id); | ||
dataWriter.writeBigSize(id.length); | ||
dataWriter.writeBytes(id); | ||
}); | ||
writer.writeUInt64BE(this.allocatedCollateral.sats); | ||
writer.writeBigSize(this.eventIds.length); | ||
dataWriter.writeUInt64BE(this.allocatedCollateral.sats); | ||
dataWriter.writeBigSize(this.eventIds.length); | ||
this.eventIds.forEach((id) => { | ||
const idBuffer = Buffer.from(id); | ||
writer.writeBigSize(idBuffer.length); | ||
writer.writeBytes(idBuffer); | ||
dataWriter.writeBigSize(id.length); | ||
dataWriter.writeBytes(idBuffer); | ||
}); | ||
writer.writeBigSize(dataWriter.size); | ||
writer.writeBytes(dataWriter.toBuffer()); | ||
return writer.toBuffer(); | ||
@@ -107,0 +112,0 @@ } |
@@ -44,2 +44,4 @@ import { Value } from '@node-dlc/bitcoin'; | ||
reader.readBigSize(); // read type | ||
instance.length = reader.readBigSize(); | ||
const tempContractIdsCount = reader.readBigSize(); | ||
@@ -61,4 +63,5 @@ for (let i = 0; i < Number(tempContractIdsCount); i++) { | ||
for (let i = 0; i < Number(eventIdsCount); i++) { | ||
const length = reader.readBigSize(); | ||
instance.eventIds.push(reader.readBytes(Number(length)).toString()); | ||
const eventIdLength = reader.readBigSize(); | ||
const eventIdBuf = reader.readBytes(Number(eventIdLength)); | ||
instance.eventIds.push(eventIdBuf.toString()); | ||
} | ||
@@ -74,2 +77,4 @@ | ||
public length: bigint; | ||
public tempContractIds: Buffer[] = []; | ||
@@ -103,23 +108,28 @@ | ||
writer.writeBigSize(this.tempContractIds.length); | ||
const dataWriter = new BufferWriter(); | ||
dataWriter.writeBigSize(this.tempContractIds.length); | ||
this.tempContractIds.forEach((id) => { | ||
writer.writeBigSize(id.length); | ||
writer.writeBytes(id); | ||
dataWriter.writeBigSize(id.length); | ||
dataWriter.writeBytes(id); | ||
}); | ||
writer.writeBigSize(this.contractIds.length); | ||
dataWriter.writeBigSize(this.contractIds.length); | ||
this.contractIds.forEach((id) => { | ||
writer.writeBigSize(id.length); | ||
writer.writeBytes(id); | ||
dataWriter.writeBigSize(id.length); | ||
dataWriter.writeBytes(id); | ||
}); | ||
writer.writeUInt64BE(this.allocatedCollateral.sats); | ||
dataWriter.writeUInt64BE(this.allocatedCollateral.sats); | ||
writer.writeBigSize(this.eventIds.length); | ||
dataWriter.writeBigSize(this.eventIds.length); | ||
this.eventIds.forEach((id) => { | ||
const idBuffer = Buffer.from(id); | ||
writer.writeBigSize(idBuffer.length); | ||
writer.writeBytes(idBuffer); | ||
dataWriter.writeBigSize(id.length); | ||
dataWriter.writeBytes(idBuffer); | ||
}); | ||
writer.writeBigSize(dataWriter.size); | ||
writer.writeBytes(dataWriter.toBuffer()); | ||
return writer.toBuffer(); | ||
@@ -126,0 +136,0 @@ } |
{ | ||
"name": "@node-dlc/messaging", | ||
"version": "0.23.3", | ||
"version": "0.23.4", | ||
"description": "DLC Messaging Protocol", | ||
@@ -25,3 +25,3 @@ "scripts": { | ||
"dependencies": { | ||
"@node-dlc/bitcoin": "^0.23.3", | ||
"@node-dlc/bitcoin": "^0.23.4", | ||
"@node-lightning/bitcoin": "0.26.1", | ||
@@ -44,3 +44,3 @@ "@node-lightning/bufio": "0.26.1", | ||
}, | ||
"gitHead": "99b218a59a310b8d4a4c0fb0a3ee457944760360" | ||
"gitHead": "b1ec102a8172bf1f967406918125d80b43e33b53" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4103567
25837
+ Addedbn.js@4.12.1(transitive)
+ Addednode-gyp-build@4.8.3(transitive)
- Removedbn.js@4.12.0(transitive)
- Removednode-gyp-build@4.8.2(transitive)
Updated@node-dlc/bitcoin@^0.23.4