View Source Hyperliquid.Rpc.Custom (hyperliquid v0.2.2)

Hyperliquid-specific custom JSON-RPC methods.

These methods are unique to Hyperliquid and not part of the standard Ethereum JSON-RPC spec.

Usage

alias Hyperliquid.Rpc.Custom

{:ok, gas_price} = Custom.big_block_gas_price()
{:ok, using_big} = Custom.using_big_blocks("0x...")
{:ok, sys_txs} = Custom.get_system_txs_by_block_number("0x1")

Summary

Functions

Get the base fee for the next big block.

Compare gas prices between small and big blocks.

Get system transactions by block hash.

Get system transactions by block number.

Check if an address is using big blocks.

Types

Functions

Link to this function

big_block_gas_price(opts \\ [])

View Source
@spec big_block_gas_price(opts()) :: result()

Get the base fee for the next big block.

Big blocks are larger blocks used for batch processing on Hyperliquid.

Returns

  • {:ok, hex_string} - Gas price in wei as hex string

Example

{:ok, "0x3b9aca00"} = Custom.big_block_gas_price()
Link to this function

compare_gas_prices(opts \\ [])

View Source
@spec compare_gas_prices(opts()) :: {:ok, map()} | {:error, any()}

Compare gas prices between small and big blocks.

Convenience function to get both gas prices at once.

Returns

  • {:ok, %{small_block: hex, big_block: hex}} - Both gas prices

Example

{:ok, %{small_block: "0x...", big_block: "0x..."}} = Custom.compare_gas_prices()
Link to this function

get_system_txs_by_block_hash(block_hash, opts \\ [])

View Source
@spec get_system_txs_by_block_hash(hash(), opts()) :: result()

Get system transactions by block hash.

Returns system transactions that originate from HyperCore.

Parameters

  • block_hash: Hash of the block

Returns

  • {:ok, transactions} - List of system transactions

Example

{:ok, sys_txs} = Custom.get_system_txs_by_block_hash("0x...")
Link to this function

get_system_txs_by_block_number(block_number, opts \\ [])

View Source
@spec get_system_txs_by_block_number(block_tag(), opts()) :: result()

Get system transactions by block number.

Returns system transactions that originate from HyperCore.

Parameters

  • block_number: Block number as hex string

Returns

  • {:ok, transactions} - List of system transactions

Example

{:ok, sys_txs} = Custom.get_system_txs_by_block_number("0x1")
Link to this function

using_big_blocks(address, opts \\ [])

View Source
@spec using_big_blocks(address(), opts()) :: result()

Check if an address is using big blocks.

Parameters

  • address: Address to check

Returns

  • {:ok, boolean} - True if using big blocks

Example

{:ok, true} = Custom.using_big_blocks("0x...")