From caedd6073012cb75477b967c0192de091ebd679a Mon Sep 17 00:00:00 2001 From: Alfreedom <00tango.bromine@icloud.com> Date: Thu, 26 Oct 2023 15:27:31 +0200 Subject: [PATCH] minor changes and new method for web3modal to use --- CHANGELOG.md | 2 +- LICENSE | 11 +++++++++ analysis_options.yaml | 3 +++ lib/apis/utils/constants.dart | 2 +- lib/apis/utils/namespace_utils.dart | 19 +++++++++++++++ lib/src/version.dart | 2 +- pubspec.yaml | 2 +- test/core_api/relay_client_test.dart | 36 ---------------------------- 8 files changed, 37 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98cac07d..97ac9487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.1.7 +## 2.1.8 - Minor changes. diff --git a/LICENSE b/LICENSE index 1f28223e..8a48a71f 100644 --- a/LICENSE +++ b/LICENSE @@ -175,6 +175,17 @@ END OF TERMS AND CONDITIONS + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + Copyright 2023 Eucalyptus Labs, Inc. Copyright 2023 Sterling Long Copyright 2023 WalletConnect, Inc. diff --git a/analysis_options.yaml b/analysis_options.yaml index 131bdc23..0995805e 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -28,6 +28,9 @@ linter: non_constant_identifier_names: false analyzer: + exclude: + - "**/*.g.dart" + - "**/*.freezed.dart" errors: invalid_annotation_target: ignore diff --git a/lib/apis/utils/constants.dart b/lib/apis/utils/constants.dart index c9eda45e..51c48e0d 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.7'; + static const SDK_VERSION = '2.1.8'; static const CORE_PROTOCOL = 'wc'; static const CORE_VERSION = 2; diff --git a/lib/apis/utils/namespace_utils.dart b/lib/apis/utils/namespace_utils.dart index 4c1c8a42..aee2d1da 100644 --- a/lib/apis/utils/namespace_utils.dart +++ b/lib/apis/utils/namespace_utils.dart @@ -140,6 +140,25 @@ class NamespaceUtils { return methods; } + /// Gets the optional methods from a namespace map for the given chain + static List getOptionalMethodsForChainId({ + required String chainId, + required Map optionalNamespaces, + }) { + List methods = []; + optionalNamespaces.forEach((String nsOrChain, RequiredNamespace rns) { + if (nsOrChain == chainId) { + methods.addAll(rns.methods); + } else { + if ((rns.chains ?? []).contains('$nsOrChain:$chainId')) { + methods.addAll(rns.methods); + } + } + }); + + return methods; + } + /// Gets the methods from a namespace map for the given chain id static List getNamespacesEventsForChain({ required String chainId, diff --git a/lib/src/version.dart b/lib/src/version.dart index f39844c3..7369037d 100644 --- a/lib/src/version.dart +++ b/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '2.1.7'; +const packageVersion = '2.1.8'; diff --git a/pubspec.yaml b/pubspec.yaml index 80c4aae2..9d51363c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: walletconnect_flutter_v2 description: This repository contains oficial implementation of WalletConnect v2 protocols for Flutter applications. The communications protocol for web3. -version: 2.1.7 +version: 2.1.8 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 31bf759f..0294a136 100644 --- a/test/core_api/relay_client_test.dart +++ b/test/core_api/relay_client_test.dart @@ -38,9 +38,6 @@ void main() { group('Relay throws errors', () { test('on init if there is no internet connection', () async { final MockWebSocketHandler mockWebSocketHandler = MockWebSocketHandler(); - // when(mockWebSocketHandler.setup(url: anyNamed('url'))).thenAnswer( - // (_) async => Future.value(), - // ); when(mockWebSocketHandler.connect()).thenThrow(const WalletConnectError( code: -1, message: 'No internet connection: test', @@ -63,16 +60,9 @@ void main() { errorCounter++; expect(args!.error.message, 'No internet connection: test'); }); - // when(WalletConnectUtils.getPackageName()).thenAnswer( - // (_) async => 'test', - // ); - // when(core.relayClient.subscribeToHeartbeat()).thenThrow(Exception()); await core.storage.init(); await core.crypto.init(); await core.relayClient.init(); - // try {} on WalletConnectError catch (e) { - // expect(e.message, 'No internet connection: test'); - // } verify(mockWebSocketHandler.setup( url: argThat( @@ -108,37 +98,11 @@ void main() { completer.complete(); }); - // when(WalletConnectUtils.getPackageName()).thenAnswer( - // (_) async => 'test', - // ); - // when(core.relayClient.subscribeToHeartbeat()).thenThrow(Exception()); - await core.start(); await completer.future; core.relayClient.onRelayClientError.unsubscribeAll(); - - // expect( - // () async => await core.start(), - // throwsA( - // isA().having( - // (e) => e.message, - // 'Invalid project id', - // 'WebSocket connection failed, this could be: 1. Missing project id, 2. Invalid project id, 3. Too many requests', - // ), - // ), - // ); - // expect( - // () async => await core.start(), - // throwsA( - // isA().having( - // (e) => e.message, - // 'Invalid project id', - // WebSocketErrors.PROJECT_ID_NOT_FOUND_MESSAGE, - // ), - // ), - // ); }); });