View Source Hyperliquid.Signer (hyperliquid v0.1.6)

Hyperliquid.Signer provides methods for signing and constructing payloads for various Hyperliquid operations.

This module includes functions for:

  • Generating action hashes
  • Constructing phantom agents
  • Signing L1 actions
  • Signing user-signed actions (e.g., spot transfers, USD transfers, withdrawals)
  • Signing agent approvals

It uses EIP-712 for structured data signing and provides utilities for handling signatures and preparing data for signing.

Summary

Functions

Link to this function

action_hash(action, nonce, vault_address)

View Source
Link to this function

construct_phantom_agent(hash, mainnet?)

View Source
Link to this function

prepare_data(message, chain_id)

View Source
Link to this function

sign_agent(action, mainnet?, secret)

View Source
Link to this function

sign_l1_action(action, vault_address, nonce, mainnet?, secret)

View Source
Link to this function

sign_spot_transfer_action(action, mainnet?, secret)

View Source
Link to this function

sign_usd_transfer_action(action, mainnet?, secret)

View Source
Link to this function

sign_user_signed_action(action, payload_types, primary_type, mainnet?, secret)

View Source
Link to this function

sign_withdraw_from_bridge_action(action, mainnet?, secret)

View Source
Link to this function

split_sig(hex_signature)

View Source

Splits a hexadecimal signature into its components.

Parameters

  • hex_signature: The hexadecimal signature to split

Returns

A map containing the signature components (r, s, v).

Example

iex> Hyperliquid.Signer.split_sig("0x1234...")
%{r: "0x...", s: "0x...", v: 27}

Raises

Raises an ArgumentError if the signature length is invalid or if the v value is unexpected.