some clean up and imports fixing from merge

This commit is contained in:
julian 2024-05-27 11:24:11 -06:00
parent 15b39097bc
commit aac27636ee
6 changed files with 161 additions and 130 deletions

View file

@ -9,7 +9,6 @@
*/
import 'dart:async';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@ -149,8 +148,10 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
if (contracts.isEmpty) {
contracts.addAll(DefaultTokens.list);
MainDB.instance.putEthContracts(contracts).then((value) =>
ref.read(priceAnd24hChangeNotifierProvider).updatePrice());
MainDB.instance.putEthContracts(contracts).then(
(value) =>
ref.read(priceAnd24hChangeNotifierProvider).updatePrice(),
);
}
tokenEntities.addAll(contracts.map((e) => EthTokenEntity(e)));
@ -349,63 +350,63 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
height: 16,
),
ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: Semantics(
label:
"Search Text Field. Inputs Text To Search In Wallets.",
excludeSemantics: true,
child: TextField(
autofocus: isDesktop,
autocorrect: !isDesktop,
enableSuggestions: !isDesktop,
controller: _searchFieldController,
focusNode: _searchFocusNode,
onChanged: (value) =>
setState(() => _searchTerm = value),
style: STextStyles.field(context),
decoration: standardInputDecoration(
"Search",
_searchFocusNode,
context,
desktopMed: isDesktop,
).copyWith(
prefixIcon: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 16,
),
child: SvgPicture.asset(
Assets.svg.search,
width: 16,
height: 16,
),
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: Semantics(
label:
"Search Text Field. Inputs Text To Search In Wallets.",
excludeSemantics: true,
child: TextField(
autofocus: isDesktop,
autocorrect: !isDesktop,
enableSuggestions: !isDesktop,
controller: _searchFieldController,
focusNode: _searchFocusNode,
onChanged: (value) =>
setState(() => _searchTerm = value),
style: STextStyles.field(context),
decoration: standardInputDecoration(
"Search",
_searchFocusNode,
context,
desktopMed: isDesktop,
).copyWith(
prefixIcon: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 16,
),
child: SvgPicture.asset(
Assets.svg.search,
width: 16,
height: 16,
),
suffixIcon: _searchFieldController.text.isNotEmpty
? Padding(
padding: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_searchFieldController.text =
"";
_searchTerm = "";
});
},
),
],
),
),
)
: null,
),
suffixIcon: _searchFieldController.text.isNotEmpty
? Padding(
padding: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_searchFieldController.text = "";
_searchTerm = "";
});
},
),
],
),
),
)
: null,
),
)),
),
),
),
const SizedBox(
height: 10,
),

View file

