View Source Hyperliquid.Api.Explorer.BlockDetails (hyperliquid v0.2.2)
Block details from the Hyperliquid L1 explorer.
Returns information about a specific block including transactions and metadata.
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/explorer
Usage
{:ok, block} = BlockDetails.request(12345)
tx_count = BlockDetails.tx_count(block)
Summary
Functions
Returns metadata about this endpoint.
Returns postgres table configurations (multi-table support).
Returns storage configuration for this endpoint.
Get block time as DateTime.
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 block details data.
Check if block is empty (no transactions).
Fetch data and persist to configured storage backends.
Fetch data and persist. Raises on error.
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 the number of transactions in the block.
Types
@type t() :: %Hyperliquid.Api.Explorer.BlockDetails{ block_number: non_neg_integer(), block_time: non_neg_integer(), hash: String.t(), prev_hash: String.t(), proposer: String.t() | nil, txs: [map()] }
Functions
Returns metadata about this endpoint.
Example
iex> Hyperliquid.Api.Explorer.BlockDetails.__endpoint_info__()
%{
endpoint: "blockDetails",
type: :explorer,
rate_limit_cost: 2,
params: [:height],
optional_params: [],
doc: "Retrieve block details by height",
returns: "Block with transactions, hash, and metadata"
}
Returns postgres table configurations (multi-table support).
Returns storage configuration for this endpoint.
@spec block_datetime(t()) :: {:ok, DateTime.t()} | {:error, :invalid_time}
Get block time as DateTime.
Parameters
details: The block details struct
Returns
{:ok, DateTime.t()}if valid{:error, :invalid_time}if invalid
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.
@spec changeset(t(), map()) :: Ecto.Changeset.t()
Creates a changeset for block details data.
Check if block is empty (no transactions).
Parameters
details: The block details struct
Returns
boolean()
Fetch data and persist to configured storage backends.
This calls request/N and then stores the result using Storage.Writer.
Request params are merged into stored data for cache key generation.
Fetch data and persist. Raises on error.
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.
@spec tx_count(t()) :: non_neg_integer()
Get the number of transactions in the block.
Parameters
details: The block details struct
Returns
non_neg_integer()