npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-solana-mobile-wallet-adapter

v0.1.0

Published

React Native Solana Mobile Wallet Adapter for iOS and Android

Readme

react-native-solana-mobile-wallet-adapter

Unified cross-platform Solana wallet adapter for React Native and Expo.

  • Android: Mobile Wallet Adapter (MWA) 2.0 protocol
  • iOS: Phantom/Solflare deeplinks with encrypted sessions

Features

  • ✅ Unified API for both iOS and Android
  • ✅ Session persistence across app restarts
  • ✅ Multiple wallet support (Phantom, Solflare, Backpack)
  • ✅ Sign transactions, messages, and more
  • ✅ Works with Expo Router
  • ✅ TypeScript support

Installation

# Install the package
npm install react-native-solana-mobile-wallet-adapter

# Install required peer dependencies
npm install expo-linking expo-secure-store @solana/web3.js

# Android only - install MWA protocol (optional if iOS-only)
npm install @solana-mobile/mobile-wallet-adapter-protocol-web3js

Quick Start

import { transact, isConnected, getConnectedAddress } from 'react-native-solana-mobile-wallet-adapter';

// Connect to wallet
const result = await transact(async (wallet) => {
  const auth = await wallet.authorize({
    cluster: 'mainnet-beta',
    identity: {
      name: 'My App',
      uri: 'https://myapp.com',
      icon: 'favicon.ico',
    },
  });
  
  return auth.accounts[0].address;
});

// Check connection status
if (isConnected()) {
  console.log('Connected to:', getConnectedAddress());
}

App Configuration

Expo (app.json / app.config.ts)

{
  "expo": {
    "scheme": "myapp",
    "ios": {
      "infoPlist": {
        "LSApplicationQueriesSchemes": ["phantom", "solflare", "backpack"]
      }
    }
  }
}

Important: The scheme is required for iOS deeplink callbacks.

React Native CLI (Info.plist)

<!-- Allow querying wallet apps -->
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>phantom</string>
  <string>solflare</string>
  <string>backpack</string>
</array>

<!-- Register your app's URL scheme -->
<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>myapp</string>
    </array>
  </dict>
</array>

Import Options

Option 1: Auto-detect platform (recommended)

import { transact } from 'react-native-solana-mobile-wallet-adapter';

// Automatically uses iOS or Android implementation
await transact(async (wallet) => { /* ... */ });

Option 2: Platform-specific imports

// iOS
import { transact } from 'react-native-solana-mobile-wallet-adapter/ios';

// Android  
import { transact } from 'react-native-solana-mobile-wallet-adapter/android';

Option 3: Explicit platform config

import { transact } from 'react-native-solana-mobile-wallet-adapter';
import { Platform } from 'react-native';

await transact(callback, { platform: Platform.OS as 'ios' | 'android' });

API Reference

transact<T>(callback, config?): Promise<T>

Opens a wallet session and executes the callback.

interface TransactConfig {
  platform?: 'ios' | 'android';       // Explicit platform
  wallet?: 'phantom' | 'solflare';    // iOS: wallet to use
  redirectScheme?: string;            // iOS: custom URL scheme
  walletUriBase?: string;             // Android: wallet URI base
}

MobileWallet Methods

authorize(params): Promise<AuthorizationResult>

const auth = await wallet.authorize({
  cluster: 'mainnet-beta',  // 'mainnet-beta' | 'devnet' | 'testnet'
  identity: {
    name: 'My App',
    uri: 'https://myapp.com',
    icon: 'favicon.ico',
  },
  authToken: previousToken,  // Optional: for re-authorization
});

// Returns:
// auth.accounts[0].address    - wallet address (string)
// auth.accounts[0].publicKey  - wallet public key (Uint8Array)
// auth.authToken              - session token

deauthorize(params): Promise<void>

await wallet.deauthorize({ authToken: auth.authToken });

signTransactions(params): Promise<Transaction[]>

const [signedTx] = await wallet.signTransactions({
  transactions: [transaction],
});

signMessages(params): Promise<Uint8Array[]>

const [signature] = await wallet.signMessages({
  addresses: [auth.accounts[0].address],
  payloads: [new TextEncoder().encode('Hello!')],
});

signAndSendTransactions(params): Promise<string[]> (Android only)

const signatures = await wallet.signAndSendTransactions({
  transactions: [tx],
  minContextSlot: slot,
});

Helper Functions

| Function | Description | |----------|-------------| | isConnected() | Returns true if there's an active session | | getConnectedAddress() | Returns the connected wallet address or null | | getConnectedWalletType() | Returns 'phantom' | 'solflare' | null (iOS only) | | disconnect() | Clears the session without calling the wallet | | getInstalledWallets() | Returns list of installed wallet apps (iOS) | | getSelectedWallet() | Returns the user's selected wallet (iOS) | | setSelectedWallet(wallet) | Sets the preferred wallet (iOS) | | handleRedirectUrl(url) | Handle deeplink callback (for Expo Router) |

Platform Differences

| Feature | Android (MWA) | iOS (Deeplinks) | |---------|---------------|-----------------| | signAndSendTransactions | ✅ | ❌ Deprecated | | Multiple wallet picker | ✅ System UI | Manual selection | | Background signing | ✅ | ❌ | | Session encryption | MWA protocol | X25519 |

Troubleshooting

"Could not detect platform" error

For local/linked packages, either:

  1. Use platform-specific imports
  2. Pass { platform: Platform.OS } in config
  3. Configure Metro (see USAGE.md)

iOS wallet doesn't return to app

Ensure your scheme is configured in app.json and matches your deeplink setup.

Android wallet picker doesn't appear

Make sure @solana-mobile/mobile-wallet-adapter-protocol-web3js is installed.

Documentation

License

MIT