This project combines a Next.js web application, a Telegram bot, and integration with the Solana blockchain using the Solana Actions API. The bot and web application can interact with Solana to perform actions like sending transactions.
- Features
- Technologies
- Installation
- Running the Project
- Solana Actions API Integration
- Project Structure
- Additional Commands
- License
- Next.js: Server-side rendering and static site generation.
- Telegram Bot: Built using the
telegraf
library and TypeScript. - Solana Actions API: Interact with the Solana blockchain to:
- Send and receive transactions.
- Integration: The bot, Next.js, and Solana integration run simultaneously using
concurrently
orPM2
.
- Next.js — React framework.
- Telegraf — Telegram bot framework.
- TypeScript — Programming language.
- Solana Web3.js — JavaScript API for Solana.
- Concurrently — Utility to run multiple commands concurrently.
- PM2 — Process manager for Node.js.
-
Clone the repository:
git clone https://github.com/your-username/your-repo.git cd your-repo
-
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.env
file in the root directory. - Add your Telegram bot token and Solana network configuration:
TELEGRAM_BOT_TOKEN=your-bot-token
- Create a
To run in development mode:
npm run dev
-
Build the project:
npm run build
-
Run Next.js, the Telegram bot, and Solana integration simultaneously:
npm run start:all
Alternatively, use PM2 for process management:
npm install pm2 -g pm2 start ecosystem.config.js
The project uses the Solana Web3.js library to interact with the Solana blockchain. Here are the key functionalities:
- The Solana Action can send SOL tokens from one wallet to another.
- Example command:
action=solana-action:http://localhost:3000/api/actions/donate
.
├── telegram-bot/ # Telegram bot source code
│ ├── index.ts # Main bot file
├── public/ # Static files
├── src/
│ ├── app/ # Next.js pages
│ │ └── api/ # Solana API endpoints
│ └── ... # Other pages
|
├── .env # Environment variables
├── ecosystem.config.js # PM2 configuration
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # Documentation
-
Run the bot separately:
npm run bot
-
Run Next.js separately:
npm run start
-
TypeScript type checking:
npx tsc --noEmit
-
Code formatting (if using Prettier):
npx prettier --write .
This project is licensed under the MIT License. See the LICENSE file for details.
- Report bugs or suggest improvements via Issues.
- Submit Pull Requests with fixes or new features.