View Source Hyperliquid.Api.Info.DelegatorHistory (hyperliquid v0.2.2)

History of user's delegation actions.

Returns delegation and undelegation events with timestamps and transaction hashes.

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-delegator-history

Usage

{:ok, history} = DelegatorHistory.request("0x1234...")
delegations = DelegatorHistory.delegations(history)

Summary

Functions

Returns metadata about this endpoint.

Returns postgres table configurations (multi-table support).

Returns storage configuration for this endpoint.

Build a cache key from response data using the configured pattern. Returns nil if cache is not enabled or no pattern configured.

Build the request payload.

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

Creates a changeset for delegator history data.

Get delegation events only.

Fetch is an alias for request when no storage is configured.

Get events for a specific validator.

Get events within a time range.

Get the most recent event.

Parse and validate the API response.

Returns true if postgres storage is enabled.

Returns the postgres table name if configured (primary table for legacy support).

Returns the upsert config for postgres (primary table for legacy support).

Get the rate limit cost for this endpoint.

Make the API request and parse the response.

Make the API request, raising on error.

Make the API request and return the raw response map (no key transformation).

Make the API request returning raw map, raising on error.

Returns true if any storage backend is enabled.

Get undelegation events only.

Types

@type t() :: %Hyperliquid.Api.Info.DelegatorHistory{events: [Event.t()]}

Functions

Returns metadata about this endpoint.

Example

iex> Hyperliquid.Api.Info.DelegatorHistory.__endpoint_info__()
%{
  endpoint: "delegatorHistory",
  type: :info,
  rate_limit_cost: 2,
  params: [:user],
  optional_params: [],
  doc: "Retrieve history of user's delegation actions",
  returns: "Delegation and undelegation events with timestamps and transaction hashes"
}

Returns postgres table configurations (multi-table support).

Returns storage configuration for this endpoint.

Build a cache key from response data using the configured pattern. Returns nil if cache is not enabled or no pattern configured.

@spec build_request(term()) :: map()

Build the request payload.

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

Link to this function

changeset(history \\ %__MODULE__{}, attrs)

View Source
@spec changeset(t(), map()) :: Ecto.Changeset.t()

Creates a changeset for delegator history data.

Parameters

  • history: The delegator history struct
  • attrs: Map with events key

Returns

  • Ecto.Changeset.t()
Link to this function

delegations(delegator_history)

View Source
@spec delegations(t()) :: [map()]

Get delegation events only.

Parameters

  • history: The delegator history struct

Returns

  • List of delegation events

Fetch is an alias for request when no storage is configured.

Link to this function

for_validator(delegator_history, validator)

View Source
@spec for_validator(t(), String.t()) :: [map()]

Get events for a specific validator.

Parameters

  • history: The delegator history struct
  • validator: Validator address

Returns

  • List of events for the validator
Link to this function

in_range(delegator_history, start_time, end_time)

View Source
@spec in_range(t(), non_neg_integer(), non_neg_integer()) :: [map()]

Get events within a time range.

Parameters

  • history: The delegator history struct
  • start_time: Start timestamp in ms
  • end_time: End timestamp in ms

Returns

  • List of events in range
Link to this function

latest(delegator_history)

View Source
@spec latest(t()) :: {:ok, map()} | {:error, :empty}

Get the most recent event.

Parameters

  • history: The delegator history struct

Returns

  • {:ok, Event.t()} if events exist
  • {:error, :empty} if no events
@spec parse_response(map()) :: {:ok, t()} | {:error, term()}

Parse and validate the API response.

Returns true if postgres storage is enabled.

Returns the postgres table name if configured (primary table for legacy support).

Link to this function

postgres_upsert_config()

View Source

Returns the upsert config for postgres (primary table for legacy support).

@spec rate_limit_cost() :: non_neg_integer()

Get the rate limit cost for this endpoint.

@spec request(term()) :: {:ok, t()} | {:error, term()}

Make the API request and parse the response.

@spec request!(term()) :: t()

Make the API request, raising on error.

@spec request_raw(term()) :: {:ok, map()} | {:error, term()}

Make the API request and return the raw response map (no key transformation).

@spec request_raw!(term()) :: map()

Make the API request returning raw map, raising on error.

Returns true if any storage backend is enabled.

Link to this function

undelegations(delegator_history)

View Source
@spec undelegations(t()) :: [map()]

Get undelegation events only.

Parameters

  • history: The delegator history struct

Returns

  • List of undelegation events