@node-dlc/core
Advanced tools
Comparing version 0.22.2 to 0.22.3
@@ -274,6 +274,6 @@ "use strict"; | ||
if (shiftForFees !== 'neither') { | ||
const csoInfo = new messaging_1.OrderCsoInfoV0(); | ||
csoInfo.shiftForFees = shiftForFees; | ||
csoInfo.fees = fees.sats; | ||
orderOffer.csoInfo = csoInfo; | ||
const positionInfo = new messaging_1.OrderPositionInfoV0(); | ||
positionInfo.shiftForFees = shiftForFees; | ||
positionInfo.fees = fees.sats; | ||
orderOffer.positionInfo = positionInfo; | ||
} | ||
@@ -280,0 +280,0 @@ return orderOffer; |
import { Value } from '@node-dlc/bitcoin'; | ||
import { ContractInfo, OrderCsoInfo, PayoutFunctionV0 } from '@node-dlc/messaging'; | ||
import { ContractInfo, OrderPositionInfo, PayoutFunctionV0 } from '@node-dlc/messaging'; | ||
import { DlcParty } from './Builder'; | ||
@@ -14,4 +14,4 @@ import { HasContractInfo, HasOfferCollateralSatoshis, HasType } from './OptionInfo'; | ||
} | ||
export declare type MaybeHasCsoInfo = { | ||
csoInfo?: OrderCsoInfo; | ||
export declare type MaybeHasPositionInfo = { | ||
positionInfo?: OrderPositionInfo; | ||
}; | ||
@@ -31,3 +31,3 @@ /** | ||
*/ | ||
export declare const getCsoInfoFromOffer: (offer: HasContractInfo & HasType & HasOfferCollateralSatoshis & MaybeHasCsoInfo) => CsoInfo; | ||
export declare const getCsoInfoFromOffer: (offer: HasContractInfo & HasType & HasOfferCollateralSatoshis & MaybeHasPositionInfo) => CsoInfo; | ||
/** | ||
@@ -34,0 +34,0 @@ * Validate Payout Function for proper CSO format |
@@ -88,10 +88,10 @@ "use strict"; | ||
const fees = bitcoin_1.Value.zero(); | ||
if (offer.csoInfo) { | ||
shiftForFees = offer.csoInfo.shiftForFees; | ||
fees.add(bitcoin_1.Value.fromSats(offer.csoInfo.fees)); | ||
if (offer.positionInfo) { | ||
shiftForFees = offer.positionInfo.shiftForFees; | ||
fees.add(bitcoin_1.Value.fromSats(offer.positionInfo.fees)); | ||
} | ||
const csoInfo = exports.getCsoInfoFromContractInfo(offer.contractInfo, shiftForFees, fees); | ||
if (csoInfo.offerCollateral.sats !== offer.offerCollateralSatoshis) | ||
const positionInfo = exports.getCsoInfoFromContractInfo(offer.contractInfo, shiftForFees, fees); | ||
if (positionInfo.offerCollateral.sats !== offer.offerCollateralSatoshis) | ||
throw Error('Offer was not generated with CSO ContractInfo'); | ||
return csoInfo; | ||
return positionInfo; | ||
}; | ||
@@ -98,0 +98,0 @@ exports.getCsoInfoFromOffer = getCsoInfoFromOffer; |
@@ -9,4 +9,4 @@ import { Value } from '@node-dlc/bitcoin'; | ||
OracleInfoV0, | ||
OrderCsoInfoV0, | ||
OrderOfferV0, | ||
OrderPositionInfoV0, | ||
PayoutFunctionV0, | ||
@@ -485,6 +485,6 @@ RoundingIntervalsV0, | ||
if (shiftForFees !== 'neither') { | ||
const csoInfo = new OrderCsoInfoV0(); | ||
csoInfo.shiftForFees = shiftForFees; | ||
csoInfo.fees = fees.sats; | ||
orderOffer.csoInfo = csoInfo; | ||
const positionInfo = new OrderPositionInfoV0(); | ||
positionInfo.shiftForFees = shiftForFees; | ||
positionInfo.fees = fees.sats; | ||
orderOffer.positionInfo = positionInfo; | ||
} | ||
@@ -491,0 +491,0 @@ |
@@ -8,4 +8,4 @@ import { Value } from '@node-dlc/bitcoin'; | ||
MessageType, | ||
OrderCsoInfo, | ||
OrderCsoInfoV0, | ||
OrderPositionInfo, | ||
OrderPositionInfoV0, | ||
PayoutFunctionV0, | ||
@@ -35,4 +35,4 @@ PolynomialPayoutCurvePiece, | ||
export type MaybeHasCsoInfo = { | ||
csoInfo?: OrderCsoInfo; | ||
export type MaybeHasPositionInfo = { | ||
positionInfo?: OrderPositionInfo; | ||
}; | ||
@@ -152,3 +152,3 @@ | ||
HasOfferCollateralSatoshis & | ||
MaybeHasCsoInfo, | ||
MaybeHasPositionInfo, | ||
): CsoInfo => { | ||
@@ -164,8 +164,8 @@ if ( | ||
if (offer.csoInfo) { | ||
shiftForFees = (offer.csoInfo as OrderCsoInfoV0).shiftForFees; | ||
fees.add(Value.fromSats((offer.csoInfo as OrderCsoInfoV0).fees)); | ||
if (offer.positionInfo) { | ||
shiftForFees = (offer.positionInfo as OrderPositionInfoV0).shiftForFees; | ||
fees.add(Value.fromSats((offer.positionInfo as OrderPositionInfoV0).fees)); | ||
} | ||
const csoInfo = getCsoInfoFromContractInfo( | ||
const positionInfo = getCsoInfoFromContractInfo( | ||
offer.contractInfo, | ||
@@ -176,6 +176,6 @@ shiftForFees, | ||
if (csoInfo.offerCollateral.sats !== offer.offerCollateralSatoshis) | ||
if (positionInfo.offerCollateral.sats !== offer.offerCollateralSatoshis) | ||
throw Error('Offer was not generated with CSO ContractInfo'); | ||
return csoInfo; | ||
return positionInfo; | ||
}; | ||
@@ -182,0 +182,0 @@ |
{ | ||
"name": "@node-dlc/core", | ||
"version": "0.22.2", | ||
"version": "0.22.3", | ||
"description": "DLC Core", | ||
@@ -26,4 +26,4 @@ "scripts": { | ||
"dependencies": { | ||
"@node-dlc/bitcoin": "^0.22.2", | ||
"@node-dlc/messaging": "^0.22.2", | ||
"@node-dlc/bitcoin": "^0.22.3", | ||
"@node-dlc/messaging": "^0.22.3", | ||
"@node-lightning/core": "0.26.1", | ||
@@ -39,3 +39,3 @@ "bignumber.js": "^9.0.1", | ||
}, | ||
"gitHead": "f4e89841b5b929d0f9a798664d374532d3dd12ce" | ||
"gitHead": "ad3a48f79b2d950eb15ed1d788cb87ff3a73d3a5" | ||
} |
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
1208259
Updated@node-dlc/bitcoin@^0.22.3
Updated@node-dlc/messaging@^0.22.3