Crate lighter_rs

Crate lighter_rs 

Source
Expand description

§Lighter RS

A comprehensive Rust SDK for the Lighter Protocol trading application blockchain.

This library provides all necessary functionality for trading on Lighter, including:

  • Cryptographic signing and key management
  • Transaction construction and validation
  • HTTP client for API interactions
  • Type-safe transaction types for all supported operations

§Modules

  • constants: Core constants and limits used throughout the protocol
  • signer: Cryptographic key management and signing functionality
  • types: Transaction types and request builders
  • client: HTTP client for API interactions
  • errors: Error types and handling

§Example

use lighter_rs::client::TxClient;
use lighter_rs::types::CreateOrderTxReq;

// Create a transaction client
let tx_client = TxClient::new(
    "https://api.lighter.xyz",
    "your_api_key_hex",
    12345,  // account_index
    0,      // api_key_index
    1,      // chain_id
)?;

// Create and submit an order
// let order = CreateOrderTxReq { ... };
// let result = tx_client.create_order(&order, None).await?;

Re-exports§

pub use client::TxResponse;
pub use errors::LighterError;
pub use errors::Result;
pub use signer::KeyManager;
pub use signer::Signer;
pub use types::TransactOpts;
pub use types::TxInfo;
pub use constants::*;

Modules§

client
HTTP client for interacting with the Lighter API
constants
Constants and limits for the Lighter Protocol
errors
Error types for the Lighter Protocol SDK
signer
Cryptographic signing and key management for Lighter Protocol
types
Transaction types and request builders for the Lighter Protocol
utils
Utility functions for the Lighter SDK
ws_client
WebSocket client for real-time Lighter Protocol data streams

Constants§

VERSION
Library version