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)));
@ -392,8 +393,7 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
child: const XIcon(),
onTap: () async {
setState(() {
_searchFieldController.text =
"";
_searchFieldController.text = "";
_searchTerm = "";
});
},
@ -405,7 +405,8 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
: 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({
@ -260,7 +258,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 ==
@ -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,
@ -529,7 +534,8 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
} catch (e, s) {
Logging.instance.log(
"Exception rethrown from recoverFromMnemonic(): $e\n$s",
level: LogLevel.Error);
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!");
@ -625,16 +635,21 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
await txData.pendingMoneroTransaction!.commit();
Logging.instance.log(
"transaction ${txData.pendingMoneroTransaction!.id} has been sent",
level: LogLevel.Info);
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)) {
@ -533,7 +536,8 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
path: path,
dirPath: dirPath,
// TODO: find out what to put for address
address: '');
address: '',
);
credentials.walletInfo = walletInfo;
final cwWalletCreationService = WalletCreationService(
@ -578,7 +582,8 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
} catch (e, s) {
Logging.instance.log(
"Exception rethrown from recoverFromMnemonic(): $e\n$s",
level: LogLevel.Error);
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!");
@ -675,16 +684,21 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
await txData.pendingWowneroTransaction!.commit();
Logging.instance.log(
"transaction ${txData.pendingWowneroTransaction!.id} has been sent",
level: LogLevel.Info);
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"