Skip to content

fix: normalize ReactNative URLS#190

Open
wenfix wants to merge 3 commits intomainfrom
fix/non-http-urls
Open

fix: normalize ReactNative URLS#190
wenfix wants to merge 3 commits intomainfrom
fix/non-http-urls

Conversation

@wenfix
Copy link
Contributor

@wenfix wenfix commented Feb 26, 2026

Explanation

  • React Native apps can provide custom-scheme URLs (e.g. react-native-playground://) as dapp.url, which breaks downstream wallet RPC middleware that calls new URL() expecting http(s) schemes
  • Adds normalizeNativeUrl() helper in setupDappMetadata() that converts non-http(s) URLs to https://<sanitized-scheme>.rn.dapp.local on RN platforms
  • Preserves the original URL in a new nativeScheme field on DappSettings

Testing

Unit tests

cd packages/connect-multichain && yarn vitest run src/multichain/utils/index.test.ts

Manual (React Native playground)

  1. cd playground/react-native-playground && cp .env.example .env (add Infura key)
  2. yarn ios or yarn android
  3. Use the Wagmi tab to connect — it passes react-native-playground:// as dapp.url
  4. Verify console log: Normalizing dapp URL for React Native: "react-native-playground://" -> "https://react-native-playground.rn.dapp.local"
  5. Connection should succeed without RPC middleware crash

References

Fixes WAPI-1134

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@wenfix wenfix requested a review from a team as a code owner February 26, 2026 15:45
Co-authored-by: Alex Donesky <adonesky@gmail.com>
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.

2 participants