Skip to content

[Wallet Apps Bridge][DEX mirror (appsource)] Add MCW #/apps iframe compatibility (EIP-1193, multi-domain, iOS/Android) #32

@marsiandeployer

Description

@marsiandeployer

Goal

Add compatibility with Swap.Online Wallet Apps host bridge so this dApp can run inside MCW #/apps iframe and use the same connected wallet session.

Related host issue:

Why

The wallet host can be deployed on different domains (white-label) and also used from Android/iOS webviews. dApp integration must not rely on one hardcoded wallet origin.

Required implementation

  1. Enable bridge mode in embedded context

    • Detect iframe mode: window.parent !== window.
    • Detect host intent by query flag: walletBridge=swaponline.
  2. Use EIP-1193 provider flow (no MetaMask-only assumptions)

    • Use window.ethereum.request(...) as the source of truth.
    • Do not require isMetaMask for connect flow.
  3. Add Wallet Apps bridge client adapter

    • Include host-compatible adapter before main app bundle.
    • Adapter should support handshake + request/response + events:
      • WALLET_APPS_BRIDGE_HELLO
      • WALLET_APPS_BRIDGE_REQUEST / RESPONSE
      • WALLET_APPS_BRIDGE_READY
      • WALLET_APPS_BRIDGE_EVENT (accountsChanged, chainChanged)
  4. Multi-domain support (important)

    • Do not hardcode one wallet domain.
    • Implement configurable allowed host origins via env/config (array).
    • Add runtime override option for support team / white-label deploys.
  5. Android / iOS compatibility

    • Validate in mobile webviews (Android + iOS Safari/WebView).
    • Ensure provider is injected before app wallet init.
    • Verify connect/sign/switch network flow without popup dependency.

Acceptance criteria

  • dApp opens in MCW #/apps and connect button uses host-connected wallet.
  • eth_requestAccounts, eth_chainId, signing and tx requests work via bridge.
  • accountsChanged and chainChanged are handled correctly.
  • No regression when app is opened standalone (outside iframe).

Deliverables in report (required)

Please post a final report comment in this issue with:

  1. Mainnet deployed URL of this dApp for QA testing.
  2. Commit/PR links.
  3. Supported wallet host origins config used.
  4. Android/iOS test results (device/browser + pass/fail for connect/sign/switch).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions