Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added fee bound check to ledger #1323

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading