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,
|
List<FrostStepRoute> stepRoutes,
|
||||||
FrostInterruptionDialogType frostInterruptionDialogType,
|
FrostInterruptionDialogType frostInterruptionDialogType,
|
||||||
NavigatorState parentNav,
|
NavigatorState parentNav,
|
||||||
|
String callerRouteName,
|
||||||
})?>((ref) => null);
|
})?>((ref) => null);
|
||||||
|
|
||||||
abstract class FrostRouteGenerator {
|
abstract class FrostRouteGenerator {
|
||||||
|
|
|
@ -431,6 +431,7 @@ class _NewFrostMsWalletViewState
|
||||||
frostInterruptionDialogType:
|
frostInterruptionDialogType:
|
||||||
FrostInterruptionDialogType.walletCreation,
|
FrostInterruptionDialogType.walletCreation,
|
||||||
parentNav: Navigator.of(context),
|
parentNav: Navigator.of(context),
|
||||||
|
callerRouteName: CreateNewFrostMsWalletView.routeName,
|
||||||
);
|
);
|
||||||
|
|
||||||
await Navigator.of(context).pushNamed(
|
await Navigator.of(context).pushNamed(
|
||||||
|
|
|
@ -131,7 +131,6 @@ class _SelectNewFrostImportTypeViewState
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
label: "Continue",
|
label: "Continue",
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final String route;
|
|
||||||
switch (_selectedOption) {
|
switch (_selectedOption) {
|
||||||
case _ImportOption.multisigNew:
|
case _ImportOption.multisigNew:
|
||||||
ref.read(pFrostScaffoldArgs.state).state = (
|
ref.read(pFrostScaffoldArgs.state).state = (
|
||||||
|
@ -144,6 +143,7 @@ class _SelectNewFrostImportTypeViewState
|
||||||
parentNav: Navigator.of(context),
|
parentNav: Navigator.of(context),
|
||||||
frostInterruptionDialogType:
|
frostInterruptionDialogType:
|
||||||
FrostInterruptionDialogType.walletCreation,
|
FrostInterruptionDialogType.walletCreation,
|
||||||
|
callerRouteName: SelectNewFrostImportTypeView.routeName,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ class _SelectNewFrostImportTypeViewState
|
||||||
parentNav: Navigator.of(context),
|
parentNav: Navigator.of(context),
|
||||||
frostInterruptionDialogType:
|
frostInterruptionDialogType:
|
||||||
FrostInterruptionDialogType.resharing,
|
FrostInterruptionDialogType.resharing,
|
||||||
|
callerRouteName: SelectNewFrostImportTypeView.routeName,
|
||||||
);
|
);
|
||||||
break;
|
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/custom_buttons/simple_copy_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/detail_item.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/frost_step_user_steps.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||||
|
@ -183,10 +184,9 @@ class _FrostCreateStep2State extends ConsumerState<FrostCreateStep2> {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
return await showDialog<void>(
|
return await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => StackOkDialog(
|
builder: (_) => FrostErrorDialog(
|
||||||
title: "Failed to generate shares",
|
title: "Failed to generate shares",
|
||||||
message: e.toString(),
|
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/custom_buttons/simple_copy_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/detail_item.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/frost_step_user_steps.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||||
|
@ -184,9 +185,8 @@ class _FrostCreateStep3State extends ConsumerState<FrostCreateStep3> {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
return await showDialog<void>(
|
return await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => StackOkDialog(
|
builder: (_) => const FrostErrorDialog(
|
||||||
title: "Failed to complete key generation",
|
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/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
import 'package:stackwallet/widgets/detail_item.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/dialogs/simple_mobile_dialog.dart';
|
||||||
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
|
import 'package:stackwallet/widgets/frost_step_user_steps.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
|
||||||
|
|
||||||
class FrostReshareStep1a extends ConsumerStatefulWidget {
|
class FrostReshareStep1a extends ConsumerStatefulWidget {
|
||||||
const FrostReshareStep1a({super.key});
|
const FrostReshareStep1a({super.key});
|
||||||
|
@ -88,9 +88,8 @@ class _FrostReshareStep1aState extends ConsumerState<FrostReshareStep1a> {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => StackOkDialog(
|
builder: (_) => FrostErrorDialog(
|
||||||
title: e.toString(),
|
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/wallets/isar/models/frost_wallet_info.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/checkbox_text_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/checkbox_text_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_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/frost_step_user_steps.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
|
||||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||||
|
|
||||||
class FrostReshareStep1b extends ConsumerStatefulWidget {
|
class FrostReshareStep1b extends ConsumerStatefulWidget {
|
||||||
|
@ -124,9 +124,8 @@ class _FrostReshareStep1bState extends ConsumerState<FrostReshareStep1b> {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => StackOkDialog(
|
builder: (_) => FrostErrorDialog(
|
||||||
title: e.toString(),
|
title: e.toString(),
|
||||||
desktopPopRootNavigator: Util.isDesktop,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,6 +190,7 @@ class _FrostReshareStep1cState extends ConsumerState<FrostReshareStep1c> {
|
||||||
parentNav: data.parentNav,
|
parentNav: data.parentNav,
|
||||||
frostInterruptionDialogType:
|
frostInterruptionDialogType:
|
||||||
FrostInterruptionDialogType.resharing,
|
FrostInterruptionDialogType.resharing,
|
||||||
|
callerRouteName: data.callerRouteName,
|
||||||
);
|
);
|
||||||
ref.read(pFrostMyName.state).state =
|
ref.read(pFrostMyName.state).state =
|
||||||
ref.read(pFrostResharingData).myName!;
|
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/custom_buttons/simple_copy_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/detail_item.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';
|
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||||
|
|
||||||
class FrostReshareStep2abd extends ConsumerStatefulWidget {
|
class FrostReshareStep2abd extends ConsumerStatefulWidget {
|
||||||
|
@ -86,10 +86,9 @@ class _FrostReshareStep2abdState extends ConsumerState<FrostReshareStep2abd> {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => StackOkDialog(
|
builder: (_) => FrostErrorDialog(
|
||||||
title: "Error",
|
title: "Error",
|
||||||
message: e.toString(),
|
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/logger.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.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';
|
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||||
|
|
||||||
class FrostReshareStep2c extends ConsumerStatefulWidget {
|
class FrostReshareStep2c extends ConsumerStatefulWidget {
|
||||||
|
@ -63,14 +63,15 @@ class _FrostReshareStep2cState extends ConsumerState<FrostReshareStep2c> {
|
||||||
level: LogLevel.Fatal,
|
level: LogLevel.Fatal,
|
||||||
);
|
);
|
||||||
|
|
||||||
await showDialog<void>(
|
if (mounted) {
|
||||||
context: context,
|
await showDialog<void>(
|
||||||
builder: (_) => StackOkDialog(
|
context: context,
|
||||||
title: "Error",
|
builder: (_) => FrostErrorDialog(
|
||||||
message: e.toString(),
|
title: "Error",
|
||||||
desktopPopRootNavigator: Util.isDesktop,
|
message: e.toString(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
_buttonLock = false;
|
_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/custom_buttons/simple_copy_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/detail_item.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';
|
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||||
|
|
||||||
class FrostReshareStep3abd extends ConsumerStatefulWidget {
|
class FrostReshareStep3abd extends ConsumerStatefulWidget {
|
||||||
|
@ -73,15 +73,15 @@ class _FrostReshareStep3abdState extends ConsumerState<FrostReshareStep3abd> {
|
||||||
"$e\n$s",
|
"$e\n$s",
|
||||||
level: LogLevel.Fatal,
|
level: LogLevel.Fatal,
|
||||||
);
|
);
|
||||||
|
if (mounted) {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => StackOkDialog(
|
builder: (_) => FrostErrorDialog(
|
||||||
title: "Error",
|
title: "Error",
|
||||||
message: e.toString(),
|
message: e.toString(),
|
||||||
desktopPopRootNavigator: Util.isDesktop,
|
),
|
||||||
),
|
);
|
||||||
);
|
}
|
||||||
} finally {
|
} finally {
|
||||||
_buttonLock = false;
|
_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/custom_buttons/simple_copy_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/detail_item.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';
|
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||||
|
|
||||||
// was FinishResharingView
|
// was FinishResharingView
|
||||||
|
@ -94,10 +94,9 @@ class _FrostReshareStep4State extends ConsumerState<FrostReshareStep4> {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => StackOkDialog(
|
builder: (_) => FrostErrorDialog(
|
||||||
title: "Error",
|
title: "Error",
|
||||||
message: e.toString(),
|
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/custom_buttons/simple_copy_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/detail_item.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
|
// was VerifyUpdatedWalletView
|
||||||
class FrostReshareStep5 extends ConsumerStatefulWidget {
|
class FrostReshareStep5 extends ConsumerStatefulWidget {
|
||||||
|
@ -110,10 +110,9 @@ class _FrostReshareStep5State extends ConsumerState<FrostReshareStep5> {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => StackOkDialog(
|
builder: (_) => FrostErrorDialog(
|
||||||
title: "Error",
|
title: "Error",
|
||||||
message: e.toString(),
|
message: e.toString(),
|
||||||
desktopPopRootNavigator: Util.isDesktop,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,7 @@ class _FrostSendViewState extends ConsumerState<FrostSendView> {
|
||||||
parentNav: Navigator.of(context),
|
parentNav: Navigator.of(context),
|
||||||
frostInterruptionDialogType:
|
frostInterruptionDialogType:
|
||||||
FrostInterruptionDialogType.transactionCreation,
|
FrostInterruptionDialogType.transactionCreation,
|
||||||
|
callerRouteName: FrostSendView.routeName,
|
||||||
);
|
);
|
||||||
|
|
||||||
await Navigator.of(context).pushNamed(
|
await Navigator.of(context).pushNamed(
|
||||||
|
|
|
@ -109,14 +109,16 @@ class _FrostSendStep1bState extends ConsumerState<FrostSendStep1b> {
|
||||||
"$e\n$s",
|
"$e\n$s",
|
||||||
level: LogLevel.Error,
|
level: LogLevel.Error,
|
||||||
);
|
);
|
||||||
await showDialog<void>(
|
if (mounted) {
|
||||||
context: context,
|
await showDialog<void>(
|
||||||
builder: (_) => StackOkDialog(
|
context: context,
|
||||||
title: "Import and attempt sign config failed",
|
builder: (_) => StackOkDialog(
|
||||||
message: e.toString(),
|
title: "Import and attempt sign config failed",
|
||||||
desktopPopRootNavigator: Util.isDesktop,
|
message: e.toString(),
|
||||||
),
|
desktopPopRootNavigator: Util.isDesktop,
|
||||||
);
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
_attemptSignLock = false;
|
_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/custom_buttons/simple_copy_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/detail_item.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/rounded_white_container.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
|
||||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||||
|
|
||||||
class FrostSendStep2 extends ConsumerStatefulWidget {
|
class FrostSendStep2 extends ConsumerStatefulWidget {
|
||||||
|
@ -293,13 +293,14 @@ class _FrostSendStep2State extends ConsumerState<FrostSendStep2> {
|
||||||
level: LogLevel.Fatal,
|
level: LogLevel.Fatal,
|
||||||
);
|
);
|
||||||
|
|
||||||
return await showDialog<void>(
|
if (context.mounted) {
|
||||||
context: context,
|
return await showDialog<void>(
|
||||||
builder: (_) => StackOkDialog(
|
context: context,
|
||||||
title: "Failed to continue signing",
|
builder: (_) => const FrostErrorDialog(
|
||||||
desktopPopRootNavigator: Util.isDesktop,
|
title: "Failed to continue signing",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -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/custom_buttons/simple_copy_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/detail_item.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/frost_step_user_steps.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
|
||||||
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
import 'package:stackwallet/widgets/textfields/frost_step_field.dart';
|
||||||
|
|
||||||
class FrostSendStep3 extends ConsumerStatefulWidget {
|
class FrostSendStep3 extends ConsumerStatefulWidget {
|
||||||
|
@ -238,9 +238,8 @@ class _FrostSendStep3State extends ConsumerState<FrostSendStep3> {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
return await showDialog<void>(
|
return await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => StackOkDialog(
|
builder: (_) => const FrostErrorDialog(
|
||||||
title: "Failed to complete signing process",
|
title: "Failed to complete signing process",
|
||||||
desktopPopRootNavigator: Util.isDesktop,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.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/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/providers/providers.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
|
@ -95,12 +94,12 @@ class SyncingOptionsView extends ConsumerWidget {
|
||||||
ref.read(prefsChangeNotifierProvider).syncType =
|
ref.read(prefsChangeNotifierProvider).syncType =
|
||||||
SyncingType.currentWalletOnly;
|
SyncingType.currentWalletOnly;
|
||||||
|
|
||||||
// disable auto sync on all wallets that aren't active/current
|
// // disable auto sync on all wallets that aren't active/current
|
||||||
ref.read(pWallets).wallets.forEach((e) {
|
// ref.read(pWallets).wallets.forEach((e) {
|
||||||
if (e.walletId != ref.read(currentWalletIdProvider)) {
|
// if (e.walletId != ref.read(currentWalletIdProvider)) {
|
||||||
e.shouldAutoSync = false;
|
// e.shouldAutoSync = false;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -174,11 +173,11 @@ class SyncingOptionsView extends ConsumerWidget {
|
||||||
ref.read(prefsChangeNotifierProvider).syncType =
|
ref.read(prefsChangeNotifierProvider).syncType =
|
||||||
SyncingType.allWalletsOnStartup;
|
SyncingType.allWalletsOnStartup;
|
||||||
|
|
||||||
// enable auto sync on all wallets
|
// // enable auto sync on all wallets
|
||||||
ref
|
// ref
|
||||||
.read(pWallets)
|
// .read(pWallets)
|
||||||
.wallets
|
// .wallets
|
||||||
.forEach((e) => e.shouldAutoSync = true);
|
// .forEach((e) => e.shouldAutoSync = true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -252,13 +251,13 @@ class SyncingOptionsView extends ConsumerWidget {
|
||||||
ref.read(prefsChangeNotifierProvider).syncType =
|
ref.read(prefsChangeNotifierProvider).syncType =
|
||||||
SyncingType.selectedWalletsAtStartup;
|
SyncingType.selectedWalletsAtStartup;
|
||||||
|
|
||||||
final ids = ref
|
// final ids = ref
|
||||||
.read(prefsChangeNotifierProvider)
|
// .read(prefsChangeNotifierProvider)
|
||||||
.walletIdsSyncOnStartup;
|
// .walletIdsSyncOnStartup;
|
||||||
|
//
|
||||||
// enable auto sync on selected wallets only
|
// // enable auto sync on selected wallets only
|
||||||
ref.read(pWallets).wallets.forEach(
|
// ref.read(pWallets).wallets.forEach(
|
||||||
(e) => e.shouldAutoSync = ids.contains(e.walletId));
|
// (e) => e.shouldAutoSync = ids.contains(e.walletId));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
|
@ -13,13 +13,11 @@ import 'dart:io';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/svg.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/providers/providers.dart';
|
||||||
import 'package:stackwallet/themes/coin_icon_provider.dart';
|
import 'package:stackwallet/themes/coin_icon_provider.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/amount/amount_formatter.dart';
|
import 'package:stackwallet/utilities/amount/amount_formatter.dart';
|
||||||
import 'package:stackwallet/utilities/constants.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/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
||||||
|
@ -181,9 +179,9 @@ class WalletSyncingOptionsView extends ConsumerWidget {
|
||||||
.walletIdsSyncOnStartup))
|
.walletIdsSyncOnStartup))
|
||||||
.contains(info.walletId),
|
.contains(info.walletId),
|
||||||
onValueChanged: (value) {
|
onValueChanged: (value) {
|
||||||
final syncType = ref
|
// final syncType = ref
|
||||||
.read(prefsChangeNotifierProvider)
|
// .read(prefsChangeNotifierProvider)
|
||||||
.syncType;
|
// .syncType;
|
||||||
final ids = ref
|
final ids = ref
|
||||||
.read(prefsChangeNotifierProvider)
|
.read(prefsChangeNotifierProvider)
|
||||||
.walletIdsSyncOnStartup
|
.walletIdsSyncOnStartup
|
||||||
|
@ -194,25 +192,25 @@ class WalletSyncingOptionsView extends ConsumerWidget {
|
||||||
ids.remove(info.walletId);
|
ids.remove(info.walletId);
|
||||||
}
|
}
|
||||||
|
|
||||||
final wallet = ref
|
// final wallet = ref
|
||||||
.read(pWallets)
|
// .read(pWallets)
|
||||||
.getWallet(info.walletId);
|
// .getWallet(info.walletId);
|
||||||
|
//
|
||||||
switch (syncType) {
|
// switch (syncType) {
|
||||||
case SyncingType.currentWalletOnly:
|
// case SyncingType.currentWalletOnly:
|
||||||
if (info.walletId ==
|
// if (info.walletId ==
|
||||||
ref.read(
|
// ref.read(
|
||||||
currentWalletIdProvider)) {
|
// currentWalletIdProvider)) {
|
||||||
wallet.shouldAutoSync = value;
|
// wallet.shouldAutoSync = value;
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
case SyncingType
|
// case SyncingType
|
||||||
.selectedWalletsAtStartup:
|
// .selectedWalletsAtStartup:
|
||||||
case SyncingType
|
// case SyncingType
|
||||||
.allWalletsOnStartup:
|
// .allWalletsOnStartup:
|
||||||
wallet.shouldAutoSync = value;
|
// wallet.shouldAutoSync = value;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
|
||||||
ref
|
ref
|
||||||
.read(prefsChangeNotifierProvider)
|
.read(prefsChangeNotifierProvider)
|
||||||
|
|
|
@ -162,6 +162,7 @@ class FrostMSWalletOptionsView extends ConsumerWidget {
|
||||||
parentNav: Navigator.of(context),
|
parentNav: Navigator.of(context),
|
||||||
frostInterruptionDialogType:
|
frostInterruptionDialogType:
|
||||||
FrostInterruptionDialogType.resharing,
|
FrostInterruptionDialogType.resharing,
|
||||||
|
callerRouteName: FrostMSWalletOptionsView.routeName,
|
||||||
);
|
);
|
||||||
|
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
|
|
|
@ -129,18 +129,19 @@ class _CompleteReshareConfigViewState
|
||||||
final wallet =
|
final wallet =
|
||||||
ref.read(pWallets).getWallet(widget.walletId) as BitcoinFrostWallet;
|
ref.read(pWallets).getWallet(widget.walletId) as BitcoinFrostWallet;
|
||||||
|
|
||||||
ref.read(pFrostScaffoldArgs.state).state = (
|
|
||||||
info: (
|
|
||||||
walletName: wallet.info.name,
|
|
||||||
frostCurrency: wallet.cryptoCurrency,
|
|
||||||
),
|
|
||||||
walletId: wallet.walletId,
|
|
||||||
stepRoutes: FrostRouteGenerator.initiateReshareStepRoutes,
|
|
||||||
parentNav: Navigator.of(context),
|
|
||||||
frostInterruptionDialogType: FrostInterruptionDialogType.resharing,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
|
ref.read(pFrostScaffoldArgs.state).state = (
|
||||||
|
info: (
|
||||||
|
walletName: wallet.info.name,
|
||||||
|
frostCurrency: wallet.cryptoCurrency,
|
||||||
|
),
|
||||||
|
walletId: wallet.walletId,
|
||||||
|
stepRoutes: FrostRouteGenerator.initiateReshareStepRoutes,
|
||||||
|
parentNav: Navigator.of(context),
|
||||||
|
frostInterruptionDialogType: FrostInterruptionDialogType.resharing,
|
||||||
|
callerRouteName: CompleteReshareConfigView.routeName,
|
||||||
|
);
|
||||||
|
|
||||||
await Navigator.of(context).pushNamed(
|
await Navigator.of(context).pushNamed(
|
||||||
FrostStepScaffold.routeName,
|
FrostStepScaffold.routeName,
|
||||||
);
|
);
|
||||||
|
@ -345,7 +346,8 @@ class _CompleteReshareConfigViewState
|
||||||
() => _includeMeInReshare = value == true,
|
() => _includeMeInReshare = value == true,
|
||||||
);
|
);
|
||||||
_participantsCountChanged(
|
_participantsCountChanged(
|
||||||
_newParticipantsCountController.text);
|
_newParticipantsCountController.text,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -124,7 +124,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
|
|
||||||
late final bool isSparkWallet;
|
late final bool isSparkWallet;
|
||||||
|
|
||||||
late final bool _shouldDisableAutoSyncOnLogOut;
|
// late final bool _shouldDisableAutoSyncOnLogOut;
|
||||||
|
|
||||||
late WalletSyncStatus _currentSyncStatus;
|
late WalletSyncStatus _currentSyncStatus;
|
||||||
late NodeConnectionStatus _currentNodeStatus;
|
late NodeConnectionStatus _currentNodeStatus;
|
||||||
|
@ -177,9 +177,9 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
if (!wallet.shouldAutoSync) {
|
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;
|
wallet.shouldAutoSync = true;
|
||||||
_shouldDisableAutoSyncOnLogOut = true;
|
// _shouldDisableAutoSyncOnLogOut = true;
|
||||||
} else {
|
// } else {
|
||||||
_shouldDisableAutoSyncOnLogOut = false;
|
// _shouldDisableAutoSyncOnLogOut = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isSparkWallet = wallet is SparkInterface;
|
isSparkWallet = wallet is SparkInterface;
|
||||||
|
@ -277,34 +277,36 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
const timeout = Duration(milliseconds: 1500);
|
const timeout = Duration(milliseconds: 1500);
|
||||||
if (_cachedTime == null || now.difference(_cachedTime!) > timeout) {
|
if (_cachedTime == null || now.difference(_cachedTime!) > timeout) {
|
||||||
_cachedTime = now;
|
_cachedTime = now;
|
||||||
unawaited(showDialog<dynamic>(
|
unawaited(
|
||||||
context: context,
|
showDialog<dynamic>(
|
||||||
barrierDismissible: false,
|
context: context,
|
||||||
builder: (_) => WillPopScope(
|
barrierDismissible: false,
|
||||||
onWillPop: () async {
|
builder: (_) => WillPopScope(
|
||||||
Navigator.of(context).popUntil(
|
onWillPop: () async {
|
||||||
ModalRoute.withName(HomeView.routeName),
|
Navigator.of(context).popUntil(
|
||||||
);
|
ModalRoute.withName(HomeView.routeName),
|
||||||
_logout();
|
);
|
||||||
return false;
|
_logout();
|
||||||
},
|
return false;
|
||||||
child: const StackDialog(title: "Tap back again to exit wallet"),
|
},
|
||||||
|
child: const StackDialog(title: "Tap back again to exit wallet"),
|
||||||
|
),
|
||||||
|
).timeout(
|
||||||
|
timeout,
|
||||||
|
onTimeout: () => Navigator.of(context).popUntil(
|
||||||
|
ModalRoute.withName(WalletView.routeName),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
).timeout(
|
);
|
||||||
timeout,
|
|
||||||
onTimeout: () => Navigator.of(context).popUntil(
|
|
||||||
ModalRoute.withName(WalletView.routeName),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _logout() async {
|
void _logout() async {
|
||||||
if (_shouldDisableAutoSyncOnLogOut) {
|
// if (_shouldDisableAutoSyncOnLogOut) {
|
||||||
// disable auto sync if it was enabled only when loading wallet
|
// // disable auto sync if it was enabled only when loading wallet
|
||||||
ref.read(pWallets).getWallet(walletId).shouldAutoSync = false;
|
ref.read(pWallets).getWallet(walletId).shouldAutoSync = false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
ref.read(currentWalletIdProvider.notifier).state = null;
|
ref.read(currentWalletIdProvider.notifier).state = null;
|
||||||
ref.read(transactionFilterProvider.state).state = null;
|
ref.read(transactionFilterProvider.state).state = null;
|
||||||
|
@ -373,6 +375,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
parentNav: Navigator.of(context),
|
parentNav: Navigator.of(context),
|
||||||
frostInterruptionDialogType:
|
frostInterruptionDialogType:
|
||||||
FrostInterruptionDialogType.transactionCreation,
|
FrostInterruptionDialogType.transactionCreation,
|
||||||
|
callerRouteName: WalletView.routeName,
|
||||||
);
|
);
|
||||||
|
|
||||||
await Navigator.of(context).pushNamed(
|
await Navigator.of(context).pushNamed(
|
||||||
|
@ -398,11 +401,12 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
.tickerEqualToAnyExchangeNameName(coin.ticker)
|
.tickerEqualToAnyExchangeNameName(coin.ticker)
|
||||||
.findFirst();
|
.findFirst();
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
_future = ExchangeDataLoadingService.instance.loadAll().then((_) =>
|
_future = ExchangeDataLoadingService.instance.loadAll().then(
|
||||||
ExchangeDataLoadingService.instance.isar.currencies
|
(_) => ExchangeDataLoadingService.instance.isar.currencies
|
||||||
.where()
|
.where()
|
||||||
.tickerEqualToAnyExchangeNameName(coin.ticker)
|
.tickerEqualToAnyExchangeNameName(coin.ticker)
|
||||||
.findFirst());
|
.findFirst(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final currency = await showLoading(
|
final currency = await showLoading(
|
||||||
|
@ -411,7 +415,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
message: "Loading...",
|
message: "Loading...",
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mounted) {
|
if (context.mounted) {
|
||||||
unawaited(
|
unawaited(
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
WalletInitiatedExchangeView.routeName,
|
WalletInitiatedExchangeView.routeName,
|
||||||
|
@ -568,7 +572,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -607,7 +611,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
style: STextStyles.navBarTitle(context),
|
style: STextStyles.navBarTitle(context),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -670,9 +674,12 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.background,
|
.background,
|
||||||
icon: ref.watch(notificationsProvider.select(
|
icon: ref.watch(
|
||||||
(value) => value
|
notificationsProvider.select(
|
||||||
.hasUnreadNotificationsFor(walletId)))
|
(value) =>
|
||||||
|
value.hasUnreadNotificationsFor(walletId),
|
||||||
|
),
|
||||||
|
)
|
||||||
? SvgPicture.file(
|
? SvgPicture.file(
|
||||||
File(
|
File(
|
||||||
ref.watch(
|
ref.watch(
|
||||||
|
@ -683,10 +690,14 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
),
|
),
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
color: ref.watch(notificationsProvider.select(
|
color: ref.watch(
|
||||||
(value) =>
|
notificationsProvider.select(
|
||||||
value.hasUnreadNotificationsFor(
|
(value) =>
|
||||||
walletId)))
|
value.hasUnreadNotificationsFor(
|
||||||
|
walletId,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
? null
|
? null
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
|
@ -696,10 +707,14 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
Assets.svg.bell,
|
Assets.svg.bell,
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
color: ref.watch(notificationsProvider.select(
|
color: ref.watch(
|
||||||
(value) =>
|
notificationsProvider.select(
|
||||||
value.hasUnreadNotificationsFor(
|
(value) =>
|
||||||
walletId)))
|
value.hasUnreadNotificationsFor(
|
||||||
|
walletId,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
? null
|
? null
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
|
@ -720,22 +735,25 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
.state;
|
.state;
|
||||||
if (unreadNotificationIds.isEmpty) return;
|
if (unreadNotificationIds.isEmpty) return;
|
||||||
|
|
||||||
List<Future<dynamic>> futures = [];
|
final List<Future<dynamic>> futures = [];
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
i < unreadNotificationIds.length - 1;
|
i < unreadNotificationIds.length - 1;
|
||||||
i++) {
|
i++) {
|
||||||
futures.add(ref
|
futures.add(
|
||||||
.read(notificationsProvider)
|
ref.read(notificationsProvider).markAsRead(
|
||||||
.markAsRead(
|
|
||||||
unreadNotificationIds.elementAt(i),
|
unreadNotificationIds.elementAt(i),
|
||||||
false));
|
false,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait for multiple to update if any
|
// wait for multiple to update if any
|
||||||
Future.wait(futures).then((_) {
|
Future.wait(futures).then((_) {
|
||||||
// only notify listeners once
|
// only notify listeners once
|
||||||
ref.read(notificationsProvider).markAsRead(
|
ref.read(notificationsProvider).markAsRead(
|
||||||
unreadNotificationIds.last, true);
|
unreadNotificationIds.last,
|
||||||
|
true,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -824,7 +842,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
style: Theme.of(context)
|
style: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.getSecondaryEnabledButtonStyle(
|
.getSecondaryEnabledButtonStyle(
|
||||||
context),
|
context,
|
||||||
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -855,7 +874,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
style: Theme.of(context)
|
style: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.getPrimaryEnabledButtonStyle(
|
.getPrimaryEnabledButtonStyle(
|
||||||
context),
|
context,
|
||||||
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Continue",
|
"Continue",
|
||||||
style:
|
style:
|
||||||
|
@ -1073,21 +1093,22 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
),
|
),
|
||||||
if (coin == Coin.banano)
|
if (coin == Coin.banano)
|
||||||
WalletNavigationBarItemData(
|
WalletNavigationBarItemData(
|
||||||
icon: SvgPicture.asset(
|
icon: SvgPicture.asset(
|
||||||
Assets.svg.monkey,
|
Assets.svg.monkey,
|
||||||
height: 20,
|
height: 20,
|
||||||
width: 20,
|
width: 20,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.bottomNavIconIcon,
|
.bottomNavIconIcon,
|
||||||
),
|
),
|
||||||
label: "MonKey",
|
label: "MonKey",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
MonkeyView.routeName,
|
MonkeyView.routeName,
|
||||||
arguments: widget.walletId,
|
arguments: widget.walletId,
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
if (ref.watch(
|
if (ref.watch(
|
||||||
pWallets.select(
|
pWallets.select(
|
||||||
(value) => value.getWallet(widget.walletId)
|
(value) => value.getWallet(widget.walletId)
|
||||||
|
@ -1112,8 +1133,12 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (ref.watch(pWallets.select((value) =>
|
if (ref.watch(
|
||||||
value.getWallet(widget.walletId) is PaynymInterface)))
|
pWallets.select(
|
||||||
|
(value) =>
|
||||||
|
value.getWallet(widget.walletId) is PaynymInterface,
|
||||||
|
),
|
||||||
|
))
|
||||||
WalletNavigationBarItemData(
|
WalletNavigationBarItemData(
|
||||||
label: "PayNym",
|
label: "PayNym",
|
||||||
icon: const PaynymNavIcon(),
|
icon: const PaynymNavIcon(),
|
||||||
|
@ -1145,7 +1170,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
level: LogLevel.Info,
|
level: LogLevel.Info,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mounted) {
|
if (context.mounted) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|
||||||
// check if account exists and for matching code to see if claimed
|
// 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 TextEditingController controller;
|
||||||
late final EventBus eventBus;
|
late final EventBus eventBus;
|
||||||
|
|
||||||
late final bool _shouldDisableAutoSyncOnLogOut;
|
// late final bool _shouldDisableAutoSyncOnLogOut;
|
||||||
|
|
||||||
Future<void> onBackPressed() async {
|
Future<void> onBackPressed() async {
|
||||||
await _logout();
|
await _logout();
|
||||||
|
@ -83,10 +83,10 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
|
||||||
|
|
||||||
Future<void> _logout() async {
|
Future<void> _logout() async {
|
||||||
final wallet = ref.read(pWallets).getWallet(widget.walletId);
|
final wallet = ref.read(pWallets).getWallet(widget.walletId);
|
||||||
if (_shouldDisableAutoSyncOnLogOut) {
|
// if (_shouldDisableAutoSyncOnLogOut) {
|
||||||
// disable auto sync if it was enabled only when loading wallet
|
// // disable auto sync if it was enabled only when loading wallet
|
||||||
wallet.shouldAutoSync = false;
|
wallet.shouldAutoSync = false;
|
||||||
}
|
// }
|
||||||
ref.read(transactionFilterProvider.state).state = null;
|
ref.read(transactionFilterProvider.state).state = null;
|
||||||
if (ref.read(prefsChangeNotifierProvider).isAutoBackupEnabled &&
|
if (ref.read(prefsChangeNotifierProvider).isAutoBackupEnabled &&
|
||||||
ref.read(prefsChangeNotifierProvider).backupFrequencyType ==
|
ref.read(prefsChangeNotifierProvider).backupFrequencyType ==
|
||||||
|
@ -131,11 +131,11 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
|
||||||
ref.read(currentWalletIdProvider.notifier).state = wallet.walletId);
|
ref.read(currentWalletIdProvider.notifier).state = wallet.walletId);
|
||||||
|
|
||||||
if (!wallet.shouldAutoSync) {
|
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;
|
wallet.shouldAutoSync = true;
|
||||||
_shouldDisableAutoSyncOnLogOut = true;
|
// _shouldDisableAutoSyncOnLogOut = true;
|
||||||
} else {
|
// } else {
|
||||||
_shouldDisableAutoSyncOnLogOut = false;
|
// _shouldDisableAutoSyncOnLogOut = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wallet.refresh();
|
wallet.refresh();
|
||||||
|
|
|
@ -13,6 +13,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:stackwallet/frost_route_generator.dart';
|
import 'package:stackwallet/frost_route_generator.dart';
|
||||||
import 'package:stackwallet/pages/send_view/frost_ms/frost_send_view.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/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_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_send.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_token_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:
|
||||||
FrostInterruptionDialogType
|
FrostInterruptionDialogType
|
||||||
.transactionCreation,
|
.transactionCreation,
|
||||||
|
callerRouteName: MyStackView.routeName,
|
||||||
);
|
);
|
||||||
|
|
||||||
await Navigator.of(context).pushNamed(
|
await Navigator.of(context).pushNamed(
|
||||||
|
@ -111,7 +113,7 @@ class _MyWalletState extends ConsumerState<MyWallet> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
FrostSendView(
|
FrostSendView(
|
||||||
|
|
|
@ -136,7 +136,8 @@ class Wallets {
|
||||||
|
|
||||||
Future<void> load(Prefs prefs, MainDB mainDB) async {
|
Future<void> load(Prefs prefs, MainDB mainDB) async {
|
||||||
// return await _loadV1(prefs, mainDB);
|
// 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 {
|
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 {
|
Future<void> _loadV2(Prefs prefs, MainDB mainDB) async {
|
||||||
if (hasLoaded) {
|
if (hasLoaded) {
|
||||||
return;
|
return;
|
||||||
|
@ -358,6 +360,160 @@ class Wallets {
|
||||||
await Future.wait(deleteFutures);
|
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(
|
Future<void> loadAfterStackRestore(
|
||||||
Prefs prefs,
|
Prefs prefs,
|
||||||
List<Wallet> wallets,
|
List<Wallet> wallets,
|
||||||
|
@ -396,10 +552,10 @@ class Wallets {
|
||||||
if (wallet is CwBasedInterface) {
|
if (wallet is CwBasedInterface) {
|
||||||
// walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
|
// walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
|
||||||
} else {
|
} else {
|
||||||
walletInitFutures.add(wallet.init().then((value) {
|
walletInitFutures.add(wallet.init().then((_) {
|
||||||
if (shouldSetAutoSync) {
|
// if (shouldSetAutoSync) {
|
||||||
wallet.shouldAutoSync = true;
|
// wallet.shouldAutoSync = true;
|
||||||
}
|
// }
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,6 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
final coinCardProvider = Provider.family<String?, Coin>((ref, coin) {
|
final coinCardProvider = Provider.family<String?, Coin>((ref, coin) {
|
||||||
final assets = ref.watch(themeAssetsProvider);
|
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) {
|
if (assets is ThemeAssetsV3) {
|
||||||
return assets.coinCardImages?[coin.mainNetVersion];
|
return assets.coinCardImages?[coin.mainNetVersion];
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,13 +26,6 @@ final coinCardProvider = Provider.family<String?, Coin>((ref, coin) {
|
||||||
final coinCardFavoritesProvider = Provider.family<String?, Coin>((ref, coin) {
|
final coinCardFavoritesProvider = Provider.family<String?, Coin>((ref, coin) {
|
||||||
final assets = ref.watch(themeAssetsProvider);
|
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) {
|
if (assets is ThemeAssetsV3) {
|
||||||
return assets.coinCardFavoritesImages?[coin.mainNetVersion] ??
|
return assets.coinCardFavoritesImages?[coin.mainNetVersion] ??
|
||||||
assets.coinCardImages?[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 coinIconProvider = Provider.family<String, Coin>((ref, coin) {
|
||||||
final assets = ref.watch(themeAssetsProvider);
|
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) {
|
if (assets is ThemeAssets) {
|
||||||
switch (coin) {
|
switch (coin) {
|
||||||
case Coin.bitcoin:
|
case Coin.bitcoin:
|
||||||
|
|
|
@ -16,13 +16,6 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
final coinImageProvider = Provider.family<String, Coin>((ref, coin) {
|
final coinImageProvider = Provider.family<String, Coin>((ref, coin) {
|
||||||
final assets = ref.watch(themeAssetsProvider);
|
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) {
|
if (assets is ThemeAssets) {
|
||||||
switch (coin) {
|
switch (coin) {
|
||||||
case Coin.bitcoin:
|
case Coin.bitcoin:
|
||||||
|
@ -71,13 +64,6 @@ final coinImageProvider = Provider.family<String, Coin>((ref, coin) {
|
||||||
final coinImageSecondaryProvider = Provider.family<String, Coin>((ref, coin) {
|
final coinImageSecondaryProvider = Provider.family<String, Coin>((ref, coin) {
|
||||||
final assets = ref.watch(themeAssetsProvider);
|
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) {
|
if (assets is ThemeAssets) {
|
||||||
switch (coin) {
|
switch (coin) {
|
||||||
case Coin.bitcoin:
|
case Coin.bitcoin:
|
||||||
|
|
|
@ -180,10 +180,12 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
final config = Frost.createSignConfig(
|
final config = Frost.createSignConfig(
|
||||||
network: network,
|
network: network,
|
||||||
inputs: utxosToUse
|
inputs: utxosToUse
|
||||||
.map((e) => (
|
.map(
|
||||||
utxo: e,
|
(e) => (
|
||||||
scriptPubKey: publicKey,
|
utxo: e,
|
||||||
))
|
scriptPubKey: publicKey,
|
||||||
|
),
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
outputs: txData.recipients!,
|
outputs: txData.recipients!,
|
||||||
changeAddress: (await getCurrentReceivingAddress())!.value,
|
changeAddress: (await getCurrentReceivingAddress())!.value,
|
||||||
|
@ -278,8 +280,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
Amount _roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
|
Amount _roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) {
|
||||||
return Amount(
|
return Amount(
|
||||||
rawValue: BigInt.from(
|
rawValue: BigInt.from(
|
||||||
((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
|
((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() *
|
||||||
(feeRatePerKB / 1000).ceil()),
|
(feeRatePerKB / 1000).ceil(),
|
||||||
|
),
|
||||||
fractionDigits: cryptoCurrency.fractionDigits,
|
fractionDigits: cryptoCurrency.fractionDigits,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -333,7 +336,7 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
final currentHeight = await chainHeight;
|
final currentHeight = await chainHeight;
|
||||||
final coin = info.coin;
|
final coin = info.coin;
|
||||||
|
|
||||||
List<Map<String, dynamic>> allTransactions = [];
|
final List<Map<String, dynamic>> allTransactions = [];
|
||||||
|
|
||||||
for (final txHash in allTxHashes) {
|
for (final txHash in allTxHashes) {
|
||||||
final storedTx = await mainDB.isar.transactionV2s
|
final storedTx = await mainDB.isar.transactionV2s
|
||||||
|
@ -390,8 +393,8 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
);
|
);
|
||||||
|
|
||||||
final prevOutJson = Map<String, dynamic>.from(
|
final prevOutJson = Map<String, dynamic>.from(
|
||||||
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout)
|
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) as Map,
|
||||||
as Map);
|
);
|
||||||
|
|
||||||
final prevOut = OutputV2.fromElectrumXJson(
|
final prevOut = OutputV2.fromElectrumXJson(
|
||||||
prevOutJson,
|
prevOutJson,
|
||||||
|
@ -456,7 +459,8 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
TransactionSubType subType = TransactionSubType.none;
|
TransactionSubType subType = TransactionSubType.none;
|
||||||
if (outputs.length > 1 && inputs.isNotEmpty) {
|
if (outputs.length > 1 && inputs.isNotEmpty) {
|
||||||
for (int i = 0; i < outputs.length; i++) {
|
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") {
|
if (scriptChunks?.length == 2 && scriptChunks?[0] == "OP_RETURN") {
|
||||||
final blindedPaymentCode = scriptChunks![1];
|
final blindedPaymentCode = scriptChunks![1];
|
||||||
final bytes = blindedPaymentCode.toUint8ListFromHex;
|
final bytes = blindedPaymentCode.toUint8ListFromHex;
|
||||||
|
@ -575,8 +579,10 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
|
|
||||||
return txData;
|
return txData;
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logging.instance.log("Exception rethrown from confirmSend(): $e\n$s",
|
Logging.instance.log(
|
||||||
level: LogLevel.Error);
|
"Exception rethrown from confirmSend(): $e\n$s",
|
||||||
|
level: LogLevel.Error,
|
||||||
|
);
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -685,7 +691,7 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
multisigConfig = await getMultisigConfig();
|
multisigConfig = await getMultisigConfig();
|
||||||
}
|
}
|
||||||
if (serializedKeys == null || multisigConfig == null) {
|
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);
|
Logging.instance.log(err, level: LogLevel.Fatal);
|
||||||
throw Exception(err);
|
throw Exception(err);
|
||||||
// TODO [prio=low]: handle null keys or config. This should not happen.
|
// 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)) {
|
if (knownSalts.contains(salt)) {
|
||||||
throw Exception("Known frost multisig salt found!");
|
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);
|
updatedKnownSalts.add(salt);
|
||||||
await _updateKnownSalts(updatedKnownSalts);
|
await _updateKnownSalts(updatedKnownSalts);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1015,8 +1021,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
.findFirstSync()!;
|
.findFirstSync()!;
|
||||||
|
|
||||||
Future<void> _updateParticipants(List<String> participants) async {
|
Future<void> _updateParticipants(List<String> participants) async {
|
||||||
|
final info = frostInfo;
|
||||||
|
|
||||||
await mainDB.isar.writeTxn(() async {
|
await mainDB.isar.writeTxn(() async {
|
||||||
final info = frostInfo;
|
|
||||||
await mainDB.isar.frostWalletInfo.delete(info.id);
|
await mainDB.isar.frostWalletInfo.delete(info.id);
|
||||||
await mainDB.isar.frostWalletInfo.put(
|
await mainDB.isar.frostWalletInfo.put(
|
||||||
info.copyWith(participants: participants),
|
info.copyWith(participants: participants),
|
||||||
|
@ -1031,8 +1038,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
.findFirstSync()!;
|
.findFirstSync()!;
|
||||||
|
|
||||||
Future<void> _updateThreshold(int threshold) async {
|
Future<void> _updateThreshold(int threshold) async {
|
||||||
|
final info = frostInfo;
|
||||||
|
|
||||||
await mainDB.isar.writeTxn(() async {
|
await mainDB.isar.writeTxn(() async {
|
||||||
final info = frostInfo;
|
|
||||||
await mainDB.isar.frostWalletInfo.delete(info.id);
|
await mainDB.isar.frostWalletInfo.delete(info.id);
|
||||||
await mainDB.isar.frostWalletInfo.put(
|
await mainDB.isar.frostWalletInfo.put(
|
||||||
info.copyWith(threshold: threshold),
|
info.copyWith(threshold: threshold),
|
||||||
|
@ -1047,8 +1055,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
.findFirstSync()!;
|
.findFirstSync()!;
|
||||||
|
|
||||||
Future<void> _updateMyName(String myName) async {
|
Future<void> _updateMyName(String myName) async {
|
||||||
|
final info = frostInfo;
|
||||||
|
|
||||||
await mainDB.isar.writeTxn(() async {
|
await mainDB.isar.writeTxn(() async {
|
||||||
final info = frostInfo;
|
|
||||||
await mainDB.isar.frostWalletInfo.delete(info.id);
|
await mainDB.isar.frostWalletInfo.delete(info.id);
|
||||||
await mainDB.isar.frostWalletInfo.put(
|
await mainDB.isar.frostWalletInfo.put(
|
||||||
info.copyWith(myName: myName),
|
info.copyWith(myName: myName),
|
||||||
|
@ -1074,13 +1083,15 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
Future<void> _updateElectrumX() async {
|
Future<void> _updateElectrumX() async {
|
||||||
final failovers = nodeService
|
final failovers = nodeService
|
||||||
.failoverNodesFor(coin: cryptoCurrency.coin)
|
.failoverNodesFor(coin: cryptoCurrency.coin)
|
||||||
.map((e) => ElectrumXNode(
|
.map(
|
||||||
address: e.host,
|
(e) => ElectrumXNode(
|
||||||
port: e.port,
|
address: e.host,
|
||||||
name: e.name,
|
port: e.port,
|
||||||
id: e.id,
|
name: e.name,
|
||||||
useSSL: e.useSSL,
|
id: e.id,
|
||||||
))
|
useSSL: e.useSSL,
|
||||||
|
),
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final newNode = await _getCurrentElectrumXNode();
|
final newNode = await _getCurrentElectrumXNode();
|
||||||
|
@ -1109,7 +1120,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _duplicateTxCheck(
|
bool _duplicateTxCheck(
|
||||||
List<Map<String, dynamic>> allTransactions, String txid) {
|
List<Map<String, dynamic>> allTransactions,
|
||||||
|
String txid,
|
||||||
|
) {
|
||||||
for (int i = 0; i < allTransactions.length; i++) {
|
for (int i = 0; i < allTransactions.length; i++) {
|
||||||
if (allTransactions[i]["txid"] == txid) {
|
if (allTransactions[i]["txid"] == txid) {
|
||||||
return true;
|
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