Estimated fee rates.

This commit is contained in:
M
2021-02-13 00:38:34 +02:00
parent b1047fb3cf
commit 35aabcd248
12 changed files with 252 additions and 168 deletions
+16 -2
View File
@@ -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();
}
}