androidfluttermetamask

Unhandled Exception: SocketException: Failed host lookup: 'xxx.bridge.walletconnect.org'


I want to do:

Check the operation of applications created with Flutter. I want to perform login using MetaMask.

Description of the error that is occurring:

E/flutter (16080): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: SocketException: Failed host lookup: '8.bridge.walletconnect.org' (OS Error: No address associated with hostname, errno = 7)
E/flutter (16080): #0      _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:721:35)
E/flutter (16080): #1      _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1914:26)
E/flutter (16080): #2      RawSocket.startConnect (dart:io-patch/socket_patch.dart:27:23)
E/flutter (16080): #3      RawSecureSocket.startConnect (dart:io/secure_socket.dart:297:22)
E/flutter (16080): #4      SecureSocket.startConnect (dart:io/secure_socket.dart:77:28)
E/flutter (16080): #5      _ConnectionTarget.connect (dart:_http/http_impl.dart:2482:26)
E/flutter (16080): #6      _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2924:12)
E/flutter (16080): #7      _HttpClient._getConnection (dart:_http/http_impl.dart:2929:12)
E/flutter (16080): #8      _HttpClient._openUrl (dart:_http/http_impl.dart:2784:12)
E/flutter (16080): #9      _HttpClient.openUrl (dart:_http/http_impl.dart:2622:7)
E/flutter (16080): #10     _WebSocketImpl.connect (dart:_http/websocket_impl.dart:1021:42)
E/flutter (16080): #11     WebSocket.connect (dart:_http/websocket.dart:320:22)
E/flutter (16080): #12     new IOWebSocketChannel.connect (package:web_socket_channel/io.dart:80:28)
E/flutter (16080): #13     connect (package:web_socket_channel/src/_connect_io.dart:15:24)
E/flutter (16080): #14     new WebSocketChannel.connect (package:web_socket_channel/src/channel.dart:115:16)
E/flutter (16080): #15     ReconnectingWebSocket.open (package:walletconnect_dart/src/network/reconnecting_web_socket.dart:86:33)
E/flutter (16080): #16     ReconnectingWebSocket._onClose.<anonymous closure> (package:walletconnect_dart/src/network/reconnecting_web_socket.dart:157:7)
E/flutter (16080): #17     _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
E/flutter (16080): #18     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter (16080): #19     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter (16080): #20     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:784:19)
E/flutter (16080): #21     _StreamController._add (dart:async/stream_controller.dart:658:7)
E/flutter (16080): #22     new Stream.fromFuture.<anonymous closure> (dart:async/stream.dart:242:18)
E/flutter (16080): <asynchronous suspension>
E/flutter (16080): #23     new Stream.fromFuture.<anonymous closure> (dart:async/stream.dart:241:17)
E/flutter (16080): <asynchronous suspension>

On the application, when I press the Connect Wallet button, the MetaMask opens, but nothing more happens.

The code for Web3Connect can be found here:

class SignIn extends StatelessWidget {
  SignIn({Key? key}) : super(key: key);
  final connection = Web3Connect();
  final String _rpcUrl = "https://testnet.aurora.dev";
  final _client =
      Web3Client("https://testnet.aurora.dev", Client(), socketConnector: () {
    return IOWebSocketChannel.connect("wss://testnet.aurora.dev")
        .cast<String>();
  });

lib/view/screens/signin.dart - GitHub

I tried:

Add <uses-permission android:name="android.permission.INTERNET"/> to android/app/src/main/AndroidManifest.xml


Solution

  • Solution:

    Change the library used for Wallet connection from web3_wallet to walletconnect_flutter_v2.

    Cause:

    Web3_connect has not been updated with obsolete endpoints.

    Reference:

    WalletConnect v1.0 Shutdown: What to Expect and How to Prepare