mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
Estimated fee rates.
This commit is contained in:
@@ -97,7 +97,8 @@ abstract class SendViewModelBase with Store {
|
||||
}
|
||||
}
|
||||
|
||||
final fee = _wallet.calculateEstimatedFee(_settingsStore.priority[_wallet.type], amount);
|
||||
final fee = _wallet.calculateEstimatedFee(
|
||||
_settingsStore.priority[_wallet.type], amount);
|
||||
|
||||
if (_wallet is BitcoinWallet) {
|
||||
return bitcoinAmountToDouble(amount: fee);
|
||||
@@ -298,7 +299,8 @@ abstract class SendViewModelBase with Store {
|
||||
final amount = !sendAll ? _amount : null;
|
||||
final priority = _settingsStore.priority[_wallet.type];
|
||||
|
||||
return BitcoinTransactionCredentials(address, amount, priority as BitcoinTransactionPriority);
|
||||
return BitcoinTransactionCredentials(
|
||||
address, amount, priority as BitcoinTransactionPriority);
|
||||
case WalletType.monero:
|
||||
final amount = !sendAll ? _amount : null;
|
||||
final priority = _settingsStore.priority[_wallet.type];
|
||||
@@ -345,4 +347,16 @@ abstract class SendViewModelBase with Store {
|
||||
|
||||
void removeTemplate({Template template}) =>
|
||||
_sendTemplateStore.remove(template: template);
|
||||
|
||||
String displayFeeRate(dynamic priority) {
|
||||
final _priority = priority as TransactionPriority;
|
||||
final wallet = _wallet;
|
||||
|
||||
if (wallet is BitcoinWallet) {
|
||||
final rate = wallet.feeRate(_priority);
|
||||
return '${priority.toString()} ($rate sat/byte)';
|
||||
}
|
||||
|
||||
return priority.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,14 @@ class PickerListItem<ItemType> extends SettingsListItem {
|
||||
{@required String title,
|
||||
@required this.selectedItem,
|
||||
@required this.items,
|
||||
this.displayItem,
|
||||
void Function(ItemType item) onItemSelected})
|
||||
: _onItemSelected = onItemSelected,
|
||||
super(title);
|
||||
|
||||
final ItemType Function() selectedItem;
|
||||
final List<ItemType> items;
|
||||
final String Function(ItemType item) displayItem;
|
||||
final void Function(ItemType item) _onItemSelected;
|
||||
|
||||
void onItemSelected(dynamic item) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:cake_wallet/bitcoin/bitcoin_transaction_priority.dart';
|
||||
import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart';
|
||||
import 'package:cake_wallet/entities/balance.dart';
|
||||
import 'package:cake_wallet/entities/transaction_priority.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
@@ -74,6 +75,16 @@ abstract class SettingsViewModelBase with Store {
|
||||
PickerListItem(
|
||||
title: S.current.settings_fee_priority,
|
||||
items: priorityForWalletType(wallet.type),
|
||||
displayItem: (dynamic priority) {
|
||||
final _priority = priority as TransactionPriority;
|
||||
|
||||
if (wallet is BitcoinWallet) {
|
||||
final rate = wallet.feeRate(_priority);
|
||||
return '${priority.toString()} ($rate sat/byte)';
|
||||
}
|
||||
|
||||
return priority.toString();
|
||||
},
|
||||
selectedItem: () => transactionPriority,
|
||||
onItemSelected: (TransactionPriority priority) =>
|
||||
_settingsStore.priority[wallet.type] = priority),
|
||||
|
||||
Reference in New Issue
Block a user