Skip to content

Commit

Permalink
Fixed relay url regression and added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sterling Long committed Jun 27, 2023
1 parent c9ae847 commit e4c201a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 24 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.12

- Fixed regression with default relay URL, added tests to ensure it doesn't happen again

## 2.0.11

- Updated relay client's error messages to be accurate and descriptive.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:async';
import 'package:stream_channel/stream_channel.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/websocket/i_http_client.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/websocket/i_websocket_handler.dart';
import 'package:walletconnect_flutter_v2/apis/models/basic_models.dart';
import 'package:web_socket_channel/web_socket_channel.dart';

class WebSocketHandler implements IWebSocketHandler {
Expand Down
4 changes: 2 additions & 2 deletions lib/apis/utils/constants.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class WalletConnectConstants {
static const SDK_VERSION = '2.0.11';
static const SDK_VERSION = '2.0.12';

static const CORE_PROTOCOL = 'wc';
static const CORE_VERSION = 2;
static const CORE_CONTEXT = 'core';

static const DEFAULT_RELAY_URL = 'wss://relay.walletconnect.org';
static const DEFAULT_RELAY_URL = 'wss://relay.walletconnect.com';

static const CORE_STORAGE_PREFIX =
'$CORE_PROTOCOL@$CORE_VERSION:$CORE_CONTEXT:';
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: walletconnect_flutter_v2
description: WalletConnect v2 client made in dart for flutter.
version: 2.0.11
version: 2.0.12
repository: https://github.com/WalletConnect/WalletConnectFlutterV2

environment:
Expand Down
18 changes: 12 additions & 6 deletions test/core_api/relay_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ import 'dart:async';
import 'package:flutter_test/flutter_test.dart';
import 'package:http/http.dart';
import 'package:mockito/mockito.dart';
import 'package:walletconnect_flutter_v2/apis/core/core.dart';
import 'package:walletconnect_flutter_v2/apis/core/i_core.dart';
import 'package:walletconnect_flutter_v2/apis/core/pairing/utils/pairing_models.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/relay_client.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/relay_client_models.dart';
import 'package:walletconnect_flutter_v2/apis/models/basic_models.dart';
import 'package:walletconnect_flutter_v2/apis/utils/errors.dart';
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';

import '../shared/shared_test_values.dart';
import '../shared/shared_test_utils.dart';
Expand All @@ -21,6 +16,17 @@ void main() {
const TEST_TOPIC = 'abc123';
const TEST_MESSAGE = 'swagmasterss';

test('relays are correct', () {
expect(
WalletConnectConstants.DEFAULT_RELAY_URL,
'wss://relay.walletconnect.com',
);
expect(
WalletConnectConstants.DEFAULT_PUSH_URL,
'https://echo.walletconnect.com',
);
});

group('Relay throws errors', () {
test('when connection parameters are invalid', () async {
final http = MockHttpWrapper();
Expand Down
23 changes: 9 additions & 14 deletions test/sign_api/web3wallet_sign_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,15 @@ void main() {

signEngineTests(
context: 'Web3App/Wallet',
clientACreator: (PairingMetadata metadata) async {
final app = Web3App(
core: Core(
projectId: TEST_PROJECT_ID,
relayUrl: TEST_RELAY_URL,
memoryStore: true,
logLevel: Level.info,
httpClient: getHttpWrapper(),
),
metadata: metadata,
);
await app.init();
return app;
},
clientACreator: (PairingMetadata metadata) async =>
await Web3App.createInstance(
projectId: TEST_PROJECT_ID,
relayUrl: TEST_RELAY_URL,
metadata: metadata,
memoryStore: true,
logLevel: Level.info,
httpClient: getHttpWrapper(),
),
clientBCreator: (PairingMetadata metadata) async =>
await Web3Wallet.createInstance(
projectId: TEST_PROJECT_ID,
Expand Down

0 comments on commit e4c201a

Please sign in to comment.