Skip to content

Commit

Permalink
added fee bound check to ledger (#1323)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorian1te authored Dec 20, 2024
1 parent 6ad44a3 commit 98eec32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-dots-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@xchainjs/xchain-bitcoin': minor
---

add feebound check to btc ledger client
4 changes: 3 additions & 1 deletion packages/xchain-bitcoin/src/clientLedger.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 98eec32

Please sign in to comment.