npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pmxt/sdk

v0.1.1

Published

TypeScript SDK for the PMXT Embed API -- fetch markets, place orders, manage portfolios

Readme

@pmxt/sdk

TypeScript SDK for the PMXT Embed API -- fetch markets, place orders, manage portfolios.

Works in any JavaScript environment. Pairs with @pmxt/components for a complete prediction market UI.

Install

npm install @pmxt/sdk

Setup

The SDK reads configuration from environment variables:

NEXT_PUBLIC_API_KEY=your-api-key               # API key sent as X-API-Key header
NEXT_PUBLIC_API_URL=https://custom-url.com     # optional, overrides the default PMXT API

Set these in your .env.local (Next.js) or equivalent. Only NEXT_PUBLIC_API_KEY is required -- get yours from pmxt.dev/dashboard.

Quick Start

Fetch top events

import { fetchTopEvents } from "@pmxt/sdk";

const events = await fetchTopEvents(5);
for (const event of events) {
  console.log(event.title, event.markets?.length, "markets");
}

Build and submit an order

import { buildOrder, submitSignedOrder } from "@pmxt/sdk";

// 1. Build the order (returns EIP-712 typed data for signing)
const built = await buildOrder({
  tokenId: "0x123...",
  side: "buy",
  amount: 10,
  userAddress: "0xabc...",
});

// 2. Sign with the user's wallet (e.g. wagmi signTypedData)
const signature = await signTypedDataAsync(built.typedData);

// 3. Submit the signed order
const result = await submitSignedOrder({
  side: "buy",
  signature,
  tokenId: "0x123...",
  userAddress: "0xabc...",
  worstPrice: built.params.worstPrice,
  deadline: built.params.deadline,
  nonce: built.params.nonce,
  wait: true,
});

Fetch portfolio and balance

import { fetchPortfolio, fetchBalance } from "@pmxt/sdk";

const portfolio = await fetchPortfolio("0xabc...");
const balance = await fetchBalance("0xabc...");
console.log(`USDC: ${balance.free.USDC}, Positions: ${portfolio.positions.length}`);

API Reference

Catalog

| Function | Description | |---|---| | fetchTopMarkets(limit?, sort?) | Fetch top markets by volume | | fetchAllMarkets() | Fetch all active markets | | fetchLiveMarketCount() | Get total count of active markets | | fetchCategories() | List all category names | | fetchEvent(slug) | Fetch a single event by slug | | fetchTopEvents(limit?) | Fetch top events ranked by 24h volume | | fetchEvents() | Fetch all active events | | fetchSidebar() | Fetch pre-built sidebar data (banners, trending, sections) | | fetchMarketsByOneCategory(name, limit?) | Fetch markets in a single category | | fetchMarketsByCategory(limitPer?, maxCats?) | Fetch markets grouped by category | | fetchEventsByCategory(eventsPer?, maxCats?) | Fetch events grouped by category, sorted by volume | | fetchEventsPaginated(options?) | Fetch events with pagination and optional category filter | | searchMarkets(query) | Search markets by text query | | searchEvents(query) | Search events by text query |

Trading

| Function | Description | |---|---| | buildOrder(req) | Build an order and get EIP-712 typed data for signing | | submitSignedOrder(req) | Submit a wallet-signed order for execution |

Funds

| Function | Description | |---|---| | buildDeposit(amount) | Build an unsigned deposit transaction | | buildWithdraw(amount) | Build an unsigned withdrawal transaction | | buildClaimWithdrawal() | Build a transaction to claim a pending withdrawal | | getWithdrawalStatus(address) | Check withdrawal status and claimable time | | fetchBalance(address) | Fetch USDC balance (total, free, used) |

Portfolio

| Function | Description | |---|---| | fetchPortfolio(address) | Fetch full portfolio summary | | fetchHoldings(address) | Get the number of open positions | | fetchPositions(address) | List all token positions | | fetchTrades(address, limit?, offset?) | Fetch paginated trade history |

Partner

| Function | Description | |---|---| | getPartnerAccruals() | Get fee accrual summary (total accrued, paid out, outstanding) | | getPartnerAccrualHistory(params?) | Fetch paginated accrual/payout history |

Utilities

| Function | Description | |---|---| | fetchPriceHistory(outcomeId, interval?, fidelity?) | Fetch price history for a single outcome | | fetchPriceHistoryBatch(tokenIds, interval?, fidelity?) | Fetch price history for multiple outcomes | | toCategorySlug(name) | Convert a category name to a URL slug | | categoryFromSlug(slug) | Resolve a URL slug back to a category name | | toEventSlug(event) | Generate a URL slug for an event |

TypeScript

The SDK exports all relevant types:

import type {
  CategoryGroup,
  CategoryEventGroup,
  PaginatedEvents,
  BalanceResponse,
  Position,
  BuildOrderRequest,
  BuildOrderResult,
  SubmitOrderRequest,
  OrderResult,
  UnsignedTx,
  BuildTxResult,
  WithdrawalStatus,
  Trade,
  PartnerAccrualSummary,
  PartnerPayoutEntry,
} from "@pmxt/sdk";

Related