From 1924c02e95dc9047b0ec95fec9b0deb020c90d6c Mon Sep 17 00:00:00 2001 From: sneurlax Date: Sun, 26 Apr 2026 21:44:34 -0500 Subject: [PATCH] chore: dart format staging vs main --- .../sub_classes/sol_token_entity.dart | 8 +- .../models/blockchain_data/transaction.dart | 14 +- lib/models/keys/view_only_wallet_data.dart | 56 ++--- lib/models/paynym/paynym_account.dart | 50 ++--- .../edit_wallet_tokens_view.dart | 21 +- .../sub_widgets/add_token_list.dart | 4 +- .../sub_widgets/add_token_list_element.dart | 96 ++++---- .../add_wallet_view/add_wallet_view.dart | 211 +++++++++--------- .../sub_widgets/next_button.dart | 26 +-- .../select_wallet_for_sol_token_view.dart | 90 +++----- lib/pages/receive_view/receive_view.dart | 3 +- .../receive_view/sol_token_receive_view.dart | 30 +-- .../epic_slatepack_entry_dialog.dart | 3 +- .../epic_slatepack_import_dialog.dart | 84 ++++--- .../sub_widgets/epic_slatepack_dialog.dart | 55 +++-- .../view_only_wallet_data_widget.dart | 133 +++++------ .../wallet_settings_view.dart | 7 +- .../sub_widgets/token_summary_sol.dart | 92 ++++---- .../sub_widgets/wallet_refresh_button.dart | 66 +++--- .../sub_widgets/wallet_list_item.dart | 28 +-- .../sub_widgets/desktop_receive.dart | 19 +- .../sub_widgets/desktop_send_fee_form.dart | 8 +- .../ui/preview_tx_button_state_provider.dart | 59 ++--- lib/services/price_service.dart | 12 +- lib/services/solana/solana_token_api.dart | 14 +- lib/utilities/amount/amount_unit.dart | 2 +- .../isar/models/token_wallet_info.dart | 9 +- lib/wallets/isar/models/wallet_info.dart | 3 +- .../isar/models/wallet_solana_token_info.dart | 9 +- .../current_sol_token_wallet_provider.dart | 14 +- .../solana/sol_token_balance_provider.dart | 158 ++++++------- .../providers/solana/sol_tokens_provider.dart | 15 +- lib/wallets/wallet/impl/ethereum_wallet.dart | 4 +- lib/wallets/wallet/impl/firo_wallet.dart | 5 +- lib/widgets/epic_txs_method_toggle.dart | 33 ++- 35 files changed, 669 insertions(+), 772 deletions(-) diff --git a/lib/models/add_wallet_list_entity/sub_classes/sol_token_entity.dart b/lib/models/add_wallet_list_entity/sub_classes/sol_token_entity.dart index 1f4c01ff06..b1acd388c2 100644 --- a/lib/models/add_wallet_list_entity/sub_classes/sol_token_entity.dart +++ b/lib/models/add_wallet_list_entity/sub_classes/sol_token_entity.dart @@ -26,6 +26,10 @@ class SolTokenEntity extends AddWalletListEntity { String get ticker => token.symbol; @override - List get props => - [cryptoCurrency.identifier, name, ticker, token.address]; + List get props => [ + cryptoCurrency.identifier, + name, + ticker, + token.address, + ]; } diff --git a/lib/models/isar/models/blockchain_data/transaction.dart b/lib/models/isar/models/blockchain_data/transaction.dart index a4c808bfbc..ec7447349c 100644 --- a/lib/models/isar/models/blockchain_data/transaction.dart +++ b/lib/models/isar/models/blockchain_data/transaction.dart @@ -218,14 +218,12 @@ class Transaction { slateId: json["slateId"] as String?, otherData: json["otherData"] as String?, nonce: json["nonce"] as int?, - inputs: - List.from( - json["inputs"] as List, - ).map((e) => Input.fromJsonString(e)).toList(), - outputs: - List.from( - json["outputs"] as List, - ).map((e) => Output.fromJsonString(e)).toList(), + inputs: List.from( + json["inputs"] as List, + ).map((e) => Input.fromJsonString(e)).toList(), + outputs: List.from( + json["outputs"] as List, + ).map((e) => Output.fromJsonString(e)).toList(), numberOfMessages: json["numberOfMessages"] as int, ); if (json["address"] == null) { diff --git a/lib/models/keys/view_only_wallet_data.dart b/lib/models/keys/view_only_wallet_data.dart index 384985ac16..7cd7a89910 100644 --- a/lib/models/keys/view_only_wallet_data.dart +++ b/lib/models/keys/view_only_wallet_data.dart @@ -4,12 +4,7 @@ import '../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dar import 'key_data_interface.dart'; // do not remove or change the order of these enum values -enum ViewOnlyWalletType { - cryptonote, - addressOnly, - xPub, - spark; -} +enum ViewOnlyWalletType { cryptonote, addressOnly, xPub, spark } sealed class ViewOnlyWalletData with KeyDataInterface { @override @@ -17,9 +12,7 @@ sealed class ViewOnlyWalletData with KeyDataInterface { ViewOnlyWalletType get type; - ViewOnlyWalletData({ - required this.walletId, - }); + ViewOnlyWalletData({required this.walletId}); static ViewOnlyWalletData fromJsonEncodedString( String jsonEncodedString, { @@ -88,10 +81,10 @@ class CryptonoteViewOnlyWalletData extends ViewOnlyWalletData { @override String toJsonEncodedString() => jsonEncode({ - "type": type.index, - "address": address, - "privateViewKey": privateViewKey, - }); + "type": type.index, + "address": address, + "privateViewKey": privateViewKey, + }); } class AddressViewOnlyWalletData extends ViewOnlyWalletData { @@ -100,10 +93,7 @@ class AddressViewOnlyWalletData extends ViewOnlyWalletData { final String address; - AddressViewOnlyWalletData({ - required super.walletId, - required this.address, - }); + AddressViewOnlyWalletData({required super.walletId, required this.address}); static AddressViewOnlyWalletData fromJsonEncodedString( String jsonEncodedString, { @@ -119,10 +109,8 @@ class AddressViewOnlyWalletData extends ViewOnlyWalletData { } @override - String toJsonEncodedString() => jsonEncode({ - "type": type.index, - "address": address, - }); + String toJsonEncodedString() => + jsonEncode({"type": type.index, "address": address}); } class ExtendedKeysViewOnlyWalletData extends ViewOnlyWalletData { @@ -158,16 +146,11 @@ class ExtendedKeysViewOnlyWalletData extends ViewOnlyWalletData { @override String toJsonEncodedString() => jsonEncode({ - "type": type.index, - "xPubs": [ - ...xPubs.map( - (e) => { - "path": e.path, - "encoded": e.encoded, - }, - ), - ], - }); + "type": type.index, + "xPubs": [ + ...xPubs.map((e) => {"path": e.path, "encoded": e.encoded}), + ], + }); } class SparkViewOnlyWalletData extends ViewOnlyWalletData { @@ -176,10 +159,7 @@ class SparkViewOnlyWalletData extends ViewOnlyWalletData { final String viewKey; - SparkViewOnlyWalletData({ - required super.walletId, - required this.viewKey, - }); + SparkViewOnlyWalletData({required super.walletId, required this.viewKey}); static SparkViewOnlyWalletData fromJsonEncodedString( String jsonEncodedString, { @@ -195,8 +175,6 @@ class SparkViewOnlyWalletData extends ViewOnlyWalletData { } @override - String toJsonEncodedString() => jsonEncode({ - "type": type.index, - "viewKey": viewKey, - }); + String toJsonEncodedString() => + jsonEncode({"type": type.index, "viewKey": viewKey}); } diff --git a/lib/models/paynym/paynym_account.dart b/lib/models/paynym/paynym_account.dart index 23a29b8043..9950912235 100644 --- a/lib/models/paynym/paynym_account.dart +++ b/lib/models/paynym/paynym_account.dart @@ -37,24 +37,24 @@ class PaynymAccount { ); PaynymAccount.fromMap(Map map) - : nymID = map["nymID"] as String, - nymName = map["nymName"] as String, - segwit = map["segwit"] as bool, - codes = (map["codes"] as List) - .map((e) => PaynymCode.fromMap(Map.from(e as Map))) - .toList(), - followers = (map["followers"] as List) - .map( - (e) => PaynymAccountLite.fromMap( - Map.from(e as Map)), - ) - .toList(), - following = (map["following"] as List) - .map( - (e) => PaynymAccountLite.fromMap( - Map.from(e as Map)), - ) - .toList(); + : nymID = map["nymID"] as String, + nymName = map["nymName"] as String, + segwit = map["segwit"] as bool, + codes = (map["codes"] as List) + .map((e) => PaynymCode.fromMap(Map.from(e as Map))) + .toList(), + followers = (map["followers"] as List) + .map( + (e) => + PaynymAccountLite.fromMap(Map.from(e as Map)), + ) + .toList(), + following = (map["following"] as List) + .map( + (e) => + PaynymAccountLite.fromMap(Map.from(e as Map)), + ) + .toList(); PaynymAccount copyWith({ String? nymID, @@ -75,13 +75,13 @@ class PaynymAccount { } Map toMap() => { - "nymID": nymID, - "nymName": nymName, - "segwit": segwit, - "codes": codes.map((e) => e.toMap()), - "followers": followers.map((e) => e.toMap()), - "following": following.map((e) => e.toMap()), - }; + "nymID": nymID, + "nymName": nymName, + "segwit": segwit, + "codes": codes.map((e) => e.toMap()), + "followers": followers.map((e) => e.toMap()), + "following": following.map((e) => e.toMap()), + }; @override String toString() { diff --git a/lib/pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart b/lib/pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart index d81afe51e5..894667d0a7 100644 --- a/lib/pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart +++ b/lib/pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart @@ -100,11 +100,10 @@ class _EditWalletTokensViewState extends ConsumerState { } Future onNextPressed() async { - final selectedTokens = - tokenEntities - .where((e) => e.selected) - .map((e) => e.token.address) - .toList(); + final selectedTokens = tokenEntities + .where((e) => e.selected) + .map((e) => e.token.address) + .toList(); final wallet = ref.read(pWallets).getWallet(widget.walletId); @@ -177,7 +176,9 @@ class _EditWalletTokensViewState extends ConsumerState { tokenEntities.add( AddTokenListElementData(contract!)..selected = true, ); - tokenEntities.sort((a, b) => a.token.name.compareTo(b.token.name)); + tokenEntities.sort( + (a, b) => a.token.name.compareTo(b.token.name), + ); } }); } @@ -199,9 +200,7 @@ class _EditWalletTokensViewState extends ConsumerState { ), ); } else { - final result = await Navigator.of( - context, - ).pushNamed( + final result = await Navigator.of(context).pushNamed( AddCustomSolanaTokenView.routeName, arguments: widget.walletId, ); @@ -228,9 +227,7 @@ class _EditWalletTokensViewState extends ConsumerState { if (tokenEntities .where((e) => e.token.address == token!.address) .isEmpty) { - tokenEntities.add( - AddTokenListElementData(token!)..selected = true, - ); + tokenEntities.add(AddTokenListElementData(token!)..selected = true); tokenEntities.sort((a, b) => a.token.name.compareTo(b.token.name)); } }); diff --git a/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list.dart b/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list.dart index b479a62aa7..08eea8874d 100644 --- a/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list.dart +++ b/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list.dart @@ -38,9 +38,7 @@ class AddTokenList extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ child, - AddCustomTokenSelector( - addFunction: addFunction!, - ), + AddCustomTokenSelector(addFunction: addFunction!), ], ), child: Padding( diff --git a/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list_element.dart b/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list_element.dart index eecf914d73..7ab2075cee 100644 --- a/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list_element.dart +++ b/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list_element.dart @@ -54,18 +54,14 @@ class _AddTokenListElementState extends ConsumerState { super.initState(); ExchangeDataLoadingService.instance.isar.then((isar) async { - final currency = - await isar.currencies - .where() - .exchangeNameEqualTo(ChangeNowExchange.exchangeName) - .filter() - .tokenContractEqualTo( - widget.data.token.address, - caseSensitive: false, - ) - .and() - .imageIsNotEmpty() - .findFirst(); + final currency = await isar.currencies + .where() + .exchangeNameEqualTo(ChangeNowExchange.exchangeName) + .filter() + .tokenContractEqualTo(widget.data.token.address, caseSensitive: false) + .and() + .imageIsNotEmpty() + .findFirst(); if (mounted) { WidgetsBinding.instance.addPostFrameCallback((_) { @@ -86,10 +82,9 @@ class _AddTokenListElementState extends ConsumerState { return RoundedWhiteContainer( padding: EdgeInsets.all(isDesktop ? 16 : 12), - borderColor: - isDesktop - ? Theme.of(context).extension()!.backgroundAppBar - : null, + borderColor: isDesktop + ? Theme.of(context).extension()!.backgroundAppBar + : null, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -97,39 +92,35 @@ class _AddTokenListElementState extends ConsumerState { children: [ currency != null ? SvgPicture.network( - currency!.image, - width: iconSize, - height: iconSize, - placeholderBuilder: - (_) => AppIcon(width: iconSize, height: iconSize), - ) + currency!.image, + width: iconSize, + height: iconSize, + placeholderBuilder: (_) => + AppIcon(width: iconSize, height: iconSize), + ) : AppIcon(width: iconSize, height: iconSize), const SizedBox(width: 12), ConditionalParent( condition: isDesktop, - builder: - (child) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - child, - const SizedBox(height: 2), - Text( - widget.data.token.symbol, - style: STextStyles.desktopTextExtraExtraSmall( - context, - ), - overflow: TextOverflow.ellipsis, - ), - ], + builder: (child) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + child, + const SizedBox(height: 2), + Text( + widget.data.token.symbol, + style: STextStyles.desktopTextExtraExtraSmall(context), + overflow: TextOverflow.ellipsis, ), + ], + ), child: Text( isDesktop ? mainLabel : "$mainLabel (${widget.data.token.symbol})", - style: - isDesktop - ? STextStyles.desktopTextSmall(context) - : STextStyles.w600_14(context), + style: isDesktop + ? STextStyles.desktopTextSmall(context) + : STextStyles.w600_14(context), overflow: TextOverflow.ellipsis, ), ), @@ -138,21 +129,20 @@ class _AddTokenListElementState extends ConsumerState { const SizedBox(width: 4), isDesktop ? Checkbox( - value: widget.data.selected, - onChanged: - (newValue) => - setState(() => widget.data.selected = newValue!), - ) + value: widget.data.selected, + onChanged: (newValue) => + setState(() => widget.data.selected = newValue!), + ) : SizedBox( - height: 20, - width: 40, - child: DraggableSwitchButton( - isOn: widget.data.selected, - onValueChanged: (newValue) { - widget.data.selected = newValue; - }, + height: 20, + width: 40, + child: DraggableSwitchButton( + isOn: widget.data.selected, + onValueChanged: (newValue) { + widget.data.selected = newValue; + }, + ), ), - ), ], ), ); diff --git a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart index 13cb7a022e..047b5f7e3e 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart @@ -103,12 +103,11 @@ class _AddWalletViewState extends ConsumerState { if (isDesktop) { contract = await showDialog( context: context, - builder: - (context) => const DesktopDialog( - maxWidth: 580, - maxHeight: 500, - child: AddCustomTokenView(), - ), + builder: (context) => const DesktopDialog( + maxWidth: 580, + maxHeight: 500, + child: AddCustomTokenView(), + ), ); } else { contract = await Navigator.of( @@ -137,12 +136,11 @@ class _AddWalletViewState extends ConsumerState { if (isDesktop) { token = await showDialog( context: context, - builder: - (context) => const DesktopDialog( - maxWidth: 580, - maxHeight: 500, - child: AddCustomSolanaTokenView(), - ), + builder: (context) => const DesktopDialog( + maxWidth: 580, + maxHeight: 500, + child: AddCustomSolanaTokenView(), + ), ); } else { token = await Navigator.of( @@ -176,8 +174,10 @@ class _AddWalletViewState extends ConsumerState { } if (AppConfig.coins.whereType().isNotEmpty) { - final contracts = - MainDB.instance.getEthContracts().sortByName().findAllSync(); + final contracts = MainDB.instance + .getEthContracts() + .sortByName() + .findAllSync(); if (contracts.isEmpty) { contracts.addAll(DefaultTokens.list); @@ -277,57 +277,58 @@ class _AddWalletViewState extends ConsumerState { style: STextStyles.desktopTextMedium( context, ).copyWith(height: 2), - decoration: standardInputDecoration( - "Search", - _searchFocusNode, - context, - ).copyWith( - contentPadding: const EdgeInsets.symmetric( - vertical: 10, - ), - prefixIcon: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16, - // vertical: 20, - ), - child: SvgPicture.asset( - Assets.svg.search, - width: 24, - height: 24, - color: - Theme.of(context) + decoration: + standardInputDecoration( + "Search", + _searchFocusNode, + context, + ).copyWith( + contentPadding: const EdgeInsets.symmetric( + vertical: 10, + ), + prefixIcon: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, + // vertical: 20, + ), + child: SvgPicture.asset( + Assets.svg.search, + width: 24, + height: 24, + color: Theme.of(context) .extension()! .textFieldDefaultSearchIconLeft, - ), - ), - suffixIcon: - _searchFieldController.text.isNotEmpty + ), + ), + suffixIcon: + _searchFieldController.text.isNotEmpty ? Padding( - padding: const EdgeInsets.only( - right: 10, - ), - child: UnconstrainedBox( - child: Row( - children: [ - TextFieldIconButton( - child: const XIcon( - width: 24, - height: 24, + padding: const EdgeInsets.only( + right: 10, + ), + child: UnconstrainedBox( + child: Row( + children: [ + TextFieldIconButton( + child: const XIcon( + width: 24, + height: 24, + ), + onTap: () async { + setState(() { + _searchFieldController + .text = + ""; + _searchTerm = ""; + }); + }, ), - onTap: () async { - setState(() { - _searchFieldController - .text = ""; - _searchTerm = ""; - }); - }, - ), - ], + ], + ), ), - ), - ) + ) : null, - ), + ), ), ), ), @@ -365,7 +366,10 @@ class _AddWalletViewState extends ConsumerState { if (solTokenEntities.isNotEmpty) ExpandingSubListItem( title: "Solana tokens", - entities: filter(_searchTerm, solTokenEntities), + entities: filter( + _searchTerm, + solTokenEntities, + ), initialState: ExpandableState.expanded, animationDurationMultiplier: 0.5, trailing: AddCustomTokenSelector( @@ -395,8 +399,9 @@ class _AddWalletViewState extends ConsumerState { } else { return Background( child: Scaffold( - backgroundColor: - Theme.of(context).extension()!.background, + backgroundColor: Theme.of( + context, + ).extension()!.background, appBar: AppBar( leading: AppBarBackButton( onPressed: () { @@ -428,49 +433,53 @@ class _AddWalletViewState extends ConsumerState { enableSuggestions: !isDesktop, controller: _searchFieldController, focusNode: _searchFocusNode, - onChanged: - (value) => setState(() => _searchTerm = value), + 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 + 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 = ""; - }); - }, - ), - ], + padding: const EdgeInsets.only( + right: 0, ), - ), - ) + child: UnconstrainedBox( + child: Row( + children: [ + TextFieldIconButton( + child: const XIcon(), + onTap: () async { + setState(() { + _searchFieldController + .text = + ""; + _searchTerm = ""; + }); + }, + ), + ], + ), + ), + ) : null, - ), + ), ), ), ), diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart index f88b491781..532922eb32 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart @@ -20,18 +20,16 @@ import '../../../../themes/stack_colors.dart'; import '../../../../utilities/text_styles.dart'; class AddWalletNextButton extends ConsumerWidget { - const AddWalletNextButton({ - super.key, - required this.isDesktop, - }); + const AddWalletNextButton({super.key, required this.isDesktop}); final bool isDesktop; @override Widget build(BuildContext context, WidgetRef ref) { debugPrint("BUILD: NextButton"); - final selectedCoin = - ref.watch(addWalletSelectedEntityStateProvider.state).state; + final selectedCoin = ref + .watch(addWalletSelectedEntityStateProvider.state) + .state; final enabled = selectedCoin != null; @@ -57,18 +55,18 @@ class AddWalletNextButton extends ConsumerWidget { } }, style: enabled - ? Theme.of(context) - .extension()! - .getPrimaryEnabledButtonStyle(context) - : Theme.of(context) - .extension()! - .getPrimaryDisabledButtonStyle(context), + ? Theme.of( + context, + ).extension()!.getPrimaryEnabledButtonStyle(context) + : Theme.of( + context, + ).extension()!.getPrimaryDisabledButtonStyle(context), child: Text( "Next", style: isDesktop ? enabled - ? STextStyles.desktopButtonEnabled(context) - : STextStyles.desktopButtonDisabled(context) + ? STextStyles.desktopButtonEnabled(context) + : STextStyles.desktopButtonDisabled(context) : STextStyles.button(context), ), ); diff --git a/lib/pages/add_wallet_views/select_wallet_for_sol_token_view.dart b/lib/pages/add_wallet_views/select_wallet_for_sol_token_view.dart index d5c012b53a..cb921e3e36 100644 --- a/lib/pages/add_wallet_views/select_wallet_for_sol_token_view.dart +++ b/lib/pages/add_wallet_views/select_wallet_for_sol_token_view.dart @@ -31,14 +31,12 @@ import '../../widgets/rounded_white_container.dart'; import '../../widgets/wallet_info_row/wallet_info_row.dart'; import 'package:tuple/tuple.dart'; -final newSolWalletTriggerTempUntilHiveCompletelyDeleted = - StateProvider((ref) => false); +final newSolWalletTriggerTempUntilHiveCompletelyDeleted = StateProvider( + (ref) => false, +); class SelectWalletForSolTokenView extends ConsumerStatefulWidget { - const SelectWalletForSolTokenView({ - super.key, - required this.entity, - }); + const SelectWalletForSolTokenView({super.key, required this.entity}); static const String routeName = "/selectWalletForSolTokenView"; @@ -58,15 +56,13 @@ class _SelectWalletForSolTokenViewState void _onContinue() { Navigator.of(context).pushNamed( EditWalletTokensView.routeName, - arguments: Tuple2( - _selectedWalletId!, - [widget.entity.token.address], - ), + arguments: Tuple2(_selectedWalletId!, [widget.entity.token.address]), ); } void _onAddNewSolWallet() { - ref.read(newSolWalletTriggerTempUntilHiveCompletelyDeleted.notifier).state = true; + ref.read(newSolWalletTriggerTempUntilHiveCompletelyDeleted.notifier).state = + true; Navigator.of(context).pushNamed( CreateOrRestoreWalletView.routeName, arguments: CoinEntity(widget.entity.cryptoCurrency), @@ -93,15 +89,21 @@ class _SelectWalletForSolTokenViewState return WillPopScope( onWillPop: () async { - ref.read(newSolWalletTriggerTempUntilHiveCompletelyDeleted.notifier).state = false; + ref + .read( + newSolWalletTriggerTempUntilHiveCompletelyDeleted.notifier, + ) + .state = + false; return true; }, child: ConditionalParent( condition: !isDesktop, builder: (child) => Background( child: Scaffold( - backgroundColor: - Theme.of(context).extension()!.background, + backgroundColor: Theme.of( + context, + ).extension()!.background, appBar: AppBar( leading: AppBarBackButton( onPressed: () { @@ -110,10 +112,7 @@ class _SelectWalletForSolTokenViewState ), ), body: SafeArea( - child: Padding( - padding: const EdgeInsets.all(16), - child: child, - ), + child: Padding(padding: const EdgeInsets.all(16), child: child), ), ), ), @@ -124,18 +123,12 @@ class _SelectWalletForSolTokenViewState isCompactHeight: false, leading: AppBarBackButton(), ), - body: SizedBox( - width: 500, - child: child, - ), + body: SizedBox(width: 500, child: child), ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - if (isDesktop) - const SizedBox( - height: 24, - ), + if (isDesktop) const SizedBox(height: 24), Text( "Select Solana wallet", textAlign: TextAlign.center, @@ -143,9 +136,7 @@ class _SelectWalletForSolTokenViewState ? STextStyles.desktopH2(context) : STextStyles.pageTitleH1(context), ), - SizedBox( - height: isDesktop ? 16 : 8, - ), + SizedBox(height: isDesktop ? 16 : 8), Text( "You are adding a Solana token.", textAlign: TextAlign.center, @@ -153,9 +144,7 @@ class _SelectWalletForSolTokenViewState ? STextStyles.desktopSubtitleH2(context) : STextStyles.subtitle(context), ), - const SizedBox( - height: 8, - ), + const SizedBox(height: 8), Text( "You must choose a Solana wallet in order to use ${widget.entity.name}", textAlign: TextAlign.center, @@ -163,9 +152,7 @@ class _SelectWalletForSolTokenViewState ? STextStyles.desktopSubtitleH2(context) : STextStyles.subtitle(context), ), - SizedBox( - height: isDesktop ? 60 : 16, - ), + SizedBox(height: isDesktop ? 60 : 16), solWalletIds.isEmpty ? RoundedWhiteContainer( padding: EdgeInsets.all(isDesktop ? 16 : 12), @@ -193,9 +180,8 @@ class _SelectWalletForSolTokenViewState child: ListView.separated( itemCount: solWalletIds.length, shrinkWrap: true, - separatorBuilder: (_, __) => SizedBox( - height: isDesktop ? 12 : 6, - ), + separatorBuilder: (_, __) => + SizedBox(height: isDesktop ? 12 : 6), itemBuilder: (_, index) { return RoundedContainer( padding: EdgeInsets.all(isDesktop ? 16 : 8), @@ -205,34 +191,26 @@ class _SelectWalletForSolTokenViewState }); }, color: isDesktop - ? Theme.of(context) - .extension()! - .popupBG + ? Theme.of( + context, + ).extension()!.popupBG : _selectedWalletId == solWalletIds[index] - ? Theme.of(context) - .extension()! - .highlight - : Colors.transparent, + ? Theme.of( + context, + ).extension()!.highlight + : Colors.transparent, child: isDesktop ? EthWalletRadio( walletId: solWalletIds[index], selectedWalletId: _selectedWalletId, ) - : WalletInfoRow( - walletId: solWalletIds[index], - ), + : WalletInfoRow(walletId: solWalletIds[index]), ); }, ), ), - if (solWalletIds.isEmpty || isDesktop) - const SizedBox( - height: 16, - ), - if (isDesktop) - const SizedBox( - height: 16, - ), + if (solWalletIds.isEmpty || isDesktop) const SizedBox(height: 16), + if (isDesktop) const SizedBox(height: 16), solWalletIds.isEmpty ? PrimaryButton( label: "Add new Solana wallet", diff --git a/lib/pages/receive_view/receive_view.dart b/lib/pages/receive_view/receive_view.dart index 61f8ae5fbe..f0978425e6 100644 --- a/lib/pages/receive_view/receive_view.dart +++ b/lib/pages/receive_view/receive_view.dart @@ -161,8 +161,7 @@ class _ReceiveViewState extends ConsumerState { if (slatepackString == null) return; if (mounted) { - final wallet = - ref.read(pWallets).getWallet(walletId) as EpiccashWallet; + final wallet = ref.read(pWallets).getWallet(walletId) as EpiccashWallet; Exception? ex; final result = await showLoading( diff --git a/lib/pages/receive_view/sol_token_receive_view.dart b/lib/pages/receive_view/sol_token_receive_view.dart index 084335b008..c07ec7405d 100644 --- a/lib/pages/receive_view/sol_token_receive_view.dart +++ b/lib/pages/receive_view/sol_token_receive_view.dart @@ -108,10 +108,7 @@ class _SolTokenReceiveViewState extends ConsumerState { child: SizedBox( width: 200, height: 200, - child: QR( - data: receivingAddress, - size: 200, - ), + child: QR(data: receivingAddress, size: 200), ), ), const SizedBox(height: 24), @@ -129,9 +126,7 @@ class _SolTokenReceiveViewState extends ConsumerState { child: Row( children: [ if (tokenWallet != null) - SolTokenIcon( - mintAddress: tokenMint, - ) + SolTokenIcon(mintAddress: tokenMint) else SizedBox.square(dimension: 32), const SizedBox(width: 6), @@ -208,14 +203,12 @@ class _SolTokenReceiveViewState extends ConsumerState { const SizedBox(width: 8), Text( "Copy", - style: - STextStyles.smallMed12(context) - .copyWith( - color: Theme.of( - context, - ).extension()! - .textDark, - ), + style: STextStyles.smallMed12(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark, + ), ), ], ), @@ -228,10 +221,7 @@ class _SolTokenReceiveViewState extends ConsumerState { ), ), const SizedBox(height: 24), - Text( - "Address", - style: STextStyles.itemSubtitle(context), - ), + Text("Address", style: STextStyles.itemSubtitle(context)), const SizedBox(height: 8), Container( decoration: BoxDecoration( @@ -259,4 +249,4 @@ class _SolTokenReceiveViewState extends ConsumerState { ), ); } -} \ No newline at end of file +} diff --git a/lib/pages/receive_view/sub_widgets/epic_slatepack_entry_dialog.dart b/lib/pages/receive_view/sub_widgets/epic_slatepack_entry_dialog.dart index c3583e7c49..0b9a22abad 100644 --- a/lib/pages/receive_view/sub_widgets/epic_slatepack_entry_dialog.dart +++ b/lib/pages/receive_view/sub_widgets/epic_slatepack_entry_dialog.dart @@ -31,7 +31,8 @@ class EpicSlatepackEntryDialog extends ConsumerStatefulWidget { _EpicSlatepackEntryDialogState(); } -class _EpicSlatepackEntryDialogState extends ConsumerState { +class _EpicSlatepackEntryDialogState + extends ConsumerState { final _receiveSlateController = TextEditingController(); final _slateFocusNode = FocusNode(); diff --git a/lib/pages/receive_view/sub_widgets/epic_slatepack_import_dialog.dart b/lib/pages/receive_view/sub_widgets/epic_slatepack_import_dialog.dart index 769a58a94f..5c31afe626 100644 --- a/lib/pages/receive_view/sub_widgets/epic_slatepack_import_dialog.dart +++ b/lib/pages/receive_view/sub_widgets/epic_slatepack_import_dialog.dart @@ -87,14 +87,12 @@ class _EpicSlatepackImportDialogState await showDialog( context: context, useRootNavigator: true, - builder: - (context) => StackOkDialog( - desktopPopRootNavigator: true, - maxWidth: Util.isDesktop ? 400 : null, - title: "Slate receive error", - message: - ex?.toString() ?? "Unexpected result without exception", - ), + builder: (context) => StackOkDialog( + desktopPopRootNavigator: true, + maxWidth: Util.isDesktop ? 400 : null, + title: "Slate receive error", + message: ex?.toString() ?? "Unexpected result without exception", + ), ); } return; @@ -112,14 +110,14 @@ class _EpicSlatepackImportDialogState final map = jsonDecode(widget.decoded.slateJson!) as Map; final rawAmount = BigInt.tryParse(map["amount"].toString()); - _amount = - rawAmount == null - ? null - : Amount( - rawValue: rawAmount, - fractionDigits: - ref.read(pWalletCoin(widget.walletId)).fractionDigits, - ); + _amount = rawAmount == null + ? null + : Amount( + rawValue: rawAmount, + fractionDigits: ref + .read(pWalletCoin(widget.walletId)) + .fractionDigits, + ); super.initState(); } @@ -154,17 +152,15 @@ class _EpicSlatepackImportDialogState children: [ ConditionalParent( condition: isDesktop, - builder: - (child) => RoundedWhiteContainer( - borderColor: - isDesktop - ? Theme.of( - context, - ).extension()!.backgroundAppBar - : null, - padding: const EdgeInsets.all(0), - child: child, - ), + builder: (child) => RoundedWhiteContainer( + borderColor: isDesktop + ? Theme.of( + context, + ).extension()!.backgroundAppBar + : null, + padding: const EdgeInsets.all(0), + child: child, + ), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, @@ -195,11 +191,10 @@ class _EpicSlatepackImportDialogState const SizedBox(height: 24), ConditionalParent( condition: isDesktop, - builder: - (child) => Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [child], - ), + builder: (child) => Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [child], + ), child: PrimaryButton( width: isDesktop ? 220 : null, @@ -255,10 +250,9 @@ class EpicSlatepackResponseDialog extends StatelessWidget { ), ), Padding( - padding: - Util.isDesktop - ? const EdgeInsets.only(left: 32, right: 32, bottom: 32) - : const EdgeInsets.only(left: 24, right: 24, bottom: 24), + padding: Util.isDesktop + ? const EdgeInsets.only(left: 32, right: 32, bottom: 32) + : const EdgeInsets.only(left: 24, right: 24, bottom: 24), child: Column( mainAxisSize: MainAxisSize.min, children: [ @@ -281,11 +275,10 @@ class EpicSlatepackResponseDialog extends StatelessWidget { const SizedBox(height: 8), ConditionalParent( condition: !Util.isDesktop, - builder: - (child) => SizedBox( - height: 220, - child: SingleChildScrollView(child: child), - ), + builder: (child) => SizedBox( + height: 220, + child: SingleChildScrollView(child: child), + ), child: SelectableText( responseSlatepack, style: STextStyles.w500_14(context), @@ -294,11 +287,10 @@ class EpicSlatepackResponseDialog extends StatelessWidget { const SizedBox(height: 24), ConditionalParent( condition: Util.isDesktop, - builder: - (child) => Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [child], - ), + builder: (child) => Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [child], + ), child: PrimaryButton( label: "Done", width: Util.isDesktop ? 220 : null, diff --git a/lib/pages/send_view/sub_widgets/epic_slatepack_dialog.dart b/lib/pages/send_view/sub_widgets/epic_slatepack_dialog.dart index 7bcf97022f..d71324b1fe 100644 --- a/lib/pages/send_view/sub_widgets/epic_slatepack_dialog.dart +++ b/lib/pages/send_view/sub_widgets/epic_slatepack_dialog.dart @@ -28,7 +28,8 @@ class EpicSlatepackDialog extends ConsumerStatefulWidget { final ClipboardInterface clipboard; @override - ConsumerState createState() => _EpicSlatepackDialogState(); + ConsumerState createState() => + _EpicSlatepackDialogState(); } class _EpicSlatepackDialogState extends ConsumerState { @@ -57,35 +58,35 @@ class _EpicSlatepackDialogState extends ConsumerState { Widget build(BuildContext context) { return ConditionalParent( condition: Util.isDesktop, - builder: - (child) => Column( - mainAxisSize: MainAxisSize.min, + builder: (child) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Header with title and close button. + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - // Header with title and close button. - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: const EdgeInsets.only(left: 32), - child: Text( - "Send Slate", - style: STextStyles.pageTitleH2(context), - ), - ), - const DesktopDialogCloseButton(), - ], + Padding( + padding: const EdgeInsets.only(left: 32), + child: Text( + "Send Slate", + style: STextStyles.pageTitleH2(context), + ), ), - Padding(padding: const EdgeInsets.all(32), child: child), + const DesktopDialogCloseButton(), ], ), + Padding(padding: const EdgeInsets.all(32), child: child), + ], + ), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ // Instructions. RoundedContainer( - color: - Theme.of(context).extension()!.textFieldDefaultBG, + color: Theme.of( + context, + ).extension()!.textFieldDefaultBG, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -109,12 +110,7 @@ class _EpicSlatepackDialogState extends ConsumerState { const SizedBox(height: 12), // QR Code view. - Center( - child: QR( - data: widget.slatepackResult.slatepack!, - size: 220, - ), - ), + Center(child: QR(data: widget.slatepackResult.slatepack!, size: 220)), const SizedBox(height: 12), @@ -135,10 +131,9 @@ class _EpicSlatepackDialogState extends ConsumerState { Assets.svg.copy, width: 10, height: 10, - color: - Theme.of( - context, - ).extension()!.infoItemIcons, + color: Theme.of( + context, + ).extension()!.infoItemIcons, ), const SizedBox(width: 4), Text("Copy", style: STextStyles.link2(context)), diff --git a/lib/pages/settings_views/sub_widgets/view_only_wallet_data_widget.dart b/lib/pages/settings_views/sub_widgets/view_only_wallet_data_widget.dart index ef68684fe6..8521c7296b 100644 --- a/lib/pages/settings_views/sub_widgets/view_only_wallet_data_widget.dart +++ b/lib/pages/settings_views/sub_widgets/view_only_wallet_data_widget.dart @@ -7,10 +7,7 @@ import '../../../widgets/detail_item.dart'; import '../../wallet_view/transaction_views/transaction_details_view.dart'; class ViewOnlyWalletDataWidget extends StatelessWidget { - const ViewOnlyWalletDataWidget({ - super.key, - required this.data, - }); + const ViewOnlyWalletDataWidget({super.key, required this.data}); final ViewOnlyWalletData data; @@ -18,85 +15,63 @@ class ViewOnlyWalletDataWidget extends StatelessWidget { Widget build(BuildContext context) { return switch (data) { final CryptonoteViewOnlyWalletData e => Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - DetailItem( - title: "Address", - detail: e.address, - button: Util.isDesktop - ? IconCopyButton( - data: e.address, - ) - : SimpleCopyButton( - data: e.address, - ), - ), - const SizedBox( - height: 16, - ), - DetailItem( - title: "Private view key", - detail: e.privateViewKey, - button: Util.isDesktop - ? IconCopyButton( - data: e.privateViewKey, - ) - : SimpleCopyButton( - data: e.privateViewKey, - ), - ), - ], - ), + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + DetailItem( + title: "Address", + detail: e.address, + button: Util.isDesktop + ? IconCopyButton(data: e.address) + : SimpleCopyButton(data: e.address), + ), + const SizedBox(height: 16), + DetailItem( + title: "Private view key", + detail: e.privateViewKey, + button: Util.isDesktop + ? IconCopyButton(data: e.privateViewKey) + : SimpleCopyButton(data: e.privateViewKey), + ), + ], + ), final AddressViewOnlyWalletData e => Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - DetailItem( - title: "Address", - detail: e.address, - button: Util.isDesktop - ? IconCopyButton( - data: e.address, - ) - : SimpleCopyButton( - data: e.address, - ), - ), - ], - ), + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + DetailItem( + title: "Address", + detail: e.address, + button: Util.isDesktop + ? IconCopyButton(data: e.address) + : SimpleCopyButton(data: e.address), + ), + ], + ), final ExtendedKeysViewOnlyWalletData e => Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - ...e.xPubs.map( - (xPub) => DetailItem( - title: xPub.path, - detail: xPub.encoded, - button: Util.isDesktop - ? IconCopyButton( - data: xPub.encoded, - ) - : SimpleCopyButton( - data: xPub.encoded, - ), - ), - ), - ], - ), - final SparkViewOnlyWalletData e => Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - DetailItem( - title: "View Key", - detail: e.viewKey, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ...e.xPubs.map( + (xPub) => DetailItem( + title: xPub.path, + detail: xPub.encoded, button: Util.isDesktop - ? IconCopyButton( - data: e.viewKey, - ) - : SimpleCopyButton( - data: e.viewKey, - ), + ? IconCopyButton(data: xPub.encoded) + : SimpleCopyButton(data: xPub.encoded), ), - ], - ), + ), + ], + ), + final SparkViewOnlyWalletData e => Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + DetailItem( + title: "View Key", + detail: e.viewKey, + button: Util.isDesktop + ? IconCopyButton(data: e.viewKey) + : SimpleCopyButton(data: e.viewKey), + ), + ], + ), }; } } 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 4fd2e8f95d..4f7a769041 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 @@ -417,10 +417,9 @@ class _WalletSettingsViewState extends ConsumerState { iconSize: 16, title: "Epicbox Servers", onPressed: () { - Navigator.of(context).pushNamed( - ManageEpicboxView.routeName, - arguments: walletId, - ); + Navigator.of( + context, + ).pushNamed(ManageEpicboxView.routeName, arguments: walletId); }, ), if (canBackup) const SizedBox(height: 8), diff --git a/lib/pages/token_view/sub_widgets/token_summary_sol.dart b/lib/pages/token_view/sub_widgets/token_summary_sol.dart index 9d627c1f58..e4cccd7e4e 100644 --- a/lib/pages/token_view/sub_widgets/token_summary_sol.dart +++ b/lib/pages/token_view/sub_widgets/token_summary_sol.dart @@ -63,8 +63,9 @@ class SolanaTokenSummary extends ConsumerWidget { child: Text( "Loading token data...", style: STextStyles.subtitle500(context).copyWith( - color: - Theme.of(context).extension()!.tokenSummaryTextPrimary, + color: Theme.of( + context, + ).extension()!.tokenSummaryTextPrimary, ), ), ), @@ -73,12 +74,7 @@ class SolanaTokenSummary extends ConsumerWidget { // Watch the balance from the database provider. final balance = ref.watch( - pSolanaTokenBalance( - ( - walletId: walletId, - tokenMint: tokenMint, - ), - ), + pSolanaTokenBalance((walletId: walletId, tokenMint: tokenMint)), ); Decimal? price; @@ -125,7 +121,9 @@ class SolanaTokenSummary extends ConsumerWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - balance.total.decimal.toStringAsFixed(tokenWallet.tokenDecimals), + balance.total.decimal.toStringAsFixed( + tokenWallet.tokenDecimals, + ), style: STextStyles.pageTitleH1(context).copyWith( color: Theme.of( context, @@ -133,9 +131,7 @@ class SolanaTokenSummary extends ConsumerWidget { ), ), const SizedBox(width: 10), - CoinTickerTag( - ticker: tokenWallet.tokenSymbol, - ), + CoinTickerTag(ticker: tokenWallet.tokenSymbol), ], ), if (price != null) const SizedBox(height: 6), @@ -163,8 +159,9 @@ class SolanaTokenSummary extends ConsumerWidget { walletId: walletId, initialSyncStatus: initialSyncStatus, tokenContractAddress: tokenMint, - overrideIconColor: - Theme.of(context).extension()!.topNavIconPrimary, + overrideIconColor: Theme.of( + context, + ).extension()!.topNavIconPrimary, ), ), ], @@ -250,8 +247,9 @@ class TokenOptionsButton extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ RawMaterialButton( - fillColor: - Theme.of(context).extension()!.tokenSummaryButtonBG, + fillColor: Theme.of( + context, + ).extension()!.tokenSummaryButtonBG, elevation: 0, focusElevation: 0, hoverElevation: 0, @@ -267,36 +265,31 @@ class TokenOptionsButton extends StatelessWidget { padding: const EdgeInsets.all(10), child: ConditionalParent( condition: iconSize < 24, - builder: - (child) => RoundedContainer( - padding: const EdgeInsets.all(6), - color: Theme.of(context) - .extension()! - .tokenSummaryIcon - .withOpacity(0.4), - radiusMultiplier: 10, - child: Center(child: child), - ), - child: - iconAssetPathSVG.startsWith("assets/") - ? SvgPicture.asset( - iconAssetPathSVG, - color: - Theme.of( - context, - ).extension()!.tokenSummaryIcon, - width: iconSize, - height: iconSize, - ) - : SvgPicture.file( - File(iconAssetPathSVG), - color: - Theme.of( - context, - ).extension()!.tokenSummaryIcon, - width: iconSize, - height: iconSize, - ), + builder: (child) => RoundedContainer( + padding: const EdgeInsets.all(6), + color: Theme.of( + context, + ).extension()!.tokenSummaryIcon.withOpacity(0.4), + radiusMultiplier: 10, + child: Center(child: child), + ), + child: iconAssetPathSVG.startsWith("assets/") + ? SvgPicture.asset( + iconAssetPathSVG, + color: Theme.of( + context, + ).extension()!.tokenSummaryIcon, + width: iconSize, + height: iconSize, + ) + : SvgPicture.file( + File(iconAssetPathSVG), + color: Theme.of( + context, + ).extension()!.tokenSummaryIcon, + width: iconSize, + height: iconSize, + ), ), ), ), @@ -304,10 +297,9 @@ class TokenOptionsButton extends StatelessWidget { Text( subLabel, style: STextStyles.w500_12(context).copyWith( - color: - Theme.of( - context, - ).extension()!.tokenSummaryTextPrimary, + color: Theme.of( + context, + ).extension()!.tokenSummaryTextPrimary, ), ), ], diff --git a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart index e75a063d58..d6317a4802 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart @@ -58,33 +58,33 @@ class _RefreshButtonState extends ConsumerState { void initState() { _spinController = RotatingArrowsController(); - eventBus = - widget.eventBus != null ? widget.eventBus! : GlobalEventBus.instance; - - _syncStatusSubscription = - eventBus.on().listen( - (event) async { - if (event.walletId == widget.walletId) { - switch (event.newStatus) { - case WalletSyncStatus.unableToSync: - if (_spinController.hasLoadedAnimation) { - _spinController.stop?.call(); - } - break; - case WalletSyncStatus.synced: - if (_spinController.hasLoadedAnimation) { - _spinController.stop?.call(); - } - break; - case WalletSyncStatus.syncing: - if (_spinController.hasLoadedAnimation) { - _spinController.repeat?.call(); - } - break; + eventBus = widget.eventBus != null + ? widget.eventBus! + : GlobalEventBus.instance; + + _syncStatusSubscription = eventBus + .on() + .listen((event) async { + if (event.walletId == widget.walletId) { + switch (event.newStatus) { + case WalletSyncStatus.unableToSync: + if (_spinController.hasLoadedAnimation) { + _spinController.stop?.call(); + } + break; + case WalletSyncStatus.synced: + if (_spinController.hasLoadedAnimation) { + _spinController.stop?.call(); + } + break; + case WalletSyncStatus.syncing: + if (_spinController.hasLoadedAnimation) { + _spinController.repeat?.call(); + } + break; + } } - } - }, - ); + }); super.initState(); } @@ -118,7 +118,9 @@ class _RefreshButtonState extends ConsumerState { if (solanaTokenWallet != null) { if (!solanaTokenWallet.refreshMutex.isLocked) { _spinController.repeat?.call(); - solanaTokenWallet.refresh().then((_) => _spinController.stop?.call()); + solanaTokenWallet.refresh().then( + (_) => _spinController.stop?.call(), + ); } } else { // Fall back to refreshing the parent Solana wallet. @@ -154,12 +156,10 @@ class _RefreshButtonState extends ConsumerState { color: widget.overrideIconColor != null ? widget.overrideIconColor! : isDesktop - ? Theme.of(context) - .extension()! - .textFieldDefaultSearchIconRight - : Theme.of(context) - .extension()! - .textFavoriteCard, + ? Theme.of( + context, + ).extension()!.textFieldDefaultSearchIconRight + : Theme.of(context).extension()!.textFavoriteCard, ), ), ), diff --git a/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart b/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart index 42955e0068..3f31b31240 100644 --- a/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart +++ b/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart @@ -46,8 +46,9 @@ class WalletListItem extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { // debugPrint("BUILD: $runtimeType"); - final walletCountString = - walletCount == 1 ? "$walletCount wallet" : "$walletCount wallets"; + final walletCountString = walletCount == 1 + ? "$walletCount wallet" + : "$walletCount wallets"; final currency = ref.watch( prefsChangeNotifierProvider.select((value) => value.currency), ); @@ -92,7 +93,9 @@ class WalletListItem extends ConsumerWidget { .wallets .firstWhere((e) => e.info.coin == coin); - final tokenAddresses = ref.read(pWalletTokenAddresses(wallet.walletId)); + final tokenAddresses = ref.read( + pWalletTokenAddresses(wallet.walletId), + ); if (tokenAddresses.isNotEmpty) { shouldShowWalletsOverview = true; } @@ -157,8 +160,9 @@ class WalletListItem extends ConsumerWidget { Expanded( child: Consumer( builder: (_, ref, __) { - Color percentChangedColor = - Theme.of(context).extension()!.textDark; + Color percentChangedColor = Theme.of( + context, + ).extension()!.textDark; String? priceString; double? percentChange; if (ref.watch( @@ -183,15 +187,13 @@ class WalletListItem extends ConsumerWidget { percentChange = price.change24h; if (percentChange > 0) { - percentChangedColor = - Theme.of( - context, - ).extension()!.accentColorGreen; + percentChangedColor = Theme.of( + context, + ).extension()!.accentColorGreen; } else if (percentChange < 0) { - percentChangedColor = - Theme.of( - context, - ).extension()!.accentColorRed; + percentChangedColor = Theme.of( + context, + ).extension()!.accentColorRed; } } } diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart index eb354eb1e0..4cd6eb6ab6 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart @@ -174,8 +174,7 @@ class _DesktopReceiveState extends ConsumerState { } Future _onEpicReceiveSlatePressed() async { - final wallet = - ref.read(pWallets).getWallet(walletId) as EpiccashWallet; + final wallet = ref.read(pWallets).getWallet(walletId) as EpiccashWallet; Exception? ex; final result = await showLoading( @@ -605,9 +604,11 @@ class _DesktopReceiveState extends ConsumerState { ), ), ), - if (!((isMimblewimblecoin || isEpiccash) && ref.watch(pIsSlatepack(widget.walletId)))) + if (!((isMimblewimblecoin || isEpiccash) && + ref.watch(pIsSlatepack(widget.walletId)))) const SizedBox(height: 20), - if (!((isMimblewimblecoin || isEpiccash) && ref.watch(pIsSlatepack(widget.walletId)))) + if (!((isMimblewimblecoin || isEpiccash) && + ref.watch(pIsSlatepack(widget.walletId)))) ConditionalParent( condition: showMultiType, builder: (child) => Column( @@ -778,7 +779,8 @@ class _DesktopReceiveState extends ConsumerState { label: "Generate new address", ), const SizedBox(height: 20), - if ((isMimblewimblecoin || isEpiccash) && ref.watch(pIsSlatepack(widget.walletId))) + if ((isMimblewimblecoin || isEpiccash) && + ref.watch(pIsSlatepack(widget.walletId))) Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -909,7 +911,8 @@ class _DesktopReceiveState extends ConsumerState { // TODO: create transparent button class to account for hover // Conditional logic for 'Submit' button or QR code - if ((isMimblewimblecoin || isEpiccash) && ref.watch(pIsSlatepack(widget.walletId))) + if ((isMimblewimblecoin || isEpiccash) && + ref.watch(pIsSlatepack(widget.walletId))) Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), child: PrimaryButton( @@ -917,7 +920,9 @@ class _DesktopReceiveState extends ConsumerState { label: "Receive Slatepack", enabled: _slateToggleFlag, onPressed: _slateToggleFlag - ? (isEpiccash ? _onEpicReceiveSlatePressed : _onReceiveSlatePressed) + ? (isEpiccash + ? _onEpicReceiveSlatePressed + : _onReceiveSlatePressed) : null, ), ) 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 0b9377599d..51cf968055 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 @@ -220,12 +220,16 @@ class _DesktopSendFeeFormState extends ConsumerState { final fee = await tokenWallet .estimateFeeFor(amount, feeRate); ref - .read(tokenFeeSessionCacheProvider) + .read( + tokenFeeSessionCacheProvider, + ) .average[amount] = fee; } catch (_) { // Token wallet not available. - debugPrint("Token fee estimation not available"); + debugPrint( + "Token fee estimation not available", + ); } } } diff --git a/lib/providers/ui/preview_tx_button_state_provider.dart b/lib/providers/ui/preview_tx_button_state_provider.dart index fcb77fe649..2edd81ac9d 100644 --- a/lib/providers/ui/preview_tx_button_state_provider.dart +++ b/lib/providers/ui/preview_tx_button_state_provider.dart @@ -47,42 +47,43 @@ final pIsSlatepack = Provider.family((ref, walletId) { return false; }); -final pPreviewTxButtonEnabled = Provider.autoDispose - .family((ref, coin) { - final amount = ref.watch(pSendAmount) ?? Amount.zero; +final pPreviewTxButtonEnabled = Provider.autoDispose.family( + (ref, coin) { + final amount = ref.watch(pSendAmount) ?? Amount.zero; - // For MWC slatepack transactions, address validation is not required. - if (coin is Mimblewimblecoin) { - final selectedMethod = ref.watch(pSelectedMwcTransactionMethod); - if (selectedMethod == MwcTransactionMethod.slatepack) { - return amount > Amount.zero; - } + // For MWC slatepack transactions, address validation is not required. + if (coin is Mimblewimblecoin) { + final selectedMethod = ref.watch(pSelectedMwcTransactionMethod); + if (selectedMethod == MwcTransactionMethod.slatepack) { + return amount > Amount.zero; } + } - // For Epic Cash slatepack transactions, address validation is not required. - if (coin is Epiccash) { - final selectedMethod = ref.watch(pSelectedEpicTransactionMethod); - if (selectedMethod == EpicTransactionMethod.slatepack) { - return amount > Amount.zero; - } + // For Epic Cash slatepack transactions, address validation is not required. + if (coin is Epiccash) { + final selectedMethod = ref.watch(pSelectedEpicTransactionMethod); + if (selectedMethod == EpicTransactionMethod.slatepack) { + return amount > Amount.zero; } + } - if (coin is Firo) { - final firoType = ref.watch(publicPrivateBalanceStateProvider); - switch (firoType) { - case BalanceType.private: - return (ref.watch(pValidSendToAddress) || - ref.watch(pValidSparkSendToAddress)) && - !ref.watch(pIsExchangeAddress) && - amount > Amount.zero; + if (coin is Firo) { + final firoType = ref.watch(publicPrivateBalanceStateProvider); + switch (firoType) { + case BalanceType.private: + return (ref.watch(pValidSendToAddress) || + ref.watch(pValidSparkSendToAddress)) && + !ref.watch(pIsExchangeAddress) && + amount > Amount.zero; - case BalanceType.public: - return ref.watch(pValidSendToAddress) && amount > Amount.zero; - } - } else { - return ref.watch(pValidSendToAddress) && amount > Amount.zero; + case BalanceType.public: + return ref.watch(pValidSendToAddress) && amount > Amount.zero; } - }); + } else { + return ref.watch(pValidSendToAddress) && amount > Amount.zero; + } + }, +); final previewTokenTxButtonStateProvider = StateProvider.autoDispose((_) { return false; diff --git a/lib/services/price_service.dart b/lib/services/price_service.dart index 4cbf27d864..ac9ac1c395 100644 --- a/lib/services/price_service.dart +++ b/lib/services/price_service.dart @@ -76,13 +76,15 @@ class PriceService extends ChangeNotifier { } } - final _solTokenContractAddressesToCheck = await solTokenContractAddressesToCheck; + final _solTokenContractAddressesToCheck = + await solTokenContractAddressesToCheck; if (_solTokenContractAddressesToCheck.isNotEmpty) { - final solTokenPriceMap = await _priceAPI.getPricesAnd24hChangeForSolTokens( - contractAddresses: _solTokenContractAddressesToCheck, - baseCurrency: baseTicker, - ); + final solTokenPriceMap = await _priceAPI + .getPricesAnd24hChangeForSolTokens( + contractAddresses: _solTokenContractAddressesToCheck, + baseCurrency: baseTicker, + ); for (final map in solTokenPriceMap.entries) { if (_cachedTokenPrices[map.key] != map.value) { diff --git a/lib/services/solana/solana_token_api.dart b/lib/services/solana/solana_token_api.dart index 3798e45c2a..e397241326 100644 --- a/lib/services/solana/solana_token_api.dart +++ b/lib/services/solana/solana_token_api.dart @@ -274,7 +274,7 @@ class SolanaTokenAPI { _checkClient(); // Return placeholder data. - // + // // TODO: Implement actual RPC call using proper client methods. return SolanaTokenApiResponse( value: TokenAccountInfo( @@ -332,9 +332,7 @@ class SolanaTokenAPI { } Future?>> - fetchTokenMetadataByMint( - String mintAddress, - ) async { + fetchTokenMetadataByMint(String mintAddress) async { try { _checkClient(); @@ -351,14 +349,10 @@ class SolanaTokenAPI { // Until then, return null to allow users to enter custom token details. // Metadata PDA derivation not yet implemented - return SolanaTokenApiResponse?>( - value: null, - ); + return SolanaTokenApiResponse?>(value: null); } on Exception { // On error, return null to allow user to manually enter token details - return SolanaTokenApiResponse?>( - value: null, - ); + return SolanaTokenApiResponse?>(value: null); } } diff --git a/lib/utilities/amount/amount_unit.dart b/lib/utilities/amount/amount_unit.dart index 0d96fbdeff..d81dc9062f 100644 --- a/lib/utilities/amount/amount_unit.dart +++ b/lib/utilities/amount/amount_unit.dart @@ -200,7 +200,7 @@ extension AmountUnitExt on AmountUnit { String value, { required String locale, required CryptoCurrency coin, - Contract? tokenContract, + Contract? tokenContract, bool overrideWithDecimalPlacesFromString = false, }) { final precisionLost = value.startsWith("~"); diff --git a/lib/wallets/isar/models/token_wallet_info.dart b/lib/wallets/isar/models/token_wallet_info.dart index 767c5a2f9a..bf6592a8b0 100644 --- a/lib/wallets/isar/models/token_wallet_info.dart +++ b/lib/wallets/isar/models/token_wallet_info.dart @@ -57,11 +57,10 @@ class TokenWalletInfo implements IsarId { required Isar isar, }) async { // // ensure we are updating using the latest entry of this in the db - final thisEntry = - await isar.tokenWalletInfo - .where() - .walletIdTokenAddressEqualTo(walletId, tokenAddress) - .findFirst(); + final thisEntry = await isar.tokenWalletInfo + .where() + .walletIdTokenAddressEqualTo(walletId, tokenAddress) + .findFirst(); if (thisEntry == null) { throw Exception( "Attempted to update cached token balance before object was saved in db", diff --git a/lib/wallets/isar/models/wallet_info.dart b/lib/wallets/isar/models/wallet_info.dart index db0a65c701..66b4393252 100644 --- a/lib/wallets/isar/models/wallet_info.dart +++ b/lib/wallets/isar/models/wallet_info.dart @@ -442,7 +442,8 @@ class WalletInfo implements IsarId { }) async { await updateOtherData( newEntries: { - WalletInfoKeys.solanaCustomTokenMintAddresses: newMintAddresses.toList(), + WalletInfoKeys.solanaCustomTokenMintAddresses: newMintAddresses + .toList(), }, isar: isar, ); diff --git a/lib/wallets/isar/models/wallet_solana_token_info.dart b/lib/wallets/isar/models/wallet_solana_token_info.dart index 473db74119..8387e35bca 100644 --- a/lib/wallets/isar/models/wallet_solana_token_info.dart +++ b/lib/wallets/isar/models/wallet_solana_token_info.dart @@ -66,11 +66,10 @@ class WalletSolanaTokenInfo implements IsarId { required Isar isar, }) async { // Ensure we are updating using the latest entry of this in the db. - final thisEntry = - await isar.walletSolanaTokenInfo - .where() - .walletIdTokenAddressEqualTo(walletId, tokenAddress) - .findFirst(); + final thisEntry = await isar.walletSolanaTokenInfo + .where() + .walletIdTokenAddressEqualTo(walletId, tokenAddress) + .findFirst(); if (thisEntry == null) { throw Exception( "Attempted to update cached token balance before object was saved in db", diff --git a/lib/wallets/isar/providers/solana/current_sol_token_wallet_provider.dart b/lib/wallets/isar/providers/solana/current_sol_token_wallet_provider.dart index ab17451220..56203ae741 100644 --- a/lib/wallets/isar/providers/solana/current_sol_token_wallet_provider.dart +++ b/lib/wallets/isar/providers/solana/current_sol_token_wallet_provider.dart @@ -3,13 +3,15 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../../wallet/impl/sub_wallets/solana_token_wallet.dart'; /// State provider for the currently active Solana token wallet. -/// +/// /// This allows global tracking of which token wallet is being viewed/interacted-with. -final solanaTokenServiceStateProvider = - StateProvider((ref) => null); +final solanaTokenServiceStateProvider = StateProvider( + (ref) => null, +); /// Public provider to read the current active Solana token wallet. -/// +/// /// Use this in UI widgets to get the active token wallet. -final pCurrentSolanaTokenWallet = - Provider((ref) => ref.watch(solanaTokenServiceStateProvider)); +final pCurrentSolanaTokenWallet = Provider( + (ref) => ref.watch(solanaTokenServiceStateProvider), +); diff --git a/lib/wallets/isar/providers/solana/sol_token_balance_provider.dart b/lib/wallets/isar/providers/solana/sol_token_balance_provider.dart index 739e231591..3d5fb16718 100644 --- a/lib/wallets/isar/providers/solana/sol_token_balance_provider.dart +++ b/lib/wallets/isar/providers/solana/sol_token_balance_provider.dart @@ -16,70 +16,71 @@ import '../util/watcher.dart'; /// final info = ref.watch( /// pSolanaTokenWalletInfo((walletId: 'wallet1', tokenMint: 'EPjFWaJUwYUoRwzwkH4H8gNB7zHW9tLT6NCKB8S4yh6h')) /// ); -final _wstwiProvider = ChangeNotifierProvider.family< - Watcher, - ({String walletId, String tokenMint}) ->((ref, data) { - final isar = ref.watch(mainDBProvider).isar; - - final collection = isar.walletSolanaTokenInfo; - - Logging.instance.i( - "pSolanaTokenBalance: Looking up WalletSolanaTokenInfo for walletId=${data.walletId}, tokenMint=${data.tokenMint}", - ); - - WalletSolanaTokenInfo? initial = collection - .where() - .walletIdTokenAddressEqualTo(data.walletId, data.tokenMint) - .findFirstSync(); - - if (initial == null) { - Logging.instance.i( - "pSolanaTokenBalance: Creating new WalletSolanaTokenInfo entry", - ); - - // Create initial entry if not found. - final solContract = - isar.solContracts.getByAddressSync(data.tokenMint); - - initial = WalletSolanaTokenInfo( - walletId: data.walletId, - tokenAddress: data.tokenMint, - tokenFractionDigits: solContract?.decimals ?? 6, - ); - - isar.writeTxnSync(() => isar.walletSolanaTokenInfo.putSync(initial!)); - - // After insert, fetch the object again to get the assigned ID. - initial = collection - .where() - .walletIdTokenAddressEqualTo(data.walletId, data.tokenMint) - .findFirstSync()!; - - Logging.instance.i( - "pSolanaTokenBalance: Created entry with ID=${initial.id}, balance=${initial.getCachedBalance().total}", - ); - } else { - Logging.instance.i( - "pSolanaTokenBalance: Found existing entry with ID=${initial.id}, cachedBalance=${initial.getCachedBalance().total}", - ); - } - - final watcher = Watcher(initial, collection: collection); - - ref.onDispose(() => watcher.dispose()); - - return watcher; -}); +final _wstwiProvider = + ChangeNotifierProvider.family< + Watcher, + ({String walletId, String tokenMint}) + >((ref, data) { + final isar = ref.watch(mainDBProvider).isar; + + final collection = isar.walletSolanaTokenInfo; + + Logging.instance.i( + "pSolanaTokenBalance: Looking up WalletSolanaTokenInfo for walletId=${data.walletId}, tokenMint=${data.tokenMint}", + ); + + WalletSolanaTokenInfo? initial = collection + .where() + .walletIdTokenAddressEqualTo(data.walletId, data.tokenMint) + .findFirstSync(); + + if (initial == null) { + Logging.instance.i( + "pSolanaTokenBalance: Creating new WalletSolanaTokenInfo entry", + ); + + // Create initial entry if not found. + final solContract = isar.solContracts.getByAddressSync(data.tokenMint); + + initial = WalletSolanaTokenInfo( + walletId: data.walletId, + tokenAddress: data.tokenMint, + tokenFractionDigits: solContract?.decimals ?? 6, + ); + + isar.writeTxnSync(() => isar.walletSolanaTokenInfo.putSync(initial!)); + + // After insert, fetch the object again to get the assigned ID. + initial = collection + .where() + .walletIdTokenAddressEqualTo(data.walletId, data.tokenMint) + .findFirstSync()!; + + Logging.instance.i( + "pSolanaTokenBalance: Created entry with ID=${initial.id}, balance=${initial.getCachedBalance().total}", + ); + } else { + Logging.instance.i( + "pSolanaTokenBalance: Found existing entry with ID=${initial.id}, cachedBalance=${initial.getCachedBalance().total}", + ); + } + + final watcher = Watcher(initial, collection: collection); + + ref.onDispose(() => watcher.dispose()); + + return watcher; + }); /// Provider for Solana token wallet info from the database. -final pSolanaTokenWalletInfo = Provider.family< - WalletSolanaTokenInfo, - ({String walletId, String tokenMint}) ->((ref, data) { - return ref.watch(_wstwiProvider(data).select((value) => value.value)) - as WalletSolanaTokenInfo; -}); +final pSolanaTokenWalletInfo = + Provider.family< + WalletSolanaTokenInfo, + ({String walletId, String tokenMint}) + >((ref, data) { + return ref.watch(_wstwiProvider(data).select((value) => value.value)) + as WalletSolanaTokenInfo; + }); /// Provider for Solana token balance from the database. /// @@ -90,19 +91,20 @@ final pSolanaTokenWalletInfo = Provider.family< /// final balance = ref.watch( /// pSolanaTokenBalance((walletId: 'wallet1', tokenMint: 'EPjFWaJUwYUoRwzwkH4H8gNB7zHW9tLT6NCKB8S4yh6h')) /// ); -final pSolanaTokenBalance = Provider.family< - Balance, - ({String walletId, String tokenMint}) ->((ref, data) { - final balance = ref.watch( - _wstwiProvider(data).select( - (value) => (value.value as WalletSolanaTokenInfo).getCachedBalance(), - ), - ); - - Logging.instance.i( - "pSolanaTokenBalance: Returning balance=${balance.total} for walletId=${data.walletId}, tokenMint=${data.tokenMint}", - ); - - return balance; -}); +final pSolanaTokenBalance = + Provider.family(( + ref, + data, + ) { + final balance = ref.watch( + _wstwiProvider(data).select( + (value) => (value.value as WalletSolanaTokenInfo).getCachedBalance(), + ), + ); + + Logging.instance.i( + "pSolanaTokenBalance: Returning balance=${balance.total} for walletId=${data.walletId}, tokenMint=${data.tokenMint}", + ); + + return balance; + }); diff --git a/lib/wallets/isar/providers/solana/sol_tokens_provider.dart b/lib/wallets/isar/providers/solana/sol_tokens_provider.dart index fe6a711bbe..373d8cdfdb 100644 --- a/lib/wallets/isar/providers/solana/sol_tokens_provider.dart +++ b/lib/wallets/isar/providers/solana/sol_tokens_provider.dart @@ -21,10 +21,11 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; /// ``` /// Note: For full token details (name, symbol, decimals), these would need to be /// fetched from the Solana token metadata or a token list API. -final pSolanaWalletTokens = Provider.family, String>( - (ref, walletId) { - // TODO: Implement token details fetching from Solana metadata or API. - // For now, just return an empty list as token details are not persisted. - return []; - }, -); +final pSolanaWalletTokens = Provider.family, String>(( + ref, + walletId, +) { + // TODO: Implement token details fetching from Solana metadata or API. + // For now, just return an empty list as token details are not persisted. + return []; +}); diff --git a/lib/wallets/wallet/impl/ethereum_wallet.dart b/lib/wallets/wallet/impl/ethereum_wallet.dart index 829110651b..d972777034 100644 --- a/lib/wallets/wallet/impl/ethereum_wallet.dart +++ b/lib/wallets/wallet/impl/ethereum_wallet.dart @@ -218,7 +218,9 @@ class EthereumWallet extends Bip39Wallet with PrivateKeyInterface { final addressHex = (await getCurrentReceivingAddress())!.value; final address = eth_wallet.EthereumAddress.fromHex(addressHex); - final eth_wallet.EtherAmount ethBalance = await client.getBalance(address); + final eth_wallet.EtherAmount ethBalance = await client.getBalance( + address, + ); final balance = Balance( total: Amount( rawValue: ethBalance.getInWei, diff --git a/lib/wallets/wallet/impl/firo_wallet.dart b/lib/wallets/wallet/impl/firo_wallet.dart index c3b861ff7e..905a802219 100644 --- a/lib/wallets/wallet/impl/firo_wallet.dart +++ b/lib/wallets/wallet/impl/firo_wallet.dart @@ -996,10 +996,7 @@ class FiroWallet extends Bip39HDWallet ); // addr.ip (4 bytes) - final ipParts = ip - .split('.') - .map((e) => int.parse(e)) - .toList(); + final ipParts = ip.split('.').map((e) => int.parse(e)).toList(); if (ipParts.length != 4) { throw Exception("Invalid IP address: $ip"); } diff --git a/lib/widgets/epic_txs_method_toggle.dart b/lib/widgets/epic_txs_method_toggle.dart index f08f086f16..7dde6080b7 100644 --- a/lib/widgets/epic_txs_method_toggle.dart +++ b/lib/widgets/epic_txs_method_toggle.dart @@ -29,30 +29,23 @@ class EpicTxsMethodToggle extends ConsumerWidget { return Toggle( onValueChanged: (value) { - ref.read(pSelectedEpicTransactionMethod.notifier).state = - value - ? EpicTransactionMethod.epicbox - : EpicTransactionMethod.slatepack; + ref.read(pSelectedEpicTransactionMethod.notifier).state = value + ? EpicTransactionMethod.epicbox + : EpicTransactionMethod.slatepack; }, isOn: ref.watch(pSelectedEpicTransactionMethod) == EpicTransactionMethod.epicbox, - onColor: - isDesktop - ? Theme.of( - context, - ).extension()!.rateTypeToggleDesktopColorOn - : Theme.of( - context, - ).extension()!.rateTypeToggleColorOn, - offColor: - isDesktop - ? Theme.of( - context, - ).extension()!.rateTypeToggleDesktopColorOff - : Theme.of( - context, - ).extension()!.rateTypeToggleColorOff, + onColor: isDesktop + ? Theme.of( + context, + ).extension()!.rateTypeToggleDesktopColorOn + : Theme.of(context).extension()!.rateTypeToggleColorOn, + offColor: isDesktop + ? Theme.of( + context, + ).extension()!.rateTypeToggleDesktopColorOff + : Theme.of(context).extension()!.rateTypeToggleColorOff, decoration: BoxDecoration( borderRadius: BorderRadius.circular( Constants.size.circularBorderRadius,