diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index d6e688a..177c7d4 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -8,9 +8,11 @@ assignees: ''
---
**Describe the bug**
+
A clear and concise description of what the bug is.
**To Reproduce**
+
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
@@ -18,24 +20,32 @@ Steps to reproduce the behavior:
4. See error
**Expected behavior**
+
A clear and concise description of what you expected to happen.
**Reproducible code**
-If applicable, add a minimum reproducible code snippet.
+
+If applicable, add a minimum reproducible code snippet.
+A minimum reproducible code should have only Reown's SDK as dependency (besides flutter sdk of course)
+There is no point you copy/paste your code if we can't run it as it is on our side.
**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]
**Additional context**
+
Add any other context about the problem here.
diff --git a/.github/workflows/release_dapp_android.yml b/.github/workflows/release_dapp_android.yml
index 46fdccb..32762aa 100644
--- a/.github/workflows/release_dapp_android.yml
+++ b/.github/workflows/release_dapp_android.yml
@@ -6,6 +6,11 @@ on:
types:
- closed
+# inputs:
+# working-directory
+# flavor
+# BUNDLE_ID
+
jobs:
build:
if: (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master') || github.event_name == 'workflow_dispatch'
diff --git a/.github/workflows/release_dapp_android_internal.yml b/.github/workflows/release_dapp_android_internal.yml
index e3ade37..a3d80d0 100644
--- a/.github/workflows/release_dapp_android_internal.yml
+++ b/.github/workflows/release_dapp_android_internal.yml
@@ -6,6 +6,11 @@ on:
types:
- closed
+# inputs:
+# working-directory
+# flavor
+# BUNDLE_ID
+
jobs:
build:
if: (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop') || github.event_name == 'workflow_dispatch'
diff --git a/.github/workflows/release_modal_android.yml b/.github/workflows/release_modal_android.yml
index 908d53c..53783c0 100644
--- a/.github/workflows/release_modal_android.yml
+++ b/.github/workflows/release_modal_android.yml
@@ -1,4 +1,4 @@
-name: Build Android App Release
+name: Android Modal (production) deploy
on:
workflow_dispatch:
@@ -11,12 +11,14 @@ on:
jobs:
build_with_signing:
name: Build Android App Release
- runs-on: macos-latest
+ runs-on: macos-latest-xlarge
steps:
# Checkout the repo
- name: Checkout repository
uses: actions/checkout@v4
+
+ # Create temp firebase key
- name: Create temp firebase key
env:
FIREBASE_KEY_BASE64: ${{ secrets.FIREBASE_KEY_BASE64 }}
@@ -26,6 +28,7 @@ jobs:
# import certificate and provisioning profile from secrets
echo -n "$FIREBASE_KEY_BASE64" | base64 --decode -o $FIREBASE_KEY_PATH
+
# Setup Java 11
- name: Setup Java 17
uses: actions/setup-java@v3
@@ -34,6 +37,8 @@ jobs:
java-version: '17'
architecture: x86_64
cache: 'gradle'
+
+ # Cache Gradle
- name: Cache Gradle
uses: actions/cache@v3
with:
@@ -43,25 +48,15 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- # Install Flutter SDK
- - name: Install Flutter
- uses: subosito/flutter-action@v2
+
+ # Install Flutter and Dependencies
+ - uses: ./.github/actions/dependencies
with:
- flutter-version: '3.19.5'
- # Get package dependencies and generate files
- - name: Get package dependencies and generate files
- run: |
- flutter pub get
- flutter pub run build_runner build --delete-conflicting-outputs
- # Get example app dependencies and generate files
- - name: Get example app dependencies and generate files
- working-directory: example
- run: |
- flutter pub get
- flutter pub run build_runner build --delete-conflicting-outputs
+ working-directory: packages/reown_appkit/example/modal
+
# Build Android example app
- name: Build Android APK
- working-directory: example
+ working-directory: packages/reown_appkit/example/modal
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
APPKIT_AUTH: ${{ secrets.APPKIT_AUTH }}
@@ -69,10 +64,10 @@ jobs:
AUTH_SERVICE_URL: ${{ secrets.AUTH_SERVICE_URL }}
run: |
# Get app version from file
+ # VERSION_FILE=$GITHUB_WORKSPACE/lib/version.dart
+ # VERSION=`echo $(cat $VERSION_FILE) | sed "s/[^']*'\([^']*\)'.*/\1/"`
+ VERSION=4.0.0
GRADLE_FILE=android/gradle.properties
- VERSION_FILE=$GITHUB_WORKSPACE/lib/version.dart
-
- VERSION=`echo $(cat $VERSION_FILE) | sed "s/[^']*'\([^']*\)'.*/\1/"`
# Set versionName on gradle.properties
awk -F"=" -v newval="$VERSION" 'BEGIN{OFS=FS} $1=="versionName"{$2=newval}1' $GRADLE_FILE > "$GRADLE_FILE.tmp" && mv "$GRADLE_FILE.tmp" $GRADLE_FILE
@@ -89,18 +84,23 @@ jobs:
# Setup Node
- name: Setup Node
uses: actions/setup-node@v3
+
# Setup Firebase
- name: Setup Firebase
uses: w9jds/setup-firebase@main
with:
tools-version: 13.0.1
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
+
+ # Upload APK
- name: Upload APK
- working-directory: example/build/app/outputs/flutter-apk
+ working-directory: packages/reown_appkit/example/modal/build/app/outputs/flutter-apk
env:
APP_ID: ${{ secrets.ANDROID_APP_ID }}
run: |
- firebase appdistribution:distribute app-stable-release.apk --app $APP_ID --release-notes "Web3Modal Flutter stable release" --groups "flutter-team, javascript-team, kotlin-team"
+ firebase appdistribution:distribute app-stable-release.apk --app $APP_ID --release-notes "AppKit Flutter sample production" --groups "flutter-team, javascript-team, kotlin-team"
+
+ # Notify Channel
- name: Notify Channel
uses: slackapi/slack-github-action@v1.24.0
env:
@@ -109,7 +109,7 @@ jobs:
with:
payload: |-
{
- "text":"🤖 New *Android* build *${{ github.ref_name }}* stable version for *Web3Modal Flutter* was just deployed. Test at https://appdistribution.firebase.dev/i/a8efff56e3f0fdb0"
+ "text":"🤖 AppKit *Modal* Flutter Sample *${{ github.ref_name }}* was just deployed. Test at https://appdistribution.firebase.dev/i/a8efff56e3f0fdb0"
}
# Clean up Flutter envs
@@ -119,4 +119,8 @@ jobs:
rm $RUNNER_TEMP/flutter-c7c2c-6df892fe6ddb.json
flutter clean
cd example
- flutter clean
\ No newline at end of file
+ flutter clean
+
+# Launch locally
+# Needs docker to be running
+# act -j build_with_signing --container-architecture linux/amd64 -P macos-latest-xlarge=-self-hosted --secret-file .github/workflows/.env.secret.modal -W .github/workflows/release_modal_android.yml
\ No newline at end of file
diff --git a/.github/workflows/release_modal_android_internal.yml b/.github/workflows/release_modal_android_internal.yml
index 29bb0c7..86fdbc5 100644
--- a/.github/workflows/release_modal_android_internal.yml
+++ b/.github/workflows/release_modal_android_internal.yml
@@ -1,4 +1,4 @@
-name: Build Android App Internal (beta)
+name: Android Modal (internal) deploy
on:
workflow_dispatch:
@@ -11,12 +11,14 @@ on:
jobs:
build_with_signing:
name: Build Android App Internal (beta)
- runs-on: macos-latest
+ runs-on: macos-latest-xlarge
steps:
# Checkout the repo
- name: Checkout repository
uses: actions/checkout@v4
+
+ # Create temp firebase key
- name: Create temp firebase key
env:
FIREBASE_KEY_BASE64: ${{ secrets.FIREBASE_KEY_BASE64 }}
@@ -26,6 +28,7 @@ jobs:
# import certificate and provisioning profile from secrets
echo -n "$FIREBASE_KEY_BASE64" | base64 --decode -o $FIREBASE_KEY_PATH
+
# Setup Java 11
- name: Setup Java 17
uses: actions/setup-java@v3
@@ -34,6 +37,8 @@ jobs:
java-version: '17'
architecture: x86_64
cache: 'gradle'
+
+ # Cache Gradle
- name: Cache Gradle
uses: actions/cache@v3
with:
@@ -43,25 +48,15 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- # Install Flutter SDK
- - name: Install Flutter
- uses: subosito/flutter-action@v2
+
+ # Install Flutter and Dependencies
+ - uses: ./.github/actions/dependencies
with:
- flutter-version: '3.19.5'
- # Get package dependencies and generate files
- - name: Get package dependencies and generate files
- run: |
- flutter pub get
- flutter pub run build_runner build --delete-conflicting-outputs
- # Get example app dependencies and generate files
- - name: Get example app dependencies and generate files
- working-directory: example
- run: |
- flutter pub get
- flutter pub run build_runner build --delete-conflicting-outputs
+ working-directory: packages/reown_appkit/example/modal
+
# Build Android example app
- name: Build Android APK
- working-directory: example
+ working-directory: packages/reown_appkit/example/modal
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
APPKIT_AUTH: ${{ secrets.APPKIT_AUTH }}
@@ -69,10 +64,10 @@ jobs:
AUTH_SERVICE_URL: ${{ secrets.AUTH_SERVICE_URL }}
run: |
# Get app version from file
+ # VERSION_FILE=$GITHUB_WORKSPACE/lib/version.dart
+ # VERSION=`echo $(cat $VERSION_FILE) | sed "s/[^']*'\([^']*\)'.*/\1/"`
+ VERSION=4.0.0
GRADLE_FILE=android/gradle.properties
- VERSION_FILE=$GITHUB_WORKSPACE/lib/version.dart
-
- VERSION=`echo $(cat $VERSION_FILE) | sed "s/[^']*'\([^']*\)'.*/\1/"`
# Set versionName on gradle.properties
awk -F"=" -v newval="$VERSION" 'BEGIN{OFS=FS} $1=="versionName"{$2=newval}1' $GRADLE_FILE > "$GRADLE_FILE.tmp" && mv "$GRADLE_FILE.tmp" $GRADLE_FILE
@@ -89,18 +84,23 @@ jobs:
# Setup Node
- name: Setup Node
uses: actions/setup-node@v3
+
# Setup Firebase
- name: Setup Firebase
uses: w9jds/setup-firebase@main
with:
tools-version: 13.0.1
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
+
+ # Upload APK
- name: Upload APK
- working-directory: example/build/app/outputs/flutter-apk
+ working-directory: packages/reown_appkit/example/modal/build/app/outputs/flutter-apk
env:
APP_ID: ${{ secrets.ANDROID_APP_ID_INTERNAL }}
run: |
- firebase appdistribution:distribute app-beta-release.apk --app $APP_ID --release-notes "Web3Modal Flutter beta release" --groups "flutter-team, javascript-team, kotlin-team"
+ firebase appdistribution:distribute app-beta-release.apk --app $APP_ID --release-notes "AppKit Flutter sample internal" --groups "flutter-team, javascript-team, kotlin-team"
+
+ # Notify Channel
- name: Notify Channel
uses: slackapi/slack-github-action@v1.24.0
env:
@@ -109,8 +109,9 @@ jobs:
with:
payload: |-
{
- "text":"🤖 New *Android* build *${{ github.ref_name }}* version for *Web3Modal Flutter* was just deployed. Test at https://appdistribution.firebase.dev/i/a47ee97e86fbdfff"
+ "text":"🤖 AppKit *Modal* Flutter Sample *Internal* *${{ github.ref_name }}* was just deployed. Test at https://appdistribution.firebase.dev/i/a47ee97e86fbdfff"
}
+
# Clean up Flutter envs
- name: Clean up
if: ${{ always() }}
@@ -118,4 +119,8 @@ jobs:
rm $RUNNER_TEMP/flutter-c7c2c-6df892fe6ddb.json
flutter clean
cd example
- flutter clean
\ No newline at end of file
+ flutter clean
+
+# Launch locally
+# Needs docker to be running
+# act -j build_with_signing --container-architecture linux/amd64 -P macos-latest-xlarge=-self-hosted --secret-file .github/workflows/.env.secret.modal -W .github/workflows/release_modal_android_internal.yml
\ No newline at end of file
diff --git a/.github/workflows/release_modal_ios.yml b/.github/workflows/release_modal_ios.yml
index c51f444..41a2447 100644
--- a/.github/workflows/release_modal_ios.yml
+++ b/.github/workflows/release_modal_ios.yml
@@ -1,4 +1,4 @@
-name: Build iOS App Release
+name: iOS Modal (production) deploy
on:
workflow_dispatch:
@@ -16,6 +16,7 @@ jobs:
# Checkout the repo
- name: Checkout repository
uses: actions/checkout@v4
+
# Install the Apple certificate and provisioning profile
- name: Install the Apple certificate and provisioning profile
env:
@@ -27,7 +28,7 @@ jobs:
# create variables
BUILD_CERT_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/FlutterAppStoreProfileWithPush.mobileprovision
- KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
+ KEYCHAIN_PATH=$RUNNER_TEMP/release-modal.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $BUILD_CERT_PATH
@@ -45,6 +46,7 @@ jobs:
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
+
# Create p8 Auth Key from secrets
- name: Create p8 Auth Key
env:
@@ -58,25 +60,15 @@ jobs:
# import certificate and provisioning profile from secrets
echo -n "$APP_STORE_CONNECT_KEY" | base64 --decode -o $AUTH_KEY_PATH
- # Install Flutter SDK
- - name: Install Flutter
- uses: subosito/flutter-action@v2
+
+ # Install Flutter and Dependencies
+ - uses: ./.github/actions/dependencies
with:
- flutter-version: '3.19.5'
- # Get package dependencies and generate files
- - name: Get package dependencies and generate files
- run: |
- flutter pub get
- flutter pub run build_runner build --delete-conflicting-outputs
- # Get example app dependencies and generate files
- - name: Get example app dependencies and generate files
- working-directory: example
- run: |
- flutter pub get
- flutter pub run build_runner build --delete-conflicting-outputs
+ working-directory: packages/reown_appkit/example/modal
+
# Build ios example app
- name: Build ios example app
- working-directory: example
+ working-directory: packages/reown_appkit/example/modal
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }}
@@ -86,10 +78,10 @@ jobs:
AUTH_SERVICE_URL: ${{ secrets.AUTH_SERVICE_URL }}
run: |
# Get app version from file
- FILE_VALUE=$(echo | grep "^version: " pubspec.yaml)
- PARTS=(${FILE_VALUE//:/ })
- FULL_VERSION=${PARTS[1]}
- VERSION_NUMBER=(${FULL_VERSION//-/ })
+ # FILE_VALUE=$(echo | grep "^version: " pubspec.yaml)
+ # PARTS=(${FILE_VALUE//:/ })
+ # FULL_VERSION=${PARTS[1]}
+ VERSION_NUMBER=4.0.0
# Build ios app with flutter
flutter build ios --build-name $VERSION_NUMBER --dart-define="PROJECT_ID=$PROJECT_ID" --dart-define="APPKIT_AUTH=$APPKIT_AUTH" --dart-define="APPKIT_PROJECT_ID=$APPKIT_PROJECT_ID" --dart-define="AUTH_SERVICE_URL=$AUTH_SERVICE_URL" --config-only --release
@@ -99,8 +91,9 @@ jobs:
agvtool next-version -all
# Archive and export
- xcodebuild -workspace "$GITHUB_WORKSPACE/example/ios/Runner.xcworkspace" -scheme Runner -sdk iphoneos -destination generic/platform=iOS -archivePath "$GITHUB_WORKSPACE/example/ios/Runner.xcarchive" archive
- xcodebuild -exportArchive -allowProvisioningUpdates -sdk iphoneos -archivePath "$GITHUB_WORKSPACE/example/ios/Runner.xcarchive" -exportOptionsPlist "$GITHUB_WORKSPACE/example/ios/Runner/ExportOptionsRelease.plist" -exportPath "$GITHUB_WORKSPACE/example/build/ios/ipa" -authenticationKeyIssuerID $APPLE_ISSUER_ID -authenticationKeyID $APP_STORE_KEY_ID -authenticationKeyPath "$GITHUB_WORKSPACE/example/build/ios/ipa/private_keys/AuthKey_$APP_STORE_KEY_ID.p8"
+ xcodebuild -workspace "$GITHUB_WORKSPACE/packages/reown_appkit/example/modal/ios/Runner.xcworkspace" -scheme Runner -sdk iphoneos -destination generic/platform=iOS -archivePath "$GITHUB_WORKSPACE/example/ios/Runner.xcarchive" archive
+ xcodebuild -exportArchive -allowProvisioningUpdates -sdk iphoneos -archivePath "$GITHUB_WORKSPACE/packages/reown_appkit/example/modal/ios/Runner.xcarchive" -exportOptionsPlist "$GITHUB_WORKSPACE/packages/reown_appkit/example/modal/ios/Runner/ExportOptionsInternal.plist" -exportPath "$GITHUB_WORKSPACE/packages/reown_appkit/example/modal/build/ios/ipa" -authenticationKeyIssuerID $APPLE_ISSUER_ID -authenticationKeyID $APP_STORE_KEY_ID -authenticationKeyPath "$GITHUB_WORKSPACE/packages/reown_appkit/example/modal/build/ios/ipa/private_keys/AuthKey_$APP_STORE_KEY_ID.p8"
+
# Upload IPA to Testflight
- name: Upload IPA to Testflight
working-directory: example/build/ios/ipa
@@ -108,6 +101,8 @@ jobs:
APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }}
APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }}
run: xcrun altool --upload-app --type ios -f web3modal_flutter.ipa --apiKey $APP_STORE_KEY_ID --apiIssuer $APPLE_ISSUER_ID
+
+ # Notify Channel
- name: Notify Channel
uses: slackapi/slack-github-action@v1.24.0
env:
@@ -116,13 +111,14 @@ jobs:
with:
payload: |-
{
- "text":"🍎 New *iOS* build *${{ github.ref_name }}* stable version for *Web3Modal Flutter* was just deployed."
+ "text":"🍎 AppKit *Modal* Flutter Sample *${{ github.ref_name }}* was just deployed."
}
- # Clean up
+
+ # # Clean up
- name: Clean up
if: ${{ always() }}
run: |
- security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
+ security delete-keychain $RUNNER_TEMP/release-modal.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/FlutterAppStoreProfileWithPush.mobileprovision
flutter clean
cd example
diff --git a/.github/workflows/release_modal_ios_internal.yml b/.github/workflows/release_modal_ios_internal.yml
index e6d75b8..fb7c3f1 100644
--- a/.github/workflows/release_modal_ios_internal.yml
+++ b/.github/workflows/release_modal_ios_internal.yml
@@ -1,4 +1,4 @@
-name: Build iOS App Internal (beta)
+name: iOS Modal (internal) deploy
on:
workflow_dispatch:
@@ -16,6 +16,7 @@ jobs:
# Checkout the repo
- name: Checkout repository
uses: actions/checkout@v4
+
# Install the Apple certificate and provisioning profile
- name: Install the Apple certificate and provisioning profile
env:
@@ -27,7 +28,7 @@ jobs:
# create variables
BUILD_CERT_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/FlutterAppStoreProfileInternal.mobileprovision
- KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
+ KEYCHAIN_PATH=$RUNNER_TEMP/release-modal.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $BUILD_CERT_PATH
@@ -45,6 +46,7 @@ jobs:
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
+
# Create p8 Auth Key from secrets
- name: Create p8 Auth Key
env:
@@ -58,25 +60,15 @@ jobs:
# import certificate and provisioning profile from secrets
echo -n "$APP_STORE_CONNECT_KEY" | base64 --decode -o $AUTH_KEY_PATH
- # Install Flutter SDK
- - name: Install Flutter
- uses: subosito/flutter-action@v2
+
+ # Install Flutter and Dependencies
+ - uses: ./.github/actions/dependencies
with:
- flutter-version: '3.19.5'
- # Get package dependencies and generate files
- - name: Get package dependencies and generate files
- run: |
- flutter pub get
- flutter pub run build_runner build --delete-conflicting-outputs
- # Get example app dependencies and generate files
- - name: Get example app dependencies and generate files
- working-directory: example
- run: |
- flutter pub get
- flutter pub run build_runner build --delete-conflicting-outputs
+ working-directory: packages/reown_appkit/example/modal
+
# Build ios example app
- name: Build ios example app
- working-directory: example
+ working-directory: packages/reown_appkit/example/modal
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }}
@@ -86,10 +78,10 @@ jobs:
AUTH_SERVICE_URL: ${{ secrets.AUTH_SERVICE_URL }}
run: |
# Get app version from file
- FILE_VALUE=$(echo | grep "^version: " pubspec.yaml)
- PARTS=(${FILE_VALUE//:/ })
- FULL_VERSION=${PARTS[1]}
- VERSION_NUMBER=(${FULL_VERSION//-/ })
+ # FILE_VALUE=$(echo | grep "^version: " pubspec.yaml)
+ # PARTS=(${FILE_VALUE//:/ })
+ # FULL_VERSION=${PARTS[1]}
+ VERSION_NUMBER=4.0.0
# Change bundleId in Runner scheme
sed -i '' 's/com.web3modal.flutterExample/com.web3modal.flutterExample.internal/g' ios/Runner.xcodeproj/project.pbxproj
@@ -106,8 +98,9 @@ jobs:
agvtool next-version -all
# Archive and export
- xcodebuild -workspace "$GITHUB_WORKSPACE/example/ios/Runner.xcworkspace" -scheme Runner -sdk iphoneos -destination generic/platform=iOS -archivePath "$GITHUB_WORKSPACE/example/ios/Runner.xcarchive" archive
- xcodebuild -exportArchive -allowProvisioningUpdates -sdk iphoneos -archivePath "$GITHUB_WORKSPACE/example/ios/Runner.xcarchive" -exportOptionsPlist "$GITHUB_WORKSPACE/example/ios/Runner/ExportOptionsInternal.plist" -exportPath "$GITHUB_WORKSPACE/example/build/ios/ipa" -authenticationKeyIssuerID $APPLE_ISSUER_ID -authenticationKeyID $APP_STORE_KEY_ID -authenticationKeyPath "$GITHUB_WORKSPACE/example/build/ios/ipa/private_keys/AuthKey_$APP_STORE_KEY_ID.p8"
+ xcodebuild -workspace "$GITHUB_WORKSPACE/packages/reown_appkit/example/modal/ios/Runner.xcworkspace" -scheme Runner -sdk iphoneos -destination generic/platform=iOS -archivePath "$GITHUB_WORKSPACE/example/ios/Runner.xcarchive" archive
+ xcodebuild -exportArchive -allowProvisioningUpdates -sdk iphoneos -archivePath "$GITHUB_WORKSPACE/packages/reown_appkit/example/modal/ios/Runner.xcarchive" -exportOptionsPlist "$GITHUB_WORKSPACE/packages/reown_appkit/example/modal/ios/Runner/ExportOptionsInternal.plist" -exportPath "$GITHUB_WORKSPACE/packages/reown_appkit/example/modal/build/ios/ipa" -authenticationKeyIssuerID $APPLE_ISSUER_ID -authenticationKeyID $APP_STORE_KEY_ID -authenticationKeyPath "$GITHUB_WORKSPACE/packages/reown_appkit/example/modal/build/ios/ipa/private_keys/AuthKey_$APP_STORE_KEY_ID.p8"
+
# Upload IPA to Testflight
- name: Upload IPA to Testflight
working-directory: example/build/ios/ipa
@@ -116,6 +109,8 @@ jobs:
APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }}
run: |
xcrun altool --upload-app --type ios -f web3modal_flutter.ipa --apiKey $APP_STORE_KEY_ID --apiIssuer $APPLE_ISSUER_ID
+
+ # Notify Channel
- name: Notify Channel
uses: slackapi/slack-github-action@v1.24.0
env:
@@ -124,14 +119,18 @@ jobs:
with:
payload: |-
{
- "text":"🍎 New *iOS* build *${{ github.ref_name }}* version for *Web3Modal Flutter* was just deployed. Test at https://testflight.apple.com/join/pzF2SUVm"
+ "text":"🍎 AppKit *Modal* Flutter Sample *${{ github.ref_name }}-internal* was just deployed. Test at https://testflight.apple.com/join/pzF2SUVm"
}
+
# Clean up
- name: Clean up
if: ${{ always() }}
run: |
- security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
+ security delete-keychain $RUNNER_TEMP/release-modal.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/FlutterAppStoreProfileInternal.mobileprovision
flutter clean
cd example
flutter clean
+
+# Launch locally
+# act -j build_with_signing --container-architecture linux/amd64 -P macos-latest-xlarge=-self-hosted --secret-file .github/workflows/.env.secret.modal -W .github/workflows/release_modal_ios_internal.yml
\ No newline at end of file
diff --git a/.github/workflows/release_wallet_android.yml b/.github/workflows/release_wallet_android.yml
index 232feea..45edb5f 100644
--- a/.github/workflows/release_wallet_android.yml
+++ b/.github/workflows/release_wallet_android.yml
@@ -6,6 +6,11 @@ on:
types:
- closed
+# inputs:
+# working-directory
+# flavor
+# BUNDLE_ID
+
jobs:
build:
if: (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master') || github.event_name == 'workflow_dispatch'
diff --git a/.github/workflows/release_wallet_android_internal.yml b/.github/workflows/release_wallet_android_internal.yml
index 19e803d..95b91b6 100644
--- a/.github/workflows/release_wallet_android_internal.yml
+++ b/.github/workflows/release_wallet_android_internal.yml
@@ -6,6 +6,11 @@ on:
types:
- closed
+# inputs:
+# working-directory
+# flavor
+# BUNDLE_ID
+
jobs:
build:
if: (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop') || github.event_name == 'workflow_dispatch'
diff --git a/.gitignore b/.gitignore
index 2819f6d..1d0d6ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,4 +55,4 @@ app.*.map.json
# Run scripts
run_tests_all.sh
-*.env.secret
+*.env.secret*
diff --git a/README.md b/README.md
index b5c97da..b635ecc 100644
--- a/README.md
+++ b/README.md
@@ -6,20 +6,24 @@ The communications protocol for web3, Reown brings the ecosystem together by ena
| [Core SDK](packages/reown_core) | [Sign SDK](packages/reown_sign) | [WalletKit](packages/reown_walletkit) | [AppKit](packages/reown_appkit) |
|---------------------------------|---------------------------------|---------------------------------------|---------------------------------|
-| 1.0.0 | 1.0.0 | 1.0.1 | 1.0.1 |
+| 1.0.4 | 1.0.4 | 1.0.3 | 1.0.1 |
## License
Reown is released under the Apache 2.0 license. [See LICENSE](/LICENSE) for details.
-### Generate project dependencies
+### To try this repo out
-- Run `sh scripts/generate_all.sh` in the root folder to generate dependencies.
+```
+1. git clone https://github.com/reown-com/reown_flutter.git
+2. cd reown_flutter
+3. sh scripts/generate_all.sh
+```
### Run WalletKit Sample
1. Run `cd packages/reown_walletkit/example`
-2. Run `flutter run --dart-define=PROJECT_ID=0123... --flavor internal --debug`
+2. Run `flutter run --dart-define="PROJECT_ID=0123..." --flavor internal`
You can add your own keys for testing purposes as follows:
@@ -42,12 +46,14 @@ _NB: WalletKit sample is intended to be used just as an explanatory project_
### Run AppKit Sample
-AppKit has two samples, `base`, which is made with `ReownAppKit` UI-less SDK, and `modal`, which is made with `ReownAppKitModal`
-
1. Run `cd packages/reown_appkit/example/base`
-2. Run `flutter run --dart-define=PROJECT_ID=0123... --flavor internal --debug`
+2. Run `flutter run --dart-define="PROJECT_ID=0123..." --flavor internal`
-or
+### Test Sample Dapp and Wallet
-1. Run `cd packages/reown_appkit/example/modal`
-2. Run `flutter run --dart-define=PROJECT_ID=0123... --debug`
\ No newline at end of file
+- Sample Wallet:
+ - [Sample Wallet for iOS](https://testflight.apple.com/join/Uv0XoBuD)
+ - [Sample Wallet for Android](https://appdistribution.firebase.dev/i/2b8b3dce9e2831cd)
+- AppKit DApp:
+ - [AppKit Dapp for iOS](https://testflight.apple.com/join/6aRJSllc)
+ - [AppKit Dapp for Android](https://appdistribution.firebase.dev/i/2c6573f6956fa7b5)
\ No newline at end of file
diff --git a/packages/reown_appkit/CHANGELOG.md b/packages/reown_appkit/CHANGELOG.md
index 2b6d35a..711ce48 100644
--- a/packages/reown_appkit/CHANGELOG.md
+++ b/packages/reown_appkit/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 1.2.0
+
+- Non-EVM Chains support
+- Social Logins
+- Bug fixes
+
## 1.0.1
- Updated Coinbase Wallet SDK to support Android Gradle Plugin 8
diff --git a/packages/reown_appkit/analysis_options.yaml b/packages/reown_appkit/analysis_options.yaml
index b677fc6..3e16fe1 100644
--- a/packages/reown_appkit/analysis_options.yaml
+++ b/packages/reown_appkit/analysis_options.yaml
@@ -29,6 +29,7 @@ linter:
sort_pub_dependencies: true
avoid_unnecessary_containers: true
cancel_subscriptions: true
+ public_member_api_docs: false
analyzer:
exclude:
diff --git a/packages/reown_appkit/dart_dependency_validator.yaml b/packages/reown_appkit/dart_dependency_validator.yaml
new file mode 100644
index 0000000..46c10a3
--- /dev/null
+++ b/packages/reown_appkit/dart_dependency_validator.yaml
@@ -0,0 +1,10 @@
+# dart_dependency_validator.yaml
+
+# Set true if you allow pinned packages in your project.
+# allow_pins: true
+# Exclude one or more paths from being scanned. Supports glob syntax.
+exclude:
+ - 'example/**' # Glob's are supported
+# Ignore one or more packages.
+# ignore:
+# - analyzer
\ No newline at end of file
diff --git a/packages/reown_appkit/example/base/android/app/src/main/AndroidManifest.xml b/packages/reown_appkit/example/base/android/app/src/main/AndroidManifest.xml
index fe850f8..a464976 100644
--- a/packages/reown_appkit/example/base/android/app/src/main/AndroidManifest.xml
+++ b/packages/reown_appkit/example/base/android/app/src/main/AndroidManifest.xml
@@ -52,8 +52,8 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/reown_appkit/example/base/ios/Runner.xcodeproj/project.pbxproj b/packages/reown_appkit/example/base/ios/Runner.xcodeproj/project.pbxproj
index 8233dbe..29492ec 100644
--- a/packages/reown_appkit/example/base/ios/Runner.xcodeproj/project.pbxproj
+++ b/packages/reown_appkit/example/base/ios/Runner.xcodeproj/project.pbxproj
@@ -10,11 +10,11 @@
0964B3132C49545400AE1CDA /* Info-internal.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0964B3122C49545400AE1CDA /* Info-internal.plist */; };
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
+ 59CABD5203E9490B70E54AF3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E3D33A121EFB3D9443E8911 /* Pods_Runner.framework */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
- DC20FE362923283F45816BFC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 787ABA0FE3B824874C8F17D8 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -39,15 +39,13 @@
09969A8C2C73BC9100B14363 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 3416E0D9F715E26B46021BBE /* Pods-Runner.profile-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-production.xcconfig"; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
- 3BC12F23EEF9AAEBD6DC9470 /* Pods-Runner.debug-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-internal.xcconfig"; sourceTree = ""; };
- 502CCCDE3EE7AF774B525040 /* Pods-Runner.debug-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-production.xcconfig"; sourceTree = ""; };
- 6CC9F567B7A0A0781351BF49 /* Pods-Runner.release-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-internal.xcconfig"; sourceTree = ""; };
+ 5E3D33A121EFB3D9443E8911 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
- 787ABA0FE3B824874C8F17D8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
- 949DAC436C6D6BCA06DF2227 /* Pods-Runner.release-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-production.xcconfig"; sourceTree = ""; };
+ 920FE43105AD6367320BA170 /* Pods-Runner.profile-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-internal.xcconfig"; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -55,8 +53,10 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
- 9DAD5C3635B945C6034033E7 /* Pods-Runner.profile-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-internal.xcconfig"; sourceTree = ""; };
- CB4B1CD3242757983B2C4FFF /* Pods-Runner.profile-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-production.xcconfig"; sourceTree = ""; };
+ B355374D5D19CAFABA4263C4 /* Pods-Runner.debug-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-production.xcconfig"; sourceTree = ""; };
+ C4ADA4C49431830B16CD5E4C /* Pods-Runner.debug-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-internal.xcconfig"; sourceTree = ""; };
+ CB3FE56545D3E38912E96518 /* Pods-Runner.release-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-production.xcconfig"; sourceTree = ""; };
+ DE145D03FB7834DA9D562601 /* Pods-Runner.release-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-internal.xcconfig"; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -64,7 +64,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- DC20FE362923283F45816BFC /* Pods_Runner.framework in Frameworks */,
+ 59CABD5203E9490B70E54AF3 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -74,12 +74,12 @@
337F646810BF58BC9EACB5E5 /* Pods */ = {
isa = PBXGroup;
children = (
- 502CCCDE3EE7AF774B525040 /* Pods-Runner.debug-production.xcconfig */,
- 3BC12F23EEF9AAEBD6DC9470 /* Pods-Runner.debug-internal.xcconfig */,
- 949DAC436C6D6BCA06DF2227 /* Pods-Runner.release-production.xcconfig */,
- 6CC9F567B7A0A0781351BF49 /* Pods-Runner.release-internal.xcconfig */,
- CB4B1CD3242757983B2C4FFF /* Pods-Runner.profile-production.xcconfig */,
- 9DAD5C3635B945C6034033E7 /* Pods-Runner.profile-internal.xcconfig */,
+ B355374D5D19CAFABA4263C4 /* Pods-Runner.debug-production.xcconfig */,
+ C4ADA4C49431830B16CD5E4C /* Pods-Runner.debug-internal.xcconfig */,
+ CB3FE56545D3E38912E96518 /* Pods-Runner.release-production.xcconfig */,
+ DE145D03FB7834DA9D562601 /* Pods-Runner.release-internal.xcconfig */,
+ 3416E0D9F715E26B46021BBE /* Pods-Runner.profile-production.xcconfig */,
+ 920FE43105AD6367320BA170 /* Pods-Runner.profile-internal.xcconfig */,
);
path = Pods;
sourceTree = "";
@@ -106,7 +106,7 @@
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
337F646810BF58BC9EACB5E5 /* Pods */,
- 982F7AB9DEC126C4156BE443 /* Frameworks */,
+ D2394B1738CB57D1DF475570 /* Frameworks */,
);
sourceTree = "";
};
@@ -135,10 +135,10 @@
path = Runner;
sourceTree = "";
};
- 982F7AB9DEC126C4156BE443 /* Frameworks */ = {
+ D2394B1738CB57D1DF475570 /* Frameworks */ = {
isa = PBXGroup;
children = (
- 787ABA0FE3B824874C8F17D8 /* Pods_Runner.framework */,
+ 5E3D33A121EFB3D9443E8911 /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "";
@@ -150,14 +150,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
- 22CDF3ADC8F132E392D0F7D4 /* [CP] Check Pods Manifest.lock */,
+ CEDF4D2527B372D5159DA206 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
- 6F66D87ECCC3A46691E42A5B /* [CP] Embed Pods Frameworks */,
+ FF3230E269FB3D3822F1DBD2 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -217,75 +217,75 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 22CDF3ADC8F132E392D0F7D4 /* [CP] Check Pods Manifest.lock */ = {
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
- inputFileListPaths = (
- );
inputPaths = (
- "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
- "${PODS_ROOT}/Manifest.lock",
- );
- name = "[CP] Check Pods Manifest.lock";
- outputFileListPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
+ name = "Thin Binary";
outputPaths = (
- "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
- showEnvVarsInLog = 0;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
};
- 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
+ 9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
- "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
- name = "Thin Binary";
+ name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
};
- 6F66D87ECCC3A46691E42A5B /* [CP] Embed Pods Frameworks */ = {
+ CEDF4D2527B372D5159DA206 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
- name = "[CP] Embed Pods Frameworks";
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
- 9740EEB61CF901F6004384FC /* Run Script */ = {
+ FF3230E269FB3D3822F1DBD2 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
- alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
- inputPaths = (
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
- name = "Run Script";
- outputPaths = (
+ name = "[CP] Embed Pods Frameworks";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@@ -648,7 +648,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.flutterdapp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
- "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore com.walletconnect.flutterdapp 1724090152";
+ "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore com.walletconnect.flutterdapp 1727257949";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
@@ -817,7 +817,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.flutterdapp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
- "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore com.walletconnect.flutterdapp 1724090152";
+ "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore com.walletconnect.flutterdapp 1727257949";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
diff --git a/packages/reown_appkit/example/base/ios/Runner/AppDelegate.swift b/packages/reown_appkit/example/base/ios/Runner/AppDelegate.swift
index 805d27d..53e1dfa 100644
--- a/packages/reown_appkit/example/base/ios/Runner/AppDelegate.swift
+++ b/packages/reown_appkit/example/base/ios/Runner/AppDelegate.swift
@@ -1,5 +1,6 @@
import UIKit
import Flutter
+import CoinbaseWalletSDK
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
@@ -48,14 +49,31 @@ import Flutter
}
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
+ if #available(iOS 13.0, *) {
+ if (CoinbaseWalletSDK.isConfigured == true) {
+ if (try? CoinbaseWalletSDK.shared.handleResponse(url)) == true {
+ return true
+ }
+ }
+ }
+
return linkStreamHandler.handleLink(url.absoluteString)
}
override func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
+ if #available(iOS 13.0, *) {
+ if (CoinbaseWalletSDK.isConfigured == true) {
+ if let url = userActivity.webpageURL, (try? CoinbaseWalletSDK.shared.handleResponse(url)) == true {
+ return true
+ }
+ }
+ }
+
if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
handleIncomingUniversalLink(userActivity: userActivity)
return true
}
+
return false
}
diff --git a/packages/reown_appkit/example/base/ios/Runner/Info-internal.plist b/packages/reown_appkit/example/base/ios/Runner/Info-internal.plist
index dbaa42e..0327438 100644
--- a/packages/reown_appkit/example/base/ios/Runner/Info-internal.plist
+++ b/packages/reown_appkit/example/base/ios/Runner/Info-internal.plist
@@ -41,8 +41,53 @@
LSApplicationQueriesSchemes
- wcflutterwallet-internal
+ wirexwallet
+ stasis
+ omni
+ strikex
+ bitcoincom
+ bnc
+ kryptogo
+ roninwallet
+ moonstake
+ ripio
+ frontier
+ qubic
+ dropp
+ safepalwallet
+ bee
+ shido
+ foxwallet
+ exodus
+ coolwallet
+ shinobi-wallet
+ halowallet
+ spotonchain
+ rainbow
+ obvious
+ robinhood-wallet
+ cbwallet
+ okto
+ bitkeep
+ bitizen
+ ape
+ uniswap
+ zerion
+ oasys-wallet
+ coinstats
+ ledgerlive
+ safe
+ okex
+ trust
+ thorwallet
+ krakenwallet
+ coinwallet
+ mewwallet
+ metamask
+ avacus
walletapp
+ wcflutterwallet-internal
+ rn-web3wallet-internal
ITSAppUsesNonExemptEncryption
diff --git a/packages/reown_appkit/example/base/ios/Runner/Info.plist b/packages/reown_appkit/example/base/ios/Runner/Info.plist
index f70379f..43ad88f 100644
--- a/packages/reown_appkit/example/base/ios/Runner/Info.plist
+++ b/packages/reown_appkit/example/base/ios/Runner/Info.plist
@@ -43,8 +43,53 @@
LSApplicationQueriesSchemes
- wcflutterwallet
+ wirexwallet
+ stasis
+ omni
+ strikex
+ bitcoincom
+ bnc
+ kryptogo
+ roninwallet
+ moonstake
+ ripio
+ frontier
+ qubic
+ dropp
+ safepalwallet
+ bee
+ shido
+ foxwallet
+ exodus
+ coolwallet
+ shinobi-wallet
+ halowallet
+ spotonchain
+ rainbow
+ obvious
+ robinhood-wallet
+ cbwallet
+ okto
+ bitkeep
+ bitizen
+ ape
+ uniswap
+ zerion
+ oasys-wallet
+ coinstats
+ ledgerlive
+ safe
+ okex
+ trust
+ thorwallet
+ krakenwallet
+ coinwallet
+ mewwallet
+ metamask
+ avacus
walletapp
+ wcflutterwallet
+ rn-web3wallet
LSRequiresIPhoneOS
diff --git a/packages/reown_appkit/example/base/ios/fastlane/Fastfile b/packages/reown_appkit/example/base/ios/fastlane/Fastfile
index 81c07ae..8091736 100644
--- a/packages/reown_appkit/example/base/ios/fastlane/Fastfile
+++ b/packages/reown_appkit/example/base/ios/fastlane/Fastfile
@@ -115,6 +115,8 @@ platform :ios do
distribute_external: true,
notify_external_testers: true,
skip_waiting_for_build_processing: false,
+ beta_app_feedback_email: "alfredo@reown.com",
+ beta_app_description: "AppKit sample app",
groups: ["External Testers"]
)
diff --git a/packages/reown_appkit/example/base/lib/main.dart b/packages/reown_appkit/example/base/lib/main.dart
index c22e52a..9d30dd3 100644
--- a/packages/reown_appkit/example/base/lib/main.dart
+++ b/packages/reown_appkit/example/base/lib/main.dart
@@ -1,22 +1,21 @@
import 'dart:convert';
import 'dart:developer';
+import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:reown_appkit/reown_appkit.dart';
-
-import 'package:reown_appkit_dapp/models/chain_metadata.dart';
import 'package:reown_appkit_dapp/models/page_data.dart';
import 'package:reown_appkit_dapp/pages/connect_page.dart';
import 'package:reown_appkit_dapp/pages/pairings_page.dart';
-import 'package:reown_appkit_dapp/pages/sessions_page.dart';
import 'package:reown_appkit_dapp/utils/constants.dart';
-import 'package:reown_appkit_dapp/utils/crypto/chain_data.dart';
import 'package:reown_appkit_dapp/utils/crypto/helpers.dart';
import 'package:reown_appkit_dapp/utils/dart_defines.dart';
import 'package:reown_appkit_dapp/utils/deep_link_handler.dart';
import 'package:reown_appkit_dapp/utils/string_constants.dart';
import 'package:reown_appkit_dapp/widgets/event_widget.dart';
+// ignore: depend_on_referenced_packages
+import 'package:shared_preferences/shared_preferences.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
@@ -24,18 +23,55 @@ void main() {
runApp(const MyApp());
}
-class MyApp extends StatelessWidget {
+class MyApp extends StatefulWidget {
const MyApp({super.key});
- // This widget is the root of your application.
+ @override
+ State createState() => _MyAppState();
+}
+
+class _MyAppState extends State with WidgetsBindingObserver {
+ bool _isDarkMode = false;
+
+ @override
+ void initState() {
+ super.initState();
+ WidgetsBinding.instance.addObserver(this);
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ setState(() {
+ final platformDispatcher = View.of(context).platformDispatcher;
+ final platformBrightness = platformDispatcher.platformBrightness;
+ _isDarkMode = platformBrightness == Brightness.dark;
+ });
+ });
+ }
+
+ @override
+ void dispose() {
+ WidgetsBinding.instance.removeObserver(this);
+ super.dispose();
+ }
+
+ @override
+ void didChangePlatformBrightness() {
+ if (mounted) {
+ setState(() {
+ final platformDispatcher = View.of(context).platformDispatcher;
+ final platformBrightness = platformDispatcher.platformBrightness;
+ _isDarkMode = platformBrightness == Brightness.dark;
+ });
+ }
+ super.didChangePlatformBrightness();
+ }
+
@override
Widget build(BuildContext context) {
- return MaterialApp(
- title: StringConstants.appTitle,
- theme: ThemeData(
- primarySwatch: Colors.blue,
+ return ReownAppKitModalTheme(
+ isDarkMode: _isDarkMode,
+ child: MaterialApp(
+ title: StringConstants.appTitle,
+ home: const MyHomePage(),
),
- home: const MyHomePage(),
);
}
}
@@ -48,8 +84,6 @@ class MyHomePage extends StatefulWidget {
}
class _MyHomePageState extends State {
- bool _initializing = true;
-
ReownAppKit? _appKit;
ReownAppKitModal? _appKitModal;
@@ -101,13 +135,11 @@ class _MyHomePageState extends State {
_appKit = ReownAppKit(
core: ReownCore(
projectId: DartDefines.projectId,
- logLevel: LogLevel.error,
+ logLevel: LogLevel.all,
),
metadata: _pairingMetadata(),
);
- _appKit!.core.addLogListener(_logListener);
-
// Register event handlers
_appKit!.core.relayClient.onRelayClientError.subscribe(
_relayClientError,
@@ -124,11 +156,99 @@ class _MyHomePageState extends State {
_appKit!.onSessionConnect.subscribe(_onSessionConnect);
_appKit!.onSessionAuthResponse.subscribe(_onSessionAuthResponse);
+ // See https://docs.reown.com/appkit/flutter/core/custom-chains
+ // final extraChains = ReownAppKitModalNetworks.extra['eip155']!;
+ // ReownAppKitModalNetworks.addSupportedNetworks('eip155', extraChains);
+ // ReownAppKitModalNetworks.removeSupportedNetworks('solana');
+ // ReownAppKitModalNetworks.removeTestNetworks();
+
+ final prefs = await SharedPreferences.getInstance();
+ final linkMode = prefs.getBool('appkit_sample_linkmode') ?? false;
+ if (!linkMode) {
+ ReownAppKitModalNetworks.addSupportedNetworks('polkadot', [
+ ReownAppKitModalNetworkInfo(
+ name: 'Polkadot',
+ chainId: '91b171bb158e2d3848fa23a9f1c25182',
+ chainIcon: 'https://cryptologos.cc/logos/polkadot-new-dot-logo.png',
+ currency: 'DOT',
+ rpcUrl: 'https://rpc.polkadot.io',
+ explorerUrl: 'https://polkadot.subscan.io',
+ ),
+ ReownAppKitModalNetworkInfo(
+ name: 'Westend',
+ chainId: 'e143f23803ac50e8f6f8e62695d1ce9e',
+ currency: 'DOT',
+ rpcUrl: 'https://westend-rpc.polkadot.io',
+ explorerUrl: 'https://westend.subscan.io',
+ isTestNetwork: true,
+ ),
+ ]);
+ } else {
+ ReownAppKitModalNetworks.removeSupportedNetworks('solana');
+ }
+
_appKitModal = ReownAppKitModal(
context: context,
appKit: _appKit,
- siweConfig: _siweConfig(),
- enableEmail: true,
+ siweConfig: _siweConfig(linkMode),
+ enableAnalytics: true,
+ featuresConfig: FeaturesConfig(
+ email: true,
+ socials: [
+ AppKitSocialOption.Farcaster,
+ AppKitSocialOption.X,
+ AppKitSocialOption.Apple,
+ AppKitSocialOption.Discord,
+ ],
+ showMainWallets: false, // OPTIONAL - true by default
+ ),
+ // requiredNamespaces: {},
+ // optionalNamespaces: {},
+ // includedWalletIds: {},
+ featuredWalletIds: {
+ 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase
+ '18450873727504ae9315a084fa7624b5297d2fe5880f0982979c17345a138277', // Kraken Wallet
+ 'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', // Metamask
+ '1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369', // Rainbow
+ 'c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a', // Uniswap
+ '38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662', // Bitget
+ },
+ // excludedWalletIds: {
+ // 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase
+ // },
+ // MORE WALLETS https://explorer.walletconnect.com/?type=wallet&chains=eip155%3A1
+ optionalNamespaces: !linkMode
+ ? {
+ // This is needed if more chains besides EVM and Solana are supported
+ // mostly because we can not define internally every possible method for every possible chain
+ 'eip155': RequiredNamespace.fromJson({
+ 'chains': ReownAppKitModalNetworks.getAllSupportedNetworks(
+ namespace: 'eip155',
+ ).map((chain) => 'eip155:${chain.chainId}').toList(),
+ 'methods':
+ NetworkUtils.defaultNetworkMethods['eip155']!.toList(),
+ 'events': NetworkUtils.defaultNetworkEvents['eip155']!.toList(),
+ }),
+ 'solana': RequiredNamespace.fromJson({
+ 'chains': ReownAppKitModalNetworks.getAllSupportedNetworks(
+ namespace: 'solana',
+ ).map((chain) => 'solana:${chain.chainId}').toList(),
+ 'methods':
+ NetworkUtils.defaultNetworkMethods['solana']!.toList(),
+ 'events': [],
+ }),
+ 'polkadot': RequiredNamespace.fromJson({
+ 'chains': ReownAppKitModalNetworks.getAllSupportedNetworks(
+ namespace: 'polkadot',
+ ).map((chain) => 'polkadot:${chain.chainId}').toList(),
+ 'methods': [
+ 'polkadot_signMessage',
+ 'polkadot_signTransaction',
+ ],
+ 'events': []
+ }),
+ }
+ : null,
);
_appKitModal!.onModalConnect.subscribe(_onModalConnect);
@@ -137,44 +257,73 @@ class _MyHomePageState extends State {
_appKitModal!.onModalDisconnect.subscribe(_onModalDisconnect);
_appKitModal!.onModalError.subscribe(_onModalError);
+ _pageDatas = [
+ PageData(
+ page: ConnectPage(
+ appKitModal: _appKitModal!,
+ linkMode: linkMode,
+ reinitialize: (bool linkMode) async {
+ final result = await showDialog(
+ context: context,
+ builder: (BuildContext context) {
+ return AlertDialog(
+ content: Text('App will be closed to apply changes'),
+ actions: [
+ TextButton(
+ onPressed: () => Navigator.of(context).pop(false),
+ child: Text('Cancel'),
+ ),
+ TextButton(
+ onPressed: () => Navigator.of(context).pop(true),
+ child: Text('Ok'),
+ ),
+ ],
+ );
+ },
+ );
+ if (result == true) {
+ await prefs.setBool('appkit_sample_linkmode', linkMode);
+ if (!kDebugMode) {
+ exit(0);
+ }
+ }
+ },
+ ),
+ title: StringConstants.connectPageTitle,
+ icon: Icons.home,
+ ),
+ PageData(
+ page: PairingsPage(appKitModal: _appKitModal!),
+ title: StringConstants.pairingsPageTitle,
+ icon: Icons.vertical_align_center_rounded,
+ ),
+ // PageData(
+ // page: SessionsPage(appKitModal: _appKitModal!),
+ // title: StringConstants.sessionsPageTitle,
+ // icon: Icons.workspaces_filled,
+ // ),
+ ];
+
await _appKitModal!.init();
await _registerEventHandlers();
- DeepLinkHandler.init(_appKit!);
+ DeepLinkHandler.init(_appKitModal!);
DeepLinkHandler.checkInitialLink();
+ final allChains = ReownAppKitModalNetworks.getAllSupportedNetworks();
// Loop through all the chain data
- for (final ChainMetadata chain in ChainData.allChains) {
+ for (final chain in allChains) {
// Loop through the events for that chain
- for (final event in getChainEvents(chain.type)) {
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ chain.chainId,
+ );
+ for (final event in getChainEvents(namespace)) {
_appKit!.registerEventHandler(
chainId: chain.chainId,
event: event,
);
}
}
-
- setState(() {
- _pageDatas = [
- PageData(
- page: ConnectPage(appKitModal: _appKitModal!),
- title: StringConstants.connectPageTitle,
- icon: Icons.home,
- ),
- PageData(
- page: PairingsPage(appKit: _appKit!),
- title: StringConstants.pairingsPageTitle,
- icon: Icons.vertical_align_center_rounded,
- ),
- PageData(
- page: SessionsPage(appKit: _appKit!),
- title: StringConstants.sessionsPageTitle,
- icon: Icons.workspaces_filled,
- ),
- ];
-
- _initializing = false;
- });
}
Future _registerEventHandlers() async {
@@ -186,9 +335,13 @@ class _MyHomePageState extends State {
}
// Loop through all the chain data
- for (final ChainMetadata chain in ChainData.allChains) {
+ final allChains = ReownAppKitModalNetworks.getAllSupportedNetworks();
+ for (final chain in allChains) {
// Loop through the events for that chain
- for (final event in getChainEvents(chain.type)) {
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ chain.chainId,
+ );
+ for (final event in getChainEvents(namespace)) {
_appKit!.registerEventHandler(
chainId: chain.chainId,
event: event,
@@ -198,22 +351,14 @@ class _MyHomePageState extends State {
}
void _onSessionConnect(SessionConnect? event) {
- debugPrint('[SampleDapp] _onSessionConnect $event');
- Future.delayed(const Duration(milliseconds: 500), () {
- setState(() => _selectedIndex = 2);
- });
+ log('[SampleDapp] _onSessionConnect ${jsonEncode(event?.session.toJson())}');
}
void _onSessionAuthResponse(SessionAuthResponse? response) {
debugPrint('[SampleDapp] _onSessionAuthResponse $response');
- if (response?.session != null) {
- Future.delayed(const Duration(milliseconds: 500), () {
- setState(() => _selectedIndex = 2);
- });
- }
}
- void _setState(dynamic args) => setState(() {});
+ void _setState(_) => setState(() {});
void _relayClientError(ErrorEvent? event) {
debugPrint('[SampleDapp] _relayClientError ${event?.error}');
@@ -223,8 +368,6 @@ class _MyHomePageState extends State {
@override
void dispose() {
// Unregister event handlers
- _appKit!.core.removeLogListener(_logListener);
-
_appKit!.core.relayClient.onRelayClientError.unsubscribe(
_relayClientError,
);
@@ -249,25 +392,11 @@ class _MyHomePageState extends State {
super.dispose();
}
- void _logListener(LogEvent event) {
- if (event.level == Level.debug) {
- // TODO send to mixpanel
- log('${event.message}');
- } else {
- debugPrint('${event.message}');
- }
- }
-
@override
Widget build(BuildContext context) {
- if (_initializing) {
- return const Center(
- child: CircularProgressIndicator(
- color: StyleConstants.primaryColor,
- ),
- );
+ if (_pageDatas.isEmpty) {
+ return Center(child: CircularProgressIndicator());
}
-
final List navRail = [];
if (MediaQuery.of(context).size.width >= Constants.smallScreen) {
navRail.add(_buildNavigationRail());
@@ -393,7 +522,7 @@ class _MyHomePageState extends State {
}
}
- SIWEConfig _siweConfig() => SIWEConfig(
+ SIWEConfig _siweConfig(bool enabled) => SIWEConfig(
getNonce: () async {
// this has to be called at the very moment of creating the pairing uri
return SIWEUtils.generateNonce();
@@ -437,8 +566,11 @@ class _MyHomePageState extends State {
},
getSession: () async {
// Return proper session from your Web Service
- final address = _appKitModal!.session!.address!;
- final chainId = _appKitModal!.session!.chainId;
+ final chainId = _appKitModal!.selectedChain?.chainId ?? '1';
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ chainId,
+ );
+ final address = _appKitModal!.session!.getAddress(namespace)!;
return SIWESession(address: address, chains: [chainId]);
},
onSignIn: (SIWESession session) {
@@ -453,20 +585,21 @@ class _MyHomePageState extends State {
// Called when disconnecting WalletConnect session was successfull
debugPrint('[SIWEConfig] onSignOut()');
},
- enabled: true,
+ enabled: enabled,
signOutOnDisconnect: true,
- signOutOnAccountChange: true,
+ signOutOnAccountChange: false,
signOutOnNetworkChange: false,
// nonceRefetchIntervalMs: 300000,
// sessionRefetchIntervalMs: 300000,
);
void _onModalConnect(ModalConnect? event) async {
- setState(() {});
debugPrint('[ExampleApp] _onModalConnect ${event?.session.toJson()}');
+ setState(() {});
}
void _onModalUpdate(ModalConnect? event) {
+ debugPrint('[ExampleApp] _onModalUpdate ${event?.session.toJson()}');
setState(() {});
}
diff --git a/packages/reown_appkit/example/base/lib/models/chain_metadata.dart b/packages/reown_appkit/example/base/lib/models/chain_metadata.dart
deleted file mode 100644
index 834a0ba..0000000
--- a/packages/reown_appkit/example/base/lib/models/chain_metadata.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-import 'package:flutter/foundation.dart';
-import 'package:flutter/material.dart';
-
-enum ChainType {
- eip155,
- solana,
- kadena,
- cosmos,
- polkadot,
-}
-
-class ChainMetadata {
- final String chainId;
- final String name;
- final String logo;
- final bool isTestnet;
- final Color color;
- final ChainType type;
- final List rpc;
-
- const ChainMetadata({
- required this.chainId,
- required this.name,
- required this.logo,
- this.isTestnet = false,
- required this.color,
- required this.type,
- required this.rpc,
- });
-
- @override
- bool operator ==(Object other) {
- if (identical(this, other)) return true;
-
- return other is ChainMetadata &&
- other.chainId == chainId &&
- other.name == name &&
- other.logo == logo &&
- other.isTestnet == isTestnet &&
- listEquals(other.rpc, rpc);
- }
-
- @override
- int get hashCode {
- return chainId.hashCode ^
- name.hashCode ^
- logo.hashCode ^
- rpc.hashCode ^
- isTestnet.hashCode;
- }
-}
diff --git a/packages/reown_appkit/example/base/lib/pages/connect_page.dart b/packages/reown_appkit/example/base/lib/pages/connect_page.dart
index c7dff84..163af43 100644
--- a/packages/reown_appkit/example/base/lib/pages/connect_page.dart
+++ b/packages/reown_appkit/example/base/lib/pages/connect_page.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+import 'dart:convert';
import 'package:fl_toast/fl_toast.dart';
import 'package:flutter/foundation.dart';
@@ -7,35 +8,44 @@ import 'package:flutter/services.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:reown_appkit/reown_appkit.dart';
-import 'package:reown_appkit_dapp/models/chain_metadata.dart';
import 'package:reown_appkit_dapp/utils/constants.dart';
-import 'package:reown_appkit_dapp/utils/crypto/chain_data.dart';
import 'package:reown_appkit_dapp/utils/crypto/eip155.dart';
+import 'package:reown_appkit_dapp/utils/crypto/helpers.dart';
import 'package:reown_appkit_dapp/utils/crypto/polkadot.dart';
import 'package:reown_appkit_dapp/utils/crypto/solana.dart';
-import 'package:reown_appkit_dapp/utils/sample_wallets.dart';
import 'package:reown_appkit_dapp/utils/string_constants.dart';
import 'package:reown_appkit_dapp/widgets/chain_button.dart';
+import 'package:reown_appkit_dapp/widgets/method_dialog.dart';
class ConnectPage extends StatefulWidget {
const ConnectPage({
super.key,
required this.appKitModal,
+ required this.reinitialize,
+ this.linkMode = false,
});
final ReownAppKitModal appKitModal;
+ final Function(bool linkMode) reinitialize;
+ final bool linkMode;
@override
ConnectPageState createState() => ConnectPageState();
}
class ConnectPageState extends State {
- final List _selectedChains = [];
+ final List _selectedChains = [];
bool _shouldDismissQrCode = true;
@override
void initState() {
super.initState();
+ widget.appKitModal.onModalConnect.subscribe(_onModalConnect);
+ widget.appKitModal.onModalUpdate.subscribe(_onModalUpdate);
+ widget.appKitModal.onModalNetworkChange.subscribe(_onModalNetworkChange);
+ widget.appKitModal.onModalDisconnect.subscribe(_onModalDisconnect);
+ widget.appKitModal.onModalError.subscribe(_onModalError);
+ //
widget.appKitModal.appKit!.onSessionConnect.subscribe(
_onSessionConnect,
);
@@ -49,6 +59,11 @@ class ConnectPageState extends State {
@override
void dispose() {
+ widget.appKitModal.onModalConnect.unsubscribe(_onModalConnect);
+ widget.appKitModal.onModalUpdate.unsubscribe(_onModalUpdate);
+ widget.appKitModal.onModalNetworkChange.unsubscribe(_onModalNetworkChange);
+ widget.appKitModal.onModalDisconnect.unsubscribe(_onModalDisconnect);
+ widget.appKitModal.onModalError.unsubscribe(_onModalError);
widget.appKitModal.onModalDisconnect.unsubscribe(
_onModalDisconnect,
);
@@ -61,7 +76,7 @@ class ConnectPageState extends State {
super.dispose();
}
- void _selectChain(ChainMetadata chain) {
+ void _selectChain(ReownAppKitModalNetworkInfo chain) {
setState(() {
if (_selectedChains.contains(chain)) {
_selectedChains.remove(chain);
@@ -78,61 +93,58 @@ class ConnectPageState extends State {
void _updateNamespaces() {
optionalNamespaces = {};
- final evmChains =
- _selectedChains.where((e) => e.type == ChainType.eip155).toList();
+ final evmChains = _selectedChains.where((c) {
+ final ns = ReownAppKitModalNetworks.getNamespaceForChainId(c.chainId);
+ return ns == 'eip155';
+ }).toList();
if (evmChains.isNotEmpty) {
optionalNamespaces['eip155'] = RequiredNamespace(
- chains: evmChains.map((c) => c.chainId).toList(),
+ chains: evmChains.map((c) => 'eip155:${c.chainId}').toList(),
methods: EIP155.methods.values.toList(),
events: EIP155.events.values.toList(),
);
}
- final solanaChains =
- _selectedChains.where((e) => e.type == ChainType.solana).toList();
+ final solanaChains = _selectedChains.where((c) {
+ final ns = ReownAppKitModalNetworks.getNamespaceForChainId(c.chainId);
+ return ns == 'solana';
+ }).toList();
if (solanaChains.isNotEmpty) {
optionalNamespaces['solana'] = RequiredNamespace(
- chains: solanaChains.map((c) => c.chainId).toList(),
+ chains: solanaChains.map((c) => 'solana:${c.chainId}').toList(),
methods: Solana.methods.values.toList(),
events: Solana.events.values.toList(),
);
}
- final polkadotChains =
- _selectedChains.where((e) => e.type == ChainType.polkadot).toList();
+ final polkadotChains = _selectedChains.where((c) {
+ final ns = ReownAppKitModalNetworks.getNamespaceForChainId(c.chainId);
+ return ns == 'polkadot';
+ }).toList();
if (polkadotChains.isNotEmpty) {
optionalNamespaces['polkadot'] = RequiredNamespace(
- chains: polkadotChains.map((c) => c.chainId).toList(),
+ chains: polkadotChains.map((c) => 'polkadot:${c.chainId}').toList(),
methods: Polkadot.methods.values.toList(),
events: Polkadot.events.values.toList(),
);
}
- if (optionalNamespaces.isEmpty) {
- requiredNamespaces = {};
- } else {
- // WalletConnectModal still requires to have requiredNamespaces
- // this has to be changed in that SDK
- requiredNamespaces = {
- 'eip155': const RequiredNamespace(
- chains: ['eip155:1'],
- methods: ['personal_sign', 'eth_signTransaction'],
- events: ['chainChanged'],
- ),
- };
- }
+ debugPrint(
+ '[$runtimeType] optionalNamespaces ${jsonEncode(optionalNamespaces)}',
+ );
}
@override
Widget build(BuildContext context) {
// Build the list of chain buttons, clear if the textnet changed
- final testChains = ChainData.allChains.where((e) => e.isTestnet).toList();
- final mainChains = ChainData.allChains.where((e) => !e.isTestnet).toList();
+ final allChains = ReownAppKitModalNetworks.getAllSupportedNetworks();
+ final mainChains = allChains.where((e) => !e.isTestNetwork).toList();
+ final testChains = allChains.where((e) => e.isTestNetwork).toList();
final List chainButtons = [];
final List testButtons = [];
- for (final ChainMetadata chain in mainChains) {
+ for (final chain in mainChains) {
// Build the button
chainButtons.add(
ChainButton(
@@ -142,7 +154,7 @@ class ConnectPageState extends State {
),
);
}
- for (final ChainMetadata chain in testChains) {
+ for (final chain in testChains) {
// Build the button
testButtons.add(
ChainButton(
@@ -154,28 +166,23 @@ class ConnectPageState extends State {
}
return ListView(
- padding: const EdgeInsets.symmetric(horizontal: StyleConstants.linear8),
+ padding: const EdgeInsets.symmetric(
+ horizontal: StyleConstants.linear8,
+ ),
children: [
Text(
widget.appKitModal.appKit!.metadata.name,
style: StyleConstants.subtitleText,
textAlign: TextAlign.center,
),
- const SizedBox(height: StyleConstants.linear8),
- const Divider(),
+ const SizedBox(height: StyleConstants.linear16),
+ const Divider(height: 1.0),
+ const SizedBox(height: StyleConstants.linear16),
const Text(
- 'Connect With AppKit Modal and Link Mode:',
+ 'Connect With AppKit Modal',
style: StyleConstants.buttonText,
textAlign: TextAlign.center,
),
- Text(
- 'Only EVM chains',
- style: TextStyle(
- color: Colors.black.withOpacity(0.7),
- fontSize: 12.0,
- ),
- textAlign: TextAlign.center,
- ),
const SizedBox(height: StyleConstants.linear8),
Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -192,222 +199,124 @@ class ConnectPageState extends State {
const SizedBox(height: StyleConstants.linear8),
Visibility(
visible: widget.appKitModal.isConnected,
- child: AppKitModalAccountButton(
- appKit: widget.appKitModal,
- ),
- ),
- const SizedBox(height: StyleConstants.linear8),
- Visibility(
- visible: !widget.appKitModal.isConnected,
child: Column(
children: [
+ AppKitModalAccountButton(
+ appKitModal: widget.appKitModal,
+ ),
+ const SizedBox.square(dimension: 8.0),
Row(
+ mainAxisAlignment: MainAxisAlignment.center,
children: [
- Expanded(
- child: const Divider(),
- ),
- const Text(
- ' Or ',
- style: StyleConstants.buttonText,
- textAlign: TextAlign.center,
+ AppKitModalBalanceButton(
+ appKitModal: widget.appKitModal,
+ onTap: widget.appKitModal.openNetworksView,
),
- Expanded(
- child: const Divider(),
+ const SizedBox.square(dimension: 8.0),
+ AppKitModalAddressButton(
+ appKitModal: widget.appKitModal,
+ onTap: widget.appKitModal.openModalView,
),
],
),
- const SizedBox(height: StyleConstants.linear8),
- const Text(
- 'Connect With AppKit multichain',
- style: StyleConstants.buttonText,
- textAlign: TextAlign.center,
- ),
- const SizedBox(height: StyleConstants.linear8),
- Wrap(
- spacing: 10.0,
- children: chainButtons,
- ),
- // const Divider(),
- const Text('Test chains'),
- Wrap(
- spacing: 10.0,
- children: testButtons,
- ),
- const SizedBox(height: StyleConstants.linear16),
- // const Divider(),
+ const SizedBox.square(dimension: 8.0),
+ ...(_buildRequestButtons()),
+ ],
+ ),
+ ),
+ const SizedBox(height: StyleConstants.linear8),
+ Visibility(
+ visible: !widget.appKitModal.isConnected,
+ child: Column(
+ children: [
Row(
+ mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- const Text(
- 'Session Propose:',
- style: StyleConstants.buttonText,
- ),
- const SizedBox(height: StyleConstants.linear8),
- Column(
- children:
- WCSampleWallets.getSampleWallets().map((wallet) {
- return Padding(
- padding: const EdgeInsets.only(bottom: 8.0),
- child: ElevatedButton(
- style: _buttonStyle,
- onPressed: _selectedChains.isEmpty
- ? null
- : () {
- _onConnect(
- nativeLink: '${wallet['schema']}',
- closeModal: () {
- if (Navigator.canPop(context)) {
- Navigator.of(context).pop();
- }
- },
- showToast: (m) async {
- showPlatformToast(
- child: Text(m),
- context: context,
- );
- },
- );
- },
- child: Text(
- '${wallet['name']}',
- style: StyleConstants.buttonText,
- ),
- ),
- );
- }).toList(),
- ),
- ],
+ child: Text(
+ 'non-EVM\nSession Proposal',
+ textAlign: TextAlign.end,
+ style: TextStyle(
+ fontWeight: !widget.linkMode
+ ? FontWeight.bold
+ : FontWeight.normal,
+ ),
),
),
- const SizedBox.square(dimension: 8.0),
+ Switch(
+ value: widget.linkMode,
+ onChanged: (value) {
+ widget.reinitialize(value);
+ },
+ ),
Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- const Text(
- 'Link Mode:',
- style: StyleConstants.buttonText,
- ),
- const SizedBox(height: StyleConstants.linear8),
- Column(
- children:
- WCSampleWallets.getSampleWallets().map((wallet) {
- return Padding(
- padding: const EdgeInsets.only(bottom: 8.0),
- child: ElevatedButton(
- style: _buttonStyle,
- onPressed: _selectedChains.isEmpty
- ? null
- : () {
- _sessionAuthenticate(
- nativeLink: '${wallet['schema']}',
- universalLink:
- '${wallet['universal']}',
- closeModal: () {
- if (Navigator.canPop(context)) {
- Navigator.of(context).pop();
- }
- },
- showToast: (message) {
- showPlatformToast(
- child: Text(message),
- context: context,
- );
- },
- );
- },
- child: Text(
- '${wallet['name']}',
- style: StyleConstants.buttonText,
- ),
- ),
- );
- }).toList(),
- ),
- ],
+ child: Text(
+ 'only EVM\nLink Mode',
+ style: TextStyle(
+ fontWeight: widget.linkMode
+ ? FontWeight.bold
+ : FontWeight.normal,
+ ),
),
),
],
),
- const SizedBox(height: StyleConstants.linear16),
- const Divider(height: 1.0),
],
),
),
const SizedBox(height: StyleConstants.linear16),
- const Text(
- 'Redirect:',
- style: TextStyle(fontWeight: FontWeight.bold),
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const Text('Native: '),
- Expanded(
- child: Text(
- '${widget.appKitModal.appKit!.metadata.redirect?.native}',
- style: const TextStyle(fontWeight: FontWeight.bold),
- ),
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const Text('Universal: '),
- Expanded(
- child: Text(
- '${widget.appKitModal.appKit!.metadata.redirect?.universal}',
- style: const TextStyle(fontWeight: FontWeight.bold),
- ),
- ),
- ],
- ),
- Row(
- children: [
- const Text('Link Mode: '),
- Text(
- '${widget.appKitModal.appKit!.metadata.redirect?.linkMode}',
- style: const TextStyle(fontWeight: FontWeight.bold),
- ),
- ],
- ),
+ const Divider(height: 1.0),
+ const SizedBox(height: StyleConstants.linear8),
+ _FooterWidget(appKitModal: widget.appKitModal),
const SizedBox(height: StyleConstants.linear8),
- FutureBuilder(
- future: PackageInfo.fromPlatform(),
- builder: (context, snapshot) {
- if (!snapshot.hasData) {
- return const SizedBox.shrink();
- }
- final v = snapshot.data!.version;
- final b = snapshot.data!.buildNumber;
- const f = String.fromEnvironment('FLUTTER_APP_FLAVOR');
- // return Text('App Version: $v-$f ($b) - SDK v$packageVersion');
- return Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const Text('App Version: '),
- Expanded(
- child: Text(
- '$v-$f ($b) - SDK v$packageVersion',
- style: const TextStyle(fontWeight: FontWeight.bold),
- ),
- ),
- ],
- );
- },
- ),
- const SizedBox(height: StyleConstants.linear16),
],
);
}
+ List _buildRequestButtons() {
+ final chainId = widget.appKitModal.selectedChain?.chainId ?? '1';
+ final ns = ReownAppKitModalNetworks.getNamespaceForChainId(chainId);
+ return widget.appKitModal.getApprovedMethods(namespace: ns)?.map((method) {
+ final topic = widget.appKitModal.session!.topic ?? '';
+ final chainId = widget.appKitModal.selectedChain!.chainId;
+ final address = widget.appKitModal.session!.getAddress(ns)!;
+ final chainInfo = ReownAppKitModalNetworks.getNetworkById(
+ ns,
+ chainId,
+ );
+ // final requestParams = await getParams(method, address);
+ // final enabled = requestParams != null;
+ return Container(
+ height: 40.0,
+ width: double.infinity,
+ margin: const EdgeInsets.symmetric(
+ vertical: StyleConstants.linear8,
+ ),
+ child: FutureBuilder(
+ future: getParams(method, address, rpcUrl: chainInfo?.rpcUrl),
+ builder: (_, snapshot) {
+ final enabled = snapshot.data != null;
+ return ElevatedButton(
+ onPressed: enabled
+ ? () {
+ widget.appKitModal.launchConnectedWallet();
+ final future = widget.appKitModal.request(
+ topic: topic,
+ chainId: chainId,
+ request: snapshot.data!,
+ );
+ MethodDialog.show(context, method, future);
+ }
+ : null,
+ child: Text(method),
+ );
+ }),
+ );
+ }).toList() ??
+ [];
+ }
+
+ // ignore: unused_element
Future _onConnect({
required String nativeLink,
VoidCallback? closeModal,
@@ -439,6 +348,7 @@ class ConnectPageState extends State {
closeModal?.call();
}
+ // ignore: unused_element
void _sessionAuthenticate({
required String nativeLink,
required String universalLink,
@@ -446,12 +356,13 @@ class ConnectPageState extends State {
Function(String message)? showToast,
}) async {
debugPrint(
- '[SampleDapp] Creating authenticate with $nativeLink, $universalLink');
+ '[SampleDapp] Creating authentication with $nativeLink, $universalLink',
+ );
final methods1 = requiredNamespaces['eip155']?.methods ?? [];
final methods2 = optionalNamespaces['eip155']?.methods ?? [];
final authResponse = await widget.appKitModal.appKit!.authenticate(
params: SessionAuthRequestParams(
- chains: _selectedChains.map((e) => e.chainId).toList(),
+ chains: _selectedChains.map((e) => 'eip155:${e.chainId}').toList(),
domain: Uri.parse(widget.appKitModal.appKit!.metadata.url).authority,
nonce: AuthUtils.generateNonce(),
uri: widget.appKitModal.appKit!.metadata.url,
@@ -559,17 +470,34 @@ class ConnectPageState extends State {
}
}
+ void _onModalConnect(ModalConnect? event) async {
+ setState(() {});
+ }
+
+ void _onModalUpdate(ModalConnect? event) {
+ setState(() {});
+ }
+
+ void _onModalNetworkChange(ModalNetworkChange? event) {
+ setState(() {});
+ }
+
void _onModalDisconnect(ModalDisconnect? event) {
setState(() {});
}
+ void _onModalError(ModalError? event) {
+ setState(() {});
+ }
+
+ // ignore: unused_element
ButtonStyle get _buttonStyle => ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith(
(states) {
if (states.contains(MaterialState.disabled)) {
return StyleConstants.grayColor;
}
- return StyleConstants.primaryColor;
+ return Colors.blue;
},
),
textStyle: MaterialStateProperty.resolveWith(
@@ -595,6 +523,106 @@ class ConnectPageState extends State {
);
}
+class _FooterWidget extends StatefulWidget {
+ const _FooterWidget({required this.appKitModal});
+ final ReownAppKitModal appKitModal;
+
+ @override
+ State<_FooterWidget> createState() => __FooterWidgetState();
+}
+
+class __FooterWidgetState extends State<_FooterWidget> {
+ @override
+ Widget build(BuildContext context) {
+ final textStyle = TextStyle(fontSize: 12.0);
+ final textStyleBold = textStyle.copyWith(fontWeight: FontWeight.bold);
+ final redirect = widget.appKitModal.appKit!.metadata.redirect;
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: StyleConstants.linear8),
+ Text('Redirect:', style: textStyleBold),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text('Native: ', style: textStyle),
+ Expanded(
+ child: Text('${redirect?.native}', style: textStyleBold),
+ ),
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text('Universal: ', style: textStyle),
+ Expanded(
+ child: Text('${redirect?.universal}', style: textStyleBold),
+ ),
+ ],
+ ),
+ Row(
+ children: [
+ Text('Link Mode: ', style: textStyle),
+ Text('${redirect?.linkMode}', style: textStyleBold),
+ ],
+ ),
+ FutureBuilder(
+ future: PackageInfo.fromPlatform(),
+ builder: (context, snapshot) {
+ if (!snapshot.hasData) {
+ return const SizedBox.shrink();
+ }
+ final v = snapshot.data!.version;
+ final b = snapshot.data!.buildNumber;
+ const f = String.fromEnvironment('FLUTTER_APP_FLAVOR');
+ // return Text('App Version: $v-$f ($b) - SDK v$packageVersion');
+ return Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text('App Version: ', style: textStyle),
+ Expanded(
+ child: Text(
+ '$v-$f ($b) - SDK v$packageVersion',
+ style: textStyleBold,
+ ),
+ ),
+ ],
+ );
+ },
+ ),
+ const SizedBox(height: StyleConstants.linear8),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Visibility(
+ visible: !widget.appKitModal.isConnected,
+ child: SizedBox(
+ height: 30.0,
+ child: ElevatedButton(
+ onPressed: () async {
+ await widget.appKitModal.appKit!.core.storage.deleteAll();
+ ScaffoldMessenger.of(context).showSnackBar(SnackBar(
+ content: Text('Storage cleared'),
+ duration: Duration(seconds: 1),
+ ));
+ },
+ child: Text(
+ 'CLEAR STORAGE',
+ style: TextStyle(fontSize: 10.0),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ],
+ );
+ }
+}
+
class QRCodeScreen extends StatefulWidget {
const QRCodeScreen({
super.key,
diff --git a/packages/reown_appkit/example/base/lib/pages/pairings_page.dart b/packages/reown_appkit/example/base/lib/pages/pairings_page.dart
index a3db3e0..46f0517 100644
--- a/packages/reown_appkit/example/base/lib/pages/pairings_page.dart
+++ b/packages/reown_appkit/example/base/lib/pages/pairings_page.dart
@@ -8,10 +8,10 @@ import 'package:reown_appkit_dapp/widgets/pairing_item.dart';
class PairingsPage extends StatefulWidget {
const PairingsPage({
super.key,
- required this.appKit,
+ required this.appKitModal,
});
- final ReownAppKit appKit;
+ final ReownAppKitModal appKitModal;
@override
PairingsPageState createState() => PairingsPageState();
@@ -19,26 +19,31 @@ class PairingsPage extends StatefulWidget {
class PairingsPageState extends State {
List _pairings = [];
+ late IReownAppKit _appKit;
@override
void initState() {
- _pairings = widget.appKit.pairings.getAll();
- // widget.appKit.onSessionDelete.subscribe(_onSessionDelete);
- widget.appKit.core.pairing.onPairingDelete.subscribe(_onPairingDelete);
- widget.appKit.core.pairing.onPairingExpire.subscribe(_onPairingDelete);
+ _appKit = widget.appKitModal.appKit!;
+ _pairings = _appKit.pairings.getAll();
+ _appKit.core.pairing.onPairingDelete.subscribe(_onPairingDelete);
+ _appKit.core.pairing.onPairingExpire.subscribe(_onPairingDelete);
super.initState();
}
@override
void dispose() {
- // widget.appKit.onSessionDelete.unsubscribe(_onSessionDelete);
- widget.appKit.core.pairing.onPairingDelete.unsubscribe(_onPairingDelete);
- widget.appKit.core.pairing.onPairingExpire.unsubscribe(_onPairingDelete);
+ _appKit.core.pairing.onPairingDelete.unsubscribe(_onPairingDelete);
+ _appKit.core.pairing.onPairingExpire.unsubscribe(_onPairingDelete);
super.dispose();
}
@override
Widget build(BuildContext context) {
+ if (_pairings.isEmpty) {
+ return Center(
+ child: Text('No relay pairings'),
+ );
+ }
final List pairingItems = _pairings
.map(
(PairingInfo pairing) => PairingItem(
@@ -71,7 +76,7 @@ class PairingsPageState extends State {
),
onPressed: () async {
try {
- widget.appKit.core.pairing.disconnect(
+ _appKit.core.pairing.disconnect(
topic: pairing.topic,
);
Navigator.of(context).pop();
@@ -104,7 +109,7 @@ class PairingsPageState extends State {
void _onPairingDelete(PairingEvent? event) {
setState(() {
- _pairings = widget.appKit.pairings.getAll();
+ _pairings = _appKit.pairings.getAll();
});
}
}
diff --git a/packages/reown_appkit/example/base/lib/pages/sessions_page.dart b/packages/reown_appkit/example/base/lib/pages/sessions_page.dart
index 3b23b9d..412e318 100644
--- a/packages/reown_appkit/example/base/lib/pages/sessions_page.dart
+++ b/packages/reown_appkit/example/base/lib/pages/sessions_page.dart
@@ -9,37 +9,44 @@ import 'package:reown_appkit_dapp/widgets/session_widget.dart';
class SessionsPage extends StatefulWidget {
const SessionsPage({
super.key,
- required this.appKit,
+ required this.appKitModal,
});
- final ReownAppKit appKit;
+ final ReownAppKitModal appKitModal;
@override
SessionsPageState createState() => SessionsPageState();
}
class SessionsPageState extends State {
+ late IReownAppKit _appKit;
Map _activeSessions = {};
- String _selectedSession = '';
+ String _selectedTopic = '';
@override
void initState() {
- _activeSessions = widget.appKit.getActiveSessions();
- widget.appKit.onSessionDelete.subscribe(_onSessionDelete);
- widget.appKit.onSessionExpire.subscribe(_onSessionExpire);
+ _appKit = widget.appKitModal.appKit!;
+ _activeSessions = _appKit.getActiveSessions();
+ _appKit.onSessionDelete.subscribe(_onSessionDelete);
+ _appKit.onSessionExpire.subscribe(_onSessionExpire);
super.initState();
}
@override
void dispose() {
- widget.appKit.onSessionDelete.unsubscribe(_onSessionDelete);
- widget.appKit.onSessionExpire.unsubscribe(_onSessionExpire);
+ _appKit.onSessionDelete.unsubscribe(_onSessionDelete);
+ _appKit.onSessionExpire.unsubscribe(_onSessionExpire);
super.dispose();
}
@override
Widget build(BuildContext context) {
final List sessions = _activeSessions.values.toList();
+ if (sessions.isEmpty) {
+ return Center(
+ child: Text('No relay sessions'),
+ );
+ }
return Center(
child: Container(
constraints: const BoxConstraints(
@@ -53,14 +60,14 @@ class SessionsPageState extends State {
materialGapSize: 0.0,
expansionCallback: (int index, bool isExpanded) {
setState(() {
- _selectedSession = !isExpanded ? '' : sessions[index].topic;
+ _selectedTopic = !isExpanded ? '' : sessions[index].topic;
});
},
children: sessions
.map(
(session) => ExpansionPanel(
canTapOnHeader: true,
- isExpanded: _selectedSession == session.topic,
+ isExpanded: _selectedTopic == session.topic,
backgroundColor: Colors.blue.withOpacity(0.2),
headerBuilder: (context, isExpanded) {
return SessionItem(
@@ -84,7 +91,7 @@ class SessionsPageState extends State {
}
Widget _buildSessionView() {
- if (_selectedSession == '') {
+ if (_selectedTopic == '') {
return const Center(
child: Text(
StringConstants.noSessionSelected,
@@ -93,29 +100,27 @@ class SessionsPageState extends State {
);
}
- final SessionData session = _activeSessions[_selectedSession]!;
-
return SessionWidget(
- appKit: widget.appKit,
- session: session,
+ appKitModal: widget.appKitModal,
+ sessionTopic: _selectedTopic,
);
}
void _onSessionDelete(SessionDelete? event) {
setState(() {
- if (event!.topic == _selectedSession) {
- _selectedSession = '';
+ if (event!.topic == _selectedTopic) {
+ _selectedTopic = '';
}
- _activeSessions = widget.appKit.getActiveSessions();
+ _activeSessions = _appKit.getActiveSessions();
});
}
void _onSessionExpire(SessionExpire? event) {
setState(() {
- if (event!.topic == _selectedSession) {
- _selectedSession = '';
+ if (event!.topic == _selectedTopic) {
+ _selectedTopic = '';
}
- _activeSessions = widget.appKit.getActiveSessions();
+ _activeSessions = _appKit.getActiveSessions();
});
}
}
diff --git a/packages/reown_appkit/example/base/lib/utils/crypto/chain_data.dart b/packages/reown_appkit/example/base/lib/utils/crypto/chain_data.dart
deleted file mode 100644
index b6b4396..0000000
--- a/packages/reown_appkit/example/base/lib/utils/crypto/chain_data.dart
+++ /dev/null
@@ -1,199 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:reown_appkit_dapp/models/chain_metadata.dart';
-
-class ChainData {
- static final List eip155Chains = [
- ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:1',
- name: 'Ethereum',
- logo: '/chain-logos/eip155-1.png',
- color: Colors.blue.shade300,
- rpc: ['https://eth.drpc.org'],
- ),
- ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:137',
- name: 'Polygon',
- logo: '/chain-logos/eip155-137.png',
- color: Colors.purple.shade300,
- rpc: ['https://polygon-rpc.com/'],
- ),
- const ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:42161',
- name: 'Arbitrum',
- logo: '/chain-logos/eip155-42161.png',
- color: Colors.blue,
- rpc: ['https://arbitrum.blockpi.network/v1/rpc/public'],
- ),
- const ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:10',
- name: 'OP Mainnet',
- logo: '/chain-logos/eip155-10.png',
- color: Colors.red,
- rpc: ['https://mainnet.optimism.io/'],
- ),
- const ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:43114',
- name: 'Avalanche',
- logo: '/chain-logos/eip155-43114.png',
- color: Colors.orange,
- rpc: ['https://api.avax.network/ext/bc/C/rpc'],
- ),
- const ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:56',
- name: 'BNB Smart Chain Mainnet',
- logo: '/chain-logos/eip155-56.png',
- color: Colors.orange,
- rpc: ['https://bsc-dataseed1.bnbchain.org'],
- ),
- const ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:42220',
- name: 'Celo',
- logo: '/chain-logos/eip155-42220.png',
- color: Colors.green,
- rpc: ['https://forno.celo.org/'],
- ),
- const ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:100',
- name: 'Gnosis',
- logo: '/chain-logos/eip155-100.png',
- color: Colors.greenAccent,
- rpc: ['https://rpc.gnosischain.com/'],
- ),
- const ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:324',
- name: 'zkSync',
- logo: '/chain-logos/eip155-324.png',
- color: Colors.black,
- rpc: ['https://mainnet.era.zksync.io'],
- ),
- ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:11155111',
- name: 'Sepolia',
- logo: '/chain-logos/eip155-1.png',
- color: Colors.blue.shade300,
- isTestnet: true,
- rpc: ['https://ethereum-sepolia.publicnode.com'],
- ),
- ChainMetadata(
- type: ChainType.eip155,
- chainId: 'eip155:80001',
- name: 'Polygon Mumbai',
- logo: '/chain-logos/eip155-137.png',
- color: Colors.purple.shade300,
- isTestnet: true,
- rpc: ['https://matic-mumbai.chainstacklabs.com'],
- ),
- ];
-
- static final List solanaChains = [
- const ChainMetadata(
- type: ChainType.solana,
- chainId: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
- name: 'Solana Mainnet',
- logo: '/chain-logos/solana.png',
- color: Color.fromARGB(255, 247, 0, 255),
- rpc: ['https://api.mainnet-beta.solana.com'],
- ),
- const ChainMetadata(
- type: ChainType.solana,
- chainId: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
- name: 'Solana Devnet',
- logo: '/chain-logos/solana.png',
- color: Color.fromARGB(255, 247, 0, 255),
- rpc: ['https://api.devnet.solana.com'],
- ),
- const ChainMetadata(
- type: ChainType.solana,
- chainId: 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
- name: 'Solana Testnet',
- logo: '/chain-logos/solana.png',
- color: Colors.black,
- isTestnet: true,
- rpc: ['https://api.testnet.solana.com'],
- ),
- ];
-
- static final List cosmosChains = [
- // TODO TO BE SUPPORTED
- const ChainMetadata(
- type: ChainType.cosmos,
- chainId: 'cosmos:cosmoshub-4',
- name: 'Cosmos Mainnet',
- logo: '/chain-logos/cosmos.png',
- color: Colors.purple,
- rpc: [
- 'https://cosmos-rpc.polkachu.com:443',
- 'https://rpc-cosmoshub-ia.cosmosia.notional.ventures:443',
- 'https://rpc.cosmos.network:443',
- ],
- ),
- ];
-
- static final List kadenaChains = [
- // TODO TO BE SUPPORTED
- const ChainMetadata(
- type: ChainType.kadena,
- chainId: 'kadena:mainnet01',
- name: 'Kadena Mainnet',
- logo: '/chain-logos/kadena.png',
- color: Colors.green,
- rpc: [
- 'https://api.chainweb.com',
- ],
- ),
- const ChainMetadata(
- type: ChainType.kadena,
- chainId: 'kadena:testnet04',
- name: 'Kadena Testnet',
- logo: '/chain-logos/kadena.png',
- color: Colors.green,
- isTestnet: true,
- rpc: [
- 'https://api.chainweb.com',
- ],
- ),
- ];
-
- static final List polkadotChains = [
- const ChainMetadata(
- type: ChainType.polkadot,
- chainId: 'polkadot:91b171bb158e2d3848fa23a9f1c25182',
- name: 'Polkadot Mainnet',
- logo: '/chain-logos/polkadot.png',
- color: Color.fromARGB(255, 174, 57, 220),
- rpc: [
- 'wss://rpc.polkadot.io',
- // 'wss://rpc.matrix.canary.enjin.io'
- ],
- ),
- const ChainMetadata(
- type: ChainType.polkadot,
- chainId: 'polkadot:e143f23803ac50e8f6f8e62695d1ce9e',
- name: 'Polkadot Testnet (Westend)',
- logo: '/chain-logos/polkadot.png',
- color: Color.fromARGB(255, 174, 57, 220),
- isTestnet: true,
- rpc: [
- 'wss://westend-rpc.polkadot.io',
- ],
- ),
- ];
-
- static final List allChains = [
- ...eip155Chains,
- ...solanaChains,
- ...polkadotChains,
- // ...kadenaChains,
- // ...cosmosChains,
- ];
-}
diff --git a/packages/reown_appkit/example/base/lib/utils/crypto/eip155.dart b/packages/reown_appkit/example/base/lib/utils/crypto/eip155.dart
index 0556792..594bb28 100644
--- a/packages/reown_appkit/example/base/lib/utils/crypto/eip155.dart
+++ b/packages/reown_appkit/example/base/lib/utils/crypto/eip155.dart
@@ -1,12 +1,9 @@
import 'dart:convert';
-import 'package:eth_sig_util/util/utils.dart';
import 'package:intl/intl.dart';
import 'package:reown_appkit/reown_appkit.dart';
-import 'package:reown_appkit_dapp/models/chain_metadata.dart';
-import 'package:reown_appkit_dapp/utils/crypto/chain_data.dart';
+import 'package:reown_appkit_dapp/utils/crypto/helpers.dart';
import 'package:reown_appkit_dapp/utils/smart_contracts.dart';
-import 'package:reown_appkit_dapp/utils/test_data.dart';
enum EIP155Methods {
personalSign,
@@ -36,10 +33,10 @@ class EIP155 {
};
static Future callMethod({
- required ReownAppKit appKit,
+ required IReownAppKit appKit,
required String topic,
required String method,
- required ChainMetadata chainData,
+ required ReownAppKitModalNetworkInfo chainData,
required String address,
}) {
switch (method) {
@@ -49,7 +46,6 @@ class EIP155 {
topic: topic,
chainId: chainData.chainId,
address: address,
- message: testSignData,
);
case 'eth_sign':
return ethSign(
@@ -57,7 +53,6 @@ class EIP155 {
topic: topic,
chainId: chainData.chainId,
address: address,
- message: testSignData,
);
case 'eth_signTypedData':
return ethSignTypedData(
@@ -65,33 +60,18 @@ class EIP155 {
topic: topic,
chainId: chainData.chainId,
address: address,
- data: typedData,
);
case 'eth_signTransaction':
return ethSignTransaction(
appKit: appKit,
topic: topic,
chainId: chainData.chainId,
- transaction: Transaction(
- from: EthereumAddress.fromHex(address),
- to: EthereumAddress.fromHex(
- '0x59e2f66C0E96803206B6486cDb39029abAE834c0',
- ),
- value: EtherAmount.fromInt(EtherUnit.finney, 12), // == 0.012
- ),
);
case 'eth_sendTransaction':
return ethSendTransaction(
appKit: appKit,
topic: topic,
chainId: chainData.chainId,
- transaction: Transaction(
- from: EthereumAddress.fromHex(address),
- to: EthereumAddress.fromHex(
- '0x59e2f66C0E96803206B6486cDb39029abAE834c0',
- ),
- value: EtherAmount.fromInt(EtherUnit.finney, 11), // == 0.011
- ),
);
default:
throw 'Method unimplemented';
@@ -99,7 +79,7 @@ class EIP155 {
}
static Future callSmartContract({
- required ReownAppKit appKit,
+ required IReownAppKit appKit,
required String topic,
required String address,
required String action,
@@ -113,21 +93,23 @@ class EIP155 {
EthereumAddress.fromHex(SepoliaTestContract.contractAddress),
);
- final sepolia =
- ChainData.allChains.firstWhere((e) => e.chainId == 'eip155:11155111');
+ final sepolia = ReownAppKitModalNetworks.getNetworkById(
+ 'eip155',
+ '11155111',
+ )!;
switch (action) {
case 'read':
return readSmartContract(
appKit: appKit,
- rpcUrl: sepolia.rpc.first,
+ rpcUrl: sepolia.rpcUrl,
contract: deployedContract,
address: address,
);
case 'write':
return appKit.requestWriteContract(
topic: topic,
- chainId: sepolia.chainId,
+ chainId: 'eip155:${sepolia.chainId}',
deployedContract: deployedContract,
functionName: 'transfer',
transaction: Transaction(
@@ -148,93 +130,70 @@ class EIP155 {
}
static Future personalSign({
- required ReownAppKit appKit,
+ required IReownAppKit appKit,
required String topic,
required String chainId,
required String address,
- required String message,
}) async {
- final bytes = utf8.encode(message);
- final encoded = bytesToHex(bytes);
-
return await appKit.request(
topic: topic,
- chainId: chainId,
- request: SessionRequestParams(
- method: methods[EIP155Methods.personalSign]!,
- params: [encoded, address],
- ),
+ chainId: 'eip155:$chainId',
+ request: (await getParams('personal_sign', address))!,
);
}
static Future ethSign({
- required ReownAppKit appKit,
+ required IReownAppKit appKit,
required String topic,
required String chainId,
required String address,
- required String message,
}) async {
return await appKit.request(
topic: topic,
- chainId: chainId,
- request: SessionRequestParams(
- method: methods[EIP155Methods.ethSign]!,
- params: [address, message],
- ),
+ chainId: 'eip155:$chainId',
+ request: (await getParams('eth_sign', address))!,
);
}
static Future ethSignTypedData({
- required ReownAppKit appKit,
+ required IReownAppKit appKit,
required String topic,
required String chainId,
required String address,
- required String data,
}) async {
return await appKit.request(
topic: topic,
- chainId: chainId,
- request: SessionRequestParams(
- method: methods[EIP155Methods.ethSignTypedData]!,
- params: [address, data],
- ),
+ chainId: 'eip155:$chainId',
+ request: (await getParams('eth_signTypedData', address))!,
);
}
static Future ethSignTransaction({
- required ReownAppKit appKit,
+ required IReownAppKit appKit,
required String topic,
required String chainId,
- required Transaction transaction,
}) async {
return await appKit.request(
topic: topic,
- chainId: chainId,
- request: SessionRequestParams(
- method: methods[EIP155Methods.ethSignTransaction]!,
- params: [transaction.toJson()],
- ),
+ chainId: 'eip155:$chainId',
+ request: (await getParams('eth_signTransaction', ''))!,
);
}
static Future ethSendTransaction({
- required ReownAppKit appKit,
+ required IReownAppKit appKit,
required String topic,
required String chainId,
- required Transaction transaction,
}) async {
return await appKit.request(
topic: topic,
- chainId: chainId,
- request: SessionRequestParams(
- method: methods[EIP155Methods.ethSendTransaction]!,
- params: [transaction.toJson()],
- ),
+ chainId: 'eip155:$chainId',
+ request: (await getParams('eth_sendTransaction', ''))!,
);
}
static Future readSmartContract({
- required ReownAppKit appKit,
+ required IReownAppKit appKit,
required String rpcUrl,
required String address,
required DeployedContract contract,
diff --git a/packages/reown_appkit/example/base/lib/utils/crypto/helpers.dart b/packages/reown_appkit/example/base/lib/utils/crypto/helpers.dart
index 6ead377..5caf4b9 100644
--- a/packages/reown_appkit/example/base/lib/utils/crypto/helpers.dart
+++ b/packages/reown_appkit/example/base/lib/utils/crypto/helpers.dart
@@ -1,55 +1,155 @@
-import 'package:flutter/material.dart';
-import 'package:reown_appkit_dapp/models/chain_metadata.dart';
-import 'package:reown_appkit_dapp/utils/crypto/chain_data.dart';
+import 'dart:convert';
+
+import 'package:bs58/bs58.dart';
+import 'package:eth_sig_util/util/utils.dart';
+import 'package:reown_appkit/reown_appkit.dart';
import 'package:reown_appkit_dapp/utils/crypto/eip155.dart';
import 'package:reown_appkit_dapp/utils/crypto/polkadot.dart';
import 'package:reown_appkit_dapp/utils/crypto/solana.dart';
+import 'package:reown_appkit_dapp/utils/test_data.dart';
-String getChainName(String chain) {
- try {
- return ChainData.allChains
- .where((element) => element.chainId == chain)
- .first
- .name;
- } catch (e) {
- debugPrint('[SampleDapp] Invalid chain');
- }
- return 'Unknown';
-}
+import 'package:solana_web3/solana_web3.dart' as solana;
-ChainMetadata getChainMetadataFromChain(String chain) {
- try {
- return ChainData.allChains
- .where((element) => element.chainId == chain)
- .first;
- } catch (e) {
- debugPrint('[SampleDapp] Invalid chain');
- }
- return ChainData.eip155Chains[0];
-}
-
-List getChainMethods(ChainType value) {
- switch (value) {
- case ChainType.eip155:
+List getChainMethods(String namespace) {
+ switch (namespace) {
+ case 'eip155':
return EIP155.methods.values.toList();
- case ChainType.solana:
+ case 'solana':
return Solana.methods.values.toList();
- case ChainType.polkadot:
+ case 'polkadot':
return Polkadot.methods.values.toList();
default:
return [];
}
}
-List getChainEvents(ChainType value) {
- switch (value) {
- case ChainType.eip155:
+List getChainEvents(String namespace) {
+ switch (namespace) {
+ case 'eip155':
return EIP155.events.values.toList();
- case ChainType.solana:
+ case 'solana':
return Solana.events.values.toList();
- case ChainType.polkadot:
+ case 'polkadot':
return Polkadot.events.values.toList();
default:
return [];
}
}
+
+Future getParams(
+ String method,
+ String address, {
+ String? rpcUrl,
+}) async {
+ switch (method) {
+ case 'personal_sign':
+ final bytes = utf8.encode(testSignData);
+ final encoded = bytesToHex(bytes, include0x: true);
+ return SessionRequestParams(
+ method: method,
+ params: [encoded, address],
+ );
+ case 'eth_sign':
+ return SessionRequestParams(
+ method: method,
+ params: [address, testSignData],
+ );
+ case 'eth_signTypedData':
+ return SessionRequestParams(
+ method: method,
+ params: [address, typedData],
+ );
+ case 'eth_signTransaction':
+ return SessionRequestParams(
+ method: method,
+ params: [
+ Transaction(
+ from: EthereumAddress.fromHex(address),
+ to: EthereumAddress.fromHex(
+ '0x59e2f66C0E96803206B6486cDb39029abAE834c0',
+ ),
+ value: EtherAmount.fromInt(EtherUnit.finney, 12), // == 0.012
+ ).toJson(),
+ ],
+ );
+ case 'eth_sendTransaction':
+ return SessionRequestParams(
+ method: method,
+ params: [
+ Transaction(
+ from: EthereumAddress.fromHex(address),
+ to: EthereumAddress.fromHex(
+ '0x59e2f66C0E96803206B6486cDb39029abAE834c0',
+ ),
+ value: EtherAmount.fromInt(EtherUnit.finney, 12), // == 0.012
+ ).toJson(),
+ ],
+ );
+ case 'solana_signMessage':
+ final bytes = utf8.encode(testSignData);
+ final message = base58.encode(bytes);
+ return SessionRequestParams(
+ method: method,
+ params: {'pubkey': address, 'message': message},
+ );
+ case 'solana_signTransaction':
+ // Create a connection to the devnet cluster.
+ final cluster = solana.Cluster.https(
+ Uri.parse(rpcUrl!).authority,
+ );
+ // final cluster = solana.Cluster.devnet;
+ final connection = solana.Connection(cluster);
+
+ // Fetch the latest blockhash.
+ final blockhash = await connection.getLatestBlockhash();
+
+ // Create a System Program instruction to transfer 0.5 SOL from [address1] to [address2].
+ final transactionv0 = solana.Transaction.v0(
+ payer: solana.Pubkey.fromBase58(address),
+ recentBlockhash: blockhash.blockhash,
+ instructions: [
+ solana.TransactionInstruction.fromJson({
+ 'programId': '11111111111111111111111111111111',
+ 'data': [2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
+ 'keys': [
+ {
+ 'isSigner': true,
+ 'isWritable': true,
+ 'pubkey': address,
+ },
+ {
+ 'isSigner': false,
+ 'isWritable': true,
+ 'pubkey': '8vCyX7oB6Pc3pbWMGYYZF5pbSnAdQ7Gyr32JqxqCy8ZR'
+ }
+ ]
+ }),
+ // SystemProgram.transfer(
+ // fromPubkey: solana.Pubkey.fromBase58(address),
+ // toPubkey: solana.Pubkey.fromBase58(
+ // '8vCyX7oB6Pc3pbWMGYYZF5pbSnAdQ7Gyr32JqxqCy8ZR',
+ // ),
+ // lamports: solana.solToLamports(0.5),
+ // ),
+ ],
+ );
+
+ const config = solana.TransactionSerializableConfig(
+ verifySignatures: false,
+ );
+ final bytes = transactionv0.serialize(config).asUint8List();
+ final encodedV0Trx = base64.encode(bytes);
+
+ return SessionRequestParams(
+ method: method,
+ params: {
+ 'transaction': encodedV0Trx,
+ // 'pubkey': address,
+ // 'feePayer': address,
+ // ...transactionv0.message.toJson(),
+ },
+ );
+ default:
+ return null;
+ }
+}
diff --git a/packages/reown_appkit/example/base/lib/utils/crypto/polkadot.dart b/packages/reown_appkit/example/base/lib/utils/crypto/polkadot.dart
index 27eec4f..194aacb 100644
--- a/packages/reown_appkit/example/base/lib/utils/crypto/polkadot.dart
+++ b/packages/reown_appkit/example/base/lib/utils/crypto/polkadot.dart
@@ -18,17 +18,17 @@ class Polkadot {
static final Map events = {};
static Future callMethod({
- required ReownAppKit appKit,
+ required IReownAppKit appKit,
required String topic,
required String method,
- required String chainId,
+ required ReownAppKitModalNetworkInfo chainData,
required String address,
}) {
switch (method) {
case 'polkadot_signMessage':
return appKit.request(
topic: topic,
- chainId: chainId,
+ chainId: chainData.chainId,
request: SessionRequestParams(
method: method,
params: {
@@ -41,7 +41,7 @@ class Polkadot {
case 'polkadot_signTransaction':
return appKit.request(
topic: topic,
- chainId: chainId,
+ chainId: chainData.chainId,
request: SessionRequestParams(
method: method,
params: {
diff --git a/packages/reown_appkit/example/base/lib/utils/crypto/solana.dart b/packages/reown_appkit/example/base/lib/utils/crypto/solana.dart
index 329d83c..57266e1 100644
--- a/packages/reown_appkit/example/base/lib/utils/crypto/solana.dart
+++ b/packages/reown_appkit/example/base/lib/utils/crypto/solana.dart
@@ -1,11 +1,6 @@
-import 'dart:convert';
-import 'package:bs58/bs58.dart';
-import 'package:solana_web3/solana_web3.dart' as solana;
-
+import 'package:reown_appkit_dapp/utils/crypto/helpers.dart';
import 'package:reown_appkit/reown_appkit.dart';
-import 'package:reown_appkit_dapp/models/chain_metadata.dart';
-
enum SolanaMethods {
solanaSignTransaction,
solanaSignMessage,
@@ -24,90 +19,28 @@ class Solana {
static final Map events = {};
static Future callMethod({
- required ReownAppKit appKit,
+ required IReownAppKit appKit,
required String topic,
required String method,
- required ChainMetadata chainData,
+ required ReownAppKitModalNetworkInfo chainData,
required String address,
- bool isV0 = false,
}) async {
switch (method) {
case 'solana_signMessage':
- final bytes = utf8.encode(
- 'This is an example message to be signed - ${DateTime.now()}',
- );
- final message = base58.encode(bytes);
return appKit.request(
topic: topic,
chainId: chainData.chainId,
- request: SessionRequestParams(
- method: method,
- params: {
- 'pubkey': address,
- 'message': message,
- },
- ),
+ request: (await getParams(method, address))!,
);
case 'solana_signTransaction':
- // Create a connection to the devnet cluster.
- final cluster = solana.Cluster.https(
- Uri.parse(chainData.rpc.first).authority,
- );
- // final cluster = solana.Cluster.devnet;
- final connection = solana.Connection(cluster);
-
- // Fetch the latest blockhash.
- final blockhash = await connection.getLatestBlockhash();
-
- // Create a System Program instruction to transfer 0.5 SOL from [address1] to [address2].
- final transactionv0 = solana.Transaction.v0(
- payer: solana.Pubkey.fromBase58(address),
- recentBlockhash: blockhash.blockhash,
- instructions: [
- solana.TransactionInstruction.fromJson({
- 'programId': '11111111111111111111111111111111',
- 'data': [2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
- 'keys': [
- {
- 'isSigner': true,
- 'isWritable': true,
- 'pubkey': address,
- },
- {
- 'isSigner': false,
- 'isWritable': true,
- 'pubkey': '8vCyX7oB6Pc3pbWMGYYZF5pbSnAdQ7Gyr32JqxqCy8ZR'
- }
- ]
- }),
- // SystemProgram.transfer(
- // fromPubkey: solana.Pubkey.fromBase58(address),
- // toPubkey: solana.Pubkey.fromBase58(
- // '8vCyX7oB6Pc3pbWMGYYZF5pbSnAdQ7Gyr32JqxqCy8ZR',
- // ),
- // lamports: solana.solToLamports(0.5),
- // ),
- ],
- );
-
- const config = solana.TransactionSerializableConfig(
- verifySignatures: false,
- );
- final bytes = transactionv0.serialize(config).asUint8List();
- final encodedV0Trx = base64.encode(bytes);
-
return appKit.request(
topic: topic,
chainId: chainData.chainId,
- request: SessionRequestParams(
- method: method,
- params: {
- 'transaction': encodedV0Trx,
- 'pubkey': address,
- 'feePayer': address,
- ...transactionv0.message.toJson(),
- },
- ),
+ request: (await getParams(
+ method,
+ address,
+ rpcUrl: chainData.rpcUrl,
+ ))!,
);
default:
throw 'Method unimplemented';
diff --git a/packages/reown_appkit/example/base/lib/utils/deep_link_handler.dart b/packages/reown_appkit/example/base/lib/utils/deep_link_handler.dart
index 7e22515..10eedaa 100644
--- a/packages/reown_appkit/example/base/lib/utils/deep_link_handler.dart
+++ b/packages/reown_appkit/example/base/lib/utils/deep_link_handler.dart
@@ -1,6 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
-import 'package:reown_appkit/reown_appkit.dart';
+import 'package:reown_appkit/modal/i_appkit_modal_impl.dart';
class DeepLinkHandler {
static const _methodChannel = MethodChannel(
@@ -10,7 +10,7 @@ class DeepLinkHandler {
'com.walletconnect.flutterdapp/events',
);
static final waiting = ValueNotifier(false);
- static late IReownAppKit _appKit;
+ static late IReownAppKitModal _appKitModal;
static void initListener() {
if (kIsWeb) return;
@@ -20,13 +20,13 @@ class DeepLinkHandler {
onError: _onError,
);
} catch (e) {
- debugPrint('[SampleWallet] [DeepLinkHandler] checkInitialLink $e');
+ debugPrint('[SampleDapp] checkInitialLink $e');
}
}
- static void init(IReownAppKit appKit) {
+ static void init(IReownAppKitModal appKitModal) {
if (kIsWeb) return;
- _appKit = appKit;
+ _appKitModal = appKitModal;
}
static void checkInitialLink() async {
@@ -34,22 +34,22 @@ class DeepLinkHandler {
try {
_methodChannel.invokeMethod('initialLink');
} catch (e) {
- debugPrint('[SampleWallet] [DeepLinkHandler] checkInitialLink $e');
+ debugPrint('[SampleDapp] checkInitialLink $e');
}
}
static Uri get nativeUri =>
- Uri.parse(_appKit.metadata.redirect?.native ?? '');
+ Uri.parse(_appKitModal.appKit!.metadata.redirect?.native ?? '');
static Uri get universalUri =>
- Uri.parse(_appKit.metadata.redirect?.universal ?? '');
+ Uri.parse(_appKitModal.appKit!.metadata.redirect?.universal ?? '');
static String get host => universalUri.host;
static void _onLink(dynamic link) async {
+ debugPrint('[SampleDapp] _onLink $link');
if (link == null) return;
- final envelope = ReownCoreUtils.getSearchParamFromURL(link, 'wc_ev');
- if (envelope.isNotEmpty) {
- debugPrint('[SampleDapp] is linkMode $link');
- await _appKit.dispatchEnvelope(link);
+ final handled = await _appKitModal.dispatchEnvelope(link);
+ if (!handled) {
+ debugPrint('[SampleDapp] _onLink not handled by AppKit');
}
}
diff --git a/packages/reown_appkit/example/base/lib/utils/sample_wallets.dart b/packages/reown_appkit/example/base/lib/utils/sample_wallets.dart
index 885e8e5..cc3a800 100644
--- a/packages/reown_appkit/example/base/lib/utils/sample_wallets.dart
+++ b/packages/reown_appkit/example/base/lib/utils/sample_wallets.dart
@@ -23,7 +23,7 @@ class WCSampleWallets {
'name': 'RN Wallet (internal)',
'platform': ['ios', 'android'],
'id': '1234567890123456789012345678922',
- 'schema': 'rn-web3wallet://wc',
+ 'schema': 'rn-web3wallet-internal://',
'bundleId': 'com.walletconnect.web3wallet.rnsample.internal',
'universal': 'https://appkit-lab.reown.com/rn_walletkit_internal',
},
@@ -32,9 +32,8 @@ class WCSampleWallets {
'platform': ['android'],
'id': '123456789012345678901234567894',
'schema': 'kotlin-web3wallet://wc',
- 'bundleId': 'com.walletconnect.sample.wallet.internal',
- 'universal':
- 'https://web3modal-laboratory-git-chore-kotlin-assetlinks-walletconnect1.vercel.app/wallet_internal',
+ 'bundleId': 'com.reown.sample.wallet.internal',
+ 'universal': 'https://appkit-lab.reown.com/wallet_internal',
},
];
@@ -59,7 +58,7 @@ class WCSampleWallets {
'name': 'RN Wallet',
'platform': ['ios', 'android'],
'id': '123456789012345678901234567892',
- 'schema': 'rn-web3wallet://wc',
+ 'schema': 'rn-web3wallet://',
'bundleId': 'com.walletconnect.web3wallet.rnsample',
'universal': 'https://appkit-lab.reown.com/rn_walletkit',
},
@@ -68,9 +67,8 @@ class WCSampleWallets {
'platform': ['android'],
'id': '123456789012345678901234567893',
'schema': 'kotlin-web3wallet://wc',
- 'bundleId': 'com.walletconnect.sample.wallet',
- 'universal':
- 'https://web3modal-laboratory-git-chore-kotlin-assetlinks-walletconnect1.vercel.app/wallet_release',
+ 'bundleId': 'com.reown.sample.wallet',
+ 'universal': 'https://appkit-lab.reown.com/wallet_release',
},
];
diff --git a/packages/reown_appkit/example/base/lib/utils/smart_contracts.dart b/packages/reown_appkit/example/base/lib/utils/smart_contracts.dart
index 9b20505..594d8a1 100644
--- a/packages/reown_appkit/example/base/lib/utils/smart_contracts.dart
+++ b/packages/reown_appkit/example/base/lib/utils/smart_contracts.dart
@@ -277,3 +277,783 @@ class SepoliaTestContract {
}
];
}
+
+class AAVESepoliaContract {
+ // AAVE on Sepolia
+ // https://sepolia.etherscan.io/token/0x88541670E55cC00bEEFD87eB59EDd1b7C511AC9a
+ static const contractAddress = '0x88541670E55cC00bEEFD87eB59EDd1b7C511AC9a';
+
+ static const contractABI = [
+ {
+ 'inputs': [
+ {'internalType': 'string', 'name': 'name', 'type': 'string'},
+ {'internalType': 'string', 'name': 'symbol', 'type': 'string'},
+ {'internalType': 'uint8', 'name': 'decimals', 'type': 'uint8'},
+ {'internalType': 'address', 'name': 'owner', 'type': 'address'}
+ ],
+ 'stateMutability': 'nonpayable',
+ 'type': 'constructor'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {
+ 'indexed': true,
+ 'internalType': 'address',
+ 'name': 'owner',
+ 'type': 'address'
+ },
+ {
+ 'indexed': true,
+ 'internalType': 'address',
+ 'name': 'spender',
+ 'type': 'address'
+ },
+ {
+ 'indexed': false,
+ 'internalType': 'uint256',
+ 'name': 'value',
+ 'type': 'uint256'
+ }
+ ],
+ 'name': 'Approval',
+ 'type': 'event'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {
+ 'indexed': true,
+ 'internalType': 'address',
+ 'name': 'previousOwner',
+ 'type': 'address'
+ },
+ {
+ 'indexed': true,
+ 'internalType': 'address',
+ 'name': 'newOwner',
+ 'type': 'address'
+ }
+ ],
+ 'name': 'OwnershipTransferred',
+ 'type': 'event'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {
+ 'indexed': true,
+ 'internalType': 'address',
+ 'name': 'from',
+ 'type': 'address'
+ },
+ {
+ 'indexed': true,
+ 'internalType': 'address',
+ 'name': 'to',
+ 'type': 'address'
+ },
+ {
+ 'indexed': false,
+ 'internalType': 'uint256',
+ 'name': 'value',
+ 'type': 'uint256'
+ }
+ ],
+ 'name': 'Transfer',
+ 'type': 'event'
+ },
+ {
+ 'inputs': [],
+ 'name': 'DOMAIN_SEPARATOR',
+ 'outputs': [
+ {'internalType': 'bytes32', 'name': '', 'type': 'bytes32'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [],
+ 'name': 'EIP712_REVISION',
+ 'outputs': [
+ {'internalType': 'bytes', 'name': '', 'type': 'bytes'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [],
+ 'name': 'PERMIT_TYPEHASH',
+ 'outputs': [
+ {'internalType': 'bytes32', 'name': '', 'type': 'bytes32'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'owner', 'type': 'address'},
+ {'internalType': 'address', 'name': 'spender', 'type': 'address'}
+ ],
+ 'name': 'allowance',
+ 'outputs': [
+ {'internalType': 'uint256', 'name': '', 'type': 'uint256'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'spender', 'type': 'address'},
+ {'internalType': 'uint256', 'name': 'amount', 'type': 'uint256'}
+ ],
+ 'name': 'approve',
+ 'outputs': [
+ {'internalType': 'bool', 'name': '', 'type': 'bool'}
+ ],
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'account', 'type': 'address'}
+ ],
+ 'name': 'balanceOf',
+ 'outputs': [
+ {'internalType': 'uint256', 'name': '', 'type': 'uint256'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [],
+ 'name': 'decimals',
+ 'outputs': [
+ {'internalType': 'uint8', 'name': '', 'type': 'uint8'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'spender', 'type': 'address'},
+ {
+ 'internalType': 'uint256',
+ 'name': 'subtractedValue',
+ 'type': 'uint256'
+ }
+ ],
+ 'name': 'decreaseAllowance',
+ 'outputs': [
+ {'internalType': 'bool', 'name': '', 'type': 'bool'}
+ ],
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'spender', 'type': 'address'},
+ {'internalType': 'uint256', 'name': 'addedValue', 'type': 'uint256'}
+ ],
+ 'name': 'increaseAllowance',
+ 'outputs': [
+ {'internalType': 'bool', 'name': '', 'type': 'bool'}
+ ],
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'account', 'type': 'address'},
+ {'internalType': 'uint256', 'name': 'value', 'type': 'uint256'}
+ ],
+ 'name': 'mint',
+ 'outputs': [
+ {'internalType': 'bool', 'name': '', 'type': 'bool'}
+ ],
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'uint256', 'name': 'value', 'type': 'uint256'}
+ ],
+ 'name': 'mint',
+ 'outputs': [
+ {'internalType': 'bool', 'name': '', 'type': 'bool'}
+ ],
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [],
+ 'name': 'name',
+ 'outputs': [
+ {'internalType': 'string', 'name': '', 'type': 'string'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'owner', 'type': 'address'}
+ ],
+ 'name': 'nonces',
+ 'outputs': [
+ {'internalType': 'uint256', 'name': '', 'type': 'uint256'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [],
+ 'name': 'owner',
+ 'outputs': [
+ {'internalType': 'address', 'name': '', 'type': 'address'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'owner', 'type': 'address'},
+ {'internalType': 'address', 'name': 'spender', 'type': 'address'},
+ {'internalType': 'uint256', 'name': 'value', 'type': 'uint256'},
+ {'internalType': 'uint256', 'name': 'deadline', 'type': 'uint256'},
+ {'internalType': 'uint8', 'name': 'v', 'type': 'uint8'},
+ {'internalType': 'bytes32', 'name': 'r', 'type': 'bytes32'},
+ {'internalType': 'bytes32', 'name': 's', 'type': 'bytes32'}
+ ],
+ 'name': 'permit',
+ 'outputs': [],
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [],
+ 'name': 'renounceOwnership',
+ 'outputs': [],
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [],
+ 'name': 'symbol',
+ 'outputs': [
+ {'internalType': 'string', 'name': '', 'type': 'string'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [],
+ 'name': 'totalSupply',
+ 'outputs': [
+ {'internalType': 'uint256', 'name': '', 'type': 'uint256'}
+ ],
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'recipient', 'type': 'address'},
+ {'internalType': 'uint256', 'name': 'amount', 'type': 'uint256'}
+ ],
+ 'name': 'transfer',
+ 'outputs': [
+ {'internalType': 'bool', 'name': '', 'type': 'bool'}
+ ],
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'sender', 'type': 'address'},
+ {'internalType': 'address', 'name': 'recipient', 'type': 'address'},
+ {'internalType': 'uint256', 'name': 'amount', 'type': 'uint256'}
+ ],
+ 'name': 'transferFrom',
+ 'outputs': [
+ {'internalType': 'bool', 'name': '', 'type': 'bool'}
+ ],
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'internalType': 'address', 'name': 'newOwner', 'type': 'address'}
+ ],
+ 'name': 'transferOwnership',
+ 'outputs': [],
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ }
+ ];
+}
+
+class USDTContract {
+ // USDT-ERC20
+ // https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7
+ static const contractAddress = '0xdAC17F958D2ee523a2206206994597C13D831ec7';
+
+ static const contractABI = [
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'name',
+ 'outputs': [
+ {'name': '', 'type': 'string'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': '_upgradedAddress', 'type': 'address'}
+ ],
+ 'name': 'deprecate',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': '_spender', 'type': 'address'},
+ {'name': '_value', 'type': 'uint256'}
+ ],
+ 'name': 'approve',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'deprecated',
+ 'outputs': [
+ {'name': '', 'type': 'bool'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': '_evilUser', 'type': 'address'}
+ ],
+ 'name': 'addBlackList',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'totalSupply',
+ 'outputs': [
+ {'name': '', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': '_from', 'type': 'address'},
+ {'name': '_to', 'type': 'address'},
+ {'name': '_value', 'type': 'uint256'}
+ ],
+ 'name': 'transferFrom',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'upgradedAddress',
+ 'outputs': [
+ {'name': '', 'type': 'address'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [
+ {'name': '', 'type': 'address'}
+ ],
+ 'name': 'balances',
+ 'outputs': [
+ {'name': '', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'decimals',
+ 'outputs': [
+ {'name': '', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'maximumFee',
+ 'outputs': [
+ {'name': '', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': '_totalSupply',
+ 'outputs': [
+ {'name': '', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [],
+ 'name': 'unpause',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [
+ {'name': '_maker', 'type': 'address'}
+ ],
+ 'name': 'getBlackListStatus',
+ 'outputs': [
+ {'name': '', 'type': 'bool'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [
+ {'name': '', 'type': 'address'},
+ {'name': '', 'type': 'address'}
+ ],
+ 'name': 'allowed',
+ 'outputs': [
+ {'name': '', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'paused',
+ 'outputs': [
+ {'name': '', 'type': 'bool'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [
+ {'name': 'who', 'type': 'address'}
+ ],
+ 'name': 'balanceOf',
+ 'outputs': [
+ {'name': '', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [],
+ 'name': 'pause',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'getOwner',
+ 'outputs': [
+ {'name': '', 'type': 'address'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'owner',
+ 'outputs': [
+ {'name': '', 'type': 'address'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'symbol',
+ 'outputs': [
+ {'name': '', 'type': 'string'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': '_to', 'type': 'address'},
+ {'name': '_value', 'type': 'uint256'}
+ ],
+ 'name': 'transfer',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': 'newBasisPoints', 'type': 'uint256'},
+ {'name': 'newMaxFee', 'type': 'uint256'}
+ ],
+ 'name': 'setParams',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': 'amount', 'type': 'uint256'}
+ ],
+ 'name': 'issue',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': 'amount', 'type': 'uint256'}
+ ],
+ 'name': 'redeem',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [
+ {'name': '_owner', 'type': 'address'},
+ {'name': '_spender', 'type': 'address'}
+ ],
+ 'name': 'allowance',
+ 'outputs': [
+ {'name': 'remaining', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'basisPointsRate',
+ 'outputs': [
+ {'name': '', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [
+ {'name': '', 'type': 'address'}
+ ],
+ 'name': 'isBlackListed',
+ 'outputs': [
+ {'name': '', 'type': 'bool'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': '_clearedUser', 'type': 'address'}
+ ],
+ 'name': 'removeBlackList',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': true,
+ 'inputs': [],
+ 'name': 'MAX_UINT',
+ 'outputs': [
+ {'name': '', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'view',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': 'newOwner', 'type': 'address'}
+ ],
+ 'name': 'transferOwnership',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'constant': false,
+ 'inputs': [
+ {'name': '_blackListedUser', 'type': 'address'}
+ ],
+ 'name': 'destroyBlackFunds',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {'name': '_initialSupply', 'type': 'uint256'},
+ {'name': '_name', 'type': 'string'},
+ {'name': '_symbol', 'type': 'string'},
+ {'name': '_decimals', 'type': 'uint256'}
+ ],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'constructor'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {'indexed': false, 'name': 'amount', 'type': 'uint256'}
+ ],
+ 'name': 'Issue',
+ 'type': 'event'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {'indexed': false, 'name': 'amount', 'type': 'uint256'}
+ ],
+ 'name': 'Redeem',
+ 'type': 'event'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {'indexed': false, 'name': 'newAddress', 'type': 'address'}
+ ],
+ 'name': 'Deprecate',
+ 'type': 'event'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {'indexed': false, 'name': 'feeBasisPoints', 'type': 'uint256'},
+ {'indexed': false, 'name': 'maxFee', 'type': 'uint256'}
+ ],
+ 'name': 'Params',
+ 'type': 'event'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {'indexed': false, 'name': '_blackListedUser', 'type': 'address'},
+ {'indexed': false, 'name': '_balance', 'type': 'uint256'}
+ ],
+ 'name': 'DestroyedBlackFunds',
+ 'type': 'event'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {'indexed': false, 'name': '_user', 'type': 'address'}
+ ],
+ 'name': 'AddedBlackList',
+ 'type': 'event'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {'indexed': false, 'name': '_user', 'type': 'address'}
+ ],
+ 'name': 'RemovedBlackList',
+ 'type': 'event'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {'indexed': true, 'name': 'owner', 'type': 'address'},
+ {'indexed': true, 'name': 'spender', 'type': 'address'},
+ {'indexed': false, 'name': 'value', 'type': 'uint256'}
+ ],
+ 'name': 'Approval',
+ 'type': 'event'
+ },
+ {
+ 'anonymous': false,
+ 'inputs': [
+ {'indexed': true, 'name': 'from', 'type': 'address'},
+ {'indexed': true, 'name': 'to', 'type': 'address'},
+ {'indexed': false, 'name': 'value', 'type': 'uint256'}
+ ],
+ 'name': 'Transfer',
+ 'type': 'event'
+ },
+ {'anonymous': false, 'inputs': [], 'name': 'Pause', 'type': 'event'},
+ {'anonymous': false, 'inputs': [], 'name': 'Unpause', 'type': 'event'}
+ ];
+}
diff --git a/packages/reown_appkit/example/base/lib/utils/test_data.dart b/packages/reown_appkit/example/base/lib/utils/test_data.dart
index cb78e1d..636ea9a 100644
--- a/packages/reown_appkit/example/base/lib/utils/test_data.dart
+++ b/packages/reown_appkit/example/base/lib/utils/test_data.dart
@@ -36,6 +36,166 @@ String testSignTypedData(String address) => jsonEncode(
const typedData =
r'''{"types":{"EIP712Domain":[{"type":"string","name":"name"},{"type":"string","name":"version"},{"type":"uint256","name":"chainId"},{"type":"address","name":"verifyingContract"}],"Part":[{"name":"account","type":"address"},{"name":"value","type":"uint96"}],"Mint721":[{"name":"tokenId","type":"uint256"},{"name":"tokenURI","type":"string"},{"name":"creators","type":"Part[]"},{"name":"royalties","type":"Part[]"}]},"domain":{"name":"Mint721","version":"1","chainId":4,"verifyingContract":"0x2547760120aed692eb19d22a5d9ccfe0f7872fce"},"primaryType":"Mint721","message":{"@type":"ERC721","contract":"0x2547760120aed692eb19d22a5d9ccfe0f7872fce","tokenId":"1","uri":"ipfs://ipfs/hash","creators":[{"account":"0xc5eac3488524d577a1495492599e8013b1f91efa","value":10000}],"royalties":[],"tokenURI":"ipfs://ipfs/hash"}}''';
+Map typeDataV3(int chainId) => {
+ 'types': {
+ 'EIP712Domain': [
+ {'name': 'name', 'type': 'string'},
+ {'name': 'version', 'type': 'string'},
+ {'name': 'chainId', 'type': 'uint256'},
+ {'name': 'verifyingContract', 'type': 'address'}
+ ],
+ 'Person': [
+ {'name': 'name', 'type': 'string'},
+ {'name': 'wallet', 'type': 'address'}
+ ],
+ 'Mail': [
+ {'name': 'from', 'type': 'Person'},
+ {'name': 'to', 'type': 'Person'},
+ {'name': 'contents', 'type': 'string'}
+ ]
+ },
+ 'primaryType': 'Mail',
+ 'domain': {
+ 'name': 'Ether Mail',
+ 'version': '1',
+ 'chainId': chainId,
+ 'verifyingContract': '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
+ },
+ 'message': {
+ 'from': {
+ 'name': 'Cow',
+ 'wallet': '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826'
+ },
+ 'to': {
+ 'name': 'Bob',
+ 'wallet': '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB'
+ },
+ 'contents': 'Hello, Bob!'
+ }
+ };
+
+Map typeDataV4(int chainId) => {
+ 'types': {
+ 'EIP712Domain': [
+ {'type': 'string', 'name': 'name'},
+ {'type': 'string', 'name': 'version'},
+ {'type': 'uint256', 'name': 'chainId'},
+ {'type': 'address', 'name': 'verifyingContract'}
+ ],
+ 'Part': [
+ {'name': 'account', 'type': 'address'},
+ {'name': 'value', 'type': 'uint96'}
+ ],
+ 'Mint721': [
+ {'name': 'tokenId', 'type': 'uint256'},
+ {'name': 'tokenURI', 'type': 'string'},
+ {'name': 'creators', 'type': 'Part[]'},
+ {'name': 'royalties', 'type': 'Part[]'}
+ ]
+ },
+ 'domain': {
+ 'name': 'Mint721',
+ 'version': '1',
+ 'chainId': chainId,
+ 'verifyingContract': '0x2547760120aed692eb19d22a5d9ccfe0f7872fce'
+ },
+ 'primaryType': 'Mint721',
+ 'message': {
+ '@type': 'ERC721',
+ 'contract': '0x2547760120aed692eb19d22a5d9ccfe0f7872fce',
+ 'tokenId': '1',
+ 'uri': 'ipfs://ipfs/hash',
+ 'creators': [
+ {
+ 'account': '0xc5eac3488524d577a1495492599e8013b1f91efa',
+ 'value': 10000
+ }
+ ],
+ 'royalties': [],
+ 'tokenURI': 'ipfs://ipfs/hash'
+ }
+ };
+
+/// KADENA ///
+
+// SignRequest createSignRequest({
+// required String networkId,
+// required String signingPubKey,
+// required String sender,
+// String code = '"hello"',
+// Map? data,
+// List caps = const [],
+// String chainId = '1',
+// int gasLimit = 2000,
+// double gasPrice = 1e-8,
+// int ttl = 600,
+// }) =>
+// SignRequest(
+// code: code,
+// data: data ?? {},
+// sender: sender,
+// networkId: networkId,
+// chainId: chainId,
+// gasLimit: gasLimit,
+// gasPrice: gasPrice,
+// signingPubKey: signingPubKey,
+// ttl: ttl,
+// caps: caps,
+// );
+
+// PactCommandPayload createPactCommandPayload({
+// required String networkId,
+// required String sender,
+// String code = '"hello"',
+// Map? data,
+// List signerCaps = const [],
+// String chainId = '1',
+// int gasLimit = 2000,
+// double gasPrice = 1e-8,
+// int ttl = 600,
+// }) =>
+// PactCommandPayload(
+// networkId: networkId,
+// payload: CommandPayload(
+// exec: ExecMessage(
+// code: code,
+// data: data ?? {},
+// ),
+// ),
+// signers: signerCaps,
+// meta: CommandMetadata(
+// chainId: chainId,
+// gasLimit: gasLimit,
+// gasPrice: gasPrice,
+// ttl: ttl,
+// sender: sender,
+// ),
+// );
+
+// QuicksignRequest createQuicksignRequest({
+// required String cmd,
+// List sigs = const [],
+// }) =>
+// QuicksignRequest(
+// commandSigDatas: [
+// CommandSigData(
+// cmd: cmd,
+// sigs: sigs,
+// ),
+// ],
+// );
+
+// GetAccountsRequest createGetAccountsRequest({
+// required String account,
+// }) =>
+// GetAccountsRequest(
+// accounts: [
+// AccountRequest(
+// account: account,
+// ),
+// ],
+// );
+
/// KADENA ///
// SignRequest createSignRequest({
diff --git a/packages/reown_appkit/example/base/lib/widgets/chain_button.dart b/packages/reown_appkit/example/base/lib/widgets/chain_button.dart
index b923c1e..2184019 100644
--- a/packages/reown_appkit/example/base/lib/widgets/chain_button.dart
+++ b/packages/reown_appkit/example/base/lib/widgets/chain_button.dart
@@ -1,7 +1,7 @@
import 'dart:math';
import 'package:flutter/material.dart';
-import 'package:reown_appkit_dapp/models/chain_metadata.dart';
+import 'package:reown_appkit/reown_appkit.dart';
import 'package:reown_appkit_dapp/utils/constants.dart';
class ChainButton extends StatelessWidget {
@@ -12,7 +12,7 @@ class ChainButton extends StatelessWidget {
this.selected = false,
});
- final ChainMetadata chain;
+ final ReownAppKitModalNetworkInfo chain;
final VoidCallback onPressed;
final bool selected;
@@ -24,19 +24,20 @@ class ChainButton extends StatelessWidget {
2) -
14.0,
height: StyleConstants.linear48,
- margin: const EdgeInsets.symmetric(
- vertical: StyleConstants.linear8,
+ margin: const EdgeInsets.only(
+ bottom: StyleConstants.linear8,
),
child: ElevatedButton(
onPressed: onPressed,
style: ButtonStyle(
+ elevation: MaterialStateProperty.all(0.0),
backgroundColor: MaterialStateProperty.all(
- selected ? Colors.grey.shade400 : Colors.white,
+ selected ? Colors.white : Colors.grey.shade300,
),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
side: BorderSide(
- color: selected ? Colors.grey.shade400 : chain.color,
+ color: selected ? Colors.blue : Colors.grey.shade300,
width: selected ? 4 : 2,
),
borderRadius: BorderRadius.circular(
diff --git a/packages/reown_appkit/example/base/lib/widgets/session_widget.dart b/packages/reown_appkit/example/base/lib/widgets/session_widget.dart
index 93e0989..86c7b32 100644
--- a/packages/reown_appkit/example/base/lib/widgets/session_widget.dart
+++ b/packages/reown_appkit/example/base/lib/widgets/session_widget.dart
@@ -1,8 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:reown_appkit/reown_appkit.dart';
-
-import 'package:reown_appkit_dapp/models/chain_metadata.dart';
import 'package:reown_appkit_dapp/utils/constants.dart';
import 'package:reown_appkit_dapp/utils/crypto/eip155.dart';
import 'package:reown_appkit_dapp/utils/crypto/helpers.dart';
@@ -14,23 +12,33 @@ import 'package:reown_appkit_dapp/widgets/method_dialog.dart';
class SessionWidget extends StatefulWidget {
const SessionWidget({
super.key,
- required this.session,
- required this.appKit,
+ required this.sessionTopic,
+ required this.appKitModal,
});
- final SessionData session;
- final ReownAppKit appKit;
+ final String sessionTopic;
+ final ReownAppKitModal appKitModal;
@override
SessionWidgetState createState() => SessionWidgetState();
}
class SessionWidgetState extends State {
+ late IReownAppKit _appKit;
+ late SessionData _session;
+
+ @override
+ void initState() {
+ super.initState();
+ _appKit = widget.appKitModal.appKit!;
+ _session = _appKit.sessions.get(widget.sessionTopic)!;
+ }
+
@override
Widget build(BuildContext context) {
final List children = [
Text(
- '${StringConstants.sessionTopic}${widget.session.topic}',
+ '${StringConstants.sessionTopic}${_session.topic}',
),
];
@@ -38,7 +46,7 @@ class SessionWidgetState extends State {
final List namespaceAccounts = [];
// Loop through the namespaces, and get the accounts
- for (final Namespace namespace in widget.session.namespaces.values) {
+ for (final Namespace namespace in _session.namespaces.values) {
namespaceAccounts.addAll(namespace.accounts);
}
@@ -61,8 +69,8 @@ class SessionWidgetState extends State {
),
child: ElevatedButton(
onPressed: () async {
- await widget.appKit.disconnectSession(
- topic: widget.session.topic,
+ await _appKit.disconnectSession(
+ topic: _session.topic,
reason: Errors.getSdkError(
Errors.USER_DISCONNECTED,
).toSignError(),
@@ -90,11 +98,17 @@ class SessionWidgetState extends State {
Widget _buildAccountWidget(String namespaceAccount) {
final chainId = NamespaceUtils.getChainFromAccount(namespaceAccount);
final account = NamespaceUtils.getAccount(namespaceAccount);
- final chainMetadata = getChainMetadataFromChain(chainId);
+ final namespace = NamespaceUtils.getNamespaceFromChain(
+ chainId,
+ );
+ final chainData = ReownAppKitModalNetworks.getNetworkById(
+ namespace,
+ chainId.split(':').last,
+ );
final List children = [
Text(
- chainMetadata.name,
+ chainData!.name,
style: StyleConstants.subtitleText,
),
const SizedBox(
@@ -113,7 +127,7 @@ class SessionWidgetState extends State {
),
];
- children.addAll(_buildChainMethodButtons(chainMetadata, account));
+ children.addAll(_buildChainMethodButtons(chainData, account));
children.add(const Divider());
@@ -131,11 +145,7 @@ class SessionWidgetState extends State {
style: StyleConstants.subtitleText,
),
]);
- children.addAll(
- _buildChainEventsTiles(
- chainMetadata,
- ),
- );
+ children.addAll(_buildChainEventsTiles(chainData));
// final ChainMetadata
return Container(
@@ -149,7 +159,7 @@ class SessionWidgetState extends State {
),
decoration: BoxDecoration(
border: Border.all(
- color: chainMetadata.color,
+ color: Colors.blue,
),
borderRadius: const BorderRadius.all(
Radius.circular(
@@ -164,13 +174,16 @@ class SessionWidgetState extends State {
}
List _buildChainMethodButtons(
- ChainMetadata chainMetadata,
+ ReownAppKitModalNetworkInfo chainMetadata,
String address,
) {
final List buttons = [];
// Add Methods
- for (final String method in getChainMethods(chainMetadata.type)) {
- final namespaces = widget.session.namespaces[chainMetadata.type.name];
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ chainMetadata.chainId,
+ );
+ for (final String method in getChainMethods(namespace)) {
+ final namespaces = _session.namespaces[namespace];
final supported = namespaces?.methods.contains(method) ?? false;
buttons.add(
Container(
@@ -195,7 +208,7 @@ class SessionWidgetState extends State {
backgroundColor: MaterialStateProperty.resolveWith(
(states) => states.contains(MaterialState.disabled)
? Colors.grey
- : chainMetadata.color,
+ : Colors.blue,
),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
@@ -220,39 +233,41 @@ class SessionWidgetState extends State {
Future callChainMethod(
String method,
- ChainMetadata chainMetadata,
+ ReownAppKitModalNetworkInfo chainMetadata,
String address,
) {
- switch (chainMetadata.type) {
- case ChainType.eip155:
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ chainMetadata.chainId,
+ );
+ switch (namespace) {
+ case 'eip155':
return EIP155.callMethod(
- appKit: widget.appKit,
- topic: widget.session.topic,
+ appKit: _appKit,
+ topic: _session.topic,
method: method,
chainData: chainMetadata,
address: address,
);
- case ChainType.polkadot:
+ case 'polkadot':
return Polkadot.callMethod(
- appKit: widget.appKit,
- topic: widget.session.topic,
+ appKit: _appKit,
+ topic: _session.topic,
method: method,
- chainId: chainMetadata.chainId,
+ chainData: chainMetadata,
address: address,
);
- case ChainType.solana:
+ case 'solana':
return Solana.callMethod(
- appKit: widget.appKit,
- topic: widget.session.topic,
+ appKit: _appKit,
+ topic: _session.topic,
method: method,
chainData: chainMetadata,
address: address,
- isV0: true,
);
// case ChainType.kadena:
// return Kadena.callMethod(
- // appKit: widget.appKit,
- // topic: widget.session.topic,
+ // appKit: _appKit,
+ // topic: _session.topic,
// method: method.toKadenaMethod()!,
// chainId: chainMetadata.chainId,
// address: address.toLowerCase(),
@@ -264,9 +279,9 @@ class SessionWidgetState extends State {
void _launchWallet() {
if (kIsWeb) return;
- widget.appKit.redirectToWallet(
- topic: widget.session.topic,
- redirect: widget.session.peer.metadata.redirect,
+ _appKit.redirectToWallet(
+ topic: _session.topic,
+ redirect: _session.peer.metadata.redirect,
);
}
@@ -284,8 +299,8 @@ class SessionWidgetState extends State {
onPressed: enabled
? () async {
final future = EIP155.callSmartContract(
- appKit: widget.appKit,
- topic: widget.session.topic,
+ appKit: _appKit,
+ topic: _session.topic,
address: address,
action: 'read',
);
@@ -326,8 +341,8 @@ class SessionWidgetState extends State {
onPressed: enabled
? () async {
final future = EIP155.callSmartContract(
- appKit: widget.appKit,
- topic: widget.session.topic,
+ appKit: _appKit,
+ topic: _session.topic,
address: address,
action: 'write',
);
@@ -362,10 +377,12 @@ class SessionWidgetState extends State {
return buttons;
}
- List _buildChainEventsTiles(ChainMetadata chainMetadata) {
+ List _buildChainEventsTiles(ReownAppKitModalNetworkInfo chainData) {
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ chainData.chainId,
+ );
final List values = [];
-
- for (final String event in getChainEvents(chainMetadata.type)) {
+ for (final String event in getChainEvents(namespace)) {
values.add(
Container(
width: double.infinity,
@@ -375,7 +392,7 @@ class SessionWidgetState extends State {
),
decoration: BoxDecoration(
border: Border.all(
- color: chainMetadata.color,
+ color: Colors.blue,
),
borderRadius: const BorderRadius.all(
Radius.circular(
diff --git a/packages/reown_appkit/example/base/pubspec.yaml b/packages/reown_appkit/example/base/pubspec.yaml
index 1934ff9..f928b0e 100644
--- a/packages/reown_appkit/example/base/pubspec.yaml
+++ b/packages/reown_appkit/example/base/pubspec.yaml
@@ -17,7 +17,7 @@ dependencies:
sdk: flutter
intl: ^0.19.0
json_annotation: ^4.8.1
- package_info_plus: ^7.0.0
+ package_info_plus: ^8.0.2
qr_flutter: ^4.0.0
reown_appkit:
path: ../..
diff --git a/packages/reown_appkit/example/example.md b/packages/reown_appkit/example/example.md
index 2abf4a8..e998461 100644
--- a/packages/reown_appkit/example/example.md
+++ b/packages/reown_appkit/example/example.md
@@ -38,7 +38,7 @@ class _MyHomePageState extends State {
super.initState();
_appKitModal = ReownAppKitModal(
context: context,
- projectId: '07429........',
+ projectId: '074.....',
metadata: const PairingMetadata(
name: 'Example App',
description: 'Example app description',
@@ -51,7 +51,7 @@ class _MyHomePageState extends State {
),
);
- _appKitModal.init();
+ _appKitModal.init().then((value) => setState(() {}));
}
@override
@@ -61,25 +61,26 @@ class _MyHomePageState extends State {
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
- body: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- AppKitModalNetworkSelectButton(
- appKit: _appKitModal,
- context: context,
- ),
- AppKitModalConnectButton(
- appKit: _appKitModal,
- context: context,
- ),
- Visibility(
- visible: _appKitModal.isConnected,
- child: AppKitModalAccountButton(
+ body: Center(
+ child: Column(
+ children: [
+ AppKitModalNetworkSelectButton(
appKit: _appKitModal,
context: context,
),
- )
- ],
+ AppKitModalConnectButton(
+ appKit: _appKitModal,
+ context: context,
+ ),
+ Visibility(
+ visible: _appKitModal.isConnected,
+ child: AppKitModalAccountButton(
+ appKit: _appKitModal,
+ context: context,
+ ),
+ )
+ ],
+ ),
),
);
}
diff --git a/packages/reown_appkit/example/modal/android/app/src/main/AndroidManifest.xml b/packages/reown_appkit/example/modal/android/app/src/main/AndroidManifest.xml
index a56e8f2..dade05d 100644
--- a/packages/reown_appkit/example/modal/android/app/src/main/AndroidManifest.xml
+++ b/packages/reown_appkit/example/modal/android/app/src/main/AndroidManifest.xml
@@ -52,8 +52,8 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -95,4 +111,4 @@
android:name="flutterEmbedding"
android:value="2" />
-
+
\ No newline at end of file
diff --git a/packages/reown_appkit/example/modal/android/app/src/main/kotlin/com/example/sign/MainActivity.kt b/packages/reown_appkit/example/modal/android/app/src/main/kotlin/com/example/sign/MainActivity.kt
index 4094c0c..877b2ca 100644
--- a/packages/reown_appkit/example/modal/android/app/src/main/kotlin/com/example/sign/MainActivity.kt
+++ b/packages/reown_appkit/example/modal/android/app/src/main/kotlin/com/example/sign/MainActivity.kt
@@ -1,6 +1,65 @@
package com.web3modal.flutterExample
import io.flutter.embedding.android.FlutterActivity
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.net.Uri
+import android.os.Bundle
+import androidx.annotation.NonNull
+
+import io.flutter.embedding.engine.FlutterEngine
+import io.flutter.plugin.common.EventChannel
+import io.flutter.plugin.common.MethodCall
+import io.flutter.plugin.common.MethodChannel
class MainActivity: FlutterActivity() {
+ private val eventsChannel = "com.web3modal.flutterExample/events"
+ private val methodsChannel = "com.web3modal.flutterExample/methods"
+
+ private var initialLink: String? = null
+ private var linksReceiver: BroadcastReceiver? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ val intent: Intent? = intent
+ initialLink = intent?.data?.toString()
+
+ EventChannel(flutterEngine?.dartExecutor?.binaryMessenger, eventsChannel).setStreamHandler(
+ object : EventChannel.StreamHandler {
+ override fun onListen(args: Any?, events: EventChannel.EventSink) {
+ linksReceiver = createChangeReceiver(events)
+ }
+ override fun onCancel(args: Any?) {
+ linksReceiver = null
+ }
+ }
+ )
+
+ MethodChannel(flutterEngine!!.dartExecutor.binaryMessenger, methodsChannel).setMethodCallHandler { call, result ->
+ if (call.method == "initialLink") {
+ if (initialLink != null) {
+ result.success(initialLink)
+ }
+ }
+ }
+ }
+
+ override fun onNewIntent(intent: Intent) {
+ super.onNewIntent(intent)
+ if (intent.action === Intent.ACTION_VIEW) {
+ linksReceiver?.onReceive(this.applicationContext, intent)
+ }
+ }
+
+ fun createChangeReceiver(events: EventChannel.EventSink): BroadcastReceiver? {
+ return object : BroadcastReceiver() {
+ override fun onReceive(context: Context, intent: Intent) {
+ val dataString = intent.dataString ?:
+ events.error("UNAVAILABLE", "Link unavailable", null)
+ events.success(dataString)
+ }
+ }
+ }
}
diff --git a/packages/reown_appkit/example/modal/ios/Podfile b/packages/reown_appkit/example/modal/ios/Podfile
index 3e44f9c..9a3af86 100644
--- a/packages/reown_appkit/example/modal/ios/Podfile
+++ b/packages/reown_appkit/example/modal/ios/Podfile
@@ -40,5 +40,8 @@ end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
+ target.build_configurations.each do |config|
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
+ end
end
end
diff --git a/packages/reown_appkit/example/modal/ios/Podfile.lock b/packages/reown_appkit/example/modal/ios/Podfile.lock
index 35be0e9..0d8a466 100644
--- a/packages/reown_appkit/example/modal/ios/Podfile.lock
+++ b/packages/reown_appkit/example/modal/ios/Podfile.lock
@@ -84,6 +84,6 @@ SPEC CHECKSUMS:
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
webview_flutter_wkwebview: 2a23822e9039b7b1bc52e5add778e5d89ad488d1
-PODFILE CHECKSUM: a57f30d18f102dd3ce366b1d62a55ecbef2158e5
+PODFILE CHECKSUM: 0a7d5b7d0e53420cb0284f7b2f171f93843b94d2
COCOAPODS: 1.15.2
diff --git a/packages/reown_appkit/example/modal/ios/Runner.xcodeproj/project.pbxproj b/packages/reown_appkit/example/modal/ios/Runner.xcodeproj/project.pbxproj
index cb7df21..0f7d8c5 100644
--- a/packages/reown_appkit/example/modal/ios/Runner.xcodeproj/project.pbxproj
+++ b/packages/reown_appkit/example/modal/ios/Runner.xcodeproj/project.pbxproj
@@ -7,15 +7,15 @@
objects = {
/* Begin PBXBuildFile section */
+ 0FC0BB3BB94AB404E045720B /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 169E0B2740AE2BC995671894 /* Pods_RunnerTests.framework */; };
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
- 39AD9E7C47D2C2E726BC1CD1 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67AE57406F4CAFF18576119B /* Pods_RunnerTests.framework */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
- 8FA6AEDFDC4C361E30EC02B5 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6989162A0A87467687F5F26F /* Pods_Runner.framework */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
+ EDDE4E51D009541346361FC7 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EBC2BC702D406D694ACF7E0 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -45,16 +45,19 @@
092D151B2ABD988600C69848 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
- 16888CA3F81E677DDEC3A0CD /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
+ 169E0B2740AE2BC995671894 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 178F7352ABF9CF9D6C0AC3E1 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; };
+ 28F59A072E15C899242AF2D5 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
+ 2EBC2BC702D406D694ACF7E0 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; };
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
- 362D7224BA747ECF2E28DB1F /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; };
+ 34526704E4066B8A8B16487C /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
- 67AE57406F4CAFF18576119B /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- 6989162A0A87467687F5F26F /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 7A0275FA2B710C9A4864BF04 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
+ 7EADC7CA6C879427CE8FE8E4 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -62,10 +65,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
- B2930B7741FEE25EBE53F9E1 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
- D06C3C4B2781C786140748A0 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; };
- E9367D8F7B7044CEE6C79C75 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
- FBB093E541A895EE125D344E /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; };
+ F67BA6AC18A21E534AD2806E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -73,7 +73,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 39AD9E7C47D2C2E726BC1CD1 /* Pods_RunnerTests.framework in Frameworks */,
+ 0FC0BB3BB94AB404E045720B /* Pods_RunnerTests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -81,22 +81,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 8FA6AEDFDC4C361E30EC02B5 /* Pods_Runner.framework in Frameworks */,
+ EDDE4E51D009541346361FC7 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
- 1FB98289B12D49950E73D65F /* Frameworks */ = {
- isa = PBXGroup;
- children = (
- 6989162A0A87467687F5F26F /* Pods_Runner.framework */,
- 67AE57406F4CAFF18576119B /* Pods_RunnerTests.framework */,
- );
- name = Frameworks;
- sourceTree = "";
- };
331C8082294A63A400263BE5 /* RunnerTests */ = {
isa = PBXGroup;
children = (
@@ -124,7 +115,7 @@
97C146EF1CF9000F007C117D /* Products */,
331C8082294A63A400263BE5 /* RunnerTests */,
E880F334C300E1CEFAFD6E4C /* Pods */,
- 1FB98289B12D49950E73D65F /* Frameworks */,
+ E653A4133AC9A030D05E99B5 /* Frameworks */,
);
sourceTree = "";
};
@@ -153,15 +144,24 @@
path = Runner;
sourceTree = "";
};
+ E653A4133AC9A030D05E99B5 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 2EBC2BC702D406D694ACF7E0 /* Pods_Runner.framework */,
+ 169E0B2740AE2BC995671894 /* Pods_RunnerTests.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
E880F334C300E1CEFAFD6E4C /* Pods */ = {
isa = PBXGroup;
children = (
- 16888CA3F81E677DDEC3A0CD /* Pods-Runner.debug.xcconfig */,
- E9367D8F7B7044CEE6C79C75 /* Pods-Runner.release.xcconfig */,
- B2930B7741FEE25EBE53F9E1 /* Pods-Runner.profile.xcconfig */,
- D06C3C4B2781C786140748A0 /* Pods-RunnerTests.debug.xcconfig */,
- 362D7224BA747ECF2E28DB1F /* Pods-RunnerTests.release.xcconfig */,
- FBB093E541A895EE125D344E /* Pods-RunnerTests.profile.xcconfig */,
+ F67BA6AC18A21E534AD2806E /* Pods-Runner.debug.xcconfig */,
+ 28F59A072E15C899242AF2D5 /* Pods-Runner.release.xcconfig */,
+ 7A0275FA2B710C9A4864BF04 /* Pods-Runner.profile.xcconfig */,
+ 178F7352ABF9CF9D6C0AC3E1 /* Pods-RunnerTests.debug.xcconfig */,
+ 7EADC7CA6C879427CE8FE8E4 /* Pods-RunnerTests.release.xcconfig */,
+ 34526704E4066B8A8B16487C /* Pods-RunnerTests.profile.xcconfig */,
);
path = Pods;
sourceTree = "";
@@ -173,7 +173,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
buildPhases = (
- A651C144B5361BC3EF29C3BB /* [CP] Check Pods Manifest.lock */,
+ AF2FA7F17BAB05056A62906B /* [CP] Check Pods Manifest.lock */,
331C807D294A63A400263BE5 /* Sources */,
331C807F294A63A400263BE5 /* Resources */,
6D09732E2619FACF7894A4A1 /* Frameworks */,
@@ -192,14 +192,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
- 19E33495D5B1E24E7C81DB51 /* [CP] Check Pods Manifest.lock */,
+ 65C32C19F7EBA60FB984317E /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
- A8353A6875DADDB86DC82CE5 /* [CP] Embed Pods Frameworks */,
+ 81B204DD1922A787090F78E0 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -270,7 +270,23 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 19E33495D5B1E24E7C81DB51 /* [CP] Check Pods Manifest.lock */ = {
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
+ isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
+ );
+ name = "Thin Binary";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
+ };
+ 65C32C19F7EBA60FB984317E /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -292,21 +308,22 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
- 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
+ 81B204DD1922A787090F78E0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
- alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
- inputPaths = (
- "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
- name = "Thin Binary";
- outputPaths = (
+ name = "[CP] Embed Pods Frameworks";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
@@ -323,7 +340,7 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
- A651C144B5361BC3EF29C3BB /* [CP] Check Pods Manifest.lock */ = {
+ AF2FA7F17BAB05056A62906B /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -345,23 +362,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
- A8353A6875DADDB86DC82CE5 /* [CP] Embed Pods Frameworks */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputFileListPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
- );
- name = "[CP] Embed Pods Frameworks";
- outputFileListPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
- showEnvVarsInLog = 0;
- };
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -492,7 +492,7 @@
};
331C8088294A63A400263BE5 /* Debug */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = D06C3C4B2781C786140748A0 /* Pods-RunnerTests.debug.xcconfig */;
+ baseConfigurationReference = 178F7352ABF9CF9D6C0AC3E1 /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
@@ -510,7 +510,7 @@
};
331C8089294A63A400263BE5 /* Release */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 362D7224BA747ECF2E28DB1F /* Pods-RunnerTests.release.xcconfig */;
+ baseConfigurationReference = 7EADC7CA6C879427CE8FE8E4 /* Pods-RunnerTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
@@ -526,7 +526,7 @@
};
331C808A294A63A400263BE5 /* Profile */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = FBB093E541A895EE125D344E /* Pods-RunnerTests.profile.xcconfig */;
+ baseConfigurationReference = 34526704E4066B8A8B16487C /* Pods-RunnerTests.profile.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
diff --git a/packages/reown_appkit/example/modal/ios/Runner/AppDelegate.swift b/packages/reown_appkit/example/modal/ios/Runner/AppDelegate.swift
index 81aa14a..9002210 100644
--- a/packages/reown_appkit/example/modal/ios/Runner/AppDelegate.swift
+++ b/packages/reown_appkit/example/modal/ios/Runner/AppDelegate.swift
@@ -4,11 +4,47 @@ import CoinbaseWalletSDK
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
- override func application(
- _ application: UIApplication,
- didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
- ) -> Bool {
+
+ private static let EVENTS_CHANNEL = "com.web3modal.flutterExample/events"
+ private static let METHODS_CHANNEL = "com.web3modal.flutterExample/methods"
+
+ private var eventsChannel: FlutterEventChannel?
+ private var methodsChannel: FlutterMethodChannel?
+ var initialLink: String?
+
+ private let linkStreamHandler = LinkStreamHandler()
+
+ override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
GeneratedPluginRegistrant.register(with: self)
+
+ let controller = window.rootViewController as! FlutterViewController
+ eventsChannel = FlutterEventChannel(name: AppDelegate.EVENTS_CHANNEL, binaryMessenger: controller.binaryMessenger)
+ eventsChannel?.setStreamHandler(linkStreamHandler)
+
+ methodsChannel = FlutterMethodChannel(name: AppDelegate.METHODS_CHANNEL, binaryMessenger: controller.binaryMessenger)
+ methodsChannel?.setMethodCallHandler({ [weak self] (call: FlutterMethodCall, result: FlutterResult) -> Void in
+ if (call.method == "initialLink") {
+ if let link = self?.initialLink {
+ let handled = self?.linkStreamHandler.handleLink(link)
+ if (handled == true) {
+ self?.initialLink = nil
+ }
+ }
+ }
+ })
+
+ // Add your deep link handling logic here
+ if let url = launchOptions?[.url] as? URL {
+ self.initialLink = url.absoluteString
+ }
+
+ if let userActivityDictionary = launchOptions?[.userActivityDictionary] as? [String: Any],
+ let userActivity = userActivityDictionary["UIApplicationLaunchOptionsUserActivityKey"] as? NSUserActivity,
+ userActivity.activityType == NSUserActivityTypeBrowsingWeb {
+
+ handleIncomingUniversalLink(userActivity: userActivity)
+ }
+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
@@ -21,19 +57,61 @@ import CoinbaseWalletSDK
}
}
- return super.application(app, open: url, options: options)
+ return linkStreamHandler.handleLink(url.absoluteString)
}
override func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if #available(iOS 13.0, *) {
if (CoinbaseWalletSDK.isConfigured == true) {
- if let url = userActivity.webpageURL,
- (try? CoinbaseWalletSDK.shared.handleResponse(url)) == true {
+ if let url = userActivity.webpageURL, (try? CoinbaseWalletSDK.shared.handleResponse(url)) == true {
return true
}
}
}
- return super.application(application, continue: userActivity, restorationHandler: restorationHandler)
+ if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
+ handleIncomingUniversalLink(userActivity: userActivity)
+ return true
+ }
+
+ return false
+ }
+
+ private func handleIncomingUniversalLink(userActivity: NSUserActivity) {
+ if let url = userActivity.webpageURL {
+ // Handle the URL, navigate to appropriate screen
+ print("App launched with Universal Link: \(url.absoluteString)")
+ let handled = linkStreamHandler.handleLink(url.absoluteString)
+ if (!handled){
+ self.initialLink = url.absoluteString
+ }
+ }
+ }
+}
+
+class LinkStreamHandler: NSObject, FlutterStreamHandler {
+ var eventSink: FlutterEventSink?
+ var queuedLinks = [String]()
+
+ func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? {
+ self.eventSink = events
+ queuedLinks.forEach({ events($0) })
+ queuedLinks.removeAll()
+ return nil
+ }
+
+ func onCancel(withArguments arguments: Any?) -> FlutterError? {
+ self.eventSink = nil
+ return nil
+ }
+
+ func handleLink(_ link: String) -> Bool {
+ guard let eventSink = eventSink else {
+ queuedLinks.append(link)
+ return false
+ }
+ eventSink(link)
+ return true
}
}
+
diff --git a/packages/reown_appkit/example/modal/ios/Runner/Info.plist b/packages/reown_appkit/example/modal/ios/Runner/Info.plist
index 119d42e..a97c4c3 100644
--- a/packages/reown_appkit/example/modal/ios/Runner/Info.plist
+++ b/packages/reown_appkit/example/modal/ios/Runner/Info.plist
@@ -69,7 +69,6 @@
cbwallet
okto
bitkeep
- hyperPay
bitizen
ape
uniswap
@@ -90,6 +89,7 @@
wcflutterwallet
wcflutterwallet-internal
rn-web3wallet
+ rn-web3wallet-internal
LSRequiresIPhoneOS
diff --git a/packages/reown_appkit/example/modal/ios/Runner/Runner.entitlements b/packages/reown_appkit/example/modal/ios/Runner/Runner.entitlements
index 903def2..bfe855c 100644
--- a/packages/reown_appkit/example/modal/ios/Runner/Runner.entitlements
+++ b/packages/reown_appkit/example/modal/ios/Runner/Runner.entitlements
@@ -2,7 +2,9 @@
- aps-environment
- development
+ com.apple.developer.associated-domains
+
+ applinks:appkit-lab.reown.com
+
diff --git a/packages/reown_appkit/example/modal/lib/home_page.dart b/packages/reown_appkit/example/modal/lib/home_page.dart
index a674459..f48418b 100644
--- a/packages/reown_appkit/example/modal/lib/home_page.dart
+++ b/packages/reown_appkit/example/modal/lib/home_page.dart
@@ -1,12 +1,13 @@
+import 'dart:convert';
import 'dart:developer';
import 'package:fl_toast/fl_toast.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
+import 'package:reown_appkit_example/services/deep_link_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:reown_appkit/reown_appkit.dart';
-
import 'package:reown_appkit_example/widgets/debug_drawer.dart';
import 'package:reown_appkit_example/utils/constants.dart';
import 'package:reown_appkit_example/services/siwe_service.dart';
@@ -33,7 +34,7 @@ class MyHomePage extends StatefulWidget {
}
class _MyHomePageState extends State {
- final overlay = OverlayController(const Duration(milliseconds: 200));
+ late OverlayController overlay;
late ReownAppKitModal _appKitModal;
late SIWESampleWebService _siweTestService;
bool _initialized = false;
@@ -43,7 +44,6 @@ class _MyHomePageState extends State {
super.initState();
_siweTestService = SIWESampleWebService();
WidgetsBinding.instance.addPostFrameCallback((_) {
- _toggleOverlay();
_initializeService(widget.prefs);
});
}
@@ -53,20 +53,17 @@ class _MyHomePageState extends State {
}
String get _flavor {
- // String flavor = '-${const String.fromEnvironment('FLUTTER_APP_FLAVOR')}';
- // return flavor.replaceAll('-production', '');
final internal = widget.bundleId.endsWith('.internal');
final debug = widget.bundleId.endsWith('.debug');
if (internal || debug || kDebugMode) {
- return 'internal';
+ return '-internal';
}
return '';
}
String _universalLink() {
- // TODO change /flutter_appkit to something else
- Uri link = Uri.parse('https://appkit-lab.reown.com/flutter_appkit');
- if (_flavor.isNotEmpty) {
+ Uri link = Uri.parse('https://appkit-lab.reown.com/flutter_appkit_modal');
+ if (_flavor.isNotEmpty && !kDebugMode) {
return link.replace(path: '${link.path}_internal').toString();
}
return link.toString();
@@ -88,7 +85,7 @@ class _MyHomePageState extends State {
description: StringConstants.pageTitle,
url: _universalLink(),
icons: [
- 'https://docs.walletconnect.com/assets/images/web3modalLogo-2cee77e07851ba0a710b56d03d4d09dd.png'
+ 'https://raw.githubusercontent.com/reown-com/reown_flutter/refs/heads/develop/assets/appkit_logo.png',
],
redirect: _constructRedirect(),
);
@@ -168,8 +165,11 @@ class _MyHomePageState extends State {
} catch (error) {
debugPrint('[SIWEConfig] getSession error: $error');
// Fallback patch for testing purposes in case SIWE backend has issues
- final address = _appKitModal.session!.address!;
- final chainId = _appKitModal.session!.chainId;
+ final chainId = _appKitModal.selectedChain?.chainId ?? '1';
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ chainId,
+ );
+ final address = _appKitModal.session!.getAddress(namespace)!;
return SIWESession(address: address, chains: [chainId]);
}
},
@@ -207,18 +207,56 @@ class _MyHomePageState extends State {
final siweAuthValue = prefs.getBool('appkit_siwe_auth') ?? true;
// See https://docs.reown.com/appkit/flutter/core/custom-chains
- final testNetworks = ReownAppKitModalNetworks.test['eip155'] ?? [];
- ReownAppKitModalNetworks.addNetworks('eip155', testNetworks);
+ // Add extra chains
+ // final extraChains = ReownAppKitModalNetworks.extra['eip155']!;
+ // ReownAppKitModalNetworks.addSupportedNetworks('eip155', extraChains);
+ // Remove every test network
+ // ReownAppKitModalNetworks.removeTestNetworks();
+ if (siweAuthValue) {
+ // Remove Solana support
+ ReownAppKitModalNetworks.removeSupportedNetworks('solana');
+ } else {
+ // Add custom chains
+ ReownAppKitModalNetworks.addSupportedNetworks('polkadot', [
+ ReownAppKitModalNetworkInfo(
+ name: 'Polkadot',
+ chainId: '91b171bb158e2d3848fa23a9f1c25182',
+ chainIcon: 'https://cryptologos.cc/logos/polkadot-new-dot-logo.png',
+ currency: 'DOT',
+ rpcUrl: 'https://rpc.polkadot.io',
+ explorerUrl: 'https://polkadot.subscan.io',
+ ),
+ ReownAppKitModalNetworkInfo(
+ name: 'Westend',
+ chainId: 'e143f23803ac50e8f6f8e62695d1ce9e',
+ currency: 'DOT',
+ rpcUrl: 'https://westend-rpc.polkadot.io',
+ explorerUrl: 'https://westend.subscan.io',
+ isTestNetwork: true,
+ ),
+ ]);
+ }
try {
_appKitModal = ReownAppKitModal(
context: context,
projectId: DartDefines.projectId,
- logLevel: LogLevel.error,
+ logLevel: LogLevel.all,
metadata: _pairingMetadata(),
siweConfig: _siweConfig(siweAuthValue),
enableAnalytics: analyticsValue, // OPTIONAL - null by default
- enableEmail: emailWalletValue, // OPTIONAL - false by default
+ featuresConfig: emailWalletValue
+ ? FeaturesConfig(
+ email: true,
+ socials: [
+ AppKitSocialOption.Farcaster,
+ AppKitSocialOption.X,
+ AppKitSocialOption.Apple,
+ AppKitSocialOption.Discord,
+ ],
+ // showMainWallets: false, // OPTIONAL - true by default
+ )
+ : null,
// requiredNamespaces: {},
// optionalNamespaces: {},
// includedWalletIds: {},
@@ -230,11 +268,51 @@ class _MyHomePageState extends State {
'c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a', // Uniswap
'38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662', // Bitget
},
- // excludedWalletIds: {
- // 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase
- // },
+ // excludedWalletIds: {},
// MORE WALLETS https://explorer.walletconnect.com/?type=wallet&chains=eip155%3A1
+ // getBalanceFallback: () async {
+ // // This method will be triggered if getting the balance from our blockchain API fails
+ // // You could place here your own getBalance method
+ // return 0.123;
+ // },
+ optionalNamespaces: siweAuthValue
+ ? null
+ : {
+ 'eip155': RequiredNamespace.fromJson({
+ 'chains': ReownAppKitModalNetworks.getAllSupportedNetworks(
+ namespace: 'eip155',
+ ).map((chain) => 'eip155:${chain.chainId}').toList(),
+ 'methods':
+ NetworkUtils.defaultNetworkMethods['eip155']!.toList(),
+ 'events':
+ NetworkUtils.defaultNetworkEvents['eip155']!.toList(),
+ }),
+ 'solana': RequiredNamespace.fromJson({
+ 'chains': ReownAppKitModalNetworks.getAllSupportedNetworks(
+ namespace: 'solana',
+ ).map((chain) => 'solana:${chain.chainId}').toList(),
+ 'methods':
+ NetworkUtils.defaultNetworkMethods['solana']!.toList(),
+ 'events': [],
+ }),
+ 'polkadot': RequiredNamespace.fromJson({
+ 'chains': [
+ 'polkadot:91b171bb158e2d3848fa23a9f1c25182',
+ 'polkadot:e143f23803ac50e8f6f8e62695d1ce9e'
+ ],
+ 'methods': [
+ 'polkadot_signMessage',
+ 'polkadot_signTransaction',
+ ],
+ 'events': []
+ }),
+ },
+ );
+ overlay = OverlayController(
+ const Duration(milliseconds: 200),
+ appKitModal: _appKitModal,
);
+ _toggleOverlay();
setState(() => _initialized = true);
} on ReownAppKitModalException catch (e) {
debugPrint('⛔️ ${e.message}');
@@ -260,25 +338,18 @@ class _MyHomePageState extends State {
_appKitModal.appKit!.core.relayClient.onRelayClientDisconnect.subscribe(
_onRelayClientDisconnect,
);
- _appKitModal.appKit!.core.addLogListener(_logListener);
//
await _appKitModal.init();
- setState(() {});
- }
- void _logListener(LogEvent event) {
- if (event.level == Level.debug || event.level == Level.error) {
- // TODO send to mixpanel
- log('${event.message}');
- } else {
- debugPrint('${event.message}');
- }
+ DeepLinkHandler.init(_appKitModal);
+ DeepLinkHandler.checkInitialLink();
+
+ setState(() {});
}
@override
void dispose() {
//
- _appKitModal.appKit!.core.removeLogListener(_logListener);
_appKitModal.appKit!.core.relayClient.onRelayClientConnect.unsubscribe(
_onRelayClientConnect,
);
@@ -304,7 +375,7 @@ class _MyHomePageState extends State {
void _onModalConnect(ModalConnect? event) async {
setState(() {});
- debugPrint('[ExampleApp] _onModalConnect ${event?.session.toJson()}');
+ log('[ExampleApp] _onModalConnect ${jsonEncode(event?.session.toJson())}');
}
void _onModalUpdate(ModalConnect? event) {
@@ -312,17 +383,17 @@ class _MyHomePageState extends State {
}
void _onModalNetworkChange(ModalNetworkChange? event) {
- debugPrint('[ExampleApp] _onModalNetworkChange ${event?.toString()}');
+ log('[ExampleApp] _onModalNetworkChange ${event?.toString()}');
setState(() {});
}
void _onModalDisconnect(ModalDisconnect? event) {
- debugPrint('[ExampleApp] _onModalDisconnect ${event?.toString()}');
+ log('[ExampleApp] _onModalDisconnect ${event?.toString()}');
setState(() {});
}
void _onModalError(ModalError? event) {
- debugPrint('[ExampleApp] _onModalError ${event?.toString()}');
+ log('[ExampleApp] _onModalError ${event?.toString()}');
// When user connected to Coinbase Wallet but Coinbase Wallet does not have a session anymore
// (for instance if user disconnected the dapp directly within Coinbase Wallet)
// Then Coinbase Wallet won't emit any event
@@ -352,7 +423,7 @@ class _MyHomePageState extends State {
showTextToast(text: 'Relay connected', context: context);
}
- void _onRelayClientError(EventArgs? event) {
+ void _onRelayClientError(ErrorEvent? event) {
setState(() {});
showTextToast(text: 'Relay disconnected', context: context);
}
@@ -367,6 +438,9 @@ class _MyHomePageState extends State {
@override
Widget build(BuildContext context) {
+ if (!_initialized) {
+ return SizedBox.shrink();
+ }
return Scaffold(
backgroundColor: ReownAppKitModalTheme.colorsOf(context).background125,
appBar: AppBar(
@@ -396,6 +470,7 @@ class _MyHomePageState extends State {
toggleOverlay: _toggleOverlay,
toggleBrightness: widget.toggleBrightness,
toggleTheme: widget.toggleTheme,
+ appKitModal: _appKitModal,
),
),
onEndDrawerChanged: (isOpen) {
@@ -483,7 +558,7 @@ class _ConnectedView extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppKitModalAccountButton(
- appKit: appKit,
+ appKitModal: appKit,
// custom: ValueListenableBuilder(
// valueListenable: appKit.balanceNotifier,
// builder: (_, balance, __) {
@@ -496,6 +571,20 @@ class _ConnectedView extends StatelessWidget {
// },
// ),
),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ AppKitModalBalanceButton(
+ appKitModal: appKit,
+ onTap: appKit.openNetworksView,
+ ),
+ const SizedBox.square(dimension: 8.0),
+ AppKitModalAddressButton(
+ appKitModal: appKit,
+ onTap: appKit.openModalView,
+ ),
+ ],
+ ),
SessionWidget(appKit: appKit),
const SizedBox.square(dimension: 12.0),
],
diff --git a/packages/reown_appkit/example/modal/lib/main.dart b/packages/reown_appkit/example/modal/lib/main.dart
index f4d292d..7142b46 100644
--- a/packages/reown_appkit/example/modal/lib/main.dart
+++ b/packages/reown_appkit/example/modal/lib/main.dart
@@ -1,10 +1,13 @@
import 'package:flutter/material.dart';
import 'package:reown_appkit_example/home_page.dart';
+import 'package:reown_appkit_example/services/deep_link_handler.dart';
import 'package:reown_appkit_example/utils/constants.dart';
import 'package:reown_appkit/reown_appkit.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() {
+ WidgetsFlutterBinding.ensureInitialized();
+ DeepLinkHandler.initListener();
runApp(const MyApp());
}
diff --git a/packages/reown_appkit/example/modal/lib/services/deep_link_handler.dart b/packages/reown_appkit/example/modal/lib/services/deep_link_handler.dart
new file mode 100644
index 0000000..afcc105
--- /dev/null
+++ b/packages/reown_appkit/example/modal/lib/services/deep_link_handler.dart
@@ -0,0 +1,60 @@
+import 'package:flutter/foundation.dart';
+import 'package:flutter/services.dart';
+import 'package:reown_appkit/modal/i_appkit_modal_impl.dart';
+
+class DeepLinkHandler {
+ static const _methodChannel = MethodChannel(
+ 'com.web3modal.flutterExample/methods',
+ );
+ static const _eventChannel = EventChannel(
+ 'com.web3modal.flutterExample/events',
+ );
+ static final waiting = ValueNotifier(false);
+ static late IReownAppKitModal _appKitModal;
+
+ static void initListener() {
+ if (kIsWeb) return;
+ try {
+ _eventChannel.receiveBroadcastStream().listen(
+ _onLink,
+ onError: _onError,
+ );
+ } catch (e) {
+ debugPrint('[SampleModal] initListener $e');
+ }
+ }
+
+ static void init(IReownAppKitModal appKitModal) {
+ if (kIsWeb) return;
+ _appKitModal = appKitModal;
+ }
+
+ static void checkInitialLink() async {
+ if (kIsWeb) return;
+ try {
+ _methodChannel.invokeMethod('initialLink');
+ } catch (e) {
+ debugPrint('[SampleModal] checkInitialLink $e');
+ }
+ }
+
+ static Uri get nativeUri =>
+ Uri.parse(_appKitModal.appKit!.metadata.redirect?.native ?? '');
+ static Uri get universalUri =>
+ Uri.parse(_appKitModal.appKit!.metadata.redirect?.universal ?? '');
+ static String get host => universalUri.host;
+
+ static void _onLink(dynamic link) async {
+ debugPrint('[SampleModal] _onLink $link');
+ if (link == null) return;
+ final handled = await _appKitModal.dispatchEnvelope(link);
+ if (!handled) {
+ debugPrint('[SampleModal] _onLink not handled by AppKit');
+ }
+ }
+
+ static void _onError(dynamic error) {
+ debugPrint('[SampleModal] _onError $error');
+ waiting.value = false;
+ }
+}
diff --git a/packages/reown_appkit/example/modal/lib/services/eip155_service.dart b/packages/reown_appkit/example/modal/lib/services/methods_service.dart
similarity index 57%
rename from packages/reown_appkit/example/modal/lib/services/eip155_service.dart
rename to packages/reown_appkit/example/modal/lib/services/methods_service.dart
index 4fd8c3b..2dab1fe 100644
--- a/packages/reown_appkit/example/modal/lib/services/eip155_service.dart
+++ b/packages/reown_appkit/example/modal/lib/services/methods_service.dart
@@ -5,11 +5,13 @@ import 'package:reown_appkit/reown_appkit.dart';
// ignore: depend_on_referenced_packages
import 'package:convert/convert.dart';
+// ignore: depend_on_referenced_packages
+import 'package:bs58/bs58.dart';
import 'package:reown_appkit_example/services/contracts/aave_contract.dart';
import 'package:reown_appkit_example/services/contracts/test_data.dart';
-enum EIP155UIMethods {
+enum SupportedMethods {
personalSign,
ethSendTransaction,
requestAccounts,
@@ -17,7 +19,8 @@ enum EIP155UIMethods {
ethSignTypedDataV3,
ethSignTypedDataV4,
ethSignTransaction,
- walletWatchAsset;
+ walletWatchAsset,
+ solanaSignMessage;
String get name {
switch (this) {
@@ -37,71 +40,76 @@ enum EIP155UIMethods {
return 'eth_signTransaction';
case walletWatchAsset:
return 'wallet_watchAsset';
+ case solanaSignMessage:
+ return 'solana_signMessage';
}
}
}
-class EIP155 {
- static EIP155UIMethods methodFromName(String name) {
+class MethodsService {
+ static SupportedMethods methodFromName(String name) {
switch (name) {
case 'personal_sign':
- return EIP155UIMethods.personalSign;
+ return SupportedMethods.personalSign;
case 'eth_signTypedData_v4':
- return EIP155UIMethods.ethSignTypedDataV4;
+ return SupportedMethods.ethSignTypedDataV4;
case 'eth_sendTransaction':
- return EIP155UIMethods.ethSendTransaction;
+ return SupportedMethods.ethSendTransaction;
case 'eth_requestAccounts':
- return EIP155UIMethods.requestAccounts;
+ return SupportedMethods.requestAccounts;
case 'eth_signTypedData_v3':
- return EIP155UIMethods.ethSignTypedDataV3;
+ return SupportedMethods.ethSignTypedDataV3;
case 'eth_signTypedData':
- return EIP155UIMethods.ethSignTypedData;
+ return SupportedMethods.ethSignTypedData;
case 'eth_signTransaction':
- return EIP155UIMethods.ethSignTransaction;
+ return SupportedMethods.ethSignTransaction;
case 'wallet_watchAsset':
- return EIP155UIMethods.walletWatchAsset;
+ return SupportedMethods.walletWatchAsset;
+ case 'solana_signMessage':
+ return SupportedMethods.solanaSignMessage;
default:
- throw Exception('Unrecognized method');
+ throw Exception('Method not implemented');
}
}
static Future callMethod({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
required String topic,
- required EIP155UIMethods method,
+ required String method,
required String chainId,
required String address,
}) {
- final cid = int.parse(chainId);
- switch (method) {
- case EIP155UIMethods.requestAccounts:
+ // final cid = int.parse(chainId);
+ final supportedMethod = MethodsService.methodFromName(method);
+ switch (supportedMethod) {
+ case SupportedMethods.requestAccounts:
return requestAccounts(
- appKit: appKit,
+ appKitModal: appKitModal,
);
- case EIP155UIMethods.personalSign:
+ case SupportedMethods.personalSign:
return personalSign(
- appKit: appKit,
+ appKitModal: appKitModal,
message: testSignData,
);
- case EIP155UIMethods.ethSignTypedDataV3:
+ case SupportedMethods.ethSignTypedDataV3:
return ethSignTypedDataV3(
- appKit: appKit,
- data: jsonEncode(typeDataV3(cid)),
+ appKitModal: appKitModal,
+ data: jsonEncode(typeDataV3(int.parse(chainId))),
);
- case EIP155UIMethods.ethSignTypedData:
+ case SupportedMethods.ethSignTypedData:
return ethSignTypedData(
- appKit: appKit,
+ appKitModal: appKitModal,
data: jsonEncode(typedData()),
);
- case EIP155UIMethods.ethSignTypedDataV4:
+ case SupportedMethods.ethSignTypedDataV4:
return ethSignTypedDataV4(
- appKit: appKit,
- data: jsonEncode(typeDataV4(cid)),
+ appKitModal: appKitModal,
+ data: jsonEncode(typeDataV4(int.parse(chainId))),
);
- case EIP155UIMethods.ethSignTransaction:
- case EIP155UIMethods.ethSendTransaction:
+ case SupportedMethods.ethSignTransaction:
+ case SupportedMethods.ethSendTransaction:
return ethSendOrSignTransaction(
- appKit: appKit,
+ appKitModal: appKitModal,
method: method,
transaction: Transaction(
from: EthereumAddress.fromHex(address),
@@ -112,107 +120,145 @@ class EIP155 {
data: utf8.encode('0x'), // to make it work with some wallets
),
);
- case EIP155UIMethods.walletWatchAsset:
+ case SupportedMethods.walletWatchAsset:
return walletWatchAsset(
- appKit: appKit,
+ appKitModal: appKitModal,
+ );
+ case SupportedMethods.solanaSignMessage:
+ return solanaSignMessage(
+ appKitModal: appKitModal,
+ message: testSignData,
);
}
}
static Future requestAccounts({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
}) async {
- return await appKit.request(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ return await appKitModal.request(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
request: SessionRequestParams(
- method: EIP155UIMethods.requestAccounts.name,
+ method: SupportedMethods.requestAccounts.name,
params: [],
),
);
}
static Future personalSign({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
required String message,
}) async {
final bytes = utf8.encode(message);
final encoded = hex.encode(bytes);
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ appKitModal.selectedChain!.chainId,
+ );
- return await appKit.request(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ return await appKitModal.request(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
request: SessionRequestParams(
- method: EIP155UIMethods.personalSign.name,
+ method: SupportedMethods.personalSign.name,
params: [
'0x$encoded',
- appKit.session!.address!,
+ appKitModal.session!.getAddress(namespace)!,
],
),
);
}
+ static Future solanaSignMessage({
+ required ReownAppKitModal appKitModal,
+ required String message,
+ }) async {
+ final bytes = utf8.encode(testSignData);
+ final message = base58.encode(bytes);
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ appKitModal.selectedChain!.chainId,
+ );
+ final address = appKitModal.session!.getAddress(namespace)!;
+
+ return await appKitModal.request(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
+ request: SessionRequestParams(
+ method: SupportedMethods.solanaSignMessage.name,
+ params: {'pubkey': address, 'message': message},
+ ),
+ );
+ }
+
static Future ethSignTypedData({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
required String data,
}) async {
- return await appKit.request(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ appKitModal.selectedChain!.chainId,
+ );
+ return await appKitModal.request(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
request: SessionRequestParams(
- method: EIP155UIMethods.ethSignTypedData.name,
+ method: SupportedMethods.ethSignTypedData.name,
params: [
data,
- appKit.session!.address!,
+ appKitModal.session!.getAddress(namespace)!,
],
),
);
}
static Future ethSignTypedDataV3({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
required String data,
}) async {
- return await appKit.request(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ appKitModal.selectedChain!.chainId,
+ );
+ return await appKitModal.request(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
request: SessionRequestParams(
- method: EIP155UIMethods.ethSignTypedDataV3.name,
+ method: SupportedMethods.ethSignTypedDataV3.name,
params: [
data,
- appKit.session!.address!,
+ appKitModal.session!.getAddress(namespace)!,
],
),
);
}
static Future ethSignTypedDataV4({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
required String data,
}) async {
- return await appKit.request(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ appKitModal.selectedChain!.chainId,
+ );
+ return await appKitModal.request(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
request: SessionRequestParams(
- method: EIP155UIMethods.ethSignTypedDataV4.name,
+ method: SupportedMethods.ethSignTypedDataV4.name,
params: [
data,
- appKit.session!.address!,
+ appKitModal.session!.getAddress(namespace)!,
],
),
);
}
static Future ethSendOrSignTransaction({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
required Transaction transaction,
- required EIP155UIMethods method,
+ required String method,
}) async {
- return await appKit.request(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ return await appKitModal.request(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
request: SessionRequestParams(
- method: method.name,
+ method: method,
params: [
transaction.toJson(),
],
@@ -221,13 +267,13 @@ class EIP155 {
}
static Future walletWatchAsset({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
}) async {
- return await appKit.request(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ return await appKitModal.request(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
request: SessionRequestParams(
- method: EIP155UIMethods.walletWatchAsset.name,
+ method: SupportedMethods.walletWatchAsset.name,
params: {
'type': 'ERC20',
'options': {
@@ -244,7 +290,7 @@ class EIP155 {
// Example of calling `transfer` function from AAVE token Smart Contract
static Future callTestSmartContract({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
required String action,
}) async {
// Create DeployedContract object using contract's ABI and address
@@ -259,7 +305,7 @@ class EIP155 {
switch (action) {
case 'read':
return _readSmartContract(
- appKit: appKit,
+ appKitModal: appKitModal,
contract: deployedContract,
);
case 'write':
@@ -276,22 +322,27 @@ 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 appKit.requestReadContract(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ final decimals = await appKitModal.requestReadContract(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
deployedContract: deployedContract,
functionName: 'decimals',
);
final d = (decimals.first as BigInt);
final requestValue = _formatValue(0.01, decimals: d);
// now we call `transfer` write function with the parsed value.
- return appKit.requestWriteContract(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ appKitModal.selectedChain!.chainId,
+ );
+ return appKitModal.requestWriteContract(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
deployedContract: deployedContract,
functionName: 'transfer',
transaction: Transaction(
- from: EthereumAddress.fromHex(appKit.session!.address!),
+ from: EthereumAddress.fromHex(
+ appKitModal.session!.getAddress(namespace)!,
+ ),
),
parameters: [
EthereumAddress.fromHex(
@@ -327,7 +378,7 @@ class EIP155 {
// Example of calling `transfer` function from USDT token Smart Contract
static Future callUSDTSmartContract({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
required String action,
}) async {
// Create DeployedContract object using contract's ABI and address
@@ -342,28 +393,33 @@ class EIP155 {
switch (action) {
case 'read':
return _readSmartContract(
- appKit: appKit,
+ appKitModal: appKitModal,
contract: deployedContract,
);
case 'write':
// 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 appKit.requestReadContract(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ final decimals = await appKitModal.requestReadContract(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
deployedContract: deployedContract,
functionName: 'decimals',
);
final d = (decimals.first as BigInt);
final requestValue = _formatValue(0.23, decimals: d);
// now we call `transfer` write function with the parsed value.
- return appKit.requestWriteContract(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ appKitModal.selectedChain!.chainId,
+ );
+ return appKitModal.requestWriteContract(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
deployedContract: deployedContract,
functionName: 'transfer',
transaction: Transaction(
- from: EthereumAddress.fromHex(appKit.session!.address!),
+ from: EthereumAddress.fromHex(
+ appKitModal.session!.getAddress(namespace)!,
+ ),
),
parameters: [
EthereumAddress.fromHex(
@@ -378,38 +434,41 @@ class EIP155 {
}
static Future _readSmartContract({
- required ReownAppKitModal appKit,
+ required ReownAppKitModal appKitModal,
required DeployedContract contract,
}) async {
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ appKitModal.selectedChain!.chainId,
+ );
final results = await Future.wait([
// results[0]
- appKit.requestReadContract(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ appKitModal.requestReadContract(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
deployedContract: contract,
functionName: 'name',
),
// results[1]
- appKit.requestReadContract(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ appKitModal.requestReadContract(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
deployedContract: contract,
functionName: 'totalSupply',
),
// results[2]
- appKit.requestReadContract(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ appKitModal.requestReadContract(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
deployedContract: contract,
functionName: 'balanceOf',
parameters: [
- EthereumAddress.fromHex(appKit.session!.address!),
+ EthereumAddress.fromHex(appKitModal.session!.getAddress(namespace)!),
],
),
// results[4]
- appKit.requestReadContract(
- topic: appKit.session!.topic,
- chainId: appKit.selectedChain!.chainId,
+ appKitModal.requestReadContract(
+ topic: appKitModal.session!.topic,
+ chainId: appKitModal.selectedChain!.chainId,
deployedContract: contract,
functionName: 'decimals',
),
diff --git a/packages/reown_appkit/example/modal/lib/widgets/debug_drawer.dart b/packages/reown_appkit/example/modal/lib/widgets/debug_drawer.dart
index 4cc98f1..c74f71a 100644
--- a/packages/reown_appkit/example/modal/lib/widgets/debug_drawer.dart
+++ b/packages/reown_appkit/example/modal/lib/widgets/debug_drawer.dart
@@ -1,24 +1,32 @@
+// ignore_for_file: depend_on_referenced_packages
+
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-// ignore: depend_on_referenced_packages
+
import 'package:package_info_plus/package_info_plus.dart';
import 'package:shared_preferences/shared_preferences.dart';
-import 'package:reown_appkit/version.dart' as apkt;
import 'package:reown_appkit/reown_appkit.dart';
+import 'package:reown_appkit/version.dart' as apkt_v;
+
+import 'package:reown_sign/version.dart' as sign_v;
+import 'package:reown_core/version.dart' as core_v;
+
class DebugDrawer extends StatefulWidget {
const DebugDrawer({
super.key,
required this.toggleOverlay,
required this.toggleBrightness,
required this.toggleTheme,
+ required this.appKitModal,
});
final VoidCallback toggleOverlay;
final VoidCallback toggleBrightness;
final VoidCallback toggleTheme;
+ final ReownAppKitModal appKitModal;
@override
State createState() => _DebugDrawerState();
@@ -174,7 +182,7 @@ class _DebugDrawerState extends State with WidgetsBindingObserver {
color:
ReownAppKitModalTheme.colorsOf(context).foreground100,
),
- title: const Text('Analytics On'),
+ title: const Text('Analytics'),
titleTextStyle: TextStyle(
color:
ReownAppKitModalTheme.colorsOf(context).foreground100,
@@ -195,7 +203,7 @@ class _DebugDrawerState extends State with WidgetsBindingObserver {
color:
ReownAppKitModalTheme.colorsOf(context).foreground100,
),
- title: const Text('Email Wallet On'),
+ title: const Text('Email & Socials'),
titleTextStyle: TextStyle(
color:
ReownAppKitModalTheme.colorsOf(context).foreground100,
@@ -216,7 +224,7 @@ class _DebugDrawerState extends State with WidgetsBindingObserver {
color:
ReownAppKitModalTheme.colorsOf(context).foreground100,
),
- title: const Text('1-CA + SIWE On'),
+ title: const Text('1-CA + SIWE'),
titleTextStyle: TextStyle(
color:
ReownAppKitModalTheme.colorsOf(context).foreground100,
@@ -234,32 +242,105 @@ class _DebugDrawerState extends State with WidgetsBindingObserver {
],
),
),
- FutureBuilder(
- future: PackageInfo.fromPlatform(),
- builder: (context, snapshot) {
- return InkWell(
- onTap: () {
- Clipboard.setData(
- ClipboardData(
- text:
- '${snapshot.data?.packageName} v${snapshot.data?.version ?? ''} (${snapshot.data?.buildNumber})\n'
- 'AppKit v${apkt.packageVersion}\n'
- 'Core v$packageVersion',
- ),
- );
- },
- child: Text(
- '${snapshot.data?.packageName} v${snapshot.data?.version ?? ''} (${snapshot.data?.buildNumber})\n'
- 'AppKit v${apkt.packageVersion}\n'
- 'Core v$packageVersion',
+ const SizedBox(height: 16.0),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 12.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const Text(
+ 'Redirect:',
+ textAlign: TextAlign.left,
style: TextStyle(
fontSize: 12.0,
- color:
- ReownAppKitModalTheme.colorsOf(context).foreground100,
+ fontWeight: FontWeight.bold,
),
),
- );
- },
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const Text(
+ 'Native: ',
+ style: TextStyle(fontSize: 12.0),
+ ),
+ Expanded(
+ child: Text(
+ '${widget.appKitModal.appKit!.metadata.redirect?.native}',
+ style: TextStyle(
+ fontSize: 12.0,
+ fontWeight: FontWeight.bold,
+ color: ReownAppKitModalTheme.colorsOf(context)
+ .foreground100,
+ ),
+ ),
+ ),
+ ],
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const Text(
+ 'Universal: ',
+ style: TextStyle(fontSize: 12.0),
+ ),
+ Expanded(
+ child: Text(
+ '${widget.appKitModal.appKit!.metadata.redirect?.universal}',
+ style: TextStyle(
+ fontSize: 12.0,
+ fontWeight: FontWeight.bold,
+ color: ReownAppKitModalTheme.colorsOf(context)
+ .foreground100,
+ ),
+ ),
+ ),
+ ],
+ ),
+ Row(
+ children: [
+ const Text(
+ 'Link Mode: ',
+ style: TextStyle(fontSize: 12.0),
+ ),
+ Text(
+ '${widget.appKitModal.appKit!.metadata.redirect?.linkMode}',
+ style: TextStyle(
+ fontSize: 12.0,
+ fontWeight: FontWeight.bold,
+ color: ReownAppKitModalTheme.colorsOf(context)
+ .foreground100,
+ ),
+ ),
+ ],
+ ),
+ const Divider(height: 10.0),
+ FutureBuilder(
+ future: PackageInfo.fromPlatform(),
+ builder: (context, snapshot) {
+ final versionText =
+ '${snapshot.data?.packageName} v${snapshot.data?.version ?? ''} (${snapshot.data?.buildNumber})\n'
+ 'AppKit v${apkt_v.packageVersion}\n'
+ 'Sign v${sign_v.packageVersion}\n'
+ 'Core v${core_v.packageVersion}';
+ return InkWell(
+ onTap: () => Clipboard.setData(ClipboardData(
+ text: versionText,
+ )),
+ child: Text(
+ versionText,
+ style: TextStyle(
+ fontSize: 12.0,
+ color: ReownAppKitModalTheme.colorsOf(context)
+ .foreground100,
+ ),
+ ),
+ );
+ },
+ ),
+ ],
+ ),
),
const SizedBox.square(dimension: 10.0),
const Divider(height: 1.0, indent: 12.0, endIndent: 12.0),
diff --git a/packages/reown_appkit/example/modal/lib/widgets/logger_widget.dart b/packages/reown_appkit/example/modal/lib/widgets/logger_widget.dart
index 8bb0855..cdbd8f5 100644
--- a/packages/reown_appkit/example/modal/lib/widgets/logger_widget.dart
+++ b/packages/reown_appkit/example/modal/lib/widgets/logger_widget.dart
@@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
-import 'package:reown_appkit/modal/services/analytics_service/analytics_service_singleton.dart';
+import 'package:reown_appkit/reown_appkit.dart';
class DraggableCard extends StatefulWidget {
final OverlayController overlayController;
+ //
const DraggableCard({
super.key,
required this.overlayController,
@@ -19,14 +20,20 @@ class _DraggableCardState extends State {
@override
void initState() {
super.initState();
- analyticsService.instance.events.listen(_eventsListener);
+ widget.overlayController.appKitModal.appKit!.core.addLogListener(
+ _eventsListener,
+ );
}
- void _eventsListener(event) {
+ void _eventsListener(String event) {
if (!mounted) return;
+ if (!event.toString().contains('[AnalyticsService]')) return;
+ String message = event.replaceAll('[AnalyticsService] ', '');
+ message = message.replaceAll('send event 202: ', '');
+ message = message.replaceAll('info: ', '');
_logs.add(
Text(
- '=> $event',
+ '=> $message',
style: const TextStyle(
color: Colors.white,
fontSize: 12.0,
@@ -38,6 +45,9 @@ class _DraggableCardState extends State {
@override
void dispose() {
+ widget.overlayController.appKitModal.appKit!.core.removeLogListener(
+ _eventsListener,
+ );
widget.overlayController.remove();
super.dispose();
}
@@ -55,12 +65,12 @@ class _DraggableCardState extends State {
children: [
SizedBox(
width: MediaQuery.of(context).size.width,
- height: 200.0,
+ height: 300.0,
child: Row(
children: [
Expanded(
child: SizedBox(
- height: 200.0,
+ height: 300.0,
child: ListView(
reverse: true,
padding: const EdgeInsets.all(6.0),
@@ -99,7 +109,11 @@ class _DraggableCardState extends State {
}
class OverlayController extends AnimatedOverlay {
- OverlayController(super.duration);
+ OverlayController(
+ super.duration, {
+ required this.appKitModal,
+ });
+ final ReownAppKitModal appKitModal;
OverlayEntry? _entry;
final _defaultAlign = const Alignment(0.0, -30.0);
Alignment align = const Alignment(0.0, -30.0);
diff --git a/packages/reown_appkit/example/modal/lib/widgets/session_widget.dart b/packages/reown_appkit/example/modal/lib/widgets/session_widget.dart
index ed8fb45..c1b5a4d 100644
--- a/packages/reown_appkit/example/modal/lib/widgets/session_widget.dart
+++ b/packages/reown_appkit/example/modal/lib/widgets/session_widget.dart
@@ -3,13 +3,14 @@ import 'dart:convert';
import 'package:fl_toast/fl_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:reown_appkit/modal/utils/core_utils.dart';
import 'package:reown_appkit_example/utils/styles.dart';
import 'package:reown_appkit/reown_appkit.dart';
import 'package:reown_appkit_example/utils/constants.dart';
-import 'package:reown_appkit_example/services/eip155_service.dart';
+import 'package:reown_appkit_example/services/methods_service.dart';
import 'package:reown_appkit_example/widgets/method_dialog.dart';
class SessionWidget extends StatefulWidget {
@@ -38,7 +39,12 @@ class SessionWidgetState extends State {
children: [
CircleAvatar(
radius: 18.0,
- backgroundImage: NetworkImage(iconImage),
+ backgroundImage: NetworkImage(
+ iconImage,
+ headers: CoreUtils.getAPIHeaders(
+ widget.appKit.appKit!.core.projectId,
+ ),
+ ),
),
const SizedBox(width: 8.0),
],
@@ -102,15 +108,17 @@ class SessionWidgetState extends State {
),
),
Column(
- children: _buildSupportedChainsWidget(),
+ children: _buildSupportedChainsWidget(
+ widget.appKit.selectedChain!.chainId,
+ ),
),
const SizedBox(height: StyleConstants.linear8),
];
// Get current active account
- final accounts = session.getAccounts() ?? [];
final chainId = widget.appKit.selectedChain?.chainId ?? '';
final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(chainId);
+ final accounts = session.getAccounts(namespace: namespace) ?? [];
final chainsNamespaces = NamespaceUtils.getChainsFromAccounts(accounts);
if (chainsNamespaces.contains('$namespace:$chainId')) {
final account = accounts.firstWhere(
@@ -165,7 +173,7 @@ class SessionWidgetState extends State {
}
Widget _buildAccountWidget(String account) {
- // final chainId = NamespaceUtils.getChainFromAccount(account);
+ final chainId = NamespaceUtils.getChainFromAccount(account);
// final chainMetadata = ChainDataWrapper.getChainMetadataFromChain(
// chainId.split(':').first,
// chainId.split(':').last,
@@ -173,7 +181,6 @@ class SessionWidgetState extends State {
final List children = [
Text(
- // chainMetadata.appKitNetworkInfo.name,
widget.appKit.selectedChain?.name ?? 'Unsupported chain',
style: ReownAppKitModalTheme.getDataOf(context)
.textStyles
@@ -220,7 +227,7 @@ class SessionWidgetState extends State {
),
),
]);
- children.add(_buildChainEventsTiles());
+ children.add(_buildChainEventsTiles(chainId));
return Container(
padding: const EdgeInsets.all(StyleConstants.linear8),
@@ -239,12 +246,14 @@ class SessionWidgetState extends State {
);
}
- List _buildChainMethodButtons(
- String address,
- ) {
+ List _buildChainMethodButtons(String address) {
// Add Methods
- final approvedMethods = widget.appKit.getApprovedMethods() ?? [];
- if (approvedMethods.isEmpty) {
+ final chainId = NamespaceUtils.getChainFromAccount(address);
+ final namespace = NamespaceUtils.getNamespaceFromChain(chainId);
+ final approvedMethods = widget.appKit.getApprovedMethods(
+ namespace: namespace,
+ );
+ if ((approvedMethods ?? []).isEmpty) {
return [
Text(
'No methods approved',
@@ -257,10 +266,10 @@ class SessionWidgetState extends State {
)
];
}
- final usableMethods = EIP155UIMethods.values.map((e) => e.name).toList();
+ final usableMethods = SupportedMethods.values.map((e) => e.name).toList();
//
final List children = [];
- for (final method in approvedMethods) {
+ for (final method in (approvedMethods ?? [])) {
final implemented = usableMethods.contains(method);
children.add(
Container(
@@ -271,12 +280,7 @@ class SessionWidgetState extends State {
onPressed: implemented
? () async {
widget.appKit.launchConnectedWallet();
- final future = callChainMethod(
- // chainMetadata.type,
- EIP155.methodFromName(method)
- // chainMetadata,
- // address,
- );
+ final future = callChainMethod(method);
MethodDialog.show(context, method, future);
}
: null,
@@ -287,6 +291,16 @@ class SessionWidgetState extends State {
);
}
+ if (namespace == 'eip155') {
+ children.addAll(_addSmartContractButtons());
+ }
+
+ return children;
+ }
+
+ List _addSmartContractButtons() {
+ final List children = [];
+
children.add(const Divider());
final onSepolia = widget.appKit.selectedChain?.chainId == '11155111';
if (!onSepolia) {
@@ -314,8 +328,8 @@ class SessionWidgetState extends State {
child: ElevatedButton(
onPressed: onSepolia
? () async {
- final future = EIP155.callTestSmartContract(
- appKit: widget.appKit,
+ final future = MethodsService.callTestSmartContract(
+ appKitModal: widget.appKit,
action: 'read',
);
MethodDialog.show(
@@ -326,8 +340,8 @@ class SessionWidgetState extends State {
}
: onMainnet
? () async {
- final future = EIP155.callUSDTSmartContract(
- appKit: widget.appKit,
+ final future = MethodsService.callUSDTSmartContract(
+ appKitModal: widget.appKit,
action: 'read',
);
MethodDialog.show(
@@ -351,8 +365,8 @@ class SessionWidgetState extends State {
onPressed: onSepolia
? () async {
widget.appKit.launchConnectedWallet();
- final future = EIP155.callTestSmartContract(
- appKit: widget.appKit,
+ final future = MethodsService.callTestSmartContract(
+ appKitModal: widget.appKit,
action: 'write',
);
MethodDialog.show(context, 'Test Contract (Write)', future);
@@ -360,8 +374,8 @@ class SessionWidgetState extends State {
: onMainnet
? () async {
widget.appKit.launchConnectedWallet();
- final future = EIP155.callUSDTSmartContract(
- appKit: widget.appKit,
+ final future = MethodsService.callUSDTSmartContract(
+ appKitModal: widget.appKit,
action: 'write',
);
MethodDialog.show(
@@ -379,7 +393,7 @@ class SessionWidgetState extends State {
return children;
}
- List _buildSupportedChainsWidget() {
+ List _buildSupportedChainsWidget(String chainId) {
List children = [];
children.addAll(
[
@@ -395,10 +409,11 @@ class SessionWidgetState extends State {
),
],
);
- final approvedChains = widget.appKit.getApprovedChains() ?? [];
+ final ns = ReownAppKitModalNetworks.getNamespaceForChainId(chainId);
+ final approvedChains = widget.appKit.getApprovedChains(namespace: ns);
children.add(
Text(
- approvedChains.join(', '),
+ (approvedChains ?? []).join(', '),
style: ReownAppKitModalTheme.getDataOf(context)
.textStyles
.small400
@@ -410,10 +425,13 @@ class SessionWidgetState extends State {
return children;
}
- Widget _buildChainEventsTiles() {
+ Widget _buildChainEventsTiles(String chainId) {
// Add Events
- final approvedEvents = widget.appKit.getApprovedEvents() ?? [];
- if (approvedEvents.isEmpty) {
+ final namespace = NamespaceUtils.getNamespaceFromChain(chainId);
+ final approvedEvents = widget.appKit.getApprovedEvents(
+ namespace: namespace,
+ );
+ if ((approvedEvents ?? []).isEmpty) {
return Text(
'No events approved',
style: ReownAppKitModalTheme.getDataOf(context)
@@ -425,7 +443,7 @@ class SessionWidgetState extends State {
);
}
final List children = [];
- for (final event in approvedEvents) {
+ for (final event in (approvedEvents ?? [])) {
children.add(
Container(
margin: const EdgeInsets.symmetric(
@@ -457,19 +475,17 @@ class SessionWidgetState extends State {
);
}
- Future callChainMethod(
- // ChainType type,
- EIP155UIMethods method,
- // ChainMetadata chainMetadata,
- // String address,
- ) {
+ Future callChainMethod(String method) {
final session = widget.appKit.session!;
- return EIP155.callMethod(
- appKit: widget.appKit,
+ final chainId = widget.appKit.selectedChain!.chainId;
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(chainId);
+ final address = session.getAddress(namespace)!;
+ return MethodsService.callMethod(
+ appKitModal: widget.appKit,
topic: session.topic ?? '',
method: method,
chainId: widget.appKit.selectedChain!.chainId,
- address: session.address!,
+ address: address,
);
}
}
diff --git a/packages/reown_appkit/generate_files.sh b/packages/reown_appkit/generate_files.sh
index aa02878..b1b0287 100644
--- a/packages/reown_appkit/generate_files.sh
+++ b/packages/reown_appkit/generate_files.sh
@@ -20,8 +20,9 @@ dart run dependency_validator
cd ios
-pod deintegrate
-pod cache clean -all
+# rm Podfile.lock
+# pod deintegrate
+# pod cache clean -all
pod install
cd ..
@@ -42,8 +43,9 @@ dart run dependency_validator
cd ios
-pod deintegrate
-pod cache clean -all
+# rm Podfile.lock
+# pod deintegrate
+# pod cache clean -all
pod install
cd ..
diff --git a/packages/reown_appkit/lib/appkit_modal.dart b/packages/reown_appkit/lib/appkit_modal.dart
index 04bc671..a58eeb6 100644
--- a/packages/reown_appkit/lib/appkit_modal.dart
+++ b/packages/reown_appkit/lib/appkit_modal.dart
@@ -5,20 +5,20 @@
// platforms in the `pubspec.yaml` at
// https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms.
-/// Models
+// Models
export 'modal/models/public/appkit_modal_models.dart';
-/// Theme
+// Theme
export 'modal/theme/public/appkit_modal_theme.dart';
/// Utils
-export 'modal/utils/public/appkit_modal_utils.dart';
+export 'modal/utils/public/appkit_modal_networks_utils.dart';
-/// Widgets
+// Widgets
export 'modal/widgets/public/appkit_modal_widgets.dart';
-/// Pages
+// Pages
export 'modal/pages/public/appkit_modal_pages.dart';
-/// Services
+// Services
export 'modal/appkit_modal_impl.dart';
diff --git a/packages/reown_appkit/lib/base/appkit_base_impl.dart b/packages/reown_appkit/lib/base/appkit_base_impl.dart
index bc82c2e..a4ce1ec 100644
--- a/packages/reown_appkit/lib/base/appkit_base_impl.dart
+++ b/packages/reown_appkit/lib/base/appkit_base_impl.dart
@@ -3,19 +3,23 @@ import 'package:reown_core/relay_client/websocket/http_client.dart';
import 'package:reown_core/store/generic_store.dart';
import 'package:reown_core/store/i_generic_store.dart';
+/// Base class that containes Core and SIgn used dapps developers to create UI-less interaction with WalletConnect protocol
class ReownAppKit implements IReownAppKit {
+ ///
static const List> DEFAULT_METHODS = [
[
MethodConstants.WC_SESSION_PROPOSE,
MethodConstants.WC_SESSION_REQUEST,
],
// [
+ // // Deprecated method but still supported for retrocompatibility
// MethodConstants.WC_AUTH_REQUEST,
// ]
];
bool _initialized = false;
+ /// Creates a instance of ReownAppKit to be used alone or to pass to ReownAppKitModal
static Future createInstance({
required String projectId,
String relayUrl = ReownConstants.DEFAULT_RELAY_URL,
@@ -53,6 +57,7 @@ class ReownAppKit implements IReownAppKit {
@override
final PairingMetadata metadata;
+ ///
ReownAppKit({
required this.core,
required this.metadata,
diff --git a/packages/reown_appkit/lib/base/i_appkit_base_impl.dart b/packages/reown_appkit/lib/base/i_appkit_base_impl.dart
index 929e00a..9bfb963 100644
--- a/packages/reown_appkit/lib/base/i_appkit_base_impl.dart
+++ b/packages/reown_appkit/lib/base/i_appkit_base_impl.dart
@@ -1,9 +1,14 @@
import 'package:reown_sign/i_sign_dapp.dart';
import 'package:reown_sign/reown_sign.dart';
+///
abstract class IReownAppKit implements IReownSignDapp {
+ ///
final String protocol = 'wc';
+
+ ///
final int version = 2;
+ ///
abstract final IReownSign reOwnSign;
}
diff --git a/packages/reown_appkit/lib/modal/appkit_modal_impl.dart b/packages/reown_appkit/lib/modal/appkit_modal_impl.dart
index 32b6fbb..eb4f700 100644
--- a/packages/reown_appkit/lib/modal/appkit_modal_impl.dart
+++ b/packages/reown_appkit/lib/modal/appkit_modal_impl.dart
@@ -1,50 +1,50 @@
import 'dart:async';
import 'dart:convert';
import 'dart:math';
-import 'dart:developer' as dev;
-import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:get_it/get_it.dart';
+import 'package:reown_appkit/modal/services/analytics_service/i_analytics_service.dart';
+import 'package:reown_appkit/modal/services/explorer_service/i_explorer_service.dart';
+import 'package:reown_appkit/modal/services/network_service/i_network_service.dart';
+import 'package:reown_appkit/modal/services/siwe_service/i_siwe_service.dart';
+import 'package:reown_appkit/modal/services/toast_service/i_toast_service.dart';
+import 'package:reown_appkit/modal/services/toast_service/toast_service.dart';
+import 'package:reown_appkit/modal/services/uri_service/i_url_utils.dart';
+
+import 'package:reown_core/store/i_store.dart';
+import 'package:reown_appkit/reown_appkit.dart';
+import 'package:reown_appkit/modal/services/blockchain_service/i_blockchain_service.dart';
+import 'package:reown_appkit/modal/services/magic_service/i_magic_service.dart';
+import 'package:reown_appkit/modal/services/toast_service/models/toast_message.dart';
+import 'package:reown_appkit/modal/services/network_service/network_service.dart';
import 'package:reown_appkit/modal/services/uri_service/launch_url_exception.dart';
import 'package:reown_appkit/modal/services/uri_service/url_utils.dart';
-import 'package:reown_appkit/modal/services/uri_service/url_utils_singleton.dart';
import 'package:reown_appkit/modal/utils/core_utils.dart';
import 'package:reown_appkit/modal/utils/platform_utils.dart';
-import 'package:reown_appkit/reown_appkit.dart';
-import 'package:reown_core/store/i_store.dart';
-import 'package:url_launcher/url_launcher.dart';
import 'package:reown_appkit/modal/constants/key_constants.dart';
-
import 'package:reown_appkit/modal/constants/string_constants.dart';
import 'package:reown_appkit/modal/pages/account_page.dart';
import 'package:reown_appkit/modal/pages/approve_magic_request_page.dart';
import 'package:reown_appkit/modal/pages/approve_siwe.dart';
import 'package:reown_appkit/modal/services/analytics_service/analytics_service.dart';
-import 'package:reown_appkit/modal/services/analytics_service/analytics_service_singleton.dart';
import 'package:reown_appkit/modal/services/analytics_service/models/analytics_event.dart';
import 'package:reown_appkit/modal/services/coinbase_service/coinbase_service.dart';
-import 'package:reown_appkit/modal/services/coinbase_service/coinbase_service_singleton.dart';
import 'package:reown_appkit/modal/services/coinbase_service/i_coinbase_service.dart';
import 'package:reown_appkit/modal/services/coinbase_service/models/coinbase_data.dart';
import 'package:reown_appkit/modal/services/coinbase_service/models/coinbase_events.dart';
import 'package:reown_appkit/modal/services/explorer_service/explorer_service.dart';
-import 'package:reown_appkit/modal/services/explorer_service/explorer_service_singleton.dart';
import 'package:reown_appkit/modal/services/explorer_service/models/redirect.dart';
import 'package:reown_appkit/modal/services/magic_service/magic_service.dart';
-import 'package:reown_appkit/modal/services/magic_service/magic_service_singleton.dart';
import 'package:reown_appkit/modal/services/magic_service/models/magic_data.dart';
import 'package:reown_appkit/modal/services/magic_service/models/magic_events.dart';
import 'package:reown_appkit/modal/services/siwe_service/siwe_service.dart';
-import 'package:reown_appkit/modal/services/siwe_service/siwe_service_singleton.dart';
import 'package:reown_appkit/modal/widgets/widget_stack/widget_stack_singleton.dart';
import 'package:reown_appkit/modal/services/blockchain_service/blockchain_service.dart';
-import 'package:reown_appkit/modal/services/blockchain_service/blockchain_service_singleton.dart';
-import 'package:reown_appkit/modal/services/network_service/network_service_singleton.dart';
import 'package:reown_appkit/modal/i_appkit_modal_impl.dart';
import 'package:reown_appkit/modal/widgets/modal_container.dart';
import 'package:reown_appkit/modal/widgets/modal_provider.dart';
-import 'package:reown_appkit/modal/services/toast_service/toast_service_singleton.dart';
/// Either a [projectId] and [metadata] must be provided or an already created [appKit].
/// optionalNamespaces is mostly not needed, if you use it, the values set here will override every optionalNamespaces set in evey chain
@@ -55,6 +55,7 @@ class ReownAppKitModal with ChangeNotifier implements IReownAppKitModal {
Map _optionalNamespaces = {};
String? _lastChainEmitted;
bool _supportsOneClickAuth = false;
+ bool _relayConnected = false;
ReownAppKitModalStatus _status = ReownAppKitModalStatus.idle;
@override
@@ -64,8 +65,11 @@ class ReownAppKitModal with ChangeNotifier implements IReownAppKitModal {
@override
ReownAppKitModalNetworkInfo? get selectedChain {
if (_currentSelectedChainId != null) {
+ final namespace = ReownAppKitModalNetworks.getNamespaceForChainId(
+ _currentSelectedChainId!,
+ );
return ReownAppKitModalNetworks.getNetworkById(
- CoreConstants.namespace,
+ namespace,
_currentSelectedChainId!,
);
}
@@ -93,10 +97,9 @@ class ReownAppKitModal with ChangeNotifier implements IReownAppKitModal {
String? get avatarUrl => _avatarUrl;
double? _chainBalance;
+ @Deprecated('Use balanceNotifier')
@override
- String get chainBalance {
- return CoreUtils.formatChainBalance(_chainBalance);
- }
+ String get chainBalance => CoreUtils.formatChainBalance(_chainBalance);
@override
final balanceNotifier = ValueNotifier('-.--');
@@ -113,8 +116,6 @@ class ReownAppKitModal with ChangeNotifier implements IReownAppKitModal {
@override
ReownAppKitModalSession? get session => _currentSession;
- Logger get _logger => _appKit.core.logger;
-
IStore