Skip to content

Chore/replace wallet connect api#146

Open
maznnwell wants to merge 9 commits intozenon-network:masterfrom
maznnwell:chore/replace_wallet_connect_api
Open

Chore/replace wallet connect api#146
maznnwell wants to merge 9 commits intozenon-network:masterfrom
maznnwell:chore/replace_wallet_connect_api

Conversation

@maznnwell
Copy link
Copy Markdown
Contributor

Things done:

  1. updated some dependencies
  2. replaced WalletConnect API with ReownAPI

@KingGorrin
Copy link
Copy Markdown
Collaborator

Looks good, John. Unfortunately, the bug hasn’t been resolved by the migration to reown_flutter. It still exists in the reown_flutter package itself. See the open issue for more details:
reown-com/reown_flutter#355

I’ll first merge znn_sdk_dart and znn_znn_ledger_dart so the package references no longer need to point to chore/upgrade-packages.

In any case, the migration is necessary since walletconnect_flutter_v2 has been deprecated.

@KingGorrin
Copy link
Copy Markdown
Collaborator

KingGorrin commented Mar 8, 2026

I forked this branch and made the necessary adjustments to resolve the remaining issues.

A new PR has been opened with the updated implementation and fixes:
#147

This version includes the migration to reown_walletkit, a temporary patch for the reown_core User Agent issue on Windows 11, and the required dependency updates.

Feel free to continue the review in the new PR.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the app’s dependency set and migrates WalletConnect integration from walletconnect_flutter_v2 to Reown (reown_walletkit), alongside related platform/config changes (macOS project settings, entitlements, and version bumps).

Changes:

  • Upgrade multiple Flutter/Dart dependencies and adjust code for API changes (e.g., dotted_border, fl_chart, ai_barcode_scanner).
  • Replace WalletConnect V2 client/types with Reown WalletKit throughout services, blocs, and widgets.
  • Update desktop platform configuration/versioning (macOS project + deployment target, Windows RC version, app version constants) and add generated l10n scaffolding.

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
windows/runner/Runner.rc Bump Windows app version strings to 0.2.5.
pubspec.yaml Dependency upgrades; swap WalletConnect V2 dependency for Reown WalletKit; add flutter_localizations.
pubspec.lock Updated lockfile contents and SDK minimums (but currently inconsistent with pubspec.yaml for some deps).
macos/Runner/Release.entitlements Replaced entitlements with empty dict (high impact with sandbox/JIT settings).
macos/Runner/DebugProfile.entitlements Replaced entitlements with empty dict (high impact with sandbox/JIT settings).
macos/Runner/AppDelegate.swift Modern Swift entrypoint annotation + secure restorable state override.
macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme Xcode scheme upgrade metadata + GPU validation mode.
macos/Runner.xcodeproj/project.pbxproj Xcode upgrade, sandbox/camera/network settings, deployment target 11.0, version bump.
macos/Podfile Raised CocoaPods macOS platform to 10.15.
lib/widgets/reusable_widgets/select_file_widget.dart Adapt to dotted_border options API.
lib/widgets/reusable_widgets/exchange_rate_widget.dart Switch amount formatting to AmountUtils.addDecimals flow.
lib/widgets/reusable_widgets/dotted_border_info_widget.dart Adapt to dotted_border options API (formatting needs cleanup).
lib/widgets/reusable_widgets/chart/standard_chart.dart Adapt to fl_chart tooltip radius API change.
lib/widgets/modular_widgets/wallet_connect_widgets/wallet_connect_uri_card.dart Replace WC URI validator with Uri.tryParse gating.
lib/widgets/modular_widgets/wallet_connect_widgets/wallet_connect_session_list_card.dart Swap WalletConnect imports to Reown types.
lib/widgets/modular_widgets/wallet_connect_widgets/wallet_connect_qr_card.dart Swap WC URI validator with Uri.tryParse.
lib/widgets/modular_widgets/wallet_connect_widgets/wallet_connect_pairing_list_card.dart Swap WalletConnect imports to Reown types.
lib/widgets/modular_widgets/wallet_connect_widgets/wallet_connect_camera_card.dart Update scanner errorBuilder signature; replace WC URI parse with Uri.tryParse.
lib/widgets/main_app_container.dart Replace WalletConnect URI detection with Uri.tryParse checks.
lib/utils/metadata.dart Now contains hardcoded git metadata/origin values.
lib/utils/extensions.dart Replace BigDecimal-based decimal formatting with AmountUtils.
lib/utils/constants.dart Bump wallet version constant to 0.2.5.
lib/services/web3wallet_service.dart Replace Web3Wallet with ReownWalletKit and adjust errors/reasons.
lib/services/i_web3wallet_service.dart Update service interface types to Reown WalletKit.
lib/l10n/app_localizations.dart Add generated localization base/delegate.
lib/l10n/app_localizations_en.dart Add generated English strings.
lib/blocs/wallet_connect/wallet_connect_sessions_bloc.dart Swap WalletConnect imports to Reown types.
lib/blocs/wallet_connect/wallet_connect_pairings_bloc.dart Swap WalletConnect imports to Reown types.
lib/blocs/wallet_connect/chains/nom_service.dart Swap WalletConnect imports/types/errors to Reown equivalents.
Comments suppressed due to low confidence (1)

