mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
fix custom rate issue (#1579)
Some checks are pending
Cache Dependencies / test (push) Waiting to run
Some checks are pending
Cache Dependencies / test (push) Waiting to run
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
parent
14e99daa73
commit
acadee6ed5
5 changed files with 19 additions and 6 deletions
|
@ -435,6 +435,13 @@ class CWBitcoin extends Bitcoin {
|
|||
);
|
||||
}
|
||||
|
||||
@override
|
||||
int feeAmountWithFeeRate(Object wallet, int feeRate, int inputsCount, int outputsCount,
|
||||
{int? size}) {
|
||||
final bitcoinWallet = wallet as ElectrumWallet;
|
||||
return bitcoinWallet.feeAmountWithFeeRate(feeRate, inputsCount, outputsCount, size: size);
|
||||
}
|
||||
|
||||
@override
|
||||
int getMaxCustomFeeRate(Object wallet) {
|
||||
final bitcoinWallet = wallet as ElectrumWallet;
|
||||
|
|
|
@ -17,7 +17,7 @@ class StandardPickerListItem<T> extends TransactionDetailsListItem {
|
|||
final List<T> items;
|
||||
final String Function(T item, double sliderValue) displayItem;
|
||||
final Function(double) onSliderChanged;
|
||||
final Function(T) onItemSelected;
|
||||
final Function(T item, double sliderValue) onItemSelected;
|
||||
final int selectedIdx;
|
||||
final double? maxValue;
|
||||
final int customItemIndex;
|
||||
|
|
|
@ -23,7 +23,7 @@ class StandardPickerList<T> extends StatefulWidget {
|
|||
final int customItemIndex;
|
||||
final String Function(T item, double sliderValue) displayItem;
|
||||
final Function(double) onSliderChanged;
|
||||
final Function(T) onItemSelected;
|
||||
final Function(T item, double sliderValue) onItemSelected;
|
||||
final String value;
|
||||
final int selectedIdx;
|
||||
final double customValue;
|
||||
|
@ -50,6 +50,7 @@ class _StandardPickerListState<T> extends State<StandardPickerList<T>> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String adaptedDisplayItem(T item) => widget.displayItem(item, customValue);
|
||||
String adaptedOnItemSelected(T item) => widget.onItemSelected(item, customValue).toString();
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
|
@ -74,7 +75,7 @@ class _StandardPickerListState<T> extends State<StandardPickerList<T>> {
|
|||
},
|
||||
onItemSelected: (T item) {
|
||||
setState(() => selectedIdx = widget.items.indexOf(item));
|
||||
value = widget.onItemSelected(item).toString();
|
||||
value = adaptedOnItemSelected(item);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
|
@ -378,9 +378,9 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
sendViewModel.displayFeeRate(priority, sliderValue.round()),
|
||||
onSliderChanged: (double newValue) =>
|
||||
setNewFee(value: newValue, priority: transactionPriority!),
|
||||
onItemSelected: (dynamic item) {
|
||||
onItemSelected: (dynamic item, double sliderValue) {
|
||||
transactionPriority = item as TransactionPriority;
|
||||
return setNewFee(priority: transactionPriority!);
|
||||
return setNewFee(value: sliderValue, priority: transactionPriority!);
|
||||
}));
|
||||
|
||||
if (transactionInfo.inputAddresses != null) {
|
||||
|
@ -427,7 +427,11 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
|
||||
String setNewFee({double? value, required TransactionPriority priority}) {
|
||||
newFee = priority == bitcoin!.getBitcoinTransactionPriorityCustom() && value != null
|
||||
? bitcoin!.getEstimatedFeeWithFeeRate(wallet, value.round(), transactionInfo.amount)
|
||||
? bitcoin!.feeAmountWithFeeRate(
|
||||
wallet,
|
||||
value.round(),
|
||||
transactionInfo.inputAddresses?.length ?? 1,
|
||||
transactionInfo.outputAddresses?.length ?? 1)
|
||||
: bitcoin!.getFeeAmountForPriority(
|
||||
wallet,
|
||||
priority,
|
||||
|
|
|
@ -210,6 +210,7 @@ abstract class Bitcoin {
|
|||
int getFeeAmountForPriority(Object wallet, TransactionPriority priority, int inputsCount, int outputsCount, {int? size});
|
||||
int getEstimatedFeeWithFeeRate(Object wallet, int feeRate, int? amount,
|
||||
{int? outputsCount, int? size});
|
||||
int feeAmountWithFeeRate(Object wallet, int feeRate, int inputsCount, int outputsCount, {int? size});
|
||||
int getHeightByDate({required DateTime date});
|
||||
Future<void> rescan(Object wallet, {required int height, bool? doSingleScan});
|
||||
Future<bool> getNodeIsElectrsSPEnabled(Object wallet);
|
||||
|
|
Loading…
Reference in a new issue