This doc is updated for Mobile Wallet Protocol Client
v1.0.0
Deep Link HandlingBreaking change in v1.0.0: Universal Links and App Links requirements are
removed in favor of custom schemes (e.g.
myapp://
).Before You Start
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:Mobile Wallet Protocol Expo Examplehttps://github.com/MobileWalletProtocol/smart-wallet-expo-example
Step 1: Install Mobile Wallet Protocol Client
Add the latest version of Mobile Wallet Protocol Client to your project.Step 2: Add Polyfills
Install peer dependencies
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.Polyfills
Mobile Wallet Protocol Client requirescrypto.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.
Step 3: Usage
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.
Option 1: EIP-1193 Provider
The
app
prefix in SDK config params is removed in v1.0.0.EIP1193Provider
instance, which is EIP-1193 compliant.
App.tsx
Option 2: Wagmi Connector
Add the latest version of Mobile Wallet Protocol wagmi-connectors to your project.createConnectorFromWallet
function and pass in the wallet you want to use to wagmi config.
config.ts
App.tsx