Skip to content

fix(sdk): mobile wallet UX fixes and connection stability#53

Open
akbarsaputrait wants to merge 3 commits into
masterfrom
fix/phantom-mobile-ux-fixes
Open

fix(sdk): mobile wallet UX fixes and connection stability#53
akbarsaputrait wants to merge 3 commits into
masterfrom
fix/phantom-mobile-ux-fixes

Conversation

@akbarsaputrait

Copy link
Copy Markdown
Member

Summary

Fixes several mobile wallet UX issues, primarily around Phantom/Backpack deeplink flows and connection stability.

Changes

Connection fixes

  • Force EVM connect on deeplink open: When a dual-chain wallet (Phantom, Backpack) opens via deeplink, only Solana auto-connects via wallet-standard. SDK now silently triggers connect() for the matching injected EVM connector — wallet approves inside its own browser, no user prompt needed. Matched by Solana wallet name, not hardcoded to Phantom.
  • dualChainConnect flag not cleared: After Phantom connects both chains, the flag was never cleared. Subsequent wallet connections (e.g. MetaMask) triggered the dual-chain handler again and looped back to SELECT_METHOD instead of SELECT_TOKEN. Fixed by moving the clear inside the route-guarded effect.

State race fix

  • Atomic route state: RozoPayProvider was setting route and routeMeta as two separate setState calls. After an await (disconnect sequence), this created a two-render window where guards read stale route, causing 'Pay with another wallet' click to do nothing. Combined into a single setState.

Disconnect safety

  • disconnectAll(): Extracted shared helper in SelectMethod using Promise.allSettled with isSolanaConnected/isStellarConnected guards. Fixes TypeError: r.disconnect is not a function when Solana wallet adapter is uninitialized (Phantom deeplink, Solana-only connected).

UX improvements

  • Pay to Address loading: Replaced 'Loading...' subtitle text with a spinner in the right-icon slot while deposit address options fetch.
  • Connector error states: ConnectorSolana and ConnectorStellar now show Connection Failed with Try Again and Cancel buttons instead of a silent hang (e.g. WalletConnect proposal expired).

Schema

  • Added sourceAmountUnits and sourceTokenSymbol optional fields to zRozoPayOrderMetadata in pay-common.

Testing

  • Build clean, pay-common 35/35 tests pass
  • Lint exits 0

- RozoPayModal: force EVM connect on deeplink open when Solana-only
  auto-connected; matches injected connector by Solana wallet name
  (works for Phantom, Backpack, any dual-chain wallet)
- RozoPayModal: fix dualChainConnect flag not cleared after Phantom
  connect, causing subsequent MetaMask connect to loop back to
  SELECT_METHOD instead of SELECT_TOKEN
- RozoPayProvider: combine route+routeMeta into single setState to
  prevent two-render race on 'Pay with another wallet' click
- RozoPayProvider: reuse consumer QueryClient if present
- SelectMethod: extract disconnectAll() with Promise.allSettled and
  isSolanaConnected/isStellarConnected guards to prevent TypeError
  when disconnect is undefined on uninitialized adapter
- OptionsList: replace 'Loading...' subtitle with spinner on loading
  option item (Pay to Address tile)
- ConnectorSolana: add error state + Retry/Cancel buttons on
  WalletConnect failure (was a silent hang)
- ConnectorStellar: same error handling as ConnectorSolana
- rozoPay: add sourceAmountUnits/sourceTokenSymbol optional fields
  to zRozoPayOrderMetadata schema
@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
intent-example Ready Ready Preview, Comment Jul 15, 2026 4:43pm

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0adee842fd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-typescript": "^12.1.2",
"@rozoai/intent-common": "0.1.23",
"@rozoai/intent-common": "0.1.25-beta.1",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the pnpm lockfile with the dependency bump

This package now requires @rozoai/intent-common 0.1.25-beta.1, but pnpm-lock.yaml was not updated and still records the packages/connectkit importer specifier/resolution as 0.1.23. Since the repo is pinned to pnpm and pnpm documents that in CI “installation fails if a lockfile is present but needs an update,” any frozen-lockfile install will fail before build/test until the lockfile is regenerated and committed.

Useful? React with 👍 / 👎.

…h-another-wallet

Adds a session-lifetime userDisconnected flag to PayContext.

Problem: On Phantom mobile deeplink, after user clicks 'Pay with another
wallet' and disconnectAll runs, Phantom's in-app browser silently
re-authorizes the EVM injected provider (persistent origin trust).
This flipped isEthConnected back to true, triggering auto-navigate
effects that routed the user to SELECT_TOKEN or back to SELECT_METHOD
with only EVM connected — never reaching MOBILECONNECTORS.

Fix: userDisconnected flag set to true right before disconnectAll,
guarding three auto-navigate effects in RozoPayModal:
  - Force-connect (Phantom deeplink EVM auto-connect)
  - SELECT_METHOD → SELECT_TOKEN auto-navigate
  - CONNECT/CONNECTORS/MOBILECONNECTORS → SELECT_TOKEN auto-route

Flag resets on:
  - Modal open/close (fresh session)
  - Explicit wallet pick in MobileConnectors handleInjectedWallet /
    handleDeeplinkWallet
  - ConnectorList onClick (desktop CONNECTORS page)

Safe under repeat cycles: each 'Pay with another wallet' click sets the
flag, disconnect + route works cleanly, wallet pick resets flag, connect
+ auto-route resumes. No state leaks between cycles.
- walletConfigs: enable showInMobileConnectors for MetaMask (was false).
  Missing entry caused MetaMask to never appear as a deeplink option,
  even when not injected in the current browser (Safari, Phantom in-app,
  etc.).
- MobileConnectors: dedup logic now cross-matches both name and
  shortName between injected and deeplink configs so any injected wallet
  correctly hides its deeplink counterpart.
- bundle-analysis, package.json version bumps, pnpm-lock refresh.
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