"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Dlc {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    constructor(client) {
        this.client = client;
    }
    /**
     * Check whether wallet is offerer of DlcOffer or DlcAccept
     * @param dlcOffer Dlc Offer Message
     * @param dlcAccept Dlc Accept Message
     * @returns {Promise<boolean>}
     */
    async isOfferer(dlcOffer, dlcAccept) {
        return this.client.getMethod('isOfferer')(dlcOffer, dlcAccept);
    }
    /**
     * Create DlcTxs object from DlcOffer and DlcAccept
     * @param dlcOffer Dlc Offer Message
     * @param dlcAccept Dlc Accept Message
     * @returns {Promise<CreateDlcTxsResponse>}
     */
    async createDlcTxs(dlcOffer, dlcAccept) {
        return this.client.getMethod('createDlcTxs')(dlcOffer, dlcAccept);
    }
    /**
     * Create DLC Offer Message
     * @param contractInfo ContractInfo TLV (V0 or V1)
     * @param offerCollateralSatoshis Amount DLC Initiator is putting into the contract
     * @param feeRatePerVb Fee rate in satoshi per virtual byte that both sides use to compute fees in funding tx
     * @param cetLocktime The nLockTime to be put on CETs
     * @param refundLocktime The nLockTime to be put on the refund transaction
     * @returns {Promise<DlcOffer>}
     */
    async createDlcOffer(contractInfo, offerCollateralSatoshis, feeRatePerVb, cetLocktime, refundLocktime, fixedInputs, inputSupplementationMode) {
        return this.client.getMethod('createDlcOffer')(contractInfo, offerCollateralSatoshis, feeRatePerVb, cetLocktime, refundLocktime, fixedInputs, inputSupplementationMode);
    }
    async batchCreateDlcOffer(contractInfos, offerCollaterals, feeRatePerVb, cetLocktime, refundLocktimes, fixedInputs) {
        return this.client.getMethod('batchCreateDlcOffer')(contractInfos, offerCollaterals, feeRatePerVb, cetLocktime, refundLocktimes, fixedInputs);
    }
    /**
     * Accept DLC Offer
     * @param dlcOffer Dlc Offer Message
     * @param fixedInputs Optional inputs to use for Funding Inputs
     * @returns {Promise<AcceptDlcOfferResponse}
     */
    async acceptDlcOffer(dlcOffer, fixedInputs) {
        return this.client.getMethod('acceptDlcOffer')(dlcOffer, fixedInputs);
    }
    /**
     * Accept DLC Offer
     * @param dlcOffers Dlc Offer Messages
     * @param fixedInputs Optional inputs to use for Funding Inputs
     * @returns {Promise<BatchAcceptDlcOfferResponse}
     */
    async batchAcceptDlcOffer(dlcOffers, fixedInputs) {
        return this.client.getMethod('batchAcceptDlcOffer')(dlcOffers, fixedInputs);
    }
    /**
     * Sign Dlc Accept Message
     * @param dlcOffer Dlc Offer Message
     * @param dlcAccept Dlc Accept Message
     * @returns {Promise<SignDlcAcceptResponse}
     */
    async signDlcAccept(dlcOffer, dlcAccept) {
        return this.client.getMethod('signDlcAccept')(dlcOffer, dlcAccept);
    }
    /**
     * Batch Sign Dlc Accept Messages
     * @param dlcOffers Dlc Offer Messages
     * @param dlcAccepts Dlc Accept Messages
     * @returns {Promise<BatchSignDlcAcceptResponse}
     */
    async batchSignDlcAccept(dlcOffers, dlcAccepts) {
        return this.client.getMethod('batchSignDlcAccept')(dlcOffers, dlcAccepts);
    }
    /**
     * Finalize Dlc Sign
     * @param dlcOffer Dlc Offer Message
     * @param dlcAccept Dlc Accept Message
     * @param dlcSign Dlc Sign Message
     * @param dlcTxs Dlc Transactions Message
     * @returns {Promise<Tx>}
     */
    async finalizeDlcSign(dlcOffer, dlcAccept, dlcSign, dlcTxs) {
        return this.client.getMethod('finalizeDlcSign')(dlcOffer, dlcAccept, dlcSign, dlcTxs);
    }
    async batchFinalizeDlcSign(dlcOffers, dlcAccepts, dlcSigns, dlcTxsList) {
        return this.client.getMethod('batchFinalizeDlcSign')(dlcOffers, dlcAccepts, dlcSigns, dlcTxsList);
    }
    /**
     * Execute DLC
     * @param dlcOffer Dlc Offer Message
     * @param dlcAccept Dlc Accept Message
     * @param dlcSign Dlc Sign Message
     * @param dlcTxs Dlc Transactions Message
     * @param oracleAttestation Oracle Attestations TLV (V0)
     * @param isOfferer Whether party is Dlc Offerer
     * @returns {Promise<Tx>}
     */
    async execute(dlcOffer, dlcAccept, dlcSign, dlcTxs, oracleAttestation, isOfferer) {
        return this.client.getMethod('execute')(dlcOffer, dlcAccept, dlcSign, dlcTxs, oracleAttestation, isOfferer);
    }
    /**
     * Refund DLC
     * @param dlcOffer Dlc Offer Message
     * @param dlcAccept Dlc Accept Message
     * @param dlcSign Dlc Sign Message
     * @param dlcTxs Dlc Transactions message
     * @returns {Promise<Tx>}
     */
    async refund(dlcOffer, dlcAccept, dlcSign, dlcTxs) {
        return this.client.getMethod('refund')(dlcOffer, dlcAccept, dlcSign, dlcTxs);
    }
    /**
     * Generate DlcClose messagetype for closing DLC with Mutual Consent
     * @param dlcOffer DlcOffer TLV (V0)
     * @param dlcAccept DlcAccept TLV (V0)
     * @param dlcTxs DlcTransactions TLV (V0)
     * @param initiatorPayoutSatoshis Amount initiator expects as a payout
     * @param isOfferer Whether offerer or not
     * @param inputs Optionally specified closing inputs
     * @returns {Promise<DlcClose>}
     */
    async createDlcClose(dlcOffer, dlcAccept, dlcTxs, initiatorPayoutSatoshis, isOfferer, inputs) {
        return this.client.getMethod('createDlcClose')(dlcOffer, dlcAccept, dlcTxs, initiatorPayoutSatoshis, isOfferer, inputs);
    }
    /**
     * Generate multiple DlcClose messagetypes for closing DLC with Mutual Consent
     * @param dlcOffer DlcOffer TLV (V0)
     * @param dlcAccept DlcAccept TLV (V0)
     * @param dlcTxs DlcTransactions TLV (V0)
     * @param initiatorPayouts Array of amounts initiator expects as payouts
     * @param isOfferer Whether offerer or not
     * @param inputs Optionally specified closing inputs
     * @returns {Promise<DlcClose[]>}
     */
    async createBatchDlcClose(dlcOffer, dlcAccept, dlcTxs, initiatorPayouts, isOfferer, inputs) {
        return this.client.getMethod('createBatchDlcClose')(dlcOffer, dlcAccept, dlcTxs, initiatorPayouts, isOfferer, inputs);
    }
    async verifyBatchDlcCloseUsingMetadata(dlcCloseMetadata, _dlcCloses, isOfferer) {
        return this.client.getMethod('verifyBatchDlcCloseUsingMetadata')(dlcCloseMetadata, _dlcCloses, isOfferer);
    }
    /**
     * Verify multiple DlcClose messagetypes for closing DLC with Mutual Consent
     * @param dlcOffer DlcOffer TLV (V0)
     * @param dlcAccept DlcAccept TLV (V0)
     * @param dlcTxs DlcTransactions TLV (V0)
     * @param dlcCloses DlcClose[] TLV (V0)
     * @param isOfferer Whether offerer or not
     * @returns {Promise<void>}
     */
    async verifyBatchDlcClose(dlcOffer, dlcAccept, dlcTxs, dlcCloses, isOfferer) {
        return this.client.getMethod('verifyBatchDlcClose')(dlcOffer, dlcAccept, dlcTxs, dlcCloses, isOfferer);
    }
    /**
     * 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<string>}
     */
    finalizeDlcClose(dlcOffer, dlcAccept, dlcClose, dlcTxs) {
        return this.client.getMethod('finalizeDlcClose')(dlcOffer, dlcAccept, dlcClose, dlcTxs);
    }
    async AddSignatureToFundTransaction(jsonObject) {
        return this.client.getMethod('AddSignatureToFundTransaction')(jsonObject);
    }
    async CreateCetAdaptorSignature(jsonObject) {
        return this.client.getMethod('CreateCetAdaptorSignature')(jsonObject);
    }
    async CreateCetAdaptorSignatures(jsonObject) {
        return this.client.getMethod('CreateCetAdaptorSignatures')(jsonObject);
    }
    async AddSignaturesToRefundTx(jsonObject) {
        return this.client.getMethod('AddSignaturesToRefundTx')(jsonObject);
    }
    async CreateCet(jsonObject) {
        return this.client.getMethod('CreateCet')(jsonObject);
    }
    async CreateDlcTransactions(jsonObject) {
        return this.client.getMethod('CreateDlcTransactions')(jsonObject);
    }
    async CreateFundTransaction(jsonObject) {
        return this.client.getMethod('CreateFundTransaction')(jsonObject);
    }
    async CreateRefundTransaction(jsonObject) {
        return this.client.getMethod('CreateRefundTransaction')(jsonObject);
    }
    async GetRawFundTxSignature(jsonObject) {
        return this.client.getMethod('GetRawFundTxSignature')(jsonObject);
    }
    async GetRawRefundTxSignature(jsonObject) {
        return this.client.getMethod('GetRawRefundTxSignature')(jsonObject);
    }
    async SignCetRequest(jsonObject) {
        return this.client.getMethod('SignCetRequest')(jsonObject);
    }
    async SignFundTransaction(jsonObject) {
        return this.client.getMethod('SignFundTransaction')(jsonObject);
    }
    async VerifyCetAdaptorSignature(jsonObject) {
        return this.client.getMethod('VerifyCetAdaptorSignature')(jsonObject);
    }
    async VerifyCetAdaptorSignatures(jsonObject) {
        return this.client.getMethod('VerifyCetAdaptorSignatures')(jsonObject);
    }
    async GetInputsForAmount(amounts, feeRatePerVb, fixedInputs) {
        return this.client.getMethod('GetInputsForAmount')(amounts, feeRatePerVb, fixedInputs);
    }
    async SignCet(jsonObject) {
        return this.client.getMethod('SignCet')(jsonObject);
    }
    async VerifyCetAdaptorSignaturesRequest(jsonObject) {
        return this.client.getMethod('VerifyCetAdaptorSignatures')(jsonObject);
    }
    async VerifyFundTxSignature(jsonObject) {
        return this.client.getMethod('VerifyFundTxSignature')(jsonObject);
    }
    async VerifyRefundTxSignature(jsonObject) {
        return this.client.getMethod('VerifyRefundTxSignature')(jsonObject);
    }
    async CreateSplicedDlcTransactions(jsonObject) {
        return this.client.getMethod('CreateSplicedDlcTransactions')(jsonObject);
    }
    async GetRawDlcFundingInputSignature(jsonObject) {
        return this.client.getMethod('GetRawDlcFundingInputSignature')(jsonObject);
    }
    async SignDlcFundingInput(jsonObject) {
        return this.client.getMethod('SignDlcFundingInput')(jsonObject);
    }
    async VerifyDlcFundingInputSignature(jsonObject) {
        return this.client.getMethod('VerifyDlcFundingInputSignature')(jsonObject);
    }
    async fundingInputToInput(_input, findDerivationPath = true) {
        return this.client.getMethod('fundingInputToInput')(_input, findDerivationPath);
    }
    async inputToFundingInput(input) {
        return this.client.getMethod('inputToFundingInput')(input);
    }
    /**
     * Create DLC input info for splice transactions
     * @param fundTxid The funding transaction ID
     * @param fundVout The funding output index
     * @param fundAmount The funding amount in satoshis
     * @param localFundPubkey Local funding public key
     * @param remoteFundPubkey Remote funding public key
     * @param maxWitnessLength Maximum witness length
     * @param inputSerialId Optional input serial ID
     * @returns {DlcInputInfoRequest} DLC input info
     */
    createDlcInputInfo(fundTxid, fundVout, fundAmount, localFundPubkey, remoteFundPubkey, contractId, maxWitnessLength, inputSerialId) {
        return {
            fundTxid,
            fundVout,
            fundAmount,
            localFundPubkey,
            remoteFundPubkey,
            contractId,
            maxWitnessLength,
            inputSerialId,
        };
    }
    /**
     * Calculate the maximum collateral possible with given inputs
     * @param inputs Array of inputs to use for funding
     * @param feeRatePerVb Fee rate in satoshis per virtual byte
     * @param contractCount Number of DLC contracts (default: 1)
     * @returns {Promise<bigint>} Maximum collateral amount in satoshis
     */
    async calculateMaxCollateral(inputs, feeRatePerVb, contractCount = 1) {
        return this.client.getMethod('calculateMaxCollateral')(inputs, feeRatePerVb, contractCount);
    }
    /**
     * Create DLC funding input from DLC input info
     * @param dlcInputInfo DLC input information
     * @param fundTxHex Optional funding transaction hex
     * @returns {Promise<IInput>} DLC funding input
     */
    async createDlcFundingInput(dlcInputInfo, fundTxHex) {
        const fundingInput = await this.client.getMethod('createDlcFundingInput')(dlcInputInfo, fundTxHex);
        return this.fundingInputToInput(fundingInput);
    }
}
exports.default = Dlc;
//# sourceMappingURL=Dlc.js.map