Skip to content

dmitro3/telegram-mini-app-aa

Β 
Β 

Repository files navigation

πŸͺ„ Welcome to Telegram Super dApp Account Abstraction Magic! πŸͺ„

Transforming Telegram into a seamless blockchain hub with our Account Abstraction Magic SDK β€” making crypto asset management effortless, secure, and gas-free for everyone

Table of Contents

Features

  • πŸ’Ό Custodial Wallet: Created and securely stored in Azure Key Vault.
  • πŸ”‘ Smart Accounts: Auto-creation using ERC-4337 account abstraction.
  • ⚑️ Mint NFTs: Easily mint NFTs with a single tap.
  • πŸ’Έ No Gas Fees: Gasless transactions facilitated by advanced transaction management.
  • 🏦 Token and NFT Management: Simple and secure transfers and swaps of tokens and NFTs.
  • 🌐 View NFTs: NFTs displayed directly in the app wallet.
  • πŸ”„ Built-in Token Swap: Powered by Uniswap for seamless token exchanges.
  • πŸ“² Developer Friendly SDK: Facilitates further integration and development.

Screenshots

photo_2024-06-10 21 11 07-imageonline co-merged photo_2024-06-10 21 11 16-imageonline co-merged

Installation

  1. Clone the repository:

    git clone https://github.com/andreykobal/telegram-mini-app-aa.git
  2. Navigate to the project directory:

    cd telegram-mini-app-aa
  3. Install dependencies for the frontend:

    npm install
  4. Install dependencies for the backend:

    cd ../backend
    npm install

Usage

  1. Start the backend server:

    cd backend
    npm start
  2. Start the frontend application:

    cd ..
    npm start
  3. Open your browser and navigate to http://localhost:3000

API Endpoints

POST /authenticate

  • Description: Authenticate a user using Telegram init data.
  • Request Body:
    {
      "initData": "string"
    }

POST /mint

  • Description: Mint a new NFT.
  • Request Body:
    {
      "initData": "string"
    }

POST /transfer

  • Description: Transfer an NFT to another address.
  • Request Body:
    {
      "initData": "string",
      "tokenId": "string",
      "toAddress": "string"
    }

POST /getNFTs

  • Description: Retrieve NFTs owned by the authenticated user.
  • Request Body:
    {
      "initData": "string"
    }

POST /sendETH

  • Description: Send ETH to another address.
  • Request Body:
    {
      "initData": "string",
      "toAddress": "string",
      "amount": "string"
    }

POST /getBalances

  • Description: Retrieve balances of the authenticated user's wallet.
  • Request Body:
    {
      "initData": "string"
    }

POST /getUsdtToUsdcRate

  • Description: Fetch the swap rate from USDT to USDC.
  • Request Body:
    {
      "amount": "string"
    }

POST /getUsdcToUsdtRate

  • Description: Fetch the swap rate from USDC to USDT.
  • Request Body:
    {
      "amount": "string"
    }

POST /getUsdtToWethRate

  • Description: Fetch the swap rate from USDT to WETH.
  • Request Body:
    {
      "amount": "string"
    }

POST /getWethToUsdtRate

  • Description: Fetch the swap rate from WETH to USDT.
  • Request Body:
    {
      "amount": "string"
    }

POST /getUsdcToWethRate

  • Description: Fetch the swap rate from USDC to WETH.
  • Request Body:
    {
      "amount": "string"
    }

POST /getWethToUsdcRate

  • Description: Fetch the swap rate from WETH to USDC.
  • Request Body:
    {
      "amount": "string"
    }

POST /swapUsdtToUsdc

  • Description: Swap USDT to USDC.
  • Request Body:
    {
      "initData": "string",
      "amount": "string"
    }

POST /swapUsdcToUsdt

  • Description: Swap USDC to USDT.
  • Request Body:
    {
      "initData": "string",
      "amount": "string"
    }

POST /swapUsdtToWeth

  • Description: Swap USDT to WETH.
  • Request Body:
    {
      "initData": "string",
      "amount": "string"
    }

POST /swapWethToUsdt

  • Description: Swap WETH to USDT.
  • Request Body:
    {
      "initData": "string",
      "amount": "string"
    }

POST /swapUsdcToWeth

  • Description: Swap USDC to WETH.
  • Request Body:
    {
      "initData": "string",
      "amount": "string"
    }

POST /swapWethToUsdc

  • Description: Swap WETH to USDC.
  • Request Body:
    {
      "initData": "string",
      "amount": "string"
    }

POST /webhook

  • Description: Handle Telegram webhook events.

Folder Structure

.
β”œβ”€β”€ .gitignore
β”œβ”€β”€ backend
β”‚   β”œβ”€β”€ .gitignore
β”‚   β”œβ”€β”€ index.js
β”‚   β”œβ”€β”€ metadata.json
β”‚   β”œβ”€β”€ models
β”‚   β”‚   β”œβ”€β”€ MetadataIndex.js
β”‚   β”‚   └── User.js
β”‚   β”œβ”€β”€ nft.js
β”‚   β”œβ”€β”€ package-lock.json
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ swap.js
β”‚   β”œβ”€β”€ test-swap-copy.js
β”‚   β”œβ”€β”€ test-swap.js
β”‚   β”œβ”€β”€ utils
β”‚   β”‚   β”œβ”€β”€ delete-all-users.js
β”‚   β”‚   β”œβ”€β”€ delete-user.js
β”‚   β”‚   └── get-all-users.js
β”‚   β”œβ”€β”€ webhook.js
β”‚   └── WETH9.json
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
β”œβ”€β”€ public
β”‚   β”œβ”€β”€ favicon.ico
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ logo192.png
β”‚   β”œβ”€β”€ logo512.png
β”‚   β”œβ”€β”€ manifest.json
β”‚   └── robots.txt
β”œβ”€β”€ README.md
└── src
    β”œβ”€β”€ App.css
    β”œβ”€β”€ App.js
    β”œβ”€β”€ App.test.js
    β”œβ”€β”€ balance.js
    β”œβ”€β”€ Buy.js
    β”œβ”€β”€ client.js
    β”œβ”€β”€ CustomSelect.css
    β”œβ”€β”€ CustomSelect.js
    β”œβ”€β”€ EthToUsdConverter.js
    β”œβ”€β”€ Home.js
    β”œβ”€β”€ icons
    β”œβ”€β”€ index.css
    β”œβ”€β”€ index.js
    β”œβ”€β”€ logo.svg
    β”œβ”€β”€ reportWebVitals.js
    β”œβ”€β”€ setupTests.js
    └── Swap.js

Technologies Used

  • Frontend: React
  • Backend: Node.js, Express
  • Database: MongoDB
  • Blockchain: Hardhat, Viem, Biconomy, Base
  • Hosting: Azure, Vercel

Contributing

Contributions are welcome! Please read the contributing guidelines first.

License

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

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 84.5%
  • CSS 13.4%
  • Dockerfile 1.2%
  • HTML 0.9%