Skip to content

abalshakou/solana-actions

Repository files navigation

Project: Next.js + Telegram Bot with Solana Actions

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.


📋 Table of Contents

  1. Features
  2. Technologies
  3. Installation
  4. Running the Project
  5. Solana Actions API Integration
  6. Project Structure
  7. Additional Commands
  8. License

🌟 Features

  • 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 or PM2.

🛠 Technologies


🚀 Installation

  1. Clone the repository:

    git clone https://github.com/your-username/your-repo.git
    cd your-repo
  2. Install dependencies:

    npm install
  3. 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

🏃 Running the Project

Development

To run in development mode:

npm run dev

Production

  1. Build the project:

    npm run build
  2. 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

🔗 Solana Actions API Integration

The project uses the Solana Web3.js library to interact with the Solana blockchain. Here are the key functionalities:

1. Send Transactions

  • The Solana Action can send SOL tokens from one wallet to another.
  • Example command:
    action=solana-action:http://localhost:3000/api/actions/donate
    

📂 Project Structure

.
├── 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

🛠 Additional Commands

  • 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 .

📄 License

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


🤝 Contributing

  1. Report bugs or suggest improvements via Issues.
  2. Submit Pull Requests with fixes or new features.

About

Website demonstrate how works solana actions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published