| Crates.io | dex-connector |
| lib.rs | dex-connector |
| version | 3.2.6 |
| created_at | 2024-01-26 11:24:29.637613+00 |
| updated_at | 2025-12-11 08:03:50.557606+00 |
| description | connections to dexes |
| homepage | https://crates.io/crates/dex-connector |
| repository | https://github.com/shigeo-nakamura/dex-connector |
| max_upload_size | |
| id | 1115431 |
| size | 447,971 |
A Rust library for connecting to multiple decentralized exchanges (DEX) with conditional feature support.
lighter-sdk (default: disabled for safety)Enables Lighter Go SDK integration with external shared library dependency.
When enabled:
libsigner.so shared libraryWhen disabled:
cargo build
Builds without native dependencies. Hyperliquid and other connectors work normally.
cargo build --features lighter-sdk
Development Environment (x86_64):
# Install x86_64 Go libraries
cd /path/to/lighter-go
go build -buildmode=c-shared -trimpath -o ./build/signer-amd64.so ./sharedlib/sharedlib.go
# Build with Lighter support
export LIGHTER_GO_PATH=/path/to/lighter-go/build
export LD_LIBRARY_PATH=$LIGHTER_GO_PATH:$LD_LIBRARY_PATH
cargo build --features lighter-sdk
Production Environment (ARM64):
# Build ARM64 Go libraries
cd /path/to/lighter-go
go build -buildmode=c-shared -trimpath -o ./build/signer-arm64.so ./sharedlib/sharedlib.go
# Set environment and build
export LIGHTER_GO_PATH=/path/to/lighter-go/build
export LD_LIBRARY_PATH=$LIGHTER_GO_PATH:$LD_LIBRARY_PATH
cargo build --features lighter-sdk
Important: Always ensure libsigner.so matches your target architecture. Using x86_64 libraries on ARM64 (or vice versa) will cause segmentation faults.
use dex_connector::*;
// Hyperliquid (always available)
let hyperliquid = create_hyperliquid_connector(
api_key,
secret_key,
base_url,
websocket_url,
)?;
// Lighter (requires lighter-sdk feature)
let lighter = create_lighter_connector(
api_key,
api_key_index,
api_private_key,
account_index,
base_url,
websocket_url,
)?;
The lighter-sdk feature enables integration with the Lighter Go shared library for cryptographic operations. When this feature is not available, the connector will return appropriate error messages.
libc for FFIlibsigner.so)dex-connector/
├── src/
│ ├── lib.rs # Public API and traits
│ ├── dex_connector.rs # Core connector trait
│ ├── hyperliquid_connector.rs # Hyperliquid implementation
│ └── lighter_connector.rs # Lighter implementation (conditional)
├── Cargo.toml # Feature flag configuration
└── README.md # This file
libsigner.so for target architecture#[cfg(feature = "lighter-sdk")]When lighter-sdk feature is disabled, Lighter-related functions return:
Err(DexError::Other(
"Lighter Go SDK not available. Build with --features lighter-sdk to enable."
))
This allows applications to handle missing functionality gracefully.