Account¤
hl.Account
dataclass
¤
Lightweight authentication credentials for Hyperliquid API.
Contains only the essential authentication data, keeping chain configuration separate at the transport layer.
Attributes:
Name | Type | Description |
---|---|---|
address |
str
|
The Ethereum address for the account. |
secret_key |
str
|
The private key for signing operations. |
vault_address |
str | None
|
Optional vault address for vault-based operations. |
Examples:
Create account with explicit address:
>>> account = Account(
... address="0x1234...",
... secret_key="0xabcd...",
... vault_address="0x5678..." # optional
... )
Create account from just a secret key:
>>> account = Account.from_key("0xabcd...")
Methods:
Name | Description |
---|---|
from_key |
Create Account from just a secret key. |
validate |
Validate that address matches the derived address from secret_key. |
from_key
classmethod
¤
Create Account from just a secret key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
secret_key
|
str
|
The private key for the account. |
required |
vault_address
|
str | None
|
Optional vault address for vault operations. |
None
|
Returns:
Type | Description |
---|---|
Account
|
Account instance with address derived from the secret key. |