From e97a3142fdd095e9e5cd7ac39950dfc0fdb1737a Mon Sep 17 00:00:00 2001 From: Serhii Date: Mon, 28 Aug 2023 17:49:32 +0300 Subject: [PATCH] fix BitcoinCashTransactionPriority --- .../lib/bitcoin_transaction_priority.dart | 3 +-- .../lib/src/bitcoin_cash_wallet.dart | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cw_bitcoin/lib/bitcoin_transaction_priority.dart b/cw_bitcoin/lib/bitcoin_transaction_priority.dart index 47ca23690..c957f357d 100644 --- a/cw_bitcoin/lib/bitcoin_transaction_priority.dart +++ b/cw_bitcoin/lib/bitcoin_transaction_priority.dart @@ -1,5 +1,4 @@ import 'package:cw_core/transaction_priority.dart'; -//import 'package:cake_wallet/generated/i18n.dart'; class BitcoinTransactionPriority extends TransactionPriority { const BitcoinTransactionPriority({required String title, required int raw}) @@ -128,7 +127,7 @@ class BitcoinCashTransactionPriority extends BitcoinTransactionPriority { } @override - String get units => 'Latoshi'; + String get units => 'Satoshi'; @override String toString() { diff --git a/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart b/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart index 61a492c47..c6bf79f0d 100644 --- a/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart +++ b/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart @@ -10,6 +10,7 @@ import 'package:cw_bitcoin/electrum_wallet.dart'; import 'package:cw_bitcoin/electrum_wallet_snapshot.dart'; import 'package:cw_bitcoin_cash/src/pending_bitcoin_cash_transaction.dart'; import 'package:cw_core/crypto_currency.dart'; +import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/unspent_coins_info.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:flutter/foundation.dart'; @@ -181,4 +182,21 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store { int feeAmountWithFeeRate(int feeRate, int inputsCount, int outputsCount) => feeRate * bitbox.BitcoinCash.getByteCount(inputsCount, outputsCount); + + @override + int feeRate(TransactionPriority priority) { + if (priority is BitcoinCashTransactionPriority) { + switch (priority) { + case BitcoinCashTransactionPriority.slow: + return 1; + case BitcoinCashTransactionPriority.medium: + return 5; + case BitcoinCashTransactionPriority.fast: + return 10; + } + } + + return 0; + } } +