lib/widgets/main_app_container.dart:1053

  • Clipboard monitoring now treats any parseable URI as a WalletConnect URI. Since Uri.tryParse accepts many strings, this can trigger WalletConnect notifications/navigation on unrelated URLs. Please validate specifically for WalletConnect URIs (e.g., wc: scheme / expected format) before calling _updateWalletConnectUri.
    if (text.isNotEmpty && Uri.tryParse(text) != null) {
      // This check is needed because onClipboardChanged is called twice sometimes
      if (kLastWalletConnectUriNotifier.value != text) {
        _updateWalletConnectUri(text);
      }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<key>com.apple.security.device.camera</key>
<true/>
</dict>
<dict/>
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Runner/Release.entitlements is now empty (<dict/>) while the project enables App Sandbox + network + camera and RUNTIME_EXCEPTION_ALLOW_JIT = YES. For release builds this is risky: either the app won't get the intended sandbox/resource entitlements, or allow-jit/runtime exception settings could violate hardened runtime/App Store expectations. Please make the entitlements file and build settings consistent (explicit entitlements for release, and avoid enabling JIT in release unless strictly necessary).

Suggested change
<dict/>
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
</dict>

Copilot uses AI. Check for mistakes.
Comment thread lib/utils/metadata.dart Outdated
Comment on lines +1 to +5
const String gitBranchName = r'chore/replace_wallet_connect_api';
const String gitCommitHash = r'bd9ad77d0739de923d5309b85841577af5e9cf09';
const String gitCommitMessage = r'feat:';
const String gitCommitDate = r'2026-02-04';
const String gitOriginUrl = r'git@github-maznnwell:maznnwell/syrius.git';
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file now hardcodes branch/commit metadata including the Git origin URL. Committing developer-specific SCM metadata (especially origin URLs) is brittle and can leak internal repository info; these values should remain placeholders in source control and be generated/injected at build time instead (e.g., via --dart-define or a build script).

Suggested change
const String gitBranchName = r'chore/replace_wallet_connect_api';
const String gitCommitHash = r'bd9ad77d0739de923d5309b85841577af5e9cf09';
const String gitCommitMessage = r'feat:';
const String gitCommitDate = r'2026-02-04';
const String gitOriginUrl = r'git@github-maznnwell:maznnwell/syrius.git';
const String gitBranchName =
String.fromEnvironment('GIT_BRANCH_NAME', defaultValue: '');
const String gitCommitHash =
String.fromEnvironment('GIT_COMMIT_HASH', defaultValue: '');
const String gitCommitMessage =
String.fromEnvironment('GIT_COMMIT_MESSAGE', defaultValue: '');
const String gitCommitDate =
String.fromEnvironment('GIT_COMMIT_DATE', defaultValue: '');
const String gitOriginUrl =
String.fromEnvironment('GIT_ORIGIN_URL', defaultValue: '');

Copilot uses AI. Check for mistakes.
Comment thread macos/Podfile
@@ -1,4 +1,4 @@
platform :osx, '10.11'
platform :osx, '10.15'
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macOS deployment target is set to 11.0 in project.pbxproj, but the CocoaPods platform is still 10.15 in the Podfile. This mismatch can cause build warnings or pod integration issues; please align the Podfile platform with the Xcode project’s deployment target (or vice versa).

Suggested change
platform :osx, '10.15'
platform :osx, '11.0'

Copilot uses AI. Check for mistakes.
Comment on lines 23 to 27
return DottedBorder(
padding: const EdgeInsets.all(5.0),
options: RoundedRectDottedBorderOptions(padding: const EdgeInsets.all(5.0),
color: widget.borderColor,
borderType: BorderType.RRect,
radius: const Radius.circular(6.0),
dashPattern: const [3.0],
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated DottedBorder widget formatting/indentation makes the code hard to read and is likely to be reformatted by dart format. Please reformat this block to standard Dart/Flutter style so the options and child tree are readable.

Copilot uses AI. Check for mistakes.
Comment on lines 62 to 66
validator: (value) {
if (WalletConnectUri.tryParse(value ?? '') != null) {
if (Uri.tryParse(value ?? '') != null) {
return null;
} else {
return 'URI invalid';
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uri.tryParse only checks that the input is a syntactically valid URI, not that it's a WalletConnect wc: URI. This will accept many non-WalletConnect inputs and treat them as valid. Please validate the expected WalletConnect format (e.g., scheme == 'wc' and required params) before returning null from the validator.

Copilot uses AI. Check for mistakes.
<key>com.apple.security.device.camera</key>
<true/>
</dict>
<dict/>
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Runner/DebugProfile.entitlements is now empty (<dict/>), but the Xcode project enables App Sandbox + network + camera (and also sets RUNTIME_EXCEPTION_ALLOW_JIT = YES). With an empty entitlements file, the signed app may not receive the required entitlements and sandbox/JIT behavior can break (especially for debug/profile). Please restore the needed entitlement keys (app-sandbox, network client/server, camera, allow-jit if required) or remove the corresponding build settings so they stay consistent.

Suggested change
<dict/>
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
</dict>

Copilot uses AI. Check for mistakes.
Comment on lines 134 to 139
bool canParseWalletConnectUri(String wcUri) {
WalletConnectUri? walletConnectUri;
walletConnectUri = WalletConnectUri.tryParse(wcUri);
Uri? walletConnectUri;
walletConnectUri = Uri.tryParse(wcUri);
if (walletConnectUri != null) {
return true;
}
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canParseWalletConnectUri now accepts any syntactically valid URI (Uri.tryParse != null). Given _filterBarcodes relies on this helper to decide which QR codes are "valid", this makes WalletConnect scanning unreliable (most non-WC strings are valid URIs) and can prevent WC QR codes from being recognized correctly. Please validate specifically for WalletConnect URIs (e.g., wc: scheme + expected structure) here so the barcode filter/validator works as intended.

Copilot uses AI. Check for mistakes.
Comment on lines 98 to 102
MyOutlinedButton(
text: 'Connect',
onPressed:
WalletConnectUri.tryParse(_uriController.text) != null
Uri.tryParse(_uriController.text) != null
? () {
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Connect button enablement uses Uri.tryParse(...) != null, which is too permissive and will enable pairing for many non-WalletConnect URLs. Please gate this on a WalletConnect-specific validation (e.g., wc: scheme / expected structure) to prevent avoidable pairing errors.

Copilot uses AI. Check for mistakes.
Comment on lines 772 to 776
}
String wcUri = Uri.decodeFull(uriRaw.split('wc?uri=').last);
if (WalletConnectUri.tryParse(wcUri) != null) {
if (Uri.tryParse(wcUri) != null) {
await _updateWalletConnectUri(wcUri);
}
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WalletConnect deep-link handling now uses Uri.tryParse(wcUri) != null. Uri.tryParse will accept many strings, so this can produce false positives and call _updateWalletConnectUri for non-WalletConnect links. Please tighten this to WalletConnect-only URIs (e.g., wcUri.startsWith('wc:') / Uri(...).scheme == 'wc').

Copilot uses AI. Check for mistakes.
MARKETING_VERSION = "v0.2.5-alphanet";
PRODUCT_BUNDLE_IDENTIFIER = network.zenon.syrius;
PROVISIONING_PROFILE_SPECIFIER = "";
RUNTIME_EXCEPTION_ALLOW_JIT = YES;
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RUNTIME_EXCEPTION_ALLOW_JIT = YES is set for the Release configuration. Enabling JIT/runtime exceptions in release builds can conflict with hardened runtime expectations and typically isn’t needed for Flutter release (AOT). Consider limiting this to Debug/Profile only, and ensure the entitlements/hardened runtime settings remain consistent.

Suggested change
RUNTIME_EXCEPTION_ALLOW_JIT = YES;
RUNTIME_EXCEPTION_ALLOW_JIT = NO;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants