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

Extra agents authorized by a user.

Returns list of additional agents (sub-accounts or authorized traders) for a user.

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

Usage

{:ok, agents} = ExtraAgents.request("0x1234...")
ExtraAgents.authorized?(agents, "0x5678...")

Summary

Functions

Returns metadata about this endpoint.

Returns postgres table configurations (multi-table support).

Returns storage configuration for this endpoint.

Get all agent addresses.

Check if an address is an authorized agent.

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 extra agents data.

Get count of extra agents.

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

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 agents that are still valid.

Types

@type t() :: %Hyperliquid.Api.Info.ExtraAgents{agents: [Agent.t()]}

Functions

Returns metadata about this endpoint.

Example

iex> Hyperliquid.Api.Info.ExtraAgents.__endpoint_info__()
%{
  endpoint: "extraAgents",
  type: :info,
  rate_limit_cost: 2,
  params: [:user],
  optional_params: [],
  doc: "Retrieve extra agents authorized by a user",
  returns: "List of additional agents with addresses, names, and validity periods"
}

Returns postgres table configurations (multi-table support).

Returns storage configuration for this endpoint.

@spec addresses(t()) :: [String.t()]

Get all agent addresses.

Parameters

  • agents: The extra agents struct

Returns

  • List of agent addresses
Link to this function

authorized?(extra_agents, address)

View Source
@spec authorized?(t(), String.t()) :: boolean()

Check if an address is an authorized agent.

Parameters

  • agents: The extra agents struct
  • address: Address to check

Returns

  • boolean()

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(agents \\ %__MODULE__{}, attrs)

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

Creates a changeset for extra agents data.

Parameters

  • agents: The extra agents struct
  • attrs: Map with agents key

Returns

  • Ecto.Changeset.t()
@spec count(t()) :: non_neg_integer()

Get count of extra agents.

Parameters

  • agents: The extra agents struct

Returns

  • non_neg_integer()

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

Link to this function

find_by_address(extra_agents, address)

View Source
@spec find_by_address(t(), String.t()) :: {:ok, map()} | {:error, :not_found}

Find agent by address.

Parameters

  • agents: The extra agents struct
  • address: Agent address

Returns

  • {:ok, Agent.t()} if found
  • {:error, :not_found} if not found
@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

valid_agents(extra_agents, current_time)

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

Get agents that are still valid.

Parameters

  • agents: The extra agents struct
  • current_time: Current time in milliseconds

Returns

  • List of valid agents