Skip to content

gugupay/gugupay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

79 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gugupay

Gugupay is a decentralized payment solution on the Sui blockchain that enables merchants to easily receive payments from customers via QR codes. Customers can pay directly with their Sui wallet using Sui tokens, which are automatically converted to stablecoin-equivalent amounts based on live exchange rates from the Pyth oracle. This approach removes the need for customers to hold stablecoins, simplifying the payment process while ensuring the merchant receives a stable value. With Gugupay, merchants can offer a seamless, crypto-based payment method that's accessible and straightforward for customers.

πŸ—οΈ Project Structure

This monorepo contains three main components:

gugupay2/
β”œβ”€β”€ contracts/      # Sui Move smart contracts
β”œβ”€β”€ sdk/           # TypeScript SDK for developers
β”œβ”€β”€ web/           # Web application (Astro + Svelte + React)
└── package.json   # Monorepo workspace configuration

πŸ“¦ Components

1. Smart Contracts (/contracts)

Sui Move smart contracts built with Pyth Network integration for real-time price feeds.

Key Features:

  • Shared object design for scalability
  • Merchant registration and management
  • Invoice creation with USD pricing
  • Automatic SUI/USD conversion using Pyth oracles
  • Payment processing and balance withdrawal
  • Real-time payment events

Tech Stack:

  • Sui Move (2024 edition)
  • Pyth Network oracle integration
  • Wormhole for cross-chain messaging

Commands:

cd contracts
sui move build        # Build contracts
sui move test         # Run tests
sui client publish    # Deploy to network

View detailed contract documentation β†’

2. SDK (/sdk)

TypeScript SDK for integrating Gugupay payments into applications.

Key Features:

  • Simple API for merchant and invoice management
  • Automatic price conversion using Pyth
  • Support for testnet and mainnet
  • Type-safe interfaces
  • Real-time price updates from Hermes

Installation:

npm install @gugupay/sdk

Quick Example:

import { GugupayClient } from '@gugupay/sdk';

const client = new GugupayClient('testnet');
const txb = new Transaction();

// Create merchant
await client.createMerchantObject({
  txb,
  name: 'My Shop',
  imageURL: 'https://example.com/logo.png',
  callbackURL: 'https://myshop.com/callback',
  description: 'My awesome shop'
});

// Create invoice
await client.createInvoice({
  txb,
  merchantId: 'merchant_id',
  amount_usd: 10.0,
  description: 'Product purchase'
});

Tech Stack:

  • TypeScript
  • @mysten/sui SDK
  • @pythnetwork/pyth-sui-js

Commands:

npm run sdk:build    # Build SDK

View detailed SDK documentation β†’

3. Web Application (/web)

Modern web application providing merchant dashboard and payment interface.

Key Features:

  • Merchant dashboard for managing payments
  • QR code generation for payment links
  • Real-time payment status updates
  • Wallet integration (Sui wallets)
  • Documentation site built-in
  • Mobile-responsive payment interface

Tech Stack:

  • Astro 4.x (Static site generation)
  • Svelte 5.x (UI components)
  • React 18.x (Some components)
  • TailwindCSS + DaisyUI (Styling)
  • Starlight (Documentation)
  • Mersui (Sui wallet integration)

Pages:

  • / - Landing page
  • /app - Merchant dashboard
  • /pay - Payment interface
  • /donate - Donation page with Mersui integration
  • /docs - Full documentation

Commands:

npm run web          # Start dev server
npm run web:build    # Build for production

View web application README β†’

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Sui CLI (for contract development)
  • Git

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/gugupay2.git
cd gugupay2
  1. Install dependencies:
npm install
  1. Build the SDK:
npm run sdk:build
  1. Start the web application:
npm run web

The web app will be available at http://localhost:4321

πŸ”§ Development Workflow

Working with Smart Contracts

cd contracts
sui move build
sui move test

Working with SDK

npm run sdk:build     # Build SDK after changes

Working with Web App

npm run web           # Hot reload enabled

πŸ“š Documentation

🌐 Environment Variables

SDK & Contracts

Key environment variables are defined in:

  • sdk/src/const.ts - SDK constants
  • contracts/README.md - Contract addresses

Web Application

Create .env in the web/ directory:

# See web/.env.example for required variables

πŸ› οΈ Tech Stack Summary

Component Technologies
Blockchain Sui, Pyth Oracle, Wormhole
Smart Contracts Sui Move
SDK TypeScript, @mysten/sui
Frontend Astro, Svelte, React, TailwindCSS
UI Framework DaisyUI
Wallet Mersui, @suiet/wallet-sdk
Documentation Starlight

πŸ›οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Web Application (Astro)           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Merchant Dashboard  β”‚  Payment UI  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Gugupay SDK (TypeScript)           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Client API  β”‚  Type Definitions    β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Sui Blockchain + Smart Contracts        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Payment Store  β”‚  Merchants β”‚ Inv. β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Pyth Oracle (Price Feeds)           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🀝 Contributing

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

πŸ“„ License

Apache-2.0

πŸ”— Links

About

Makes crypto payment simple, secure, decentralized, and possible for all merchants.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •