Skip to content

feat(mobile): network switch, ETH balance, WC flows, nav fixes#10

Merged
hooftly merged 18 commits intomainfrom
develop
Oct 18, 2025
Merged

feat(mobile): network switch, ETH balance, WC flows, nav fixes#10
hooftly merged 18 commits intomainfrom
develop

Conversation

@hooftly
Copy link
Member

@hooftly hooftly commented Oct 18, 2025

Summary

Consolidates recent mobile changes: adds a side-menu network switch, surfaces ETH balance on the wallet screen, lands WalletConnect responder/UI, and introduces a Security & Network view. Cleans up navigation and drawer UX, adds a footer with version info, and stabilizes lifecycle and localization.

Changes

  • Network & Navigation
    • Add network switch in side menu (network-switch)
    • Move wallet screen and add top navbar for clearer routing
    • Global navigator key to fix context/localization crashes in dialogs
  • Wallet & Balance
    • Show ETH balance on wallet screen
    • EOA tx service: sign/send EIP-1559 txs, ERC-20 sends/approvals
  • WalletConnect (Reown)
    • Add WalletKit responder SDK and scaffold WC module
    • Secure session storage + client (pair/approve/reject/disconnect)
    • In-app QR pairing, connect sheet, and rich request modal
    • Typed data (EIP-712) parsing, hashing, deterministic signing
    • Router validates chains/addresses; WC 4001 errors on reject
  • Security & Network
    • New screen showing ChainID, EntryPoint, Aggregator, ProverRegistry, ForceOnChainVerify
  • Drawer & Footer
    • Move wallet switcher to left drawer; app bar address trigger
    • Drawer footer with EqualFi logo and runtime app version
  • Android Host
    • Migrate to Gradle V2 (Kotlin DSL, manifests, resources)
  • Stability & Tests
    • Fix “controller used after dispose” in WC pairing dialog
    • Widget and parity tests for wallet drawer and WC signer flows

Motivation

Improve first-run UX, make network context explicit, enable dApp connectivity, and harden navigation and lifecycle paths to reduce crashes during pairing and signing.

Testing

  • Manual: network switching, wallet balance display, EOA send/approve
  • WC: QR pairing, connect sheet, personal/raw/typed-data signing
  • Routing: dialogs via global navigator; settings and PIN flows
  • Android: cold start on Gradle V2 host, splash/theme resources
  • Automated:
    • Wallet drawer widget test (open/select/assert callback)
    • EIP-712 parity vectors (DAI Permit, Permit2)
    • Router rejections for unauthorized chains/addresses

Checklist

  • Tests
  • Docs
  • Lint
  • Ready for review

…d unify signing

Split ECDSA key derivation into a dedicated service with reusable signing helpers.
Paired it with a WOTS master-seed service and refactored KeyMaterial to consume the
new abstractions cleanly.

Security
- Harden mnemonic access by gating secure storage behind biometrics.
- Introduce a locked-state retry view for failed/denied biometric attempts.

UX
- Add an account switcher in the main UI that clearly exposes both contexts:
  • Classic EOA (externally owned account)
  • PQC smart wallet (WOTS+/AA)

Signing & Flows
- Route all user-operation (ERC-4337) signing through the new ECDSA service.
- Reuse the shared WOTS master-seed handling across ETH and token flows for consistent
  derivation and rotation semantics.

Notes
- Touches: ECDSAService, WotsSeedService, KeyMaterial, SecureStore, UserOp pipeline,
  main UI navigation/switcher, locked-state view.
- No breaking storage migrations expected; ensure biometric capability checks are
  gracefully handled on unsupported devices.
…droid host to Gradle V2

EOA Transactions
- Introduce `EOATransactions` service that:
  - signs EIP-1559 transactions,
  - estimates gas,
  - broadcasts raw ETH transfers, ERC-20 sends, and approvals via the RPC client.
- Update main wallet view to use the EOA transaction service and expose raw ETH sending when the EOA account is active.
- Extend the token action sheet with an EOA vs 4337 toggle and new approval inputs.
- Log raw transfers and approvals in `ActivityStore`.

Android Host (Flutter V2)
- Add Gradle wrapper + Kotlin DSL host configs so Flutter recognizes a Gradle-backed V2 app:
  • mobile/android/build.gradle.kts:1
  • mobile/android/settings.gradle.kts:1
  • mobile/android/app/build.gradle.kts:8
- Introduce a V2-compatible entry point and manifest:
  • `MainActivity` now subclasses `FlutterActivity` (mobile/android/app/src/main/kotlin/com/equalfi/pqcwallet/MainActivity.kt:1)
  • Manifest carries flutterEmbedding metadata and biometrics permissions (mobile/android/app/src/main/AndroidManifest.xml:7)
- Supply missing Android resources (debug/profile manifests, launcher assets, splash backgrounds) and theme the launch to the dark aesthetic:
  • mobile/android/app/src/main/res/values/styles.xml:4
  • mobile/android/app/src/main/res/drawable/launch_background.xml:4
- Update `mobile/android/.gitignore` to keep the Gradle wrapper and scripts versioned for out-of-the-box builds.
…prevent context/localization crashes

