### Quick Start: Setup Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependents Guides on setting up the wallet client and the CLOB client, including authentication methods. ```APIDOC ## Quick Start: Setup First, create a wallet client and then create the CLOB client: ```typescript import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { bscTestnet } from 'viem/chains' import { createClobClient } from '@prob/clob' // Create a wallet client const account = privateKeyToAccount('0x...' as `0x${string}`) const wallet = createWalletClient({ chain: bscTestnet, transport: http(), account: account, }) // Create the CLOB client const client = createClobClient({ baseUrl: '...', chainId: bscTestnet.id, wallet: wallet, }) // For methods that require authentication (order operations, trades, etc.), // generate an API key first. The API key will be automatically stored in the client. await client.generateApiKey() ``` **Note** : * L1 authentication (wallet signature) is automatically handled when you provide a `wallet` to the client. * Methods that use `l1AuthHttpClient` or `l2AuthHttpClient` require calling `generateApiKey()` first. These include: * Order operations: `postOrder`, `postOrders`, `getOrder`, `getOpenOrders`, `cancelOrder`, `cancelOrders`, `cancelAllOrders` * Trade operations: `getTrades` * API key management: `getApiKey`, `deleteApiKey` * Info: `getTokenIdsForEvent` * Public methods (like `getMarkets`, `getOrderBook`, `getEvents`) don't require authentication. ``` -------------------------------- ### Setup and Authentication Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependencies Guides on setting up the CLOB client and handling authentication for different methods. ```APIDOC ## Setup First, create a wallet client and then create the CLOB client: ```typescript import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { bscTestnet } from 'viem/chains' import { createClobClient } from '@prob/clob' // Create a wallet client const account = privateKeyToAccount('0x...' as `0x${string}`) const wallet = createWalletClient({ chain: bscTestnet, transport: http(), account: account, }) // Create the CLOB client const client = createClobClient({ baseUrl: '...', chainId: bscTestnet.id, wallet: wallet, }) // For methods that require authentication (order operations, trades, etc.), // generate an API key first. The API key will be automatically stored in the client. await client.generateApiKey() ``` **Note** : * L1 authentication (wallet signature) is automatically handled when you provide a `wallet` to the client. * Methods that use `l1AuthHttpClient` or `l2AuthHttpClient` require calling `generateApiKey()` first. These include: * Order operations: `postOrder`, `postOrders`, `getOrder`, `getOpenOrders`, `cancelOrder`, `cancelOrders`, `cancelAllOrders` * Trade operations: `getTrades` * API key management: `getApiKey`, `deleteApiKey` * Info: `getTokenIdsForEvent` * Public methods (like `getMarkets`, `getOrderBook`, `getEvents`) don't require authentication. ``` -------------------------------- ### ProbClob SDK Development Setup and Scripts Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependencies Instructions for setting up the ProbClob SDK development environment, including cloning the repository, installing dependencies, building packages, and running common scripts like linting and testing. ```text ## Development ### Setup 1. Clone the repository 2. Install dependencies: `pnpm install` 3. Build all packages: `pnpm build` ### Scripts * `pnpm lint`: Run Biome linter * `pnpm lint:fix`: Fix linting issues automatically * `pnpm test`: Run tests with Vitest * `pnpm test:watch`: Run tests in watch mode * `pnpm build`: Build all packages ``` -------------------------------- ### Development Setup and Scripts for prob-sdk Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=readme Outlines the essential steps for setting up the development environment for the prob-sdk, including cloning the repository, installing dependencies, and building packages. It also lists common npm scripts for linting, testing, and building. ```text ### Setup 1. Clone the repository 2. Install dependencies: `pnpm install` 3. Build all packages: `pnpm build` ### Scripts * `pnpm lint`: Run Biome linter * `pnpm lint:fix`: Fix linting issues automatically * `pnpm test`: Run tests with Vitest * `pnpm test:watch`: Run tests in watch mode * `pnpm build`: Build all packages ``` -------------------------------- ### SDK Setup and Initialization Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=readme Demonstrates how to set up a wallet client and initialize the CLOB client for interacting with the Prob platform. ```APIDOC ## Setup First, create a wallet client and then create the CLOB client: ```typescript import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { bscTestnet } from 'viem/chains' import { createClobClient } from '@prob/clob' // Create a wallet client const account = privateKeyToAccount('0x...' as `0x${string}`) const wallet = createWalletClient({ chain: bscTestnet, transport: http(), account: account, }) // Create the CLOB client const client = createClobClient({ baseUrl: '...', chainId: bscTestnet.id, wallet: wallet, }) // For methods that require authentication (order operations, trades, etc.), // generate an API key first. The API key will be automatically stored in the client. await client.generateApiKey() ``` **Note** : * L1 authentication (wallet signature) is automatically handled when you provide a `wallet` to the client. * Methods that use `l1AuthHttpClient` or `l2AuthHttpClient` require calling `generateApiKey()` first. These include: * Order operations: `postOrder`, `postOrders`, `getOrder`, `getOpenOrders`, `cancelOrder`, `cancelOrders`, `cancelAllOrders` * Trade operations: `getTrades` * API key management: `getApiKey`, `deleteApiKey` * Info: `getTokenIdsForEvent` * Public methods (like `getMarkets`, `getOrderBook`, `getEvents`) don't require authentication. ``` -------------------------------- ### Installation Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependencies Instructions on how to install the @prob/clob SDK using different package managers. ```APIDOC ## Installation To use this SDK in your project, install the main package: ```bash # Using pnpm pnpm add @prob/clob # Using npm npm install @prob/clob # Using yarn yarn add @prob/clob ``` ``` -------------------------------- ### Development Setup and Scripts for prob-sdk Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0_activeTab=dependencies Outlines the steps for setting up the development environment and common scripts for linting, testing, and building the prob-sdk packages. ```bash ### Setup 1. Clone the repository 2. Install dependencies: `pnpm install` 3. Build all packages: `pnpm build` ### Scripts * `pnpm lint`: Run Biome linter * `pnpm lint:fix`: Fix linting issues automatically * `pnpm test`: Run tests with Vitest * `pnpm test:watch`: Run tests in watch mode * `pnpm build`: Build all packages ``` -------------------------------- ### Setup and Initialization Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.1_activeTab=dependents This section details how to set up and initialize the CLOB client, including wallet client creation and API key generation for authenticated methods. ```APIDOC ## Setup First, create a wallet client and then create the CLOB client: ```typescript import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { bscTestnet } from 'viem/chains' import { createClobClient } from '@prob/clob' // Create a wallet client const account = privateKeyToAccount('0x...' as `0x${string}`) const wallet = createWalletClient({ chain: bscTestnet, transport: http(), account: account, }) // Create the CLOB client const client = createClobClient({ baseUrl: '...', chainId: bscTestnet.id, wallet: wallet, }) // For methods that require authentication (order operations, trades, etc.), // generate an API key first. The API key will be automatically stored in the client. await client.generateApiKey() ``` ### Notes: * L1 authentication (wallet signature) is automatically handled when you provide a `wallet` to the client. * Methods that use `l1AuthHttpClient` or `l2AuthHttpClient` require calling `generateApiKey()` first. These include: * Order operations: `postOrder`, `postOrders`, `getOrder`, `getOpenOrders`, `cancelOrder`, `cancelOrders`, `cancelAllOrders` * Trade operations: `getTrades` * API key management: `getApiKey`, `deleteApiKey` * Info: `getTokenIdsForEvent` * Public methods (like `getMarkets`, `getOrderBook`, `getEvents`) don't require authentication. ``` -------------------------------- ### Install @prob/clob SDK using package managers Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=readme Instructions for installing the main @prob/clob SDK package using pnpm, npm, or yarn. ```bash # Using pnpm pnpm add @prob/clob # Using npm npm install @prob/clob # Using yarn yarn add @prob/clob ``` -------------------------------- ### Basic Usage Examples Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependencies Demonstrates how to perform common operations like fetching markets, order books, and positions. ```APIDOC ## Basic Usage ```typescript // Get markets (public, no authentication required) const markets = await client.getMarkets({ eventId: '162' }) // Get orderbook (public, no authentication required) const orderbook = await client.getOrderBook({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) // Get current positions (requires authentication, ensure generateApiKey() was called) const positions = await client.getCurrentPositions({ eventId: '162' }) ``` ``` -------------------------------- ### Basic CLOB client usage examples Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=readme Examples of using the CLOB client for public and authenticated queries. Includes fetching markets, orderbooks, and current positions. Public methods do not require authentication, while others require `generateApiKey()` to be called first. ```typescript // Get markets (public, no authentication required) const markets = await client.getMarkets({ eventId: '162' }) // Get orderbook (public, no authentication required) const orderbook = await client.getOrderBook({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) // Get current positions (requires authentication, ensure generateApiKey() was called) const positions = await client.getCurrentPositions({ eventId: '162' }) ``` -------------------------------- ### Basic Usage Examples Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.1_activeTab=dependents Illustrates basic usage of the CLOB client for public and authenticated methods. ```APIDOC ### Basic Usage ```typescript // Get markets (public, no authentication required) const markets = await client.getMarkets({ eventId: '162' }) // Get orderbook (public, no authentication required) const orderbook = await client.getOrderBook({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) // Get current positions (requires authentication, ensure generateApiKey() was called) const positions = await client.getCurrentPositions({ eventId: '162' }) ``` ``` -------------------------------- ### Get Prices using prob_clob Client Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=readme Shows how to retrieve current prices for single or multiple tokens, and historical price data using the prob_clob client. Requires a valid client instance and token IDs. Price history queries also require start and end times. ```javascript const price = await client.getPrice({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) const prices = await client.getPrices({ tokenIds: [ '74342822607920627529671190134784974807193804148539661920621719393105547397621', '109502175175535116549611025410934749011537522542042437183890832452933730647182', ], }) const priceHistory = await client.getPricesHistory({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', startTime: Date.now() - 86400000, // 24 hours ago endTime: Date.now(), }) ``` -------------------------------- ### Public CLOB Client Usage Examples Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0 Examples of using the CLOB client for public, unauthenticated queries such as fetching markets and orderbooks. Also shows how to retrieve current positions, which requires authentication. ```typescript // Get markets (public, no authentication required) const markets = await client.getMarkets({ eventId: '162' }) // Get orderbook (public, no authentication required) const orderbook = await client.getOrderBook({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) // Get current positions (requires authentication, ensure generateApiKey() was called) const positions = await client.getCurrentPositions({ eventId: '162' }) ``` -------------------------------- ### Order Operations Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependencies Examples for creating, submitting, and retrieving orders. ```APIDOC ## Order Operations ### Create and Submit a Limit Order ```typescript import { OrderSide, LimitTimeInForce } from '@prob/clob' const order = await client.createLimitOrder({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', price: 0.6, size: 100, side: OrderSide.Buy, timeInForce: LimitTimeInForce.GTC, }) const { orderId } = await client.postOrder(order) console.log('Order created:', orderId) ``` ### Create and Submit a Market Order ```typescript const marketOrder = await client.createMarketOrder({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', size: 100, side: OrderSide.Buy, }) await client.postOrder(marketOrder) ``` ### Get Open Orders ```typescript // Get all open orders for an event const openOrders = await client.getOpenOrders({ eventId: '162' }) // Get open orders for specific tokens const tokenOrders = await client.getOpenOrders({ tokenIds: [ '74342822607920627529671190134784974807193804148539661920621719393105547397621', ], }) // Get a specific order const order = await client.getOrder({ orderId: '123', tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) ``` ``` -------------------------------- ### Install @prob/clob Package Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=readme Command to install the @prob/clob package using npm. Specifies the version to be installed. ```bash npm i @prob/clob@0.0.1-alpha.d211eb6 ``` -------------------------------- ### Basic Usage Examples Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=readme Illustrates common operations using the CLOB client, including fetching market data, orderbooks, and user positions. ```APIDOC ## Basic Usage ```typescript // Get markets (public, no authentication required) const markets = await client.getMarkets({ eventId: '162' }) // Get orderbook (public, no authentication required) const orderbook = await client.getOrderBook({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) // Get current positions (requires authentication, ensure generateApiKey() was called) const positions = await client.getCurrentPositions({ eventId: '162' }) ``` ``` -------------------------------- ### Development Setup and Scripts (Shell) Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=versions Provides instructions for setting up the development environment and common scripts for linting, testing, and building the project. Uses pnpm for package management. ```shell 1. Clone the repository 2. Install dependencies: `pnpm install` 3. Build all packages: `pnpm build` * `pnpm lint`: Run Biome linter * `pnpm lint:fix`: Fix linting issues automatically * `pnpm test`: Run tests with Vitest * `pnpm test:watch`: Run tests in watch mode * `pnpm build`: Build all packages ``` -------------------------------- ### Create and Submit Market Order Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependents Example demonstrating how to create and submit a market order. This involves using the `createMarketOrder` method and then submitting it via `postOrder`. ```typescript const marketOrder = await client.createMarketOrder({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', size: 100, side: OrderSide.Buy, }) await client.postOrder(marketOrder) ``` -------------------------------- ### Order Operations: Create and Submit a Market Order Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependents Example of creating and submitting a market order using the SDK. ```APIDOC ## Order Operations: Create and Submit a Market Order ```typescript const marketOrder = await client.createMarketOrder({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', size: 100, side: OrderSide.Buy, }) await client.postOrder(marketOrder) ``` ``` -------------------------------- ### Development Setup and Scripts for prob-sdk Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0 Outlines the essential steps for setting up the development environment and common scripts for linting, testing, and building the prob-sdk packages. ```bash 1. Clone the repository 2. Install dependencies: `pnpm install` 3. Build all packages: `pnpm build` Scripts: * `pnpm lint`: Run Biome linter * `pnpm lint:fix`: Fix linting issues automatically * `pnpm test`: Run tests with Vitest * `pnpm test:watch`: Run tests in watch mode * `pnpm build`: Build all packages ``` -------------------------------- ### Install @prob/clob Package Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0_activeTab=dependencies Command to install a specific version of the '@prob/clob' package using npm. This is the standard method for adding the package as a dependency to another project. ```bash npm i @prob/clob@0.0.3 ``` -------------------------------- ### Order Operations Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=readme Provides examples for creating, submitting, and retrieving various types of orders, including limit and market orders. ```APIDOC ## Order Operations ### Create and Submit a Limit Order ```typescript import { OrderSide, LimitTimeInForce } from '@prob/clob' const order = await client.createLimitOrder({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', price: 0.6, size: 100, side: OrderSide.Buy, timeInForce: LimitTimeInForce.GTC, }) const { orderId } = await client.postOrder(order) console.log('Order created:', orderId) ``` ### Create and Submit a Market Order ```typescript const marketOrder = await client.createMarketOrder({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', size: 100, side: OrderSide.Buy, }) await client.postOrder(marketOrder) ``` ### Get Open Orders ```typescript // Get all open orders for an event const openOrders = await client.getOpenOrders({ eventId: '162' }) // Get open orders for specific tokens const tokenOrders = await client.getOpenOrders({ tokenIds: [ '74342822607920627529671190134784974807193804148539661920621719393105547397621', ], }) // Get a specific order const order = await client.getOrder({ orderId: '123', tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) ``` ``` -------------------------------- ### Order Operations: Get Open Orders Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependents Examples of retrieving open orders, including filtering by event or specific tokens, and fetching a single order. ```APIDOC ## Order Operations: Get Open Orders ```typescript // Get all open orders for an event const openOrders = await client.getOpenOrders({ eventId: '162' }) // Get open orders for specific tokens const tokenOrders = await client.getOpenOrders({ tokenIds: [ '74342822607920627529671190134784974807193804148539661920621719393105547397621', ], }) // Get a specific order const order = await client.getOrder({ orderId: '123', tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) ``` ``` -------------------------------- ### Setup CLOB client with viem wallet Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=readme Demonstrates how to create a wallet client using viem and then initialize the CLOB client with the wallet, base URL, and chain ID. It also covers generating an API key for authenticated operations. ```typescript import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { bscTestnet } from 'viem/chains' import { createClobClient } from '@prob/clob' // Create a wallet client const account = privateKeyToAccount('0x...' as `0x${string}`) const wallet = createWalletClient({ chain: bscTestnet, transport: http(), account: account, }) // Create the CLOB client const client = createClobClient({ baseUrl: '...', chainId: bscTestnet.id, wallet: wallet, }) // For methods that require authentication (order operations, trades, etc.), // generate an API key first. The API key will be automatically stored in the client. await client.generateApiKey() ``` -------------------------------- ### Install @prob/clob Package Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.1_activeTab=versions Command to install the '@prob/clob' package using npm. This is the standard way to add the package as a dependency to your project. ```bash npm i @prob/clob ``` -------------------------------- ### Order Operations: Create and Submit a Limit Order Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependents Example of creating and submitting a limit order using the SDK. ```APIDOC ## Order Operations: Create and Submit a Limit Order ```typescript import { OrderSide, LimitTimeInForce } from '@prob/clob' const order = await client.createLimitOrder({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', price: 0.6, size: 100, side: OrderSide.Buy, timeInForce: LimitTimeInForce.GTC, }) const { orderId } = await client.postOrder(order) console.log('Order created:', orderId) ``` ``` -------------------------------- ### Create and submit a market order with @prob/clob Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=readme Shows how to create and submit a market order using the CLOB client. This example specifies the token ID, size, and side for the market order. ```typescript const marketOrder = await client.createMarketOrder({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', size: 100, side: OrderSide.Buy, }) await client.postOrder(marketOrder) ``` -------------------------------- ### Get Prices using ProbClob SDK Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependencies Shows how to retrieve current prices, prices for multiple tokens, and historical price data using the ProbClob SDK. Requires an authenticated client instance. ```javascript // Get current price for a token const price = await client.getPrice({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) // Get prices for multiple tokens const prices = await client.getPrices({ tokenIds: [ '74342822607920627529671190134784974807193804148539661920621719393105547397621', '109502175175535116549611025410934749011537522542042437183890832452933730647182', ], }) // Get price history const priceHistory = await client.getPricesHistory({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', startTime: Date.now() - 86400000, // 24 hours ago endTime: Date.now(), }) ``` -------------------------------- ### Position Management API Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob APIs for managing user positions, including getting, splitting, merging, and redeeming positions. ```APIDOC ## Position Management ### Description APIs to manage and query user positions. ### Method GET/POST (Implied by client method calls) ### Endpoints - `/getCurrentPositions` - `/getClosedPositions` - `/getPendingPositions` - `/getPositionValue` - `/splitPosition` - `/mergePosition` - `/redeemPosition` ### Parameters #### Position Retrieval - **eventId** (string) - Required - The ID of the event associated with the positions. #### Position Modification - **conditionId** (string) - Required - The ID of the condition for the position. - **formattedAmount** (string) - Required - The amount to split or merge, formatted as a string. ### Request Example ```javascript // Get current positions const currentPositions = await client.getCurrentPositions({ eventId: '162' }) // Get closed positions const closedPositions = await client.getClosedPositions({ eventId: '162' }) // Get pending positions const pendingPositions = await client.getPendingPositions({ eventId: '162' }) // Get position value const positionValue = await client.getPositionValue({ eventId: '162' }) const conditionId = '0x3614ed5aa3d8ab73edd3364541f8c1c48104aa7d0bb081ed51f0f634edd8dad9' // Split Position const txHash = await client.splitPosition({ conditionId, formattedAmount: '1', }) // Merge Position const mergeTxHash = await client.mergePosition({ conditionId, formattedAmount: '1', }) // Redeem Position const redeemTxHash = await client.redeemPosition({ conditionId, }) ``` ### Response (Details not provided in source, typically position data or transaction hashes for modifications.) ``` -------------------------------- ### Get Markets (JavaScript) Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0_activeTab=versions Fetches markets associated with an event or a specific market by its ID. Requires `eventId` or `marketId`. ```javascript const markets = await client.getMarkets({ eventId: '162' }) const market = await client.getMarketById({ marketId: '123' }) ``` -------------------------------- ### Get Prices (JavaScript) Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob_activeTab=code Illustrates fetching current prices, prices for multiple tokens, and historical price data using the CLOB client. Requires token identifiers and optionally time ranges for history. Returns price information. ```javascript const price = await client.getPrice({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', }) const prices = await client.getPrices({ tokenIds: [ '74342822607920627529671190134784974807193804148539661920621719393105547397621', '109502175175535116549611025410934749011537522542042437183890832452933730647182', ], }) const priceHistory = await client.getPricesHistory({ tokenId: '74342822607920627529671190134784974807193804148539661920621719393105547397621', startTime: Date.now() - 86400000, endTime: Date.now(), }) ``` -------------------------------- ### Get Events (JavaScript) Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0_activeTab=versions Fetches a list of available events, with an option to limit the number of results. Accepts a limit parameter. ```javascript const events = await client.getEvents({ limit: 10 }) ``` -------------------------------- ### ProbClob SDK Project Structure Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0.1-alpha_activeTab=dependencies Overview of the directory structure for the ProbClob SDK, highlighting key packages and their purposes. ```text prob-sdk/ ├── packages/ │ ├── clob/ # Main SDK package │ │ ├── src/ │ │ │ ├── auth/ # Authentication (L1, L2) │ │ │ ├── clob/ # CLOB client and API methods │ │ │ ├── order/ # Order creation and management │ │ │ ├── positions/ # Position management │ │ │ ├── price/ # Price and orderbook queries │ │ │ ├── trades/ # Trade history │ │ │ └── ... │ │ └── e2e/ # End-to-end tests │ ├── core/ # Core utilities │ │ ├── src/ │ │ │ ├── abis/ # Contract ABIs │ │ │ ├── constants/ # Exchange configs and addresses │ │ │ ├── exchange/ # Exchange utilities │ │ │ ├── token/ # Token operations │ │ │ └── ... │ └── types/ # Shared TypeScript types │ └── src/ ├── package.json └── pnpm-workspace.yaml ``` -------------------------------- ### Search with CLOB Client Source: https://www.npmjs.com/package/@prob/clob/package/%40prob/clob/v/0.0_activeTab=dependencies Performs a search query within the CLOB system. Requires an initialized CLOB client and a search query string. ```javascript const results = await client.search({ query: 'bitcoin' }) ```