Skip to content

feat: centralize fee logic and add Bitcoin deposit forwarding#3258

Draft
bernd2022 wants to merge 2 commits intodevelopfrom
feat/centralize-fee-logic-and-btc-forwarding
Draft

feat: centralize fee logic and add Bitcoin deposit forwarding#3258
bernd2022 wants to merge 2 commits intodevelopfrom
feat/centralize-fee-logic-and-btc-forwarding

Conversation

@bernd2022
Copy link
Collaborator

@bernd2022 bernd2022 commented Feb 24, 2026

Summary

  • Move getSendFeeRate() into BitcoinBasedFeeService using template method pattern, eliminating duplicate fee multiplier logic across Bitcoin and Firo services
  • Add dedicated Bitcoin deposit forwarding with explicit UTXO selection and subtract_fee_from_outputs for accurate fee handling
  • Add getUtxoForAddresses() to NodeClient for address-filtered UTXO queries
  • Remove dead code: unused DexFiroService.getFeeRate() wrapper, unused Config import in PayoutBitcoinService

Test plan

  • Verify TypeScript compilation passes (npm run build)
  • Verify all existing tests pass (npm test)
  • Verify Bitcoin deposit forwarding creates correct transactions with fee subtracted from output
  • Verify fee multiplier is applied consistently across all services (DexBitcoin, DexFiro, PayInBitcoin, PayInFiro, PayoutBitcoin)

Move getSendFeeRate() into BitcoinBasedFeeService using template method
pattern, eliminating duplicate fee multiplier logic across Bitcoin and
Firo services. Add dedicated Bitcoin deposit forwarding with explicit
UTXO selection and subtract_fee_from_outputs for accurate fee handling.
@bernd2022 bernd2022 marked this pull request as draft February 24, 2026 16:56
Move UTXO-from-address fetching and input mapping into a shared
sendManyFromAddress method on BitcoinBasedClient. FiroClient overrides
it with its raw-transaction approach. Simplifies forwardBitcoinDeposit
to a single method call.
Comment on lines +83 to +84
const utxos = await this.getUtxoForAddresses(fromAddresses, this.nodeConfig.allowUnconfirmedUtxos);
if (!utxos.length) return '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw error if no UTXOs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants