DEVELOPER REFERENCE

Halo SDK

Everything you need to build trading addons for Hyperliquid and publish them to the Halo store. Addons inject directly into app.hyperliquid.xyz — full access to live market data, no CORS headaches, no setup for users.

No backend required. Addons are self-contained HTML/JS panels. ScarCity handles injection, CORS proxying, and the Hyperliquid API connection. You just write the panel.

Overview

ScarCity is a Chrome extension that injects a toolbar into Hyperliquid. Community builders can create addon panels that appear in that toolbar. Every addon is a self-contained HTML/JS file that uses the Halo SDK to access live HL data.

When a user installs your addon, they see it in the ScarCity toolbar. They can open your panel without leaving Hyperliquid. If you've set a tip address, they can voluntarily support your work.

How it works

Quick Start

The simplest possible addon — a panel that shows the current BTC funding rate:

my-addon/index.js
const addon = new HaloAddon({
  name:        "FundingWatch",
  version:     "1.0.0",
  description: "Live funding rates for any HL perp",
  author:      "yourhandle",
  tip:         "0xYourWallet", // optional — any EVM address
  price:       0,
});

addon.addPanel({
  icon:  "",
  label: "FundingWatch",
  render: async (el, ctx) => {
    const mids = await addon.hl({ type: "allMids" });
    const [meta, ctxs] = await addon.hl({ type: "metaAndAssetCtxs" });

    el.innerHTML = meta.universe.map((m, i) => `
      <div class="rate-row">
        <span>${m.name}</span>
        <span>${(parseFloat(ctxs[i]?.funding) * 100).toFixed(4)}%</span>
      </div>
    `).join("");
  }
});

addon.register();

Addon Structure

An addon is a folder containing at minimum an index.js and an optional panel.html. Submit it as a zip file.

my-addon/
my-addon/
├── index.js       # required — addon logic + SDK usage
├── panel.html     # optional — custom HTML template
├── panel.css      # optional — panel styles
└── README.md      # recommended — describe what your addon does

! No external scripts. Addons must be fully self-contained. No CDN imports, no remote JS, no eval(). All logic must be included in the zip. External API calls to api.hyperliquid.xyz and api.anthropic.com are allowed.

HaloAddon

The main class. Instantiate once per addon with your configuration.

new HaloAddon(config: AddonConfig)
Creates a new addon instance. Call register() after adding panels.
FIELDTYPEDESCRIPTION
namerequiredstringDisplay name shown in the store and toolbar
versionrequiredstringSemver string e.g. "1.0.0"
descriptionrequiredstringShort description shown in the store listing
authorrequiredstringYour handle or name
tipoptionalstringEVM wallet address to receive tips. Any wallet works — no HL builder account needed.
priceoptionalnumber0 for free, positive number for paid (USD). Default: 0
tippedoptionalbooleanAllow voluntary tips. Default: true if tip address provided

addPanel()

Registers a panel that appears in the ScarCity toolbar. You can call addPanel multiple times to add multiple panels to a single addon.

addon.addPanel(panel: PanelConfig): void
FIELDTYPEDESCRIPTION
iconrequiredstringEmoji or short string shown in the toolbar button
labelrequiredstringPanel name shown in the header and store
renderrequiredfunctionAsync function called when panel opens. Receives (el, ctx) — the panel DOM element and context object.
refreshoptionalnumberAuto-refresh interval in milliseconds. Calls render again on interval.

The render context (ctx)

The second argument to your render function gives you live context about what the user is doing:

context object
ctx.coin      // "BTC" — coin currently viewed in HL
ctx.wallet    // "0x..." — connected wallet address (if any)
ctx.theme     // "dark" — user's current theme

hl()

Makes a CORS-proxied request to the Hyperliquid API. Use this for all HL data — do not call api.hyperliquid.xyz directly from your panel (CORS will block it).

await addon.hl(body: object): Promise<any>
Posts to https://api.hyperliquid.xyz/info via ScarCity's background CORS proxy. Returns parsed JSON.

Market Data Types

All mid prices

example
const mids = await addon.hl({ type: "allMids" });
// { "BTC": "94230.5", "ETH": "3201.1", ... }

Meta + asset contexts (funding, OI, volume)

example
const [meta, ctxs] = await addon.hl({ type: "metaAndAssetCtxs" });
// meta.universe[i].name  — coin name
// ctxs[i].funding        — current funding rate
// ctxs[i].openInterest   — open interest
// ctxs[i].dayNtlVlm      — 24h notional volume
// ctxs[i].prevDayPx      — previous day price

Order book (L2)

example
const book = await addon.hl({ type: "l2Book", coin: "BTC" });
// book.levels[0] — bids array: [{px, sz, n}, ...]
// book.levels[1] — asks array: [{px, sz, n}, ...]

Account Data Types

These require a wallet address — use ctx.wallet or ask the user to paste one.

Account state (balance, positions)

example
const state = await addon.hl({
  type: "clearinghouseState",
  user: ctx.wallet
});
// state.marginSummary.accountValue
// state.assetPositions[i].position.coin
// state.assetPositions[i].position.szi  — size
// state.assetPositions[i].position.entryPx

Trade history (fills)

example
const fills = await addon.hl({ type: "userFills", user: ctx.wallet });
// fills[i].coin, fills[i].px, fills[i].sz
// fills[i].side — "B" or "A"
// fills[i].time, fills[i].fee, fills[i].closedPnl

Candles

! Candles return arrays, not objects. Each candle is [timestamp, open, high, low, close, volume]. Always use index access: c[1] for open, c[4] for close. Do not use c.o — it returns undefined.

example
const candles = await addon.hl({
  type:        "candleSnapshot",
  req: {
    coin:      "BTC",
    interval:  "1h", // 1m 5m 15m 1h 4h 1d
    startTime: Date.now() - 86400000, // 24h ago
    endTime:   Date.now()
  }
});

// Each candle: [timestamp, open, high, low, close, volume]
candles.forEach(c => {
  const [t, o, h, l, close, vol] = c;
  console.log(close); //  correct
});

register()

addon.register(): void
Registers the addon with ScarCity. Call this once after all addPanel() calls. This is what makes your panels appear in the toolbar.

Security Rules

Every addon is reviewed against these rules before going live. Violations result in rejection.

Any addon that attempts to place orders, access private keys, or exfiltrate user data will be permanently banned from the store and reported.

Packaging

Submit your addon as a .zip file containing your source. The zip must include your index.js at the root.

terminal
# From inside your addon folder:
zip -r my-addon.zip index.js panel.html panel.css README.md

# Verify the structure:
unzip -l my-addon.zip

Review Process

Only ScarCity Labs approves and publishes addons to the store. No self-publishing. Here's what happens after you submit:

  1. Submission received — you get a confirmation via the email you provide
  2. Manual code review — a human reads your code against the security checklist
  3. Static analysis — automated scan for eval(), obfuscated code, network calls to non-allowed domains
  4. Identity verification — we confirm your X account and EVM tip wallet
  5. Published or rejected — usually within 48 hours. Rejection includes specific feedback.
Ready to build?

Submit your addon for review. The base pack proves the platform works — now it's your turn.

Submit Your Addon →