pub struct HyperliquidSDKInner { /* private fields */ }Expand description
Shared SDK state
Implementations§
Source§impl HyperliquidSDKInner
impl HyperliquidSDKInner
Sourcepub fn hypercore_url(&self) -> String
pub fn hypercore_url(&self) -> String
Get the HyperCore endpoint URL
Sourcepub async fn query_info(&self, body: &Value) -> Result<Value>
pub async fn query_info(&self, body: &Value) -> Result<Value>
Make a POST request to the info endpoint
Sourcepub async fn build_action(
&self,
action: &Value,
slippage: Option<f64>,
) -> Result<BuildResponse>
pub async fn build_action( &self, action: &Value, slippage: Option<f64>, ) -> Result<BuildResponse>
Build an action (get hash without sending)
Sourcepub async fn send_action(
&self,
action: &Value,
nonce: u64,
signature: &Signature,
) -> Result<Value>
pub async fn send_action( &self, action: &Value, nonce: u64, signature: &Signature, ) -> Result<Value>
Send a signed action
Sourcepub async fn build_sign_send(
&self,
action: &Value,
slippage: Option<f64>,
) -> Result<Value>
pub async fn build_sign_send( &self, action: &Value, slippage: Option<f64>, ) -> Result<Value>
Build, sign, and send an action
If slippage is Some, it is included in the build payload for the worker
to apply when computing market order prices. When None, the constructor-level
default slippage is used (if > 0).
Sourcepub async fn refresh_metadata(&self) -> Result<()>
pub async fn refresh_metadata(&self) -> Result<()>
Refresh metadata cache
Sourcepub async fn get_mid_price(&self, asset: &str) -> Result<f64>
pub async fn get_mid_price(&self, asset: &str) -> Result<f64>
Get mid price for an asset (from cache or fetch)
Sourcepub fn resolve_asset(&self, name: &str) -> Option<usize>
pub fn resolve_asset(&self, name: &str) -> Option<usize>
Resolve asset name to index
Sourcepub async fn cancel_by_oid(&self, oid: u64, asset: &str) -> Result<Value>
pub async fn cancel_by_oid(&self, oid: u64, asset: &str) -> Result<Value>
Cancel an order by OID
Sourcepub async fn modify_by_oid(
&self,
oid: u64,
asset: &str,
side: Side,
price: Decimal,
size: Decimal,
) -> Result<PlacedOrder>
pub async fn modify_by_oid( &self, oid: u64, asset: &str, side: Side, price: Decimal, size: Decimal, ) -> Result<PlacedOrder>
Modify an order by OID
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for HyperliquidSDKInner
impl !RefUnwindSafe for HyperliquidSDKInner
impl Send for HyperliquidSDKInner
impl Sync for HyperliquidSDKInner
impl Unpin for HyperliquidSDKInner
impl UnsafeUnpin for HyperliquidSDKInner
impl !UnwindSafe for HyperliquidSDKInner
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request