| Crates.io | hl_ranger |
| lib.rs | hl_ranger |
| version | 0.6.0-ranger.20 |
| created_at | 2025-05-27 07:19:16.7271+00 |
| updated_at | 2025-08-21 17:28:30.423639+00 |
| description | Fork of Hyperliquid Rust SDK with unsigned transaction support for external signing |
| homepage | https://hyperliquid.xyz/ |
| repository | https://github.com/ranger-finance/hyperliquid-rust-sdk |
| max_upload_size | |
| id | 1690708 |
| size | 401,365 |
This is a fork of the official hyperliquid-rust-sdk with added support for unsigned transaction generation.
SDK for Hyperliquid API trading with Rust, enhanced with the ability to generate unsigned transactions for external signing.
This fork introduces the UnsignedTransactionBuilder which allows you to:
use hl_ranger::prelude::Result;
use hl_ranger::{
BaseUrl, ClientLimit, ClientOrder, ClientOrderRequest,
UnsignedTransactionBuilder, UnsignedTransactionComponents,
};
#[tokio::main]
async fn main() -> Result<()> {
// Initialize the unsigned transaction builder
let builder = UnsignedTransactionBuilder::new(
None, // Use default HTTP client
Some(BaseUrl::Testnet), // Use testnet
None, // Fetch meta automatically
None, // No vault address
).await?;
// Prepare an unsigned order
let order = ClientOrderRequest {
asset: "ETH".to_string(),
is_buy: true,
limit_px: 2000.0,
sz: 0.1,
order_type: ClientOrder::Limit(ClientLimit {
tif: "Gtc".to_string(),
}),
reduce_only: false,
cloid: None,
};
let unsigned_order = builder
.prepare_unsigned_order(order, Some("example_group".to_string()))
.await?;
// Now you have:
// - unsigned_order.digest_to_sign: The hash to sign with your private key
// - unsigned_order.action_payload_json: The action for the final payload
// - unsigned_order.nonce: The nonce for the transaction
// Sign the digest externally and construct the final ExchangePayload
Ok(())
}
prepare_unsigned_order - Place ordersprepare_unsigned_cancel - Cancel ordersprepare_unsigned_usdc_transfer - Transfer USDCprepare_unsigned_withdraw - Withdraw fundsprepare_unsigned_update_leverage - Update leverageprepare_unsigned_spot_transfer - Spot transfersprepare_unsigned_vault_transfer - Vault transfersSee src/bin for examples. You can run any example with cargo run --bin [EXAMPLE].
For unsigned transaction examples, see:
cargo run --bin unsigned_transaction_examplecargo add hl_ranger
This fork maintains full compatibility with the original hyperliquid-rust-sdk. All original functionality remains unchanged.
This project is licensed under the terms of the MIT license. See LICENSE for more details.
@misc{hl-ranger,
author = {HL Ranger (Fork of Hyperliquid)},
title = {Fork of Hyperliquid Rust SDK with unsigned transaction support},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/hl-ranger/hyperliquid-rust-sdk}}
}