Installation
1. Install the package
You can add Mobile Wallet Adapter to your web application by installing:
npm install @solana-mobile/wallet-standard-mobile
2. Register the wallet
In the root of your web application, invoke the registerMwa function.
CAUTIONEnsure registerMwa is invoked in a non-SSR context. if you’re using a framework with Server Side Rendering (e.g Next.js),
// 'use client' - If using Next.js, ensure it is registered in a non-SSR context.
import {
createDefaultAuthorizationCache,
createDefaultChainSelector,
createDefaultWalletNotFoundHandler,
registerMwa,
} from '@solana-mobile/wallet-standard-mobile';
registerMwa({
appIdentity: {
name: 'My app',
uri: 'https://myapp.io',
icon: 'relative/path/to/icon.png', // resolves to https://myapp.io/relative/path/to/icon.png
},
authorizationCache: createDefaultAuthorizationCache(),
chains: ['solana:devnet', 'solana:mainnet'],
chainSelector: createDefaultChainSelector(),
onWalletNotFound: createDefaultWalletNotFoundHandler(),
})
Once registered, MWA will appear as a wallet option for users browsing on Android Chrome. The connection is handled locally via Android Intents (same as native Android apps).