pub struct HyperLiquidAuth { /* private fields */ }Expand description
HyperLiquid EIP-712 authenticator.
Handles wallet address derivation and EIP-712 typed data signing for authenticated API requests.
Implementations§
Source§impl HyperLiquidAuth
impl HyperLiquidAuth
Sourcepub fn from_private_key(private_key_hex: &str) -> Result<Self>
pub fn from_private_key(private_key_hex: &str) -> Result<Self>
Creates a new HyperLiquidAuth from a hex-encoded private key.
§Arguments
private_key_hex- The private key as a hex string (with or without “0x” prefix).
§Returns
A new HyperLiquidAuth instance with the derived wallet address.
§Errors
Returns an error if:
- The private key is not valid hex
- The private key is not exactly 32 bytes
- The private key is not a valid secp256k1 scalar
§Example
use ccxt_exchanges::hyperliquid::HyperLiquidAuth;
let auth = HyperLiquidAuth::from_private_key(
"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
).unwrap();
println!("Wallet: {}", auth.wallet_address());Sourcepub fn wallet_address(&self) -> &str
pub fn wallet_address(&self) -> &str
Returns the wallet address (checksummed).
Sourcepub fn private_key_bytes(&self) -> &[u8; 32]
pub fn private_key_bytes(&self) -> &[u8; 32]
Sourcepub fn sign_l1_action(
&self,
action: &Value,
nonce: u64,
is_mainnet: bool,
) -> Result<Eip712Signature>
pub fn sign_l1_action( &self, action: &Value, nonce: u64, is_mainnet: bool, ) -> Result<Eip712Signature>
Sourcepub fn sign_agent(&self, agent_address: &str) -> Result<Eip712Signature>
pub fn sign_agent(&self, agent_address: &str) -> Result<Eip712Signature>
Trait Implementations§
Source§impl Clone for HyperLiquidAuth
impl Clone for HyperLiquidAuth
Source§fn clone(&self) -> HyperLiquidAuth
fn clone(&self) -> HyperLiquidAuth
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HyperLiquidAuth
impl RefUnwindSafe for HyperLiquidAuth
impl Send for HyperLiquidAuth
impl Sync for HyperLiquidAuth
impl Unpin for HyperLiquidAuth
impl UnwindSafe for HyperLiquidAuth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more