Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
fix: Correct mns site & update balance check
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Sep 12, 2023
1 parent 8c15abf commit f3dddec
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -15,6 +16,8 @@ class SplashMNSQueryPresenter extends CompletePresenter<SplashMNSQueryState> {

late final _tokenContractUseCase = ref.read(tokenContractUseCaseProvider);
late final _accountUserCase = ref.read(accountUseCaseProvider);
late final _chainConfigurationUseCase =
ref.read(chainConfigurationUseCaseProvider);

late final TextEditingController usernameController = TextEditingController();

Expand All @@ -27,6 +30,12 @@ class SplashMNSQueryPresenter extends CompletePresenter<SplashMNSQueryState> {
notify(() => state.walletAddress = value.address);
}
});

listen(_chainConfigurationUseCase.selectedNetwork, (value) {
if (value != null) {
state.network = value;
}
});
}

Future<void> queryNameAvailable() async {
Expand Down Expand Up @@ -86,9 +95,11 @@ class SplashMNSQueryPresenter extends CompletePresenter<SplashMNSQueryState> {
}

Future<void> 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()));
});
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Object?> get props => [
Expand Down
3 changes: 3 additions & 0 deletions lib/features/splash/setup_wallet/setup_wallet_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -27,6 +28,8 @@ class SplashSetupWalletPresenter
_chainConfigurationUseCase.addItems(defaultList);
}
_chainConfigurationUseCase.getCurrentNetwork();
_authUseCase.resetNetwork(
_chainConfigurationUseCase.getCurrentNetworkWithoutRefresh());
});

listen<Language?>(
Expand Down
2 changes: 1 addition & 1 deletion packages/shared

0 comments on commit f3dddec

Please sign in to comment.