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

Commit

Permalink
fix: Fixed switch network custom network & dapp
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Sep 11, 2023
1 parent 5b63bbe commit 3ffff99
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class OpenDAppPresenter extends CompletePresenter<OpenDAppState> {
ref.read(chainConfigurationUseCaseProvider);
late final _tokenContractUseCase = ref.read(tokenContractUseCaseProvider);
late final _accountUseCase = ref.read(accountUseCaseProvider);
late final _authUseCase = ref.read(authUseCaseProvider);

@override
void initState() {
Expand Down Expand Up @@ -185,6 +186,7 @@ class OpenDAppPresenter extends CompletePresenter<OpenDAppState> {
void switchNetwork(dynamic id, Network toNetwork, String rawChainId) {
// "{"id":1692336424091,"name":"switchEthereumChain","object":{"chainId":"0x66eed"},"network":"ethereum"}"
_chainConfigurationUseCase.switchDefaultNetwork(toNetwork);
_authUseCase.resetNetwork(toNetwork);
notify(() => state.network = toNetwork);
state.webviewController?.sendResult('null', id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class DeleteCustomNetworkPresenter
late final TextEditingController chainIdController = TextEditingController();
late final TextEditingController symbolController = TextEditingController();
late final TextEditingController explorerController = TextEditingController();

late final _authUseCase = ref.read(authUseCaseProvider);

Network? selectedNetwork;

@override
Expand Down Expand Up @@ -150,7 +151,7 @@ class DeleteCustomNetworkPresenter

void setAsDefault() {
_chainConfigurationUseCase.switchDefaultNetwork(selectedNetwork!);

_authUseCase.resetNetwork(selectedNetwork!);
addMessage(translate('x_is_now_active')!.replaceFirst(
'{0}',
selectedNetwork!.label ??
Expand Down
2 changes: 1 addition & 1 deletion packages/shared

0 comments on commit 3ffff99

Please sign in to comment.