mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-03 17:29:23 +00:00
commit
8b75d1c02a
30 changed files with 515 additions and 259 deletions
|
@ -41,6 +41,7 @@ final pFrostScaffoldArgs = StateProvider<
|
|||
List<FrostStepRoute> stepRoutes,
|
||||
FrostInterruptionDialogType frostInterruptionDialogType,
|
||||
NavigatorState parentNav,
|
||||
String callerRouteName,
|
||||
})?>((ref) => null);
|
||||
|
||||
abstract class FrostRouteGenerator {
|
||||
|
|
|
@ -431,6 +431,7 @@ class _NewFrostMsWalletViewState
|
|||
frostInterruptionDialogType:
|
||||
FrostInterruptionDialogType.walletCreation,
|
||||
parentNav: Navigator.of(context),
|
||||
callerRouteName: CreateNewFrostMsWalletView.routeName,
|
||||
);
|
||||
|
||||
await Navigator.of(context).pushNamed(
|
||||
|
|
|
@ -131,7 +131,6 @@ class _SelectNewFrostImportTypeViewState
|
|||
PrimaryButton(
|
||||
label: "Continue",
|
||||
onPressed: () async {
|
||||
final String route;
|
||||
switch (_selectedOption) {
|
||||
case _ImportOption.multisigNew:
|
||||
ref.read(pFrostScaffoldArgs.state).state = (
|
||||
|
@ -144,6 +143,7 @@ class _SelectNewFrostImportTypeViewState
|
|||
parentNav: Navigator.of(context),
|
||||
frostInterruptionDialogType:
|
||||
FrostInterruptionDialogType.walletCreation,
|
||||
callerRouteName: SelectNewFrostImportTypeView.routeName,
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -158,6 +158,7 @@ class _SelectNewFrostImportTypeViewState
|
|||
parentNav: Navigator.of(context),
|
||||
frostInterruptionDialogType:
|
||||
FrostInterruptionDialogType.resharing,
|
||||
callerRouteName: SelectNewFrostImportTypeView.routeName,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
|
|||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||
|
@ -183,10 +184,9 @@ class _FrostCreateStep2State extends ConsumerState<FrostCreateStep2> {
|
|||
if (context.mounted) {
|
||||
return await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => FrostErrorDialog(
|
||||
title: "Failed to generate shares",
|
||||
message: e.toString(),
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
|
|||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||
|
@ -184,9 +185,8 @@ class _FrostCreateStep3State extends ConsumerState<FrostCreateStep3> {
|
|||
if (context.mounted) {
|
||||
return await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => const FrostErrorDialog(
|
||||
title: "Failed to complete key generation",
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@ import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
|||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/simple_mobile_dialog.dart';
|
||||
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
|
||||
class FrostReshareStep1a extends ConsumerStatefulWidget {
|
||||
const FrostReshareStep1a({super.key});
|
||||
|
@ -88,9 +88,8 @@ class _FrostReshareStep1aState extends ConsumerState<FrostReshareStep1a> {
|
|||
if (mounted) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => FrostErrorDialog(
|
||||
title: e.toString(),
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ import 'package:stackwallet/utilities/util.dart';
|
|||
import 'package:stackwallet/wallets/isar/models/frost_wallet_info.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/checkbox_text_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||
|
||||
class FrostReshareStep1b extends ConsumerStatefulWidget {
|
||||
|
@ -124,9 +124,8 @@ class _FrostReshareStep1bState extends ConsumerState<FrostReshareStep1b> {
|
|||
if (mounted) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => FrostErrorDialog(
|
||||
title: e.toString(),
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -190,6 +190,7 @@ class _FrostReshareStep1cState extends ConsumerState<FrostReshareStep1c> {
|
|||
parentNav: data.parentNav,
|
||||
frostInterruptionDialogType:
|
||||
FrostInterruptionDialogType.resharing,
|
||||
callerRouteName: data.callerRouteName,
|
||||
);
|
||||
ref.read(pFrostMyName.state).state =
|
||||
ref.read(pFrostResharingData).myName!;
|
||||
|
|
|
@ -15,7 +15,7 @@ import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
|
|||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||
|
||||
class FrostReshareStep2abd extends ConsumerStatefulWidget {
|
||||
|
@ -86,10 +86,9 @@ class _FrostReshareStep2abdState extends ConsumerState<FrostReshareStep2abd> {
|
|||
if (mounted) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => FrostErrorDialog(
|
||||
title: "Error",
|
||||
message: e.toString(),
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'package:stackwallet/services/frost.dart';
|
|||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||
|
||||
class FrostReshareStep2c extends ConsumerStatefulWidget {
|
||||
|
@ -63,14 +63,15 @@ class _FrostReshareStep2cState extends ConsumerState<FrostReshareStep2c> {
|
|||
level: LogLevel.Fatal,
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => FrostErrorDialog(
|
||||
title: "Error",
|
||||
message: e.toString(),
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
_buttonLock = false;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
|
|||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||
|
||||
class FrostReshareStep3abd extends ConsumerStatefulWidget {
|
||||
|
@ -73,15 +73,15 @@ class _FrostReshareStep3abdState extends ConsumerState<FrostReshareStep3abd> {
|
|||
"$e\n$s",
|
||||
level: LogLevel.Fatal,
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => FrostErrorDialog(
|
||||
title: "Error",
|
||||
message: e.toString(),
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
_buttonLock = false;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
|
|||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||
|
||||
// was FinishResharingView
|
||||
|
@ -94,10 +94,9 @@ class _FrostReshareStep4State extends ConsumerState<FrostReshareStep4> {
|
|||
if (mounted) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => FrostErrorDialog(
|
||||
title: "Error",
|
||||
message: e.toString(),
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import 'package:stackwallet/wallets/wallet/impl/bitcoin_frost_wallet.dart';
|
|||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
|
||||
// was VerifyUpdatedWalletView
|
||||
class FrostReshareStep5 extends ConsumerStatefulWidget {
|
||||
|
@ -110,10 +110,9 @@ class _FrostReshareStep5State extends ConsumerState<FrostReshareStep5> {
|
|||
if (mounted) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => FrostErrorDialog(
|
||||
title: "Error",
|
||||
message: e.toString(),
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ class _FrostSendViewState extends ConsumerState<FrostSendView> {
|
|||
parentNav: Navigator.of(context),
|
||||
frostInterruptionDialogType:
|
||||
FrostInterruptionDialogType.transactionCreation,
|
||||
callerRouteName: FrostSendView.routeName,
|
||||
);
|
||||
|
||||
await Navigator.of(context).pushNamed(
|
||||
|
|
|
@ -109,6 +109,7 @@ class _FrostSendStep1bState extends ConsumerState<FrostSendStep1b> {
|
|||
"$e\n$s",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
if (mounted) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
|
@ -117,6 +118,7 @@ class _FrostSendStep1bState extends ConsumerState<FrostSendStep1b> {
|
|||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
_attemptSignLock = false;
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
|
|||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||
|
||||
class FrostSendStep2 extends ConsumerStatefulWidget {
|
||||
|
@ -293,14 +293,15 @@ class _FrostSendStep2State extends ConsumerState<FrostSendStep2> {
|
|||
level: LogLevel.Fatal,
|
||||
);
|
||||
|
||||
if (context.mounted) {
|
||||
return await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => const FrostErrorDialog(
|
||||
title: "Failed to continue signing",
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -15,8 +15,8 @@ import 'package:stackwallet/widgets/custom_buttons/frost_qr_dialog_button.dart';
|
|||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/dialogs/frost/frost_error_dialog.dart';
|
||||
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||
|
||||
class FrostSendStep3 extends ConsumerStatefulWidget {
|
||||
|
@ -238,9 +238,8 @@ class _FrostSendStep3State extends ConsumerState<FrostSendStep3> {
|
|||
if (context.mounted) {
|
||||
return await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
builder: (_) => const FrostErrorDialog(
|
||||
title: "Failed to complete signing process",
|
||||
desktopPopRootNavigator: Util.isDesktop,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart';
|
||||
import 'package:stackwallet/providers/global/active_wallet_provider.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
|
@ -95,12 +94,12 @@ class SyncingOptionsView extends ConsumerWidget {
|
|||
ref.read(prefsChangeNotifierProvider).syncType =
|
||||
SyncingType.currentWalletOnly;
|
||||
|
||||
// disable auto sync on all wallets that aren't active/current
|
||||
ref.read(pWallets).wallets.forEach((e) {
|
||||
if (e.walletId != ref.read(currentWalletIdProvider)) {
|
||||
e.shouldAutoSync = false;
|
||||
}
|
||||
});
|
||||
// // disable auto sync on all wallets that aren't active/current
|
||||
// ref.read(pWallets).wallets.forEach((e) {
|
||||
// if (e.walletId != ref.read(currentWalletIdProvider)) {
|
||||
// e.shouldAutoSync = false;
|
||||
// }
|
||||
// });
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
|
@ -174,11 +173,11 @@ class SyncingOptionsView extends ConsumerWidget {
|
|||
ref.read(prefsChangeNotifierProvider).syncType =
|
||||
SyncingType.allWalletsOnStartup;
|
||||
|
||||
// enable auto sync on all wallets
|
||||
ref
|
||||
.read(pWallets)
|
||||
.wallets
|
||||
.forEach((e) => e.shouldAutoSync = true);
|
||||
// // enable auto sync on all wallets
|
||||
// ref
|
||||
// .read(pWallets)
|
||||
// .wallets
|
||||
// .forEach((e) => e.shouldAutoSync = true);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
|
@ -252,13 +251,13 @@ class SyncingOptionsView extends ConsumerWidget {
|
|||
ref.read(prefsChangeNotifierProvider).syncType =
|
||||
SyncingType.selectedWalletsAtStartup;
|
||||
|
||||
final ids = ref
|
||||
.read(prefsChangeNotifierProvider)
|
||||
.walletIdsSyncOnStartup;
|
||||
|
||||
// enable auto sync on selected wallets only
|
||||
ref.read(pWallets).wallets.forEach(
|
||||
(e) => e.shouldAutoSync = ids.contains(e.walletId));
|
||||
// final ids = ref
|
||||
// .read(prefsChangeNotifierProvider)
|
||||
// .walletIdsSyncOnStartup;
|
||||
//
|
||||
// // enable auto sync on selected wallets only
|
||||
// ref.read(pWallets).wallets.forEach(
|
||||
// (e) => e.shouldAutoSync = ids.contains(e.walletId));
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
|
|
|
@ -13,13 +13,11 @@ import 'dart:io';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/providers/global/active_wallet_provider.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/themes/coin_icon_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount_formatter.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/enums/sync_type_enum.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
||||
|
@ -181,9 +179,9 @@ class WalletSyncingOptionsView extends ConsumerWidget {
|
|||
.walletIdsSyncOnStartup))
|
||||
.contains(info.walletId),
|
||||
onValueChanged: (value) {
|
||||
final syncType = ref
|
||||
.read(prefsChangeNotifierProvider)
|
||||
.syncType;
|
||||
// final syncType = ref
|
||||
// .read(prefsChangeNotifierProvider)
|
||||
// .syncType;
|
||||
final ids = ref
|
||||
.read(prefsChangeNotifierProvider)
|
||||
.walletIdsSyncOnStartup
|
||||
|
@ -194,25 +192,25 @@ class WalletSyncingOptionsView extends ConsumerWidget {
|
|||
ids.remove(info.walletId);
|
||||
}
|
||||
|
||||
final wallet = ref
|
||||
.read(pWallets)
|
||||
.getWallet(info.walletId);
|
||||
|
||||
switch (syncType) {
|
||||
case SyncingType.currentWalletOnly:
|
||||
if (info.walletId ==
|
||||
ref.read(
|
||||
currentWalletIdProvider)) {
|
||||
wallet.shouldAutoSync = value;
|
||||
}
|
||||
break;
|
||||
case SyncingType
|
||||
.selectedWalletsAtStartup:
|
||||
case SyncingType
|
||||
.allWalletsOnStartup:
|
||||
wallet.shouldAutoSync = value;
|
||||
break;
|
||||
}
|
||||
// final wallet = ref
|
||||
// .read(pWallets)
|
||||
// .getWallet(info.walletId);
|
||||
//
|
||||
// switch (syncType) {
|
||||
// case SyncingType.currentWalletOnly:
|
||||
// if (info.walletId ==
|
||||
// ref.read(
|
||||
// currentWalletIdProvider)) {
|
||||
// wallet.shouldAutoSync = value;
|
||||
// }
|
||||
// break;
|
||||
// case SyncingType
|
||||
// .selectedWalletsAtStartup:
|
||||
// case SyncingType
|
||||
// .allWalletsOnStartup:
|
||||
// wallet.shouldAutoSync = value;
|
||||
// break;
|
||||
// }
|
||||
|
||||
ref
|
||||
.read(prefsChangeNotifierProvider)
|
||||
|
|
|
@ -162,6 +162,7 @@ class FrostMSWalletOptionsView extends ConsumerWidget {
|
|||
parentNav: Navigator.of(context),
|
||||
frostInterruptionDialogType:
|
||||
FrostInterruptionDialogType.resharing,
|
||||
callerRouteName: FrostMSWalletOptionsView.routeName,
|
||||
);
|
||||
|
||||
Navigator.of(context).pushNamed(
|
||||
|
|
|
@ -129,6 +129,7 @@ class _CompleteReshareConfigViewState
|
|||
final wallet =
|
||||
ref.read(pWallets).getWallet(widget.walletId) as BitcoinFrostWallet;
|
||||
|
||||
if (mounted) {
|
||||
ref.read(pFrostScaffoldArgs.state).state = (
|
||||
info: (
|
||||
walletName: wallet.info.name,
|
||||
|
@ -138,9 +139,9 @@ class _CompleteReshareConfigViewState
|
|||
stepRoutes: FrostRouteGenerator.initiateReshareStepRoutes,
|
||||
parentNav: Navigator.of(context),
|
||||
frostInterruptionDialogType: FrostInterruptionDialogType.resharing,
|
||||
callerRouteName: CompleteReshareConfigView.routeName,
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
await Navigator.of(context).pushNamed(
|
||||
FrostStepScaffold.routeName,
|
||||
);
|
||||
|
@ -345,7 +346,8 @@ class _CompleteReshareConfigViewState
|
|||
() => _includeMeInReshare = value == true,
|
||||
);
|
||||
_participantsCountChanged(
|
||||
_newParticipantsCountController.text);
|
||||
_newParticipantsCountController.text,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
|
@ -124,7 +124,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
|
||||
late final bool isSparkWallet;
|
||||
|
||||
late final bool _shouldDisableAutoSyncOnLogOut;
|
||||
// late final bool _shouldDisableAutoSyncOnLogOut;
|
||||
|
||||
late WalletSyncStatus _currentSyncStatus;
|
||||
late NodeConnectionStatus _currentNodeStatus;
|
||||
|
@ -177,9 +177,9 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
if (!wallet.shouldAutoSync) {
|
||||
// enable auto sync if it wasn't enabled when loading wallet
|
||||
wallet.shouldAutoSync = true;
|
||||
_shouldDisableAutoSyncOnLogOut = true;
|
||||
} else {
|
||||
_shouldDisableAutoSyncOnLogOut = false;
|
||||
// _shouldDisableAutoSyncOnLogOut = true;
|
||||
// } else {
|
||||
// _shouldDisableAutoSyncOnLogOut = false;
|
||||
}
|
||||
|
||||
isSparkWallet = wallet is SparkInterface;
|
||||
|
@ -277,7 +277,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
const timeout = Duration(milliseconds: 1500);
|
||||
if (_cachedTime == null || now.difference(_cachedTime!) > timeout) {
|
||||
_cachedTime = now;
|
||||
unawaited(showDialog<dynamic>(
|
||||
unawaited(
|
||||
showDialog<dynamic>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (_) => WillPopScope(
|
||||
|
@ -295,16 +296,17 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
onTimeout: () => Navigator.of(context).popUntil(
|
||||
ModalRoute.withName(WalletView.routeName),
|
||||
),
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void _logout() async {
|
||||
if (_shouldDisableAutoSyncOnLogOut) {
|
||||
// disable auto sync if it was enabled only when loading wallet
|
||||
// if (_shouldDisableAutoSyncOnLogOut) {
|
||||
// // disable auto sync if it was enabled only when loading wallet
|
||||
ref.read(pWallets).getWallet(walletId).shouldAutoSync = false;
|
||||
}
|
||||
// }
|
||||
|
||||
ref.read(currentWalletIdProvider.notifier).state = null;
|
||||
ref.read(transactionFilterProvider.state).state = null;
|
||||
|
@ -373,6 +375,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
parentNav: Navigator.of(context),
|
||||
frostInterruptionDialogType:
|
||||
FrostInterruptionDialogType.transactionCreation,
|
||||
callerRouteName: WalletView.routeName,
|
||||
);
|
||||
|
||||
await Navigator.of(context).pushNamed(
|
||||
|
@ -398,11 +401,12 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
.tickerEqualToAnyExchangeNameName(coin.ticker)
|
||||
.findFirst();
|
||||
} catch (_) {
|
||||
_future = ExchangeDataLoadingService.instance.loadAll().then((_) =>
|
||||
ExchangeDataLoadingService.instance.isar.currencies
|
||||
_future = ExchangeDataLoadingService.instance.loadAll().then(
|
||||
(_) => ExchangeDataLoadingService.instance.isar.currencies
|
||||
.where()
|
||||
.tickerEqualToAnyExchangeNameName(coin.ticker)
|
||||
.findFirst());
|
||||
.findFirst(),
|
||||
);
|
||||
}
|
||||
|
||||
final currency = await showLoading(
|
||||
|
@ -411,7 +415,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
message: "Loading...",
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
if (context.mounted) {
|
||||
unawaited(
|
||||
Navigator.of(context).pushNamed(
|
||||
WalletInitiatedExchangeView.routeName,
|
||||
|
@ -568,7 +572,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -607,7 +611,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
style: STextStyles.navBarTitle(context),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
|
@ -670,9 +674,12 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
icon: ref.watch(notificationsProvider.select(
|
||||
(value) => value
|
||||
.hasUnreadNotificationsFor(walletId)))
|
||||
icon: ref.watch(
|
||||
notificationsProvider.select(
|
||||
(value) =>
|
||||
value.hasUnreadNotificationsFor(walletId),
|
||||
),
|
||||
)
|
||||
? SvgPicture.file(
|
||||
File(
|
||||
ref.watch(
|
||||
|
@ -683,10 +690,14 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
),
|
||||
width: 20,
|
||||
height: 20,
|
||||
color: ref.watch(notificationsProvider.select(
|
||||
color: ref.watch(
|
||||
notificationsProvider.select(
|
||||
(value) =>
|
||||
value.hasUnreadNotificationsFor(
|
||||
walletId)))
|
||||
walletId,
|
||||
),
|
||||
),
|
||||
)
|
||||
? null
|
||||
: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
|
@ -696,10 +707,14 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
Assets.svg.bell,
|
||||
width: 20,
|
||||
height: 20,
|
||||
color: ref.watch(notificationsProvider.select(
|
||||
color: ref.watch(
|
||||
notificationsProvider.select(
|
||||
(value) =>
|
||||
value.hasUnreadNotificationsFor(
|
||||
walletId)))
|
||||
walletId,
|
||||
),
|
||||
),
|
||||
)
|
||||
? null
|
||||
: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
|
@ -720,22 +735,25 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
.state;
|
||||
if (unreadNotificationIds.isEmpty) return;
|
||||
|
||||
List<Future<dynamic>> futures = [];
|
||||
final List<Future<dynamic>> futures = [];
|
||||
for (int i = 0;
|
||||
i < unreadNotificationIds.length - 1;
|
||||
i++) {
|
||||
futures.add(ref
|
||||
.read(notificationsProvider)
|
||||
.markAsRead(
|
||||
futures.add(
|
||||
ref.read(notificationsProvider).markAsRead(
|
||||
unreadNotificationIds.elementAt(i),
|
||||
false));
|
||||
false,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// wait for multiple to update if any
|
||||
Future.wait(futures).then((_) {
|
||||
// only notify listeners once
|
||||
ref.read(notificationsProvider).markAsRead(
|
||||
unreadNotificationIds.last, true);
|
||||
unreadNotificationIds.last,
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -824,7 +842,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getSecondaryEnabledButtonStyle(
|
||||
context),
|
||||
context,
|
||||
),
|
||||
onPressed: () async {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
|
@ -855,7 +874,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getPrimaryEnabledButtonStyle(
|
||||
context),
|
||||
context,
|
||||
),
|
||||
child: Text(
|
||||
"Continue",
|
||||
style:
|
||||
|
@ -1087,7 +1107,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
MonkeyView.routeName,
|
||||
arguments: widget.walletId,
|
||||
);
|
||||
}),
|
||||
},
|
||||
),
|
||||
if (ref.watch(
|
||||
pWallets.select(
|
||||
(value) => value.getWallet(widget.walletId)
|
||||
|
@ -1112,8 +1133,12 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
);
|
||||
},
|
||||
),
|
||||
if (ref.watch(pWallets.select((value) =>
|
||||
value.getWallet(widget.walletId) is PaynymInterface)))
|
||||
if (ref.watch(
|
||||
pWallets.select(
|
||||
(value) =>
|
||||
value.getWallet(widget.walletId) is PaynymInterface,
|
||||
),
|
||||
))
|
||||
WalletNavigationBarItemData(
|
||||
label: "PayNym",
|
||||
icon: const PaynymNavIcon(),
|
||||
|
@ -1145,7 +1170,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
level: LogLevel.Info,
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
// check if account exists and for matching code to see if claimed
|
||||
|
|
|
@ -72,7 +72,7 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
|
|||
late final TextEditingController controller;
|
||||
late final EventBus eventBus;
|
||||
|
||||
late final bool _shouldDisableAutoSyncOnLogOut;
|
||||
// late final bool _shouldDisableAutoSyncOnLogOut;
|
||||
|
||||
Future<void> onBackPressed() async {
|
||||
await _logout();
|
||||
|
@ -83,10 +83,10 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
|
|||
|
||||
Future<void> _logout() async {
|
||||
final wallet = ref.read(pWallets).getWallet(widget.walletId);
|
||||
if (_shouldDisableAutoSyncOnLogOut) {
|
||||
// disable auto sync if it was enabled only when loading wallet
|
||||
// if (_shouldDisableAutoSyncOnLogOut) {
|
||||
// // disable auto sync if it was enabled only when loading wallet
|
||||
wallet.shouldAutoSync = false;
|
||||
}
|
||||
// }
|
||||
ref.read(transactionFilterProvider.state).state = null;
|
||||
if (ref.read(prefsChangeNotifierProvider).isAutoBackupEnabled &&
|
||||
ref.read(prefsChangeNotifierProvider).backupFrequencyType ==
|
||||
|
@ -131,11 +131,11 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
|
|||
ref.read(currentWalletIdProvider.notifier).state = wallet.walletId);
|
||||
|
||||
if (!wallet.shouldAutoSync) {
|
||||
// enable auto sync if it wasn't enabled when loading wallet
|
||||
// // enable auto sync if it wasn't enabled when loading wallet
|
||||
wallet.shouldAutoSync = true;
|
||||
_shouldDisableAutoSyncOnLogOut = true;
|
||||
} else {
|
||||
_shouldDisableAutoSyncOnLogOut = false;
|
||||
// _shouldDisableAutoSyncOnLogOut = true;
|
||||
// } else {
|
||||
// _shouldDisableAutoSyncOnLogOut = false;
|
||||
}
|
||||
|
||||
wallet.refresh();
|
||||
|
|
|
@ -13,6 +13,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:stackwallet/frost_route_generator.dart';
|
||||
import 'package:stackwallet/pages/send_view/frost_ms/frost_send_view.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/my_stack_view/my_stack_view.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_token_send.dart';
|
||||
|
@ -104,6 +105,7 @@ class _MyWalletState extends ConsumerState<MyWallet> {
|
|||
frostInterruptionDialogType:
|
||||
FrostInterruptionDialogType
|
||||
.transactionCreation,
|
||||
callerRouteName: MyStackView.routeName,
|
||||
);
|
||||
|
||||
await Navigator.of(context).pushNamed(
|
||||
|
@ -111,7 +113,7 @@ class _MyWalletState extends ConsumerState<MyWallet> {
|
|||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
FrostSendView(
|
||||
|
|
|
@ -136,7 +136,8 @@ class Wallets {
|
|||
|
||||
Future<void> load(Prefs prefs, MainDB mainDB) async {
|
||||
// return await _loadV1(prefs, mainDB);
|
||||
return await _loadV2(prefs, mainDB);
|
||||
// return await _loadV2(prefs, mainDB);
|
||||
return await _loadV3(prefs, mainDB);
|
||||
}
|
||||
|
||||
Future<void> _loadV1(Prefs prefs, MainDB mainDB) async {
|
||||
|
@ -240,6 +241,7 @@ class Wallets {
|
|||
}
|
||||
}
|
||||
|
||||
/// should be fastest but big ui performance hit
|
||||
Future<void> _loadV2(Prefs prefs, MainDB mainDB) async {
|
||||
if (hasLoaded) {
|
||||
return;
|
||||
|
@ -358,6 +360,160 @@ class Wallets {
|
|||
await Future.wait(deleteFutures);
|
||||
}
|
||||
|
||||
/// should be best performance
|
||||
Future<void> _loadV3(Prefs prefs, MainDB mainDB) async {
|
||||
if (hasLoaded) {
|
||||
return;
|
||||
}
|
||||
hasLoaded = true;
|
||||
|
||||
// clear out any wallet hive boxes where the wallet was deleted in previous app run
|
||||
for (final walletId in DB.instance
|
||||
.values<String>(boxName: DB.boxNameWalletsToDeleteOnStart)) {
|
||||
await mainDB.isar.writeTxn(() async => await mainDB.isar.walletInfo
|
||||
.where()
|
||||
.walletIdEqualTo(walletId)
|
||||
.deleteAll());
|
||||
}
|
||||
// clear list
|
||||
await DB.instance
|
||||
.deleteAll<String>(boxName: DB.boxNameWalletsToDeleteOnStart);
|
||||
|
||||
final walletInfoList = await mainDB.isar.walletInfo.where().findAll();
|
||||
if (walletInfoList.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<Future<String>> walletIDInitFutures = [];
|
||||
final List<Future<void>> deleteFutures = [];
|
||||
final List<({Wallet wallet, bool shouldAutoSync})> walletsToInitLinearly =
|
||||
[];
|
||||
|
||||
final List<String> walletIdsToSyncOnceOnStartup = [];
|
||||
bool shouldSyncAllOnceOnStartup = false;
|
||||
switch (prefs.syncType) {
|
||||
case SyncingType.currentWalletOnly:
|
||||
// do nothing as this will be set when going into a wallet from the main screen
|
||||
break;
|
||||
case SyncingType.selectedWalletsAtStartup:
|
||||
walletIdsToSyncOnceOnStartup.addAll(prefs.walletIdsSyncOnStartup);
|
||||
break;
|
||||
case SyncingType.allWalletsOnStartup:
|
||||
shouldSyncAllOnceOnStartup = true;
|
||||
break;
|
||||
}
|
||||
|
||||
for (final walletInfo in walletInfoList) {
|
||||
try {
|
||||
final isVerified = await walletInfo.isMnemonicVerified(mainDB.isar);
|
||||
Logging.instance.log(
|
||||
"LOADING WALLET: ${walletInfo.name}:${walletInfo.walletId} "
|
||||
"IS VERIFIED: $isVerified",
|
||||
level: LogLevel.Info,
|
||||
);
|
||||
|
||||
if (isVerified) {
|
||||
// TODO: integrate this into the new wallets somehow?
|
||||
// requires some thinking
|
||||
// final txTracker =
|
||||
// TransactionNotificationTracker(walletId: walletInfo.walletId);
|
||||
|
||||
final walletIdCompleter = Completer<String>();
|
||||
|
||||
walletIDInitFutures.add(walletIdCompleter.future);
|
||||
|
||||
await Wallet.load(
|
||||
walletId: walletInfo.walletId,
|
||||
mainDB: mainDB,
|
||||
secureStorageInterface: nodeService.secureStorageInterface,
|
||||
nodeService: nodeService,
|
||||
prefs: prefs,
|
||||
).then((wallet) {
|
||||
if (wallet is CwBasedInterface) {
|
||||
// walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
|
||||
|
||||
walletIdCompleter.complete("dummy_ignore");
|
||||
} else {
|
||||
walletIdCompleter.complete(wallet.walletId);
|
||||
}
|
||||
|
||||
_wallets[wallet.walletId] = wallet;
|
||||
});
|
||||
} else {
|
||||
// wallet creation was not completed by user so we remove it completely
|
||||
deleteFutures.add(_deleteWallet(walletInfo.walletId));
|
||||
}
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("$e $s", level: LogLevel.Fatal);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
final asyncWalletIds = await Future.wait(walletIDInitFutures);
|
||||
asyncWalletIds.removeWhere((e) => e == "dummy_ignore");
|
||||
|
||||
final List<String> idsToRefresh = [];
|
||||
final List<Future<void>> walletInitFutures = asyncWalletIds
|
||||
.map(
|
||||
(id) => _wallets[id]!.init().then(
|
||||
(_) {
|
||||
if (shouldSyncAllOnceOnStartup ||
|
||||
walletIdsToSyncOnceOnStartup.contains(id)) {
|
||||
idsToRefresh.add(id);
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
||||
Future<void> _refreshFutures(List<String> idsToRefresh) async {
|
||||
final start = DateTime.now();
|
||||
Logging.instance.log(
|
||||
"Initial refresh start: ${start.toUtc()}",
|
||||
level: LogLevel.Warning,
|
||||
);
|
||||
const groupCount = 3;
|
||||
for (int i = 0; i < idsToRefresh.length; i += groupCount) {
|
||||
final List<Future<void>> futures = [];
|
||||
for (int j = 0; j < groupCount; j++) {
|
||||
if (i + j >= idsToRefresh.length) {
|
||||
break;
|
||||
}
|
||||
futures.add(
|
||||
_wallets[idsToRefresh[i + j]]!.refresh(),
|
||||
);
|
||||
}
|
||||
await Future.wait(futures);
|
||||
}
|
||||
Logging.instance.log(
|
||||
"Initial refresh duration: ${DateTime.now().difference(start)}",
|
||||
level: LogLevel.Warning,
|
||||
);
|
||||
}
|
||||
|
||||
if (walletInitFutures.isNotEmpty && walletsToInitLinearly.isNotEmpty) {
|
||||
unawaited(
|
||||
Future.wait([
|
||||
_initLinearly(walletsToInitLinearly),
|
||||
...walletInitFutures,
|
||||
]).then(
|
||||
(value) => _refreshFutures(idsToRefresh),
|
||||
),
|
||||
);
|
||||
} else if (walletInitFutures.isNotEmpty) {
|
||||
unawaited(
|
||||
Future.wait(walletInitFutures).then(
|
||||
(value) => _refreshFutures(idsToRefresh),
|
||||
),
|
||||
);
|
||||
} else if (walletsToInitLinearly.isNotEmpty) {
|
||||
unawaited(_initLinearly(walletsToInitLinearly));
|
||||
}
|
||||
|
||||
// finally await any deletions that haven't completed yet
|
||||
await Future.wait(deleteFutures);
|
||||
}
|
||||
|
||||
Future<void> loadAfterStackRestore(
|
||||
Prefs prefs,
|
||||
List<Wallet> wallets,
|
||||
|
@ -396,10 +552,10 @@ class Wallets {
|
|||
if (wallet is CwBasedInterface) {
|
||||
// walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
|
||||
} else {
|
||||
walletInitFutures.add(wallet.init().then((value) {
|
||||
if (shouldSetAutoSync) {
|
||||
wallet.shouldAutoSync = true;
|
||||
}
|
||||
walletInitFutures.add(wallet.init().then((_) {
|
||||
// if (shouldSetAutoSync) {
|
||||
// wallet.shouldAutoSync = true;
|
||||
// }
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,6 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|||
final coinCardProvider = Provider.family<String?, Coin>((ref, coin) {
|
||||
final assets = ref.watch(themeAssetsProvider);
|
||||
|
||||
// TODO: handle this differently by adding proper frost assets to themes
|
||||
if (coin == Coin.bitcoinFrost) {
|
||||
coin = Coin.bitcoin;
|
||||
} else if (coin == Coin.bitcoinFrostTestNet) {
|
||||
coin = Coin.bitcoinTestNet;
|
||||
}
|
||||
|
||||
if (assets is ThemeAssetsV3) {
|
||||
return assets.coinCardImages?[coin.mainNetVersion];
|
||||
} else {
|
||||
|
@ -33,13 +26,6 @@ final coinCardProvider = Provider.family<String?, Coin>((ref, coin) {
|
|||
final coinCardFavoritesProvider = Provider.family<String?, Coin>((ref, coin) {
|
||||
final assets = ref.watch(themeAssetsProvider);
|
||||
|
||||
// TODO: handle this differently by adding proper frost assets to themes
|
||||
if (coin == Coin.bitcoinFrost) {
|
||||
coin = Coin.bitcoin;
|
||||
} else if (coin == Coin.bitcoinFrostTestNet) {
|
||||
coin = Coin.bitcoinTestNet;
|
||||
}
|
||||
|
||||
if (assets is ThemeAssetsV3) {
|
||||
return assets.coinCardFavoritesImages?[coin.mainNetVersion] ??
|
||||
assets.coinCardImages?[coin.mainNetVersion];
|
||||
|
|
|
@ -16,13 +16,6 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|||
final coinIconProvider = Provider.family<String, Coin>((ref, coin) {
|
||||
final assets = ref.watch(themeAssetsProvider);
|
||||
|
||||
// TODO: handle this differently by adding proper frost assets to themes
|
||||
if (coin == Coin.bitcoinFrost) {
|
||||
coin = Coin.bitcoin;
|
||||
} else if (coin == Coin.bitcoinFrostTestNet) {
|
||||
coin = Coin.bitcoinTestNet;
|
||||
}
|
||||
|
||||
if (assets is ThemeAssets) {
|
||||
switch (coin) {
|
||||
case Coin.bitcoin:
|
||||
|
|
|
@ -16,13 +16,6 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|||
final coinImageProvider = Provider.family<String, Coin>((ref, coin) {
|
||||
final assets = ref.watch(themeAssetsProvider);
|
||||
|
||||
// TODO: handle this differently by adding proper frost assets to themes
|
||||
if (coin == Coin.bitcoinFrost) {
|
||||
coin = Coin.bitcoin;
|
||||
} else if (coin == Coin.bitcoinFrostTestNet) {
|
||||
coin = Coin.bitcoinTestNet;
|
||||
}
|
||||
|
||||
if (assets is ThemeAssets) {
|
||||
switch (coin) {
|
||||
case Coin.bitcoin:
|
||||
|
@ -71,13 +64,6 @@ final coinImageProvider = Provider.family<String, Coin>((ref, coin) {
|
|||
final coinImageSecondaryProvider = Provider.family<String, Coin>((ref, coin) {
|
||||
final assets = ref.watch(themeAssetsProvider);
|
||||
|
||||
// TODO: handle this differently by adding proper frost assets to themes
|
||||
if (coin == Coin.bitcoinFrost) {
|
||||
coin = Coin.bitcoin;
|
||||
} else if (coin == Coin.bitcoinFrostTestNet) {
|
||||
coin = Coin.bitcoinTestNet;
|
||||
}
|
||||
|
||||
if (assets is ThemeAssets) {
|
||||
switch (coin) {
|
||||
case Coin.bitcoin:
|
||||
|
|
|
@ -180,10 +180,12 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
final config = Frost.createSignConfig(
|
||||
network: network,
|
||||
inputs: utxosToUse
|
||||
.map((e) => (
|
||||
.map(
|
||||
(e) => (
|
||||
utxo: e,
|
||||
scriptPubKey: publicKey,
|
||||
))
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
outputs: txData.recipients!,
|
||||
changeAddress: (await getCurrentReceivingAddress())!.value,
|
||||
|
@ -279,7 +281,8 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
return Amount(
|
||||
rawValue: BigInt.from(
|
||||
((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
|
||||
(feeRatePerKB / 1000).ceil()),
|
||||
(feeRatePerKB / 1000).ceil(),
|
||||
),
|
||||
fractionDigits: cryptoCurrency.fractionDigits,
|
||||
);
|
||||
}
|
||||
|
@ -333,7 +336,7 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
final currentHeight = await chainHeight;
|
||||
final coin = info.coin;
|
||||
|
||||
List<Map<String, dynamic>> allTransactions = [];
|
||||
final List<Map<String, dynamic>> allTransactions = [];
|
||||
|
||||
for (final txHash in allTxHashes) {
|
||||
final storedTx = await mainDB.isar.transactionV2s
|
||||
|
@ -390,8 +393,8 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
);
|
||||
|
||||
final prevOutJson = Map<String, dynamic>.from(
|
||||
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout)
|
||||
as Map);
|
||||
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) as Map,
|
||||
);
|
||||
|
||||
final prevOut = OutputV2.fromElectrumXJson(
|
||||
prevOutJson,
|
||||
|
@ -456,7 +459,8 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
TransactionSubType subType = TransactionSubType.none;
|
||||
if (outputs.length > 1 && inputs.isNotEmpty) {
|
||||
for (int i = 0; i < outputs.length; i++) {
|
||||
List<String>? scriptChunks = outputs[i].scriptPubKeyAsm?.split(" ");
|
||||
final List<String>? scriptChunks =
|
||||
outputs[i].scriptPubKeyAsm?.split(" ");
|
||||
if (scriptChunks?.length == 2 && scriptChunks?[0] == "OP_RETURN") {
|
||||
final blindedPaymentCode = scriptChunks![1];
|
||||
final bytes = blindedPaymentCode.toUint8ListFromHex;
|
||||
|
@ -575,8 +579,10 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
|
||||
return txData;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception rethrown from confirmSend(): $e\n$s",
|
||||
level: LogLevel.Error);
|
||||
Logging.instance.log(
|
||||
"Exception rethrown from confirmSend(): $e\n$s",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
@ -685,7 +691,7 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
multisigConfig = await getMultisigConfig();
|
||||
}
|
||||
if (serializedKeys == null || multisigConfig == null) {
|
||||
String err = "${info.coinName} wallet ${info.walletId} had null keys/cfg";
|
||||
final err = "${info.coinName} wallet ${info.walletId} had null keys/cfg";
|
||||
Logging.instance.log(err, level: LogLevel.Fatal);
|
||||
throw Exception(err);
|
||||
// TODO [prio=low]: handle null keys or config. This should not happen.
|
||||
|
@ -713,7 +719,7 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
if (knownSalts.contains(salt)) {
|
||||
throw Exception("Known frost multisig salt found!");
|
||||
}
|
||||
List<String> updatedKnownSalts = List<String>.from(knownSalts);
|
||||
final List<String> updatedKnownSalts = List<String>.from(knownSalts);
|
||||
updatedKnownSalts.add(salt);
|
||||
await _updateKnownSalts(updatedKnownSalts);
|
||||
} else {
|
||||
|
@ -1015,8 +1021,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
.findFirstSync()!;
|
||||
|
||||
Future<void> _updateParticipants(List<String> participants) async {
|
||||
await mainDB.isar.writeTxn(() async {
|
||||
final info = frostInfo;
|
||||
|
||||
await mainDB.isar.writeTxn(() async {
|
||||
await mainDB.isar.frostWalletInfo.delete(info.id);
|
||||
await mainDB.isar.frostWalletInfo.put(
|
||||
info.copyWith(participants: participants),
|
||||
|
@ -1031,8 +1038,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
.findFirstSync()!;
|
||||
|
||||
Future<void> _updateThreshold(int threshold) async {
|
||||
await mainDB.isar.writeTxn(() async {
|
||||
final info = frostInfo;
|
||||
|
||||
await mainDB.isar.writeTxn(() async {
|
||||
await mainDB.isar.frostWalletInfo.delete(info.id);
|
||||
await mainDB.isar.frostWalletInfo.put(
|
||||
info.copyWith(threshold: threshold),
|
||||
|
@ -1047,8 +1055,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
.findFirstSync()!;
|
||||
|
||||
Future<void> _updateMyName(String myName) async {
|
||||
await mainDB.isar.writeTxn(() async {
|
||||
final info = frostInfo;
|
||||
|
||||
await mainDB.isar.writeTxn(() async {
|
||||
await mainDB.isar.frostWalletInfo.delete(info.id);
|
||||
await mainDB.isar.frostWalletInfo.put(
|
||||
info.copyWith(myName: myName),
|
||||
|
@ -1074,13 +1083,15 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
Future<void> _updateElectrumX() async {
|
||||
final failovers = nodeService
|
||||
.failoverNodesFor(coin: cryptoCurrency.coin)
|
||||
.map((e) => ElectrumXNode(
|
||||
.map(
|
||||
(e) => ElectrumXNode(
|
||||
address: e.host,
|
||||
port: e.port,
|
||||
name: e.name,
|
||||
id: e.id,
|
||||
useSSL: e.useSSL,
|
||||
))
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
||||
final newNode = await _getCurrentElectrumXNode();
|
||||
|
@ -1109,7 +1120,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
|||
}
|
||||
|
||||
bool _duplicateTxCheck(
|
||||
List<Map<String, dynamic>> allTransactions, String txid) {
|
||||
List<Map<String, dynamic>> allTransactions,
|
||||
String txid,
|
||||
) {
|
||||
for (int i = 0; i < allTransactions.length; i++) {
|
||||
if (allTransactions[i]["txid"] == txid) {
|
||||
return true;
|
||||
|
|
92
lib/widgets/dialogs/frost/frost_error_dialog.dart
Normal file
92
lib/widgets/dialogs/frost/frost_error_dialog.dart
Normal file
|
@ -0,0 +1,92 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/frost_route_generator.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
|
||||
class FrostErrorDialog extends ConsumerWidget {
|
||||
const FrostErrorDialog({
|
||||
super.key,
|
||||
required this.title,
|
||||
this.icon,
|
||||
this.message,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final Widget? icon;
|
||||
final String? message;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return SafeArea(
|
||||
child: StackDialogBase(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
title,
|
||||
style: STextStyles.pageTitleH2(context),
|
||||
),
|
||||
),
|
||||
icon != null ? icon! : Container(),
|
||||
],
|
||||
),
|
||||
if (message != null)
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
if (message != null)
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
message!,
|
||||
style: STextStyles.smallMed14(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Process must be restarted",
|
||||
style: STextStyles.smallMed14(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Spacer(),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
PrimaryButton(
|
||||
label: "Ok",
|
||||
onPressed: () {
|
||||
ref.read(pFrostScaffoldCanPopDesktop.notifier).state = true;
|
||||
ref.read(pFrostScaffoldArgs)!.parentNav.popUntil(
|
||||
ModalRoute.withName(
|
||||
ref.read(pFrostScaffoldArgs)!.callerRouteName,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue