Skip to content

Commit

Permalink
Merge pull request #305 from WalletConnect/feature/wallet_certificati…
Browse files Browse the repository at this point in the history
…on_and_fixes

[chores] Wallet certification and fixes
  • Loading branch information
quetool committed Aug 8, 2024
2 parents 8b2394c + 6d03b1a commit 8b204bc
Show file tree
Hide file tree
Showing 49 changed files with 1,462 additions and 685 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 2.3.1-beta01
## 2.3.1-beta02

- Minor changes
- Added Connectivity check to core and throw exceptions when internet connection is gone
- Fix for https://github.com/WalletConnect/WalletConnectFlutterV2/issues/303 (EIP-55 validation for SIWE)
- Minor improvements

## 2.3.0

Expand Down
15 changes: 11 additions & 4 deletions example/dapp/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class _MyHomePageState extends State<MyHomePage> {
title: Text(_pageDatas[_selectedIndex].title),
centerTitle: true,
actions: [
const Text('Relay '),
CircleAvatar(
radius: 6.0,
backgroundColor: _web3App!.core.relayClient.isConnected
Expand All @@ -219,14 +220,20 @@ class _MyHomePageState extends State<MyHomePage> {
const SizedBox(width: 16.0),
],
),
body: Center(
child: Container(
constraints: BoxConstraints(
maxWidth: Constants.smallScreen.toDouble(),
),
child: Row(
children: navRail,
),
),
),
bottomNavigationBar:
MediaQuery.of(context).size.width < Constants.smallScreen
? _buildBottomNavBar()
: null,
body: Row(
mainAxisSize: MainAxisSize.max,
children: navRail,
),
);
}

Expand Down
7 changes: 6 additions & 1 deletion example/dapp/lib/widgets/chain_button.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:walletconnect_flutter_v2_dapp/models/chain_metadata.dart';
import 'package:walletconnect_flutter_v2_dapp/utils/constants.dart';
Expand All @@ -17,7 +19,10 @@ class ChainButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: (MediaQuery.of(context).size.width / 2) - 14.0,
width: (min(Constants.smallScreen - 78.0,
MediaQuery.of(context).size.width) /
2) -
14.0,
height: StyleConstants.linear48,
margin: const EdgeInsets.symmetric(
vertical: StyleConstants.linear8,
Expand Down
2 changes: 1 addition & 1 deletion example/dapp/macos/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform :osx, '10.11'
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
24 changes: 18 additions & 6 deletions example/dapp/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
PODS:
- FlutterMacOS (1.0.0)
- package_info_plus (0.0.1):
- FlutterMacOS
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- url_launcher_macos (0.0.1):
- FlutterMacOS

DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)

EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral
package_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos

SPEC CHECKSUMS:
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399

PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

COCOAPODS: 1.11.3
COCOAPODS: 1.15.2
2 changes: 1 addition & 1 deletion example/dapp/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
url_launcher: ^6.2.2
# intl: ^0.19.0
package_info_plus: ^7.0.0
walletconnect_modal_flutter: ^2.1.19
walletconnect_modal_flutter: ^2.1.20
# walletconnect_flutter_v2:
# path: ../..

Expand Down
7 changes: 7 additions & 0 deletions example/wallet/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- LEGACY -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wc" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
7 changes: 7 additions & 0 deletions example/wallet/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
PODS:
- connectivity_plus (0.0.1):
- Flutter
- FlutterMacOS
- Flutter (1.0.0)
- MTBBarcodeScanner (5.0.11)
- package_info_plus (0.4.5):
Expand All @@ -15,6 +18,7 @@ PODS:
- Flutter

