You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
import{buildOrder,submitSignedOrder}from"@pmxt/sdk";// 1. Build the order (returns EIP-712 typed data for signing)constbuilt=awaitbuildOrder({tokenId: "0x123...",side: "buy",amount: 10,userAddress: "0xabc...",});// 2. Sign with the user's wallet (e.g. wagmi signTypedData)constsignature=awaitsignTypedDataAsync(built.typedData);// 3. Submit the signed orderconstresult=awaitsubmitSignedOrder({side: "buy",
signature,tokenId: "0x123...",userAddress: "0xabc...",worstPrice: built.params.worstPrice,deadline: built.params.deadline,nonce: built.params.nonce,wait: true,});