Expand description
§Tensora Rust SDK
tensora-rs is the official Rust SDK for the Tensora L2 AI Network.
Built on the OP Stack with BSC (BNB Chain) as L1 settlement layer.
§Features
- Typed contract bindings for TORA token, staking, subnets, and bridge
- Wallet abstraction supporting local keypairs and external signers
- Bridge helpers for L1↔L2 WTORA deposits and withdrawals
- API clients for off-chain services (indexer, explorer, coordinator)
- Async-safe with retry logic and BSC reorg handling
§Quick Start
use tensora::prelude::*;
use ethers::types::Address;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Load configuration from environment
let config = TensoraConfig::from_env()?;
// Create client
let client = TensoraClient::new(&config).await?;
// Get balance
let addr: Address = "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb".parse()?;
let balance = client.get_balance(addr).await?;
println!("Balance: {} BNB", balance);
Ok(())
}§Configuration
Set these environment variables or use a .env file:
TENSORA_RPC=https://rpc.tensora.sh
TENSORA_CHAIN_ID=44444444
BSC_RPC=https://bsc-dataseed.binance.org
PRIVATE_KEY=0x... # Optional, for signing transactionsRe-exports§
pub use ethers;
Modules§
- api
- API clients for off-chain Tensora services
- client
- Tensora client for interacting with the L2 network
- config
- Configuration management for Tensora SDK
- contracts
- Smart contract bindings for Tensora L2
- errors
- Error types for the Tensora SDK
- prelude
- Re-export commonly used types
- types
- Shared types for the Tensora SDK
- wallet
- Wallet and signer abstraction for Tensora SDK