Skip to content

Commit

Permalink
Merge pull request #243 from WalletConnect/chore/silence_attestation_…
Browse files Browse the repository at this point in the history
…not_found

[Chore] Silence attestation error not found and update dependencies
  • Loading branch information
quetool authored Jan 5, 2024
2 parents 05707dd + cc74cc4 commit 8ccbf43
Show file tree
Hide file tree
Showing 22 changed files with 94 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.12

- Minor improvements and updated dependencies

## 2.1.11

- Fixed an issue with `generatedNamespaces` during session proposal
Expand Down
10 changes: 7 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
include: package:lints/recommended.yaml

linter:
# The lint rules applied to this project can be customized in the
Expand All @@ -23,9 +23,13 @@ linter:
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
constant_identifier_names: false
non_constant_identifier_names: false
constant_identifier_names: false
avoid_print: true
prefer_single_quotes: true
sort_pub_dependencies: true
avoid_unnecessary_containers: true
cancel_subscriptions: true

analyzer:
exclude:
Expand Down
6 changes: 6 additions & 0 deletions example/dapp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ PODS:
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

EXTERNAL SOURCES:
Flutter:
Expand All @@ -18,11 +21,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/package_info_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

Expand Down
8 changes: 8 additions & 0 deletions example/dapp/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:convert';

