A simple, ready-to-use example for connecting Solana wallets (Phantom, etc.) to your React Native application using the Mobile Wallet Adapter (MWA) protocol.
- ✅ Connect to Phantom and other Solana mobile wallets
- ✅ Mobile Wallet Adapter (MWA) protocol integration
- ✅ Works on both iOS and Android
- ✅ Built with React Native 0.83.1
- ✅ TypeScript support
- ✅ Ready-to-run example code
Before you begin, ensure you have the following installed:
- Node.js >= 20
- React Native development environment set up (React Native CLI Quickstart)
- For iOS: Xcode and CocoaPods
- For Android: Android Studio and Java Development Kit (JDK)
- A Solana wallet app installed on your device (e.g., Phantom, Solflare)
- Clone the repository:
git clone https://github.com/dev78ashish/react-native-solana-wallet-adapter.git
cd react-native-solana-wallet-adapter- Install dependencies:
npm install
# or
yarn install- Install iOS dependencies (iOS only):
cd ios && pod install && cd ..npm run android
# or
yarn androidnpm run ios
# or
yarn iosThis project uses the following key packages:
@solana-mobile/mobile-wallet-adapter-protocol- Core MWA protocol@solana-mobile/mobile-wallet-adapter-protocol-web3js- Web3.js integration for MWA@solana/web3.js- Solana JavaScript APIreact-native-get-random-values- Polyfill for crypto random valuesbuffer- Buffer polyfill for React Native
"Buffer is not defined"
- Make sure
react-native-get-random-valuesis imported at the top of your entry file - Ensure
bufferis properly installed
"Crypto.getRandomValues() not supported"
- Import
react-native-get-random-valuesbefore any other imports
Wallet not detected
- Ensure you have a compatible Solana wallet installed on your device
- Make sure the wallet app is updated to the latest version
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Solana Mobile Documentation
- Mobile Wallet Adapter Specification
- Solana Web3.js Documentation
- React Native Documentation
If this project helped you, please give it a ⭐️!
For questions or feedback, please open an issue on GitHub.
Note: This is an example project for educational purposes. Always follow security best practices when handling user wallets and transactions in production applications.