How mirrorworld-universe/sonic-code-examples works
Main Components
• Sonic Blockchain: At the core, all these examples interact with the Sonic blockchain. Represent this as the central external service.
• Typescript-based Code Examples: These include:
• Basic Sonic Operations (fetching balances, sending transactions, memo programs, priority fees, and gRPC interactions)
• SPL Token Operations (minting and transferring SPL tokens, fetching token balances)
• NFT Operations (minting NFTs using Metaplex)
• Pyth Integration (fetching price feeds from the Pyth network)
• Agent Kit (demonstrating AI agent interactions with onchain actions)
• Rust-based Code Examples:
• Rush ECS Framework Examples – illustrating game development examples (including the “position” blueprint for storing/updating entity positions)
Out the Relationships and Interactions
• For the TypeScript side, create blocks for “Basic Operations”, “SPL Token”, “NFT”, “Pyth Integration”, and “Agent Kit”. Each block should display how they send/receive data or commands to/from the Sonic blockchain (e.g., using RPC endpoints as configured via environment variables).
• For the Rust example, illustrate the “Rush ECS Framework” as a separate component that also connects to the Sonic blockchain. Within this, show a sub-component like “Position Blueprint”, representing an example of onchain game state management.
• External dependencies where applicable—for example, the Pyth Network (for price feeds) or external API keys used in the Agent Kit (e.g., OpenAI API).
Architectural Patterns & Design Principles
• Clearly separate the concerns between the TypeScript examples and Rust (Rush ECS) examples.
• That while this project is not a traditional full-stack application with separate “frontend” and “backend” layers, it still touches on separation of concerns by having distinct modules for each type of operation.
• Reusability and modular design: each sample is self-contained and demonstrates a particular capability or integration, which aids extensibility for developers.
Relevant Technologies
• Technologies like Node.js (for executing TypeScript examples, npm management, ts-node execution), Rust (with Cargo for build and dependency management), and associated configuration (like .env for RPC_URL, keys) should be noted.
• Mention integration points like gRPC (for real‑time account updates) and external services (Pyth, OpenAI for Agent Kit).
• To one side, arrange the TypeScript examples by grouping them as:
• Basic Operations (with sub-items: fetch balance, send transaction, memo program, add priority fees, gRPC interaction)
• SPL Token Operations (mint SPL token, send SPL token, fetch token balance)
• NFT Operations (mint NFT)
• Pyth Integration (get price feed)
• Agent Kit (AI agent example)
• A “Rush Quickstart” for general ECS and a “Position Blueprint” submodule (as shown by the directories under rust/rush/)
• Use callouts to indicate technology stacks (e.g., “Node.js, TypeScript, ts-node” for the TS examples, “Rust, Cargo” for the Rush sample)