Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: integrate Solana GPT Wallet into examples #219

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions examples/solana-gpt-wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Solana GPT Wallet

A modern, AI-powered wallet interface for Solana that allows users to interact with their crypto assets using natural language. Built with Next.js, Tailwind CSS, and integrated with GPT for an intuitive user experience.

🔗 **Live Demo**: [https://solana-gpt-wallet.vercel.app/](https://solana-gpt-wallet.vercel.app/)

> ⚡ Please be mindful of GPT API usage if testing the live demo.

## 💡 Inspiration

This project was inspired by [@thearyanag](https://github.com/thearyanag)'s ideas and [this discussion](https://github.com/sendaifun/solana-agent-kit/issues/126) about Solana Agent Kit. The goal is to create a more intuitive way to interact with Solana wallets using natural language.

## 🎯 Implementation Details

- Currently using GPT-4o-mini for processing natural language commands (feel free to experiment with different models)
- Using default Solana wallet provider for transaction signing
- Future possibilities (not yet implemented):
- Using Privy for auto-signing transactions
- Generating unique wallets for each user mapped to their EOA
- Automated features:
- Integrated 2 SOL airdrop for testing
- Real-time balance updates
- Transaction history tracking

## ⚠️ Known Limitations

- **Swap Functionality**: Currently, the swap feature is not fully functional due to Jupiter API limitations on Devnet. Contributions to fix this are welcome!
- Running on Devnet for testing purposes.
- Current model (GPT-4o-mini) limitations - feel free to experiment with other models like GPT-o1 or Claude 3.5 Sonnet.

## ✨ Features

- **Natural Language Interactions** - Send tokens, check balances, and perform actions using simple text commands
- **Token Management** - View SOL and USDC balances in real-time
- **Transaction History** - Track your recent transactions with detailed status updates
- **AI-Powered Interface** - Interact with your wallet using natural language
- **Automated Test SOL** - One-click 2 SOL airdrop for testing
- **Secure Architecture** - Built with security best practices and proper error handling
- **Mobile Responsive** - Fully functional on both desktop and mobile devices

## 🚀 Quick Start

1. **Clone the repository**
```bash
git clone https://github.com/pegasus1134/solana-gpt-wallet.git
cd solana-gpt-wallet
```

2. **Install dependencies**
```bash
npm install
```

3. **Set up environment variables**
Create a `.env.local` file in the root directory:
```env
NEXT_PUBLIC_OPENAI_API_KEY=your_api_key_here
```

4. **Run the development server**
```bash
npm run dev
```

## 🔧 Customization

Feel free to experiment with:
- Different GPT models (currently using GPT-4o-mini)
- Custom system prompts for better interactions
- Alternative wallet providers
- Additional token support

## 🛠 Tech Stack

- **Frontend**: Next.js, React, TypeScript
- **Styling**: Tailwind CSS, Shadcn UI
- **Blockchain**: Solana Web3.js
- **AI Integration**: OpenAI GPT-4o-mini
- **State Management**: Zustand

## 🤝 Contributing

Contributions are welcome! Particularly interested in:
- Fixing the swap functionality
- Implementing Privy integration
- Adding support for more tokens
- Improving error handling
- Enhancing the UI/UX

To contribute:
1. Fork the repository
2. Create a new branch
3. Make your changes
4. Submit a pull request

## 📄 License

MIT License - feel free to use this project for your own purposes

## 👏 Acknowledgements

- [@thearyanag](https://github.com/thearyanag) for the original idea and inspiration
- [Solana Agent Kit](https://github.com/sendaifun/solana-agent-kit)
- Solana and OpenAI teams for their amazing tools

---

Made by [pegasus1134](https://github.com/pegasus1134) | neuralway.ai
16 changes: 16 additions & 0 deletions examples/solana-gpt-wallet/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
];

export default eslintConfig;
16 changes: 16 additions & 0 deletions examples/solana-gpt-wallet/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const nextJest = require('next/jest');

const createJestConfig = nextJest({
dir: './',
});

const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
moduleDirectories: ['node_modules', '<rootDir>/'],
testEnvironment: 'jest-environment-jsdom',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
};

module.exports = createJestConfig(customJestConfig);
5 changes: 5 additions & 0 deletions examples/solana-gpt-wallet/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
17 changes: 17 additions & 0 deletions examples/solana-gpt-wallet/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
typescript: {
// !! WARN !!
// This will allow production builds to successfully complete even if
// your project has type errors.
ignoreBuildErrors: true,
},
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
}

export default nextConfig;
21 changes: 21 additions & 0 deletions examples/solana-gpt-wallet/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
webpack: (config) => {
config.resolve.fallback = {
fs: false,
path: false,
os: false,
};
return config;
},
}

module.exports = nextConfig
Loading