disconnectExternalWallet method
Disconnects one address. Other connected addresses stay connected.
Implementation
@override
Future<void> disconnectExternalWallet(String address) async {
Future<void> instrumentationOperation() async {
final operationScope = _state.flowScope.capture(replace: false);
await operationScope.ready();
final walletConnectProjectId = _state.projectSettings?.sdk?.walletConnect?.projectId;
if (walletConnectProjectId == null) {
throw DynamicStateException("This environment has no WalletConnect projectId — enable WalletConnect for it in the Dynamic dashboard");
}
operationScope.check();
await _externalWalletProvider.initialize(walletConnectProjectId, _config.appName, _config.appLogoUrl, _config.nativeLink, _config.universalLink);
operationScope.check();
operationScope.check();
await _externalWalletProvider.disconnect(address);
operationScope.check();
operationScope.commit(() {
_externalWalletState.externalWalletAccounts = _externalWalletState.externalWalletAccounts?.map((account) => (account.address == address ? null : account)).where((v) => v != null).map((v) => v!).toList() ?? const [];
_externalWalletState.externalWalletAccountsChanged.emit(_externalWalletState.externalWalletAccounts);
});
}
return await _api.instrumentation.runAsync("externalWallet.disconnectExternalWallet", instrumentationOperation);
}