Skip to content

unicitynetwork/sphere

Repository files navigation

Unicity AgentSphere

A multifunctional Web3 platform with integrated crypto wallet, specialized AI agents, and P2P functionality.

Overview

Unicity AgentSphere is a modern decentralized application built on the concept of "agents" β€” specialized AI interfaces for various activities: sports betting, gaming, merchandise shopping, P2P crypto trading, trivia, direct messaging, and AI assistance.

Key Features

πŸ€– Agent System

  • Chat Agent β€” direct and group messaging via Nostr protocol
  • AI Assistant (Viktor) β€” uncensored LLM with internet access
  • Trivia Agent β€” quiz games with score tracking
  • P2P Gaming β€” gaming platform (Quake arena, crypto poker)
  • Sports Betting β€” sports event betting with history tracking
  • OTC Trading β€” P2P cryptocurrency trading
  • Merch Store β€” merchandise store with order management

πŸ’° Multi-Layer Wallet

Layer 1 (L1) β€” base blockchain layer:

  • Wallet creation and management
  • Transaction history
  • Vesting selector
  • Password protection
  • Bridge between layers

Layer 3 (L3) β€” application-specific rollup:

  • Fast, low-cost transactions
  • Token management
  • Direct transfers
  • Incoming payment notifications

Additional Features:

  • Nametag system (@username identification)
  • Wallet switching
  • QR codes for receiving payments
  • Seed phrase management
  • Real-time market data

πŸ” Security

  • Cryptographic identification
  • Transaction signing via elliptic curve cryptography
  • PIN-based session protection
  • Decentralized messaging (Nostr protocol)
  • Secure seed phrase storage

Tech Stack

Frontend

  • React 19 with TypeScript
  • Vite 7 β€” build tool and HMR
  • Tailwind CSS 4 β€” styling
  • Framer Motion β€” animations
  • React Router DOM v7 β€” routing
  • TanStack React Query v5 β€” server state management

Web3 / Crypto

  • Unicity Labs State Transition SDK β€” blockchain interaction
  • Nostr JS SDK β€” decentralized messaging
  • BIP39 β€” seed phrase generation
  • Elliptic β€” cryptography
  • CryptoJS β€” encryption

Utilities

  • Axios β€” HTTP client
  • Lucide React β€” icons
  • UUID β€” identifier generation
  • QR Code Styling β€” QR code generation

Installation and Setup

Requirements

  • Node.js 18+
  • npm or yarn

Install Dependencies

npm install

Run Development Server

npm run dev

The application will be available at http://localhost:5173

Build for Production

npm run build

Preview Production Build

npm run preview

Lint Code

npm run lint

Environment Variables

Create a .env file in the project root:

# Agent mode (mock/real)
VITE_USE_MOCK_AGENTS=true

# Backend API URL
VITE_AGENT_API_URL=https://api.example.com

# Base path for deployment
BASE_PATH=/

Project Structure

src/
β”œβ”€β”€ components/          # React components
β”‚   β”œβ”€β”€ agents/         # Agent components
β”‚   β”‚   β”œβ”€β”€ shared/     # Reusable chat components
β”‚   β”‚   └── [specific]  # AIChat, SportChat, P2PChat, etc.
β”‚   β”œβ”€β”€ wallet/         # Multi-layer wallet
β”‚   β”‚   β”œβ”€β”€ L1/         # Layer 1 components
β”‚   β”‚   β”œβ”€β”€ L3/         # Layer 3 components
β”‚   β”‚   └── shared/     # Shared utilities
β”‚   β”œβ”€β”€ chat/           # Messaging system
β”‚   β”œβ”€β”€ auth/           # Authentication
β”‚   β”œβ”€β”€ layout/         # Page layouts
β”‚   β”œβ”€β”€ theme/          # Theme management
β”‚   └── splash/         # Loading screen
β”œβ”€β”€ pages/              # Application pages
β”œβ”€β”€ hooks/              # Custom React hooks
β”œβ”€β”€ config/             # Configuration (agent definitions)
β”œβ”€β”€ types/              # TypeScript types
β”œβ”€β”€ data/               # Mock data
β”œβ”€β”€ repositories/       # Data access layer
β”œβ”€β”€ utils/              # Helper functions
└── assets/             # Static resources

Responsive Design

Mobile (< 1024px)

  • Swipeable tab interface (chat/wallet)
  • Optimized keyboard handling
  • Touch-friendly elements

Desktop (β‰₯ 1024px)

  • Grid layout with agent picker, chat, and wallet
  • Sidebars with additional information
  • Extended navigation capabilities

Core Components

Agent Architecture

Each agent is a specialized interface:

interface IAgent {
  id: string;
  name: string;
  icon: string;
  description: string;
  activityId?: string; // For backend integration
}

State Management

  • Server State: TanStack Query
  • UI State: React hooks (useState, useRef)
  • Theme State: Context API
  • Persistent State: localStorage

Real-time Features

  • WebSocket via Nostr for chat
  • Automatic wallet balance updates
  • Market data refresh (60 sec intervals)
  • Automatic incoming transfer detection

User Flow

  1. Splash Screen β†’ IntroPage
  2. Authentication β†’ WalletGate (create/import wallet)
  3. Dashboard β†’ Agent selection
  4. Interaction β†’ Chat interface with optional sidebar
  5. Wallet β†’ L1/L3 management, transfers
  6. Direct Messages β†’ Real-time communication
  7. Marketplace β†’ Shopping, trading, betting, gaming

Development Features

Performance Optimization

  • Query caching via React Query
  • Debounced scroll detection
  • Memoization with Framer Motion
  • Lazy component mounting
  • LocalStorage for offline access

Security

  • Cryptographic key management
  • Transaction signing
  • PIN session authentication
  • Identity verification via Unicity SDK

License

Private project

Contact

For questions and suggestions, please contact the Unicity Labs development team.


Built with React, TypeScript, Vite, and Unicity SDKs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages