From be7ce26a5a32b6bcd2502101b7192c6779e2e5b3 Mon Sep 17 00:00:00 2001 From: Polybius93 Date: Thu, 20 Jun 2024 15:47:13 +0200 Subject: [PATCH] feat: add bitcoinAmount arguemnt to funding transaction handling functions --- src/dlc-handlers/ledger-dlc-handler.ts | 3 ++- src/dlc-handlers/private-key-dlc-handler.ts | 3 ++- src/dlc-handlers/software-wallet-dlc-handler.ts | 3 ++- src/functions/bitcoin/index.ts | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/dlc-handlers/ledger-dlc-handler.ts b/src/dlc-handlers/ledger-dlc-handler.ts index 4592c48..bd84df8 100644 --- a/src/dlc-handlers/ledger-dlc-handler.ts +++ b/src/dlc-handlers/ledger-dlc-handler.ts @@ -265,6 +265,7 @@ export class LedgerDLCHandler { async createFundingPSBT( vault: RawVault, + bitcoinAmount: bigint, attestorGroupPublicKey: string, feeRateMultiplier?: number, customFeeRate?: bigint @@ -294,7 +295,7 @@ export class LedgerDLCHandler { } const fundingTransaction = await createFundingTransaction( - vault.valueLocked.toBigInt(), + bitcoinAmount, this.bitcoinNetwork, taprootMultisigPayment.address, nativeSegwitPayment, diff --git a/src/dlc-handlers/private-key-dlc-handler.ts b/src/dlc-handlers/private-key-dlc-handler.ts index d5b971a..9fd72cc 100644 --- a/src/dlc-handlers/private-key-dlc-handler.ts +++ b/src/dlc-handlers/private-key-dlc-handler.ts @@ -170,6 +170,7 @@ export class PrivateKeyDLCHandler { async createFundingPSBT( vault: RawVault, + bitcoinAmount: bigint, attestorGroupPublicKey: string, feeRateMultiplier?: number, customFeeRate?: bigint @@ -194,7 +195,7 @@ export class PrivateKeyDLCHandler { BigInt(await getFeeRate(this.bitcoinBlockchainFeeRecommendationAPI, feeRateMultiplier)); const fundingTransaction = await createFundingTransaction( - vault.valueLocked.toBigInt(), + bitcoinAmount, this.bitcoinNetwork, taprootMultisigPayment.address, nativeSegwitPayment, diff --git a/src/dlc-handlers/software-wallet-dlc-handler.ts b/src/dlc-handlers/software-wallet-dlc-handler.ts index 215a75e..23046a7 100644 --- a/src/dlc-handlers/software-wallet-dlc-handler.ts +++ b/src/dlc-handlers/software-wallet-dlc-handler.ts @@ -145,6 +145,7 @@ export class SoftwareWalletDLCHandler { async createFundingPSBT( vault: RawVault, + bitcoinAmount: bigint, attestorGroupPublicKey: string, feeRateMultiplier?: number, customFeeRate?: bigint @@ -176,7 +177,7 @@ export class SoftwareWalletDLCHandler { } const fundingTransaction = await createFundingTransaction( - vault.valueLocked.toBigInt(), + bitcoinAmount, this.bitcoinNetwork, taprootMultisigPayment.address, nativeSegwitPayment, diff --git a/src/functions/bitcoin/index.ts b/src/functions/bitcoin/index.ts index bc9e6fd..0d7ba9b 100644 --- a/src/functions/bitcoin/index.ts +++ b/src/functions/bitcoin/index.ts @@ -1,3 +1,4 @@ +import { getFeeAmount } from '../bitcoin/bitcoin-functions.js'; import { broadcastTransaction, fetchBitcoinBlockchainBlockHeight, @@ -15,5 +16,6 @@ export { broadcastTransaction, fetchBitcoinBlockchainBlockHeight, fetchBitcoinTransaction, + getFeeAmount, getBalance, };