@keystrokehq/polymarket 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ import { D as createPolymarketClient, E as polymarketOperation, i as eventSchema, o as listEventsParamsSchema, w as tagSchema } from "./schemas-C6SqZjA-.mjs";
2
+ import { z } from "zod";
3
+
4
+ //#region src/events.ts
5
+ /**
6
+ * polymarket/events.ts
7
+ *
8
+ * Steps for listing, getting, and querying Polymarket events via the Gamma API.
9
+ */
10
+ const listEvents = polymarketOperation({
11
+ id: "list_polymarket_events",
12
+ name: "List Polymarket Events",
13
+ description: "List and filter events with query params via the Gamma API",
14
+ input: listEventsParamsSchema,
15
+ output: z.array(eventSchema),
16
+ run: async (input, credentials) => {
17
+ return createPolymarketClient(credentials).request({
18
+ host: "gamma",
19
+ method: "GET",
20
+ path: "/events",
21
+ query: input
22
+ });
23
+ }
24
+ });
25
+ const getEvent = polymarketOperation({
26
+ id: "get_polymarket_event",
27
+ name: "Get Polymarket Event",
28
+ description: "Get a single event by ID from the Gamma API",
29
+ input: z.object({ id: z.string() }),
30
+ output: eventSchema,
31
+ run: async (input, credentials) => {
32
+ return createPolymarketClient(credentials).request({
33
+ host: "gamma",
34
+ method: "GET",
35
+ path: `/events/${input.id}`
36
+ });
37
+ }
38
+ });
39
+ const getEventBySlug = polymarketOperation({
40
+ id: "get_polymarket_event_by_slug",
41
+ name: "Get Polymarket Event by Slug",
42
+ description: "Get a single event by slug from the Gamma API",
43
+ input: z.object({ slug: z.string() }),
44
+ output: eventSchema,
45
+ run: async (input, credentials) => {
46
+ return createPolymarketClient(credentials).request({
47
+ host: "gamma",
48
+ method: "GET",
49
+ path: `/events/slug/${input.slug}`
50
+ });
51
+ }
52
+ });
53
+ const getEventTags = polymarketOperation({
54
+ id: "get_polymarket_event_tags",
55
+ name: "Get Polymarket Event Tags",
56
+ description: "Get tags for an event by event ID from the Gamma API",
57
+ input: z.object({ id: z.string() }),
58
+ output: z.array(tagSchema),
59
+ run: async (input, credentials) => {
60
+ return createPolymarketClient(credentials).request({
61
+ host: "gamma",
62
+ method: "GET",
63
+ path: `/events/${input.id}/tags`
64
+ });
65
+ }
66
+ });
67
+
68
+ //#endregion
69
+ export { getEvent, getEventBySlug, getEventTags, listEvents };
@@ -0,0 +1,372 @@
1
+ import { n as polymarket, t as PolymarketCredentials } from "./integration-CSROawvr.mjs";
2
+ import { getLiveVolume, getMarketHolders, getOpenInterest, getUserPositions, listTrades } from "./data.mjs";
3
+ import { getProfile, getSeries, getSportsMarketTypes, getSportsMetadata, getSportsTeams, listSeries, listTags, search } from "./discovery.mjs";
4
+ import { getEvent, getEventBySlug, getEventTags, listEvents } from "./events.mjs";
5
+ import { getMarket, getMarketBySlug, getMarketTags, listMarkets } from "./markets.mjs";
6
+ import { batchGetOrderBooks, batchGetSpreads, getOrderBook } from "./orderbook.mjs";
7
+ import { batchGetPrices, getMidpoint, getPrice, getPriceHistory, listPrices } from "./pricing.mjs";
8
+ import { z } from "zod";
9
+
10
+ //#region src/client.d.ts
11
+ declare const POLYMARKET_HOSTS: {
12
+ readonly gamma: "https://gamma-api.polymarket.com";
13
+ readonly clob: "https://clob.polymarket.com";
14
+ readonly data: "https://data-api.polymarket.com";
15
+ };
16
+ type PolymarketHost = keyof typeof POLYMARKET_HOSTS;
17
+ interface PolymarketRequestOptions {
18
+ host: PolymarketHost;
19
+ method: 'GET' | 'POST';
20
+ path: string;
21
+ body?: unknown;
22
+ query?: Record<string, string | number | boolean | undefined>;
23
+ }
24
+ interface PolymarketClient {
25
+ request: <T = unknown>(options: PolymarketRequestOptions) => Promise<T>;
26
+ }
27
+ /**
28
+ * Create a Polymarket API client from resolved credentials.
29
+ *
30
+ * @param credentials - Resolved credentials containing the API key
31
+ * @returns A client with a typed `request` method
32
+ */
33
+ declare function createPolymarketClient(credentials: PolymarketCredentials): PolymarketClient;
34
+ //#endregion
35
+ //#region src/schemas.d.ts
36
+ /**
37
+ * Pagination params used by all list endpoints (offset-based).
38
+ */
39
+ declare const paginationParamsSchema: z.ZodObject<{
40
+ limit: z.ZodOptional<z.ZodNumber>;
41
+ offset: z.ZodOptional<z.ZodNumber>;
42
+ }, z.core.$strip>;
43
+ type PaginationParams = z.infer<typeof paginationParamsSchema>;
44
+ declare const tagSchema: z.ZodObject<{
45
+ id: z.ZodString;
46
+ label: z.ZodString;
47
+ slug: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$loose>;
49
+ type Tag = z.infer<typeof tagSchema>;
50
+ /**
51
+ * Market object from Gamma API.
52
+ * Has 100+ fields — key fields are modeled explicitly with .passthrough() for the rest.
53
+ */
54
+ declare const marketSchema: z.ZodObject<{
55
+ id: z.ZodString;
56
+ question: z.ZodString;
57
+ conditionId: z.ZodString;
58
+ slug: z.ZodString;
59
+ endDate: z.ZodOptional<z.ZodString>;
60
+ startDate: z.ZodOptional<z.ZodString>;
61
+ description: z.ZodOptional<z.ZodString>;
62
+ outcomes: z.ZodOptional<z.ZodString>;
63
+ outcomePrices: z.ZodOptional<z.ZodString>;
64
+ volume: z.ZodOptional<z.ZodString>;
65
+ volumeNum: z.ZodOptional<z.ZodNumber>;
66
+ liquidity: z.ZodOptional<z.ZodString>;
67
+ liquidityNum: z.ZodOptional<z.ZodNumber>;
68
+ bestBid: z.ZodOptional<z.ZodNumber>;
69
+ bestAsk: z.ZodOptional<z.ZodNumber>;
70
+ lastTradePrice: z.ZodOptional<z.ZodNumber>;
71
+ active: z.ZodOptional<z.ZodBoolean>;
72
+ closed: z.ZodOptional<z.ZodBoolean>;
73
+ archived: z.ZodOptional<z.ZodBoolean>;
74
+ acceptingOrders: z.ZodOptional<z.ZodBoolean>;
75
+ clobTokenIds: z.ZodOptional<z.ZodString>;
76
+ image: z.ZodOptional<z.ZodString>;
77
+ icon: z.ZodOptional<z.ZodString>;
78
+ groupItemTitle: z.ZodOptional<z.ZodString>;
79
+ groupItemThreshold: z.ZodOptional<z.ZodString>;
80
+ enableOrderBook: z.ZodOptional<z.ZodBoolean>;
81
+ createdAt: z.ZodOptional<z.ZodString>;
82
+ updatedAt: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$loose>;
84
+ type Market = z.infer<typeof marketSchema>;
85
+ /**
86
+ * List markets query params.
87
+ */
88
+ declare const listMarketsParamsSchema: z.ZodObject<{
89
+ limit: z.ZodOptional<z.ZodNumber>;
90
+ offset: z.ZodOptional<z.ZodNumber>;
91
+ order: z.ZodOptional<z.ZodEnum<{
92
+ volume24hr: "volume24hr";
93
+ volumeNum: "volumeNum";
94
+ liquidityNum: "liquidityNum";
95
+ startDate: "startDate";
96
+ endDate: "endDate";
97
+ competitive: "competitive";
98
+ closedTime: "closedTime";
99
+ }>>;
100
+ ascending: z.ZodOptional<z.ZodBoolean>;
101
+ id: z.ZodOptional<z.ZodString>;
102
+ slug: z.ZodOptional<z.ZodString>;
103
+ clob_token_ids: z.ZodOptional<z.ZodString>;
104
+ condition_ids: z.ZodOptional<z.ZodString>;
105
+ liquidity_num_min: z.ZodOptional<z.ZodNumber>;
106
+ liquidity_num_max: z.ZodOptional<z.ZodNumber>;
107
+ volume_num_min: z.ZodOptional<z.ZodNumber>;
108
+ volume_num_max: z.ZodOptional<z.ZodNumber>;
109
+ start_date_min: z.ZodOptional<z.ZodString>;
110
+ start_date_max: z.ZodOptional<z.ZodString>;
111
+ end_date_min: z.ZodOptional<z.ZodString>;
112
+ end_date_max: z.ZodOptional<z.ZodString>;
113
+ tag_id: z.ZodOptional<z.ZodNumber>;
114
+ closed: z.ZodOptional<z.ZodBoolean>;
115
+ active: z.ZodOptional<z.ZodBoolean>;
116
+ }, z.core.$strip>;
117
+ type ListMarketsParams = z.infer<typeof listMarketsParamsSchema>;
118
+ /**
119
+ * Event object from Gamma API.
120
+ * Rich nested structure with markets[], tags[], categories[].
121
+ */
122
+ declare const eventSchema: z.ZodObject<{
123
+ id: z.ZodString;
124
+ title: z.ZodString;
125
+ slug: z.ZodString;
126
+ description: z.ZodOptional<z.ZodString>;
127
+ startDate: z.ZodOptional<z.ZodString>;
128
+ endDate: z.ZodOptional<z.ZodString>;
129
+ active: z.ZodOptional<z.ZodBoolean>;
130
+ closed: z.ZodOptional<z.ZodBoolean>;
131
+ archived: z.ZodOptional<z.ZodBoolean>;
132
+ featured: z.ZodOptional<z.ZodBoolean>;
133
+ liquidity: z.ZodOptional<z.ZodNumber>;
134
+ volume: z.ZodOptional<z.ZodNumber>;
135
+ createdAt: z.ZodOptional<z.ZodString>;
136
+ updatedAt: z.ZodOptional<z.ZodString>;
137
+ markets: z.ZodOptional<z.ZodArray<z.ZodObject<{
138
+ id: z.ZodString;
139
+ question: z.ZodString;
140
+ conditionId: z.ZodString;
141
+ slug: z.ZodString;
142
+ endDate: z.ZodOptional<z.ZodString>;
143
+ startDate: z.ZodOptional<z.ZodString>;
144
+ description: z.ZodOptional<z.ZodString>;
145
+ outcomes: z.ZodOptional<z.ZodString>;
146
+ outcomePrices: z.ZodOptional<z.ZodString>;
147
+ volume: z.ZodOptional<z.ZodString>;
148
+ volumeNum: z.ZodOptional<z.ZodNumber>;
149
+ liquidity: z.ZodOptional<z.ZodString>;
150
+ liquidityNum: z.ZodOptional<z.ZodNumber>;
151
+ bestBid: z.ZodOptional<z.ZodNumber>;
152
+ bestAsk: z.ZodOptional<z.ZodNumber>;
153
+ lastTradePrice: z.ZodOptional<z.ZodNumber>;
154
+ active: z.ZodOptional<z.ZodBoolean>;
155
+ closed: z.ZodOptional<z.ZodBoolean>;
156
+ archived: z.ZodOptional<z.ZodBoolean>;
157
+ acceptingOrders: z.ZodOptional<z.ZodBoolean>;
158
+ clobTokenIds: z.ZodOptional<z.ZodString>;
159
+ image: z.ZodOptional<z.ZodString>;
160
+ icon: z.ZodOptional<z.ZodString>;
161
+ groupItemTitle: z.ZodOptional<z.ZodString>;
162
+ groupItemThreshold: z.ZodOptional<z.ZodString>;
163
+ enableOrderBook: z.ZodOptional<z.ZodBoolean>;
164
+ createdAt: z.ZodOptional<z.ZodString>;
165
+ updatedAt: z.ZodOptional<z.ZodString>;
166
+ }, z.core.$loose>>>;
167
+ tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
168
+ id: z.ZodString;
169
+ label: z.ZodString;
170
+ slug: z.ZodOptional<z.ZodString>;
171
+ }, z.core.$loose>>>;
172
+ categories: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
173
+ }, z.core.$loose>;
174
+ type Event = z.infer<typeof eventSchema>;
175
+ /**
176
+ * List events query params.
177
+ */
178
+ declare const listEventsParamsSchema: z.ZodObject<{
179
+ limit: z.ZodOptional<z.ZodNumber>;
180
+ offset: z.ZodOptional<z.ZodNumber>;
181
+ order: z.ZodOptional<z.ZodString>;
182
+ ascending: z.ZodOptional<z.ZodBoolean>;
183
+ id: z.ZodOptional<z.ZodString>;
184
+ slug: z.ZodOptional<z.ZodString>;
185
+ tag_id: z.ZodOptional<z.ZodNumber>;
186
+ tag_slug: z.ZodOptional<z.ZodString>;
187
+ active: z.ZodOptional<z.ZodBoolean>;
188
+ archived: z.ZodOptional<z.ZodBoolean>;
189
+ featured: z.ZodOptional<z.ZodBoolean>;
190
+ closed: z.ZodOptional<z.ZodBoolean>;
191
+ liquidity_min: z.ZodOptional<z.ZodNumber>;
192
+ liquidity_max: z.ZodOptional<z.ZodNumber>;
193
+ volume_min: z.ZodOptional<z.ZodNumber>;
194
+ volume_max: z.ZodOptional<z.ZodNumber>;
195
+ start_date_min: z.ZodOptional<z.ZodString>;
196
+ start_date_max: z.ZodOptional<z.ZodString>;
197
+ end_date_min: z.ZodOptional<z.ZodString>;
198
+ end_date_max: z.ZodOptional<z.ZodString>;
199
+ }, z.core.$strip>;
200
+ type ListEventsParams = z.infer<typeof listEventsParamsSchema>;
201
+ declare const seriesSchema: z.ZodObject<{
202
+ id: z.ZodString;
203
+ title: z.ZodString;
204
+ slug: z.ZodOptional<z.ZodString>;
205
+ description: z.ZodOptional<z.ZodString>;
206
+ }, z.core.$loose>;
207
+ type Series = z.infer<typeof seriesSchema>;
208
+ declare const searchResultSchema: z.ZodObject<{
209
+ events: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
210
+ tags: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
211
+ profiles: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
212
+ pagination: z.ZodOptional<z.ZodObject<{
213
+ hasMore: z.ZodOptional<z.ZodBoolean>;
214
+ totalResults: z.ZodOptional<z.ZodNumber>;
215
+ }, z.core.$strip>>;
216
+ }, z.core.$strip>;
217
+ type SearchResult = z.infer<typeof searchResultSchema>;
218
+ declare const profileSchema: z.ZodObject<{
219
+ address: z.ZodString;
220
+ pseudonym: z.ZodOptional<z.ZodString>;
221
+ bio: z.ZodOptional<z.ZodString>;
222
+ profileImage: z.ZodOptional<z.ZodString>;
223
+ displayUsernamePublic: z.ZodOptional<z.ZodBoolean>;
224
+ }, z.core.$loose>;
225
+ type Profile = z.infer<typeof profileSchema>;
226
+ declare const sportsMetadataSchema: z.ZodUnknown;
227
+ declare const sportsMarketTypeSchema: z.ZodUnknown;
228
+ declare const sportsTeamSchema: z.ZodUnknown;
229
+ /**
230
+ * CLOB price response — prices are strings, not numbers.
231
+ */
232
+ declare const clobPriceSchema: z.ZodObject<{
233
+ price: z.ZodString;
234
+ }, z.core.$strip>;
235
+ type ClobPrice = z.infer<typeof clobPriceSchema>;
236
+ /**
237
+ * CLOB midpoint response.
238
+ */
239
+ declare const clobMidpointSchema: z.ZodObject<{
240
+ mid: z.ZodString;
241
+ }, z.core.$strip>;
242
+ type ClobMidpoint = z.infer<typeof clobMidpointSchema>;
243
+ /**
244
+ * CLOB /prices response — Record<token_id, { BUY: string, SELL: string }>
245
+ */
246
+ declare const clobPricesMapSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
247
+ BUY: z.ZodString;
248
+ SELL: z.ZodString;
249
+ }, z.core.$strip>>;
250
+ type ClobPricesMap = z.infer<typeof clobPricesMapSchema>;
251
+ /**
252
+ * CLOB price history point.
253
+ */
254
+ declare const priceHistoryPointSchema: z.ZodObject<{
255
+ t: z.ZodNumber;
256
+ p: z.ZodNumber;
257
+ }, z.core.$strip>;
258
+ type PriceHistoryPoint = z.infer<typeof priceHistoryPointSchema>;
259
+ /**
260
+ * CLOB /prices-history response.
261
+ */
262
+ declare const priceHistoryResponseSchema: z.ZodObject<{
263
+ history: z.ZodArray<z.ZodObject<{
264
+ t: z.ZodNumber;
265
+ p: z.ZodNumber;
266
+ }, z.core.$strip>>;
267
+ }, z.core.$strip>;
268
+ type PriceHistoryResponse = z.infer<typeof priceHistoryResponseSchema>;
269
+ /**
270
+ * Order book entry (bid or ask) — prices and sizes are strings.
271
+ */
272
+ declare const orderBookEntrySchema: z.ZodObject<{
273
+ price: z.ZodString;
274
+ size: z.ZodString;
275
+ }, z.core.$strip>;
276
+ type OrderBookEntry = z.infer<typeof orderBookEntrySchema>;
277
+ /**
278
+ * Order book summary for a token.
279
+ */
280
+ declare const orderBookSummarySchema: z.ZodObject<{
281
+ market: z.ZodOptional<z.ZodString>;
282
+ asset_id: z.ZodString;
283
+ timestamp: z.ZodOptional<z.ZodString>;
284
+ hash: z.ZodOptional<z.ZodString>;
285
+ bids: z.ZodArray<z.ZodObject<{
286
+ price: z.ZodString;
287
+ size: z.ZodString;
288
+ }, z.core.$strip>>;
289
+ asks: z.ZodArray<z.ZodObject<{
290
+ price: z.ZodString;
291
+ size: z.ZodString;
292
+ }, z.core.$strip>>;
293
+ min_order_size: z.ZodOptional<z.ZodString>;
294
+ tick_size: z.ZodOptional<z.ZodString>;
295
+ neg_risk: z.ZodOptional<z.ZodBoolean>;
296
+ }, z.core.$loose>;
297
+ type OrderBookSummary = z.infer<typeof orderBookSummarySchema>;
298
+ /**
299
+ * Spread for a token.
300
+ */
301
+ declare const spreadSchema: z.ZodObject<{
302
+ asset_id: z.ZodString;
303
+ spread: z.ZodString;
304
+ bid: z.ZodOptional<z.ZodString>;
305
+ ask: z.ZodOptional<z.ZodString>;
306
+ }, z.core.$loose>;
307
+ type Spread = z.infer<typeof spreadSchema>;
308
+ declare const tradeSchema: z.ZodObject<{
309
+ id: z.ZodOptional<z.ZodString>;
310
+ taker_order_id: z.ZodOptional<z.ZodString>;
311
+ market: z.ZodOptional<z.ZodString>;
312
+ asset_id: z.ZodOptional<z.ZodString>;
313
+ side: z.ZodOptional<z.ZodString>;
314
+ size: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>;
315
+ fee_rate_bps: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>;
316
+ price: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>;
317
+ status: z.ZodOptional<z.ZodString>;
318
+ match_time: z.ZodOptional<z.ZodString>;
319
+ last_update: z.ZodOptional<z.ZodString>;
320
+ outcome: z.ZodOptional<z.ZodString>;
321
+ maker_address: z.ZodOptional<z.ZodString>;
322
+ trader_side: z.ZodOptional<z.ZodString>;
323
+ transaction_hash: z.ZodOptional<z.ZodString>;
324
+ bucket_index: z.ZodOptional<z.ZodNumber>;
325
+ owner: z.ZodOptional<z.ZodString>;
326
+ type: z.ZodOptional<z.ZodString>;
327
+ }, z.core.$loose>;
328
+ type Trade = z.infer<typeof tradeSchema>;
329
+ declare const positionSchema: z.ZodObject<{
330
+ asset: z.ZodOptional<z.ZodString>;
331
+ conditionId: z.ZodOptional<z.ZodString>;
332
+ proxyWallet: z.ZodOptional<z.ZodString>;
333
+ size: z.ZodOptional<z.ZodNumber>;
334
+ avgPrice: z.ZodOptional<z.ZodNumber>;
335
+ initialValue: z.ZodOptional<z.ZodNumber>;
336
+ currentValue: z.ZodOptional<z.ZodNumber>;
337
+ cashPnl: z.ZodOptional<z.ZodNumber>;
338
+ percentPnl: z.ZodOptional<z.ZodNumber>;
339
+ totalBought: z.ZodOptional<z.ZodNumber>;
340
+ totalSold: z.ZodOptional<z.ZodNumber>;
341
+ realizedPnl: z.ZodOptional<z.ZodNumber>;
342
+ curPrice: z.ZodOptional<z.ZodNumber>;
343
+ redeemed: z.ZodOptional<z.ZodBoolean>;
344
+ mergeable: z.ZodOptional<z.ZodBoolean>;
345
+ outcome: z.ZodOptional<z.ZodString>;
346
+ title: z.ZodOptional<z.ZodString>;
347
+ slug: z.ZodOptional<z.ZodString>;
348
+ icon: z.ZodOptional<z.ZodString>;
349
+ eventSlug: z.ZodOptional<z.ZodString>;
350
+ eventTitle: z.ZodOptional<z.ZodString>;
351
+ }, z.core.$loose>;
352
+ type Position = z.infer<typeof positionSchema>;
353
+ declare const holderSchema: z.ZodObject<{
354
+ address: z.ZodOptional<z.ZodString>;
355
+ proxyWallet: z.ZodOptional<z.ZodString>;
356
+ amount: z.ZodOptional<z.ZodNumber>;
357
+ value: z.ZodOptional<z.ZodNumber>;
358
+ position: z.ZodOptional<z.ZodString>;
359
+ }, z.core.$loose>;
360
+ type Holder = z.infer<typeof holderSchema>;
361
+ declare const openInterestSchema: z.ZodObject<{
362
+ conditionId: z.ZodOptional<z.ZodString>;
363
+ openInterest: z.ZodOptional<z.ZodNumber>;
364
+ }, z.core.$loose>;
365
+ type OpenInterest = z.infer<typeof openInterestSchema>;
366
+ declare const liveVolumeSchema: z.ZodObject<{
367
+ volume: z.ZodOptional<z.ZodNumber>;
368
+ volume24hr: z.ZodOptional<z.ZodNumber>;
369
+ }, z.core.$loose>;
370
+ type LiveVolume = z.infer<typeof liveVolumeSchema>;
371
+ //#endregion
372
+ export { type ClobMidpoint, type ClobPrice, type ClobPricesMap, type Event, type Holder, type ListEventsParams, type ListMarketsParams, type LiveVolume, type Market, type OpenInterest, type OrderBookEntry, type OrderBookSummary, type PaginationParams, type PolymarketClient, type PolymarketCredentials, type PolymarketHost, type PolymarketRequestOptions, type Position, type PriceHistoryPoint, type PriceHistoryResponse, type Profile, type SearchResult, type Series, type Spread, type Tag, type Trade, batchGetOrderBooks, batchGetPrices, batchGetSpreads, clobMidpointSchema, clobPriceSchema, clobPricesMapSchema, createPolymarketClient, eventSchema, getEvent, getEventBySlug, getEventTags, getLiveVolume, getMarket, getMarketBySlug, getMarketHolders, getMarketTags, getMidpoint, getOpenInterest, getOrderBook, getPrice, getPriceHistory, getProfile, getSeries, getSportsMarketTypes, getSportsMetadata, getSportsTeams, getUserPositions, holderSchema, listEvents, listEventsParamsSchema, listMarkets, listMarketsParamsSchema, listPrices, listSeries, listTags, listTrades, liveVolumeSchema, marketSchema, openInterestSchema, orderBookEntrySchema, orderBookSummarySchema, paginationParamsSchema, polymarket, positionSchema, priceHistoryPointSchema, priceHistoryResponseSchema, profileSchema, search, searchResultSchema, seriesSchema, sportsMarketTypeSchema, sportsMetadataSchema, sportsTeamSchema, spreadSchema, tagSchema, tradeSchema };
package/dist/index.mjs ADDED
@@ -0,0 +1,10 @@
1
+ import { C as spreadSchema, D as createPolymarketClient, S as sportsTeamSchema, T as tradeSchema, _ as profileSchema, a as holderSchema, b as sportsMarketTypeSchema, c as liveVolumeSchema, d as orderBookEntrySchema, f as orderBookSummarySchema, g as priceHistoryResponseSchema, h as priceHistoryPointSchema, i as eventSchema, l as marketSchema, m as positionSchema, n as clobPriceSchema, o as listEventsParamsSchema, p as paginationParamsSchema, r as clobPricesMapSchema, s as listMarketsParamsSchema, t as clobMidpointSchema, u as openInterestSchema, v as searchResultSchema, w as tagSchema, x as sportsMetadataSchema, y as seriesSchema } from "./schemas-C6SqZjA-.mjs";
2
+ import { t as polymarket } from "./integration-KDxC97JC.mjs";
3
+ import { getLiveVolume, getMarketHolders, getOpenInterest, getUserPositions, listTrades } from "./data.mjs";
4
+ import { getProfile, getSeries, getSportsMarketTypes, getSportsMetadata, getSportsTeams, listSeries, listTags, search } from "./discovery.mjs";
5
+ import { getEvent, getEventBySlug, getEventTags, listEvents } from "./events.mjs";
6
+ import { getMarket, getMarketBySlug, getMarketTags, listMarkets } from "./markets.mjs";
7
+ import { batchGetOrderBooks, batchGetSpreads, getOrderBook } from "./orderbook.mjs";
8
+ import { batchGetPrices, getMidpoint, getPrice, getPriceHistory, listPrices } from "./pricing.mjs";
9
+
10
+ export { batchGetOrderBooks, batchGetPrices, batchGetSpreads, clobMidpointSchema, clobPriceSchema, clobPricesMapSchema, createPolymarketClient, eventSchema, getEvent, getEventBySlug, getEventTags, getLiveVolume, getMarket, getMarketBySlug, getMarketHolders, getMarketTags, getMidpoint, getOpenInterest, getOrderBook, getPrice, getPriceHistory, getProfile, getSeries, getSportsMarketTypes, getSportsMetadata, getSportsTeams, getUserPositions, holderSchema, listEvents, listEventsParamsSchema, listMarkets, listMarketsParamsSchema, listPrices, listSeries, listTags, listTrades, liveVolumeSchema, marketSchema, openInterestSchema, orderBookEntrySchema, orderBookSummarySchema, paginationParamsSchema, polymarket, positionSchema, priceHistoryPointSchema, priceHistoryResponseSchema, profileSchema, search, searchResultSchema, seriesSchema, sportsMarketTypeSchema, sportsMetadataSchema, sportsTeamSchema, spreadSchema, tagSchema, tradeSchema };
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ import * as _keystrokehq_integration_authoring_official0 from "@keystrokehq/integration-authoring/official";
3
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
+ import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
+ import * as _keystrokehq_core0 from "@keystrokehq/core";
6
+
7
+ //#region src/integration.d.ts
8
+ declare const polymarketBundle: _keystrokehq_integration_authoring_official0.OfficialIntegrationBundle<"polymarket", z.ZodObject<{
9
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
10
+ }, z.core.$strip>>;
11
+ declare const polymarket: _keystrokehq_core0.CredentialSet<"polymarket", z.ZodObject<{
12
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
13
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
14
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>>[] | undefined>;
16
+ /**
17
+ * Credentials injected into steps.
18
+ * Derived from the integration definition.
19
+ */
20
+ type PolymarketCredentials = InferCredentialSetAuth<typeof polymarket>;
21
+ //#endregion
22
+ export { polymarket as n, polymarketBundle as r, PolymarketCredentials as t };
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import { defineOfficialIntegration } from "@keystrokehq/integration-authoring/official";
3
+
4
+ //#region src/integration.ts
5
+ const polymarketAuthSchema = z.object({ POLYMARKET_API_KEY: z.string().optional() });
6
+ /**
7
+ * Polymarket integration — prediction market data via three public APIs.
8
+ *
9
+ * The API key is stored as a credential and included as a header when present.
10
+ * This enables future support for authenticated CLOB trading endpoints.
11
+ */
12
+ const polymarketOfficialIntegration = {
13
+ id: "polymarket",
14
+ name: "Polymarket",
15
+ description: "Polymarket — decentralized prediction market data",
16
+ auth: polymarketAuthSchema,
17
+ proxy: { hosts: [
18
+ "gamma-api.polymarket.com",
19
+ "clob.polymarket.com",
20
+ "data-api.polymarket.com"
21
+ ] }
22
+ };
23
+ const polymarketBundle = defineOfficialIntegration(polymarketOfficialIntegration);
24
+ const polymarket = polymarketBundle.credentialSet;
25
+
26
+ //#endregion
27
+ export { polymarketBundle as n, polymarket as t };
@@ -0,0 +1,152 @@
1
+ import { z } from "zod";
2
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
3
+ import * as _keystrokehq_core0 from "@keystrokehq/core";
4
+
5
+ //#region src/markets.d.ts
6
+ declare const listMarkets: _keystrokehq_core0.Operation<z.ZodObject<{
7
+ limit: z.ZodOptional<z.ZodNumber>;
8
+ offset: z.ZodOptional<z.ZodNumber>;
9
+ order: z.ZodOptional<z.ZodEnum<{
10
+ volume24hr: "volume24hr";
11
+ volumeNum: "volumeNum";
12
+ liquidityNum: "liquidityNum";
13
+ startDate: "startDate";
14
+ endDate: "endDate";
15
+ competitive: "competitive";
16
+ closedTime: "closedTime";
17
+ }>>;
18
+ ascending: z.ZodOptional<z.ZodBoolean>;
19
+ id: z.ZodOptional<z.ZodString>;
20
+ slug: z.ZodOptional<z.ZodString>;
21
+ clob_token_ids: z.ZodOptional<z.ZodString>;
22
+ condition_ids: z.ZodOptional<z.ZodString>;
23
+ liquidity_num_min: z.ZodOptional<z.ZodNumber>;
24
+ liquidity_num_max: z.ZodOptional<z.ZodNumber>;
25
+ volume_num_min: z.ZodOptional<z.ZodNumber>;
26
+ volume_num_max: z.ZodOptional<z.ZodNumber>;
27
+ start_date_min: z.ZodOptional<z.ZodString>;
28
+ start_date_max: z.ZodOptional<z.ZodString>;
29
+ end_date_min: z.ZodOptional<z.ZodString>;
30
+ end_date_max: z.ZodOptional<z.ZodString>;
31
+ tag_id: z.ZodOptional<z.ZodNumber>;
32
+ closed: z.ZodOptional<z.ZodBoolean>;
33
+ active: z.ZodOptional<z.ZodBoolean>;
34
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
35
+ id: z.ZodString;
36
+ question: z.ZodString;
37
+ conditionId: z.ZodString;
38
+ slug: z.ZodString;
39
+ endDate: z.ZodOptional<z.ZodString>;
40
+ startDate: z.ZodOptional<z.ZodString>;
41
+ description: z.ZodOptional<z.ZodString>;
42
+ outcomes: z.ZodOptional<z.ZodString>;
43
+ outcomePrices: z.ZodOptional<z.ZodString>;
44
+ volume: z.ZodOptional<z.ZodString>;
45
+ volumeNum: z.ZodOptional<z.ZodNumber>;
46
+ liquidity: z.ZodOptional<z.ZodString>;
47
+ liquidityNum: z.ZodOptional<z.ZodNumber>;
48
+ bestBid: z.ZodOptional<z.ZodNumber>;
49
+ bestAsk: z.ZodOptional<z.ZodNumber>;
50
+ lastTradePrice: z.ZodOptional<z.ZodNumber>;
51
+ active: z.ZodOptional<z.ZodBoolean>;
52
+ closed: z.ZodOptional<z.ZodBoolean>;
53
+ archived: z.ZodOptional<z.ZodBoolean>;
54
+ acceptingOrders: z.ZodOptional<z.ZodBoolean>;
55
+ clobTokenIds: z.ZodOptional<z.ZodString>;
56
+ image: z.ZodOptional<z.ZodString>;
57
+ icon: z.ZodOptional<z.ZodString>;
58
+ groupItemTitle: z.ZodOptional<z.ZodString>;
59
+ groupItemThreshold: z.ZodOptional<z.ZodString>;
60
+ enableOrderBook: z.ZodOptional<z.ZodBoolean>;
61
+ createdAt: z.ZodOptional<z.ZodString>;
62
+ updatedAt: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$loose>>, readonly [_keystrokehq_core0.CredentialSet<"polymarket", z.ZodObject<{
64
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
65
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
66
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strip>>[] | undefined>], undefined>;
68
+ declare const getMarket: _keystrokehq_core0.Operation<z.ZodObject<{
69
+ id: z.ZodString;
70
+ }, z.core.$strip>, z.ZodObject<{
71
+ id: z.ZodString;
72
+ question: z.ZodString;
73
+ conditionId: z.ZodString;
74
+ slug: z.ZodString;
75
+ endDate: z.ZodOptional<z.ZodString>;
76
+ startDate: z.ZodOptional<z.ZodString>;
77
+ description: z.ZodOptional<z.ZodString>;
78
+ outcomes: z.ZodOptional<z.ZodString>;
79
+ outcomePrices: z.ZodOptional<z.ZodString>;
80
+ volume: z.ZodOptional<z.ZodString>;
81
+ volumeNum: z.ZodOptional<z.ZodNumber>;
82
+ liquidity: z.ZodOptional<z.ZodString>;
83
+ liquidityNum: z.ZodOptional<z.ZodNumber>;
84
+ bestBid: z.ZodOptional<z.ZodNumber>;
85
+ bestAsk: z.ZodOptional<z.ZodNumber>;
86
+ lastTradePrice: z.ZodOptional<z.ZodNumber>;
87
+ active: z.ZodOptional<z.ZodBoolean>;
88
+ closed: z.ZodOptional<z.ZodBoolean>;
89
+ archived: z.ZodOptional<z.ZodBoolean>;
90
+ acceptingOrders: z.ZodOptional<z.ZodBoolean>;
91
+ clobTokenIds: z.ZodOptional<z.ZodString>;
92
+ image: z.ZodOptional<z.ZodString>;
93
+ icon: z.ZodOptional<z.ZodString>;
94
+ groupItemTitle: z.ZodOptional<z.ZodString>;
95
+ groupItemThreshold: z.ZodOptional<z.ZodString>;
96
+ enableOrderBook: z.ZodOptional<z.ZodBoolean>;
97
+ createdAt: z.ZodOptional<z.ZodString>;
98
+ updatedAt: z.ZodOptional<z.ZodString>;
99
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"polymarket", z.ZodObject<{
100
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
101
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
102
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$strip>>[] | undefined>], undefined>;
104
+ declare const getMarketBySlug: _keystrokehq_core0.Operation<z.ZodObject<{
105
+ slug: z.ZodString;
106
+ }, z.core.$strip>, z.ZodObject<{
107
+ id: z.ZodString;
108
+ question: z.ZodString;
109
+ conditionId: z.ZodString;
110
+ slug: z.ZodString;
111
+ endDate: z.ZodOptional<z.ZodString>;
112
+ startDate: z.ZodOptional<z.ZodString>;
113
+ description: z.ZodOptional<z.ZodString>;
114
+ outcomes: z.ZodOptional<z.ZodString>;
115
+ outcomePrices: z.ZodOptional<z.ZodString>;
116
+ volume: z.ZodOptional<z.ZodString>;
117
+ volumeNum: z.ZodOptional<z.ZodNumber>;
118
+ liquidity: z.ZodOptional<z.ZodString>;
119
+ liquidityNum: z.ZodOptional<z.ZodNumber>;
120
+ bestBid: z.ZodOptional<z.ZodNumber>;
121
+ bestAsk: z.ZodOptional<z.ZodNumber>;
122
+ lastTradePrice: z.ZodOptional<z.ZodNumber>;
123
+ active: z.ZodOptional<z.ZodBoolean>;
124
+ closed: z.ZodOptional<z.ZodBoolean>;
125
+ archived: z.ZodOptional<z.ZodBoolean>;
126
+ acceptingOrders: z.ZodOptional<z.ZodBoolean>;
127
+ clobTokenIds: z.ZodOptional<z.ZodString>;
128
+ image: z.ZodOptional<z.ZodString>;
129
+ icon: z.ZodOptional<z.ZodString>;
130
+ groupItemTitle: z.ZodOptional<z.ZodString>;
131
+ groupItemThreshold: z.ZodOptional<z.ZodString>;
132
+ enableOrderBook: z.ZodOptional<z.ZodBoolean>;
133
+ createdAt: z.ZodOptional<z.ZodString>;
134
+ updatedAt: z.ZodOptional<z.ZodString>;
135
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"polymarket", z.ZodObject<{
136
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
138
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
139
+ }, z.core.$strip>>[] | undefined>], undefined>;
140
+ declare const getMarketTags: _keystrokehq_core0.Operation<z.ZodObject<{
141
+ id: z.ZodString;
142
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
143
+ id: z.ZodString;
144
+ label: z.ZodString;
145
+ slug: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$loose>>, readonly [_keystrokehq_core0.CredentialSet<"polymarket", z.ZodObject<{
147
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
148
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
149
+ POLYMARKET_API_KEY: z.ZodOptional<z.ZodString>;
150
+ }, z.core.$strip>>[] | undefined>], undefined>;
151
+ //#endregion
152
+ export { getMarket, getMarketBySlug, getMarketTags, listMarkets };