View Source Hyperliquid.Api.Exchange.SpotDeploy (hyperliquid v0.4.1)

Deploy and manage HIP-1 and HIP-2 spot tokens.

Sub-action functions:

FunctionSDK keyPurpose
register_token2/2registerToken2Register a new spot token
user_genesis/2userGenesisSet user genesis allocations
genesis/2genesisConfigure token supply and hyperliquidity
register_spot/3registerSpotRegister a base/quote trading pair
register_hyperliquidity/2registerHyperliquiditySeed liquidity (HIP-2)
set_deployer_trading_fee_share/3setDeployerTradingFeeShareSet deployer fee share (0–100%)
enable_quote_token/2enableQuoteTokenConvert a token to a quote token
enable_aligned_quote_token/2enableAlignedQuoteTokenEnable aligned quote token status

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-1-and-hip-2-assets

Typical deployment sequence

# 1. Register the token
{:ok, _} = SpotDeploy.register_token2(%{
  spec: %{name: "MYTOKEN", sz_decimals: 2, wei_decimals: 8},
  max_gas: 1_000_000,
  full_name: "My Token"           # optional
})

# 2. Set user genesis allocations (tuples: {address, amount_in_wei})
{:ok, _} = SpotDeploy.user_genesis(%{
  token: 42,
  user_and_wei: [{"0xabc...", "1000000000"}],
  existing_token_and_wei: []
})

# 3. Finalize genesis (max supply)
{:ok, _} = SpotDeploy.genesis(%{token: 42, max_supply: "1000000000"})

# 4. Register spot pair (base token, quote token index)
{:ok, _} = SpotDeploy.register_spot(42, 0)

# 5. Seed hyperliquidity (HIP-2)
{:ok, _} = SpotDeploy.register_hyperliquidity(%{
  spot: 10,
  start_px: "1.0",
  order_sz: "100",
  n_orders: 10
})

# 6. Set deployer fee share
{:ok, _} = SpotDeploy.set_deployer_trading_fee_share(42, "50")

Summary

Functions

Enable aligned quote token status for a token.

Convert a token to a quote token.

Finalize token genesis (max supply and hyperliquidity settings).

Register hyperliquidity seeding configuration for a spot pair (HIP-2).

Register a spot trading pair (HIP-1 step 3).

Register a new spot token (HIP-1 step 1).

Set the deployer's trading fee share for a token (0–100%).

Set user genesis balance allocations for a deployed token (HIP-1 step 2).

Functions

Link to this function

enable_aligned_quote_token(token, opts \\ [])

View Source

Enable aligned quote token status for a token.

Parameters

  • token: Token integer ID to enable as aligned quote token
  • opts: Optional keyword list (:private_key)
Link to this function

enable_quote_token(token, opts \\ [])

View Source

Convert a token to a quote token.

Parameters

  • token: Token integer ID to enable as quote token
  • opts: Optional keyword list (:private_key)
Link to this function

genesis(params, opts \\ [])

View Source

Finalize token genesis (max supply and hyperliquidity settings).

Parameters

  • params: Map with:
    • :token — Token integer ID
    • :max_supply — Maximum total supply as a decimal string
    • :no_hyperliquidity — Optional; set to true to set hyperliquidity balance to 0
  • opts: Optional keyword list (:private_key)
Link to this function

register_hyperliquidity(params, opts \\ [])

View Source

Register hyperliquidity seeding configuration for a spot pair (HIP-2).

Parameters

  • params: Map with:
    • :spot — Spot index (distinct from base token index)
    • :start_px — Starting price as a decimal string
    • :order_sz — Order size as a decimal string (not in wei)
    • :n_orders — Total number of orders to place (integer)
    • :n_seeded_levels — Optional; number of levels to seed with USDC (integer)
  • opts: Optional keyword list (:private_key)
Link to this function

register_spot(base_token, quote_token, opts \\ [])

View Source

Register a spot trading pair (HIP-1 step 3).

Parameters

  • base_token: Base token integer ID
  • quote_token: Quote token integer ID (usually 0 for USDC)
  • opts: Optional keyword list (:private_key)
Link to this function

register_token2(params, opts \\ [])

View Source

Register a new spot token (HIP-1 step 1).

Parameters

  • params: Map with:
    • :spec%{name: String, sz_decimals: integer, wei_decimals: integer}
    • :max_gas — Max gas in native token wei (integer)
    • :full_name — Optional full token name string
  • opts: Optional keyword list (:private_key)
Link to this function

set_deployer_trading_fee_share(token, share, opts \\ [])

View Source

Set the deployer's trading fee share for a token (0–100%).

Parameters

  • token: Token integer ID
  • share: Fee share percentage as a decimal string (e.g. "50" for 50%)
  • opts: Optional keyword list (:private_key)
Link to this function

user_genesis(params, opts \\ [])

View Source

Set user genesis balance allocations for a deployed token (HIP-1 step 2).

Parameters

  • params: Map with:
    • :token — Token integer ID
    • :user_and_wei — List of {address, amount_wei_string} tuples
    • :existing_token_and_wei — List of {token_id_integer, amount_wei_string} tuples
    • :blacklist_users — Optional list of {address, bool} tuples
                              (`true` = blacklist, `false` = remove from blacklist)
  • opts: Optional keyword list (:private_key)