@polyman/core
v0.1.0
Published
Shared HTTP client, types, and constants for Polymarket API packages
Downloads
107
Readme
@polyman/core
Shared HTTP client, types, and constants used by all @polyman/* packages.
Features
- Lightweight
fetch-based HTTP client (viaundici) - Automatic proxy support via
HTTPS_PROXY/HTTP_PROXYenv vars - Common TypeScript types (
PaginatedResponse,TokenInfo,ApiError) - Polymarket API base URL constants
Installation
npm install @polyman/coreUsage
import { HttpClient, API_URLS, ApiError } from '@polyman/core';
const client = new HttpClient(API_URLS.GAMMA);
try {
const data = await client.get('/markets', { params: { limit: 10 } });
} catch (err) {
if (err instanceof ApiError) {
console.error(err.status, err.url, err.message);
}
}API Constants
import { API_URLS } from '@polyman/core';
API_URLS.GAMMA // https://gamma-api.polymarket.com
API_URLS.CLOB // https://clob.polymarket.com
API_URLS.DATA // https://data-api.polymarket.com
API_URLS.WS // wss://ws-subscriptions-clob.polymarket.comLicense
ISC
