Demo

Features

Embedded Wallet

Authentication with Privy supporting Google, Apple, and Email login methods

Natural Language Interface

Chat interface for interacting with Solana blockchain using simple language

AI-Powered

Solana transaction capabilities through an intelligent AI assistant

Chat History

Persistent chat history management across sessions

Profile Management

User profile creation and management

Native Mobile Experience

Built with React Native for native mobile performance

Prerequisites

  • Node.js (v16+)
  • MongoDB
  • OpenAI API Key
  • Helius API Key (for Solana RPC access)
  • iOS/Android development environment

Setup Instructions

1

Clone the repository

git clone https://github.com/yourusername/privy-sak-react-native.git
cd privy-sak-react-native
2

Install dependencies

yarn install
3

Configure environment variables

Copy the example environment files:

# For client
cp .env.local.example .env.local

# For server
cd server
cp .env.example .env
cd ..

# For Expo configuration
cp app.example.json app.json

Update these files with your app’s information and API keys.

4

Start the server

cd server
yarn dev
5

Run the app on iOS

npx expo run:ios

For Android:

npx expo run:android

This app cannot be run with Expo Go as some polyfills used in the project are not compatible with Expo Go. You must use the development build with npx expo run:ios or npx expo run:android.

Environment Variables

The following environment variables are required:

Client (.env.local)

# OpenAI API Key for chat functionality
EXPO_PUBLIC_OPENAI_API_KEY=your_openai_api_key

# Server URL
EXPO_PUBLIC_API_URL=http://localhost:3001

# Helius RPC URL with API key
EXPO_PUBLIC_HELIUS_URL=https://mainnet.helius-rpc.com/?api-key=your_helius_api_key

Server (.env)

# OpenAI API Key
OPENAI_API_KEY=your_openai_api_key

# MongoDB connection string
MONGODB_URI=mongodb://localhost:27017/privy-sak

# Helius RPC URL
HELIUS_STAKED_URL=https://mainnet.helius-rpc.com/?api-key=your_helius_api_key

# Server port
PORT=3001

Project Structure

Privy Integration

This example demonstrates how to integrate Privy’s embedded wallet solution with React Native. Key integration points include:

Wallet Provider Setup

Solana Agent Kit Integration

Mobile-Specific Considerations

When working with Solana Agent Kit in React Native, consider these mobile-specific aspects:

  1. Polyfills: Several Node.js modules need polyfills in React Native
  2. Performance: Be mindful of resource usage on mobile devices
  3. Offline Handling: Implement proper handling for intermittent connectivity
  4. Deep Linking: Configure for wallet connection redirects
  5. Secure Storage: Use secure storage for sensitive information

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.