enable experimental firo public funds coin control

This commit is contained in:
julian 2024-06-04 10:08:37 -06:00
parent b7a4f7c29e
commit ed15482442
4 changed files with 29 additions and 8 deletions

View file

@ -20,6 +20,7 @@ import '../../../frost_route_generator.dart';
import '../../../models/isar/models/isar_models.dart';
import '../../../providers/frost_wallet/frost_wallet_providers.dart';
import '../../../providers/providers.dart';
import '../../../providers/wallet/public_private_balance_state_provider.dart';
import '../../../themes/coin_icon_provider.dart';
import '../../../themes/stack_colors.dart';
import '../../../utilities/amount/amount.dart';
@ -234,7 +235,10 @@ class _FrostSendViewState extends ConsumerState<FrostSendView> {
prefsChangeNotifierProvider.select(
(value) => value.enableCoinControl,
),
);
) &&
(coin is Firo
? ref.watch(publicPrivateBalanceStateProvider) == FiroType.public
: true);
return ConditionalParent(
condition: !Util.isDesktop,

View file

@ -998,10 +998,15 @@ class _SendViewState extends ConsumerState<SendView> {
prefsChangeNotifierProvider.select(
(value) => value.enableCoinControl,
),
);
) &&
(coin is Firo
? ref.watch(publicPrivateBalanceStateProvider) == FiroType.public
: true);
if (isFiro) {
ref.listen(publicPrivateBalanceStateProvider, (previous, next) {
selectedUTXOs = {};
if (ref.read(pSendAmount) == null) {
setState(() {
_calculateFeesFuture = calculateFees(

View file

@ -17,16 +17,13 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import '../../../../models/isar/models/contact_entry.dart';
import '../../../../models/paynym/paynym_account_lite.dart';
import '../../../../models/send_view_auto_fill_data.dart';
import '../../../../pages/send_view/confirm_transaction_view.dart';
import '../../../../pages/send_view/sub_widgets/building_transaction_dialog.dart';
import '../../../../pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart';
import '../../../coin_control/desktop_coin_control_use_dialog.dart';
import '../../../desktop_home_view.dart';
import 'address_book_address_chooser/address_book_address_chooser.dart';
import 'desktop_fee_dropdown.dart';
import '../../../../providers/providers.dart';
import '../../../../providers/ui/fee_rate_type_state_provider.dart';
import '../../../../providers/ui/preview_tx_button_state_provider.dart';
@ -70,6 +67,10 @@ import '../../../../widgets/icon_widgets/x_icon.dart';
import '../../../../widgets/rounded_container.dart';
import '../../../../widgets/stack_text_field.dart';
import '../../../../widgets/textfield_icon_button.dart';
import '../../../coin_control/desktop_coin_control_use_dialog.dart';
import '../../../desktop_home_view.dart';
import 'address_book_address_chooser/address_book_address_chooser.dart';
import 'desktop_fee_dropdown.dart';
class DesktopSend extends ConsumerStatefulWidget {
const DesktopSend({
@ -947,7 +948,10 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
(value) => value.enableCoinControl,
),
) &&
ref.watch(pWallets).getWallet(walletId) is CoinControlInterface;
ref.watch(pWallets).getWallet(walletId) is CoinControlInterface &&
(coin is Firo
? ref.watch(publicPrivateBalanceStateProvider) == FiroType.public
: true);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -1042,6 +1046,9 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
],
onChanged: (value) {
if (value is FiroType) {
if (value != FiroType.public) {
ref.read(desktopUseUTXOs.state).state = {};
}
setState(() {
ref.read(publicPrivateBalanceStateProvider.state).state =
value;

View file

@ -21,6 +21,7 @@ import '../../isar/models/spark_coin.dart';
import '../../isar/models/wallet_info.dart';
import '../../models/tx_data.dart';
import '../intermediate/bip39_hd_wallet.dart';
import '../wallet_mixin_interfaces/coin_control_interface.dart';
import '../wallet_mixin_interfaces/electrumx_interface.dart';
import '../wallet_mixin_interfaces/lelantus_interface.dart';
import '../wallet_mixin_interfaces/spark_interface.dart';
@ -28,7 +29,11 @@ import '../wallet_mixin_interfaces/spark_interface.dart';
const sparkStartBlock = 819300; // (approx 18 Jan 2024)
class FiroWallet<T extends ElectrumXCurrencyInterface> extends Bip39HDWallet<T>
with ElectrumXInterface<T>, LelantusInterface<T>, SparkInterface<T> {
with
ElectrumXInterface<T>,
LelantusInterface<T>,
SparkInterface<T>,
CoinControlInterface<T> {
// IMPORTANT: The order of the above mixins matters.
// SparkInterface MUST come after LelantusInterface.