diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index dd84ea78..a24ee211 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -17,22 +17,19 @@ Steps to reproduce the behavior:
3. Scroll down to '....'
4. See error
-**Expected behavior**
-A clear and concise description of what you expected to happen.
+**Meaningful logs**
+Any error or information log that would help identify the issue
+
+**Reproducible code**
+Minimum reproducible code of the issue
**Screenshots**
If applicable, add screenshots to help explain your problem.
-**Desktop (please complete the following information):**
- - OS: [e.g. iOS]
- - Browser [e.g. chrome, safari]
- - Version [e.g. 22]
-
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- - Browser [e.g. stock browser, safari]
- - Version [e.g. 22]
+ - Web3Modal Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b3af0266..93fd1c9c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 3.3.0-beta01
+
+- One-Click Auth + SIWE implementation
+- Coinbase Wallet dependency update
+- Bug fixes
+
## 3.2.2
- Network change improvements
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index 9c491cd5..65662b88 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.2.2
-versionCode=61
+versionName=3.3.0
+versionCode=62
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 71a9021d..e8822df8 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 = 61;
+ CURRENT_PROJECT_VERSION = 62;
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 = 61;
+ CURRENT_PROJECT_VERSION = 62;
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 = 61;
+ CURRENT_PROJECT_VERSION = 62;
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 = 61;
+ CURRENT_PROJECT_VERSION = 62;
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 = 61;
+ CURRENT_PROJECT_VERSION = 62;
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 = 61;
+ CURRENT_PROJECT_VERSION = 62;
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 a0ec3ffc..58fd63ff 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -19,7 +19,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 3.2.2
+ 3.3.0
CFBundleSignature
????
CFBundleURLTypes
@@ -36,7 +36,7 @@
CFBundleVersion
- 61
+ 62
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
diff --git a/example/lib/home_page.dart b/example/lib/home_page.dart
index f4e50e62..191d288d 100644
--- a/example/lib/home_page.dart
+++ b/example/lib/home_page.dart
@@ -1,14 +1,13 @@
import 'package:fl_toast/fl_toast.dart';
import 'package:flutter/material.dart';
-// ignore: unused_import
-import 'package:web3modal_flutter/utils/util.dart';
import 'package:web3modal_flutter/web3modal_flutter.dart';
+import 'package:walletconnect_flutter_dapp/utils/constants.dart';
+import 'package:walletconnect_flutter_dapp/utils/crypto/siwe_service.dart';
import 'package:walletconnect_flutter_dapp/widgets/logger_widget.dart';
import 'package:walletconnect_flutter_dapp/widgets/session_widget.dart';
import 'package:walletconnect_flutter_dapp/utils/dart_defines.dart';
-import 'package:walletconnect_flutter_dapp/utils/string_constants.dart';
class MyHomePage extends StatefulWidget {
const MyHomePage({
@@ -26,6 +25,7 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State {
final overlay = OverlayController(const Duration(milliseconds: 200));
late W3MService _w3mService;
+ late SIWESampleWebService _siweTestService;
@override
void initState() {
@@ -33,6 +33,7 @@ class _MyHomePageState extends State {
WidgetsBinding.instance.addPostFrameCallback((_) {
_toggleOverlay();
});
+ _siweTestService = SIWESampleWebService();
_initializeService();
}
@@ -40,19 +41,10 @@ class _MyHomePageState extends State {
overlay.show(context);
}
- void _initializeService() async {
- // See https://docs.walletconnect.com/web3modal/flutter/custom-chains
- W3MChainPresets.chains.addAll(W3MChainPresets.extraChains);
- W3MChainPresets.chains.addAll(W3MChainPresets.testChains);
- // W3MChainPresets.chains.removeWhere((key, _) => key != '137');
-
- _w3mService = W3MService(
- projectId: DartDefines.projectId,
- logLevel: LogLevel.error,
- metadata: const PairingMetadata(
+ PairingMetadata get _pairingMetadata => const PairingMetadata(
name: StringConstants.w3mPageTitleV3,
description: StringConstants.w3mPageTitleV3,
- url: 'https://walletconnect.com/appkit',
+ url: 'https://walletconnect.com/',
icons: [
'https://docs.walletconnect.com/assets/images/web3modalLogo-2cee77e07851ba0a710b56d03d4d09dd.png'
],
@@ -60,43 +52,153 @@ class _MyHomePageState extends State {
native: 'web3modalflutter://',
universal: 'https://walletconnect.com/appkit',
),
- ),
+ );
+
+ SIWEConfig get _siweConfig => SIWEConfig(
+ context: context,
+ getNonce: () async {
+ // this has to be called at the very moment of creating the pairing uri
+ try {
+ debugPrint('[SIWEConfig] getNonce()');
+ final response = await _siweTestService.getNonce();
+ return response['nonce'] as String;
+ } catch (error) {
+ debugPrint('[SIWEConfig] getNonce error: $error');
+ // Fallback patch for testing purposes in case SIWE backend has issues
+ return AuthUtils.generateNonce();
+ }
+ },
+ getMessageParams: () async {
+ // Provide everything that is needed to construct the SIWE message
+ debugPrint('[SIWEConfig] getMessageParams()');
+ final uri = Uri.parse(_pairingMetadata.redirect!.universal!);
+ return SIWEMessageArgs(
+ domain: uri.authority,
+ uri: 'https://walletconnect.com/login',
+ statement: 'Welcome to AppKit for Flutter.',
+ methods: MethodsConstants.allMethods,
+ );
+ },
+ createMessage: (SIWECreateMessageArgs args) {
+ // Create SIWE message to be signed.
+ // You can use our provided formatMessage() method of implement your own
+ debugPrint('[SIWEConfig] createMessage()');
+ return _w3mService.formatMessage(args);
+ },
+ verifyMessage: (SIWEVerifyMessageArgs args) async {
+ // Implement your verifyMessage to authenticate the user after it.
+ try {
+ debugPrint('[SIWEConfig] verifyMessage()');
+ final payload = args.toJson();
+ final uri = Uri.parse(_pairingMetadata.redirect!.universal!);
+ final result = await _siweTestService.authenticate(
+ payload,
+ domain: uri.authority,
+ );
+ return result['token'] != null;
+ } catch (error) {
+ debugPrint('[SIWEConfig] verifyMessage error: $error');
+ // Fallback patch for testing purposes in case SIWE backend has issues
+ final chainId = AuthSignature.getChainIdFromMessage(args.message);
+ final address = AuthSignature.getAddressFromMessage(args.message);
+ final cacaoSignature = args.cacao != null
+ ? args.cacao!.s
+ : CacaoSignature(
+ t: CacaoSignature.EIP191,
+ s: args.signature,
+ );
+ return await AuthSignature.verifySignature(
+ address,
+ args.message,
+ cacaoSignature,
+ chainId,
+ DartDefines.projectId,
+ );
+ }
+ },
+ getSession: () async {
+ // Return proper session from your Web Service
+ try {
+ debugPrint('[SIWEConfig] getSession()');
+ final session = await _siweTestService.getAppKitAuthSession();
+ final address = session['address']!.toString();
+ final chainId = session['chainId']!.toString();
+ return SIWESession(address: address, chains: [chainId]);
+ } catch (error) {
+ debugPrint('[SIWEConfig] getSession error: $error');
+ // Fallback patch for testing purposes in case SIWE backend has issues
+ final address = _w3mService.session!.address!;
+ final chainId = _w3mService.session!.chainId;
+ return SIWESession(address: address, chains: [chainId]);
+ }
+ },
+ onSignIn: (SIWESession session) {
+ // Called after SIWE message is signed and verified
+ debugPrint('[SIWEConfig] onSignIn()');
+ },
+ signOut: () async {
+ // Called when user taps on disconnect button
+ try {
+ debugPrint('[SIWEConfig] signOut()');
+ final _ = await _siweTestService.appKitAuthSignOut();
+ return true;
+ } catch (error) {
+ debugPrint('[SIWEConfig] signOut error: $error');
+ // Fallback patch for testing purposes in case SIWE backend has issues
+ return true;
+ }
+ },
+ onSignOut: () {
+ // Called when disconnecting WalletConnect session was successfull
+ debugPrint('[SIWEConfig] onSignOut()');
+ },
+ // enabled: true,
+ // signOutOnDisconnect: true,
+ // signOutOnAccountChange: true,
+ // signOutOnNetworkChange: true,
+ // nonceRefetchIntervalMs: 300000,
+ // sessionRefetchIntervalMs: 300000,
+ );
+
+ void _initializeService() async {
+ // See https://docs.walletconnect.com/web3modal/flutter/custom-chains
+ W3MChainPresets.chains.addAll(W3MChainPresets.extraChains);
+ W3MChainPresets.chains.addAll(W3MChainPresets.testChains);
+
+ _w3mService = W3MService(
+ projectId: DartDefines.projectId,
+ logLevel: LogLevel.error,
+ metadata: _pairingMetadata,
+ siweConfig: _siweConfig,
enableAnalytics: true, // OPTIONAL - null by default
enableEmail: true, // OPTIONAL - false by default
// requiredNamespaces: {},
// optionalNamespaces: {},
+ // includedWalletIds: {},
+ featuredWalletIds: {
+ 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase
+ '18450873727504ae9315a084fa7624b5297d2fe5880f0982979c17345a138277', // Kraken Wallet
+ 'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', // Metamask
+ '1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369', // Rainbow
+ 'c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a', // Uniswap
+ '38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662', // Bitget
+ },
// excludedWalletIds: {
- // 'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', // Metamask
+ // 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase
// },
// MORE WALLETS https://explorer.walletconnect.com/?type=wallet&chains=eip155%3A1
- // includedWalletIds: {
- // 'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', // Metamask
- // '1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369', // Rainbow
- // 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase Wallet
- // 'c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a', // Uniswap
- // '18450873727504ae9315a084fa7624b5297d2fe5880f0982979c17345a138277', // Kraken Wallet
- // '38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662', // Bitget
- // '19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927', // Ledger Live
- // '4457c130df49fb3cb1f8b99574b97b35208bd3d0d13b8d25d2b5884ed2cad13a', // Shapeshift
- // },
- // featuredWalletIds: {
- // '18450873727504ae9315a084fa7624b5297d2fe5880f0982979c17345a138277', // Kraken Wallet
- // '19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927', // Ledger Live
- // '4457c130df49fb3cb1f8b99574b97b35208bd3d0d13b8d25d2b5884ed2cad13a', // Shapeshift
- // 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase Wallet
- // '38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662', // Bitget
- // },
);
- //
+ // modal specific subscriptions
_w3mService.onModalConnect.subscribe(_onModalConnect);
+ _w3mService.onModalUpdate.subscribe(_onModalUpdate);
_w3mService.onModalNetworkChange.subscribe(_onModalNetworkChange);
_w3mService.onModalDisconnect.subscribe(_onModalDisconnect);
_w3mService.onModalError.subscribe(_onModalError);
- //
+ // session related subscriptions
_w3mService.onSessionExpireEvent.subscribe(_onSessionExpired);
_w3mService.onSessionUpdateEvent.subscribe(_onSessionUpdate);
_w3mService.onSessionEventEvent.subscribe(_onSessionEvent);
- //
+ // relayClient subscriptions
_w3mService.web3App!.core.relayClient.onRelayClientConnect.subscribe(
_onRelayClientConnect,
);
@@ -125,6 +227,7 @@ class _MyHomePageState extends State {
);
//
_w3mService.onModalConnect.unsubscribe(_onModalConnect);
+ _w3mService.onModalUpdate.unsubscribe(_onModalUpdate);
_w3mService.onModalNetworkChange.unsubscribe(_onModalNetworkChange);
_w3mService.onModalDisconnect.unsubscribe(_onModalDisconnect);
_w3mService.onModalError.unsubscribe(_onModalError);
@@ -151,6 +254,10 @@ class _MyHomePageState extends State {
}
}
+ void _onModalUpdate(ModalConnect? event) {
+ setState(() {});
+ }
+
void _switchToPolygonIfNeeded() {
final polygon = W3MChainPresets.chains['137']!;
// final approvedChains = _w3mService.getApprovedChains() ?? [];
diff --git a/example/lib/main.dart b/example/lib/main.dart
index d0f85200..6bb3ebae 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:walletconnect_flutter_dapp/home_page.dart';
-import 'package:walletconnect_flutter_dapp/utils/string_constants.dart';
+import 'package:walletconnect_flutter_dapp/utils/constants.dart';
import 'package:web3modal_flutter/web3modal_flutter.dart';
void main() {
diff --git a/example/lib/models/eth/ethereum_sign_message.dart b/example/lib/models/eth/ethereum_sign_message.dart
deleted file mode 100644
index f5dda50c..00000000
--- a/example/lib/models/eth/ethereum_sign_message.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-enum WCSignType {
- message,
- personalMessage,
- typedMessageV2,
- typedMessageV3,
- typedMessageV4,
-}
-
-class EthereumSignMessage {
- final String data;
- final String address;
- final WCSignType type;
-
- const EthereumSignMessage({
- required this.data,
- required this.address,
- required this.type,
- });
-}
diff --git a/example/lib/models/eth/ethereum_transaction.dart b/example/lib/models/eth/ethereum_transaction.dart
deleted file mode 100644
index f1cd650c..00000000
--- a/example/lib/models/eth/ethereum_transaction.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-// import 'package:json_annotation/json_annotation.dart';
-
-// part 'ethereum_transaction.g.dart';
-
-// @JsonSerializable(includeIfNull: false)
-class EthereumTransaction {
- final String from;
- final String to;
- final String value;
- final String? nonce;
- final String? gasPrice;
- final String? maxFeePerGas;
- final String? maxPriorityFeePerGas;
- final String? gas;
- final String? gasLimit;
- final String? data;
-
- EthereumTransaction({
- required this.from,
- required this.to,
- required this.value,
- this.nonce,
- this.gasPrice,
- this.maxFeePerGas,
- this.maxPriorityFeePerGas,
- this.gas,
- this.gasLimit,
- this.data,
- });
-
- // factory EthereumTransaction.fromJson(Map json) {
- // return EthereumTransaction(from: from, to: to, value: value,);
- // }
-
- Map toJson() {
- Map json = {
- 'from': from,
- 'to': to,
- 'value': value,
- };
- if (nonce != null) {
- json['nonce'] = nonce;
- }
- if (gasPrice != null) {
- json['gasPrice'] = gasPrice;
- }
- if (maxFeePerGas != null) {
- json['maxFeePerGas'] = maxFeePerGas;
- }
- if (maxPriorityFeePerGas != null) {
- json['maxPriorityFeePerGas'] = maxPriorityFeePerGas;
- }
- if (gas != null) {
- json['gas'] = gas;
- }
- if (gasLimit != null) {
- json['gasLimit'] = gasLimit;
- }
- if (data != null) {
- json['data'] = data;
- }
- return json;
- }
-
- @override
- String toString() {
- return 'WCEthereumTransaction(from: $from, to: $to, nonce: $nonce, gasPrice: $gasPrice, maxFeePerGas: $maxFeePerGas, maxPriorityFeePerGas: $maxPriorityFeePerGas, gas: $gas, gasLimit: $gasLimit, value: $value, data: $data)';
- }
-}
diff --git a/example/lib/utils/crypto/chain_data_wrapper.dart b/example/lib/utils/chain_data_wrapper.dart
similarity index 76%
rename from example/lib/utils/crypto/chain_data_wrapper.dart
rename to example/lib/utils/chain_data_wrapper.dart
index c6bb831f..03abd553 100644
--- a/example/lib/utils/crypto/chain_data_wrapper.dart
+++ b/example/lib/utils/chain_data_wrapper.dart
@@ -81,3 +81,32 @@ class ChainDataWrapper {
// ),
];
}
+
+String getChainName(String chain) {
+ try {
+ return ChainDataWrapper.chains
+ .where((element) => element.w3mChainInfo.namespace == chain)
+ .first
+ .w3mChainInfo
+ .chainName;
+ } catch (e) {
+ debugPrint('[ExampleApp] getChainName, Invalid chain: $chain');
+ }
+ return 'Unknown';
+}
+
+ChainMetadata getChainMetadataFromChain(String namespace) {
+ try {
+ return ChainDataWrapper.chains
+ .where((element) => element.w3mChainInfo.namespace == namespace)
+ .first;
+ } catch (_) {
+ return ChainMetadata(
+ color: Colors.blue,
+ type: ChainType.eip155,
+ w3mChainInfo: W3MChainPresets.chains.values.firstWhere(
+ (e) => e.namespace == namespace,
+ ),
+ );
+ }
+}
diff --git a/example/lib/utils/constants.dart b/example/lib/utils/constants.dart
index 0018d199..8f91e3e7 100644
--- a/example/lib/utils/constants.dart
+++ b/example/lib/utils/constants.dart
@@ -5,8 +5,6 @@ class Constants {
static const String aud = 'https://walletconnect.org/login';
static const String domain = 'walletconnect.org';
-
- static const String signPageTypeKey = 'signPageType';
}
class StyleConstants {
@@ -53,3 +51,46 @@ class StyleConstants {
fontWeight: FontWeight.w600,
);
}
+
+class StringConstants {
+ // General
+ static const String cancel = 'Cancel';
+ static const String close = 'Close';
+ static const String ok = 'OK';
+ static const String delete = 'Delete';
+
+ // Main Page
+ static const String appTitle = 'WalletConnect v2 Flutter dApp Demo';
+ static const String basicPageTitle = 'Basic';
+ static const String wcmPageTitle = 'WalletConnect Modal';
+ static const String w3mPageTitle = 'Web3Modal';
+ static const String w3mPageTitleV3 = 'Web3Modal Flutter';
+ static const String pairingsPageTitle = 'Pairings';
+ static const String sessionsPageTitle = 'Sessions';
+ static const String authPageTitle = 'Auth';
+ static const String settingsPageTitle = 'Settings';
+ static const String receivedPing = 'Received Ping';
+ static const String receivedEvent = 'Received Event';
+
+ // Sign Page
+ static const String selectChains = 'Select chains:';
+ static const String testnetsOnly = 'Testnets only?';
+ static const String scanQrCode = 'Scan QR Code';
+ static const String copiedToClipboard = 'Copied to clipboard';
+ static const String bareBonesSign = 'Connect Bare Bones';
+ static const String connectionEstablished = 'Session established';
+ static const String connectionFailed = 'Session setup failed';
+ static const String authSucceeded = 'Authentication Successful';
+ static const String authFailed = 'Authentication Failed';
+
+ // Pairings Page
+ static const String pairings = 'Pairings';
+ static const String deletePairing = 'Delete Pairing?';
+
+ // Sessions Page
+ static const String sessions = 'Sessions';
+ static const String noSessionSelected = 'No session selected';
+ static const String sessionTopic = 'Session Topic: ';
+ static const String methods = 'Methods';
+ static const String events = 'Events';
+}
diff --git a/example/lib/utils/crypto/eip155.dart b/example/lib/utils/crypto/eip155_service.dart
similarity index 98%
rename from example/lib/utils/crypto/eip155.dart
rename to example/lib/utils/crypto/eip155_service.dart
index 6a2122ce..2236beb3 100644
--- a/example/lib/utils/crypto/eip155.dart
+++ b/example/lib/utils/crypto/eip155_service.dart
@@ -1,13 +1,13 @@
import 'dart:convert';
import 'package:intl/intl.dart';
-import 'package:walletconnect_flutter_dapp/utils/crypto/smart_contracts/usdt_contract.dart';
+import 'package:walletconnect_flutter_dapp/utils/crypto/test_data/usdt_contract.dart';
import 'package:web3modal_flutter/web3modal_flutter.dart';
// ignore: depend_on_referenced_packages
import 'package:convert/convert.dart';
-import 'package:walletconnect_flutter_dapp/utils/crypto/smart_contracts/aave_contract.dart';
-import 'package:walletconnect_flutter_dapp/utils/crypto/test_data.dart';
+import 'package:walletconnect_flutter_dapp/utils/crypto/test_data/aave_contract.dart';
+import 'package:walletconnect_flutter_dapp/utils/crypto/test_data/test_data.dart';
enum EIP155UIMethods {
personalSign,
diff --git a/example/lib/utils/crypto/helpers.dart b/example/lib/utils/crypto/helpers.dart
deleted file mode 100644
index 064c0fb8..00000000
--- a/example/lib/utils/crypto/helpers.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:walletconnect_flutter_dapp/models/chain_metadata.dart';
-import 'package:walletconnect_flutter_dapp/utils/crypto/chain_data_wrapper.dart';
-import 'package:web3modal_flutter/utils/w3m_chains_presets.dart';
-
-String getChainName(String chain) {
- try {
- return ChainDataWrapper.chains
- .where((element) => element.w3mChainInfo.namespace == chain)
- .first
- .w3mChainInfo
- .chainName;
- } catch (e) {
- debugPrint('[ExampleApp] getChainName, Invalid chain: $chain');
- }
- return 'Unknown';
-}
-
-ChainMetadata getChainMetadataFromChain(String namespace) {
- try {
- return ChainDataWrapper.chains
- .where((element) => element.w3mChainInfo.namespace == namespace)
- .first;
- } catch (_) {
- return ChainMetadata(
- color: Colors.blue,
- type: ChainType.eip155,
- w3mChainInfo: W3MChainPresets.chains.values.firstWhere(
- (e) => e.namespace == namespace,
- ),
- );
- }
-}
diff --git a/example/lib/utils/crypto/kadena.dart b/example/lib/utils/crypto/kadena_service.dart
similarity index 100%
rename from example/lib/utils/crypto/kadena.dart
rename to example/lib/utils/crypto/kadena_service.dart
diff --git a/example/lib/utils/crypto/siwe_service.dart b/example/lib/utils/crypto/siwe_service.dart
new file mode 100644
index 00000000..38354606
--- /dev/null
+++ b/example/lib/utils/crypto/siwe_service.dart
@@ -0,0 +1,109 @@
+import 'package:flutter/foundation.dart';
+// ignore: depend_on_referenced_packages
+import 'package:http/http.dart' as http;
+import 'dart:convert';
+
+import 'package:walletconnect_flutter_dapp/utils/dart_defines.dart';
+import 'package:web3modal_flutter/utils/core/core_utils_singleton.dart';
+
+class SIWESampleWebService {
+ late Map _headers;
+
+ SIWESampleWebService() {
+ _headers = coreUtils.instance.getAPIHeaders(
+ DartDefines.appKitProjectId,
+ );
+ }
+
+ Future