diff --git a/lib/features/splash/mns_process/presentation/mns_query/mns_query_presenter.dart b/lib/features/splash/mns_process/presentation/mns_query/mns_query_presenter.dart index 39083d7b..84358c16 100644 --- a/lib/features/splash/mns_process/presentation/mns_query/mns_query_presenter.dart +++ b/lib/features/splash/mns_process/presentation/mns_query/mns_query_presenter.dart @@ -1,3 +1,4 @@ +import 'package:datadashwallet/common/config.dart'; import 'package:datadashwallet/features/dapps/dapps.dart'; import 'package:datadashwallet/core/core.dart'; import 'package:datadashwallet/features/portfolio/presentation/widgets/show_wallet_address_dialog.dart'; @@ -15,6 +16,8 @@ class SplashMNSQueryPresenter extends CompletePresenter { late final _tokenContractUseCase = ref.read(tokenContractUseCaseProvider); late final _accountUserCase = ref.read(accountUseCaseProvider); + late final _chainConfigurationUseCase = + ref.read(chainConfigurationUseCaseProvider); late final TextEditingController usernameController = TextEditingController(); @@ -27,6 +30,12 @@ class SplashMNSQueryPresenter extends CompletePresenter { notify(() => state.walletAddress = value.address); } }); + + listen(_chainConfigurationUseCase.selectedNetwork, (value) { + if (value != null) { + state.network = value; + } + }); } Future queryNameAvailable() async { @@ -86,9 +95,11 @@ class SplashMNSQueryPresenter extends CompletePresenter { } Future claim(String name) async { + final launchUrl = state.network!.chainId == Config.mxcMainnetChainId + ? Config.mainnetMns(name) + : Config.testnetMns(name); await navigator - ?.push(route.featureDialog( - OpenAppPage(url: 'https://wannsee-mns.mxc.com/$name.mxc/register'))) + ?.push(route.featureDialog(OpenAppPage(url: launchUrl))) .then((_) { navigator?.replaceAll(route(const DAppsPage())); }); diff --git a/lib/features/splash/mns_process/presentation/mns_query/mns_query_state.dart b/lib/features/splash/mns_process/presentation/mns_query/mns_query_state.dart index ccb0e314..63d839cb 100644 --- a/lib/features/splash/mns_process/presentation/mns_query/mns_query_state.dart +++ b/lib/features/splash/mns_process/presentation/mns_query/mns_query_state.dart @@ -1,11 +1,13 @@ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; +import 'package:mxc_logic/mxc_logic.dart'; class SplashMNSQueryState with EquatableMixin { bool isRegistered = false; String? errorText; String? walletAddress; bool checking = false; + Network? network; @override List get props => [ diff --git a/lib/features/splash/setup_wallet/setup_wallet_presenter.dart b/lib/features/splash/setup_wallet/setup_wallet_presenter.dart index 56b6a931..fd67cc7d 100644 --- a/lib/features/splash/setup_wallet/setup_wallet_presenter.dart +++ b/lib/features/splash/setup_wallet/setup_wallet_presenter.dart @@ -17,6 +17,7 @@ class SplashSetupWalletPresenter ref.read(chainConfigurationUseCaseProvider); late final LanguageUseCase _languageUseCase = ref.read(languageUseCaseProvider); + late final _authUseCase = ref.read(authUseCaseProvider); @override void initState() { @@ -27,6 +28,8 @@ class SplashSetupWalletPresenter _chainConfigurationUseCase.addItems(defaultList); } _chainConfigurationUseCase.getCurrentNetwork(); + _authUseCase.resetNetwork( + _chainConfigurationUseCase.getCurrentNetworkWithoutRefresh()); }); listen( diff --git a/packages/shared b/packages/shared index 4d2f41c3..398b14b9 160000 --- a/packages/shared +++ b/packages/shared @@ -1 +1 @@ -Subproject commit 4d2f41c3476316351d27beb6067d33bacd005dad +Subproject commit 398b14b957dc481e2369604b0733da3cd5f24055