DEPENDENCIES:
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
- Flutter (from `Flutter`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- qr_bar_code_scanner_dialog (from `.symlinks/plugins/qr_bar_code_scanner_dialog/ios`)
Expand All @@ -27,6 +31,8 @@ SPEC REPOS:
- MTBBarcodeScanner

EXTERNAL SOURCES:
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/darwin"
Flutter:
:path: Flutter
package_info_plus:
Expand All @@ -41,6 +47,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ class BottomSheetListenerState extends State<BottomSheetListener> {
builder: (context) {
if (item.closeAfter > 0) {
Future.delayed(Duration(seconds: item.closeAfter), () {
Navigator.pop(context);
try {
if (!mounted) return;
Navigator.pop(context);
} catch (e) {
debugPrint('[$runtimeType] close $e');
}
});
}
return Container(
Expand Down
134 changes: 92 additions & 42 deletions example/wallet/lib/dependencies/chains/evm_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:get_it/get_it.dart';
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';
import 'package:walletconnect_flutter_v2_wallet/dependencies/bottom_sheet/i_bottom_sheet_service.dart';
import 'package:walletconnect_flutter_v2_wallet/dependencies/chains/common.dart';
import 'package:walletconnect_flutter_v2_wallet/dependencies/deep_link_handler.dart';
import 'package:walletconnect_flutter_v2_wallet/dependencies/i_web3wallet_service.dart';
import 'package:walletconnect_flutter_v2_wallet/dependencies/key_service/i_key_service.dart';
import 'package:walletconnect_flutter_v2_wallet/models/chain_metadata.dart';
Expand Down Expand Up @@ -140,12 +141,19 @@ class EVMService {
);
}

await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);

CommonMethods.goBackToDapp(topic, response.result ?? response.error);
try {
await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);
CommonMethods.goBackToDapp(topic, response.result ?? response.error);
} on WalletConnectError catch (error) {
DeepLinkHandler.goBackModal(
title: 'Error',
message: error.message,
success: false,
);
}
}

Future<void> ethSign(String topic, dynamic parameters) async {
Expand Down Expand Up @@ -187,12 +195,19 @@ class EVMService {
);
}

await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);

CommonMethods.goBackToDapp(topic, response.result ?? response.error);
try {
await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);
CommonMethods.goBackToDapp(topic, response.result ?? response.error);
} on WalletConnectError catch (error) {
DeepLinkHandler.goBackModal(
title: 'Error',
message: error.message,
success: false,
);
}
}

Future<void> ethSignTypedData(String topic, dynamic parameters) async {
Expand Down Expand Up @@ -229,12 +244,19 @@ class EVMService {
);
}

await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);

CommonMethods.goBackToDapp(topic, response.result ?? response.error);
try {
await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);
CommonMethods.goBackToDapp(topic, response.result ?? response.error);
} on WalletConnectError catch (error) {
DeepLinkHandler.goBackModal(
title: 'Error',
message: error.message,
success: false,
);
}
}

Future<void> ethSignTypedDataV4(String topic, dynamic parameters) async {
Expand Down Expand Up @@ -271,12 +293,19 @@ class EVMService {
);
}

await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);

CommonMethods.goBackToDapp(topic, response.result ?? response.error);
try {
await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);
CommonMethods.goBackToDapp(topic, response.result ?? response.error);
} on WalletConnectError catch (error) {
DeepLinkHandler.goBackModal(
title: 'Error',
message: error.message,
success: false,
);
}
}

Future<void> ethSignTransaction(String topic, dynamic parameters) async {
Expand Down Expand Up @@ -331,12 +360,19 @@ class EVMService {
response = response.copyWith(error: transaction as JsonRpcError);
}

await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);

CommonMethods.goBackToDapp(topic, response.result ?? response.error);
try {
await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);
CommonMethods.goBackToDapp(topic, response.result ?? response.error);
} on WalletConnectError catch (error) {
DeepLinkHandler.goBackModal(
title: 'Error',
message: error.message,
success: false,
);
}
}

Future<void> ethSendTransaction(String topic, dynamic parameters) async {
Expand Down Expand Up @@ -389,12 +425,19 @@ class EVMService {
response = response.copyWith(error: transaction as JsonRpcError);
}

await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);

CommonMethods.goBackToDapp(topic, response.result ?? response.error);
try {
await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);
CommonMethods.goBackToDapp(topic, response.result ?? response.error);
} on WalletConnectError catch (error) {
DeepLinkHandler.goBackModal(
title: 'Error',
message: error.message,
success: false,
);
}
}

Future<void> switchChain(String topic, dynamic parameters) async {
Expand Down Expand Up @@ -426,12 +469,19 @@ class EVMService {
);
}

await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);

CommonMethods.goBackToDapp(topic, true);
try {
await _web3Wallet.respondSessionRequest(
topic: topic,
response: response,
);
CommonMethods.goBackToDapp(topic, true);
} on WalletConnectError catch (error) {
DeepLinkHandler.goBackModal(
title: 'Error',
message: error.message,
success: false,
);
}
}

// Future<void> addChain(String topic, dynamic parameters) async {
Expand Down
Loading

0 comments on commit 8b204bc

Please sign in to comment.