Skip to main content

Crate df_lighter_core

Crate df_lighter_core 

Source
Expand description

Lighter SDK for Rust, on Lighter and on Lighter on Robinhood Chain.

  • client: the Client, the REST API over HTTP, rate limits, the two networks, and the native and browser wires.
  • markets: what is listed and what it trades at.
  • account: what an account holds and who may sign for it.
  • trade: orders on every market.
  • transfer: moving money.
  • earn: public pools, LIT staking and LIT fee credits.
  • deploy: binary options markets.
  • live: websocket subscriptions and kept live state.
  • utils: decimals, a market’s grid, ids, units and the signing primitives.

Money is exact decimals, never floats. Features: sign and native (default), web.

Re-exports§

pub use client::Client;
pub use client::Network;
pub use client::SendError;
pub use utils::Address;
pub use utils::Dec;

Modules§

account
What an account holds, what it did, how it is set up, and who may sign for it.
client
Connecting to Lighter: the Client that reads, signs and sends over one network’s rate-limited REST API (http), the two networks, the L1 they settle on (evm), and the native and browser wires.
deploy
Binary options markets an operator creates, updates and settles: Lighter only. Lighter assigns an operator its market slots (1000 to 2000) and runs the Up/Down series itself.
earn
Earning on Lighter: public pools (the LLP among them), LIT staking and LIT fee credits.
live
The websocket without the socket: subscriptions, the frames sent and received, the connection’s state, what a feed hands back, and a store that keeps live state for an app. Each piece is sans-IO and stands alone: an app that runs its own socket subscribes with subscribe, reads with decode and keeps a book with store::Book; the native and browser feeds (client::native::Feed, client::web::Feed) carry a Session over a socket for an app that does not. Rows the socket sends in the shapes the reads answer are the crate::account and crate::markets types; only the socket’s own are defined here.
markets
What is listed and what it trades at, on either network: every public market read, as plain rows and free functions over any crate::client::Transport. Nothing is cached here; a program keeps what it read.
trade
Orders on every market: place, group, cancel, modify, leverage and isolated margin, each a transaction of plain data that signs as lighter-go signs it.
transfer
Moving money: transfers between accounts and between an account’s perps and spot routes, secure and fast withdrawals, deposits through the ZkLighter contract on the L1, and what the venue reads back about them.
utils
Helpers every Lighter app needs: exact decimals, a market’s grid, the ids things are named by, integer units, time, hex and base64, nonces, the enums orders are described by and the signing primitives.