mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
firo fee sheet fixes
This commit is contained in:
parent
da24aaa391
commit
da88f6640c
3 changed files with 132 additions and 58 deletions
|
@ -90,11 +90,21 @@ class _TransactionFeeSelectionSheetState
|
|||
final fee = await wallet.estimateFeeFor(
|
||||
amount, MoneroTransactionPriority.fast.raw!);
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
|
||||
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.read(publicPrivateBalanceStateProvider.state).state ==
|
||||
"Private") {
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] =
|
||||
await (wallet as FiroWallet).estimateFeeForLelantus(amount);
|
||||
} else if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
final Amount fee;
|
||||
switch (ref.read(publicPrivateBalanceStateProvider.state).state) {
|
||||
case FiroType.spark:
|
||||
fee =
|
||||
await (wallet as FiroWallet).estimateFeeForSpark(amount);
|
||||
case FiroType.lelantus:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeForLelantus(amount);
|
||||
case FiroType.public:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
|
||||
} else {
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] =
|
||||
await wallet.estimateFeeFor(amount, feeRate);
|
||||
|
@ -115,11 +125,20 @@ class _TransactionFeeSelectionSheetState
|
|||
final fee = await wallet.estimateFeeFor(
|
||||
amount, MoneroTransactionPriority.regular.raw!);
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
|
||||
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.read(publicPrivateBalanceStateProvider.state).state ==
|
||||
"Private") {
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] =
|
||||
await (wallet as FiroWallet).estimateFeeForLelantus(amount);
|
||||
} else if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
final Amount fee;
|
||||
switch (ref.read(publicPrivateBalanceStateProvider.state).state) {
|
||||
case FiroType.spark:
|
||||
fee =
|
||||
await (wallet as FiroWallet).estimateFeeForSpark(amount);
|
||||
case FiroType.lelantus:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeForLelantus(amount);
|
||||
case FiroType.public:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
|
||||
} else {
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] =
|
||||
await wallet.estimateFeeFor(amount, feeRate);
|
||||
|
@ -140,11 +159,20 @@ class _TransactionFeeSelectionSheetState
|
|||
final fee = await wallet.estimateFeeFor(
|
||||
amount, MoneroTransactionPriority.slow.raw!);
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
|
||||
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.read(publicPrivateBalanceStateProvider.state).state ==
|
||||
"Private") {
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] =
|
||||
await (wallet as FiroWallet).estimateFeeForLelantus(amount);
|
||||
} else if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
final Amount fee;
|
||||
switch (ref.read(publicPrivateBalanceStateProvider.state).state) {
|
||||
case FiroType.spark:
|
||||
fee =
|
||||
await (wallet as FiroWallet).estimateFeeForSpark(amount);
|
||||
case FiroType.lelantus:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeForLelantus(amount);
|
||||
case FiroType.public:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
|
||||
} else {
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] =
|
||||
await wallet.estimateFeeFor(amount, feeRate);
|
||||
|
|
|
@ -28,6 +28,7 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|||
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
||||
import 'package:stackwallet/wallets/wallet/impl/firo_wallet.dart';
|
||||
import 'package:stackwallet/widgets/animated_text.dart';
|
||||
|
||||
final tokenFeeSessionCacheProvider =
|
||||
|
@ -83,14 +84,20 @@ class _DesktopFeeDropDownState extends ConsumerState<DesktopFeeDropDown> {
|
|||
final fee = await wallet.estimateFeeFor(
|
||||
amount, MoneroTransactionPriority.fast.raw!);
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
|
||||
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.read(publicPrivateBalanceStateProvider.state).state !=
|
||||
"Private") {
|
||||
// TODO: [prio=high] firo fees
|
||||
throw UnimplementedError("Firo public fees");
|
||||
// ref.read(feeSheetSessionCacheProvider).fast[amount] =
|
||||
// await (manager.wallet as FiroWallet)
|
||||
// .estimateFeeForPublic(amount, feeRate);
|
||||
} else if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
final Amount fee;
|
||||
switch (ref.read(publicPrivateBalanceStateProvider.state).state) {
|
||||
case FiroType.spark:
|
||||
fee =
|
||||
await (wallet as FiroWallet).estimateFeeForSpark(amount);
|
||||
case FiroType.lelantus:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeForLelantus(amount);
|
||||
case FiroType.public:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
|
||||
} else {
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] =
|
||||
await wallet.estimateFeeFor(amount, feeRate);
|
||||
|
@ -121,14 +128,20 @@ class _DesktopFeeDropDownState extends ConsumerState<DesktopFeeDropDown> {
|
|||
final fee = await wallet.estimateFeeFor(
|
||||
amount, MoneroTransactionPriority.regular.raw!);
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
|
||||
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.read(publicPrivateBalanceStateProvider.state).state !=
|
||||
"Private") {
|
||||
// TODO: [prio=high] firo fees
|
||||
throw UnimplementedError("Firo public fees");
|
||||
// ref.read(feeSheetSessionCacheProvider).average[amount] =
|
||||
// await (manager.wallet as FiroWallet)
|
||||
// .estimateFeeForPublic(amount, feeRate);
|
||||
} else if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
final Amount fee;
|
||||
switch (ref.read(publicPrivateBalanceStateProvider.state).state) {
|
||||
case FiroType.spark:
|
||||
fee =
|
||||
await (wallet as FiroWallet).estimateFeeForSpark(amount);
|
||||
case FiroType.lelantus:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeForLelantus(amount);
|
||||
case FiroType.public:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
|
||||
} else {
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] =
|
||||
await wallet.estimateFeeFor(amount, feeRate);
|
||||
|
@ -159,14 +172,20 @@ class _DesktopFeeDropDownState extends ConsumerState<DesktopFeeDropDown> {
|
|||
final fee = await wallet.estimateFeeFor(
|
||||
amount, MoneroTransactionPriority.slow.raw!);
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
|
||||
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.read(publicPrivateBalanceStateProvider.state).state !=
|
||||
"Private") {
|
||||
// TODO: [prio=high] firo fees
|
||||
throw UnimplementedError("Firo public fees");
|
||||
// ref.read(feeSheetSessionCacheProvider).slow[amount] =
|
||||
// await (manager.wallet as FiroWallet)
|
||||
// .estimateFeeForPublic(amount, feeRate);
|
||||
} else if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
final Amount fee;
|
||||
switch (ref.read(publicPrivateBalanceStateProvider.state).state) {
|
||||
case FiroType.spark:
|
||||
fee =
|
||||
await (wallet as FiroWallet).estimateFeeForSpark(amount);
|
||||
case FiroType.lelantus:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeForLelantus(amount);
|
||||
case FiroType.public:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
|
||||
} else {
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] =
|
||||
await wallet.estimateFeeFor(amount, feeRate);
|
||||
|
|
|
@ -61,18 +61,27 @@ class _DesktopFeeDialogState extends ConsumerState<DesktopFeeDialog> {
|
|||
final fee = await wallet.estimateFeeFor(
|
||||
amount, MoneroTransactionPriority.fast.raw!);
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
|
||||
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.read(publicPrivateBalanceStateProvider.state).state ==
|
||||
"Private") {
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] =
|
||||
await (wallet as FiroWallet).estimateFeeForLelantus(amount);
|
||||
} else if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
final Amount fee;
|
||||
switch (ref.read(publicPrivateBalanceStateProvider.state).state) {
|
||||
case FiroType.spark:
|
||||
fee =
|
||||
await (wallet as FiroWallet).estimateFeeForSpark(amount);
|
||||
case FiroType.lelantus:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeForLelantus(amount);
|
||||
case FiroType.public:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
|
||||
} else {
|
||||
ref.read(feeSheetSessionCacheProvider).fast[amount] =
|
||||
await wallet.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
} else {
|
||||
final tokenWallet = ref.read(tokenServiceProvider)!;
|
||||
final fee = tokenWallet.estimateFeeFor(feeRate);
|
||||
final tokenWallet = ref.read(pCurrentTokenWallet)!;
|
||||
final fee = await tokenWallet.estimateFeeFor(amount, feeRate);
|
||||
ref.read(tokenFeeSessionCacheProvider).fast[amount] = fee;
|
||||
}
|
||||
}
|
||||
|
@ -96,18 +105,27 @@ class _DesktopFeeDialogState extends ConsumerState<DesktopFeeDialog> {
|
|||
final fee = await wallet.estimateFeeFor(
|
||||
amount, MoneroTransactionPriority.regular.raw!);
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
|
||||
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.read(publicPrivateBalanceStateProvider.state).state ==
|
||||
"Private") {
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] =
|
||||
await (wallet as FiroWallet).estimateFeeForLelantus(amount);
|
||||
} else if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
final Amount fee;
|
||||
switch (ref.read(publicPrivateBalanceStateProvider.state).state) {
|
||||
case FiroType.spark:
|
||||
fee =
|
||||
await (wallet as FiroWallet).estimateFeeForSpark(amount);
|
||||
case FiroType.lelantus:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeForLelantus(amount);
|
||||
case FiroType.public:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
|
||||
} else {
|
||||
ref.read(feeSheetSessionCacheProvider).average[amount] =
|
||||
await wallet.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
} else {
|
||||
final tokenWallet = ref.read(tokenServiceProvider)!;
|
||||
final fee = tokenWallet.estimateFeeFor(feeRate);
|
||||
final tokenWallet = ref.read(pCurrentTokenWallet)!;
|
||||
final fee = await tokenWallet.estimateFeeFor(amount, feeRate);
|
||||
ref.read(tokenFeeSessionCacheProvider).average[amount] = fee;
|
||||
}
|
||||
}
|
||||
|
@ -131,11 +149,20 @@ class _DesktopFeeDialogState extends ConsumerState<DesktopFeeDialog> {
|
|||
final fee = await wallet.estimateFeeFor(
|
||||
amount, MoneroTransactionPriority.slow.raw!);
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
|
||||
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||
ref.read(publicPrivateBalanceStateProvider.state).state ==
|
||||
"Private") {
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] =
|
||||
await (wallet as FiroWallet).estimateFeeForLelantus(amount);
|
||||
} else if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
final Amount fee;
|
||||
switch (ref.read(publicPrivateBalanceStateProvider.state).state) {
|
||||
case FiroType.spark:
|
||||
fee =
|
||||
await (wallet as FiroWallet).estimateFeeForSpark(amount);
|
||||
case FiroType.lelantus:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeForLelantus(amount);
|
||||
case FiroType.public:
|
||||
fee = await (wallet as FiroWallet)
|
||||
.estimateFeeFor(amount, feeRate);
|
||||
}
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
|
||||
} else {
|
||||
ref.read(feeSheetSessionCacheProvider).slow[amount] =
|
||||
await wallet.estimateFeeFor(amount, feeRate);
|
||||
|
|
Loading…
Reference in a new issue