View Source Hyperliquid.Api.Exchange.TokenDelegate (hyperliquid v0.3.0)

Delegate or undelegate stake to/from a validator.

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint

Summary

Functions

Delegate or undelegate stake to/from a validator.

Functions

Link to this function

request(validator, is_undelegate, wei, opts \\ [])

View Source

Delegate or undelegate stake to/from a validator.

Parameters

  • validator: Validator address (0x...)
  • is_undelegate: true to undelegate, false to delegate
  • wei: Amount in wei (integer)
  • opts: Optional parameters

Options

  • :private_key - Private key for signing (falls back to config)

Returns

  • {:ok, response} - Delegation result
  • {:error, term()} - Error details

Examples

# Delegate 1 HYPE
{:ok, result} = TokenDelegate.request("0x...", false, 100_000_000)

# Undelegate
{:ok, result} = TokenDelegate.request("0x...", true, 100_000_000)