import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';
import 'package:walletconnect_flutter_v2_dapp/models/chain_metadata.dart';
import 'package:walletconnect_flutter_v2_dapp/models/page_data.dart';
Expand Down Expand Up @@ -89,6 +91,7 @@ class _MyHomePageState extends State<MyHomePage> {
_web3App!.onSessionEvent.subscribe(_onSessionEvent);
_web3App!.core.relayClient.onRelayClientConnect.subscribe(_setState);
_web3App!.core.relayClient.onRelayClientDisconnect.subscribe(_setState);
_web3App!.onSessionConnect.subscribe(_onSessionConnect);

setState(() {
_pageDatas = [
Expand Down Expand Up @@ -125,6 +128,7 @@ class _MyHomePageState extends State<MyHomePage> {

@override
void dispose() {
_web3App!.onSessionConnect.unsubscribe(_onSessionConnect);
_web3App!.core.relayClient.onRelayClientConnect.unsubscribe(_setState);
_web3App!.core.relayClient.onRelayClientDisconnect.unsubscribe(_setState);
_web3App!.onSessionPing.unsubscribe(_onSessionPing);
Expand Down Expand Up @@ -260,4 +264,8 @@ class _MyHomePageState extends State<MyHomePage> {
},
);
}

void _onSessionConnect(SessionConnect? event) {
debugPrint(jsonEncode(event?.session.toJson()));
}
}
2 changes: 1 addition & 1 deletion example/dapp/lib/utils/crypto/chain_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ChainData {
chainId: 'eip155:42161',
name: 'Arbitrum',
logo: '/chain-logos/eip155-42161.png',
color: Colors.black,
color: Colors.blue,
rpc: ['https://arbitrum.blockpi.network/v1/rpc/public'],
),
const ChainMetadata(
Expand Down
4 changes: 4 additions & 0 deletions example/dapp/linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include "generated_plugin_registrant.h"

#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
}
1 change: 1 addition & 0 deletions example/dapp/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down
2 changes: 2 additions & 0 deletions example/dapp/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import Foundation

import package_info_plus
import shared_preferences_foundation
import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
1 change: 1 addition & 0 deletions example/dapp/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies:
path: ../..
fl_toast: ^3.1.0
# kadena_dart_sdk: ^2.0.0
url_launcher: ^6.2.2

dev_dependencies:
flutter_test:
Expand Down
3 changes: 3 additions & 0 deletions example/dapp/windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#include "generated_plugin_registrant.h"

#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
1 change: 1 addition & 0 deletions example/dapp/windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_windows
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down
1 change: 0 additions & 1 deletion lib/apis/auth_api/i_auth_client.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:event/event.dart';
import 'package:walletconnect_flutter_v2/apis/core/store/i_generic_store.dart';
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';

Expand Down
7 changes: 7 additions & 0 deletions lib/apis/core/verify/models/verify_context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ class AttestationResponse with _$AttestationResponse {
factory AttestationResponse.fromJson(Map<String, dynamic> json) =>
_$AttestationResponseFromJson(json);
}

class AttestationNotFound implements Exception {
int code;
String message;

AttestationNotFound({required this.code, required this.message}) : super();
}
14 changes: 13 additions & 1 deletion lib/apis/core/verify/verify.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ class Verify implements IVerify {
AttestationResponse? response;
try {
response = await _fetchAttestation(attestationId, _verifyUrl);
} catch (error) {
} on AttestationNotFound catch (e) {
_core.logger.i(e.message);
response = await _fetchAttestation(
attestationId,
WalletConnectConstants.VERIFY_FALLBACK_SERVER,
);
} on Exception catch (error) {
_core.logger.e(error);
response = await _fetchAttestation(
attestationId,
Expand All @@ -46,6 +52,12 @@ class Verify implements IVerify {
) async {
final uri = Uri.parse('$url/attestation/$attestationId');
final response = await _httpClient.get(uri);
if (response.statusCode == 404) {
throw AttestationNotFound(
code: 404,
message: 'Attestion for this dapp could not be found',
);
}
if (response.statusCode != 200) {
final error = 'Attestation response error: ${response.statusCode}';
throw Exception(error);
Expand Down
1 change: 0 additions & 1 deletion lib/apis/sign_api/i_sign_client.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:event/event.dart';
import 'package:walletconnect_flutter_v2/apis/core/store/i_generic_store.dart';
import 'package:walletconnect_flutter_v2/apis/sign_api/i_sessions.dart';
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';
Expand Down
8 changes: 3 additions & 5 deletions lib/apis/sign_api/sign_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1738,11 +1738,9 @@ class SignEngine implements ISignEngine {
isScam: result?.isScam,
);
} catch (e, s) {
core.logger.e(
'[$runtimeType] _getVerifyContext',
error: e,
stackTrace: s,
);
if (e is! AttestationNotFound) {
core.logger.e('[$runtimeType] verify error', error: e, stackTrace: s);
}
return VerifyContext(
origin: proposerMetada.url,
verifyUrl: proposerMetada.verifyUrl ?? '',
Expand Down
1 change: 0 additions & 1 deletion lib/apis/web3app/web3app.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:event/event.dart';
import 'package:walletconnect_flutter_v2/apis/auth_api/auth_engine.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/websocket/http_client.dart';
import 'package:walletconnect_flutter_v2/apis/core/store/generic_store.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/apis/web3wallet/web3wallet.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:event/event.dart';
import 'package:walletconnect_flutter_v2/apis/auth_api/auth_engine.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/websocket/http_client.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/websocket/i_http_client.dart';
Expand Down
10 changes: 9 additions & 1 deletion lib/walletconnect_flutter_v2.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
library walletconnect_flutter_v2;

export 'src/version.dart';

// Common
export 'apis/core/i_core.dart';
export 'apis/core/core.dart';
Expand Down Expand Up @@ -49,4 +51,10 @@ export 'apis/web3wallet/web3wallet.dart';
export 'apis/web3app/i_web3app.dart';
export 'apis/web3app/web3app.dart';

export 'src/version.dart';
// Libraries
export 'package:event/event.dart';
export 'package:logger/logger.dart';
export 'package:shared_preferences/shared_preferences.dart';
export 'package:universal_io/io.dart';
export 'package:web3dart/web3dart.dart';
export 'package:web3dart/crypto.dart';
48 changes: 24 additions & 24 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
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.11
version: 2.1.12
repository: https://github.com/WalletConnect/WalletConnectFlutterV2

environment:
sdk: '>=2.19.0 <4.0.0'

dependencies:
bs58: ^1.0.2
convert: ^3.0.1
cryptography: ^2.0.5
ed25519_edwards: ^0.3.1
event: ^2.1.2
flutter:
sdk: flutter
web_socket_channel: ^2.4.0
http: '>=0.13.0 <1.2.0'
cryptography: ^2.0.5
convert: ^3.0.1
freezed_annotation: ^2.2.0
http: ^1.1.2
json_annotation: ^4.8.1
logger: ^2.0.2+1
package_info_plus: ^5.0.1
pointycastle: ^3.6.2
x25519: ^0.1.1
bs58: ^1.0.2
ed25519_edwards: ^0.3.1
event: ^2.1.2
stream_channel: ^2.1.0
shared_preferences: ^2.0.17
universal_io: ^2.0.4
shared_preferences: ^2.2.2
stack_trace: ^1.10.0
web3dart: ^2.5.1
logger: ^2.0.2+1
freezed_annotation: ^2.2.0
package_info_plus: ^4.2.0
stream_channel: ^2.1.0
universal_io: ^2.2.2
web3dart: ^2.7.2
web_socket_channel: ^2.4.2
x25519: ^0.1.1

dev_dependencies:
flutter_test:
sdk:
flutter
build_runner: ^2.0.0
json_serializable: ^6.5.3
build_runner: ^2.4.7
build_version: ^2.1.1
dependency_validator: ^3.2.2
mockito: ^5.3.2
eth_sig_util: ^0.0.9
build_version: ^2.0.0
flutter_lints: ^2.0.0
freezed: ^2.4.0
flutter_test:
sdk:
flutter
freezed: ^2.4.5
json_serializable: ^6.7.0
mockito: ^5.4.3

1 change: 0 additions & 1 deletion test/sign_api/sign_client_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@Timeout(Duration(seconds: 45))

import 'package:flutter_test/flutter_test.dart';
import 'package:logger/logger.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';

Expand Down
2 changes: 0 additions & 2 deletions test/sign_api/utils/sign_client_test_wrapper.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'package:event/event.dart';
import 'package:logger/logger.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/websocket/http_client.dart';
import 'package:walletconnect_flutter_v2/apis/core/relay_client/websocket/i_http_client.dart';
import 'package:walletconnect_flutter_v2/apis/core/store/i_generic_store.dart';
Expand Down

0 comments on commit 8ccbf43

Please sign in to comment.