@atomicfinance/bitcoin-dlc-provider
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -5,5 +5,4 @@ /// <reference types="node" /> | ||
import { BitcoinNetwork } from '@liquality/bitcoin-networks'; | ||
import { CetAdaptorSignaturesV0, ContractDescriptorV1, ContractInfo, DlcAccept, DlcAcceptV0, DlcOffer, DlcOfferV0, DlcSign, DlcTransactions, DlcTransactionsV0, FundingInput, HyperbolaPayoutCurvePiece, OracleAttestationV0 } from '@node-dlc/messaging'; | ||
import { CetAdaptorSignaturesV0, ContractDescriptorV1, ContractInfo, DlcAccept, DlcClose, DlcOffer, DlcSign, DlcTransactions, FundingInput, HyperbolaPayoutCurvePiece, OracleAttestationV0 } from '@node-dlc/messaging'; | ||
import { Tx } from '@node-lightning/bitcoin'; | ||
import { Psbt } from 'bitcoinjs-lib'; | ||
export default class BitcoinDlcProvider extends Provider implements Partial<DlcProvider> { | ||
@@ -47,3 +46,2 @@ _network: BitcoinNetwork; | ||
private GetFundPrivateKey; | ||
BuildCloseTx(dlcOffer: DlcOfferV0, dlcAccept: DlcAcceptV0, dlcTxs: DlcTransactionsV0, initiatorPayoutSatoshis: bigint, isOfferer: boolean, inputs?: Input[]): Promise<Psbt>; | ||
/** | ||
@@ -110,5 +108,9 @@ * Check whether wallet is offerer of DlcOffer or DlcAccept | ||
/** | ||
* Generate PSBT for closing DLC with Mutual Consent | ||
* If no PSBT provided, assume initiator | ||
* If PSBT provided, assume reciprocator | ||
* Goal of createDlcClose is for alice (the initiator) to | ||
* 1. take dlcoffer, accept, and sign messages. Create a dlcClose message. | ||
* 2. Build a close tx, sign. | ||
* 3. return dlcClose message (no psbt) | ||
*/ | ||
/** | ||
* Generate DlcClose messagetype for closing DLC with Mutual Consent | ||
* @param _dlcOffer DlcOffer TLV (V0) | ||
@@ -119,7 +121,22 @@ * @param _dlcAccept DlcAccept TLV (V0) | ||
* @param isOfferer Whether offerer or not | ||
* @param _psbt Partially Signed Bitcoin Transaction | ||
* @param _inputs Optionally specified closing inputs | ||
* @returns {Promise<Psbt>} | ||
* @returns {Promise<DlcClose>} | ||
*/ | ||
close(_dlcOffer: DlcOffer, _dlcAccept: DlcAccept, _dlcTxs: DlcTransactions, initiatorPayoutSatoshis: bigint, isOfferer: boolean, _psbt?: Psbt, _inputs?: Input[]): Promise<Psbt>; | ||
createDlcClose(_dlcOffer: DlcOffer, _dlcAccept: DlcAccept, _dlcTxs: DlcTransactions, initiatorPayoutSatoshis: bigint, isOfferer: boolean, _inputs?: Input[]): Promise<DlcClose>; | ||
/** | ||
* Goal of finalize Dlc Close is for bob to | ||
* 1. take the dlcClose created by alice using createDlcClose, | ||
* 2. Build a psbt using Alice's dlcClose message | ||
* 3. Sign psbt with bob's privkey | ||
* 4. return a tx ready to be broadcast | ||
*/ | ||
/** | ||
* Finalize Dlc Close | ||
* @param _dlcOffer Dlc Offer Message | ||
* @param _dlcAccept Dlc Accept Message | ||
* @param _dlcClose Dlc Close Message | ||
* @param _dlcTxs Dlc Transactions Message | ||
* @returns {Promise<Tx>} | ||
*/ | ||
finalizeDlcClose(_dlcOffer: DlcOffer, _dlcAccept: DlcAccept, _dlcClose: DlcClose, _dlcTxs: DlcTransactions): Promise<string>; | ||
AddSignatureToFundTransaction(jsonObject: AddSignatureToFundTransactionRequest): Promise<AddSignatureToFundTransactionResponse>; | ||
@@ -126,0 +143,0 @@ CreateCetAdaptorSignature(jsonObject: CreateCetAdaptorSignatureRequest): Promise<CreateCetAdaptorSignatureResponse>; |
import { Messages, PayoutRequest } from '@atomicfinance/types'; | ||
import { DlcAccept, DlcAcceptV0, DlcOffer, DlcOfferV0, DlcSign, DlcSignV0, DlcTransactions, DlcTransactionsV0 } from '@node-dlc/messaging'; | ||
import { DlcAccept, DlcAcceptV0, DlcClose, DlcCloseV0, DlcOffer, DlcOfferV0, DlcSign, DlcSignV0, DlcTransactions, DlcTransactionsV0 } from '@node-dlc/messaging'; | ||
export declare function asyncForEach(array: any, callback: any): Promise<void>; | ||
@@ -11,2 +11,3 @@ export declare function generateSerialId(): bigint; | ||
_dlcSign?: DlcSign; | ||
_dlcClose?: DlcClose; | ||
_dlcTxs?: DlcTransactions; | ||
@@ -18,2 +19,3 @@ } | ||
dlcSign?: DlcSignV0; | ||
dlcClose?: DlcCloseV0; | ||
dlcTxs?: DlcTransactionsV0; | ||
@@ -20,0 +22,0 @@ } |
@@ -20,3 +20,3 @@ "use strict"; | ||
function checkTypes(types) { | ||
const { _dlcOffer, _dlcAccept, _dlcSign, _dlcTxs } = types; | ||
const { _dlcOffer, _dlcAccept, _dlcSign, _dlcClose, _dlcTxs } = types; | ||
if (_dlcOffer && _dlcOffer.type !== messaging_1.MessageType.DlcOfferV0) | ||
@@ -28,2 +28,4 @@ throw Error('DlcOffer must be V0'); | ||
throw Error('DlcSign must be V0'); | ||
if (_dlcClose && _dlcClose.type !== messaging_1.MessageType.DlcCloseV0) | ||
throw Error('DlcClose must be V0'); | ||
if (_dlcTxs && _dlcTxs.type !== messaging_1.MessageType.DlcTransactionsV0) | ||
@@ -34,2 +36,3 @@ throw Error('DlcTransactions must be V0'); | ||
let dlcSign; | ||
let dlcClose; | ||
let dlcTxs; | ||
@@ -42,5 +45,7 @@ if (_dlcOffer) | ||
dlcSign = _dlcSign; | ||
if (_dlcClose) | ||
dlcClose = _dlcClose; | ||
if (_dlcTxs) | ||
dlcTxs = _dlcTxs; | ||
return { dlcOffer, dlcAccept, dlcSign, dlcTxs }; | ||
return { dlcOffer, dlcAccept, dlcSign, dlcClose, dlcTxs }; | ||
} | ||
@@ -47,0 +52,0 @@ exports.checkTypes = checkTypes; |
@@ -5,2 +5,4 @@ import { Messages, PayoutRequest } from '@atomicfinance/types'; | ||
DlcAcceptV0, | ||
DlcClose, | ||
DlcCloseV0, | ||
DlcOffer, | ||
@@ -27,3 +29,3 @@ DlcOfferV0, | ||
export function checkTypes(types: ICheckTypesRequest): ICheckTypesResponse { | ||
const { _dlcOffer, _dlcAccept, _dlcSign, _dlcTxs } = types; | ||
const { _dlcOffer, _dlcAccept, _dlcSign, _dlcClose, _dlcTxs } = types; | ||
if (_dlcOffer && _dlcOffer.type !== MessageType.DlcOfferV0) | ||
@@ -35,2 +37,4 @@ throw Error('DlcOffer must be V0'); | ||
throw Error('DlcSign must be V0'); | ||
if (_dlcClose && _dlcClose.type !== MessageType.DlcCloseV0) | ||
throw Error('DlcClose must be V0'); | ||
if (_dlcTxs && _dlcTxs.type !== MessageType.DlcTransactionsV0) | ||
@@ -42,2 +46,3 @@ throw Error('DlcTransactions must be V0'); | ||
let dlcSign: DlcSignV0; | ||
let dlcClose: DlcCloseV0; | ||
let dlcTxs: DlcTransactionsV0; | ||
@@ -48,5 +53,6 @@ | ||
if (_dlcSign) dlcSign = _dlcSign as DlcSignV0; | ||
if (_dlcClose) dlcClose = _dlcClose as DlcCloseV0; | ||
if (_dlcTxs) dlcTxs = _dlcTxs as DlcTransactionsV0; | ||
return { dlcOffer, dlcAccept, dlcSign, dlcTxs }; | ||
return { dlcOffer, dlcAccept, dlcSign, dlcClose, dlcTxs }; | ||
} | ||
@@ -93,2 +99,3 @@ | ||
_dlcSign?: DlcSign; | ||
_dlcClose?: DlcClose; | ||
_dlcTxs?: DlcTransactions; | ||
@@ -101,2 +108,3 @@ } | ||
dlcSign?: DlcSignV0; | ||
dlcClose?: DlcCloseV0; | ||
dlcTxs?: DlcTransactionsV0; | ||
@@ -103,0 +111,0 @@ } |
{ | ||
"name": "@atomicfinance/bitcoin-dlc-provider", | ||
"umdName": "BitcoinDlcProvider", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "CAL Finance Bitcoin Dlc Provider", | ||
@@ -18,5 +18,5 @@ "author": "Atomic Finance <info@atomic.finance>", | ||
"dependencies": { | ||
"@atomicfinance/bitcoin-networks": "^2.2.0", | ||
"@atomicfinance/provider": "^2.2.0", | ||
"@atomicfinance/types": "^2.2.0", | ||
"@atomicfinance/bitcoin-networks": "^2.2.1", | ||
"@atomicfinance/provider": "^2.2.1", | ||
"@atomicfinance/types": "^2.2.1", | ||
"@liquality/bitcoin-utils": "1.1.5", | ||
@@ -26,4 +26,4 @@ "@liquality/provider": "1.1.5", | ||
"@liquality/utils": "1.1.5", | ||
"@node-dlc/core": "0.9.7", | ||
"@node-dlc/messaging": "0.9.7", | ||
"@node-dlc/core": "0.10.3", | ||
"@node-dlc/messaging": "0.10.3", | ||
"@node-lightning/bitcoin": "0.22.1", | ||
@@ -46,3 +46,3 @@ "@node-lightning/bufio": "0.22.1", | ||
}, | ||
"gitHead": "96cab9339c9c6917c73f3f4f75f3fd4e54ffb493" | ||
"gitHead": "7d0509c7426510e24c4e387aaec06fb48deda154" | ||
} |
Sorry, the diff of this file is too big to display
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 too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
0
100
3763
211200
15
1
+ Added@node-dlc/core@0.10.3(transitive)
+ Added@node-dlc/messaging@0.10.3(transitive)
- Removed@node-dlc/core@0.9.7(transitive)
- Removed@node-dlc/messaging@0.9.7(transitive)
Updated@atomicfinance/types@^2.2.1
Updated@node-dlc/core@0.10.3
Updated@node-dlc/messaging@0.10.3