@ -12,13 +12,8 @@ import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import '../../create_or_restore_wallet_view/sub_widgets/coin_image.dart';
import 'sub_widgets/mobile_mnemonic_length_selector.dart';
import 'sub_widgets/restore_from_date_picker.dart';
import 'sub_widgets/restore_options_next_button.dart';
import 'sub_widgets/restore_options_platform_layout.dart';
import '../restore_wallet_view.dart';
import '../sub_widgets/mnemonic_word_count_select_sheet.dart';
import 'package:tuple/tuple.dart';
import '../../../../pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart';
import '../../../../providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart';
import '../../../../themes/stack_colors.dart';
@ -27,9 +22,6 @@ import '../../../../utilities/constants.dart';
import '../../../../utilities/format.dart';
import '../../../../utilities/text_styles.dart';
import '../../../../utilities/util.dart';
import '../../../../wallets/crypto_currency/coins/epiccash.dart';
import '../../../../wallets/crypto_currency/coins/monero.dart';
import '../../../../wallets/crypto_currency/coins/wownero.dart';
import '../../../../wallets/crypto_currency/crypto_currency.dart';
import '../../../../widgets/conditional_parent.dart';
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
@ -39,7 +31,13 @@ import '../../../../widgets/desktop/desktop_scaffold.dart';
import '../../../../widgets/expandable.dart';
import '../../../../widgets/rounded_white_container.dart';
import '../../../../widgets/stack_text_field.dart';
import 'package:tuple/tuple.dart';
import '../../create_or_restore_wallet_view/sub_widgets/coin_image.dart';
import '../restore_wallet_view.dart';
import '../sub_widgets/mnemonic_word_count_select_sheet.dart';
import 'sub_widgets/mobile_mnemonic_length_selector.dart';
import 'sub_widgets/restore_from_date_picker.dart';
import 'sub_widgets/restore_options_next_button.dart';
import 'sub_widgets/restore_options_platform_layout.dart';
class RestoreOptionsView extends ConsumerStatefulWidget {
const RestoreOptionsView({
@ -220,8 +218,8 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
height: isDesktop ? 40 : 24,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
@ -237,9 +235,9 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
: STextStyles.smallMed12(context),
textAlign: TextAlign.left,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
@ -247,9 +245,9 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
SizedBox(
height: isDesktop ? 16 : 8,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
@ -259,8 +257,9 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
onTap: chooseDate,
controller: _dateController,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state == 25) ||
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
@ -272,8 +271,8 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
controller: _dateController,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
@ -281,9 +280,9 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
const SizedBox(
height: 8,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
@ -304,9 +303,9 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
),
),
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
@ -411,8 +410,8 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
"Advanced",
style: isDesktop
? STextStyles.desktopTextExtraExtraSmall(
context)
.copyWith(
context,
).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark3,
@ -474,7 +473,8 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
),
GestureDetector(
key: const Key(
"mnemonicPassphraseFieldShowPasswordButtonKey"),
"mnemonicPassphraseFieldShowPasswordButtonKey",
),
onTap: () async {
setState(() {
hidePassword = !hidePassword;

View file

@ -13,10 +13,11 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import '../../../app_config.dart';
import '../../../pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart';
import '../../../providers/providers.dart';
import '../../../route_generator.dart';
import '../../../app_config.dart';
import '../../../themes/coin_icon_provider.dart';
import '../../../themes/stack_colors.dart';
import '../../../utilities/assets.dart';

View file

@ -19,15 +19,19 @@ import 'package:flutter_libmonero/core/wallet_creation_service.dart';
import 'package:flutter_libmonero/monero/monero.dart' as xmr_dart;
import 'package:flutter_libmonero/view_model/send/output.dart' as monero_output;
import 'package:isar/isar.dart';
import 'package:mutex/mutex.dart';
import 'package:tuple/tuple.dart';
import '../../../db/hive/db.dart';
import '../../../models/isar/models/blockchain_data/address.dart';
import '../../../models/isar/models/blockchain_data/transaction.dart';
import '../../../services/event_bus/events/global/tor_connection_status_changed_event.dart';
import '../../../services/event_bus/events/global/tor_status_changed_event.dart';
import '../../../services/event_bus/global_event_bus.dart';
import '../../../services/tor_service.dart';
import '../../../utilities/amount/amount.dart';
import '../../../utilities/enums/fee_rate_type_enum.dart';
import '../../../utilities/logger.dart';
import '../../crypto_currency/coins/monero.dart';
import '../../crypto_currency/crypto_currency.dart';
import '../../models/tx_data.dart';
import '../intermediate/cryptonote_wallet.dart';
@ -390,7 +394,8 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
// subtract a couple days to ensure we have a buffer for SWB
final bufferedCreateHeight = xmr_dart.monero.getHeigthByDate(
date: DateTime.now().subtract(const Duration(days: 2)));
date: DateTime.now().subtract(const Duration(days: 2)),
);
await info.updateRestoreHeight(
newRestoreHeight: bufferedCreateHeight,
@ -528,8 +533,9 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
CwBasedInterface.cwWalletBase?.close();
} catch (e, s) {
Logging.instance.log(
"Exception rethrown from recoverFromMnemonic(): $e\n$s",
level: LogLevel.Error);
"Exception rethrown from recoverFromMnemonic(): $e\n$s",
level: LogLevel.Error,
);
rethrow;
}
});
@ -586,8 +592,10 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
CwBasedInterface.cwWalletBase!.createTransaction(tmp);
});
} catch (e, s) {
Logging.instance.log("Exception rethrown from prepareSend(): $e\n$s",
level: LogLevel.Warning);
Logging.instance.log(
"Exception rethrown from prepareSend(): $e\n$s",
level: LogLevel.Warning,
);
}
final PendingMoneroTransaction pendingMoneroTransaction =
@ -605,8 +613,10 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
throw ArgumentError("Invalid fee rate argument provided!");
}
} catch (e, s) {
Logging.instance.log("Exception rethrown from prepare send(): $e\n$s",
level: LogLevel.Info);
Logging.instance.log(
"Exception rethrown from prepare send(): $e\n$s",
level: LogLevel.Info,
);
if (e.toString().contains("Incorrect unlocked balance")) {
throw Exception("Insufficient balance!");
@ -624,17 +634,22 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
try {
await txData.pendingMoneroTransaction!.commit();
Logging.instance.log(
"transaction ${txData.pendingMoneroTransaction!.id} has been sent",
level: LogLevel.Info);
"transaction ${txData.pendingMoneroTransaction!.id} has been sent",
level: LogLevel.Info,
);
return txData.copyWith(txid: txData.pendingMoneroTransaction!.id);
} catch (e, s) {
Logging.instance.log("${info.name} monero confirmSend: $e\n$s",
level: LogLevel.Error);
Logging.instance.log(
"${info.name} monero confirmSend: $e\n$s",
level: LogLevel.Error,
);
rethrow;
}
} catch (e, s) {
Logging.instance.log("Exception rethrown from confirmSend(): $e\n$s",
level: LogLevel.Info);
Logging.instance.log(
"Exception rethrown from confirmSend(): $e\n$s",
level: LogLevel.Info,
);
rethrow;
}
}

