[dependencies] solana-oasis-sdk = "0.1.0"
npm install @solana-oasis/sdk
// 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); }
// 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?;
// 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?;
// 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 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); } }