2 unstable releases
| 0.2.0 | Dec 7, 2025 |
|---|---|
| 0.1.1 | Dec 6, 2025 |
#9 in #amm
82KB
1K
SLoC
Yieldin CLI
Command-line interface for interacting with the Yieldin Protocol - a unified liquidity pool on Solana.
Features
- Direct Pool Operations: Deposit, withdraw, and swap tokens through the Yieldin pool
- Token-2022 Support: Native support for Token-2022 LP tokens with transfer fees
- Full Anchor SDK Integration: Type-safe program interaction
- User-Friendly: Interactive prompts and detailed transaction feedback
- Security: Comprehensive on-chain validations for platform verification
Coming Soon
- Magic Swap: Intelligent routing via Jupiter aggregator
- Magic Add: Simplified liquidity provision with auto-calculations
- Magic Remove: Optimized liquidity withdrawal
Installation
cd cli
cargo build --release
The binary will be at target/release/yieldin.
You can add it to your PATH:
sudo cp target/release/yieldin /usr/local/bin/
Quick Start
1. Initialize Configuration
yieldin init --rpc-url https://api.mainnet-beta.solana.com --wallet ~/.config/solana/id.json
This creates a config file at ~/.config/yieldin/config.toml with your settings.
2. Check Pool Information
yieldin info
View detailed pool statistics:
yieldin info --detailed
Commands
Basic Operations
Deposit
Deposit tokens into the pool and receive LP tokens:
yieldin deposit --token <TOKEN_MINT> --amount 100 --min-lp 99
Example with full token address:
yieldin deposit --token 9QFCh8z1s6u4zm959wyBvW8VtNcZGfEHnRzYub33bonk --amount 10
Withdraw
Burn LP tokens and receive underlying tokens:
yieldin withdraw --amount 100 --token <TOKEN_MINT> --min-out 99
Example:
yieldin withdraw --token 9QFCh8z1s6u4zm959wyBvW8VtNcZGfEHnRzYub33bonk --amount 1
Swap
Exchange one token for another through the pool (two transactions: deposit + withdraw):
yieldin swap --from <FROM_MINT> --to <TO_MINT> --amount 100 --min-out 98
Example:
yieldin swap \
--from 9QFCh8z1s6u4zm959wyBvW8VtNcZGfEHnRzYub33bonk \
--to 8jFvTLps7uBigKoXMH8FVRDmSvetGvB5ivUVzphBBAGS \
--amount 10
Note: Swap executes as two transactions (deposit → withdraw) and applies fees on both operations.
Coming Soon Features
The following "magic" commands are planned for future releases:
Magic Swap
Intelligent swap routing with Jupiter integration for best execution across all Solana DEXs.
Magic Add Liquidity
Simplified deposit with automatic calculations and preview confirmation.
Magic Remove Liquidity
Optimized withdrawal with best execution and proportional distribution options.
Configuration
Config File Location
Default: ~/.config/yieldin/config.toml
Override with --config flag:
yieldin --config /path/to/config.toml info
Config File Format
rpc_url = "https://api.mainnet-beta.solana.com"
wallet_path = "/home/user/.config/solana/id.json"
program_id = "8DVcjWUSBobmb4b3wdEksb9jwoxfUC55nzkky3u8s4qW"
pool_state = "6k3KnkaRUwdxEGr165CFVMEeAL2eWsoyGoqKWepX8KWV"
CLI Overrides
Override config values with CLI flags:
yieldin --rpc-url https://api.devnet.solana.com --wallet /path/to/wallet.json info
Advanced Usage
Custom RPC Endpoint
yieldin --rpc-url https://your-private-rpc.com swap --from <FROM> --to <TO> --amount 100
Different Wallet
yieldin --wallet /path/to/other-wallet.json deposit --token <MINT> --amount 50
Verbose Logging
Enable debug logs for troubleshooting:
yieldin --verbose magic-swap --from <FROM> --to <TO> --amount 100
Examples
Complete Workflow
-
Check your balance and pool info:
yieldin info --detailed -
Deposit tokens into the pool:
yieldin deposit --token 9QFCh8z1s6u4zm959wyBvW8VtNcZGfEHnRzYub33bonk --amount 10 -
Swap between registered tokens:
yieldin swap \ --from 9QFCh8z1s6u4zm959wyBvW8VtNcZGfEHnRzYub33bonk \ --to 8jFvTLps7uBigKoXMH8FVRDmSvetGvB5ivUVzphBBAGS \ --amount 5 \ --min-out 0 -
Withdraw LP tokens:
yieldin withdraw --token 9QFCh8z1s6u4zm959wyBvW8VtNcZGfEHnRzYub33bonk --amount 1
Program Details
- Program ID:
8DVcjWUSBobmb4b3wdEksb9jwoxfUC55nzkky3u8s4qW - Pool State:
6k3KnkaRUwdxEGr165CFVMEeAL2eWsoyGoqKWepX8KWV - LP Mint (Token-2022):
m1nJUGyKZEjREJQ755EetM1boJsnFXFF7orRwQTbNPB- Metadata: "yieldin' 24/7"
Integration
Jupiter Aggregator
Magic swap uses Jupiter's V6 API for intelligent routing:
- Quote API:
https://quote-api.jup.ag/v6/quote - Swap API:
https://quote-api.jup.ag/v6/swap
Solana RPC
Default RPC: https://api.mainnet-beta.solana.com
For production usage, consider using a private RPC provider for better reliability:
- Helius
- Triton
- QuickNode
- Alchemy
Development
Build from Source
git clone https://github.com/atlantictechguy/yieldin.git
cd yieldin/cli
cargo build --release
Run Tests
cargo test
Code Structure
cli/
├── src/
│ ├── main.rs # CLI entry point and command routing
│ ├── config.rs # Configuration management
│ ├── client/ # Anchor client wrapper
│ │ └── mod.rs
│ ├── commands/ # Command implementations
│ │ ├── deposit.rs
│ │ ├── withdraw.rs
│ │ ├── swap.rs
│ │ ├── info.rs
│ │ └── magic/ # Magic functions
│ │ ├── swap.rs
│ │ ├── add_liquidity.rs
│ │ └── remove_liquidity.rs
│ └── jupiter/ # Jupiter integration
│ ├── mod.rs
│ └── client.rs
└── Cargo.toml
Troubleshooting
"Failed to read wallet keypair"
Ensure your wallet file exists and is readable:
ls -la ~/.config/solana/id.json
"Failed to fetch pool state"
Check your RPC connection:
yieldin --rpc-url https://api.mainnet-beta.solana.com info
"Insufficient funds"
Ensure you have:
- Tokens in your wallet for the operation
- SOL for transaction fees (~0.005 SOL per transaction)
Jupiter integration issues
If magic swap fails with Jupiter, try direct pool routing:
yieldin magic-swap --from <FROM> --to <TO> --amount 100 --use-jupiter false
Security
⚠️ Important Security Notes:
- Wallet Protection: Never commit or share your wallet keypair files
- Config Security: Config file may contain sensitive paths - keep secure
- Transaction Review: Always review transaction details before confirming
- Slippage Settings: Use appropriate slippage for market conditions
- RPC Privacy: Consider using private RPC endpoints for sensitive operations
License
Apache-2.0
Support
- Documentation: Main README
- Issues: GitHub Issues
- Protocol Docs: See
../docs/for technical specifications
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
See main project README for contribution guidelines.
Dependencies
~63–87MB
~1.5M SLoC