- Add a `GlobalKey<NavigatorState>` to `MaterialApp` so all dialogs and pushes have a context with `Navigator` and `MaterialLocalizations` (mobile/lib/main.dart:42, :256).
- Rework PIN prompts to pull `context` and snack bars from the global navigator, eliminating the missing-localizations crash that left the UI spinning (mobile/lib/main.dart:60, :79).
- Switch settings navigation to use the same navigator key, preventing the “No Navigator in context” tap exception (mobile/lib/main.dart:217).
…C module

- Add Reown WalletKit responder SDK to mobile dependencies and capture resolved packages in `pubspec.lock`.
- Scaffold WalletConnect module with client, routing/session handling, storage interfaces, signing adapters, and basic UI shells.
- Export module surfaces for future integration into the app shell.

Notes
- No functional wiring yet; module is staged behind exports for incremental integration.
- Add secure-session persistence using FlutterSecureStorage
- Prune expired WalletConnect metadata on load; normalize stored payloads
- Implement WcClient ChangeNotifier that boots Reown WalletKit, tracks
  proposals/requests, and exposes pairing/approve/reject/disconnect
- Integrate client into app lifecycle after key material loads; route via
  shared navigator key
- Surface WalletConnect access in settings with configuration defaults
…ic signing + parity tests

- Implement full EIP-712 typed-data parsing and hashing with helpers for domain and structs.
- Add deterministic signing utilities with 65-byte signature packing (r||s||v).
- Integrate utilities into the WalletConnect signer surface.

Tests
- Add parity tests for DAI Permit and Permit2 (single and batch) vectors.
- Assert domain hashes, struct hashes, digests, and signatures, including nested struct and array scenarios.
…alidated router with WC 4001 errors

Signer (WcSigner)
- Support personal, raw, and EIP-712 typed-data signatures alongside transaction signing.
- Cache the signer address for faster dispatch.
- Preflight transactions via RPC: normalize EIP-1559 fees and estimate gas before broadcast.

Router
- Introduce WalletConnect router that validates session chain IDs and addresses.
- Dispatch supported methods to the signer; reject unauthorized or invalid requests with WC 4001 errors.

Tests
- Verify personal message prefixing and address recovery.
- Assert router rejection paths for unauthorized chains, addresses, and malformed payloads.
… request modal

- Add `qr_bar_code_scanner_dialog` dependency to enable in-app WalletConnect QR capture for Reown sessions.
- Wire a QR/paste pairing dialog with navigator-aware feedback; surface from the app bar as “Connect dApp (Reown)”.
- Implement a cyberpunk-themed connect sheet that presents:
  - dApp metadata (name, icon, URL)
  - requested chains and methods
  - shared accounts to be exposed
  - warnings for unsupported chains/methods
- Build a request modal that renders:
  - transaction details (to, value, EIP-1559 params)
  - personal/raw/typed-data previews and summaries
  - ENS lookups where available
  - security banners for risky payloads (e.g., approvals, high-value sends)
… trigger + widget test

- Rework home scaffold to use a drawer-enabled scaffold key and replace the navbar toggle pill with a tappable truncated-address trigger on the AppBar; keep wallet switching wired through state updates (mobile/lib/main.dart:643, :663).
- Add `WalletMenuDrawer` with radio options and truncated address display so wallet selection now lives in the left slide-out menu (mobile/lib/main.dart:783).
- Introduce a widget test that opens the drawer, asserts rendered wallet options, and verifies the selection callback fires for the EOA choice (mobile/test/wallet_menu_drawer_test.dart:1).
- Route shield tab to a dedicated Security & Network view; leave other
  tabs on existing wallet flow
- Streamline home wallet view to focus on recent activity and tx actions;
  remove chain configuration cards
- Add Security & Network screen listing ChainID, EntryPoint, Aggregator,
  ProverRegistry, and ForceOnChainVerify details
- Replace deprecated status banner color calls; migrate wallet drawer
  account selector to Flutter’s new RadioGroup to silence analyzer issues
- Update bundled QR scanner example/package: use enum .name, handle
  AppLifecycleState.hidden, raise minimum SDK to Dart 3-era tooling
- Modernize plugin tests with binary messenger mocking API and silence
  unavoidable web-library deprecation warnings in legacy shims
- Introduce SecureStorage wrapper around FlutterSecureStorage enabling
  encrypted shared prefs on Android and first_unlock on Apple; transparently
  migrate legacy key material from old defaults
- Switch all secure data users to shared store:
  - wallet secret (mobile/lib/main.dart:64)
  - PIN storage (mobile/lib/services/pin_service.dart:9)
  - settings (mobile/lib/state/settings.dart:55)
  - pending index cache (mobile/lib/services/storage.dart:6)
  - WalletConnect session cache (mobile/lib/walletconnect/wc_session_store.dart:1)
- Add reusable in-memory test store (mobile/test/support/memory_store.dart:1)
  and inject in affected tests to preserve unit coverage
- Rework WalletConnect pairing flow: dialog owns its controller to remove
  "controller used after dispose" crash (mobile/lib/main.dart:875)
- Introduce _WalletConnectPairingDialog stateful widget managing controller
  lifecycle, handling QR scans/paste, and routing snackbars via parent scaffold
- Remove "Wallet Menu" label from drawer header to make room for footer
- Add footer widget rendering gradient EqualFi logo and runtime semantic
  version from package_info_plus
- Declare package_info_plus as a direct dependency for reliable version
  access in the drawer
@hooftly hooftly merged commit 3793515 into main Oct 18, 2025
2 checks passed
@hooftly hooftly deleted the develop branch October 18, 2025 13:42
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.

1 participant