WIP extract some kind of CryptonoteWallet interface
What changed, and why it matters
This commit is a work-in-progress code cleanup that introduces a shared 'CryptonoteWallet' interface for Monero-like wallets (Monero, Wownero, Salvium). It replaces repeated checks for individual wallet classes with checks against the new shared interface. There is no direct security fix here; it is a refactoring change that could slightly reduce future bugs by making the code more consistent, but it also changes behavior in a few places by broadening which wallets match certain conditions.
Treat this as a routine refactoring commit. Reviewers should verify that the new CryptonoteWallet interface correctly abstracts all required behavior for Monero, Wownero, and Salvium, and that broadened type checks (e.g., in node URL handling, fee estimation, and view-only wallet creation) do not unintentionally include or exclude other coins. No immediate security patch or user action is required.
Security signals we found
Refactoring of wallet class hierarchy with new CryptonoteWallet interface
Broadening of type checks from specific wallet classes to shared CryptonoteWallet/CryptonoteCurrency interfaces
Removal of direct csMonero/csWownero static priority helpers in favor of wallet instance methods
Consolidation of view-only wallet creation and key export paths across Monero-like coins
Evidence from the diff
The commit extracts a CryptonoteWallet intermediate interface and updates 26 call sites to use it instead of checking for LibMoneroWallet and/or LibSalviumWallet individually. Notable changes include: wallet initialization now calls init(wordCount:) for any CryptonoteWallet rather than only LibMoneroWallet/LibSalviumWallet; view-only wallet creation uses the shared hackToCreateNewViewOnlyWalletData… method; fee estimation uses wallet-provided priority methods instead of static csMonero/csWownero helpers; node URL stripping and the ‘trusted node’ checkbox now apply to all CryptonoteCurrency coins; restore height handling groups these wallets together; and key export uses the shared getKeys() method. The diff is mostly formatting and import changes. No explicit security relevance, CVE, or researcher attribution is present in the commit.
Changed components
lib/wallets/wallet/intermediate/cryptonote_wallet.dartlib/wallets/wallet/intermediate/lib_monero_wallet.dartlib/wallets/wallet/intermediate/lib_salvium_wallet.dartlib/wallets/wallet/intermediate/lib_wownero_wallet.dartlib/pages/send_view/send_view.dartlib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dartlib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dartlib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dartlib/pages/settings_views/wallet_settings_view/wallet_settings_view.dartlib/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dartlib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dartlib/services/wallets.dartlib/services/churning_service.dartInspect captured patch +1626 / −1536
diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart
index 7e3f57d..031a8b4 100644
--- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart
+++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart
@@ -30,8 +30,7 @@ import '../../../utilities/text_styles.dart';
import '../../../utilities/util.dart';
import '../../../wallets/crypto_currency/crypto_currency.dart';
import '../../../wallets/isar/models/wallet_info.dart';
-import '../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
+import '../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../wallets/wallet/wallet.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
@@ -81,12 +80,11 @@ class _NewWalletRecoveryPhraseWarningViewState
if (mounted) {
await showDialog<void>(
context: context,
- builder:
- (_) => StackOkDialog(
- title: "Create Wallet Error",
- message: ex?.toString() ?? "Unknown error",
- maxWidth: 600,
- ),
+ builder: (_) => StackOkDialog(
+ title: "Create Wallet Error",
+ message: ex?.toString() ?? "Unknown error",
+ maxWidth: 600,
+ ),
);
}
return;
@@ -195,8 +193,10 @@ class _NewWalletRecoveryPhraseWarningViewState
} else if (wordCount > 0) {
if (ref.read(pNewWalletOptions.state).state != null) {
if (coin.hasMnemonicPassphraseSupport) {
- mnemonicPassphrase =
- ref.read(pNewWalletOptions.state).state!.mnemonicPassphrase;
+ mnemonicPassphrase = ref
+ .read(pNewWalletOptions.state)
+ .state!
+ .mnemonicPassphrase;
} else {
// this may not be epiccash and sol specific?
if (coin is Epiccash || coin is Solana) {
@@ -204,8 +204,10 @@ class _NewWalletRecoveryPhraseWarningViewState
}
}
- wordCount =
- ref.read(pNewWalletOptions.state).state!.mnemonicWordsCount;
+ wordCount = ref
+ .read(pNewWalletOptions.state)
+ .state!
+ .mnemonicWordsCount;
} else {
mnemonicPassphrase = "";
}
@@ -230,9 +232,7 @@ class _NewWalletRecoveryPhraseWarningViewState
privateKey: privateKey,
);
- if (wallet is LibMoneroWallet) {
- await wallet.init(wordCount: wordCount);
- } else if (wallet is LibSalviumWallet) {
+ if (wallet is CryptonoteWallet) {
await wallet.init(wordCount: wordCount);
} else {
await wallet.init();
@@ -241,8 +241,8 @@ class _NewWalletRecoveryPhraseWarningViewState
// set checkbox back to unchecked to annoy users to agree again :P
ref.read(checkBoxStateProvider.state).state = false;
- final fetchedMnemonic =
- await (wallet as MnemonicInterface).getMnemonicAsWords();
+ final fetchedMnemonic = await (wallet as MnemonicInterface)
+ .getMnemonicAsWords();
return (wallet, fetchedMnemonic);
} catch (e, s) {
@@ -269,46 +269,43 @@ class _NewWalletRecoveryPhraseWarningViewState
return MasterScaffold(
isDesktop: isDesktop,
- appBar:
- isDesktop
- ? const DesktopAppBar(
- isCompactHeight: false,
- leading: AppBarBackButton(),
- trailing: ExitToMyStackButton(),
- )
- : AppBar(
- leading: const AppBarBackButton(),
- actions: [
- Padding(
- padding: const EdgeInsets.only(
- top: 10,
- bottom: 10,
- right: 10,
- ),
- child: AppBarIconButton(
- semanticsLabel:
- "Question Button. Opens A Dialog For Recovery Phrase Explanation.",
- icon: SvgPicture.asset(
- Assets.svg.circleQuestion,
- width: 20,
- height: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorDark,
- ),
- onPressed: () async {
- await showDialog<void>(
- context: context,
- builder:
- (context) =>
- const RecoveryPhraseExplanationDialog(),
- );
- },
+ appBar: isDesktop
+ ? const DesktopAppBar(
+ isCompactHeight: false,
+ leading: AppBarBackButton(),
+ trailing: ExitToMyStackButton(),
+ )
+ : AppBar(
+ leading: const AppBarBackButton(),
+ actions: [
+ Padding(
+ padding: const EdgeInsets.only(
+ top: 10,
+ bottom: 10,
+ right: 10,
+ ),
+ child: AppBarIconButton(
+ semanticsLabel:
+ "Question Button. Opens A Dialog For Recovery Phrase Explanation.",
+ icon: SvgPicture.asset(
+ Assets.svg.circleQuestion,
+ width: 20,
+ height: 20,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
),
+ onPressed: () async {
+ await showDialog<void>(
+ context: context,
+ builder: (context) =>
+ const RecoveryPhraseExplanationDialog(),
+ );
+ },
),
- ],
- ),
+ ),
+ ],
+ ),
body: SingleChildScrollView(
child: ConstrainedBox(
constraints: BoxConstraints(
@@ -319,10 +316,9 @@ class _NewWalletRecoveryPhraseWarningViewState
padding: const EdgeInsets.all(16),
child: Center(
child: Column(
- crossAxisAlignment:
- isDesktop
- ? CrossAxisAlignment.center
- : CrossAxisAlignment.stretch,
+ crossAxisAlignment: isDesktop
+ ? CrossAxisAlignment.center
+ : CrossAxisAlignment.stretch,
children: [
/*if (isDesktop)
const Spacer(
@@ -341,233 +337,206 @@ class _NewWalletRecoveryPhraseWarningViewState
Text(
"Recovery Phrase",
textAlign: TextAlign.center,
- style:
- isDesktop
- ? STextStyles.desktopH2(context)
- : STextStyles.pageTitleH1(context),
+ style: isDesktop
+ ? STextStyles.desktopH2(context)
+ : STextStyles.pageTitleH1(context),
),
SizedBox(height: isDesktop ? 32 : 16),
RoundedWhiteContainer(
padding: const EdgeInsets.all(32),
width: isDesktop ? 480 : null,
- child:
- isDesktop
- ? Text(
- "On the next screen you will see "
- "$seedCount "
- "words that make up your recovery phrase.\n\nPlease "
- "write it down. Keep it safe and never share it with "
- "anyone. Your recovery phrase is the only way you can"
- " access your funds if you forget your PIN, lose your"
- " phone, etc.\n\n${AppConfig.appName} does not keep nor is "
- "able to restore your recover phrase. Only you have "
- "access to your wallet.",
- style:
- isDesktop
- ? STextStyles.desktopTextMediumRegular(
- context,
- )
- : STextStyles.subtitle(
- context,
- ).copyWith(fontSize: 12),
- )
- : Column(
- children: [
- Text(
- "Important",
+ child: isDesktop
+ ? Text(
+ "On the next screen you will see "
+ "$seedCount "
+ "words that make up your recovery phrase.\n\nPlease "
+ "write it down. Keep it safe and never share it with "
+ "anyone. Your recovery phrase is the only way you can"
+ " access your funds if you forget your PIN, lose your"
+ " phone, etc.\n\n${AppConfig.appName} does not keep nor is "
+ "able to restore your recover phrase. Only you have "
+ "access to your wallet.",
+ style: isDesktop
+ ? STextStyles.desktopTextMediumRegular(
+ context,
+ )
+ : STextStyles.subtitle(
+ context,
+ ).copyWith(fontSize: 12),
+ )
+ : Column(
+ children: [
+ Text(
+ "Important",
+ style: STextStyles.desktopH3(context)
+ .copyWith(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .accentColorBlue,
+ ),
+ ),
+ const SizedBox(height: 24),
+ RichText(
+ textAlign: TextAlign.center,
+ text: TextSpan(
style: STextStyles.desktopH3(
context,
- ).copyWith(
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .accentColorBlue,
- ),
+ ).copyWith(fontSize: 18),
+ children: [
+ TextSpan(
+ text:
+ "On the next screen you will be given ",
+ style: STextStyles.desktopH3(context)
+ .copyWith(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .textDark,
+ fontSize: 18,
+ height: 1.3,
+ ),
+ ),
+ TextSpan(
+ text: "$seedCount words",
+ style: STextStyles.desktopH3(context)
+ .copyWith(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .accentColorBlue,
+ fontSize: 18,
+ height: 1.3,
+ ),
+ ),
+ TextSpan(
+ text: ". They are your ",
+ style: STextStyles.desktopH3(context)
+ .copyWith(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .textDark,
+ fontSize: 18,
+ height: 1.3,
+ ),
+ ),
+ TextSpan(
+ text: "recovery phrase",
+ style: STextStyles.desktopH3(context)
+ .copyWith(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .accentColorBlue,
+ fontSize: 18,
+ height: 1.3,
+ ),
+ ),
+ TextSpan(
+ text: ".",
+ style: STextStyles.desktopH3(context)
+ .copyWith(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .textDark,
+ fontSize: 18,
+ height: 1.3,
+ ),
+ ),
+ ],
),
- const SizedBox(height: 24),
- RichText(
- textAlign: TextAlign.center,
- text: TextSpan(
- style: STextStyles.desktopH3(
- context,
- ).copyWith(fontSize: 18),
+ ),
+ const SizedBox(height: 40),
+ Column(
+ children: [
+ Row(
children: [
- TextSpan(
- text:
- "On the next screen you will be given ",
- style: STextStyles.desktopH3(
- context,
- ).copyWith(
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .textDark,
- fontSize: 18,
- height: 1.3,
- ),
- ),
- TextSpan(
- text: "$seedCount words",
- style: STextStyles.desktopH3(
- context,
- ).copyWith(
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .accentColorBlue,
- fontSize: 18,
- height: 1.3,
+ SizedBox(
+ width: 32,
+ height: 32,
+ child: RoundedContainer(
+ radiusMultiplier: 20,
+ padding: const EdgeInsets.all(9),
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .buttonBackSecondary,
+ child: SvgPicture.asset(
+ Assets.svg.pencil,
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .accentColorDark,
+ ),
),
),
- TextSpan(
- text: ". They are your ",
- style: STextStyles.desktopH3(
+ const SizedBox(width: 20),
+ Text(
+ "Write them down.",
+ style: STextStyles.navBarTitle(
context,
- ).copyWith(
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .textDark,
- fontSize: 18,
- height: 1.3,
),
),
- TextSpan(
- text: "recovery phrase",
- style: STextStyles.desktopH3(
- context,
- ).copyWith(
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .accentColorBlue,
- fontSize: 18,
- height: 1.3,
+ ],
+ ),
+ const SizedBox(height: 30),
+ Row(
+ children: [
+ SizedBox(
+ width: 32,
+ height: 32,
+ child: RoundedContainer(
+ radiusMultiplier: 20,
+ padding: const EdgeInsets.all(8),
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .buttonBackSecondary,
+ child: SvgPicture.asset(
+ Assets.svg.lock,
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .accentColorDark,
+ ),
),
),
- TextSpan(
- text: ".",
- style: STextStyles.desktopH3(
+ const SizedBox(width: 20),
+ Text(
+ "Keep them safe.",
+ style: STextStyles.navBarTitle(
context,
- ).copyWith(
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .textDark,
- fontSize: 18,
- height: 1.3,
),
),
],
),
- ),
- const SizedBox(height: 40),
- Column(
- children: [
- Row(
- children: [
- SizedBox(
- width: 32,
- height: 32,
- child: RoundedContainer(
- radiusMultiplier: 20,
- padding: const EdgeInsets.all(9),
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .buttonBackSecondary,
- child: SvgPicture.asset(
- Assets.svg.pencil,
- color:
- Theme.of(context)
- .extension<
- StackColors
- >()!
- .accentColorDark,
- ),
- ),
- ),
- const SizedBox(width: 20),
- Text(
- "Write them down.",
- style: STextStyles.navBarTitle(
- context,
- ),
- ),
- ],
- ),
- const SizedBox(height: 30),
- Row(
- children: [
- SizedBox(
- width: 32,
- height: 32,
- child: RoundedContainer(
- radiusMultiplier: 20,
- padding: const EdgeInsets.all(8),
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .buttonBackSecondary,
- child: SvgPicture.asset(
- Assets.svg.lock,
- color:
- Theme.of(context)
- .extension<
- StackColors
- >()!
- .accentColorDark,
- ),
+ const SizedBox(height: 30),
+ Row(
+ children: [
+ SizedBox(
+ width: 32,
+ height: 32,
+ child: RoundedContainer(
+ radiusMultiplier: 20,
+ padding: const EdgeInsets.all(8),
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .buttonBackSecondary,
+ child: SvgPicture.asset(
+ Assets.svg.eyeSlash,
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .accentColorDark,
),
),
- const SizedBox(width: 20),
- Text(
- "Keep them safe.",
+ ),
+ const SizedBox(width: 20),
+ Expanded(
+ child: Text(
+ "Do not show them to anyone.",
style: STextStyles.navBarTitle(
context,
),
),
- ],
- ),
- const SizedBox(height: 30),
- Row(
- children: [
- SizedBox(
- width: 32,
- height: 32,
- child: RoundedContainer(
- radiusMultiplier: 20,
- padding: const EdgeInsets.all(8),
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .buttonBackSecondary,
- child: SvgPicture.asset(
- Assets.svg.eyeSlash,
- color:
- Theme.of(context)
- .extension<
- StackColors
- >()!
- .accentColorDark,
- ),
- ),
- ),
- const SizedBox(width: 20),
- Expanded(
- child: Text(
- "Do not show them to anyone.",
- style: STextStyles.navBarTitle(
- context,
- ),
- ),
- ),
- ],
- ),
- ],
- ),
- ],
- ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ],
+ ),
),
if (!isDesktop) const Spacer(),
if (!isDesktop) const SizedBox(height: 16),
@@ -584,10 +553,9 @@ class _NewWalletRecoveryPhraseWarningViewState
children: [
GestureDetector(
onTap: () {
- final value =
- ref
- .read(checkBoxStateProvider.state)
- .state;
+ final value = ref
+ .read(checkBoxStateProvider.state)
+ .state;
ref.read(checkBoxStateProvider.state).state =
!value;
},
@@ -603,18 +571,19 @@ class _NewWalletRecoveryPhraseWarningViewState
child: Checkbox(
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
- value:
- ref
- .watch(
- checkBoxStateProvider.state,
- )
- .state,
+ value: ref
+ .watch(
+ checkBoxStateProvider.state,
+ )
+ .state,
onChanged: (newValue) {
ref
- .read(
- checkBoxStateProvider.state,
- )
- .state = newValue!;
+ .read(
+ checkBoxStateProvider
+ .state,
+ )
+ .state =
+ newValue!;
},
),
),
@@ -622,14 +591,13 @@ class _NewWalletRecoveryPhraseWarningViewState
Flexible(
child: Text(
"I understand that ${AppConfig.appName} does not keep and cannot restore my recovery phrase, and If I lose my recovery phrase, I will not be able to access my funds.",
- style:
- isDesktop
- ? STextStyles.desktopTextMedium(
- context,
- )
- : STextStyles.baseXS(
- context,
- ).copyWith(height: 1.3),
+ style: isDesktop
+ ? STextStyles.desktopTextMedium(
+ context,
+ )
+ : STextStyles.baseXS(
+ context,
+ ).copyWith(height: 1.3),
),
),
],
@@ -644,41 +612,39 @@ class _NewWalletRecoveryPhraseWarningViewState
child: TextButton(
onPressed:
ref
- .read(checkBoxStateProvider.state)
- .state
- ? _initNewWallet
- : null,
+ .read(checkBoxStateProvider.state)
+ .state
+ ? _initNewWallet
+ : null,
style:
ref
- .read(checkBoxStateProvider.state)
- .state
- ? Theme.of(context)
- .extension<StackColors>()!
- .getPrimaryEnabledButtonStyle(
- context,
- )
- : Theme.of(context)
- .extension<StackColors>()!
- .getPrimaryDisabledButtonStyle(
- context,
- ),
+ .read(checkBoxStateProvider.state)
+ .state
+ ? Theme.of(context)
+ .extension<StackColors>()!
+ .getPrimaryEnabledButtonStyle(
+ context,
+ )
+ : Theme.of(context)
+ .extension<StackColors>()!
+ .getPrimaryDisabledButtonStyle(
+ context,
+ ),
child: Text(
"View recovery phrase",
- style:
- isDesktop
- ? ref
- .read(
- checkBoxStateProvider
- .state,
- )
- .state
- ? STextStyles.desktopButtonEnabled(
+ style: isDesktop
+ ? ref
+ .read(
+ checkBoxStateProvider.state,
+ )
+ .state
+ ? STextStyles.desktopButtonEnabled(
context,
)
- : STextStyles.desktopButtonDisabled(
+ : STextStyles.desktopButtonDisabled(
context,
)
- : STextStyles.button(context),
+ : STextStyles.button(context),
),
),
),
diff --git a/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart b/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart
index b5063ae..e19eca1 100644
--- a/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart
+++ b/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart
@@ -37,8 +37,7 @@ import '../../../wallets/wallet/impl/epiccash_wallet.dart';
import '../../../wallets/wallet/impl/monero_wallet.dart';
import '../../../wallets/wallet/impl/wownero_wallet.dart';
import '../../../wallets/wallet/impl/xelis_wallet.dart';
-import '../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
+import '../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../wallets/wallet/wallet.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/view_only_option_interface.dart';
@@ -112,8 +111,7 @@ class _VerifyRecoveryPhraseViewState
final ViewOnlyWalletType viewOnlyWalletType;
if (widget.wallet is ExtendedKeysInterface) {
viewOnlyWalletType = ViewOnlyWalletType.xPub;
- } else if (widget.wallet is LibMoneroWallet ||
- widget.wallet is LibSalviumWallet) {
+ } else if (widget.wallet is CryptonoteWallet) {
if (widget.wallet.cryptoCurrency is Monero) {
height = csMonero.getHeightByDate(
DateTime.now().subtract(const Duration(days: 7)),
@@ -174,23 +172,8 @@ class _VerifyRecoveryPhraseViewState
walletId: voInfo.walletId,
xPubs: [xPub],
);
- } else if (widget.wallet is LibMoneroWallet) {
- final w = widget.wallet as LibMoneroWallet;
-
- final info = await w
- .hackToCreateNewViewOnlyWalletDataFromNewlyCreatedWalletThisFunctionShouldNotBeCalledUnlessYouKnowWhatYouAreDoing();
- final address = info.$1;
- final privateViewKey = info.$2;
-
- await w.exit();
-
- viewOnlyData = CryptonoteViewOnlyWalletData(
- walletId: voInfo.walletId,
- address: address,
- privateViewKey: privateViewKey,
- );
- } else if (widget.wallet is LibSalviumWallet) {
- final w = widget.wallet as LibSalviumWallet;
+ } else if (widget.wallet is CryptonoteWallet) {
+ final w = widget.wallet as CryptonoteWallet;
final info = await w
.hackToCreateNewViewOnlyWalletDataFromNewlyCreatedWalletThisFunctionShouldNotBeCalledUnlessYouKnowWhatYouAreDoing();
diff --git a/lib/pages/send_view/send_view.dart b/lib/pages/send_view/send_view.dart
index e56f12c..54cdf51 100644
--- a/lib/pages/send_view/send_view.dart
+++ b/lib/pages/send_view/send_view.dart
@@ -49,11 +49,13 @@ import '../../utilities/show_loading.dart';
import '../../utilities/text_styles.dart';
import '../../utilities/util.dart';
import '../../wallets/crypto_currency/crypto_currency.dart';
+import '../../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
import '../../wallets/crypto_currency/intermediate/nano_currency.dart';
import '../../wallets/isar/providers/wallet_info_provider.dart';
import '../../wallets/models/tx_data.dart';
import '../../wallets/wallet/impl/firo_wallet.dart';
import '../../wallets/wallet/impl/mimblewimblecoin_wallet.dart';
+import '../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/mweb_interface.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart';
@@ -74,8 +76,6 @@ import '../../widgets/rounded_white_container.dart';
import '../../widgets/stack_dialog.dart';
import '../../widgets/stack_text_field.dart';
import '../../widgets/textfield_icon_button.dart';
-import '../../wl_gen/interfaces/cs_monero_interface.dart';
-import '../../wl_gen/interfaces/cs_wownero_interface.dart';
import '../address_book_views/address_book_view.dart';
import '../coin_control/coin_control_view.dart';
import 'confirm_transaction_view.dart';
@@ -560,39 +560,17 @@ class _SendViewState extends ConsumerState<SendView> {
}
Amount fee;
- if (coin is Monero) {
+ if (coin is CryptonoteCurrency) {
final int specialMoneroId;
switch (ref.read(feeRateTypeMobileStateProvider.state).state) {
case FeeRateType.fast:
- specialMoneroId = csMonero.getTxPriorityHigh();
+ specialMoneroId = (wallet as CryptonoteWallet).getTxPriorityHigh();
break;
case FeeRateType.average:
- specialMoneroId = csMonero.getTxPriorityMedium();
+ specialMoneroId = (wallet as CryptonoteWallet).getTxPriorityMedium();
break;
case FeeRateType.slow:
- specialMoneroId = csMonero.getTxPriorityNormal();
- break;
- default:
- throw ArgumentError("custom fee not available for monero");
- }
-
- fee = await wallet.estimateFeeFor(amount, BigInt.from(specialMoneroId));
- cachedFees[amount] = ref
- .read(pAmountFormatter(coin))
- .format(fee, withUnitName: true, indicatePrecisionLoss: false);
-
- return cachedFees[amount]!;
- } else if (coin is Wownero) {
- final int specialMoneroId;
- switch (ref.read(feeRateTypeMobileStateProvider.state).state) {
- case FeeRateType.fast:
- specialMoneroId = csWownero.getTxPriorityHigh();
- break;
- case FeeRateType.average:
- specialMoneroId = csWownero.getTxPriorityMedium();
- break;
- case FeeRateType.slow:
- specialMoneroId = csWownero.getTxPriorityNormal();
+ specialMoneroId = (wallet as CryptonoteWallet).getTxPriorityNormal();
break;
default:
throw ArgumentError("custom fee not available for monero");
diff --git a/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart b/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart
index c7112a5..8c165cc 100644
--- a/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart
+++ b/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart
@@ -23,13 +23,13 @@ import '../../../utilities/enums/fee_rate_type_enum.dart';
import '../../../utilities/logger.dart';
import '../../../utilities/text_styles.dart';
import '../../../wallets/crypto_currency/crypto_currency.dart';
+import '../../../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
import '../../../wallets/isar/providers/eth/current_token_wallet_provider.dart';
import '../../../wallets/isar/providers/wallet_info_provider.dart';
import '../../../wallets/wallet/impl/firo_wallet.dart';
+import '../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart';
import '../../../widgets/animated_text.dart';
-import '../../../wl_gen/interfaces/cs_monero_interface.dart';
-import '../../../wl_gen/interfaces/cs_wownero_interface.dart';
final feeSheetSessionCacheProvider =
ChangeNotifierProvider<FeeSheetSessionCache>((ref) {
@@ -89,16 +89,10 @@ class _TransactionFeeSelectionSheetState
if (widget.isToken == false) {
final wallet = ref.read(pWallets).getWallet(walletId);
- if (coin is Monero) {
+ if (coin is CryptonoteCurrency) {
final fee = await wallet.estimateFeeFor(
amount,
- BigInt.from(csMonero.getTxPriorityHigh()),
- );
- ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
- } else if (coin is Wownero) {
- final fee = await wallet.estimateFeeFor(
- amount,
- BigInt.from(csWownero.getTxPriorityHigh()),
+ BigInt.from((wallet as CryptonoteWallet).getTxPriorityHigh()),
);
ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
} else if (coin is Firo) {
@@ -132,16 +126,10 @@ class _TransactionFeeSelectionSheetState
if (ref.read(feeSheetSessionCacheProvider).average[amount] == null) {
if (widget.isToken == false) {
final wallet = ref.read(pWallets).getWallet(walletId);
- if (coin is Monero) {
- final fee = await wallet.estimateFeeFor(
- amount,
- BigInt.from(csMonero.getTxPriorityMedium()),
- );
- ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
- } else if (coin is Wownero) {
+ if (coin is CryptonoteCurrency) {
final fee = await wallet.estimateFeeFor(
amount,
- BigInt.from(csWownero.getTxPriorityMedium()),
+ BigInt.from((wallet as CryptonoteWallet).getTxPriorityMedium()),
);
ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
} else if (coin is Firo) {
@@ -174,16 +162,10 @@ class _TransactionFeeSelectionSheetState
if (ref.read(feeSheetSessionCacheProvider).slow[amount] == null) {
if (widget.isToken == false) {
final wallet = ref.read(pWallets).getWallet(walletId);
- if (coin is Monero) {
- final fee = await wallet.estimateFeeFor(
- amount,
- BigInt.from(csMonero.getTxPriorityNormal()),
- );
- ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
- } else if (coin is Wownero) {
+ if (coin is CryptonoteCurrency) {
final fee = await wallet.estimateFeeFor(
amount,
- BigInt.from(csWownero.getTxPriorityNormal()),
+ BigInt.from((wallet as CryptonoteWallet).getTxPriorityNormal()),
);
ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
} else if (coin is Firo) {
diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart
index e0ebd4c..738ccb8 100644
--- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart
+++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart
@@ -35,8 +35,6 @@ import '../../../../utilities/tor_plain_net_option_enum.dart';
import '../../../../utilities/util.dart';
import '../../../../wallets/crypto_currency/crypto_currency.dart';
import '../../../../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
-import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../../widgets/background.dart';
import '../../../../widgets/conditional_parent.dart';
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
@@ -114,107 +112,102 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
context: context,
useSafeArea: true,
barrierDismissible: true,
- builder:
- (_) =>
- isDesktop
- ? DesktopDialog(
- maxWidth: 440,
- maxHeight: 300,
- child: Column(
+ builder: (_) => isDesktop
+ ? DesktopDialog(
+ maxWidth: 440,
+ maxHeight: 300,
+ child: Column(
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(top: 32),
+ child: Row(
children: [
- Padding(
- padding: const EdgeInsets.only(top: 32),
- child: Row(
- children: [
- const SizedBox(width: 32),
- Text(
- "Server currently unreachable",
- style: STextStyles.desktopH3(context),
- ),
- ],
- ),
+ const SizedBox(width: 32),
+ Text(
+ "Server currently unreachable",
+ style: STextStyles.desktopH3(context),
),
- Expanded(
- child: Padding(
- padding: const EdgeInsets.only(
- left: 32,
- right: 32,
- top: 16,
- bottom: 32,
- ),
- child: Column(
- children: [
- const Spacer(),
- Text(
- "Would you like to save this node anyways?",
- style: STextStyles.desktopTextMedium(
+ ],
+ ),
+ ),
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.only(
+ left: 32,
+ right: 32,
+ top: 16,
+ bottom: 32,
+ ),
+ child: Column(
+ children: [
+ const Spacer(),
+ Text(
+ "Would you like to save this node anyways?",
+ style: STextStyles.desktopTextMedium(context),
+ ),
+ const Spacer(flex: 2),
+ Row(
+ children: [
+ Expanded(
+ child: SecondaryButton(
+ label: "Cancel",
+ buttonHeight: isDesktop
+ ? ButtonHeight.l
+ : null,
+ onPressed: () => Navigator.of(
context,
- ),
+ rootNavigator: true,
+ ).pop(false),
),
- const Spacer(flex: 2),
- Row(
- children: [
- Expanded(
- child: SecondaryButton(
- label: "Cancel",
- buttonHeight:
- isDesktop ? ButtonHeight.l : null,
- onPressed:
- () => Navigator.of(
- context,
- rootNavigator: true,
- ).pop(false),
- ),
- ),
- const SizedBox(width: 16),
- Expanded(
- child: PrimaryButton(
- label: "Save",
- buttonHeight:
- isDesktop ? ButtonHeight.l : null,
- onPressed:
- () => Navigator.of(
- context,
- rootNavigator: true,
- ).pop(true),
- ),
- ),
- ],
+ ),
+ const SizedBox(width: 16),
+ Expanded(
+ child: PrimaryButton(
+ label: "Save",
+ buttonHeight: isDesktop
+ ? ButtonHeight.l
+ : null,
+ onPressed: () => Navigator.of(
+ context,
+ rootNavigator: true,
+ ).pop(true),
),
- ],
- ),
+ ),
+ ],
),
- ),
- ],
- ),
- )
- : StackDialog(
- title: "Server currently unreachable",
- message: "Would you like to save this node anyways?",
- leftButton: TextButton(
- onPressed: () async {
- Navigator.of(context).pop(false);
- },
- child: Text(
- "Cancel",
- style: STextStyles.button(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorDark,
- ),
+ ],
),
),
- rightButton: TextButton(
- onPressed: () async {
- Navigator.of(context).pop(true);
- },
- style: Theme.of(context)
- .extension<StackColors>()!
- .getPrimaryEnabledButtonStyle(context),
- child: Text("Save", style: STextStyles.button(context)),
- ),
),
+ ],
+ ),
+ )
+ : StackDialog(
+ title: "Server currently unreachable",
+ message: "Would you like to save this node anyways?",
+ leftButton: TextButton(
+ onPressed: () async {
+ Navigator.of(context).pop(false);
+ },
+ child: Text(
+ "Cancel",
+ style: STextStyles.button(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
+ ),
+ ),
+ ),
+ rightButton: TextButton(
+ onPressed: () async {
+ Navigator.of(context).pop(true);
+ },
+ style: Theme.of(context)
+ .extension<StackColors>()!
+ .getPrimaryEnabledButtonStyle(context),
+ child: Text("Save", style: STextStyles.button(context)),
+ ),
+ ),
).then((value) {
if (value is bool && value) {
shouldSave = true;
@@ -233,7 +226,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
// strip unused path
String address = formData.host!;
- if (coin is LibMoneroWallet || coin is LibSalviumWallet) {
+ if (coin is CryptonoteCurrency) {
if (address.startsWith("http")) {
final uri = Uri.parse(address);
address = "${uri.scheme}://${uri.host}";
@@ -450,8 +443,9 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
saveEnabled = false;
testConnectionEnabled = false;
} else {
- final node =
- ref.read(nodeServiceChangeNotifierProvider).getNodeById(id: nodeId!)!;
+ final node = ref
+ .read(nodeServiceChangeNotifierProvider)
+ .getNodeById(id: nodeId!)!;
testConnectionEnabled = node.host.isNotEmpty;
saveEnabled = testConnectionEnabled && node.name.isNotEmpty;
}
@@ -468,205 +462,193 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
Widget build(BuildContext context) {
final NodeModel? node =
viewType == AddEditNodeViewType.edit && nodeId != null
- ? ref.watch(
- nodeServiceChangeNotifierProvider.select(
- (value) => value.getNodeById(id: nodeId!),
- ),
- )
- : null;
+ ? ref.watch(
+ nodeServiceChangeNotifierProvider.select(
+ (value) => value.getNodeById(id: nodeId!),
+ ),
+ )
+ : null;
return ConditionalParent(
condition: !isDesktop,
- builder:
- (child) => Background(
- child: Scaffold(
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.background,
- appBar: AppBar(
- leading: AppBarBackButton(
- onPressed: () async {
- if (FocusScope.of(context).hasFocus) {
- FocusScope.of(context).unfocus();
- await Future<void>.delayed(
- const Duration(milliseconds: 75),
- );
- }
- if (context.mounted) {
- Navigator.of(context).pop();
- }
- },
- ),
- title: Text(
- viewType == AddEditNodeViewType.edit
- ? "Edit node"
- : "Add node",
- style: STextStyles.navBarTitle(context),
- ),
- actions: [
- if (viewType == AddEditNodeViewType.add &&
- coin
- is CryptonoteCurrency) // TODO: [prio=low] do something other than `coin is CryptonoteCurrency` in the future
- Padding(
- padding: const EdgeInsets.only(
- top: 10,
- bottom: 10,
- right: 10,
- ),
- child: AspectRatio(
- aspectRatio: 1,
- child: AppBarIconButton(
- key: const Key("qrNodeAppBarButtonKey"),
- size: 36,
- shadows: const [],
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
- icon: QrCodeIcon(
- width: 20,
- height: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorDark,
- ),
- onPressed: _scanQr,
- ),
+ builder: (child) => Background(
+ child: Scaffold(
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
+ appBar: AppBar(
+ leading: AppBarBackButton(
+ onPressed: () async {
+ if (FocusScope.of(context).hasFocus) {
+ FocusScope.of(context).unfocus();
+ await Future<void>.delayed(const Duration(milliseconds: 75));
+ }
+ if (context.mounted) {
+ Navigator.of(context).pop();
+ }
+ },
+ ),
+ title: Text(
+ viewType == AddEditNodeViewType.edit ? "Edit node" : "Add node",
+ style: STextStyles.navBarTitle(context),
+ ),
+ actions: [
+ if (viewType == AddEditNodeViewType.add &&
+ coin
+ is CryptonoteCurrency) // TODO: [prio=low] do something other than `coin is CryptonoteCurrency` in the future
+ Padding(
+ padding: const EdgeInsets.only(
+ top: 10,
+ bottom: 10,
+ right: 10,
+ ),
+ child: AspectRatio(
+ aspectRatio: 1,
+ child: AppBarIconButton(
+ key: const Key("qrNodeAppBarButtonKey"),
+ size: 36,
+ shadows: const [],
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
+ icon: QrCodeIcon(
+ width: 20,
+ height: 20,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
),
+ onPressed: _scanQr,
),
- if (viewType == AddEditNodeViewType.edit &&
- ref
- .watch(
- nodeServiceChangeNotifierProvider.select(
- (value) => value.getNodesFor(coin),
- ),
- )
- .length >
- 1)
- Padding(
- padding: const EdgeInsets.only(
- top: 10,
- bottom: 10,
- right: 10,
+ ),
+ ),
+ if (viewType == AddEditNodeViewType.edit &&
+ ref
+ .watch(
+ nodeServiceChangeNotifierProvider.select(
+ (value) => value.getNodesFor(coin),
+ ),
+ )
+ .length >
+ 1)
+ Padding(
+ padding: const EdgeInsets.only(
+ top: 10,
+ bottom: 10,
+ right: 10,
+ ),
+ child: AspectRatio(
+ aspectRatio: 1,
+ child: AppBarIconButton(
+ key: const Key("deleteNodeAppBarButtonKey"),
+ size: 36,
+ shadows: const [],
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
+ icon: SvgPicture.asset(
+ Assets.svg.trash,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
+ width: 20,
+ height: 20,
),
- child: AspectRatio(
- aspectRatio: 1,
- child: AppBarIconButton(
- key: const Key("deleteNodeAppBarButtonKey"),
- size: 36,
- shadows: const [],
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
- icon: SvgPicture.asset(
- Assets.svg.trash,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorDark,
- width: 20,
- height: 20,
- ),
- onPressed: () async {
- Navigator.popUntil(
- context,
- ModalRoute.withName(
- widget.routeOnSuccessOrDelete,
- ),
- );
+ onPressed: () async {
+ Navigator.popUntil(
+ context,
+ ModalRoute.withName(widget.routeOnSuccessOrDelete),
+ );
- await ref
- .read(nodeServiceChangeNotifierProvider)
- .delete(nodeId!, true);
- },
- ),
- ),
+ await ref
+ .read(nodeServiceChangeNotifierProvider)
+ .delete(nodeId!, true);
+ },
),
- ],
- ),
- body: SafeArea(
- child: Padding(
- padding: const EdgeInsets.only(
- top: 12,
- left: 12,
- right: 12,
- bottom: 12,
- ),
- child: LayoutBuilder(
- builder: (context, constraints) {
- return SingleChildScrollView(
- child: Padding(
- padding: const EdgeInsets.all(4),
- child: ConstrainedBox(
- constraints: BoxConstraints(
- minHeight: constraints.maxHeight - 8,
- ),
- child: IntrinsicHeight(child: child),
- ),
- ),
- );
- },
),
),
+ ],
+ ),
+ body: SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.only(
+ top: 12,
+ left: 12,
+ right: 12,
+ bottom: 12,
+ ),
+ child: LayoutBuilder(
+ builder: (context, constraints) {
+ return SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.all(4),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: constraints.maxHeight - 8,
+ ),
+ child: IntrinsicHeight(child: child),
+ ),
+ ),
+ );
+ },
),
),
),
+ ),
+ ),
child: ConditionalParent(
condition: isDesktop,
- builder:
- (child) => DesktopDialog(
- maxWidth: 580,
- maxHeight: double.infinity,
- child: Column(
- mainAxisSize: MainAxisSize.min,
+ builder: (child) => DesktopDialog(
+ maxWidth: 580,
+ maxHeight: double.infinity,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const SizedBox(height: 8),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- const SizedBox(height: 8),
Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Row(
- children: [
- const SizedBox(width: 8),
- const AppBarBackButton(iconSize: 24, size: 40),
- Text(
- "Add new node",
- style: STextStyles.desktopH3(context),
- ),
- ],
+ const SizedBox(width: 8),
+ const AppBarBackButton(iconSize: 24, size: 40),
+ Text(
+ "Add new node",
+ style: STextStyles.desktopH3(context),
),
- if (coin
- is CryptonoteCurrency) // TODO: [prio=low] do something other than `coin is CryptonoteCurrency` in the future
- Padding(
- padding: const EdgeInsets.only(right: 32),
- child: AppBarIconButton(
- size: 40,
- color:
- isDesktop
- ? Theme.of(context)
- .extension<StackColors>()!
- .textFieldDefaultBG
- : Theme.of(
- context,
- ).extension<StackColors>()!.background,
- icon: const QrCodeIcon(width: 21, height: 21),
- onPressed: _scanQr,
- ),
- ),
],
),
- Padding(
- padding: const EdgeInsets.only(
- left: 32,
- right: 32,
- top: 16,
- bottom: 32,
+ if (coin
+ is CryptonoteCurrency) // TODO: [prio=low] do something other than `coin is CryptonoteCurrency` in the future
+ Padding(
+ padding: const EdgeInsets.only(right: 32),
+ child: AppBarIconButton(
+ size: 40,
+ color: isDesktop
+ ? Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG
+ : Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
+ icon: const QrCodeIcon(width: 21, height: 21),
+ onPressed: _scanQr,
+ ),
),
- child: child,
- ),
],
),
- ),
+ Padding(
+ padding: const EdgeInsets.only(
+ left: 32,
+ right: 32,
+ top: 16,
+ bottom: 32,
+ ),
+ child: child,
+ ),
+ ],
+ ),
+ ),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -704,37 +686,36 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
label: "Test connection",
enabled: testConnectionEnabled,
buttonHeight: isDesktop ? ButtonHeight.l : null,
- onPressed:
- testConnectionEnabled
- ? () async {
- final testPassed = await testNodeConnection(
- context: context,
- onSuccess: _onTestSuccess,
- cryptoCurrency: coin,
- nodeFormData: ref.read(nodeFormDataProvider),
- ref: ref,
- );
- if (context.mounted) {
- if (testPassed) {
- unawaited(
- showFloatingFlushBar(
- type: FlushBarType.success,
- message: "Server ping success",
- context: context,
- ),
- );
- } else {
- unawaited(
- showFloatingFlushBar(
- type: FlushBarType.warning,
- message: "Server unreachable",
- context: context,
- ),
- );
- }
+ onPressed: testConnectionEnabled
+ ? () async {
+ final testPassed = await testNodeConnection(
+ context: context,
+ onSuccess: _onTestSuccess,
+ cryptoCurrency: coin,
+ nodeFormData: ref.read(nodeFormDataProvider),
+ ref: ref,
+ );
+ if (context.mounted) {
+ if (testPassed) {
+ unawaited(
+ showFloatingFlushBar(
+ type: FlushBarType.success,
+ message: "Server ping success",
+ context: context,
+ ),
+ );
+ } else {
+ unawaited(
+ showFloatingFlushBar(
+ type: FlushBarType.warning,
+ message: "Server unreachable",
+ context: context,
+ ),
+ );
}
}
- : null,
+ }
+ : null,
),
),
if (isDesktop) const SizedBox(width: 16),
@@ -752,14 +733,13 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
if (!isDesktop) const SizedBox(height: 16),
if (!isDesktop)
TextButton(
- style:
- saveEnabled
- ? Theme.of(context)
- .extension<StackColors>()!
- .getPrimaryEnabledButtonStyle(context)
- : Theme.of(context)
- .extension<StackColors>()!
- .getPrimaryDisabledButtonStyle(context),
+ style: saveEnabled
+ ? Theme.of(context)
+ .extension<StackColors>()!
+ .getPrimaryEnabledButtonStyle(context)
+ : Theme.of(context)
+ .extension<StackColors>()!
+ .getPrimaryDisabledButtonStyle(context),
onPressed: saveEnabled ? attemptSave : null,
child: Text("Save", style: STextStyles.button(context)),
),
@@ -873,10 +853,12 @@ class _NodeFormState extends ConsumerState<NodeForm> {
onChanged?.call(canSave, canTestConnection);
ref.read(nodeFormDataProvider).name = _nameController.text;
ref.read(nodeFormDataProvider).host = _hostController.text;
- ref.read(nodeFormDataProvider).login =
- _usernameController.text.isEmpty ? null : _usernameController.text;
- ref.read(nodeFormDataProvider).password =
- _passwordController.text.isEmpty ? null : _passwordController.text;
+ ref.read(nodeFormDataProvider).login = _usernameController.text.isEmpty
+ ? null
+ : _usernameController.text;
+ ref.read(nodeFormDataProvider).password = _passwordController.text.isEmpty
+ ? null
+ : _passwordController.text;
ref.read(nodeFormDataProvider).port = port;
ref.read(nodeFormDataProvider).useSSL = _useSSL;
ref.read(nodeFormDataProvider).isFailover = _isFailover;
@@ -985,31 +967,32 @@ class _NodeFormState extends ConsumerState<NodeForm> {
controller: _nameController,
focusNode: _nameFocusNode,
style: STextStyles.field(context),
- decoration: standardInputDecoration(
- "Node name",
- _nameFocusNode,
- context,
- ).copyWith(
- suffixIcon:
- !shouldBeReadOnly && _nameController.text.isNotEmpty
+ decoration:
+ standardInputDecoration(
+ "Node name",
+ _nameFocusNode,
+ context,
+ ).copyWith(
+ suffixIcon:
+ !shouldBeReadOnly && _nameController.text.isNotEmpty
? Padding(
- padding: const EdgeInsets.only(right: 0),
- child: UnconstrainedBox(
- child: Row(
- children: [
- TextFieldIconButton(
- child: const XIcon(),
- onTap: () async {
- _nameController.text = "";
- _updateState();
- },
- ),
- ],
+ padding: const EdgeInsets.only(right: 0),
+ child: UnconstrainedBox(
+ child: Row(
+ children: [
+ TextFieldIconButton(
+ child: const XIcon(),
+ onTap: () async {
+ _nameController.text = "";
+ _updateState();
+ },
+ ),
+ ],
+ ),
),
- ),
- )
+ )
: null,
- ),
+ ),
onChanged: (newValue) {
_updateState();
setState(() {});
@@ -1030,31 +1013,32 @@ class _NodeFormState extends ConsumerState<NodeForm> {
controller: _hostController,
focusNode: _hostFocusNode,
style: STextStyles.field(context),
- decoration: standardInputDecoration(
- (widget.coin is! CryptonoteCurrency) ? "IP address" : "Url",
- _hostFocusNode,
- context,
- ).copyWith(
- suffixIcon:
- !shouldBeReadOnly && _hostController.text.isNotEmpty
+ decoration:
+ standardInputDecoration(
+ (widget.coin is! CryptonoteCurrency) ? "IP address" : "Url",
+ _hostFocusNode,
+ context,
+ ).copyWith(
+ suffixIcon:
+ !shouldBeReadOnly && _hostController.text.isNotEmpty
? Padding(
- padding: const EdgeInsets.only(right: 0),
- child: UnconstrainedBox(
- child: Row(
- children: [
- TextFieldIconButton(
- child: const XIcon(),
- onTap: () async {
- _hostController.text = "";
- _updateState();
- },
- ),
- ],
+ padding: const EdgeInsets.only(right: 0),
+ child: UnconstrainedBox(
+ child: Row(
+ children: [
+ TextFieldIconButton(
+ child: const XIcon(),
+ onTap: () async {
+ _hostController.text = "";
+ _updateState();
+ },
+ ),
+ ],
+ ),
),
- ),
- )
+ )
: null,
- ),
+ ),
onChanged: (newValue) {
// parse port hack
try {
@@ -1098,7 +1082,7 @@ class _NodeFormState extends ConsumerState<NodeForm> {
} else {
enableSSLCheckbox = true;
}
- } else if (widget.coin is LibMoneroWallet || widget.coin is LibSalviumWallet) {
+ } else if (widget.coin is CryptonoteCurrency) {
if (newValue.startsWith("https://")) {
_useSSL = true;
} else if (newValue.startsWith("http://")) {
@@ -1139,31 +1123,28 @@ class _NodeFormState extends ConsumerState<NodeForm> {
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
keyboardType: TextInputType.number,
style: STextStyles.field(context),
- decoration: standardInputDecoration(
- "Port",
- _portFocusNode,
- context,
- ).copyWith(
- suffixIcon:
- !shouldBeReadOnly && _portController.text.isNotEmpty
+ decoration: standardInputDecoration("Port", _portFocusNode, context)
+ .copyWith(
+ suffixIcon:
+ !shouldBeReadOnly && _portController.text.isNotEmpty
? Padding(
- padding: const EdgeInsets.only(right: 0),
- child: UnconstrainedBox(
- child: Row(
- children: [
- TextFieldIconButton(
- child: const XIcon(),
- onTap: () async {
- _portController.text = "";
- _updateState();
- },
- ),
- ],
+ padding: const EdgeInsets.only(right: 0),
+ child: UnconstrainedBox(
+ child: Row(
+ children: [
+ TextFieldIconButton(
+ child: const XIcon(),
+ onTap: () async {
+ _portController.text = "";
+ _updateState();
+ },
+ ),
+ ],
+ ),
),
- ),
- )
+ )
: null,
- ),
+ ),
onChanged: (newValue) {
_updateState();
setState(() {});
@@ -1184,31 +1165,32 @@ class _NodeFormState extends ConsumerState<NodeForm> {
enabled: enableField(_usernameController),
focusNode: _usernameFocusNode,
style: STextStyles.field(context),
- decoration: standardInputDecoration(
- "Login (optional)",
- _usernameFocusNode,
- context,
- ).copyWith(
- suffixIcon:
- !shouldBeReadOnly && _usernameController.text.isNotEmpty
+ decoration:
+ standardInputDecoration(
+ "Login (optional)",
+ _usernameFocusNode,
+ context,
+ ).copyWith(
+ suffixIcon:
+ !shouldBeReadOnly && _usernameController.text.isNotEmpty
? Padding(
- padding: const EdgeInsets.only(right: 0),
- child: UnconstrainedBox(
- child: Row(
- children: [
- TextFieldIconButton(
- child: const XIcon(),
- onTap: () async {
- _usernameController.text = "";
- _updateState();
- },
- ),
- ],
+ padding: const EdgeInsets.only(right: 0),
+ child: UnconstrainedBox(
+ child: Row(
+ children: [
+ TextFieldIconButton(
+ child: const XIcon(),
+ onTap: () async {
+ _usernameController.text = "";
+ _updateState();
+ },
+ ),
+ ],
+ ),
),
- ),
- )
+ )
: null,
- ),
+ ),
onChanged: (newValue) {
_updateState();
setState(() {});
@@ -1230,31 +1212,32 @@ class _NodeFormState extends ConsumerState<NodeForm> {
obscureText: true,
focusNode: _passwordFocusNode,
style: STextStyles.field(context),
- decoration: standardInputDecoration(
- "Password (optional)",
- _passwordFocusNode,
- context,
- ).copyWith(
- suffixIcon:
- !shouldBeReadOnly && _passwordController.text.isNotEmpty
+ decoration:
+ standardInputDecoration(
+ "Password (optional)",
+ _passwordFocusNode,
+ context,
+ ).copyWith(
+ suffixIcon:
+ !shouldBeReadOnly && _passwordController.text.isNotEmpty
? Padding(
- padding: const EdgeInsets.only(right: 0),
- child: UnconstrainedBox(
- child: Row(
- children: [
- TextFieldIconButton(
- child: const XIcon(),
- onTap: () async {
- _passwordController.text = "";
- _updateState();
- },
- ),
- ],
+ padding: const EdgeInsets.only(right: 0),
+ child: UnconstrainedBox(
+ child: Row(
+ children: [
+ TextFieldIconButton(
+ child: const XIcon(),
+ onTap: () async {
+ _passwordController.text = "";
+ _updateState();
+ },
+ ),
+ ],
+ ),
),
- ),
- )
+ )
: null,
- ),
+ ),
onChanged: (newValue) {
_updateState();
setState(() {});
@@ -1266,15 +1249,14 @@ class _NodeFormState extends ConsumerState<NodeForm> {
Row(
children: [
GestureDetector(
- onTap:
- !shouldBeReadOnly && enableSSLCheckbox
- ? () {
- setState(() {
- _useSSL = !_useSSL;
- });
- _updateState();
- }
- : null,
+ onTap: !shouldBeReadOnly && enableSSLCheckbox
+ ? () {
+ setState(() {
+ _useSSL = !_useSSL;
+ });
+ _updateState();
+ }
+ : null,
child: Container(
color: Colors.transparent,
child: Row(
@@ -1283,26 +1265,24 @@ class _NodeFormState extends ConsumerState<NodeForm> {
width: 20,
height: 20,
child: Checkbox(
- fillColor:
- !shouldBeReadOnly && enableSSLCheckbox
- ? null
- : MaterialStateProperty.all(
- Theme.of(context)
- .extension<StackColors>()!
- .checkboxBGDisabled,
- ),
+ fillColor: !shouldBeReadOnly && enableSSLCheckbox
+ ? null
+ : MaterialStateProperty.all(
+ Theme.of(context)
+ .extension<StackColors>()!
+ .checkboxBGDisabled,
+ ),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
value: _useSSL,
- onChanged:
- !shouldBeReadOnly && enableSSLCheckbox
- ? (newValue) {
- setState(() {
- _useSSL = newValue!;
- });
- _updateState();
- }
- : null,
+ onChanged: !shouldBeReadOnly && enableSSLCheckbox
+ ? (newValue) {
+ setState(() {
+ _useSSL = newValue!;
+ });
+ _updateState();
+ }
+ : null,
),
),
const SizedBox(width: 12),
@@ -1316,19 +1296,18 @@ class _NodeFormState extends ConsumerState<NodeForm> {
),
],
),
- if (widget.coin is LibMoneroWallet || widget.coin is LibSalviumWallet)
+ if (widget.coin is CryptonoteCurrency)
Row(
children: [
GestureDetector(
- onTap:
- !widget.readOnly /*&& trustedCheckbox*/
- ? () {
- setState(() {
- _trusted = !_trusted;
- });
- _updateState();
- }
- : null,
+ onTap: !widget.readOnly /*&& trustedCheckbox*/
+ ? () {
+ setState(() {
+ _trusted = !_trusted;
+ });
+ _updateState();
+ }
+ : null,
child: Container(
color: Colors.transparent,
child: Row(
@@ -1337,26 +1316,24 @@ class _NodeFormState extends ConsumerState<NodeForm> {
width: 20,
height: 20,
child: Checkbox(
- fillColor:
- !widget.readOnly
- ? null
- : MaterialStateProperty.all(
- Theme.of(context)
- .extension<StackColors>()!
- .checkboxBGDisabled,
- ),
+ fillColor: !widget.readOnly
+ ? null
+ : MaterialStateProperty.all(
+ Theme.of(context)
+ .extension<StackColors>()!
+ .checkboxBGDisabled,
+ ),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
value: _trusted,
- onChanged:
- !widget.readOnly
- ? (newValue) {
- setState(() {
- _trusted = newValue!;
- });
- _updateState();
- }
- : null,
+ onChanged: !widget.readOnly
+ ? (newValue) {
+ setState(() {
+ _trusted = newValue!;
+ });
+ _updateState();
+ }
+ : null,
),
),
const SizedBox(width: 12),
@@ -1373,9 +1350,7 @@ class _NodeFormState extends ConsumerState<NodeForm> {
if (widget.coin is! CryptonoteCurrency &&
widget.coin is! Epiccash &&
widget.coin is! Mimblewimblecoin)
- const SizedBox(
- height: 8,
- ),
+ const SizedBox(height: 8),
if (widget.coin is! CryptonoteCurrency &&
widget.coin is! Epiccash &&
widget.coin is! Mimblewimblecoin)
@@ -1509,25 +1484,23 @@ class _NodeFormState extends ConsumerState<NodeForm> {
width: 20,
height: 20,
child: Checkbox(
- fillColor:
- !widget.readOnly
- ? null
- : MaterialStateProperty.all(
- Theme.of(
- context,
- ).extension<StackColors>()!.checkboxBGDisabled,
- ),
+ fillColor: !widget.readOnly
+ ? null
+ : MaterialStateProperty.all(
+ Theme.of(
+ context,
+ ).extension<StackColors>()!.checkboxBGDisabled,
+ ),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
value: _forceNoTor,
- onChanged:
- !widget.readOnly
- ? (newValue) {
- setState(() {
- _forceNoTor = newValue!;
- });
- _updateState();
- }
- : null,
+ onChanged: !widget.readOnly
+ ? (newValue) {
+ setState(() {
+ _forceNoTor = newValue!;
+ });
+ _updateState();
+ }
+ : null,
),
),
const SizedBox(width: 12),
@@ -1564,9 +1537,8 @@ class RadioTextButton<T> extends StatelessWidget {
Widget build(BuildContext context) {
return ConditionalParent(
condition: Util.isDesktop,
- builder:
- (child) =>
- MouseRegion(cursor: SystemMouseCursors.click, child: child),
+ builder: (child) =>
+ MouseRegion(cursor: SystemMouseCursors.click, child: child),
child: GestureDetector(
onTap: () {
if (value != groupValue) {
@@ -1583,20 +1555,18 @@ class RadioTextButton<T> extends StatelessWidget {
width: 20,
height: 20,
child: Radio<T>(
- activeColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.radioButtonIconEnabled,
+ activeColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.radioButtonIconEnabled,
value: value,
groupValue: groupValue,
- onChanged:
- !enabled
- ? null
- : (_) {
- if (value != groupValue) {
- onChanged.call(value);
- }
- },
+ onChanged: !enabled
+ ? null
+ : (_) {
+ if (value != groupValue) {
+ onChanged.call(value);
+ }
+ },
),
),
const SizedBox(width: 14),
diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart
index 355fc66..0bf51bc 100644
--- a/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart
+++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart
@@ -54,8 +54,7 @@ import '../../../../../wallets/wallet/impl/mimblewimblecoin_wallet.dart';
import '../../../../../wallets/wallet/impl/monero_wallet.dart';
import '../../../../../wallets/wallet/impl/wownero_wallet.dart';
import '../../../../../wallets/wallet/impl/xelis_wallet.dart';
-import '../../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
+import '../../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../../../wallets/wallet/wallet.dart';
import '../../../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import '../../../../../wallets/wallet/wallet_mixin_interfaces/private_key_interface.dart';
@@ -501,8 +500,7 @@ abstract class SWB {
int restoreHeight = walletbackup['restoreHeight'] as int? ?? 0;
if (restoreHeight <= 0) {
if (wallet is EpiccashWallet ||
- wallet is LibMoneroWallet ||
- wallet is LibSalviumWallet ||
+ wallet is CryptonoteWallet ||
wallet is MimblewimblecoinWallet) {
restoreHeight = 0;
} else {
diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart
index 2e3ffbb..b347431 100644
--- a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart
+++ b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart
@@ -39,11 +39,11 @@ import '../../../../wallets/crypto_currency/coins/mimblewimblecoin.dart';
import '../../../../wallets/crypto_currency/coins/monero.dart';
import '../../../../wallets/crypto_currency/coins/salvium.dart';
import '../../../../wallets/crypto_currency/coins/wownero.dart';
+import '../../../../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
import '../../../../wallets/wallet/impl/epiccash_wallet.dart';
import '../../../../wallets/wallet/impl/mimblewimblecoin_wallet.dart';
-import '../../../../wallets/wallet/impl/salvium_wallet.dart';
-import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
+import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/mweb_interface.dart';
import '../../../../widgets/animated_text.dart';
@@ -333,16 +333,9 @@ class _WalletNetworkSettingsViewState
final coin = ref.watch(pWalletCoin(widget.walletId));
- if (coin is Salvium) {
+ if (coin is CryptonoteCurrency) {
final double highestPercent =
- (ref.read(pWallets).getWallet(widget.walletId) as SalviumWallet)
- .highestPercentCached;
- if (_percent < highestPercent) {
- _percent = highestPercent.clamp(0.0, 1.0);
- }
- } else if (coin is Monero || coin is Wownero) {
- final double highestPercent =
- (ref.read(pWallets).getWallet(widget.walletId) as LibMoneroWallet)
+ (ref.read(pWallets).getWallet(widget.walletId) as CryptonoteWallet)
.highestPercentCached;
if (_percent < highestPercent) {
_percent = highestPercent.clamp(0.0, 1.0);
diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart
index b1b4854..bae20da 100644
--- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart
+++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart
@@ -18,9 +18,9 @@ import 'package:tuple/tuple.dart';
import '../../../db/hive/db.dart';
import '../../../db/sqlite/firo_cache.dart';
import '../../../models/epicbox_config_model.dart';
-import '../../../models/mwcmqs_config_model.dart';
import '../../../models/keys/key_data_interface.dart';
import '../../../models/keys/view_only_wallet_data.dart';
+import '../../../models/mwcmqs_config_model.dart';
import '../../../notifications/show_flush_bar.dart';
import '../../../providers/global/wallets_provider.dart';
import '../../../providers/ui/transaction_filter_provider.dart';
@@ -38,9 +38,8 @@ import '../../../wallets/crypto_currency/intermediate/frost_currency.dart';
import '../../../wallets/crypto_currency/intermediate/nano_currency.dart';
import '../../../wallets/wallet/impl/bitcoin_frost_wallet.dart';
import '../../../wallets/wallet/impl/epiccash_wallet.dart';
-import '../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../wallets/wallet/impl/mimblewimblecoin_wallet.dart';
+import '../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import '../../../wallets/wallet/wallet_mixin_interfaces/view_only_option_interface.dart';
@@ -115,8 +114,9 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
_currentSyncStatus = widget.initialSyncStatus;
// _currentNodeStatus = widget.initialNodeStatus;
- eventBus =
- widget.eventBus != null ? widget.eventBus! : GlobalEventBus.instance;
+ eventBus = widget.eventBus != null
+ ? widget.eventBus!
+ : GlobalEventBus.instance;
_syncStatusSubscription = eventBus
.on<WalletSyncStatusChangedEvent>()
@@ -296,12 +296,12 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
keys: results[0]!,
prevGen:
results[2] == null ||
- results[3] == null
- ? null
- : (
- config: results[3]!,
- keys: results[2]!,
- ),
+ results[3] == null
+ ? null
+ : (
+ config: results[3]!,
+ keys: results[2]!,
+ ),
);
}
} else {
@@ -312,30 +312,26 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
.isViewOnly) {
// TODO: is something needed here?
} else {
- mnemonic =
- await wallet
- .getMnemonicAsWords();
+ mnemonic = await wallet
+ .getMnemonicAsWords();
}
}
}
- KeyDataInterface? keyData;
- if (wallet
- is ViewOnlyOptionInterface &&
- wallet.isViewOnly) {
- keyData =
- await wallet
- .getViewOnlyWalletData();
- } else if (wallet
- is ExtendedKeysInterface) {
- keyData = await wallet.getXPrivs();
- } else if (wallet
- is LibMoneroWallet) {
- keyData = await wallet.getKeys();
- } else if (wallet
- is LibSalviumWallet) {
- keyData = await wallet.getKeys();
- }
+ KeyDataInterface? keyData;
+ if (wallet
+ is ViewOnlyOptionInterface &&
+ wallet.isViewOnly) {
+ keyData = await wallet
+ .getViewOnlyWalletData();
+ } else if (wallet
+ is ExtendedKeysInterface) {
+ keyData = await wallet
+ .getXPrivs();
+ } else if (wallet
+ is CryptonoteWallet) {
+ keyData = await wallet.getKeys();
+ }
if (context.mounted) {
if (keyData != null &&
@@ -348,26 +344,22 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
shouldUseMaterialRoute:
RouteGenerator
.useMaterialPageRoute,
- builder:
- (_) => LockscreenView(
- routeOnSuccessArguments:
- (
- walletId:
- walletId,
- keyData:
- keyData,
- ),
- showBackButton: true,
- routeOnSuccess:
- MobileKeyDataView
- .routeName,
- biometricsCancelButtonString:
- "CANCEL",
- biometricsLocalizedReason:
- "Authenticate to view recovery data",
- biometricsAuthenticationTitle:
- "View recovery data",
- ),
+ builder: (_) => LockscreenView(
+ routeOnSuccessArguments: (
+ walletId: walletId,
+ keyData: keyData,
+ ),
+ showBackButton: true,
+ routeOnSuccess:
+ MobileKeyDataView
+ .routeName,
+ biometricsCancelButtonString:
+ "CANCEL",
+ biometricsLocalizedReason:
+ "Authenticate to view recovery data",
+ biometricsAuthenticationTitle:
+ "View recovery data",
+ ),
settings: const RouteSettings(
name:
"/viewRecoveryDataLockscreen",
@@ -381,27 +373,26 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
shouldUseMaterialRoute:
RouteGenerator
.useMaterialPageRoute,
- builder:
- (_) => LockscreenView(
- routeOnSuccessArguments: (
- walletId: walletId,
- mnemonic:
- mnemonic ?? [],
- frostWalletData:
- frostWalletData,
- keyData: keyData,
- ),
- showBackButton: true,
- routeOnSuccess:
- WalletBackupView
- .routeName,
- biometricsCancelButtonString:
- "CANCEL",
- biometricsLocalizedReason:
- "Authenticate to view recovery phrase",
- biometricsAuthenticationTitle:
- "View recovery phrase",
- ),
+ builder: (_) => LockscreenView(
+ routeOnSuccessArguments: (
+ walletId: walletId,
+ mnemonic:
+ mnemonic ?? [],
+ frostWalletData:
+ frostWalletData,
+ keyData: keyData,
+ ),
+ showBackButton: true,
+ routeOnSuccess:
+ WalletBackupView
+ .routeName,
+ biometricsCancelButtonString:
+ "CANCEL",
+ biometricsLocalizedReason:
+ "Authenticate to view recovery phrase",
+ biometricsAuthenticationTitle:
+ "View recovery phrase",
+ ),
settings: const RouteSettings(
name:
"/viewRecoverPhraseLockscreen",
@@ -489,23 +480,20 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
useSafeArea: false,
barrierDismissible: true,
context: context,
- builder:
- (_) => StackOkDialog(
- title:
- "Are you sure you want to clear "
- "${coin.prettyName} electrumx cache?",
- onOkPressed: (value) {
- result = value;
- },
- leftButton: SecondaryButton(
- label: "Cancel",
- onPressed: () {
- Navigator.of(
- context,
- ).pop();
- },
- ),
- ),
+ builder: (_) => StackOkDialog(
+ title:
+ "Are you sure you want to clear "
+ "${coin.prettyName} electrumx cache?",
+ onOkPressed: (value) {
+ result = value;
+ },
+ leftButton: SecondaryButton(
+ label: "Cancel",
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
+ ),
+ ),
);
if (result == "OK" &&
@@ -578,8 +566,11 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
// .getWallet(walletId)
// .isActiveWallet = false;
ref
- .read(transactionFilterProvider.state)
- .state = null;
+ .read(
+ transactionFilterProvider.state,
+ )
+ .state =
+ null;
Navigator.of(context).popUntil(
ModalRoute.withName(HomeView.routeName),
@@ -591,10 +582,9 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
child: Text(
"Log out",
style: STextStyles.button(context).copyWith(
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .accentColorDark,
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .accentColorDark,
),
),
);
@@ -666,8 +656,9 @@ class _EpiBoxInfoFormState extends ConsumerState<EpicBoxInfoForm> {
enableSuggestions: Util.isDesktop ? false : true,
controller: portController,
decoration: const InputDecoration(hintText: "Port"),
- keyboardType:
- Util.isDesktop ? null : const TextInputType.numberWithOptions(),
+ keyboardType: Util.isDesktop
+ ? null
+ : const TextInputType.numberWithOptions(),
),
const SizedBox(height: 8),
TextButton(
@@ -696,8 +687,9 @@ class _EpiBoxInfoFormState extends ConsumerState<EpicBoxInfoForm> {
child: Text(
"Save",
style: STextStyles.button(context).copyWith(
- color:
- Theme.of(context).extension<StackColors>()!.accentColorDark,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
),
),
),
@@ -708,10 +700,7 @@ class _EpiBoxInfoFormState extends ConsumerState<EpicBoxInfoForm> {
}
class MwcMqsInfoForm extends ConsumerStatefulWidget {
- const MwcMqsInfoForm({
- super.key,
- required this.walletId,
- });
+ const MwcMqsInfoForm({super.key, required this.walletId});
final String walletId;
@@ -756,20 +745,17 @@ class _MwcmqsInfoFormState extends ConsumerState<MwcMqsInfoForm> {
controller: hostController,
decoration: const InputDecoration(hintText: "Host"),
),
- const SizedBox(
- height: 8,
- ),
+ const SizedBox(height: 8),
TextField(
autocorrect: Util.isDesktop ? false : true,
enableSuggestions: Util.isDesktop ? false : true,
controller: portController,
decoration: const InputDecoration(hintText: "Port"),
- keyboardType:
- Util.isDesktop ? null : const TextInputType.numberWithOptions(),
- ),
- const SizedBox(
- height: 8,
+ keyboardType: Util.isDesktop
+ ? null
+ : const TextInputType.numberWithOptions(),
),
+ const SizedBox(height: 8),
TextButton(
onPressed: () async {
try {
@@ -796,8 +782,9 @@ class _MwcmqsInfoFormState extends ConsumerState<MwcMqsInfoForm> {
child: Text(
"Save",
style: STextStyles.button(context).copyWith(
- color:
- Theme.of(context).extension<StackColors>()!.accentColorDark,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
),
),
),
diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/edit_refresh_height_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/edit_refresh_height_view.dart
index bfa5d0a..70ca0a4 100644
--- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/edit_refresh_height_view.dart
+++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/edit_refresh_height_view.dart
@@ -11,8 +11,7 @@ import '../../../../utilities/constants.dart';
import '../../../../utilities/text_styles.dart';
import '../../../../utilities/util.dart';
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
-import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../../../wallets/wallet/intermediate/lib_wownero_wallet.dart';
+import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../../widgets/background.dart';
import '../../../../widgets/conditional_parent.dart';
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
@@ -22,8 +21,6 @@ import '../../../../widgets/desktop/primary_button.dart';
import '../../../../widgets/icon_widgets/x_icon.dart';
import '../../../../widgets/stack_text_field.dart';
import '../../../../widgets/textfield_icon_button.dart';
-import '../../../../wl_gen/interfaces/cs_monero_interface.dart';
-import '../../../../wl_gen/interfaces/cs_wownero_interface.dart';
class EditRefreshHeightView extends ConsumerStatefulWidget {
const EditRefreshHeightView({super.key, required this.walletId});
@@ -58,10 +55,8 @@ class _EditRefreshHeightViewState extends ConsumerState<EditRefreshHeightView> {
isar: ref.read(mainDBProvider).isar,
);
final wallet = ref.read(pWallets).getWallet(widget.walletId);
- if (wallet is LibMoneroWallet && wallet.wallet != null) {
- csMonero.setRefreshFromBlockHeight(wallet.wallet!, newHeight);
- } else if (wallet is LibWowneroWallet && wallet.wallet != null) {
- csWownero.setRefreshFromBlockHeight(wallet.wallet!, newHeight);
+ if (wallet is CryptonoteWallet && wallet.wallet != null) {
+ wallet.setRefreshFromBlockHeight(newHeight);
}
} else {
errMessage = "Invalid height: ${_controller.text}";
@@ -100,14 +95,8 @@ class _EditRefreshHeightViewState extends ConsumerState<EditRefreshHeightView> {
super.initState();
_controller = TextEditingController();
final wallet = ref.read(pWallets).getWallet(widget.walletId);
- if (wallet is LibMoneroWallet && wallet.wallet != null) {
- _controller.text = csMonero
- .getRefreshFromBlockHeight(wallet.wallet!)
- .toString();
- } else if (wallet is LibWowneroWallet && wallet.wallet != null) {
- _controller.text = csWownero
- .getRefreshFromBlockHeight(wallet.wallet!)
- .toString();
+ if (wallet is CryptonoteWallet && wallet.wallet != null) {
+ _controller.text = wallet.getRefreshFromBlockHeight().toString();
} else {
_controller.text = ref
.read(pWalletInfo(widget.walletId))
diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart
index 7792fb2..f030856 100644
--- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart
+++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart
@@ -22,8 +22,7 @@ import '../../../../utilities/logger.dart';
import '../../../../utilities/text_styles.dart';
import '../../../../wallets/isar/models/wallet_info.dart';
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
-import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
+import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/multi_address_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/mweb_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/rbf_interface.dart';
@@ -510,9 +509,8 @@ class _WalletSettingsWalletSettingsViewState
),
),
),
- if (wallet is LibMoneroWallet || wallet is LibSalviumWallet)
- const SizedBox(height: 8),
- if (wallet is LibMoneroWallet || wallet is LibSalviumWallet)
+ if (wallet is CryptonoteWallet) const SizedBox(height: 8),
+ if (wallet is CryptonoteWallet)
RoundedWhiteContainer(
padding: const EdgeInsets.all(0),
child: RawMaterialButton(
@@ -560,65 +558,59 @@ class _WalletSettingsWalletSettingsViewState
showDialog<void>(
barrierDismissible: true,
context: context,
- builder:
- (_) => StackDialog(
- title:
- "Do you want to delete ${ref.read(pWalletName(widget.walletId))}?",
- leftButton: TextButton(
- style: Theme.of(context)
- .extension<StackColors>()!
- .getSecondaryEnabledButtonStyle(context),
- onPressed: () {
- Navigator.pop(context);
- },
- child: Text(
- "Cancel",
- style: STextStyles.button(context).copyWith(
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .accentColorDark,
- ),
- ),
+ builder: (_) => StackDialog(
+ title:
+ "Do you want to delete ${ref.read(pWalletName(widget.walletId))}?",
+ leftButton: TextButton(
+ style: Theme.of(context)
+ .extension<StackColors>()!
+ .getSecondaryEnabledButtonStyle(context),
+ onPressed: () {
+ Navigator.pop(context);
+ },
+ child: Text(
+ "Cancel",
+ style: STextStyles.button(context).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
),
- rightButton: TextButton(
- style: Theme.of(context)
- .extension<StackColors>()!
- .getPrimaryEnabledButtonStyle(context),
- onPressed: () {
- Navigator.pop(context);
- Navigator.push(
- context,
- RouteGenerator.getRoute(
- shouldUseMaterialRoute:
- RouteGenerator.useMaterialPageRoute,
- builder:
- (_) => LockscreenView(
- routeOnSuccessArguments:
- widget.walletId,
- showBackButton: true,
- routeOnSuccess:
- DeleteWalletWarningView
- .routeName,
- biometricsCancelButtonString:
- "CANCEL",
- biometricsLocalizedReason:
- "Authenticate to delete wallet",
- biometricsAuthenticationTitle:
- "Delete wallet",
- ),
- settings: const RouteSettings(
- name: "/deleteWalletLockscreen",
- ),
- ),
- );
- },
- child: Text(
- "Delete",
- style: STextStyles.button(context),
+ ),
+ ),
+ rightButton: TextButton(
+ style: Theme.of(context)
+ .extension<StackColors>()!
+ .getPrimaryEnabledButtonStyle(context),
+ onPressed: () {
+ Navigator.pop(context);
+ Navigator.push(
+ context,
+ RouteGenerator.getRoute(
+ shouldUseMaterialRoute:
+ RouteGenerator.useMaterialPageRoute,
+ builder: (_) => LockscreenView(
+ routeOnSuccessArguments: widget.walletId,
+ showBackButton: true,
+ routeOnSuccess:
+ DeleteWalletWarningView.routeName,
+ biometricsCancelButtonString: "CANCEL",
+ biometricsLocalizedReason:
+ "Authenticate to delete wallet",
+ biometricsAuthenticationTitle:
+ "Delete wallet",
+ ),
+ settings: const RouteSettings(
+ name: "/deleteWalletLockscreen",
+ ),
),
- ),
+ );
+ },
+ child: Text(
+ "Delete",
+ style: STextStyles.button(context),
),
+ ),
+ ),
);
},
child: Padding(
diff --git a/lib/pages/special/firo_rescan_recovery_error_dialog.dart b/lib/pages/special/firo_rescan_recovery_error_dialog.dart
index 1b8675d..8e8c21f 100644
--- a/lib/pages/special/firo_rescan_recovery_error_dialog.dart
+++ b/lib/pages/special/firo_rescan_recovery_error_dialog.dart
@@ -12,8 +12,7 @@ import '../../utilities/assets.dart';
import '../../utilities/text_styles.dart';
import '../../utilities/util.dart';
import '../../wallets/isar/providers/wallet_info_provider.dart';
-import '../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
+import '../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import '../../widgets/background.dart';
@@ -65,21 +64,20 @@ class _FiroRescanRecoveryErrorViewState
final result = await showDialog<bool?>(
context: context,
barrierDismissible: false,
- builder:
- (context) => Navigator(
- initialRoute: DesktopDeleteWalletDialog.routeName,
- onGenerateRoute: RouteGenerator.generateRoute,
- onGenerateInitialRoutes: (_, __) {
- return [
- RouteGenerator.generateRoute(
- RouteSettings(
- name: DesktopDeleteWalletDialog.routeName,
- arguments: widget.walletId,
- ),
- ),
- ];
- },
- ),
+ builder: (context) => Navigator(
+ initialRoute: DesktopDeleteWalletDialog.routeName,
+ onGenerateRoute: RouteGenerator.generateRoute,
+ onGenerateInitialRoutes: (_, __) {
+ return [
+ RouteGenerator.generateRoute(
+ RouteSettings(
+ name: DesktopDeleteWalletDialog.routeName,
+ arguments: widget.walletId,
+ ),
+ ),
+ ];
+ },
+ ),
);
if (result == true) {
@@ -100,8 +98,9 @@ class _FiroRescanRecoveryErrorViewState
builder: (child) {
return Background(
child: Scaffold(
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.background,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
appBar: AppBar(
automaticallyImplyLeading: false,
actions: [
@@ -120,18 +119,16 @@ class _FiroRescanRecoveryErrorViewState
key: const Key("walletViewRadioButton"),
size: 36,
shadows: const [],
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
icon: SvgPicture.asset(
Assets.svg.trash,
width: 20,
height: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.topNavIconPrimary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.topNavIconPrimary,
),
onPressed: () async {
final walletName = ref.read(
@@ -140,71 +137,60 @@ class _FiroRescanRecoveryErrorViewState
await showDialog<void>(
barrierDismissible: true,
context: context,
- builder:
- (_) => StackDialog(
- title: "Do you want to delete $walletName?",
- leftButton: TextButton(
- style: Theme.of(context)
+ builder: (_) => StackDialog(
+ title: "Do you want to delete $walletName?",
+ leftButton: TextButton(
+ style: Theme.of(context)
+ .extension<StackColors>()!
+ .getSecondaryEnabledButtonStyle(context),
+ onPressed: () {
+ Navigator.pop(context);
+ },
+ child: Text(
+ "Cancel",
+ style: STextStyles.button(context).copyWith(
+ color: Theme.of(context)
.extension<StackColors>()!
- .getSecondaryEnabledButtonStyle(
- context,
- ),
- onPressed: () {
- Navigator.pop(context);
- },
- child: Text(
- "Cancel",
- style: STextStyles.button(
- context,
- ).copyWith(
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .accentColorDark,
- ),
- ),
+ .accentColorDark,
),
- rightButton: TextButton(
- style: Theme.of(context)
- .extension<StackColors>()!
- .getPrimaryEnabledButtonStyle(
- context,
- ),
- onPressed: () {
- Navigator.pop(context);
- Navigator.push(
- context,
- RouteGenerator.getRoute(
- shouldUseMaterialRoute:
- RouteGenerator
- .useMaterialPageRoute,
- builder:
- (_) => LockscreenView(
- routeOnSuccessArguments:
- widget.walletId,
- showBackButton: true,
- routeOnSuccess:
- DeleteWalletWarningView
- .routeName,
- biometricsCancelButtonString:
- "CANCEL",
- biometricsLocalizedReason:
- "Authenticate to delete wallet",
- biometricsAuthenticationTitle:
- "Delete wallet",
- ),
- settings: const RouteSettings(
- name: "/deleteWalletLockscreen",
- ),
- ),
- );
- },
- child: Text(
- "Delete",
- style: STextStyles.button(context),
+ ),
+ ),
+ rightButton: TextButton(
+ style: Theme.of(context)
+ .extension<StackColors>()!
+ .getPrimaryEnabledButtonStyle(context),
+ onPressed: () {
+ Navigator.pop(context);
+ Navigator.push(
+ context,
+ RouteGenerator.getRoute(
+ shouldUseMaterialRoute:
+ RouteGenerator.useMaterialPageRoute,
+ builder: (_) => LockscreenView(
+ routeOnSuccessArguments:
+ widget.walletId,
+ showBackButton: true,
+ routeOnSuccess:
+ DeleteWalletWarningView.routeName,
+ biometricsCancelButtonString:
+ "CANCEL",
+ biometricsLocalizedReason:
+ "Authenticate to delete wallet",
+ biometricsAuthenticationTitle:
+ "Delete wallet",
+ ),
+ settings: const RouteSettings(
+ name: "/deleteWalletLockscreen",
+ ),
),
- ),
+ );
+ },
+ child: Text(
+ "Delete",
+ style: STextStyles.button(context),
),
+ ),
+ ),
);
},
),
@@ -232,20 +218,18 @@ class _FiroRescanRecoveryErrorViewState
Util.isDesktop ? const SizedBox(height: 60) : const Spacer(),
BranchedParent(
condition: Util.isDesktop,
- conditionBranchBuilder:
- (children) => Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: children,
- ),
- otherBranchBuilder:
- (children) => Row(
- children: [
- Expanded(child: children[0]),
- children[1],
- Expanded(child: children[2]),
- ],
- ),
+ conditionBranchBuilder: (children) => Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: children,
+ ),
+ otherBranchBuilder: (children) => Row(
+ children: [
+ Expanded(child: children[0]),
+ children[1],
+ Expanded(child: children[2]),
+ ],
+ ),
children: [
SecondaryButton(
label: "Show mnemonic",
@@ -255,21 +239,20 @@ class _FiroRescanRecoveryErrorViewState
await showDialog<void>(
context: context,
barrierDismissible: false,
- builder:
- (context) => Navigator(
- initialRoute: UnlockWalletKeysDesktop.routeName,
- onGenerateRoute: RouteGenerator.generateRoute,
- onGenerateInitialRoutes: (_, __) {
- return [
- RouteGenerator.generateRoute(
- RouteSettings(
- name: UnlockWalletKeysDesktop.routeName,
- arguments: widget.walletId,
- ),
- ),
- ];
- },
- ),
+ builder: (context) => Navigator(
+ initialRoute: UnlockWalletKeysDesktop.routeName,
+ onGenerateRoute: RouteGenerator.generateRoute,
+ onGenerateInitialRoutes: (_, __) {
+ return [
+ RouteGenerator.generateRoute(
+ RouteSettings(
+ name: UnlockWalletKeysDesktop.routeName,
+ arguments: widget.walletId,
+ ),
+ ),
+ ];
+ },
+ ),
);
} else {
final wallet = ref
@@ -282,9 +265,7 @@ class _FiroRescanRecoveryErrorViewState
KeyDataInterface? keyData;
if (wallet is ExtendedKeysInterface) {
keyData = await wallet.getXPrivs();
- } else if (wallet is LibMoneroWallet) {
- keyData = await wallet.getKeys();
- } else if (wallet is LibSalviumWallet) {
+ } else if (wallet is CryptonoteWallet) {
keyData = await wallet.getKeys();
}
@@ -294,22 +275,20 @@ class _FiroRescanRecoveryErrorViewState
RouteGenerator.getRoute(
shouldUseMaterialRoute:
RouteGenerator.useMaterialPageRoute,
- builder:
- (_) => LockscreenView(
- routeOnSuccessArguments: (
- walletId: widget.walletId,
- mnemonic: mnemonic,
- keyData: keyData,
- ),
- showBackButton: true,
- routeOnSuccess:
- WalletBackupView.routeName,
- biometricsCancelButtonString: "CANCEL",
- biometricsLocalizedReason:
- "Authenticate to view recovery phrase",
- biometricsAuthenticationTitle:
- "View recovery phrase",
- ),
+ builder: (_) => LockscreenView(
+ routeOnSuccessArguments: (
+ walletId: widget.walletId,
+ mnemonic: mnemonic,
+ keyData: keyData,
+ ),
+ showBackButton: true,
+ routeOnSuccess: WalletBackupView.routeName,
+ biometricsCancelButtonString: "CANCEL",
+ biometricsLocalizedReason:
+ "Authenticate to view recovery phrase",
+ biometricsAuthenticationTitle:
+ "View recovery phrase",
+ ),
settings: const RouteSettings(
name: "/viewRecoverPhraseLockscreen",
),
diff --git a/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart b/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart
index 21d76fa..748912e 100644
--- a/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart
+++ b/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart
@@ -43,8 +43,7 @@ import '../../../../wallets/isar/models/spark_coin.dart';
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
import '../../../../wallets/wallet/impl/epiccash_wallet.dart';
import '../../../../wallets/wallet/impl/mimblewimblecoin_wallet.dart';
-import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
+import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/rbf_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
import '../../../../widgets/background.dart';
@@ -185,7 +184,7 @@ class _TransactionV2DetailsViewState
final wallet = ref.read(pWallets).getWallet(walletId);
hasTxKeyProbably =
- (wallet is LibMoneroWallet || wallet is LibSalviumWallet) &&
+ (wallet is CryptonoteWallet) &&
(_transaction.type == TransactionType.outgoing ||
_transaction.type == TransactionType.sentToSelf);
diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart
index 417ad22..b7929f1 100644
--- a/lib/pages/wallet_view/wallet_view.dart
+++ b/lib/pages/wallet_view/wallet_view.dart
@@ -53,7 +53,7 @@ import '../../wallets/wallet/impl/bitcoin_frost_wallet.dart';
import '../../wallets/wallet/impl/firo_wallet.dart';
import '../../wallets/wallet/impl/mimblewimblecoin_wallet.dart';
import '../../wallets/wallet/impl/namecoin_wallet.dart';
-import '../../wallets/wallet/intermediate/lib_monero_wallet.dart';
+import '../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
@@ -1272,9 +1272,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
);
},
),
- if ((wallet is LibMoneroWallet ||
- wallet is LibSalviumWallet) &&
- !viewOnly)
+ if ((wallet is CryptonoteWallet) && !viewOnly)
WalletNavigationBarItemData(
label: "Churn",
icon: const ChurnNavIcon(),
diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send_fee_form.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send_fee_form.dart
index 7215e6e..e0dfd7f 100644
--- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send_fee_form.dart
+++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send_fee_form.dart
@@ -12,17 +12,17 @@ import '../../../../utilities/eth_commons.dart';
import '../../../../utilities/text_styles.dart';
import '../../../../wallets/crypto_currency/crypto_currency.dart';
import '../../../../wallets/crypto_currency/interfaces/electrumx_currency_interface.dart';
+import '../../../../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
import '../../../../wallets/isar/providers/eth/current_token_wallet_provider.dart';
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
import '../../../../wallets/wallet/impl/firo_wallet.dart';
+import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../../widgets/animated_text.dart';
import '../../../../widgets/conditional_parent.dart';
import '../../../../widgets/custom_buttons/blue_text_button.dart';
import '../../../../widgets/desktop/desktop_fee_dialog.dart';
import '../../../../widgets/eth_fee_form.dart';
import '../../../../widgets/fee_slider.dart';
-import '../../../../wl_gen/interfaces/cs_monero_interface.dart';
-import '../../../../wl_gen/interfaces/cs_wownero_interface.dart';
class DesktopSendFeeForm extends ConsumerStatefulWidget {
const DesktopSendFeeForm({
@@ -168,13 +168,12 @@ class _DesktopSendFeeFormState extends ConsumerState<DesktopSendFeeForm> {
.read(pWallets)
.getWallet(widget.walletId);
- if (coin is Monero || coin is Wownero) {
+ if (coin is CryptonoteCurrency) {
final fee = await wallet.estimateFeeFor(
amount,
BigInt.from(
- coin is Monero
- ? csMonero.getTxPriorityMedium()
- : csWownero.getTxPriorityMedium(),
+ (wallet as CryptonoteWallet)
+ .getTxPriorityMedium(),
),
);
ref
diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart
index 8d14c78..052569a 100644
--- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart
+++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart
@@ -41,7 +41,7 @@ import '../../../../wallets/crypto_currency/coins/banano.dart';
import '../../../../wallets/crypto_currency/coins/firo.dart';
import '../../../../wallets/wallet/impl/firo_wallet.dart';
import '../../../../wallets/wallet/impl/namecoin_wallet.dart';
-import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
+import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../../../../wallets/wallet/wallet.dart' show Wallet;
import '../../../../wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart';
@@ -490,8 +490,7 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
wallet is CashFusionInterface)
(WalletFeature.fusion, Assets.svg.cashFusion, _onFusionPressed),
- if (!isViewOnly &&
- (wallet is LibMoneroWallet || wallet is LibSalviumWallet))
+ if (!isViewOnly && (wallet is CryptonoteWallet))
(WalletFeature.churn, Assets.svg.churn, _onChurnPressed),
if (wallet is NamecoinWallet)
diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart
index 4f1db45..dc15771 100644
--- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart
+++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart
@@ -23,8 +23,7 @@ import '../../../../utilities/assets.dart';
import '../../../../utilities/constants.dart';
import '../../../../utilities/text_styles.dart';
import '../../../../wallets/wallet/impl/bitcoin_frost_wallet.dart';
-import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
+import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/view_only_option_interface.dart';
@@ -61,12 +60,11 @@ class _UnlockWalletKeysDesktopState
unawaited(
showDialog(
context: context,
- builder:
- (context) => const Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [LoadingIndicator(width: 200, height: 200)],
- ),
+ builder: (context) => const Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [LoadingIndicator(width: 200, height: 200)],
+ ),
),
);
@@ -108,10 +106,9 @@ class _UnlockWalletKeysDesktopState
myName: wallet.frostInfo.myName,
config: results[1]!,
keys: results[0]!,
- prevGen:
- results[2] == null || results[3] == null
- ? null
- : (config: results[3]!, keys: results[2]!),
+ prevGen: results[2] == null || results[3] == null
+ ? null
+ : (config: results[3]!, keys: results[2]!),
);
}
} else {
@@ -131,9 +128,7 @@ class _UnlockWalletKeysDesktopState
keyData = await wallet.getViewOnlyWalletData();
} else if (wallet is ExtendedKeysInterface) {
keyData = await wallet.getXPrivs();
- } else if (wallet is LibMoneroWallet) {
- keyData = await wallet.getKeys();
- } else if (wallet is LibSalviumWallet) {
+ } else if (wallet is CryptonoteWallet) {
keyData = await wallet.getKeys();
}
@@ -191,8 +186,10 @@ class _UnlockWalletKeysDesktopState
mainAxisAlignment: MainAxisAlignment.end,
children: [
DesktopDialogCloseButton(
- onPressedOverride:
- Navigator.of(context, rootNavigator: true).pop,
+ onPressedOverride: Navigator.of(
+ context,
+ rootNavigator: true,
+ ).pop,
),
],
),
@@ -230,53 +227,53 @@ class _UnlockWalletKeysDesktopState
enterPassphrase();
}
},
- decoration: standardInputDecoration(
- "Enter password",
- passwordFocusNode,
- context,
- ).copyWith(
- suffixIcon: UnconstrainedBox(
- child: SizedBox(
- height: 70,
- child: Row(
- children: [
- GestureDetector(
- key: const Key(
- "enterUnlockWalletKeysDesktopFieldShowPasswordButtonKey",
- ),
- onTap: () async {
- setState(() {
- hidePassword = !hidePassword;
- });
- },
- child: Container(
- decoration: BoxDecoration(
- color: Colors.transparent,
- borderRadius: BorderRadius.circular(1000),
- ),
- height: 32,
- width: 32,
- child: Center(
- child: SvgPicture.asset(
- hidePassword
- ? Assets.svg.eye
- : Assets.svg.eyeSlash,
- color:
- Theme.of(
+ decoration:
+ standardInputDecoration(
+ "Enter password",
+ passwordFocusNode,
+ context,
+ ).copyWith(
+ suffixIcon: UnconstrainedBox(
+ child: SizedBox(
+ height: 70,
+ child: Row(
+ children: [
+ GestureDetector(
+ key: const Key(
+ "enterUnlockWalletKeysDesktopFieldShowPasswordButtonKey",
+ ),
+ onTap: () async {
+ setState(() {
+ hidePassword = !hidePassword;
+ });
+ },
+ child: Container(
+ decoration: BoxDecoration(
+ color: Colors.transparent,
+ borderRadius: BorderRadius.circular(1000),
+ ),
+ height: 32,
+ width: 32,
+ child: Center(
+ child: SvgPicture.asset(
+ hidePassword
+ ? Assets.svg.eye
+ : Assets.svg.eyeSlash,
+ color: Theme.of(
context,
).extension<StackColors>()!.textDark3,
- width: 24,
- height: 19,
+ width: 24,
+ height: 19,
+ ),
+ ),
),
),
- ),
+ const SizedBox(width: 10),
+ ],
),
- const SizedBox(width: 10),
- ],
+ ),
),
),
- ),
- ),
onChanged: (newValue) {
setState(() {
continueEnabled = newValue.isNotEmpty;
diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_options_button.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_options_button.dart
index 8136133..9a933e5 100644
--- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_options_button.dart
+++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_options_button.dart
@@ -29,8 +29,7 @@ import '../../../../utilities/util.dart';
import '../../../../wallets/crypto_currency/intermediate/frost_currency.dart';
import '../../../../wallets/crypto_currency/intermediate/nano_currency.dart';
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
-import '../../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
+import '../../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
import '../../../../wallets/wallet/wallet_mixin_interfaces/view_only_option_interface.dart';
import '../../../addresses/desktop_wallet_addresses_view.dart';
@@ -63,23 +62,15 @@ enum _WalletOptions {
}
class WalletOptionsButton extends ConsumerWidget {
- const WalletOptionsButton({
- super.key,
- required this.walletId,
- });
+ const WalletOptionsButton({super.key, required this.walletId});
final String walletId;
@override
Widget build(BuildContext context, WidgetRef ref) {
return RawMaterialButton(
- constraints: const BoxConstraints(
- minHeight: 32,
- minWidth: 32,
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(1000),
- ),
+ constraints: const BoxConstraints(minHeight: 32, minWidth: 32),
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(1000)),
onPressed: () async {
final func = await showDialog<_WalletOptions?>(
context: context,
@@ -148,9 +139,10 @@ class WalletOptionsButton extends ConsumerWidget {
case _WalletOptions.showXpub:
final xpubData = await showLoading(
delay: const Duration(milliseconds: 800),
- whileFuture: (ref.read(pWallets).getWallet(walletId)
- as ExtendedKeysInterface)
- .getXPubs(),
+ whileFuture:
+ (ref.read(pWallets).getWallet(walletId)
+ as ExtendedKeysInterface)
+ .getXPubs(),
context: context,
message: "Loading xpubs",
rootNavigator: Util.isDesktop,
@@ -224,9 +216,8 @@ class WalletOptionsButton extends ConsumerWidget {
unawaited(
showDialog(
context: context,
- builder: (context) => EditRefreshHeightView(
- walletId: walletId,
- ),
+ builder: (context) =>
+ EditRefreshHeightView(walletId: walletId),
),
);
} else {
@@ -242,19 +233,16 @@ class WalletOptionsButton extends ConsumerWidget {
}
},
child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 19,
- horizontal: 32,
- ),
+ padding: const EdgeInsets.symmetric(vertical: 19, horizontal: 32),
child: Row(
children: [
SvgPicture.asset(
Assets.svg.ellipsis,
width: 20,
height: 20,
- color: Theme.of(context)
- .extension<StackColors>()!
- .buttonTextSecondary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonTextSecondary,
),
],
),
@@ -297,7 +285,7 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
final bool canChangeRep = coin is NanoCurrency;
final bool isFrost = coin is FrostCurrency;
- final bool isMoneroWow = wallet is LibMoneroWallet || wallet is LibSalviumWallet;
+ final bool isCN = wallet is CryptonoteWallet;
return Stack(
children: [
@@ -339,23 +327,21 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
Expanded(
child: Text(
_WalletOptions.addressList.prettyName,
- style: STextStyles.desktopTextExtraExtraSmall(
- context,
- ).copyWith(
- color: Theme.of(context)
- .extension<StackColors>()!
- .textDark,
- ),
+ style:
+ STextStyles.desktopTextExtraExtraSmall(
+ context,
+ ).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ ),
),
),
],
),
),
),
- if (canChangeRep)
- const SizedBox(
- height: 8,
- ),
+ if (canChangeRep) const SizedBox(height: 8),
if (canChangeRep)
TransparentButton(
onPressed: onChangeRepPressed,
@@ -376,23 +362,21 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
Expanded(
child: Text(
_WalletOptions.changeRepresentative.prettyName,
- style: STextStyles.desktopTextExtraExtraSmall(
- context,
- ).copyWith(
- color: Theme.of(context)
- .extension<StackColors>()!
- .textDark,
- ),
+ style:
+ STextStyles.desktopTextExtraExtraSmall(
+ context,
+ ).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ ),
),
),
],
),
),
),
- if (isFrost)
- const SizedBox(
- height: 8,
- ),
+ if (isFrost) const SizedBox(height: 8),
if (isFrost)
TransparentButton(
onPressed: onFrostMSWalletOptionsPressed,
@@ -413,24 +397,22 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
Expanded(
child: Text(
_WalletOptions.frostOptions.prettyName,
- style: STextStyles.desktopTextExtraExtraSmall(
- context,
- ).copyWith(
- color: Theme.of(context)
- .extension<StackColors>()!
- .textDark,
- ),
+ style:
+ STextStyles.desktopTextExtraExtraSmall(
+ context,
+ ).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ ),
),
),
],
),
),
),
- if (isMoneroWow)
- const SizedBox(
- height: 8,
- ),
- if (isMoneroWow)
+ if (isCN) const SizedBox(height: 8),
+ if (isCN)
TransparentButton(
onPressed: onRefreshHeightPressed,
child: Padding(
@@ -450,23 +432,21 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
Expanded(
child: Text(
_WalletOptions.refreshFromHeight.prettyName,
- style: STextStyles.desktopTextExtraExtraSmall(
- context,
- ).copyWith(
- color: Theme.of(context)
- .extension<StackColors>()!
- .textDark,
- ),
+ style:
+ STextStyles.desktopTextExtraExtraSmall(
+ context,
+ ).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ ),
),
),
],
),
),
),
- if (xpubEnabled)
- const SizedBox(
- height: 8,
- ),
+ if (xpubEnabled) const SizedBox(height: 8),
if (xpubEnabled)
TransparentButton(
onPressed: onShowXpubPressed,
@@ -487,22 +467,21 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
Expanded(
child: Text(
_WalletOptions.showXpub.prettyName,
- style: STextStyles.desktopTextExtraExtraSmall(
- context,
- ).copyWith(
- color: Theme.of(context)
- .extension<StackColors>()!
- .textDark,
- ),
+ style:
+ STextStyles.desktopTextExtraExtraSmall(
+ context,
+ ).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ ),
),
),
],
),
),
),
- const SizedBox(
- height: 8,
- ),
+ const SizedBox(height: 8),
TransparentButton(
onPressed: onDeletePressed,
child: Padding(
@@ -522,13 +501,14 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
Expanded(
child: Text(
_WalletOptions.deleteWallet.prettyName,
- style: STextStyles.desktopTextExtraExtraSmall(
- context,
- ).copyWith(
- color: Theme.of(context)
- .extension<StackColors>()!
- .textDark,
- ),
+ style:
+ STextStyles.desktopTextExtraExtraSmall(
+ context,
+ ).copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ ),
),
),
],
@@ -546,11 +526,7 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
}
class TransparentButton extends StatelessWidget {
- const TransparentButton({
- super.key,
- required this.child,
- this.onPressed,
- });
+ const TransparentButton({super.key, required this.child, this.onPressed});
final Widget child;
final VoidCallback? onPressed;
@@ -558,10 +534,7 @@ class TransparentButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RawMaterialButton(
- constraints: const BoxConstraints(
- minHeight: 32,
- minWidth: 32,
- ),
+ constraints: const BoxConstraints(minHeight: 32, minWidth: 32),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
diff --git a/lib/providers/churning/churning_service_provider.dart b/lib/providers/churning/churning_service_provider.dart
index 642d110..2da0fa5 100644
--- a/lib/providers/churning/churning_service_provider.dart
+++ b/lib/providers/churning/churning_service_provider.dart
@@ -1,12 +1,12 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../services/churning_service.dart';
-import '../../wallets/wallet/intermediate/lib_monero_wallet.dart';
+import '../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../global/wallets_provider.dart';
final pChurningService = ChangeNotifierProvider.family<ChurningService, String>(
(ref, walletId) {
final wallet = ref.watch(pWallets.select((s) => s.getWallet(walletId)));
- return ChurningService(wallet: wallet as LibMoneroWallet);
+ return ChurningService(wallet: wallet as CryptonoteWallet);
},
);
diff --git a/lib/services/churning_service.dart b/lib/services/churning_service.dart
index b1449fd..a7f0819 100644
--- a/lib/services/churning_service.dart
+++ b/lib/services/churning_service.dart
@@ -5,8 +5,9 @@ import 'package:flutter/cupertino.dart';
import 'package:mutex/mutex.dart';
import '../utilities/logger.dart';
-import '../wallets/wallet/intermediate/lib_monero_wallet.dart';
-import '../wl_gen/interfaces/cs_monero_interface.dart';
+import '../wallets/wallet/intermediate/cryptonote_wallet.dart';
+import '../wl_gen/interfaces/cs_monero_interface.dart'
+ show CsRecipient, CsOutput;
enum ChurnStatus { waiting, running, failed, success }
@@ -16,7 +17,7 @@ class ChurningService extends ChangeNotifier {
ChurningService({required this.wallet});
- final LibMoneroWallet wallet;
+ final CryptonoteWallet wallet;
String get walletId => wallet.walletId;
int rounds = 1; // default
@@ -33,7 +34,7 @@ class ChurningService extends ChangeNotifier {
bool _canChurn() {
if (wallet.wallet != null &&
- csMonero.getUnlockedBalance(wallet.wallet!, accountIndex: kAccount)! >
+ wallet.internalGetUnlockedBalance(accountIndex: kAccount)! >
BigInt.zero) {
return true;
} else {
@@ -50,7 +51,7 @@ class ChurningService extends ChangeNotifier {
final outputs = wallet.wallet == null
? <CsOutput>[]
- : await csMonero.getOutputs(wallet.wallet!, refresh: true);
+ : await wallet.internalGetOutputs(refresh: true);
final required = wallet.cryptoCurrency.minConfirms;
int lowestNumberOfConfirms = required;
@@ -185,27 +186,25 @@ class ChurningService extends ChangeNotifier {
}
Future<void> _churnTxSimple() async {
- final address = csMonero.getAddress(
- wallet.wallet!,
+ final address = wallet.internalGetAddress(
accountIndex: kAccount,
addressIndex: 0,
);
final height = await wallet.chainHeight;
- final pending = await csMonero.createTx(
- wallet.wallet!,
+ final pending = await wallet.internalCreateTx(
output: CsRecipient(
address,
BigInt.zero, // Doesn't matter if `sweep` is true
),
- priority: csMonero.getTxPriorityNormal(),
+ priority: wallet.getTxPriorityNormal(),
accountIndex: kAccount,
sweep: true,
minConfirms: wallet.cryptoCurrency.minConfirms,
currentHeight: height,
);
- await csMonero.commitTx(wallet.wallet!, pending);
+ await wallet.internalCommitTx(pending);
}
}
diff --git a/lib/services/wallets.dart b/lib/services/wallets.dart
index ffdfbdc..d802842 100644
--- a/lib/services/wallets.dart
+++ b/lib/services/wallets.dart
@@ -27,7 +27,7 @@ import '../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
import '../wallets/isar/models/wallet_info.dart';
import '../wallets/wallet/impl/epiccash_wallet.dart';
import '../wallets/wallet/impl/mimblewimblecoin_wallet.dart';
-import '../wallets/wallet/intermediate/lib_monero_wallet.dart';
+import '../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../wallets/wallet/intermediate/lib_salvium_wallet.dart';
import '../wallets/wallet/wallet.dart';
import 'event_bus/events/wallet_added_event.dart';
@@ -201,11 +201,10 @@ class Wallets {
boxName: DB.boxNameWalletsToDeleteOnStart,
)) {
await mainDB.isar.writeTxn(
- () async =>
- await mainDB.isar.walletInfo
- .where()
- .walletIdEqualTo(walletId)
- .deleteAll(),
+ () async => await mainDB.isar.walletInfo
+ .where()
+ .walletIdEqualTo(walletId)
+ .deleteAll(),
);
}
// clear list
@@ -262,7 +261,7 @@ class Wallets {
shouldAutoSyncAll ||
walletIdsToEnableAutoSync.contains(walletInfo.walletId);
- if (wallet is LibMoneroWallet || wallet is LibSalviumWallet) {
+ if (wallet is CryptonoteWallet) {
// walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
} else {
walletInitFutures.add(
@@ -310,11 +309,10 @@ class Wallets {
boxName: DB.boxNameWalletsToDeleteOnStart,
)) {
await mainDB.isar.writeTxn(
- () async =>
- await mainDB.isar.walletInfo
- .where()
- .walletIdEqualTo(walletId)
- .deleteAll(),
+ () async => await mainDB.isar.walletInfo
+ .where()
+ .walletIdEqualTo(walletId)
+ .deleteAll(),
);
}
// clear list
@@ -371,7 +369,7 @@ class Wallets {
nodeService: nodeService,
prefs: prefs,
).then((wallet) {
- if (wallet is LibMoneroWallet || wallet is LibSalviumWallet) {
+ if (wallet is CryptonoteWallet) {
// walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
walletIdCompleter.complete("dummy_ignore");
@@ -394,17 +392,15 @@ class Wallets {
final asyncWalletIds = await Future.wait(walletIDInitFutures);
asyncWalletIds.removeWhere((e) => e == "dummy_ignore");
- final List<Future<void>> walletInitFutures =
- asyncWalletIds
- .map(
- (id) => _wallets[id]!.init().then((_) {
- if (shouldAutoSyncAll ||
- walletIdsToEnableAutoSync.contains(id)) {
- _wallets[id]!.shouldAutoSync = true;
- }
- }),
- )
- .toList();
+ final List<Future<void>> walletInitFutures = asyncWalletIds
+ .map(
+ (id) => _wallets[id]!.init().then((_) {
+ if (shouldAutoSyncAll || walletIdsToEnableAutoSync.contains(id)) {
+ _wallets[id]!.shouldAutoSync = true;
+ }
+ }),
+ )
+ .toList();
if (walletInitFutures.isNotEmpty && walletsToInitLinearly.isNotEmpty) {
unawaited(
@@ -435,11 +431,10 @@ class Wallets {
boxName: DB.boxNameWalletsToDeleteOnStart,
)) {
await mainDB.isar.writeTxn(
- () async =>
- await mainDB.isar.walletInfo
- .where()
- .walletIdEqualTo(walletId)
- .deleteAll(),
+ () async => await mainDB.isar.walletInfo
+ .where()
+ .walletIdEqualTo(walletId)
+ .deleteAll(),
);
}
// clear list
@@ -447,15 +442,14 @@ class Wallets {
boxName: DB.boxNameWalletsToDeleteOnStart,
);
- final walletInfoList =
- await mainDB.isar.walletInfo
- .where()
- .filter()
- .anyOf<String, CryptoCurrency>(
- AppConfig.coins.map((e) => e.identifier),
- (q, element) => q.coinNameMatches(element),
- )
- .findAll();
+ final walletInfoList = await mainDB.isar.walletInfo
+ .where()
+ .filter()
+ .anyOf<String, CryptoCurrency>(
+ AppConfig.coins.map((e) => e.identifier),
+ (q, element) => q.coinNameMatches(element),
+ )
+ .findAll();
if (isDuress) {
walletInfoList.retainWhere((e) => e.isDuressVisible);
@@ -509,7 +503,7 @@ class Wallets {
nodeService: nodeService,
prefs: prefs,
).then((wallet) {
- if (wallet is LibMoneroWallet || wallet is LibSalviumWallet) {
+ if (wallet is CryptonoteWallet) {
// walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
walletIdCompleter.complete("dummy_ignore");
@@ -533,17 +527,16 @@ class Wallets {
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();
+ 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();
@@ -620,7 +613,7 @@ class Wallets {
walletIdsToEnableAutoSync.contains(wallet.walletId);
if (isDesktop) {
- if (wallet is LibMoneroWallet || wallet is LibSalviumWallet) {
+ if (wallet is CryptonoteWallet) {
// walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
} else {
walletInitFutures.add(
diff --git a/lib/wallets/wallet/intermediate/cryptonote_wallet.dart b/lib/wallets/wallet/intermediate/cryptonote_wallet.dart
index 0d32e07..6023434 100644
--- a/lib/wallets/wallet/intermediate/cryptonote_wallet.dart
+++ b/lib/wallets/wallet/intermediate/cryptonote_wallet.dart
@@ -1,10 +1,65 @@
+import 'package:meta/meta.dart';
+
+import '../../../models/input.dart';
+import '../../../models/keys/cw_key_data.dart';
+import '../../../wl_gen/interfaces/cs_monero_interface.dart'
+ show CsOutput, CsPendingTransaction, CsRecipient;
+import '../../../wl_gen/interfaces/cs_salvium_interface.dart';
import '../../crypto_currency/intermediate/cryptonote_currency.dart';
-import '../wallet.dart';
import '../wallet_mixin_interfaces/coin_control_interface.dart';
import '../wallet_mixin_interfaces/mnemonic_interface.dart';
import 'external_wallet.dart';
-abstract class CryptonoteWallet<T extends CryptonoteCurrency> extends ExternalWallet<T>
+abstract class CryptonoteWallet<T extends CryptonoteCurrency>
+ extends ExternalWallet<T>
with MnemonicInterface<T>, CoinControlInterface<T> {
CryptonoteWallet(super.currency);
+
+ WrappedWallet? wallet;
+
+ double highestPercentCached = 0;
+ int currentKnownChainHeight = 0;
+
+ @mustCallSuper
+ @override
+ Future<void> init({bool? isRestore, int? wordCount});
+
+ Future<CWKeyData?> getKeys();
+
+ String getTxKeyFor({required String txid});
+
+ Future<(String, String)>
+ hackToCreateNewViewOnlyWalletDataFromNewlyCreatedWalletThisFunctionShouldNotBeCalledUnlessYouKnowWhatYouAreDoing();
+
+ void setRefreshFromBlockHeight(int newHeight);
+
+ int getRefreshFromBlockHeight();
+
+ String internalGetAddress({
+ required int accountIndex,
+ required int addressIndex,
+ });
+
+ BigInt? internalGetUnlockedBalance({int accountIndex = 0});
+ Future<List<CsOutput>> internalGetOutputs({
+ bool refresh = false,
+ bool includeSpent = false,
+ });
+
+ Future<CsPendingTransaction> internalCreateTx({
+ required CsRecipient output,
+ required int priority,
+ required bool sweep,
+ List<StandardInput>? preferredInputs,
+ required int accountIndex,
+ required int minConfirms,
+ required int currentHeight,
+ });
+
+ Future<void> internalCommitTx(CsPendingTransaction tx);
+
+ // tx prio forwarding
+ int getTxPriorityHigh();
+ int getTxPriorityMedium();
+ int getTxPriorityNormal();
}
diff --git a/lib/wallets/wallet/intermediate/lib_monero_wallet.dart b/lib/wallets/wallet/intermediate/lib_monero_wallet.dart
index 38ca63e..bea4547 100644
--- a/lib/wallets/wallet/intermediate/lib_monero_wallet.dart
+++ b/lib/wallets/wallet/intermediate/lib_monero_wallet.dart
@@ -51,8 +51,6 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
@override
int get isarTransactionVersion => 2;
- WrappedWallet? wallet;
-
LibMoneroWallet(super.currency, this.compatType) {
final bus = GlobalEventBus.instance;
@@ -135,8 +133,6 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
bool _txRefreshLock = false;
int _lastCheckedHeight = -1;
int _txCount = 0;
- int currentKnownChainHeight = 0;
- double highestPercentCached = 0;
Future<WrappedWallet> loadWallet({
required String path,
@@ -170,6 +166,7 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
bool walletExists(String path);
+ @override
String getTxKeyFor({required String txid}) {
if (wallet == null) {
throw Exception("Cannot get tx key in uninitialized libMoneroWallet");
@@ -293,6 +290,7 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
return newReceivingAddress;
}
+ @override
Future<CWKeyData?> getKeys() async {
final oldInfo = getLibMoneroWalletInfo(walletId);
if (wallet == null || (oldInfo != null && oldInfo.name != walletId)) {
@@ -318,6 +316,7 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
}
}
+ @override
Future<(String, String)>
hackToCreateNewViewOnlyWalletDataFromNewlyCreatedWalletThisFunctionShouldNotBeCalledUnlessYouKnowWhatYouAreDoing() async {
final path = await pathForWallet(name: walletId, type: compatType);
@@ -1416,6 +1415,102 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
}
}
+ @override
+ int getRefreshFromBlockHeight() => wallet == null
+ ? throw Exception(
+ "Cannot getRefreshFromBlockHeight when wallet is not open",
+ )
+ : csMonero.getRefreshFromBlockHeight(wallet!);
+
+ @override
+ int getTxPriorityHigh() => csMonero.getTxPriorityHigh();
+
+ @override
+ int getTxPriorityMedium() => csMonero.getTxPriorityMedium();
+
+ @override
+ int getTxPriorityNormal() => csMonero.getTxPriorityNormal();
+
+ @override
+ Future<void> internalCommitTx(CsPendingTransaction tx) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+
+ return csMonero.commitTx(wallet!, tx);
+ }
+
+ @override
+ Future<CsPendingTransaction> internalCreateTx({
+ required CsRecipient output,
+ required int priority,
+ required bool sweep,
+ List<StandardInput>? preferredInputs,
+ required int accountIndex,
+ required int minConfirms,
+ required int currentHeight,
+ }) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csMonero.createTx(
+ wallet!,
+ output: output,
+ priority: priority,
+ sweep: sweep,
+ accountIndex: accountIndex,
+ minConfirms: minConfirms,
+ currentHeight: currentHeight,
+ preferredInputs: preferredInputs,
+ );
+ }
+
+ @override
+ String internalGetAddress({
+ required int accountIndex,
+ required int addressIndex,
+ }) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csMonero.getAddress(
+ wallet!,
+ accountIndex: accountIndex,
+ addressIndex: addressIndex,
+ );
+ }
+
+ @override
+ Future<List<CsOutput>> internalGetOutputs({
+ bool refresh = false,
+ bool includeSpent = false,
+ }) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csMonero.getOutputs(
+ wallet!,
+ refresh: refresh,
+ includeSpent: includeSpent,
+ );
+ }
+
+ @override
+ BigInt? internalGetUnlockedBalance({int accountIndex = 0}) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csMonero.getUnlockedBalance(wallet!, accountIndex: accountIndex);
+ }
+
+ @override
+ void setRefreshFromBlockHeight(int newHeight) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ csMonero.setRefreshFromBlockHeight(wallet!, newHeight);
+ }
+
// ============== View only ==================================================
@override
diff --git a/lib/wallets/wallet/intermediate/lib_salvium_wallet.dart b/lib/wallets/wallet/intermediate/lib_salvium_wallet.dart
index 4081c90..020fe1a 100644
--- a/lib/wallets/wallet/intermediate/lib_salvium_wallet.dart
+++ b/lib/wallets/wallet/intermediate/lib_salvium_wallet.dart
@@ -49,8 +49,6 @@ abstract class LibSalviumWallet<T extends CryptonoteCurrency>
@override
int get isarTransactionVersion => 2;
- WrappedWallet? wallet;
-
LibSalviumWallet(super.currency) {
final bus = GlobalEventBus.instance;
@@ -131,8 +129,6 @@ abstract class LibSalviumWallet<T extends CryptonoteCurrency>
bool _txRefreshLock = false;
int _lastCheckedHeight = -1;
int _txCount = 0;
- int currentKnownChainHeight = 0;
- double highestPercentCached = 0;
Future<WrappedWallet> loadWallet({
required String path,
@@ -166,6 +162,7 @@ abstract class LibSalviumWallet<T extends CryptonoteCurrency>
bool walletExists(String path);
+ @override
String getTxKeyFor({required String txid}) {
if (wallet == null) {
throw Exception("Cannot get tx key in uninitialized libSalviumWallet");
@@ -274,6 +271,7 @@ abstract class LibSalviumWallet<T extends CryptonoteCurrency>
return newReceivingAddress;
}
+ @override
Future<CWKeyData?> getKeys() async {
if (wallet == null) {
return null;
@@ -298,6 +296,7 @@ abstract class LibSalviumWallet<T extends CryptonoteCurrency>
}
}
+ @override
Future<(String, String)>
hackToCreateNewViewOnlyWalletDataFromNewlyCreatedWalletThisFunctionShouldNotBeCalledUnlessYouKnowWhatYouAreDoing() async {
final path = await pathForWallet(name: walletId);
@@ -1409,6 +1408,102 @@ abstract class LibSalviumWallet<T extends CryptonoteCurrency>
}
}
+ @override
+ int getRefreshFromBlockHeight() => wallet == null
+ ? throw Exception(
+ "Cannot getRefreshFromBlockHeight when wallet is not open",
+ )
+ : csSalvium.getRefreshFromBlockHeight(wallet!);
+
+ @override
+ int getTxPriorityHigh() => csSalvium.getTxPriorityHigh();
+
+ @override
+ int getTxPriorityMedium() => csSalvium.getTxPriorityMedium();
+
+ @override
+ int getTxPriorityNormal() => csSalvium.getTxPriorityNormal();
+
+ @override
+ Future<void> internalCommitTx(CsPendingTransaction tx) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+
+ return csSalvium.commitTx(wallet!, tx);
+ }
+
+ @override
+ Future<CsPendingTransaction> internalCreateTx({
+ required CsRecipient output,
+ required int priority,
+ required bool sweep,
+ List<StandardInput>? preferredInputs,
+ required int accountIndex,
+ required int minConfirms,
+ required int currentHeight,
+ }) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csSalvium.createTx(
+ wallet!,
+ output: output,
+ priority: priority,
+ sweep: sweep,
+ accountIndex: accountIndex,
+ minConfirms: minConfirms,
+ currentHeight: currentHeight,
+ preferredInputs: preferredInputs,
+ );
+ }
+
+ @override
+ String internalGetAddress({
+ required int accountIndex,
+ required int addressIndex,
+ }) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csSalvium.getAddress(
+ wallet!,
+ accountIndex: accountIndex,
+ addressIndex: addressIndex,
+ );
+ }
+
+ @override
+ Future<List<CsOutput>> internalGetOutputs({
+ bool refresh = false,
+ bool includeSpent = false,
+ }) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csSalvium.getOutputs(
+ wallet!,
+ refresh: refresh,
+ includeSpent: includeSpent,
+ );
+ }
+
+ @override
+ BigInt? internalGetUnlockedBalance({int accountIndex = 0}) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csSalvium.getUnlockedBalance(wallet!, accountIndex: accountIndex);
+ }
+
+ @override
+ void setRefreshFromBlockHeight(int newHeight) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ csSalvium.setRefreshFromBlockHeight(wallet!, newHeight);
+ }
+
// ============== View only ==================================================
@override
diff --git a/lib/wallets/wallet/intermediate/lib_wownero_wallet.dart b/lib/wallets/wallet/intermediate/lib_wownero_wallet.dart
index cf47fb9..b6ad2ef 100644
--- a/lib/wallets/wallet/intermediate/lib_wownero_wallet.dart
+++ b/lib/wallets/wallet/intermediate/lib_wownero_wallet.dart
@@ -52,8 +52,6 @@ abstract class LibWowneroWallet<T extends CryptonoteCurrency>
@override
int get isarTransactionVersion => 2;
- WrappedWallet? wallet;
-
LibWowneroWallet(super.currency, this.compatType) {
final bus = GlobalEventBus.instance;
@@ -136,8 +134,6 @@ abstract class LibWowneroWallet<T extends CryptonoteCurrency>
bool _txRefreshLock = false;
int _lastCheckedHeight = -1;
int _txCount = 0;
- int currentKnownChainHeight = 0;
- double highestPercentCached = 0;
Future<WrappedWallet> loadWallet({
required String path,
@@ -171,6 +167,7 @@ abstract class LibWowneroWallet<T extends CryptonoteCurrency>
bool walletExists(String path);
+ @override
String getTxKeyFor({required String txid}) {
if (wallet == null) {
throw Exception("Cannot get tx key in uninitialized LibWowneroWallet");
@@ -294,6 +291,7 @@ abstract class LibWowneroWallet<T extends CryptonoteCurrency>
return newReceivingAddress;
}
+ @override
Future<CWKeyData?> getKeys() async {
final oldInfo = getLibWowneroWalletInfo(walletId);
if (wallet == null || (oldInfo != null && oldInfo.name != walletId)) {
@@ -319,6 +317,7 @@ abstract class LibWowneroWallet<T extends CryptonoteCurrency>
}
}
+ @override
Future<(String, String)>
hackToCreateNewViewOnlyWalletDataFromNewlyCreatedWalletThisFunctionShouldNotBeCalledUnlessYouKnowWhatYouAreDoing() async {
final path = await pathForWallet(name: walletId, type: compatType);
@@ -1420,6 +1419,102 @@ abstract class LibWowneroWallet<T extends CryptonoteCurrency>
}
}
+ @override
+ int getRefreshFromBlockHeight() => wallet == null
+ ? throw Exception(
+ "Cannot getRefreshFromBlockHeight when wallet is not open",
+ )
+ : csWownero.getRefreshFromBlockHeight(wallet!);
+
+ @override
+ int getTxPriorityHigh() => csWownero.getTxPriorityHigh();
+
+ @override
+ int getTxPriorityMedium() => csWownero.getTxPriorityMedium();
+
+ @override
+ int getTxPriorityNormal() => csWownero.getTxPriorityNormal();
+
+ @override
+ Future<void> internalCommitTx(CsPendingTransaction tx) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+
+ return csWownero.commitTx(wallet!, tx);
+ }
+
+ @override
+ Future<CsPendingTransaction> internalCreateTx({
+ required CsRecipient output,
+ required int priority,
+ required bool sweep,
+ List<StandardInput>? preferredInputs,
+ required int accountIndex,
+ required int minConfirms,
+ required int currentHeight,
+ }) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csWownero.createTx(
+ wallet!,
+ output: output,
+ priority: priority,
+ sweep: sweep,
+ accountIndex: accountIndex,
+ minConfirms: minConfirms,
+ currentHeight: currentHeight,
+ preferredInputs: preferredInputs,
+ );
+ }
+
+ @override
+ String internalGetAddress({
+ required int accountIndex,
+ required int addressIndex,
+ }) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csWownero.getAddress(
+ wallet!,
+ accountIndex: accountIndex,
+ addressIndex: addressIndex,
+ );
+ }
+
+ @override
+ Future<List<CsOutput>> internalGetOutputs({
+ bool refresh = false,
+ bool includeSpent = false,
+ }) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csWownero.getOutputs(
+ wallet!,
+ refresh: refresh,
+ includeSpent: includeSpent,
+ );
+ }
+
+ @override
+ BigInt? internalGetUnlockedBalance({int accountIndex = 0}) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ return csWownero.getUnlockedBalance(wallet!, accountIndex: accountIndex);
+ }
+
+ @override
+ void setRefreshFromBlockHeight(int newHeight) {
+ if (wallet == null) {
+ throw Exception("Cannot internalCommitTx when wallet is not open");
+ }
+ csWownero.setRefreshFromBlockHeight(wallet!, newHeight);
+ }
+
// ============== View only ==================================================
@override
diff --git a/lib/widgets/desktop/desktop_fee_dialog.dart b/lib/widgets/desktop/desktop_fee_dialog.dart
index 5f9d163..3ec5124 100644
--- a/lib/widgets/desktop/desktop_fee_dialog.dart
+++ b/lib/widgets/desktop/desktop_fee_dialog.dart
@@ -15,8 +15,7 @@ import '../../utilities/text_styles.dart';
import '../../wallets/crypto_currency/crypto_currency.dart';
import '../../wallets/isar/providers/eth/current_token_wallet_provider.dart';
import '../../wallets/wallet/impl/firo_wallet.dart';
-import '../../wl_gen/interfaces/cs_monero_interface.dart';
-import '../../wl_gen/interfaces/cs_wownero_interface.dart';
+import '../../wallets/wallet/intermediate/cryptonote_wallet.dart';
import '../animated_text.dart';
import '../conditional_parent.dart';
import 'desktop_dialog.dart';
@@ -61,16 +60,10 @@ class _DesktopFeeDialogState extends ConsumerState<DesktopFeeDialog> {
if (widget.isToken == false) {
final wallet = ref.read(pWallets).getWallet(walletId);
- if (coin is Monero) {
+ if (wallet is CryptonoteWallet) {
final fee = await wallet.estimateFeeFor(
amount,
- BigInt.from(csMonero.getTxPriorityHigh()),
- );
- ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
- } else if (coin is Wownero) {
- final fee = await wallet.estimateFeeFor(
- amount,
- BigInt.from(csWownero.getTxPriorityHigh()),
+ BigInt.from(wallet.getTxPriorityHigh()),
);
ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
} else if (coin is Firo) {
@@ -117,16 +110,10 @@ class _DesktopFeeDialogState extends ConsumerState<DesktopFeeDialog> {
if (widget.isToken == false) {
final wallet = ref.read(pWallets).getWallet(walletId);
- if (coin is Monero) {
- final fee = await wallet.estimateFeeFor(
- amount,
- BigInt.from(csMonero.getTxPriorityMedium()),
- );
- ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
- } else if (coin is Wownero) {
+ if (wallet is CryptonoteWallet) {
final fee = await wallet.estimateFeeFor(
amount,
- BigInt.from(csWownero.getTxPriorityMedium()),
+ BigInt.from(wallet.getTxPriorityMedium()),
);
ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
} else if (coin is Firo) {
@@ -173,16 +160,10 @@ class _DesktopFeeDialogState extends ConsumerState<DesktopFeeDialog> {
if (widget.isToken == false) {
final wallet = ref.read(pWallets).getWallet(walletId);
- if (coin is Monero) {
- final fee = await wallet.estimateFeeFor(
- amount,
- BigInt.from(csMonero.getTxPriorityNormal()),
- );
- ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
- } else if (coin is Wownero) {
+ if (wallet is CryptonoteWallet) {
final fee = await wallet.estimateFeeFor(
amount,
- BigInt.from(csWownero.getTxPriorityNormal()),
+ BigInt.from(wallet.getTxPriorityNormal()),
);
ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
} else if (coin is Firo) {
diff --git a/lib/widgets/tx_key_widget.dart b/lib/widgets/tx_key_widget.dart
index f9e1fb4..8222fdb 100644
--- a/lib/widgets/tx_key_widget.dart
+++ b/lib/widgets/tx_key_widget.dart
@@ -8,13 +8,13 @@ import '../pages_desktop_specific/password/request_desktop_auth_dialog.dart';
import '../providers/global/wallets_provider.dart';
import '../utilities/text_styles.dart';
import '../utilities/util.dart';
-import '../wallets/wallet/intermediate/lib_monero_wallet.dart';
+import '../wallets/wallet/intermediate/cryptonote_wallet.dart';
import 'custom_buttons/blue_text_button.dart';
import 'custom_buttons/simple_copy_button.dart';
import 'detail_item.dart';
class TxKeyWidget extends ConsumerStatefulWidget {
- /// The [walletId] MUST be the id of a [LibMoneroWallet]!
+ /// The [walletId] MUST be the id of a [CryptonoteWallet]!
const TxKeyWidget({super.key, required this.walletId, required this.txid});
final String walletId;
@@ -38,24 +38,20 @@ class _TxKeyWidgetState extends ConsumerState<TxKeyWidget> {
try {
final verified = await showDialog<String?>(
context: context,
- builder:
- (context) =>
- Util.isDesktop
- ? const RequestDesktopAuthDialog(
- title: "Show private view key",
- )
- : const PinpadDialog(
- biometricsAuthenticationTitle: "Show private view key",
- biometricsLocalizedReason:
- "Authenticate to show private view key",
- biometricsCancelButtonString: "CANCEL",
- ),
+ builder: (context) => Util.isDesktop
+ ? const RequestDesktopAuthDialog(title: "Show private view key")
+ : const PinpadDialog(
+ biometricsAuthenticationTitle: "Show private view key",
+ biometricsLocalizedReason:
+ "Authenticate to show private view key",
+ biometricsCancelButtonString: "CANCEL",
+ ),
barrierDismissible: !Util.isDesktop,
);
if (verified == "verified success" && mounted) {
final wallet =
- ref.read(pWallets).getWallet(widget.walletId) as LibMoneroWallet;
+ ref.read(pWallets).getWallet(widget.walletId) as CryptonoteWallet;
_private = wallet.getTxKeyFor(txid: widget.txid);
if (_private!.isEmpty) {
@@ -76,16 +72,15 @@ class _TxKeyWidgetState extends ConsumerState<TxKeyWidget> {
@override
Widget build(BuildContext context) {
return DetailItemBase(
- button:
- _private == null
- ? CustomTextButton(
- text: "Show",
- onTap: _loadTxKey,
- enabled: _private == null,
- )
- : Util.isDesktop
- ? tvd.IconCopyButton(data: _private!)
- : SimpleCopyButton(data: _private!),
+ button: _private == null
+ ? CustomTextButton(
+ text: "Show",
+ onTap: _loadTxKey,
+ enabled: _private == null,
+ )
+ : Util.isDesktop
+ ? tvd.IconCopyButton(data: _private!)
+ : SimpleCopyButton(data: _private!),
title: Text("Private view key", style: STextStyles.itemSubtitle(context)),
detail: SelectableText(
// TODO
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.