mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
fix: dogecoin custom fee slider and possible absurd fees error
This commit is contained in:
parent
2ff855d7d0
commit
ab9e734b80
4 changed files with 20 additions and 5 deletions
|
@ -2065,6 +2065,7 @@ class _SendViewState extends ConsumerState<SendView> {
|
|||
top: 16,
|
||||
),
|
||||
child: FeeSlider(
|
||||
coin: coin,
|
||||
onSatVByteChanged: (rate) {
|
||||
customFeeRate = rate;
|
||||
},
|
||||
|
|
|
@ -1564,6 +1564,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
top: 16,
|
||||
),
|
||||
child: FeeSlider(
|
||||
coin: coin,
|
||||
onSatVByteChanged: (rate) {
|
||||
customFeeRate = rate;
|
||||
},
|
||||
|
|
|
@ -2665,7 +2665,10 @@ class DogecoinWallet extends CoinServiceAPI
|
|||
Logging.instance
|
||||
.log("Starting buildTransaction ----------", level: LogLevel.Info);
|
||||
|
||||
final txb = TransactionBuilder(network: network);
|
||||
final txb = TransactionBuilder(
|
||||
network: network,
|
||||
maximumFeeRate: 2500000, // 1000x default value in bitcoindart lib
|
||||
);
|
||||
txb.setVersion(1);
|
||||
|
||||
// Add transaction inputs
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
|
||||
class FeeSlider extends StatefulWidget {
|
||||
const FeeSlider({
|
||||
super.key,
|
||||
required this.onSatVByteChanged,
|
||||
required this.coin,
|
||||
});
|
||||
|
||||
final Coin coin;
|
||||
final void Function(int) onSatVByteChanged;
|
||||
|
||||
@override
|
||||
|
@ -16,12 +19,12 @@ class FeeSlider extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _FeeSliderState extends State<FeeSlider> {
|
||||
static const int min = 1;
|
||||
static const int max = 4;
|
||||
static const double min = 1;
|
||||
static const double max = 4;
|
||||
|
||||
double sliderValue = 0;
|
||||
|
||||
int rate = min;
|
||||
int rate = min.toInt();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -45,7 +48,14 @@ class _FeeSliderState extends State<FeeSlider> {
|
|||
onChanged: (value) {
|
||||
setState(() {
|
||||
sliderValue = value;
|
||||
rate = pow(sliderValue * (max - min) + min, 4).toInt();
|
||||
final number = pow(sliderValue * (max - min) + min, 4).toDouble();
|
||||
switch (widget.coin) {
|
||||
case Coin.dogecoin:
|
||||
case Coin.dogecoinTestNet:
|
||||
rate = (number * 1000).toInt();
|
||||
default:
|
||||
rate = number.toInt();
|
||||
}
|
||||
});
|
||||
widget.onSatVByteChanged(rate);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue