getActiveNetworkId method
The network id the connected external wallet reports itself to be on, for chain/accountAddress.
Implementation
@override
Future<String> getActiveNetworkId(String chain, String accountAddress) async {
Future<String> 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();
final networkId = await _externalWalletProvider.getActiveNetworkId(chain, accountAddress);
operationScope.check();
return networkId;
}
return await _api.instrumentation.runAsync("externalWallet.getActiveNetworkId", instrumentationOperation);
}