pub struct Secrets {
pub private_key: EvmPrivateKey,
pub vault_address: Option<VaultAddress>,
pub is_testnet: bool,
}Expand description
Complete secrets configuration for Hyperliquid
Fields§
§private_key: EvmPrivateKey§vault_address: Option<VaultAddress>§is_testnet: boolImplementations§
Source§impl Secrets
impl Secrets
Sourcepub fn env_vars(is_testnet: bool) -> (&'static str, &'static str)
pub fn env_vars(is_testnet: bool) -> (&'static str, &'static str)
Returns the environment variable names for the specified network.
Sourcepub fn resolve(
private_key: Option<&str>,
vault_address: Option<&str>,
is_testnet: bool,
) -> Result<Self>
pub fn resolve( private_key: Option<&str>, vault_address: Option<&str>, is_testnet: bool, ) -> Result<Self>
Resolves secrets from provided values or environment variables.
If private_key is provided, uses it directly. Otherwise falls back
to environment variables based on the network.
Sourcepub fn from_env(is_testnet: bool) -> Result<Self>
pub fn from_env(is_testnet: bool) -> Result<Self>
Load secrets from environment variables for the specified network.
Expected environment variables:
HYPERLIQUID_PK: EVM private key for mainnet (required whenis_testnet=false)HYPERLIQUID_TESTNET_PK: EVM private key for testnet (required whenis_testnet=true)HYPERLIQUID_VAULT: Vault address for mainnet (optional)HYPERLIQUID_TESTNET_VAULT: Vault address for testnet (optional)
Sourcepub fn from_private_key(
private_key_str: &str,
vault_address_str: Option<&str>,
is_testnet: bool,
) -> Result<Self>
pub fn from_private_key( private_key_str: &str, vault_address_str: Option<&str>, is_testnet: bool, ) -> Result<Self>
Create secrets from explicit private key and vault address.
§Errors
Returns an error if the private key or vault address is invalid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Secrets
impl RefUnwindSafe for Secrets
impl Send for Secrets
impl Sync for Secrets
impl Unpin for Secrets
impl UnsafeUnpin for Secrets
impl UnwindSafe for Secrets
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more