diff --git a/.changeset/grumpy-dots-cheer.md b/.changeset/grumpy-dots-cheer.md new file mode 100644 index 000000000..0ca148247 --- /dev/null +++ b/.changeset/grumpy-dots-cheer.md @@ -0,0 +1,5 @@ +--- +'@xchainjs/xchain-bitcoin': minor +--- + +add feebound check to btc ledger client diff --git a/packages/xchain-bitcoin/src/clientLedger.ts b/packages/xchain-bitcoin/src/clientLedger.ts index 467cc4ce7..be2922153 100644 --- a/packages/xchain-bitcoin/src/clientLedger.ts +++ b/packages/xchain-bitcoin/src/clientLedger.ts @@ -1,6 +1,6 @@ import AppBtc from '@ledgerhq/hw-app-btc' import { Transaction } from '@ledgerhq/hw-app-btc/lib/types' -import { FeeOption, FeeRate, TxHash } from '@xchainjs/xchain-client' +import { FeeOption, FeeRate, TxHash, checkFeeBounds } from '@xchainjs/xchain-client' import { Address } from '@xchainjs/xchain-util' import { TxParams, UTXO, UtxoClientParams } from '@xchainjs/xchain-utxo' import * as Bitcoin from 'bitcoinjs-lib' @@ -54,6 +54,8 @@ class ClientLedger extends Client { const fromAddressIndex = params?.walletIndex || 0 // Get fee rate const feeRate = params.feeRate || (await this.getFeeRates())[FeeOption.Fast] + // Check if the fee rate is within the fee bounds + checkFeeBounds(this.feeBounds, feeRate) // Get sender address const sender = await this.getAddressAsync(fromAddressIndex) // Prepare transaction