diff --git a/cw_solana/lib/default_spl_tokens.dart b/cw_solana/lib/default_spl_tokens.dart index 7acad78e0..21b5ef79d 100644 --- a/cw_solana/lib/default_spl_tokens.dart +++ b/cw_solana/lib/default_spl_tokens.dart @@ -19,30 +19,6 @@ class DefaultSPLTokens { mint: 'usdcsol', enabled: true, ), - SPLToken( - name: 'Wrapped Ethereum (Sollet)', - symbol: 'soETH', - mintAddress: '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk', - decimal: 6, - mint: 'soEth', - iconPath: 'assets/images/eth_icon.png', - ), - SPLToken( - name: 'Wrapped SOL', - symbol: 'WSOL', - mintAddress: 'So11111111111111111111111111111111111111112', - decimal: 9, - mint: 'WSOL', - iconPath: 'assets/images/sol_icon.png', - ), - SPLToken( - name: 'Wrapped Bitcoin (Sollet)', - symbol: 'BTC', - mintAddress: '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E', - decimal: 6, - mint: 'btcsol', - iconPath: 'assets/images/btc.png', - ), SPLToken( name: 'Bonk', symbol: 'Bonk', @@ -50,21 +26,7 @@ class DefaultSPLTokens { decimal: 5, mint: 'Bonk', iconPath: 'assets/images/bonk_icon.png', - ), - SPLToken( - name: 'Helium Network Token', - symbol: 'HNT', - mintAddress: 'hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux', - decimal: 8, - mint: 'hnt', - iconPath: 'assets/images/hnt_icon.png', - ), - SPLToken( - name: 'Pyth Network', - symbol: 'PYTH', - mintAddress: 'HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3', - decimal: 6, - mint: 'pyth', + enabled: true, ), SPLToken( name: 'Raydium', @@ -73,6 +35,51 @@ class DefaultSPLTokens { decimal: 6, mint: 'ray', iconPath: 'assets/images/ray_icon.png', + enabled: true, + ), + SPLToken( + name: 'Wrapped Ethereum (Sollet)', + symbol: 'soETH', + mintAddress: '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk', + decimal: 6, + mint: 'soEth', + iconPath: 'assets/images/eth_icon.png', + enabled: false, + ), + SPLToken( + name: 'Wrapped SOL', + symbol: 'WSOL', + mintAddress: 'So11111111111111111111111111111111111111112', + decimal: 9, + mint: 'WSOL', + iconPath: 'assets/images/sol_icon.png', + enabled: false, + ), + SPLToken( + name: 'Wrapped Bitcoin (Sollet)', + symbol: 'BTC', + mintAddress: '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E', + decimal: 6, + mint: 'btcsol', + iconPath: 'assets/images/btc.png', + enabled: false, + ), + SPLToken( + name: 'Helium Network Token', + symbol: 'HNT', + mintAddress: 'hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux', + decimal: 8, + mint: 'hnt', + iconPath: 'assets/images/hnt_icon.png', + enabled: false, + ), + SPLToken( + name: 'Pyth Network', + symbol: 'PYTH', + mintAddress: 'HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3', + decimal: 6, + mint: 'pyth', + enabled: false, ), SPLToken( name: 'GMT', @@ -81,6 +88,7 @@ class DefaultSPLTokens { decimal: 6, mint: 'ray', iconPath: 'assets/images/gmt_icon.png', + enabled: false, ), SPLToken( name: 'AvocadoCoin', @@ -89,6 +97,7 @@ class DefaultSPLTokens { decimal: 8, mint: 'avdo', iconPath: 'assets/images/avdo_icon.png', + enabled: false, ), ]; diff --git a/lib/core/wallet_creation_service.dart b/lib/core/wallet_creation_service.dart index a55e9ee3f..1fa50a6be 100644 --- a/lib/core/wallet_creation_service.dart +++ b/lib/core/wallet_creation_service.dart @@ -58,7 +58,7 @@ class WalletCreationService { checkIfExists(credentials.name); final password = generateWalletPassword(); credentials.password = password; - if (type == WalletType.bitcoinCash || type == WalletType.ethereum) { + if (_hasSeedPhraseLengthOption) { credentials.seedPhraseLength = settingsStore.seedPhraseLength.value; } await keyService.saveWalletPassword(password: password, walletName: credentials.name); @@ -72,6 +72,25 @@ class WalletCreationService { return wallet; } + bool get _hasSeedPhraseLengthOption { + switch (type) { + case WalletType.ethereum: + case WalletType.bitcoinCash: + case WalletType.polygon: + case WalletType.solana: + case WalletType.tron: + return true; + case WalletType.monero: + case WalletType.none: + case WalletType.bitcoin: + case WalletType.litecoin: + case WalletType.haven: + case WalletType.nano: + case WalletType.banano: + return false; + } + } + Future restoreFromKeys(WalletCredentials credentials, {bool? isTestnet}) async { checkIfExists(credentials.name); final password = generateWalletPassword(); diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index 381365ceb..bec10435e 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -36,7 +36,7 @@ import 'package:cake_wallet/src/screens/release_notes/release_notes_screen.dart' import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; import 'package:cake_wallet/themes/extensions/balance_page_theme.dart'; -class DashboardPage extends StatelessWidget { +class DashboardPage extends StatefulWidget { DashboardPage({ required this.bottomSheetService, required this.balancePage, @@ -50,43 +50,71 @@ class DashboardPage extends StatelessWidget { final WalletAddressListViewModel addressListViewModel; @override - Widget build(BuildContext context) { - final screenHeight = MediaQuery.of(context).size.height; - return Scaffold( - body: Builder( - builder: (_) { - final dashboardPageView = RefreshIndicator( - displacement: screenHeight * 0.1, - onRefresh: () async => await dashboardViewModel.refreshDashboard(), - child: SingleChildScrollView( - physics: AlwaysScrollableScrollPhysics(), - child: Container( - height: screenHeight, - child: _DashboardPageView( - balancePage: balancePage, - bottomSheetService: bottomSheetService, - dashboardViewModel: dashboardViewModel, - addressListViewModel: addressListViewModel, - ), - ), - ), - ); + State createState() => _DashboardPageState(); +} - if (DeviceInfo.instance.isDesktop) { - if (responsiveLayoutUtil.screenWidth > - ResponsiveLayoutUtilBase.kDesktopMaxDashBoardWidthConstraint) { - return getIt.get(); - } else { - return dashboardPageView; - } - } else if (responsiveLayoutUtil.shouldRenderMobileUI) { - return dashboardPageView; - } else { - return getIt.get(); - } - }, +class _DashboardPageState extends State { + @override + void initState() { + super.initState(); + + bool isMobileLayout = + responsiveLayoutUtil.screenWidth < ResponsiveLayoutUtilBase.kMobileThreshold; + + reaction((_) => responsiveLayoutUtil.screenWidth, (screenWidth) { + // Check if it was previously in mobile layout, and now changing to desktop + if (isMobileLayout && + screenWidth > ResponsiveLayoutUtilBase.kDesktopMaxDashBoardWidthConstraint) { + setState(() { + isMobileLayout = false; + }); + } + + // Check if it was previously in desktop layout, and now changing to mobile + if (!isMobileLayout && + screenWidth <= ResponsiveLayoutUtilBase.kDesktopMaxDashBoardWidthConstraint) { + setState(() { + isMobileLayout = true; + }); + } + }); + } + + @override + Widget build(BuildContext context) { + Widget dashboardChild; + + final dashboardPageView = RefreshIndicator( + displacement: responsiveLayoutUtil.screenHeight * 0.1, + onRefresh: () async => await widget.dashboardViewModel.refreshDashboard(), + child: SingleChildScrollView( + physics: AlwaysScrollableScrollPhysics(), + child: Container( + height: responsiveLayoutUtil.screenHeight, + child: _DashboardPageView( + balancePage: widget.balancePage, + bottomSheetService: widget.bottomSheetService, + dashboardViewModel: widget.dashboardViewModel, + addressListViewModel: widget.addressListViewModel, + ), + ), ), ); + + if (DeviceInfo.instance.isDesktop) { + if (responsiveLayoutUtil.screenWidth > + ResponsiveLayoutUtilBase.kDesktopMaxDashBoardWidthConstraint) { + dashboardChild = getIt.get(); + } else { + dashboardChild = dashboardPageView; + } + } else if (responsiveLayoutUtil.shouldRenderMobileUI) { + dashboardChild = dashboardPageView; + } else { + dashboardChild = getIt.get(); + } + + return Scaffold(body: dashboardChild); } } diff --git a/lib/utils/responsive_layout_util.dart b/lib/utils/responsive_layout_util.dart index 86a4a3776..aa30b3f07 100644 --- a/lib/utils/responsive_layout_util.dart +++ b/lib/utils/responsive_layout_util.dart @@ -6,7 +6,7 @@ part 'responsive_layout_util.g.dart'; class _ResponsiveLayoutUtil = ResponsiveLayoutUtilBase with _$_ResponsiveLayoutUtil; abstract class ResponsiveLayoutUtilBase with Store, WidgetsBindingObserver { - static const double _kMobileThreshold = 550; + static const double kMobileThreshold = 550; static const double kDesktopMaxWidthConstraint = 400; static const double kDesktopMaxDashBoardWidthConstraint = 900; static const double kPopupWidth = 400; @@ -42,13 +42,13 @@ abstract class ResponsiveLayoutUtilBase with Store, WidgetsBindingObserver { @computed bool get shouldRenderMobileUI { - return (screenWidth <= _kMobileThreshold) || + return (screenWidth <= kMobileThreshold) || (orientation == Orientation.portrait && screenWidth < screenHeight) || (orientation == Orientation.landscape && screenWidth < screenHeight); } bool get shouldRenderTabletUI { - return screenWidth > _kMobileThreshold && screenWidth < kDesktopMaxDashBoardWidthConstraint; + return screenWidth > kMobileThreshold && screenWidth < kDesktopMaxDashBoardWidthConstraint; } } diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index 1560a4be0..5e0443bf8 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -154,11 +154,11 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with ChangeNowExchangeProvider(settingsStore: _settingsStore), SideShiftExchangeProvider(), SimpleSwapExchangeProvider(), - TrocadorExchangeProvider( - useTorOnly: _useTorOnly, providerStates: _settingsStore.trocadorProviderStates), ThorChainExchangeProvider(tradesStore: trades), if (FeatureFlag.isExolixEnabled) ExolixExchangeProvider(), QuantexExchangeProvider(), + TrocadorExchangeProvider( + useTorOnly: _useTorOnly, providerStates: _settingsStore.trocadorProviderStates), ]; @observable