Remove direct calls of cw_bitcoin BitcoinTransactionPriority from SendViewModel and SettingsViewModel. Add bitcoinTransactionPriorityWithLabel to bitcoin facade. (#574)

This commit is contained in:
mkyq 2022-10-28 18:09:27 -04:00 committed by GitHub
parent 12e7b45520
commit 52aabee658
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View file

@ -112,6 +112,10 @@ class CWBitcoin extends Bitcoin {
int formatterStringDoubleToBitcoinAmount(String amount)
=> stringDoubleToBitcoinAmount(amount);
@override
String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate)
=> (priority as BitcoinTransactionPriority).labelWithRate(rate);
@override
List<Unspent> getUnspents(Object wallet) {
final bitcoinWallet = wallet as ElectrumWallet;

View file

@ -1,7 +1,6 @@
import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/entities/transaction_description.dart';
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
import 'package:cw_bitcoin/bitcoin_transaction_priority.dart';
import 'package:cw_core/transaction_priority.dart';
import 'package:cake_wallet/view_model/send/output.dart';
import 'package:cake_wallet/view_model/send/send_template_view_model.dart';
@ -276,7 +275,7 @@ abstract class SendViewModelBase with Store {
if (isElectrumWallet) {
final rate = bitcoin!.getFeeRate(wallet, _priority);
return '${(priority as BitcoinTransactionPriority).labelWithRate(rate)}';
return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate);
}
return priority.toString();

View file

@ -1,7 +1,6 @@
import 'package:cake_wallet/entities/language_service.dart';
import 'package:cake_wallet/store/yat/yat_store.dart';
import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
import 'package:cw_bitcoin/bitcoin_transaction_priority.dart';
import 'package:flutter/cupertino.dart';
import 'package:mobx/mobx.dart';
import 'package:package_info/package_info.dart';
@ -137,7 +136,7 @@ abstract class SettingsViewModelBase with Store {
if (wallet.type == WalletType.bitcoin
|| wallet.type == WalletType.litecoin) {
final rate = bitcoin!.getFeeRate(wallet, _priority);
return '${(priority as BitcoinTransactionPriority).labelWithRate(rate)}';
return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate);
}
return priority.toString();

View file

@ -86,6 +86,7 @@ abstract class Bitcoin {
String formatterBitcoinAmountToString({required int amount});
double formatterBitcoinAmountToDouble({required int amount});
int formatterStringDoubleToBitcoinAmount(String amount);
String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate);
List<Unspent> getUnspents(Object wallet);
void updateUnspents(Object wallet);