Lasagna Finance CLI Demo

Welcome to Lasagna Finance CLI documentation! This guide will help you understand and use the Lasagna Finance CLI for testing Liquid Staking Token (LST) arbitrage opportunities on Solana.

Table of Contents

  1. Installation

  2. Quick Start

  3. Core Features

  4. Command Reference

  5. Development Guide

  6. Troubleshooting

  7. API Reference

1. Installation

Prerequisites

  • Node.js v16 or higher

  • npm v7 or higher

  • Solana CLI tools (optional, for local validator testing)

Install via npm

npm install -g @lasagna-finance/cli

Verify Installation

lasagna --version

2. Quick Start

Initial Setup

# Initialize CLI
lasagna init

# Create or import wallet
lasagna wallet create

# For devnet testing, get some test SOL
lasagna wallet airdrop

Basic Usage Example

# Check wallet balance
lasagna wallet balance

# Deposit LSTs
lasagna staking deposit

# Monitor your portfolio
lasagna portfolio

3. Core Features

Wallet Management

  • Create new wallets

  • Import existing wallets

  • Check balances

  • Request airdrops (devnet only)

LST Operations

  • Deposit stSOL and mSOL

  • Track staking rewards

  • Auto-compound rewards

  • Optimize APY across pools

Portfolio Management

  • Real-time balance tracking

  • APY monitoring

  • Reward calculations

  • Performance analytics

Arbitrage Features

  • Real-time price monitoring

  • Automated opportunity detection

  • APY comparison across protocols

  • Transaction simulation

4. Command Reference

Global Options

  • --help: Display help information

  • --version: Show CLI version

  • --network: Specify network (mainnet, devnet, localnet)

Wallet Commands

# Create new wallet
lasagna wallet create

# Check balance
lasagna wallet balance

# Request airdrop (devnet)
lasagna wallet airdrop --amount 1

Staking Commands

# Deposit LSTs
lasagna staking deposit

# Withdraw LSTs
lasagna staking withdraw

# Check and claim rewards
lasagna staking rewards

Portfolio Commands

# View portfolio summary
lasagna portfolio

# Check specific token details
lasagna portfolio --token stSOL

Monitor Commands

# Start monitoring prices
lasagna monitor start

# Set custom alert thresholds
lasagna monitor --threshold 0.5

5. Development Guide

Local Setup

# Clone repository
git clone https://github.com/lasagna-finance/cli.git
cd lasagna-finance-cli

# Install dependencies
npm install

# Build from source
npm run build

# Run tests
npm test

Testing with Local Validator

# Start local validator
solana-test-validator

# Run CLI with local network
lasagna init --network localnet

Environment Configuration

Create a .env file:

NETWORK=devnet
RPC_URL=https://api.devnet.solana.com

6. Troubleshooting

Common Issues

Connection Issues

Error: Unable to connect to network
Solution: Check network selection and RPC endpoint

Transaction Errors

Error: Transaction simulation failed
Solution: Ensure sufficient SOL for fees

Wallet Issues

Error: Wallet not found
Solution: Run 'lasagna wallet create' or import existing wallet

Debug Mode

# Run with debug logging
DEBUG=lasagna* lasagna command

7. API Reference

Program Accounts

Vault Account

interface VaultAccount {
    authority: PublicKey;
    totalDeposited: number;
    totalRewards: number;
}

User State

interface UserState {
    deposited: number;
    rewards: number;
    lastUpdate: number;
}

Transaction APIs

Deposit Function

async function deposit(
    amount: number,
    token: 'stSOL' | 'mSOL'
): Promise<string>

Withdraw Function

async function withdraw(
    amount: number,
    token: 'stSOL' | 'mSOL'
): Promise<string>

Contributing

Development Process

  1. Fork the repository

  2. Create feature branch

  3. Submit pull request

  4. Pass CI/CD checks

Code Style

  • Follow TypeScript best practices

  • Use Prettier for formatting

  • Write unit tests for new features

Last updated