diff --git a/packages/core/__tests__/dlc/finance/CsoInfo.spec.ts b/packages/core/__tests__/dlc/finance/CsoInfo.spec.ts index 7aebab9e..66524f59 100644 --- a/packages/core/__tests__/dlc/finance/CsoInfo.spec.ts +++ b/packages/core/__tests__/dlc/finance/CsoInfo.spec.ts @@ -20,6 +20,7 @@ import { dustThreshold, getFinalizerByCount, LinearPayout, + roundDownToNearestMultiplier, roundUpToNearestMultiplier, } from '../../../lib'; import { @@ -631,10 +632,19 @@ describe('CsoInfo', () => { } = getCsoInfoFromOffer(csoOrderOffer, 'v1'); // Fees are very high, so use dust threshold for max gain - const expectedMaxGainForContractSize = Value.fromSats( + const offerFees = Value.fromSats( getFinalizerByCount(feePerByte, numOfferInputs, 3, numContracts) .offerFees, - ).addn(Value.fromSats(dustThreshold(feePerByte))); + ); + const expectedMaxGainForContractSize_ = offerFees.addn( + Value.fromSats(dustThreshold(BigInt(feePerByte))), + ); + const expectedMaxGainForContractSize = Value.fromSats( + roundUpToNearestMultiplier( + expectedMaxGainForContractSize_.sats, + BigInt(100), + ), + ); const expectedMaxLossForContractSize = Value.fromSats( roundUpToNearestMultiplier( @@ -644,24 +654,24 @@ describe('CsoInfo', () => { ); const expectedNormalizedMaxGain = Value.fromSats( - roundUpToNearestMultiplier( + roundDownToNearestMultiplier( (expectedMaxGainForContractSize.sats * BigInt(1e8)) / contractSize.sats, BigInt(100), ), ); - expect(actualNormalizedMaxGain.sats).to.equal( - expectedNormalizedMaxGain.sats, - ); - expect(actualNormalizedMaxLoss.sats).to.equal(normalizedMaxLoss.sats); expect(actualMaxGainForContractSize.sats).to.equal( expectedMaxGainForContractSize.sats, ); expect(actualMaxLossForContractSize.sats).to.equal( expectedMaxLossForContractSize.sats, ); - expect(minPayout).to.equal(BigInt(119900)); + expect(actualNormalizedMaxLoss.sats).to.equal(normalizedMaxLoss.sats); + expect(actualNormalizedMaxGain.sats).to.equal( + expectedNormalizedMaxGain.sats, + ); // TODO: Fix issue with this line + expect(minPayout).to.equal(BigInt(121200)); expect(maxPayout).to.equal(collateral.sats); expect(actualContractSize.sats).to.equal(contractSize.sats); expect(actualOfferCollateral.sats).to.equal( @@ -706,10 +716,19 @@ describe('CsoInfo', () => { } = getCsoInfoFromOffer(csoOrderOffer, 'v1'); // Fees are very high, so use dust threshold for max gain - const expectedMaxGainForContractSize = Value.fromSats( + const offerFees = Value.fromSats( getFinalizerByCount(feePerByte, numOfferInputs, 3, numContracts) .offerFees, - ).addn(Value.fromSats(dustThreshold(feePerByte))); + ); + const expectedMaxGainForContractSize_ = offerFees.addn( + Value.fromSats(dustThreshold(BigInt(feePerByte))), + ); + const expectedMaxGainForContractSize = Value.fromSats( + roundUpToNearestMultiplier( + expectedMaxGainForContractSize_.sats, + BigInt(100), + ), + ); const expectedMaxLossForContractSize = Value.fromSats( roundUpToNearestMultiplier( @@ -719,7 +738,7 @@ describe('CsoInfo', () => { ); const expectedNormalizedMaxGain = Value.fromSats( - roundUpToNearestMultiplier( + roundDownToNearestMultiplier( (expectedMaxGainForContractSize.sats * BigInt(1e8)) / contractSize.sats, BigInt(100), @@ -736,7 +755,7 @@ describe('CsoInfo', () => { expect(actualMaxLossForContractSize.sats).to.equal( expectedMaxLossForContractSize.sats, ); - expect(minPayout).to.equal(BigInt(119900)); + expect(minPayout).to.equal(BigInt(121200)); expect(maxPayout).to.equal(collateral.sats); expect(actualContractSize.sats).to.equal(contractSize.sats); expect(actualOfferCollateral.sats).to.equal( @@ -781,10 +800,19 @@ describe('CsoInfo', () => { } = getCsoInfoFromOffer(csoOrderOffer, 'v1'); // Fees are very high, so use dust threshold for max gain - const expectedMaxGainForContractSize = Value.fromSats( + const offerFees = Value.fromSats( getFinalizerByCount(feePerByte, numOfferInputs, 3, numContracts) .offerFees, - ).addn(Value.fromSats(dustThreshold(feePerByte))); + ); + const expectedMaxGainForContractSize_ = offerFees.addn( + Value.fromSats(dustThreshold(BigInt(feePerByte))), + ); + const expectedMaxGainForContractSize = Value.fromSats( + roundUpToNearestMultiplier( + expectedMaxGainForContractSize_.sats, + BigInt(100), + ), + ); const expectedMaxLossForContractSize = Value.fromSats( roundUpToNearestMultiplier( @@ -794,7 +822,7 @@ describe('CsoInfo', () => { ); const expectedNormalizedMaxGain = Value.fromSats( - roundUpToNearestMultiplier( + roundDownToNearestMultiplier( (expectedMaxGainForContractSize.sats * BigInt(1e8)) / contractSize.sats, BigInt(100), @@ -811,7 +839,7 @@ describe('CsoInfo', () => { expect(actualMaxLossForContractSize.sats).to.equal( expectedMaxLossForContractSize.sats, ); - expect(minPayout).to.equal(BigInt(119900)); + expect(minPayout).to.equal(BigInt(121200)); expect(maxPayout).to.equal(collateral.sats); expect(actualContractSize.sats).to.equal(contractSize.sats); expect(actualOfferCollateral.sats).to.equal( diff --git a/packages/core/lib/dlc/TxBuilder.ts b/packages/core/lib/dlc/TxBuilder.ts index 9ac31e3b..22284a15 100644 --- a/packages/core/lib/dlc/TxBuilder.ts +++ b/packages/core/lib/dlc/TxBuilder.ts @@ -12,6 +12,7 @@ import { TxBuilder, Value, } from '@node-lightning/bitcoin'; +import Decimal from 'decimal.js'; import { DualFundingTxFinalizer } from './TxFinalizer'; @@ -21,48 +22,64 @@ export class DlcTxBuilder { readonly dlcAccept: DlcAcceptWithoutSigs, ) {} + public buildFundingTransaction(): Tx { + const txBuilder = new BatchDlcTxBuilder([this.dlcOffer], [this.dlcAccept]); + return txBuilder.buildFundingTransaction(); + } +} + +export class BatchDlcTxBuilder { + constructor( + readonly dlcOffers: DlcOfferV0[], + readonly dlcAccepts: DlcAcceptWithoutSigs[], + ) {} + public buildFundingTransaction(): Tx { const tx = new TxBuilder(); tx.version = 2; tx.locktime = LockTime.zero(); - const multisigScript = - Buffer.compare( - this.dlcOffer.fundingPubKey, - this.dlcAccept.fundingPubKey, - ) === -1 - ? Script.p2msLock( - 2, - this.dlcOffer.fundingPubKey, - this.dlcAccept.fundingPubKey, - ) - : Script.p2msLock( - 2, - this.dlcAccept.fundingPubKey, - this.dlcOffer.fundingPubKey, - ); - const witScript = Script.p2wshLock(multisigScript); - - const offerInput = this.dlcOffer.offerCollateralSatoshis; - const acceptInput = this.dlcAccept.acceptCollateralSatoshis; - - const totalInput = offerInput + acceptInput; + if (this.dlcOffers.length !== this.dlcAccepts.length) + throw Error('DlcOffers and DlcAccepts must be the same length'); + if (this.dlcOffers.length === 0) throw Error('DlcOffers must not be empty'); + if (this.dlcAccepts.length === 0) + throw Error('DlcAccepts must not be empty'); + + // Ensure all DLC offers and accepts have the same funding inputs + this.ensureSameFundingInputs(); + + const multisigScripts: Script[] = []; + for (let i = 0; i < this.dlcOffers.length; i++) { + const offer = this.dlcOffers[i]; + const accept = this.dlcAccepts[i]; + + multisigScripts.push( + Buffer.compare(offer.fundingPubKey, accept.fundingPubKey) === -1 + ? Script.p2msLock(2, offer.fundingPubKey, accept.fundingPubKey) + : Script.p2msLock(2, accept.fundingPubKey, offer.fundingPubKey), + ); + } + + const witScripts = multisigScripts.map((multisigScript) => + Script.p2wshLock(multisigScript), + ); const finalizer = new DualFundingTxFinalizer( - this.dlcOffer.fundingInputs, - this.dlcOffer.payoutSPK, - this.dlcOffer.changeSPK, - this.dlcAccept.fundingInputs, - this.dlcAccept.payoutSPK, - this.dlcAccept.changeSPK, - this.dlcOffer.feeRatePerVb, + this.dlcOffers[0].fundingInputs, + this.dlcOffers[0].payoutSPK, + this.dlcOffers[0].changeSPK, + this.dlcAccepts[0].fundingInputs, + this.dlcAccepts[0].payoutSPK, + this.dlcAccepts[0].changeSPK, + this.dlcOffers[0].feeRatePerVb, + this.dlcOffers.length, ); - this.dlcOffer.fundingInputs.forEach((input) => { + this.dlcOffers[0].fundingInputs.forEach((input) => { if (input.type !== MessageType.FundingInputV0) throw Error('FundingInput must be V0'); }); - const offerFundingInputs: FundingInputV0[] = this.dlcOffer.fundingInputs.map( + const offerFundingInputs: FundingInputV0[] = this.dlcOffers[0].fundingInputs.map( (input) => input as FundingInputV0, ); @@ -70,7 +87,7 @@ export class DlcTxBuilder { return total + input.prevTx.outputs[input.prevTxVout].value.sats; }, BigInt(0)); - const acceptTotalFunding = this.dlcAccept.fundingInputs.reduce( + const acceptTotalFunding = this.dlcAccepts[0].fundingInputs.reduce( (total, input) => { return total + input.prevTx.outputs[input.prevTxVout].value.sats; }, @@ -79,7 +96,7 @@ export class DlcTxBuilder { const fundingInputs: FundingInputV0[] = [ ...offerFundingInputs, - ...this.dlcAccept.fundingInputs, + ...this.dlcAccepts[0].fundingInputs, ]; fundingInputs.sort( @@ -94,28 +111,64 @@ export class DlcTxBuilder { ); }); - const fundingValue = - totalInput + finalizer.offerFutureFee + finalizer.acceptFutureFee; + const offerInput = this.dlcOffers.reduce( + (total, offer) => total + offer.offerCollateralSatoshis, + BigInt(0), + ); + const acceptInput = this.dlcAccepts.reduce( + (total, accept) => total + accept.acceptCollateralSatoshis, + BigInt(0), + ); + + const totalInputs = this.dlcOffers.map((offer, i) => { + const offerInput = offer.offerCollateralSatoshis; + const acceptInput = this.dlcAccepts[i].acceptCollateralSatoshis; + return offerInput + acceptInput; + }); + + const fundingValues = totalInputs.map((totalInput) => { + const offerFutureFeePerOffer = new Decimal( + finalizer.offerFutureFee.toString(), + ) + .div(this.dlcOffers.length) + .ceil() + .toNumber(); + const acceptFutureFeePerAccept = new Decimal( + finalizer.acceptFutureFee.toString(), + ) + .div(this.dlcAccepts.length) + .ceil() + .toNumber(); + + return ( + totalInput + + Value.fromSats(offerFutureFeePerOffer).sats + + Value.fromSats(acceptFutureFeePerAccept).sats + ); + }); + const offerChangeValue = offerTotalFunding - offerInput - finalizer.offerFees; const acceptChangeValue = acceptTotalFunding - acceptInput - finalizer.acceptFees; const outputs: Output[] = []; - outputs.push({ - value: Value.fromSats(Number(fundingValue)), - script: witScript, - serialId: this.dlcOffer.fundOutputSerialId, + witScripts.forEach((witScript, i) => { + outputs.push({ + value: Value.fromSats(Number(fundingValues[i])), + script: witScript, + serialId: this.dlcOffers[i].fundOutputSerialId, + }); }); outputs.push({ value: Value.fromSats(Number(offerChangeValue)), - script: Script.p2wpkhLock(this.dlcOffer.changeSPK.slice(2)), - serialId: this.dlcOffer.changeSerialId, + script: Script.p2wpkhLock(this.dlcOffers[0].changeSPK.slice(2)), + serialId: this.dlcOffers[0].changeSerialId, }); outputs.push({ value: Value.fromSats(Number(acceptChangeValue)), - script: Script.p2wpkhLock(this.dlcAccept.changeSPK.slice(2)), - serialId: this.dlcAccept.changeSerialId, + script: Script.p2wpkhLock(this.dlcAccepts[0].changeSPK.slice(2)), + serialId: this.dlcAccepts[0].changeSerialId, }); outputs.sort((a, b) => Number(a.serialId) - Number(b.serialId)); @@ -126,6 +179,46 @@ export class DlcTxBuilder { return tx.toTx(); } + + private ensureSameFundingInputs(): void { + // Check for offers + const referenceOfferInputs = this.dlcOffers[0].fundingInputs.map((input) => + input.serialize().toString('hex'), + ); + for (let i = 1; i < this.dlcOffers.length; i++) { + const currentInputs = this.dlcOffers[i].fundingInputs.map((input) => + input.serialize().toString('hex'), + ); + if (!this.arraysEqual(referenceOfferInputs, currentInputs)) { + throw new Error( + `Funding inputs for offer ${i} do not match the first offer's funding inputs.`, + ); + } + } + + // Check for accepts + const referenceAcceptInputs = this.dlcAccepts[0].fundingInputs.map( + (input) => input.serialize().toString('hex'), + ); + for (let i = 1; i < this.dlcAccepts.length; i++) { + const currentInputs = this.dlcAccepts[i].fundingInputs.map((input) => + input.serialize().toString('hex'), + ); + if (!this.arraysEqual(referenceAcceptInputs, currentInputs)) { + throw new Error( + `Funding inputs for accept ${i} do not match the first accept's funding inputs.`, + ); + } + } + } + + private arraysEqual(arr1: string[], arr2: string[]): boolean { + if (arr1.length !== arr2.length) return false; + for (let i = 0; i < arr1.length; i++) { + if (arr1[i] !== arr2[i]) return false; + } + return true; + } } interface Output { diff --git a/packages/core/lib/dlc/TxFinalizer.ts b/packages/core/lib/dlc/TxFinalizer.ts index a567ceb7..76638cfb 100644 --- a/packages/core/lib/dlc/TxFinalizer.ts +++ b/packages/core/lib/dlc/TxFinalizer.ts @@ -1,4 +1,5 @@ import { FundingInput, FundingInputV0, MessageType } from '@node-dlc/messaging'; +import { Decimal } from 'decimal.js'; const BATCH_FUND_TX_BASE_WEIGHT = 42; const FUNDING_OUTPUT_SIZE = 43; @@ -30,9 +31,12 @@ export class DualFundingTxFinalizer { ); // https://github.com/discreetlogcontracts/dlcspecs/blob/8ee4bbe816c9881c832b1ce320b9f14c72e3506f/Transactions.md#expected-weight-of-the-contract-execution-or-refund-transaction const futureFeeWeight = 249 + 4 * payoutSPK.length; - const futureFeeVBytes = Math.ceil(futureFeeWeight / 4); - const futureFee = - this.feeRate * BigInt(futureFeeVBytes) * BigInt(numContracts); + const futureFeeVBytes = new Decimal(futureFeeWeight) + .times(numContracts) + .div(4) + .ceil() + .toNumber(); + const futureFee = this.feeRate * BigInt(futureFeeVBytes); // https://github.com/discreetlogcontracts/dlcspecs/blob/8ee4bbe816c9881c832b1ce320b9f14c72e3506f/Transactions.md#expected-weight-of-the-funding-transaction const inputWeight = inputs.reduce((total, input) => { @@ -42,7 +46,7 @@ export class DualFundingTxFinalizer { (BATCH_FUND_TX_BASE_WEIGHT + FUNDING_OUTPUT_SIZE * numContracts * 4) / 2; const outputWeight = 36 + 4 * changeSPK.length + contractWeight; const weight = outputWeight + inputWeight; - const vbytes = Math.ceil(weight / 4); + const vbytes = new Decimal(weight).div(4).ceil().toNumber(); const fundingFee = this.feeRate * BigInt(vbytes); return { futureFee, fundingFee }; @@ -115,7 +119,7 @@ export class DualClosingTxFinalizer { }, 0); const outputWeight = 36 + 4 * payoutSPK.length; const weight = 213 + outputWeight + inputWeight; - const vbytes = Math.ceil(weight / 4); + const vbytes = new Decimal(weight).div(4).ceil().toNumber(); const fee = this.feeRate * BigInt(vbytes); return fee; diff --git a/packages/core/lib/dlc/finance/Builder.ts b/packages/core/lib/dlc/finance/Builder.ts index 04739516..116638b5 100644 --- a/packages/core/lib/dlc/finance/Builder.ts +++ b/packages/core/lib/dlc/finance/Builder.ts @@ -73,6 +73,11 @@ export const roundUpToNearestMultiplier = ( multiplier: bigint, ): bigint => ((num + multiplier - BigInt(1)) / multiplier) * multiplier; +export const roundDownToNearestMultiplier = ( + num: bigint, + multiplier: bigint, +): bigint => num - (num % multiplier); + export type DlcParty = 'offeror' | 'acceptor' | 'neither'; /** diff --git a/packages/core/lib/dlc/finance/CsoInfo.ts b/packages/core/lib/dlc/finance/CsoInfo.ts index 3f676845..7e36a350 100644 --- a/packages/core/lib/dlc/finance/CsoInfo.ts +++ b/packages/core/lib/dlc/finance/CsoInfo.ts @@ -196,13 +196,11 @@ export const getCsoInfoParamsFromContractInfoV1 = ( const normalizedMaxLoss = ONE_BTC_CONTRACT.clone(); normalizedMaxLoss.sub(startOutcomeValue); - const maxGainForContractSize = Value.fromBitcoin( - new Decimal(normalizedMaxGain.bitcoin) - .times(contractSize.bitcoin) - .toDecimalPlaces( - 8 - Math.log10(Number(UNIT_MULTIPLIER[unit.toLowerCase()])), - ) - .toNumber(), + const maxGainForContractSize = Value.fromSats( + roundUpToNearestMultiplier( + (normalizedMaxGain.sats * contractSize.sats) / BigInt(1e8), + BigInt(UNIT_MULTIPLIER[unit.toLowerCase()]), + ), ); const maxLossForContractSize = Value.fromSats( diff --git a/packages/core/package-lock.json b/packages/core/package-lock.json index 17566d3b..988f66ef 100644 --- a/packages/core/package-lock.json +++ b/packages/core/package-lock.json @@ -4,6 +4,26 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@node-dlc/bitcoin": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@node-dlc/bitcoin/-/bitcoin-0.23.0.tgz", + "integrity": "sha512-oHGXJjOQ9WV4V2ZSaPs3j84+vWcONfJs9IYDXwSZV0R228geyLlAmqL2v/9N/m0y0DuDYGsvgGsCev/A3V9gJQ==" + }, + "@node-dlc/messaging": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@node-dlc/messaging/-/messaging-0.23.0.tgz", + "integrity": "sha512-AVyiSEV6AMcTQPHE6z1lJCl8fvPDQFBAIE0TuUxiZQJmrsR8MXL3qH/lDOIb2nDKN/TrR+HCuB/L8Wzs77BvtA==", + "requires": { + "@node-dlc/bitcoin": "^0.23.0", + "@node-lightning/bitcoin": "0.26.1", + "@node-lightning/bufio": "0.26.1", + "@node-lightning/checksum": "0.26.1", + "@node-lightning/wire": "0.26.1", + "bip-schnorr": "0.6.3", + "bitcoin-networks": "^1.0.0", + "bitcoinjs-lib": "5.2.0" + } + }, "@node-lightning/bitcoin": { "version": "0.26.1", "resolved": "https://registry.npmjs.org/@node-lightning/bitcoin/-/bitcoin-0.26.1.tgz", @@ -18,6 +38,11 @@ "resolved": "https://registry.npmjs.org/@node-lightning/bufio/-/bufio-0.26.1.tgz", "integrity": "sha512-AxTALfvajmxa5uPz7oZ42acBP689SGAWhWmO311Rsyn2dq2f8WVqQ3uts08QZTTI0NpX4KRY4IVfgbsTUFcYRg==" }, + "@node-lightning/checksum": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/@node-lightning/checksum/-/checksum-0.26.1.tgz", + "integrity": "sha512-/UctRMO6A+MhMueUGCuQsq7ynXeNnL5vT02sNtaPOinxryXA7HBv3vpy91jeznn3yg8JjVGHXy0fVlFr/hQjaw==" + }, "@node-lightning/core": { "version": "0.26.1", "resolved": "https://registry.npmjs.org/@node-lightning/core/-/core-0.26.1.tgz", @@ -36,6 +61,33 @@ "secp256k1": "^4.0.2" } }, + "@node-lightning/logger": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/@node-lightning/logger/-/logger-0.26.1.tgz", + "integrity": "sha512-rkP7h5g3j4OKyutBR5+3Bp+KsxmyKH6sfr9Rd2CKiE3xlsJP61F1yWSBTlk9qXySIdybkh7Q+uRIZUrxRZHkaQ==" + }, + "@node-lightning/noise": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/@node-lightning/noise/-/noise-0.26.1.tgz", + "integrity": "sha512-p9lG6KwjH9DpUDKWdsBFLqGA4cjPqzaCJIZkJmxsuE27PH9PtQ+xy/YBNUcmAsmdDjFwrJ4ScFcymWteqYVNOg==", + "requires": { + "@node-lightning/crypto": "^0.26.1", + "@node-lightning/logger": "^0.26.1" + } + }, + "@node-lightning/wire": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/@node-lightning/wire/-/wire-0.26.1.tgz", + "integrity": "sha512-oNKUntAXrSxNSCL+w7er3Vqn9gbgnldQXuwiJPuLZllAt4eeBFA6rzR3hLjr5yZsv1QXBkqNKCzUyKquZGkI/Q==", + "requires": { + "@node-lightning/bufio": "^0.26.1", + "@node-lightning/checksum": "^0.26.1", + "@node-lightning/core": "^0.26.1", + "@node-lightning/crypto": "^0.26.1", + "@node-lightning/logger": "^0.26.1", + "@node-lightning/noise": "^0.26.1" + } + }, "@types/node": { "version": "16.10.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.3.tgz", @@ -55,6 +107,11 @@ "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" }, + "bigi": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz", + "integrity": "sha512-ddkU+dFIuEIW8lE7ZwdIAf2UPoM90eaprg5m3YXAVVTmKlqV/9BX4A2M8BOK2yOq6/VgZFVhK6QAxJebhlbhzw==" + }, "bignumber.js": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.2.tgz", @@ -68,6 +125,18 @@ "file-uri-to-path": "1.0.0" } }, + "bip-schnorr": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/bip-schnorr/-/bip-schnorr-0.6.3.tgz", + "integrity": "sha512-aScZ6wkbhxki/WhVghCPUTT0Uwar9FJ0tpFPhj5LcyFhtuFDsLvb0uNvwEVAVMBe8pHdjfNMvylBjksPdorRhA==", + "requires": { + "bigi": "^1.4.2", + "ecurve": "^1.0.6", + "js-sha256": "^0.9.0", + "randombytes": "^2.1.0", + "safe-buffer": "^5.2.1" + } + }, "bip174": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/bip174/-/bip174-2.1.0.tgz", @@ -204,6 +273,15 @@ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" }, + "ecurve": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/ecurve/-/ecurve-1.0.6.tgz", + "integrity": "sha512-/BzEjNfiSuB7jIWKcS/z8FK9jNjmEWvUV2YZ4RLSmcDtP7Lq0m6FvDuSnJpBlDpGRpfRQeTLGLBI8H+kEv0r+w==", + "requires": { + "bigi": "^1.1.0", + "safe-buffer": "^5.0.1" + } + }, "elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", @@ -257,6 +335,11 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "js-sha256": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", + "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", diff --git a/packages/rocksdb/__tests__/rocksdb-dlc-store.spec.ts b/packages/rocksdb/__tests__/rocksdb-dlc-store.spec.ts index 8d0ab385..3fffc8c8 100644 --- a/packages/rocksdb/__tests__/rocksdb-dlc-store.spec.ts +++ b/packages/rocksdb/__tests__/rocksdb-dlc-store.spec.ts @@ -2,7 +2,6 @@ import { DlcTxBuilder } from '@node-dlc/core'; import { - ContractInfoV0, DlcAcceptV0, DlcCancelV0, DlcCloseV0,