View Source Hyperliquid.Api.Info.UsdcRouting (hyperliquid v0.3.0)

Current USDC deposit and withdrawal routing.

Each route is either "bridge" (the native Arbitrum bridge) or "cctp" (Circle's Cross-Chain Transfer Protocol). The routes can change independently, so check the one for the direction you care about.

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

Usage

{:ok, routing} = UsdcRouting.request()
UsdcRouting.deposit_via_cctp?(routing)

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 USDC routing data.

Whether deposits currently route over CCTP.

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.

Known routing values.

Returns true if any storage backend is enabled.

Whether withdrawals currently route over CCTP.

Types

@type route() :: String.t()
@type t() :: %Hyperliquid.Api.Info.UsdcRouting{
  deposit_route: route() | nil,
  withdrawal_route: route() | nil
}

Functions

Returns metadata about this endpoint.

Example

iex> Hyperliquid.Api.Info.UsdcRouting.__endpoint_info__()
%{
  endpoint: "usdcRouting",
  type: :info,
  rate_limit_cost: 2,
  params: [],
  optional_params: [],
  doc: "Retrieve current USDC deposit and withdrawal routing",
  returns: "Deposit and withdrawal routes, each bridge or cctp"
}

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() :: map()

Build the request payload.

Returns true if cache storage is enabled.

Returns the cache TTL if configured.

Link to this function

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

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

Creates a changeset for USDC routing data.

Parameters

  • routing: The routing struct
  • attrs: Map of attributes

Returns

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

deposit_via_cctp?(usdc_routing)

View Source
@spec deposit_via_cctp?(t()) :: boolean()

Whether deposits currently route over CCTP.

Parameters

  • routing: The routing struct

Returns

  • boolean()
@spec fetch() :: {:ok, t()} | {:error, term()}

Fetch data and persist to configured storage backends.

This calls request/0 and then stores the result using Storage.Writer.

@spec fetch!() :: t()

Fetch data and persist. Raises on error.

@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() :: {:ok, t()} | {:error, term()}

Make the API request and parse the response.

@spec request!() :: t()

Make the API request, raising on error.

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

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

@spec request_raw!() :: map()

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

@spec routes() :: [route()]

Known routing values.

Returns

  • List of valid route strings

Returns true if any storage backend is enabled.

Link to this function

withdrawal_via_cctp?(usdc_routing)

View Source
@spec withdrawal_via_cctp?(t()) :: boolean()

Whether withdrawals currently route over CCTP.

Parameters

  • routing: The routing struct

Returns

  • boolean()