How ston-fi/sdk works
Main Components
A. SDK Core Layer (packages/sdk):
• Client Module
• Contract Implementations
• DEX Contracts (v1, v2.1, v2.2)
• Farm Contracts (v1, v2, v3)
• pTON Contracts
• Utility Functions
• Test Utils
B. Example Application Layer (examples/next-js-app):
• Frontend Components
• API Integration
• Wallet Integration
• Swap Implementation
• Vault Implementation
┌─────────────────────────────────────────────┐
• Client Application │
• (Next.js Frontend + Application Logic) │
• ┤
• SDK Interface │
• (Client Module + Contract Abstractions) │
• ┤
• Smart Contracts Layer │
• (DEX, Farm, pTON Contract Implementations) │
• ┤
• Blockchain Layer │
• (TON Network Interface) │
• ┘
Detailed Component Breakdown
A. Frontend Layer (Blue):
• Components: Swap, Vault, UI Elements
• Hooks and Queries
• State Management
• Wallet Integration
B. SDK Interface (Green):
• Client Module
• Contract Abstractions
• Utility Functions
• Type Definitions
C. Smart Contracts (Orange):
• DEX Contracts (Multiple Versions)
• Farm Contracts
• pTON Contracts
• Router Implementations
Key Interactions to Highlight
• Frontend → SDK: Contract calls and transactions
• SDK → Smart Contracts: Method calls and state changes
• Smart Contracts → Blockchain: State updates and events
• Wallet → Frontend: User authentication and signatures
Additional Elements
• Version indicators for different contract implementations
• Data flow directions between components
• Integration points with external services
• Error handling and fallback paths
Implementation Notes
• Maintain consistent spacing and alignment
• Brief descriptions for complex interactions
• Creating separate detailed views for specific features (swap, vault, farming)