📓 Sacred SDK Grimoire

🗝️ Installation Ritual

Cargo

[dependencies]
solana-oasis-sdk = "0.1.0"

npm

npm install @solana-oasis/sdk

⚔️ Quick Start Incantation

// Initialize the SDK
use solana_oasis_sdk::OasisClient;

#[tokio::main]
async fn main() {
    // Create a new client
    let client = OasisClient::new(
        "Coming Soon",  // RPC endpoint
        "your-private-key"
    ).await?;

    // Submit an AI computation
    let result = client
        .compute()
        .model("gpt-4")
        .input("Analyze this text...")
        .execute()
        .await?;

    println!("Result: {:?}", result);
}

⛧ Core Features

Computation

  • AI model access
  • Batch processing
  • Result verification

Bridge

  • Asset transfers
  • Message passing
  • State syncing

State

  • State queries
  • Proof generation
  • State updates

⚡ Sacred Incantations

Bridge Operations

// Bridge asset transfer
let bridge = client.bridge();

// Deposit assets
let deposit = bridge
    .deposit()
    .amount(1000000000)
    .token("SOL")
    .destination("0x...")
    .execute()
    .await?;

// Withdraw assets
let withdrawal = bridge
    .withdraw()
    .amount(1000000000)
    .token("SOL")
    .execute()
    .await?;

State Management

// Query state
let state = client
    .state()
    .get_latest()
    .await?;

// Generate proof
let proof = client
    .state()
    .generate_proof(state_root)
    .await?;

// Verify state
let valid = client
    .state()
    .verify_proof(proof)
    .await?;

AI Computation

// Submit computation
let computation = client
    .compute()
    .model("gpt-4")
    .input("Analyze market data...")
    .params(ComputeParams {
        temperature: 0.7,
        max_tokens: 100,
    })
    .execute()
    .await?;

// Get computation result
let result = client
    .compute()
    .get_result(computation.id)
    .await?;

🌒 Error Handling

// Error handling example
match client.compute().execute().await {
    Ok(result) => {
        println!("Computation successful: {:?}", result);
    }
    Err(OasisError::ComputeError(e)) => {
        eprintln!("Computation failed: {}", e);
    }
    Err(OasisError::NetworkError(e)) => {
        eprintln!("Network error: {}", e);
    }
    Err(e) => {
        eprintln!("Other error: {}", e);
    }
}