This guide walks you through adding support for Base Account into an existing React Native app or starter project.If you prefer to skip ahead and start with a working example, navigate to the repository below:
The Mobile Wallet Protocol Client library requires the Expo WebBrowser and Async Storage packages to be installed.
Follow the instructions on the respective pages for any additional setup.
Report incorrect code
Copy
Ask AI
npm i expo expo-web-browser @react-native-async-storage/async-storage
Mobile Wallet Protocol Client requires crypto.randomUUID, crypto.getRandomValues, and URL to be polyfilled globally since they are not available in the React Native environment.Below is an example of how to polyfill these functions in your app using the expo-crypto and expo-standard-web-crypto packages.
Report incorrect code
Copy
Ask AI
npm i expo-crypto expo-standard-web-crypto react-native-url-polyfill
Report incorrect code
Copy
Ask AI
import "react-native-url-polyfill/auto";import { polyfillWebCrypto } from "expo-standard-web-crypto";import { randomUUID } from "expo-crypto";polyfillWebCrypto();crypto.randomUUID = randomUUID;
Mobile Wallet Protocol Client provides 2 interfaces for mobile app to interact with the Base Account, an EIP-1193 compliant provider interface and a wagmi connector.
If your app is using wallet aggregator, go straight to Option 2: Wagmi
Connector for 1-line integration.