View file

@ -20,21 +20,24 @@ import 'package:flutter_libmonero/view_model/send/output.dart'
as wownero_output;
import 'package:flutter_libmonero/wownero/wownero.dart' as wow_dart;
import 'package:isar/isar.dart';
import 'package:mutex/mutex.dart';
import 'package:tuple/tuple.dart';
import '../../../db/hive/db.dart';
import '../../../models/isar/models/blockchain_data/address.dart';
import '../../../models/isar/models/blockchain_data/transaction.dart';
import '../../../services/event_bus/events/global/tor_connection_status_changed_event.dart';
import '../../../services/event_bus/events/global/tor_status_changed_event.dart';
import '../../../services/event_bus/global_event_bus.dart';
import '../../../services/tor_service.dart';
import '../../../utilities/amount/amount.dart';
import '../../../utilities/enums/fee_rate_type_enum.dart';
import '../../../utilities/logger.dart';
import '../../crypto_currency/coins/wownero.dart';
import '../../crypto_currency/crypto_currency.dart';
import '../../models/tx_data.dart';
import '../intermediate/cryptonote_wallet.dart';
import '../wallet.dart';
import '../wallet_mixin_interfaces/cw_based_interface.dart';
import 'package:tuple/tuple.dart';
class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
WowneroWallet(CryptoCurrencyNetwork network) : super(Wownero(network)) {
@ -524,16 +527,17 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
);
try {
walletInfo = WalletInfo.external(
id: WalletBase.idFor(name, WalletType.wownero),
name: name,
type: WalletType.wownero,
isRecovery: false,
restoreHeight: credentials.height ?? 0,
date: DateTime.now(),
path: path,
dirPath: dirPath,
// TODO: find out what to put for address
address: '');
id: WalletBase.idFor(name, WalletType.wownero),
name: name,
type: WalletType.wownero,
isRecovery: false,
restoreHeight: credentials.height ?? 0,
date: DateTime.now(),
path: path,
dirPath: dirPath,
// TODO: find out what to put for address
address: '',
);
credentials.walletInfo = walletInfo;
final cwWalletCreationService = WalletCreationService(
@ -577,8 +581,9 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
CwBasedInterface.cwWalletBase?.close();
} catch (e, s) {
Logging.instance.log(
"Exception rethrown from recoverFromMnemonic(): $e\n$s",
level: LogLevel.Error);
"Exception rethrown from recoverFromMnemonic(): $e\n$s",
level: LogLevel.Error,
);
rethrow;
}
});
@ -636,8 +641,10 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
CwBasedInterface.cwWalletBase!.createTransaction(tmp);
});
} catch (e, s) {
Logging.instance.log("Exception rethrown from prepareSend(): $e\n$s",
level: LogLevel.Warning);
Logging.instance.log(
"Exception rethrown from prepareSend(): $e\n$s",
level: LogLevel.Warning,
);
}
final PendingWowneroTransaction pendingWowneroTransaction =
@ -655,8 +662,10 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
throw ArgumentError("Invalid fee rate argument provided!");
}
} catch (e, s) {
Logging.instance.log("Exception rethrown from prepare send(): $e\n$s",
level: LogLevel.Info);
Logging.instance.log(
"Exception rethrown from prepare send(): $e\n$s",
level: LogLevel.Info,
);
if (e.toString().contains("Incorrect unlocked balance")) {
throw Exception("Insufficient balance!");
@ -674,17 +683,22 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
try {
await txData.pendingWowneroTransaction!.commit();
Logging.instance.log(
"transaction ${txData.pendingWowneroTransaction!.id} has been sent",
level: LogLevel.Info);
"transaction ${txData.pendingWowneroTransaction!.id} has been sent",
level: LogLevel.Info,
);
return txData.copyWith(txid: txData.pendingWowneroTransaction!.id);
} catch (e, s) {
Logging.instance.log("${info.name} wownero confirmSend: $e\n$s",
level: LogLevel.Error);
Logging.instance.log(
"${info.name} wownero confirmSend: $e\n$s",
level: LogLevel.Error,
);
rethrow;
}
} catch (e, s) {
Logging.instance.log("Exception rethrown from confirmSend(): $e\n$s",
level: LogLevel.Info);
Logging.instance.log(
"Exception rethrown from confirmSend(): $e\n$s",
level: LogLevel.Info,
);
rethrow;
}
}

View file

@ -1742,8 +1742,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: f31f8f857665d85338824ae171aba4c629c3ba6f
resolved-ref: f31f8f857665d85338824ae171aba4c629c3ba6f
ref: "13fa937ea9a9fc34caf047e068df9535f65c27ad"
resolved-ref: "13fa937ea9a9fc34caf047e068df9535f65c27ad"
url: "https://github.com/cypherstack/tezart.git"
source: git
version: "2.0.5"