Quick Start
Create a wallet client, then create the CLOB client. For authenticated methods, generate an API key once per client (it will be stored in the client instance).
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { bscTestnet } from "viem/chains";
import { createClobClient } from "@prob/clob";
const account = privateKeyToAccount("0x..." as `0x${string}`);
const wallet = createWalletClient({
chain: bscTestnet,
transport: http(),
account,
});
const client = createClobClient({
baseUrl: "https://api.probable.markets/public/api/v1",
chainId: bscTestnet.id,
wallet,
});
await client.generateApiKey();Basic usage (public)
const markets = await client.getMarkets({ eventId: "162" });
const orderbook = await client.getOrderBook({ tokenId: "..." });Basic usage (authenticated)
const positions = await client.getCurrentPositions({ eventId: "162" });