From 12a9bd7a3ae19767ee7a3efb90effad73161db5d Mon Sep 17 00:00:00 2001
From: Alfreedom <00tango.bromine@icloud.com>
Date: Mon, 12 Aug 2024 17:59:30 +0200
Subject: [PATCH] bug fixes, improvementes and updates
---
CHANGELOG.md | 4 +
example/android/gradle.properties | 4 +-
example/ios/Podfile.lock | 7 +
example/ios/Runner.xcodeproj/project.pbxproj | 12 +-
example/ios/Runner/Info.plist | 6 +-
example/lib/home_page.dart | 6 +-
example/lib/utils/crypto/eip155_service.dart | 12 +
.../Flutter/GeneratedPluginRegistrant.swift | 2 +
example/pubspec.lock | 42 ++-
example/pubspec.yaml | 2 +-
.../flutter/generated_plugin_registrant.cc | 3 +
.../windows/flutter/generated_plugins.cmake | 1 +
ios/Podfile.lock | 7 +
lib/pages/account_page.dart | 265 +++++++++---------
.../blockchain_service.dart | 25 +-
.../models/wc_sample_wallets.dart | 2 +-
lib/services/w3m_service/i_w3m_service.dart | 5 +-
lib/services/w3m_service/w3m_service.dart | 41 ++-
lib/version.dart | 2 +-
lib/widgets/navigation/navbar.dart | 5 +-
macos/Flutter/GeneratedPluginRegistrant.swift | 2 +
pubspec.lock | 36 ++-
pubspec.yaml | 4 +-
test/mock_classes.mocks.dart | 12 +-
.../flutter/generated_plugin_registrant.cc | 3 +
windows/flutter/generated_plugins.cmake | 1 +
26 files changed, 313 insertions(+), 198 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea4fc829..3138ea6e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 3.3.1
+
+- Bug fixes and improvements
+
## 3.3.0
- One-Click Auth + SIWE implementation
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index 8745d21a..e23b88f2 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -1,5 +1,5 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
-versionName=3.3.0
-versionCode=71
+versionName=3.3.1
+versionCode=72
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index 94bf2d7c..7186b01b 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -7,6 +7,9 @@ PODS:
- CoinbaseWalletSDK/Client (1.0.4)
- CoinbaseWalletSDK/CrossPlatform (1.0.4):
- CoinbaseWalletSDK/Client
+ - connectivity_plus (0.0.1):
+ - Flutter
+ - FlutterMacOS
- Flutter (1.0.0)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
@@ -30,6 +33,7 @@ PODS:
DEPENDENCIES:
- appcheck (from `.symlinks/plugins/appcheck/ios`)
- coinbase_wallet_sdk (from `.symlinks/plugins/coinbase_wallet_sdk/ios`)
+ - connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
- Flutter (from `Flutter`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
@@ -48,6 +52,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/appcheck/ios"
coinbase_wallet_sdk:
:path: ".symlinks/plugins/coinbase_wallet_sdk/ios"
+ connectivity_plus:
+ :path: ".symlinks/plugins/connectivity_plus/darwin"
Flutter:
:path: Flutter
package_info_plus:
@@ -67,6 +73,7 @@ SPEC CHECKSUMS:
appcheck: e1ab9d4e03736f03e0401554a134d1ed502d7629
coinbase_wallet_sdk: 7ccd4e1a7940deba6ba9bd81beece999a2268c15
CoinbaseWalletSDK: ea1f37512bbc69ebe07416e3b29bf840f5cc3152
+ connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 340b0b88..c8fca1bf 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -470,7 +470,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
ENABLE_BITCODE = NO;
@@ -496,7 +496,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.web3modal.flutterExample.RunnerTests;
@@ -514,7 +514,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.web3modal.flutterExample.RunnerTests;
@@ -530,7 +530,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.web3modal.flutterExample.RunnerTests;
@@ -655,7 +655,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
ENABLE_BITCODE = NO;
@@ -686,7 +686,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 71;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
ENABLE_BITCODE = NO;
diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist
index 0050911f..a9c6c1b3 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -19,7 +19,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 3.3.0
+ 3.3.1
CFBundleSignature
????
CFBundleURLTypes
@@ -36,7 +36,7 @@
CFBundleVersion
- 70
+ 71
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
@@ -87,7 +87,7 @@
metamask
avacus
walletapp
- wcflutterwallet-production
+ wcflutterwallet
wcflutterwallet-internal
rn-web3wallet
diff --git a/example/lib/home_page.dart b/example/lib/home_page.dart
index 49b5d843..f8a24b03 100644
--- a/example/lib/home_page.dart
+++ b/example/lib/home_page.dart
@@ -74,10 +74,10 @@ class _MyHomePageState extends State {
getMessageParams: () async {
// Provide everything that is needed to construct the SIWE message
debugPrint('[SIWEConfig] getMessageParams()');
- final uri = Uri.parse(_pairingMetadata.redirect!.native!);
+ final uri = Uri.parse(_pairingMetadata.url);
return SIWEMessageArgs(
domain: uri.authority,
- uri: 'https://walletconnect.com/login',
+ uri: 'https://${uri.authority}/login',
statement: 'Welcome to AppKit $packageVersion for Flutter.',
methods: MethodsConstants.allMethods,
);
@@ -93,7 +93,7 @@ class _MyHomePageState extends State {
try {
debugPrint('[SIWEConfig] verifyMessage()');
final payload = args.toJson();
- final uri = Uri.parse(_pairingMetadata.redirect!.native!);
+ final uri = Uri.parse(_pairingMetadata.url);
final result = await _siweTestService.verifyMessage(
payload,
domain: uri.authority,
diff --git a/example/lib/utils/crypto/eip155_service.dart b/example/lib/utils/crypto/eip155_service.dart
index 9d53bd42..6e7a1631 100644
--- a/example/lib/utils/crypto/eip155_service.dart
+++ b/example/lib/utils/crypto/eip155_service.dart
@@ -276,6 +276,8 @@ class EIP155 {
// we first call `decimals` function, which is a read function,
// to check how much decimal we need to use to parse the amount value
final decimals = await w3mService.requestReadContract(
+ topic: w3mService.session!.topic,
+ chainId: w3mService.selectedChain!.namespace,
deployedContract: deployedContract,
functionName: 'decimals',
);
@@ -346,6 +348,8 @@ class EIP155 {
// we first call `decimals` function, which is a read function,
// to check how much decimal we need to use to parse the amount value
final decimals = await w3mService.requestReadContract(
+ topic: w3mService.session!.topic,
+ chainId: w3mService.selectedChain!.namespace,
deployedContract: deployedContract,
functionName: 'decimals',
);
@@ -379,16 +383,22 @@ class EIP155 {
final results = await Future.wait([
// results[0]
w3mService.requestReadContract(
+ topic: w3mService.session!.topic,
+ chainId: w3mService.selectedChain!.namespace,
deployedContract: contract,
functionName: 'name',
),
// results[1]
w3mService.requestReadContract(
+ topic: w3mService.session!.topic,
+ chainId: w3mService.selectedChain!.namespace,
deployedContract: contract,
functionName: 'totalSupply',
),
// results[2]
w3mService.requestReadContract(
+ topic: w3mService.session!.topic,
+ chainId: w3mService.selectedChain!.namespace,
deployedContract: contract,
functionName: 'balanceOf',
parameters: [
@@ -397,6 +407,8 @@ class EIP155 {
),
// results[4]
w3mService.requestReadContract(
+ topic: w3mService.session!.topic,
+ chainId: w3mService.selectedChain!.namespace,
deployedContract: contract,
functionName: 'decimals',
),
diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift
index 3ebb6b9e..0f56e054 100644
--- a/example/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -5,6 +5,7 @@
import FlutterMacOS
import Foundation
+import connectivity_plus
import package_info_plus
import path_provider_foundation
import shared_preferences_foundation
@@ -12,6 +13,7 @@ import sqflite
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
+ ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 5d2f9c40..c9a5245d 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -225,6 +225,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.18.0"
+ connectivity_plus:
+ dependency: transitive
+ description:
+ name: connectivity_plus
+ sha256: "3e7d1d9dbae40ae82cbe6c23c518f0c4ffe32764ee9749b9a99d32cbac8734f6"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.0.4"
+ connectivity_plus_platform_interface:
+ dependency: transitive
+ description:
+ name: connectivity_plus_platform_interface
+ sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.0.1"
convert:
dependency: transitive
description:
@@ -273,6 +289,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.2"
+ dbus:
+ dependency: transitive
+ description:
+ name: dbus
+ sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.7.10"
ed25519_edwards:
dependency: transitive
description:
@@ -584,6 +608,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.4"
+ nm:
+ dependency: transitive
+ description:
+ name: nm
+ sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.5.0"
octo_image:
dependency: transitive
description:
@@ -708,10 +740,10 @@ packages:
dependency: transitive
description:
name: pointycastle
- sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29"
+ sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe"
url: "https://pub.dev"
source: hosted
- version: "3.7.4"
+ version: "3.9.1"
pool:
dependency: transitive
description:
@@ -1097,10 +1129,10 @@ packages:
dependency: transitive
description:
name: walletconnect_flutter_v2
- sha256: "4a77de8d33f5d1f6b6ae07d4d2f7bf591ddb6c4cd671bf7493100798d92fa4d3"
+ sha256: da2208740e7f40a682e2fc258fd16b176ca0dcece2696343822cd0c997c4e13c
url: "https://pub.dev"
source: hosted
- version: "2.3.0"
+ version: "2.3.1"
watcher:
dependency: transitive
description:
@@ -1131,7 +1163,7 @@ packages:
path: ".."
relative: true
source: path
- version: "3.3.0"
+ version: "3.3.1"
web_socket_channel:
dependency: transitive
description:
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 8823dfdf..351c7902 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -3,7 +3,7 @@ description: A dApp showing how to use WalletConnect v2 with Flutter
publish_to: "none"
-version: 3.3.0
+version: 3.3.1
environment:
sdk: ">=3.0.1 <4.0.0"
diff --git a/example/windows/flutter/generated_plugin_registrant.cc b/example/windows/flutter/generated_plugin_registrant.cc
index 4f788487..5777988d 100644
--- a/example/windows/flutter/generated_plugin_registrant.cc
+++ b/example/windows/flutter/generated_plugin_registrant.cc
@@ -6,9 +6,12 @@
#include "generated_plugin_registrant.h"
+#include
#include
void RegisterPlugins(flutter::PluginRegistry* registry) {
+ ConnectivityPlusWindowsPluginRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake
index 88b22e5c..31032063 100644
--- a/example/windows/flutter/generated_plugins.cmake
+++ b/example/windows/flutter/generated_plugins.cmake
@@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
+ connectivity_plus
url_launcher_windows
)
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 98b8a132..afe98c53 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -7,6 +7,9 @@ PODS:
- CoinbaseWalletSDK/Client (1.0.4)
- CoinbaseWalletSDK/CrossPlatform (1.0.4):
- CoinbaseWalletSDK/Client
+ - connectivity_plus (0.0.1):
+ - Flutter
+ - FlutterMacOS
- Flutter (1.0.0)
- package_info_plus (0.4.5):
- Flutter
@@ -27,6 +30,7 @@ PODS:
DEPENDENCIES:
- appcheck (from `.symlinks/plugins/appcheck/ios`)
- coinbase_wallet_sdk (from `.symlinks/plugins/coinbase_wallet_sdk/ios`)
+ - connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
- Flutter (from `Flutter`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
@@ -44,6 +48,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/appcheck/ios"
coinbase_wallet_sdk:
:path: ".symlinks/plugins/coinbase_wallet_sdk/ios"
+ connectivity_plus:
+ :path: ".symlinks/plugins/connectivity_plus/darwin"
Flutter:
:path: Flutter
package_info_plus:
@@ -63,6 +69,7 @@ SPEC CHECKSUMS:
appcheck: e1ab9d4e03736f03e0401554a134d1ed502d7629
coinbase_wallet_sdk: 7ccd4e1a7940deba6ba9bd81beece999a2268c15
CoinbaseWalletSDK: ea1f37512bbc69ebe07416e3b29bf840f5cc3152
+ connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
diff --git a/lib/pages/account_page.dart b/lib/pages/account_page.dart
index 53d31be8..ca67a8ce 100644
--- a/lib/pages/account_page.dart
+++ b/lib/pages/account_page.dart
@@ -11,6 +11,7 @@ import 'package:web3modal_flutter/theme/constants.dart';
import 'package:web3modal_flutter/utils/asset_util.dart';
import 'package:web3modal_flutter/widgets/loader.dart';
import 'package:web3modal_flutter/widgets/miscellaneous/content_loading.dart';
+import 'package:web3modal_flutter/widgets/navigation/navbar.dart';
import 'package:web3modal_flutter/widgets/widget_stack/widget_stack_singleton.dart';
import 'package:web3modal_flutter/web3modal_flutter.dart';
import 'package:web3modal_flutter/widgets/web3modal_provider.dart';
@@ -19,7 +20,6 @@ import 'package:web3modal_flutter/widgets/buttons/address_copy_button.dart';
import 'package:web3modal_flutter/widgets/buttons/simple_icon_button.dart';
import 'package:web3modal_flutter/widgets/icons/rounded_icon.dart';
import 'package:web3modal_flutter/widgets/lists/list_items/account_list_item.dart';
-import 'package:web3modal_flutter/widgets/navigation/navbar_action_button.dart';
import 'package:web3modal_flutter/widgets/text/w3m_balance.dart';
class AccountPage extends StatefulWidget {
@@ -64,147 +64,144 @@ class _AccountPageState extends State with WidgetsBindingObserver {
if (_service == null) {
return ContentLoading(viewHeight: 400.0);
}
+
+ return Web3ModalNavbar(
+ title: '',
+ safeAreaLeft: true,
+ safeAreaRight: true,
+ safeAreaBottom: true,
+ divider: false,
+ body: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: kPadding12),
+ child: _DefaultAccountView(
+ service: _service!,
+ ),
+ ),
+ );
+ }
+}
+
+class _DefaultAccountView extends StatelessWidget {
+ const _DefaultAccountView({required IW3MService service})
+ : _service = service;
+ final IW3MService _service;
+
+ @override
+ Widget build(BuildContext context) {
final themeData = Web3ModalTheme.getDataOf(context);
final themeColors = Web3ModalTheme.colorsOf(context);
final radiuses = Web3ModalTheme.radiusesOf(context);
- return SafeArea(
- child: Stack(
- children: [
- Padding(
- padding: const EdgeInsets.only(
- top: kNavbarHeight / 2,
- left: kPadding12,
- right: kPadding12,
- bottom: kPadding12,
- ),
- child: SingleChildScrollView(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Column(
- children: [
- const W3MAccountOrb(size: 72.0),
- const SizedBox.square(dimension: kPadding12),
- const W3MAddressWithCopyButton(),
- const W3MBalanceText(),
- Visibility(
- visible: _service!.selectedChain?.blockExplorer != null,
- child: Padding(
- padding: const EdgeInsets.only(top: kPadding12),
- child: SimpleIconButton(
- onTap: () => _service!.launchBlockExplorer(),
- leftIcon: 'assets/icons/compass.svg',
- rightIcon: 'assets/icons/arrow_top_right.svg',
- title: 'Block Explorer',
- backgroundColor: themeColors.background125,
- foregroundColor: themeColors.foreground150,
- overlayColor: MaterialStateProperty.all(
- themeColors.background200,
- ),
- ),
- ),
- ),
- ],
+ final isEmailLogin = _service.session?.sessionService.isMagic ?? false;
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Column(
+ children: [
+ const W3MAccountOrb(size: 72.0),
+ const SizedBox.square(dimension: kPadding12),
+ const W3MAddressWithCopyButton(),
+ const W3MBalanceText(),
+ Visibility(
+ visible: _service.selectedChain?.blockExplorer != null,
+ child: Padding(
+ padding: const EdgeInsets.only(top: kPadding12),
+ child: SimpleIconButton(
+ onTap: () => _service.launchBlockExplorer(),
+ leftIcon: 'assets/icons/compass.svg',
+ rightIcon: 'assets/icons/arrow_top_right.svg',
+ title: 'Block Explorer',
+ backgroundColor: themeColors.background125,
+ foregroundColor: themeColors.foreground150,
+ overlayColor: MaterialStateProperty.all(
+ themeColors.background200,
),
- const SizedBox.square(dimension: kPadding12),
- Visibility(
- visible: _service!.session?.sessionService.isMagic ?? false,
- child: Column(
- children: [
- const SizedBox.square(dimension: kPadding8),
- AccountListItem(
- padding: const EdgeInsets.symmetric(
- horizontal: kPadding8,
- vertical: kPadding12,
- ),
- iconWidget: Padding(
- padding: const EdgeInsets.all(4.0),
- child: RoundedIcon(
- borderRadius: radiuses.isSquare()
- ? 0.0
- : radiuses.isCircular()
- ? 40.0
- : 8.0,
- size: 40.0,
- assetPath: 'assets/icons/regular/wallet.svg',
- assetColor: themeColors.accent100,
- circleColor: themeColors.accenGlass010,
- borderColor: themeColors.accenGlass010,
- ),
- ),
- title: 'Upgrade your wallet',
- subtitle: 'Transition to a self-custodial wallet',
- hightlighted: true,
- flexible: true,
- titleStyle:
- themeData.textStyles.paragraph500.copyWith(
- color: themeColors.foreground100,
- ),
- onTap: () =>
- widgetStack.instance.push(UpgradeWalletPage()),
- ),
- ],
- ),
- ),
- Visibility(
- visible: _service!.session?.sessionService.isMagic ?? false,
- child: Column(
- children: [
- const SizedBox.square(dimension: kPadding8),
- AccountListItem(
- iconPath: 'assets/icons/mail.svg',
- iconColor: themeColors.foreground100,
- title: _service!.session?.email ?? '',
- titleStyle:
- themeData.textStyles.paragraph500.copyWith(
- color: themeColors.foreground100,
- ),
- onTap: () {
- widgetStack.instance.push(EditEmailPage());
- },
- ),
- ],
- ),
- ),
- const SizedBox.square(dimension: kPadding8),
- _SelectNetworkButton(),
- const SizedBox.square(dimension: kPadding8),
- AccountListItem(
- iconPath: 'assets/icons/disconnect.svg',
- trailing: _service!.status.isLoading
- ? Row(
- children: [
- CircularLoader(size: 18.0, strokeWidth: 2.0),
- SizedBox.square(dimension: kPadding12),
- ],
- )
- : const SizedBox.shrink(),
- title: 'Disconnect',
- titleStyle: themeData.textStyles.paragraph500.copyWith(
- color: themeColors.foreground200,
- ),
- onTap: _service!.status.isLoading
- ? null
- : () async {
- await _service!.disconnect();
- _service!.closeModal();
- },
- ),
- ],
+ ),
),
),
+ ],
+ ),
+ const SizedBox.square(dimension: kPadding12),
+ Visibility(
+ visible: isEmailLogin,
+ child: Column(
+ children: [
+ const SizedBox.square(dimension: kPadding8),
+ AccountListItem(
+ padding: const EdgeInsets.symmetric(
+ horizontal: kPadding8,
+ vertical: kPadding12,
+ ),
+ iconWidget: Padding(
+ padding: const EdgeInsets.all(4.0),
+ child: RoundedIcon(
+ borderRadius: radiuses.isSquare()
+ ? 0.0
+ : radiuses.isCircular()
+ ? 40.0
+ : 8.0,
+ size: 40.0,
+ assetPath: 'assets/icons/regular/wallet.svg',
+ assetColor: themeColors.accent100,
+ circleColor: themeColors.accenGlass010,
+ borderColor: themeColors.accenGlass010,
+ ),
+ ),
+ title: 'Upgrade your wallet',
+ subtitle: 'Transition to a self-custodial wallet',
+ hightlighted: true,
+ flexible: true,
+ titleStyle: themeData.textStyles.paragraph500.copyWith(
+ color: themeColors.foreground100,
+ ),
+ onTap: () => widgetStack.instance.push(UpgradeWalletPage()),
+ ),
+ ],
),
- Positioned(
- top: 0,
- right: 0,
- child: NavbarActionButton(
- asset: 'assets/icons/close.svg',
- action: () => _service!.closeModal(),
- ),
+ ),
+ Visibility(
+ visible: isEmailLogin,
+ child: Column(
+ children: [
+ const SizedBox.square(dimension: kPadding8),
+ AccountListItem(
+ iconPath: 'assets/icons/mail.svg',
+ iconColor: themeColors.foreground100,
+ title: _service.session?.email ?? '',
+ titleStyle: themeData.textStyles.paragraph500.copyWith(
+ color: themeColors.foreground100,
+ ),
+ onTap: () {
+ widgetStack.instance.push(EditEmailPage());
+ },
+ ),
+ ],
),
- ],
- ),
+ ),
+ const SizedBox.square(dimension: kPadding8),
+ _SelectNetworkButton(),
+ const SizedBox.square(dimension: kPadding8),
+ AccountListItem(
+ iconPath: 'assets/icons/disconnect.svg',
+ trailing: _service.status.isLoading
+ ? Row(
+ children: [
+ CircularLoader(size: 18.0, strokeWidth: 2.0),
+ SizedBox.square(dimension: kPadding12),
+ ],
+ )
+ : const SizedBox.shrink(),
+ title: 'Disconnect',
+ titleStyle: themeData.textStyles.paragraph500.copyWith(
+ color: themeColors.foreground200,
+ ),
+ onTap: _service.status.isLoading
+ ? null
+ : () async {
+ await _service.disconnect();
+ _service.closeModal();
+ },
+ ),
+ ],
);
}
}
diff --git a/lib/services/blockchain_service/blockchain_service.dart b/lib/services/blockchain_service/blockchain_service.dart
index 6ec93911..7480698d 100644
--- a/lib/services/blockchain_service/blockchain_service.dart
+++ b/lib/services/blockchain_service/blockchain_service.dart
@@ -11,17 +11,13 @@ import 'package:web3modal_flutter/services/logger_service/logger_service_singlet
class BlockChainService implements IBlockChainService {
late final ICore _core;
late final String _baseUrl;
- late final String _clientId;
+ String? _clientId;
- BlockChainService({required ICore core}) : _core = core;
+ BlockChainService({required ICore core})
+ : _core = core,
+ _baseUrl = '${UrlConstants.blockChainService}/v1';
- @override
- Future init() async {
- _baseUrl = '${UrlConstants.blockChainService}/v1';
- _clientId = await _core.crypto.getClientId();
- }
-
- Map get _requiredParams => {
+ Map get _requiredParams => {
'projectId': _core.projectId,
'clientId': _clientId,
};
@@ -31,11 +27,19 @@ class BlockChainService implements IBlockChainService {
'x-sdk-version': 'flutter-${StringConstants.X_SDK_VERSION}',
};
+ @override
+ Future init() async {
+ _clientId = await _core.crypto.getClientId();
+ }
+
@override
Future getIdentity(String address) async {
try {
final uri = Uri.parse('$_baseUrl/identity/$address');
final queryParams = {..._requiredParams};
+ if (queryParams['clientId'] == null) {
+ queryParams['clientId'] = await _core.crypto.getClientId();
+ }
final response = await http.get(
uri.replace(queryParameters: queryParams),
headers: _requiredHeaders,
@@ -66,6 +70,9 @@ class BlockChainService implements IBlockChainService {
}
final uri = Uri.parse(_baseUrl);
final queryParams = {..._requiredParams, 'chainId': chain};
+ if (queryParams['clientId'] == null) {
+ queryParams['clientId'] = await _core.crypto.getClientId();
+ }
final response = await http.post(
uri.replace(queryParameters: queryParams),
headers: {
diff --git a/lib/services/explorer_service/models/wc_sample_wallets.dart b/lib/services/explorer_service/models/wc_sample_wallets.dart
index bd5662e8..309b31fa 100644
--- a/lib/services/explorer_service/models/wc_sample_wallets.dart
+++ b/lib/services/explorer_service/models/wc_sample_wallets.dart
@@ -23,7 +23,7 @@ class WCSampleWallets {
'platform': ['ios', 'android'],
'ios': NativeAppData(
id: '123456789012345678901234567891',
- schema: 'wcflutterwallet-production://',
+ schema: 'wcflutterwallet://',
),
'android': NativeAppData(
id: '123456789012345678901234567891',
diff --git a/lib/services/w3m_service/i_w3m_service.dart b/lib/services/w3m_service/i_w3m_service.dart
index 190985a2..d60b980f 100644
--- a/lib/services/w3m_service/i_w3m_service.dart
+++ b/lib/services/w3m_service/i_w3m_service.dart
@@ -117,8 +117,11 @@ abstract class IW3MService with ChangeNotifier {
Future disconnect({bool disconnectAllSessions = true});
Future> requestReadContract({
+ required String? topic,
+ required String chainId,
required DeployedContract deployedContract,
required String functionName,
+ EthereumAddress? sender,
List parameters = const [],
});
@@ -128,8 +131,8 @@ abstract class IW3MService with ChangeNotifier {
required DeployedContract deployedContract,
required String functionName,
required Transaction transaction,
- String? method,
List parameters = const [],
+ String? method,
});
/// Make a request
diff --git a/lib/services/w3m_service/w3m_service.dart b/lib/services/w3m_service/w3m_service.dart
index a4a963ab..9bdeca4b 100644
--- a/lib/services/w3m_service/w3m_service.dart
+++ b/lib/services/w3m_service/w3m_service.dart
@@ -193,6 +193,7 @@ class W3MService with ChangeNotifier implements IW3MService {
blockchainService.instance = BlockChainService(
core: _web3App.core,
);
+
magicService.instance = MagicService(
web3app: _web3App,
enabled: enableEmail,
@@ -813,6 +814,7 @@ class W3MService with ChangeNotifier implements IW3MService {
_logger.i('[$runtimeType] Rebuilding session, ending future');
return;
} catch (e) {
+ await disconnect();
await _connectionErrorHandler(e);
}
}
@@ -1016,16 +1018,24 @@ class W3MService with ChangeNotifier implements IW3MService {
@override
Future> requestReadContract({
+ required String? topic,
+ required String chainId,
required DeployedContract deployedContract,
required String functionName,
+ EthereumAddress? sender,
List parameters = const [],
}) async {
try {
- // TODO use blockchain-api if possible.
+ if (selectedChain == null) {
+ throw W3MServiceException(
+ 'You must select a chain before reading a contract',
+ );
+ }
return await _web3App.requestReadContract(
deployedContract: deployedContract,
functionName: functionName,
rpcUrl: selectedChain!.rpcUrl,
+ sender: sender,
parameters: parameters,
);
} catch (e) {
@@ -1040,31 +1050,18 @@ class W3MService with ChangeNotifier implements IW3MService {
required DeployedContract deployedContract,
required String functionName,
required Transaction transaction,
+ List parameters = const [],
String? method,
- List parameters = const [],
}) async {
try {
- final requestParams = SessionRequestParams(
- method: MethodsConstants.ethSendTransaction,
- params: [
- Transaction.callContract(
- contract: deployedContract,
- function: deployedContract.function(functionName),
- from: transaction.from,
- value: transaction.value,
- maxGas: transaction.maxGas,
- gasPrice: transaction.gasPrice,
- nonce: transaction.nonce,
- maxFeePerGas: transaction.maxFeePerGas,
- maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
- parameters: parameters,
- ).toJson(),
- ],
- );
- return request(
- topic: topic,
+ return await _web3App.requestWriteContract(
+ topic: topic ?? '',
chainId: chainId,
- request: requestParams,
+ deployedContract: deployedContract,
+ functionName: functionName,
+ transaction: transaction,
+ parameters: parameters,
+ method: method,
);
} catch (e) {
rethrow;
diff --git a/lib/version.dart b/lib/version.dart
index f611ec25..0c4dca25 100644
--- a/lib/version.dart
+++ b/lib/version.dart
@@ -1,2 +1,2 @@
// Generated code. Do not modify.
-const packageVersion = '3.3.0';
+const packageVersion = '3.3.1';
diff --git a/lib/widgets/navigation/navbar.dart b/lib/widgets/navigation/navbar.dart
index 2f454822..9c9caec9 100644
--- a/lib/widgets/navigation/navbar.dart
+++ b/lib/widgets/navigation/navbar.dart
@@ -19,6 +19,7 @@ class Web3ModalNavbar extends StatelessWidget {
this.safeAreaRight = false,
this.safeAreaBottom = true,
this.noClose = false,
+ this.divider = true,
});
final VoidCallback? onBack;
@@ -26,7 +27,7 @@ class Web3ModalNavbar extends StatelessWidget {
final Widget body;
final String title;
final NavbarActionButton? leftAction;
- final bool safeAreaLeft, safeAreaRight, safeAreaBottom, noClose;
+ final bool safeAreaLeft, safeAreaRight, safeAreaBottom, noClose, divider;
@override
Widget build(BuildContext context) {
@@ -90,7 +91,7 @@ class Web3ModalNavbar extends StatelessWidget {
),
),
),
- Divider(color: themeColors.grayGlass005, height: 0.0),
+ if (divider) Divider(color: themeColors.grayGlass005, height: 0.0),
Flexible(
child: SafeArea(
left: safeAreaLeft,
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index 3ebb6b9e..0f56e054 100644
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -5,6 +5,7 @@
import FlutterMacOS
import Foundation
+import connectivity_plus
import package_info_plus
import path_provider_foundation
import shared_preferences_foundation
@@ -12,6 +13,7 @@ import sqflite
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
+ ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
diff --git a/pubspec.lock b/pubspec.lock
index 9deebcdc..82f7089d 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -217,6 +217,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.18.0"
+ connectivity_plus:
+ dependency: transitive
+ description:
+ name: connectivity_plus
+ sha256: "3e7d1d9dbae40ae82cbe6c23c518f0c4ffe32764ee9749b9a99d32cbac8734f6"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.0.4"
+ connectivity_plus_platform_interface:
+ dependency: transitive
+ description:
+ name: connectivity_plus_platform_interface
+ sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.0.1"
convert:
dependency: "direct main"
description:
@@ -265,6 +281,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.6"
+ dbus:
+ dependency: transitive
+ description:
+ name: dbus
+ sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.7.10"
ed25519_edwards:
dependency: transitive
description:
@@ -560,6 +584,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
+ nm:
+ dependency: transitive
+ description:
+ name: nm
+ sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.5.0"
octo_image:
dependency: transitive
description:
@@ -1073,10 +1105,10 @@ packages:
dependency: "direct main"
description:
name: walletconnect_flutter_v2
- sha256: "4a77de8d33f5d1f6b6ae07d4d2f7bf591ddb6c4cd671bf7493100798d92fa4d3"
+ sha256: da2208740e7f40a682e2fc258fd16b176ca0dcece2696343822cd0c997c4e13c
url: "https://pub.dev"
source: hosted
- version: "2.3.0"
+ version: "2.3.1"
watcher:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 69b685d6..5c7ab94c 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: web3modal_flutter
description: "WalletConnect Web3Modal: Simple, intuitive wallet login. With this drop-in UI SDK, enable any wallet's users to seamlessly log in to your app and enjoy a unified experience"
-version: 3.3.0
+version: 3.3.1
repository: https://github.com/WalletConnect/Web3ModalFlutter
environment:
@@ -24,7 +24,7 @@ dependencies:
shimmer: ^3.0.0
url_launcher: ^6.2.5
uuid: ^4.3.3
- walletconnect_flutter_v2: ^2.3.0
+ walletconnect_flutter_v2: ^2.3.1
webview_flutter: ^4.7.0
webview_flutter_android: ^3.16.0
webview_flutter_wkwebview: ^3.13.0
diff --git a/test/mock_classes.mocks.dart b/test/mock_classes.mocks.dart
index b1028d95..034eda0f 100644
--- a/test/mock_classes.mocks.dart
+++ b/test/mock_classes.mocks.dart
@@ -807,8 +807,11 @@ class MockW3MService extends _i1.Mock implements _i3.W3MService {
@override
_i14.Future> requestReadContract({
+ required String? topic,
+ required String? chainId,
required _i3.DeployedContract? deployedContract,
required String? functionName,
+ _i3.EthereumAddress? sender,
List? parameters = const [],
}) =>
(super.noSuchMethod(
@@ -816,8 +819,11 @@ class MockW3MService extends _i1.Mock implements _i3.W3MService {
#requestReadContract,
[],
{
+ #topic: topic,
+ #chainId: chainId,
#deployedContract: deployedContract,
#functionName: functionName,
+ #sender: sender,
#parameters: parameters,
},
),
@@ -831,8 +837,8 @@ class MockW3MService extends _i1.Mock implements _i3.W3MService {
required _i3.DeployedContract? deployedContract,
required String? functionName,
required _i3.Transaction? transaction,
- String? method,
List? parameters = const [],
+ String? method,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -844,8 +850,8 @@ class MockW3MService extends _i1.Mock implements _i3.W3MService {
#deployedContract: deployedContract,
#functionName: functionName,
#transaction: transaction,
- #method: method,
#parameters: parameters,
+ #method: method,
},
),
returnValue: _i14.Future.value(),
@@ -1466,7 +1472,6 @@ class MockWeb3App extends _i1.Mock implements _i3.Web3App {
_i14.Future requestWriteContract({
required String? topic,
required String? chainId,
- required String? rpcUrl,
required _i3.DeployedContract? deployedContract,
required String? functionName,
required _i3.Transaction? transaction,
@@ -1480,7 +1485,6 @@ class MockWeb3App extends _i1.Mock implements _i3.Web3App {
{
#topic: topic,
#chainId: chainId,
- #rpcUrl: rpcUrl,
#deployedContract: deployedContract,
#functionName: functionName,
#transaction: transaction,
diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc
index 4f788487..5777988d 100644
--- a/windows/flutter/generated_plugin_registrant.cc
+++ b/windows/flutter/generated_plugin_registrant.cc
@@ -6,9 +6,12 @@
#include "generated_plugin_registrant.h"
+#include
#include
void RegisterPlugins(flutter::PluginRegistry* registry) {
+ ConnectivityPlusWindowsPluginRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake
index 88b22e5c..31032063 100644
--- a/windows/flutter/generated_plugins.cmake
+++ b/windows/flutter/generated_plugins.cmake
@@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
+ connectivity_plus
url_launcher_windows
)