{
  "$schema": "https://ui.shadcn.com/schema/registry.json",
  "name": "purrdict",
  "homepage": "https://ui.purrdict.xyz",
  "items": [
    {
      "name": "hip4-format",
      "type": "registry:lib",
      "title": "HIP-4 Formatting Utilities",
      "description": "Price, USDH, countdown, and period formatters for HIP-4 prediction market data. Exports formatMidPrice(px, style?), formatUsdh(amount), formatTargetPrice(price), formatPeriod(market), parseMid(midStr). Used internally by MarketCard, Orderbook, PositionCard, and MarketStats.",
      "dependencies": []
    },
    {
      "name": "market-card",
      "type": "registry:ui",
      "title": "Market Card",
      "description": "Display card for HIP-4 prediction markets with 4 variants: \"event\" (Yes/No), \"recurring\" (Up/Down with asset logo), \"named-binary\" (custom side names), \"question\" (multi-outcome). Pass market object from useMarkets() and yesMid from mids map. Key props: market (Market), yesMid (number), volume? (number), variant? (MarketVariant), onClick? (callback).",
      "dependencies": [
        "@purrdict/hip4"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/countdown.json",
        "https://ui.purrdict.xyz/r/hip4-format.json"
      ]
    },
    {
      "name": "live-price-chart",
      "type": "registry:ui",
      "title": "Live Price Chart",
      "description": "Canvas-based real-time chart for the underlying asset's perp price (what the prediction market resolves against). Feed with useUnderlyingPrice(symbol) which returns { prices, currentPrice }. Key props: symbol (string), prices (PricePoint[]), currentPrice (number), targetPrice? (number, the strike price), color? (string, defaults to asset brand color).",
      "dependencies": [],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/hip4-format.json",
        "https://ui.purrdict.xyz/r/use-underlying-price.json"
      ]
    },
    {
      "name": "probability-chart",
      "type": "registry:ui",
      "title": "Probability Chart",
      "description": "Polymarket-style multi-line step-function probability chart for multi-outcome question markets (3+ outcomes). NOT for binary markets — use ProbabilityBar instead. Feed with useProbabilityHistory(questionMarkets) which returns { series }. Key props: series (OutcomeSeries[]), height? (default 220), theme? ('dark'|'light'). Each outcome auto-assigned a color from OUTCOME_COLORS palette, overridable per series.",
      "dependencies": [],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/hip4-format.json",
        "https://ui.purrdict.xyz/r/use-probability-history.json"
      ]
    },
    {
      "name": "orderbook",
      "type": "registry:ui",
      "title": "Orderbook",
      "description": "Dual-pane L2 orderbook with color-coded depth bars, spread display, and click-to-set-price. Feed with useOrderbook(coin) which returns { bids, asks }. Key props: coin (string), bids (BookLevel[]), asks (BookLevel[]), depth? (number), onPriceClick? (price => void). Component calculates spread/mid internally.",
      "dependencies": [
        "@purrdict/hip4"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/hip4-format.json"
      ]
    },
    {
      "name": "recent-trades",
      "type": "registry:ui",
      "title": "Recent Trades",
      "description": "Scrollable trade feed with color-coded buy/sell sides and monospace prices. Feed with useRecentTrades(coin) which returns { trades }. Key props: trades (Trade[] with side, price, size, time), maxRows? (number, default 50). Pure presentation — no data fetching.",
      "dependencies": [],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/use-recent-trades.json"
      ]
    },
    {
      "name": "trade-form",
      "type": "registry:ui",
      "title": "Trade Form",
      "description": "Complete prediction market trade form. Pass bookData={{ bids, asks }} from useOrderbook to auto-resolve mid/bid/ask. Requires sides array from market.sides (e.g. [{name: 'Yes', coin: '#9860'}]). Connect useTrade(exchange) for order submission via onSubmit. Key props: sides, bookData?, minShares? (from useMinShares), usdhBalance? (from usePortfolio), shareBalance?, isConnected?, builder? ({address, fee}), onSubmit? (TradeSubmitParams => Promise).",
      "dependencies": [
        "@purrdict/hip4"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/hip4-format.json",
        "https://ui.purrdict.xyz/r/use-trade.json"
      ]
    },
    {
      "name": "market-stats",
      "type": "registry:ui",
      "title": "Market Stats",
      "description": "Compact inline stats bar showing volume, trade count, and unique trader count with icons. Pure presentation — pass data directly, no hook needed. Key props: volume (number, 24h USDH), trades (number, total count), traders (number, unique count).",
      "dependencies": [],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/hip4-format.json"
      ]
    },
    {
      "name": "probability-bar",
      "type": "registry:ui",
      "title": "Probability Bar",
      "description": "Two-tone horizontal probability bar. Pure presentation — pass probabilities directly, no hook needed. Key props: yesPx (number 0-1), noPx (number 0-1), yesLabel? (string, default 'Yes'), noLabel? (string, default 'No'). Uses --success and --destructive CSS variables.",
      "dependencies": []
    },
    {
      "name": "countdown",
      "type": "registry:ui",
      "title": "Countdown",
      "description": "Segmented countdown timer with urgency colors: red (<1h), amber (<6h), normal. Two variants: 'segments' (DAYS/HRS/MINS/SECS boxes) and 'text' (inline). Key props: expiry (Date), variant? ('segments' | 'text'). Pure presentation — no hook needed.",
      "dependencies": [],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/hip4-format.json"
      ]
    },
    {
      "name": "position-card",
      "type": "registry:ui",
      "title": "Position Card",
      "description": "Displays a user's position with shares, current value, average entry, and unrealized P&L. Feed with usePortfolio(address) for positions array, and mids from useMarkets for currentPrice. Key props: coin (string), shares (number), currentPrice (number), avgEntry? (number), onSell? (coin => void).",
      "dependencies": [],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/hip4-format.json"
      ]
    },
    {
      "name": "rounds-timeline",
      "type": "registry:ui",
      "title": "Rounds Timeline",
      "description": "Polymarket-style bottom bar for navigating recurring market rounds. Shows inline tabs with result indicators (▲ above / ▼ below), a \"Past\" popover dropdown grouped by date, and a streak strip. Pure presentation — pass rounds data directly. Key props: rounds (Round[]), activeRoundId (number), onRoundSelect (callback), period (\"15m\"|\"1d\"), underlying? (string), visibleCount? (number, default 5).",
      "dependencies": [],
      "registryDependencies": [
        "popover"
      ]
    },
    {
      "name": "use-hip4-client",
      "type": "registry:hook",
      "title": "useHIP4Client",
      "description": "Creates and caches InfoClient + SubscriptionClient from @nktkas/hyperliquid. Returns { info, sub, close }. Cached in ref — stable across rerenders. Pass { testnet: true } for testnet. Usually consumed via HIP4Provider rather than directly.",
      "dependencies": [
        "@purrdict/hip4"
      ]
    },
    {
      "name": "hip4-provider",
      "type": "registry:hook",
      "title": "HIP4Provider",
      "description": "React context provider — wrap your app in <HIP4Provider testnet={false}> and all hooks (useMarkets, useOrderbook, etc.) auto-resolve the client. No prop-drilling needed. Key props: testnet? (boolean, default false), children.",
      "dependencies": [
        "@nktkas/hyperliquid"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/use-hip4-client.json",
        "https://ui.purrdict.xyz/r/hip4-provider.json"
      ]
    },
    {
      "name": "use-hip4-signer",
      "type": "registry:hook",
      "title": "useHIP4Signer",
      "description": "Adapts any wagmi wallet to { address, walletClient } for use with ExchangeClient. Returns null when disconnected. Works with MetaMask, WalletConnect, Privy, Coinbase Wallet. Pass walletClient to new ExchangeClient({ transport, wallet: signer.walletClient }).",
      "dependencies": [
        "wagmi",
        "viem"
      ]
    },
    {
      "name": "use-markets",
      "type": "registry:hook",
      "title": "useMarkets",
      "description": "Discovers all active HIP-4 markets and subscribes to live mid prices via WebSocket. Returns { markets: Market[], mids: Record<string, string>, isLoading, error }. Feed markets to MarketCard and mids[coin] for yesMid. Stable markets array (useMemo) prevents downstream rerenders.",
      "dependencies": [
        "@purrdict/hip4"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/use-hip4-client.json",
        "https://ui.purrdict.xyz/r/hip4-provider.json"
      ]
    },
    {
      "name": "use-orderbook",
      "type": "registry:hook",
      "title": "useOrderbook",
      "description": "Subscribes to the L2 orderbook for a prediction market coin via WebSocket. Returns { bids: BookLevel[], asks: BookLevel[], spread: number|null, midPrice: number|null, isLoading, error }. Pass { bids, asks } as bookData to TradeForm. Call as useOrderbook(coin) with HIP4Provider or useOrderbook(client, coin).",
      "dependencies": [
        "@purrdict/hip4"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/use-hip4-client.json",
        "https://ui.purrdict.xyz/r/hip4-provider.json"
      ]
    },
    {
      "name": "use-portfolio",
      "type": "registry:hook",
      "title": "usePortfolio",
      "description": "Fetches USDH balance, outcome token positions, and open orders for a wallet address. Returns { usdh: TokenBalance|null, positions: Position[], openOrders: OpenOrder[], isLoading, error, refresh() }. Pass usdh.total to TradeForm as usdhBalance. Call refresh() after placing an order.",
      "dependencies": [
        "@purrdict/hip4"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/use-hip4-client.json",
        "https://ui.purrdict.xyz/r/hip4-provider.json"
      ]
    },
    {
      "name": "use-trade",
      "type": "registry:hook",
      "title": "useTrade",
      "description": "Place and cancel HIP-4 prediction market orders. Takes ExchangeClient (NOT HIP4Client) — create with new ExchangeClient({ transport, wallet }). Returns { buy(params), sell(params), cancel(asset, oid), isSubmitting, lastResult, error }. TradeParams: { coin, asset, shares, price, tif?, markPx?, builder? }.",
      "dependencies": [
        "@purrdict/hip4"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/use-hip4-client.json",
        "https://ui.purrdict.xyz/r/use-hip4-signer.json"
      ]
    },
    {
      "name": "use-min-shares",
      "type": "registry:hook",
      "title": "useMinShares",
      "description": "Computes the minimum order size for a prediction market coin. Fetches mark price from spotMetaAndAssetCtxs, applies formula: ceil(10/max(min(markPx,1-markPx),0.01)). Returns { minShares: number, markPx: number|null, isLoading, error }. Pass minShares to TradeForm.",
      "dependencies": [
        "@purrdict/hip4"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/use-hip4-client.json",
        "https://ui.purrdict.xyz/r/hip4-provider.json"
      ]
    },
    {
      "name": "use-recent-trades",
      "type": "registry:hook",
      "title": "useRecentTrades",
      "description": "Subscribes to recent trades for a prediction market coin. Returns { trades: RecentTrade[], isLoading, error }. Each trade has { side: 'B'|'S', price: number, size: number, time: number }. Fetches initial history via HTTP then appends live trades via WebSocket. Pass trades to RecentTrades component.",
      "dependencies": [
        "@nktkas/hyperliquid"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/use-hip4-client.json",
        "https://ui.purrdict.xyz/r/hip4-provider.json"
      ]
    },
    {
      "name": "use-underlying-price",
      "type": "registry:hook",
      "title": "useUnderlyingPrice",
      "description": "Subscribes to the underlying asset's perp price with candleSnapshot history. Returns { prices, currentPrice } ready for LivePriceChart. Handles history prefetch + live WS updates + deduplication.",
      "dependencies": [
        "@nktkas/hyperliquid"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/use-hip4-client.json",
        "https://ui.purrdict.xyz/r/hip4-provider.json"
      ]
    },
    {
      "name": "use-probability-history",
      "type": "registry:hook",
      "title": "useProbabilityHistory",
      "description": "Subscribes to probability history for all outcomes in a multi-outcome question market. Fetches candleSnapshot history + streams live allMids updates. Returns { series: OutcomeSeries[], isLoading, error }. Pass series directly to <ProbabilityChart series={...} />. Accepts markets array from useMarkets().",
      "dependencies": [
        "@purrdict/hip4",
        "@nktkas/hyperliquid"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/use-hip4-client.json",
        "https://ui.purrdict.xyz/r/hip4-provider.json",
        "https://ui.purrdict.xyz/r/probability-chart.json"
      ]
    },
    {
      "name": "hip4-quickstart",
      "type": "registry:example",
      "title": "HIP-4 Quickstart",
      "description": "Complete working example: HIP4Provider + useMarkets + MarketCard grid + Orderbook + TradeForm + RecentTrades. Installs ALL components and hooks. One command to get a full prediction market UI.",
      "dependencies": [
        "@purrdict/hip4",
        "@nktkas/hyperliquid"
      ],
      "registryDependencies": [
        "https://ui.purrdict.xyz/r/hip4-provider.json",
        "https://ui.purrdict.xyz/r/market-card.json",
        "https://ui.purrdict.xyz/r/live-price-chart.json",
        "https://ui.purrdict.xyz/r/orderbook.json",
        "https://ui.purrdict.xyz/r/recent-trades.json",
        "https://ui.purrdict.xyz/r/trade-form.json",
        "https://ui.purrdict.xyz/r/market-stats.json",
        "https://ui.purrdict.xyz/r/probability-bar.json",
        "https://ui.purrdict.xyz/r/countdown.json",
        "https://ui.purrdict.xyz/r/position-card.json",
        "https://ui.purrdict.xyz/r/use-markets.json",
        "https://ui.purrdict.xyz/r/use-orderbook.json",
        "https://ui.purrdict.xyz/r/use-portfolio.json",
        "https://ui.purrdict.xyz/r/use-trade.json",
        "https://ui.purrdict.xyz/r/use-min-shares.json",
        "https://ui.purrdict.xyz/r/use-recent-trades.json",
        "https://ui.purrdict.xyz/r/use-underlying-price.json",
        "https://ui.purrdict.xyz/r/probability-chart.json",
        "https://ui.purrdict.xyz/r/use-probability-history.json",
        "https://ui.purrdict.xyz/r/use-hip4-signer.json",
        "https://ui.purrdict.xyz/r/hip4-format.json",
        "https://ui.purrdict.xyz/r/rounds-timeline.json"
      ]
    }
  ]
}
