Skip to content

Should await for requestSwitchToChain #145

@mthinh

Description

@mthinh

SDK Affected

AppKit

Context
I want to selectChain before doing any transaction, when calling selectChain with switchChain = true, we call requestSwitchToChain without waiting for it to be done. This lead to making transaction failed

Should await for requestSwitchToChain and move launchConnectedWallet before calling switch

Reproducible code
In appkit_modal_impl.dart, selectChain method

if (!hasChainAlready) {
  requestSwitchToChain(chainInfo);
  // Should launch connected wallet first 
// Then call requestSwitchToChain
  final hasSwitchMethod = _currentSession!.hasSwitchMethod();
  if (hasSwitchMethod) {
    launchConnectedWallet();
  }
} else {
  await _setLocalEthChain(chainInfo.chainId, logEvent: logEvent);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    appkitAppKit related issueawaiting customerFurther information has been requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions