mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-02 12:14:09 +01:00
Fix estimated fee calculation for customs fee rate (#1406)
* Update output.dart * fix estimated fee calculation * Update bitcoin_transaction_priority.dart
This commit is contained in:
@@ -282,13 +282,14 @@ class CWBitcoin extends Bitcoin {
|
||||
}
|
||||
|
||||
@override
|
||||
int getFeeAmountWithFeeRate(Object wallet, int feeRate, int inputsCount, int outputsCount,
|
||||
{int? size}) {
|
||||
int getEstimatedFeeWithFeeRate(Object wallet, int feeRate, int? amount,
|
||||
{int? outputsCount, int? size}) {
|
||||
final bitcoinWallet = wallet as ElectrumWallet;
|
||||
return bitcoinWallet.feeAmountWithFeeRate(
|
||||
return bitcoinWallet.calculateEstimatedFeeWithFeeRate(
|
||||
feeRate,
|
||||
inputsCount,
|
||||
outputsCount,
|
||||
amount,
|
||||
outputsCount: outputsCount,
|
||||
size: size,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,8 +126,8 @@ abstract class OutputBase with Store {
|
||||
|
||||
if (_wallet.type == WalletType.bitcoin) {
|
||||
if (_settingsStore.priority[_wallet.type] == bitcoin!.getBitcoinTransactionPriorityCustom()) {
|
||||
fee = bitcoin!.getFeeAmountWithFeeRate(
|
||||
_settingsStore.customBitcoinFeeRate, formattedCryptoAmount, 1, 1);
|
||||
fee = bitcoin!.getEstimatedFeeWithFeeRate(_wallet,
|
||||
_settingsStore.customBitcoinFeeRate,formattedCryptoAmount);
|
||||
}
|
||||
|
||||
return bitcoin!.formatterBitcoinAmountToDouble(amount: fee);
|
||||
|
||||
@@ -390,16 +390,12 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
|
||||
String setNewFee({double? value, required TransactionPriority priority}) {
|
||||
newFee = priority == bitcoin!.getBitcoinTransactionPriorityCustom() && value != null
|
||||
? bitcoin!.getFeeAmountWithFeeRate(
|
||||
wallet,
|
||||
value.round(),
|
||||
transactionInfo.inputAddresses?.length ?? 1,
|
||||
transactionInfo.outputAddresses?.length ?? 1)
|
||||
? bitcoin!.getEstimatedFeeWithFeeRate(wallet, value.round(), transactionInfo.amount)
|
||||
: bitcoin!.getFeeAmountForPriority(
|
||||
wallet,
|
||||
priority,
|
||||
transactionInfo.inputAddresses?.length ?? 1,
|
||||
transactionInfo.outputAddresses?.length ?? 1);
|
||||
wallet,
|
||||
priority,
|
||||
transactionInfo.inputAddresses?.length ?? 1,
|
||||
transactionInfo.outputAddresses?.length ?? 1);
|
||||
|
||||
return bitcoin!.formatterBitcoinAmountToString(amount: newFee);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user