diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ed227b1..dc748bb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.3 + +- Relay Client no longer throws errors on init + ## 2.1.2 - No internet connection/invalid URL errors will no longer throw, but the relay's `onRelayClientError` will emit them. diff --git a/lib/apis/core/core.dart b/lib/apis/core/core.dart index 2d66d075..21bfb09c 100644 --- a/lib/apis/core/core.dart +++ b/lib/apis/core/core.dart @@ -152,17 +152,13 @@ class Core implements ICore { Future start() async { await storage.init(); await crypto.init(); + await relayClient.init(); - try { - await relayClient.init(); - } catch (e) { - // If the relay URL is the default, try both it and the backup (.org) - if (_relayUrl == WalletConnectConstants.DEFAULT_RELAY_URL) { - _relayUrl = WalletConnectConstants.FALLBACK_RELAY_URL; - try { - await relayClient.init(); - } catch (_) {} - } + // If it didn't connect, and the relayUrl is the default, try the fallback + if (!relayClient.isConnected && + _relayUrl == WalletConnectConstants.DEFAULT_RELAY_URL) { + _relayUrl = WalletConnectConstants.FALLBACK_RELAY_URL; + relayClient.connect(); } await expirer.init(); diff --git a/lib/apis/core/relay_client/relay_client.dart b/lib/apis/core/relay_client/relay_client.dart index b3f47aca..a738079d 100644 --- a/lib/apis/core/relay_client/relay_client.dart +++ b/lib/apis/core/relay_client/relay_client.dart @@ -277,7 +277,6 @@ class RelayClient implements IRelayClient { e, ), ); - rethrow; } _connecting = false; } diff --git a/lib/apis/utils/constants.dart b/lib/apis/utils/constants.dart index f1d7ded6..f07f2ac6 100644 --- a/lib/apis/utils/constants.dart +++ b/lib/apis/utils/constants.dart @@ -1,5 +1,5 @@ class WalletConnectConstants { - static const SDK_VERSION = '2.1.2'; + static const SDK_VERSION = '2.1.3'; static const CORE_PROTOCOL = 'wc'; static const CORE_VERSION = 2; diff --git a/pubspec.yaml b/pubspec.yaml index e3f3bd1e..23c55b00 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: walletconnect_flutter_v2 description: WalletConnect v2 client made in dart for flutter. -version: 2.1.2 +version: 2.1.3 repository: https://github.com/WalletConnect/WalletConnectFlutterV2 environment: diff --git a/test/core_api/relay_client_test.dart b/test/core_api/relay_client_test.dart index 5090b4bb..0a716095 100644 --- a/test/core_api/relay_client_test.dart +++ b/test/core_api/relay_client_test.dart @@ -57,11 +57,10 @@ void main() { }); await core.storage.init(); await core.crypto.init(); - try { - await core.relayClient.init(); - } on WalletConnectError catch (e) { - expect(e.message, 'No internet connection: test'); - } + await core.relayClient.init(); + // try {} on WalletConnectError catch (e) { + // expect(e.message, 'No internet connection: test'); + // } verify(mockWebSocketHandler.setup( url: argThat(