View Source Hyperliquid.Api.Info.DelegatorRewards (hyperliquid v0.2.2)
User's staking rewards history.
Returns delegation and commission rewards with timestamps.
Usage
{:ok, rewards} = DelegatorRewards.request("0x1234...")
{:ok, total} = DelegatorRewards.total_rewards(rewards)
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.
Get rewards by source type.
Returns true if cache storage is enabled.
Returns the cache TTL if configured.
Creates a changeset for delegator rewards data.
Get commission rewards only.
Get delegation rewards only.
Fetch is an alias for request when no storage is configured.
Get rewards within a time range.
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 total rewards by source.
Get total rewards across all entries.
Get valid reward sources.
Types
@type t() :: %Hyperliquid.Api.Info.DelegatorRewards{rewards: [Reward.t()]}
Functions
Returns metadata about this endpoint.
Example
iex> Hyperliquid.Api.Info.DelegatorRewards.__endpoint_info__()
%{
endpoint: "delegatorRewards",
type: :info,
rate_limit_cost: 2,
params: [:user],
optional_params: [],
doc: "Retrieve user's staking rewards history",
returns: "Delegation and commission rewards with timestamps"
}
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.
Get rewards by source type.
Parameters
rewards: The delegator rewards structsource: Source type ("delegation" or "commission")
Returns
- List of rewards from the source
Returns true if cache storage is enabled.
Returns the cache TTL if configured.
@spec changeset(t(), map()) :: Ecto.Changeset.t()
Creates a changeset for delegator rewards data.
Parameters
rewards: The delegator rewards structattrs: Map with rewards key
Returns
Ecto.Changeset.t()
Get commission rewards only.
Parameters
rewards: The delegator rewards struct
Returns
- List of commission rewards
Get delegation rewards only.
Parameters
rewards: The delegator rewards struct
Returns
- List of delegation rewards
Fetch is an alias for request when no storage is configured.
@spec in_range(t(), non_neg_integer(), non_neg_integer()) :: [map()]
Get rewards within a time range.
Parameters
rewards: The delegator rewards structstart_time: Start timestamp in msend_time: End timestamp in ms
Returns
- List of rewards in range
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).
@spec rate_limit_cost() :: non_neg_integer()
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 total rewards by source.
Parameters
rewards: The delegator rewards structsource: Source type
Returns
{:ok, float()}- Total for source{:error, :parse_error}- If parsing fails
Get total rewards across all entries.
Parameters
rewards: The delegator rewards struct
Returns
{:ok, float()}- Total rewards{:error, :parse_error}- If parsing fails
@spec valid_sources() :: [String.t()]
Get valid reward sources.
Returns
- List of valid source strings