From 92305f558a7281b05e9033cc5664d3dbd8836ec5 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 12 Oct 2023 17:05:17 -0500 Subject: [PATCH] this isn't the right way to do this --- .../mixins/fusion_wallet_interface.dart | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/lib/services/mixins/fusion_wallet_interface.dart b/lib/services/mixins/fusion_wallet_interface.dart index 97ba4008f..58f8698d9 100644 --- a/lib/services/mixins/fusion_wallet_interface.dart +++ b/lib/services/mixins/fusion_wallet_interface.dart @@ -10,6 +10,7 @@ import 'package:stackwallet/db/isar/main_db.dart'; import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart'; import 'package:stackwallet/models/fusion_progress_ui_state.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart'; +import 'package:stackwallet/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart'; import 'package:stackwallet/services/fusion_tor_service.dart'; import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; @@ -56,8 +57,6 @@ mixin FusionWalletInterface { /// Initializes the FusionWalletInterface mixin. /// /// This function must be called before any other functions in this mixin. - /// - /// Returns a `Future` that resolves when Tor has been started. Future initFusionInterface({ required String walletId, required Coin coin, @@ -88,8 +87,29 @@ mixin FusionWalletInterface { // callback to update the ui state object void updateStatus(fusion.FusionStatus fusionStatus) { - // TODO: this - // set _uiState states + switch (fusionStatus) { + case fusion.FusionStatus.setup: + _uiState?.connecting = CashFusionStatus.waiting; + break; + case fusion.FusionStatus.waiting: + _uiState?.connecting = CashFusionStatus.waiting; + break; + case fusion.FusionStatus.connecting: + _uiState?.connecting = CashFusionStatus.waiting; + break; + case fusion.FusionStatus.running: + _uiState?.connecting = CashFusionStatus.fusing; + break; + case fusion.FusionStatus.complete: + _uiState?.connecting = CashFusionStatus.success; + break; + case fusion.FusionStatus.failed: + _uiState?.connecting = CashFusionStatus.failed; + break; + case fusion.FusionStatus.exception: + _uiState?.connecting = CashFusionStatus.failed; + break; + } } /// Returns a list of all owned p2pkh addresses in the wallet. @@ -249,9 +269,6 @@ mixin FusionWalletInterface { /// Fuse the wallet's UTXOs. /// /// This function is called when the user taps the "Fuse" button in the UI. - /// - /// Returns: - /// A `Future` that resolves when the fusion operation is finished. Future fuse() async { // Initial attempt for CashFusion integration goes here. final mainFusionObject = fusion.Fusion(fusion.FusionParams());