This guide helps you add support for Base Account into a React Native app by integrating the Mobile Wallet Protocol Client.
This doc is updated for Mobile Wallet Protocol Client v1.0.0
Deep Link Handling
Breaking change in v1.0.0: Universal Links and App Links requirements are
removed in favor of custom schemes (e.g. myapp://
).
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:
If you are looking to integrate Base Account into an existing React Native app or starter project, follow the instructions below.
Add the latest version of Mobile Wallet Protocol Client to your project.
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.
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.
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.
The app
prefix in SDK config params is removed in v1.0.0.
Create a new EIP1193Provider
instance, which is EIP-1193 compliant.
Add the latest version of Mobile Wallet Protocol wagmi-connectors to your project.
Simply import the createConnectorFromWallet
function and pass in the wallet you want to use to wagmi config.
Then you can use wagmi’s react interface to interact with the Base Account.
Send us feedback on the Base Discord or create a new issue on the MobileWalletProtocol/react-native-client repository.