lighter-rust
lighter-rust is an independently maintained Rust client for the Lighter
exchange. The Cargo package published from this repository is lighter-sdk.
This repository is open-source work done independently and is not affiliated with, maintained by, or endorsed by Lighter.
lighter-sdk provides:
- a signer-backed transaction client
- REST API access
- WebSocket streaming
- nonce management helpers
[!WARNING] This repository was written with AI assistance and does not have complete feature or test coverage. Treat it as a useful starting point rather than a fully hardened SDK. If you plan to depend on it heavily, developing from your own fork may be the safest way to use it.
PRs or feature requests are welcome.
Install
[]
= "0.1"
= { = "1", = ["macros", "rt-multi-thread"] }
Examples
The public usage examples live in the
examples/ directory
and are intended to be the primary source of truth:
examples/public_rest.rs: fetch public exchange stats over REST without signer setupexamples/quickstart.rs: initialize aSignerClientfrom environment variables and validate the configured keyexamples/skip_nonce_order.rs: sign a create order transaction withSkipNonce = 1without sending itexamples/README.md: example-specific setup notes and required environment variables, including signer and nonce notes
Run them with:
The signer-backed examples expect:
LIGHTER_HOSTLIGHTER_SIGNER_LIB_PATHLIGHTER_ACCOUNT_INDEXLIGHTER_API_KEY_INDEXLIGHTER_API_PRIVATE_KEY
Signer Installation
lighter-sdk does not ship the signer shared library inside the crate package.
Install the signer separately from the
lighter-go releases or
build it from source with the
lighter-go justfile.
Supported runtime lookup order:
Config::with_signer_lib_path(...)LIGHTER_SIGNER_LIB_PATH- next to the current executable, or in
signers/next to it - the current working directory, or
./signers
Supported library filenames:
- macOS arm64:
lighter-signer-darwin-arm64.dylib - Linux amd64:
lighter-signer-linux-amd64.so - Linux arm64:
lighter-signer-linux-arm64.so - Windows amd64:
lighter-signer-windows-amd64.dll
Compatibility
lighter-sdk |
Tested signer source | Notes |
|---|---|---|
0.1.1 |
lighter-go |
Shared library release/build source |
0.1.0 |
lighter-go |
Initial standalone release |
Reference ports used while building this crate:
| SDK | Repository |
|---|---|
| Go reference signer | lighter-go |
| Python reference SDK | lighter-python |
Development
Local validation:
For a manual publish checklist, see
RELEASE.md.
There is also an ignored smoke test for validating an external signer:
LIGHTER_SIGNER_LIB_PATH=/path/to/signer \
LIGHTER_SDK_SMOKE_HOST=your-lighter-host \
LIGHTER_SDK_SMOKE_PRIVATE_KEY=... \
LIGHTER_SDK_SMOKE_API_KEY_INDEX=0 \
LIGHTER_SDK_SMOKE_ACCOUNT_INDEX=0 \