pmxt-core 2.50.16 → 2.51.0

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.
Files changed (50) hide show
  1. package/dist/exchanges/hunch/api.d.ts +736 -0
  2. package/dist/exchanges/hunch/api.js +820 -0
  3. package/dist/exchanges/hunch/auth.d.ts +36 -0
  4. package/dist/exchanges/hunch/auth.js +63 -0
  5. package/dist/exchanges/hunch/errors.d.ts +26 -0
  6. package/dist/exchanges/hunch/errors.js +94 -0
  7. package/dist/exchanges/hunch/fetcher.d.ts +204 -0
  8. package/dist/exchanges/hunch/fetcher.js +130 -0
  9. package/dist/exchanges/hunch/index.d.ts +51 -0
  10. package/dist/exchanges/hunch/index.js +330 -0
  11. package/dist/exchanges/hunch/normalizer.d.ts +56 -0
  12. package/dist/exchanges/hunch/normalizer.js +180 -0
  13. package/dist/exchanges/hunch/price.d.ts +5 -0
  14. package/dist/exchanges/hunch/price.js +12 -0
  15. package/dist/exchanges/hunch/utils.d.ts +79 -0
  16. package/dist/exchanges/hunch/utils.js +182 -0
  17. package/dist/exchanges/hunch/websocket.d.ts +25 -0
  18. package/dist/exchanges/hunch/websocket.js +137 -0
  19. package/dist/exchanges/hyperliquid/auth.js +15 -2
  20. package/dist/exchanges/hyperliquid/fetcher.d.ts +26 -1
  21. package/dist/exchanges/hyperliquid/fetcher.js +66 -4
  22. package/dist/exchanges/hyperliquid/index.d.ts +4 -1
  23. package/dist/exchanges/hyperliquid/index.js +84 -20
  24. package/dist/exchanges/hyperliquid/normalizer.d.ts +4 -3
  25. package/dist/exchanges/hyperliquid/normalizer.js +69 -11
  26. package/dist/exchanges/hyperliquid/utils.d.ts +7 -1
  27. package/dist/exchanges/hyperliquid/utils.js +16 -4
  28. package/dist/exchanges/kalshi/api.d.ts +1 -1
  29. package/dist/exchanges/kalshi/api.js +1 -1
  30. package/dist/exchanges/limitless/api.d.ts +1 -1
  31. package/dist/exchanges/limitless/api.js +1 -1
  32. package/dist/exchanges/myriad/api.d.ts +1 -1
  33. package/dist/exchanges/myriad/api.js +1 -1
  34. package/dist/exchanges/opinion/api.d.ts +1 -1
  35. package/dist/exchanges/opinion/api.js +1 -1
  36. package/dist/exchanges/polymarket/api-clob.d.ts +1 -1
  37. package/dist/exchanges/polymarket/api-clob.js +1 -1
  38. package/dist/exchanges/polymarket/api-data.d.ts +1 -1
  39. package/dist/exchanges/polymarket/api-data.js +1 -1
  40. package/dist/exchanges/polymarket/api-gamma.d.ts +1 -1
  41. package/dist/exchanges/polymarket/api-gamma.js +1 -1
  42. package/dist/exchanges/probable/api.d.ts +1 -1
  43. package/dist/exchanges/probable/api.js +1 -1
  44. package/dist/index.d.ts +4 -0
  45. package/dist/index.js +5 -1
  46. package/dist/server/app.js +1 -0
  47. package/dist/server/exchange-factory.js +8 -0
  48. package/dist/server/openapi.yaml +17 -0
  49. package/dist/types.d.ts +4 -0
  50. package/package.json +3 -3
@@ -0,0 +1,820 @@
1
+ "use strict";
2
+ /**
3
+ * Embedded Hunch agent-platform OpenAPI spec (subset).
4
+ *
5
+ * SOURCED VERBATIM from the LIVE spec at https://www.playhunch.xyz/openapi.json
6
+ * (fetched while authoring this adapter), trimmed to the operations the Hunch
7
+ * adapter actually drives. operationIds are preserved exactly so the implicit
8
+ * API generated by parseOpenApiSpec() exposes them under the same names:
9
+ * listMarkets, getMarket, researchMarket, quoteBet, placeBet,
10
+ * listPositions, getResult, checkWallet, getStats, getHealth.
11
+ *
12
+ * MAINTAINER NOTE: regenerate by re-fetching /openapi.json (the project would
13
+ * normally do this via `npm run fetch:openapi`; this exchange was authored
14
+ * against the live prod spec directly). Hunch reads are keyless (no security
15
+ * scheme); the trade route settles via x402 / EIP-3009 — see index.ts createOrder.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.hunchApiSpec = void 0;
19
+ exports.hunchApiSpec = {
20
+ "openapi": "3.1.0",
21
+ "info": {
22
+ "title": "Hunch agent platform API",
23
+ "version": "hunch-agent-api-v1"
24
+ },
25
+ "servers": [
26
+ {
27
+ "url": "https://www.playhunch.xyz"
28
+ }
29
+ ],
30
+ "paths": {
31
+ "/api/agent/v1/markets": {
32
+ "get": {
33
+ "operationId": "listMarkets",
34
+ "summary": "List tradeable markets with live odds.",
35
+ "description": "List tradeable markets with live odds.",
36
+ "tags": [
37
+ "markets"
38
+ ],
39
+ "x-hunch-status": "live",
40
+ "parameters": [
41
+ {
42
+ "name": "status",
43
+ "in": "query",
44
+ "required": false,
45
+ "description": "open (default) = tradeable now; all includes settled markets.",
46
+ "schema": {
47
+ "type": "string",
48
+ "enum": [
49
+ "open",
50
+ "all"
51
+ ],
52
+ "default": "open"
53
+ }
54
+ },
55
+ {
56
+ "name": "type",
57
+ "in": "query",
58
+ "required": false,
59
+ "description": "Exact targetMetric filter (e.g. market_cap, price_direction, token_mcap_flip).",
60
+ "schema": {
61
+ "type": "string"
62
+ }
63
+ },
64
+ {
65
+ "name": "token",
66
+ "in": "query",
67
+ "required": false,
68
+ "description": "Case-insensitive token symbol filter (e.g. BNKR).",
69
+ "schema": {
70
+ "type": "string"
71
+ }
72
+ },
73
+ {
74
+ "name": "ids",
75
+ "in": "query",
76
+ "required": false,
77
+ "description": "Comma-separated batch of market ids or slugs.",
78
+ "schema": {
79
+ "type": "string"
80
+ }
81
+ },
82
+ {
83
+ "name": "limit",
84
+ "in": "query",
85
+ "required": false,
86
+ "description": "Maximum results (≤ 200).",
87
+ "schema": {
88
+ "type": "integer",
89
+ "minimum": 1,
90
+ "maximum": 200
91
+ }
92
+ }
93
+ ],
94
+ "responses": {
95
+ "200": {
96
+ "description": "The Base-only tradeable market list with live odds.",
97
+ "content": {
98
+ "application/json": {
99
+ "schema": {
100
+ "type": "object",
101
+ "properties": {
102
+ "meta": {
103
+ "$ref": "#/components/schemas/AgentMeta"
104
+ },
105
+ "count": {
106
+ "type": "integer"
107
+ },
108
+ "markets": {
109
+ "type": "array",
110
+ "items": {
111
+ "$ref": "#/components/schemas/AgentMarketRef"
112
+ }
113
+ }
114
+ },
115
+ "required": [
116
+ "meta",
117
+ "count",
118
+ "markets"
119
+ ]
120
+ }
121
+ }
122
+ }
123
+ },
124
+ "404": {
125
+ "description": "Not found — an unknown id/slug, or the agent platform flag is off (the entire /api/agent/v1 surface returns 404 while dark).",
126
+ "content": {
127
+ "application/json": {
128
+ "schema": {
129
+ "$ref": "#/components/schemas/AgentError"
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+ }
136
+ },
137
+ "/api/agent/v1/markets/{id}": {
138
+ "get": {
139
+ "operationId": "getMarket",
140
+ "summary": "One market's full reference: question, odds, outcomes, deadline, fee, links.",
141
+ "description": "One market's full reference: question, odds, outcomes, deadline, fee, links.",
142
+ "tags": [
143
+ "markets"
144
+ ],
145
+ "x-hunch-status": "live",
146
+ "parameters": [
147
+ {
148
+ "name": "id",
149
+ "in": "path",
150
+ "required": true,
151
+ "description": "Market id or slug.",
152
+ "schema": {
153
+ "type": "string"
154
+ }
155
+ }
156
+ ],
157
+ "responses": {
158
+ "200": {
159
+ "description": "The market's enriched reference (live odds + stats folded in).",
160
+ "content": {
161
+ "application/json": {
162
+ "schema": {
163
+ "type": "object",
164
+ "properties": {
165
+ "meta": {
166
+ "$ref": "#/components/schemas/AgentMeta"
167
+ },
168
+ "market": {
169
+ "$ref": "#/components/schemas/AgentMarketRef"
170
+ }
171
+ },
172
+ "required": [
173
+ "meta",
174
+ "market"
175
+ ]
176
+ }
177
+ }
178
+ }
179
+ },
180
+ "404": {
181
+ "description": "Not found — an unknown id/slug, or the agent platform flag is off (the entire /api/agent/v1 surface returns 404 while dark).",
182
+ "content": {
183
+ "application/json": {
184
+ "schema": {
185
+ "$ref": "#/components/schemas/AgentError"
186
+ }
187
+ }
188
+ }
189
+ }
190
+ }
191
+ }
192
+ },
193
+ "/api/agent/v1/markets/{id}/research": {
194
+ "get": {
195
+ "operationId": "researchMarket",
196
+ "summary": "Decision-grade research: resolution rules, odds history, observations, price impact, related markets.",
197
+ "description": "Decision-grade research: resolution rules, odds history, observations, price impact, related markets.",
198
+ "tags": [
199
+ "markets"
200
+ ],
201
+ "x-hunch-status": "live",
202
+ "parameters": [
203
+ {
204
+ "name": "id",
205
+ "in": "path",
206
+ "required": true,
207
+ "description": "Market id or slug.",
208
+ "schema": {
209
+ "type": "string"
210
+ }
211
+ }
212
+ ],
213
+ "responses": {
214
+ "200": {
215
+ "description": "Decision-grade research. The advisory field is DATA ONLY (always null in Phase 1) — the betting decision is the agent's own.",
216
+ "content": {
217
+ "application/json": {
218
+ "schema": {
219
+ "type": "object",
220
+ "properties": {
221
+ "meta": {
222
+ "$ref": "#/components/schemas/AgentMeta"
223
+ },
224
+ "research": {
225
+ "$ref": "#/components/schemas/AgentResearch"
226
+ }
227
+ },
228
+ "required": [
229
+ "meta",
230
+ "research"
231
+ ]
232
+ }
233
+ }
234
+ }
235
+ },
236
+ "404": {
237
+ "description": "Not found — an unknown id/slug, or the agent platform flag is off (the entire /api/agent/v1 surface returns 404 while dark).",
238
+ "content": {
239
+ "application/json": {
240
+ "schema": {
241
+ "$ref": "#/components/schemas/AgentError"
242
+ }
243
+ }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ },
249
+ "/api/agent/v1/quote": {
250
+ "get": {
251
+ "operationId": "quoteBet",
252
+ "summary": "Price a bet: tier, priceCents, estimatedShares, fee breakdown, 60s quoteId.",
253
+ "description": "Price a bet: tier, priceCents, estimatedShares, fee breakdown, 60s quoteId.",
254
+ "tags": [
255
+ "trading"
256
+ ],
257
+ "x-hunch-status": "live",
258
+ "parameters": [
259
+ {
260
+ "name": "marketId",
261
+ "in": "query",
262
+ "required": true,
263
+ "description": "Market id or slug.",
264
+ "schema": {
265
+ "type": "string"
266
+ }
267
+ },
268
+ {
269
+ "name": "side",
270
+ "in": "query",
271
+ "required": false,
272
+ "description": "yes | no | up | down | <bucketKey> — validated against the market's outcome keys.",
273
+ "schema": {
274
+ "type": "string",
275
+ "default": "yes"
276
+ }
277
+ },
278
+ {
279
+ "name": "sizeUsd",
280
+ "in": "query",
281
+ "required": false,
282
+ "description": "Bet size in USD. $1 floor, NO maximum — a quote above $10 persists a verifiable 60-second lock behind its quoteId.",
283
+ "schema": {
284
+ "type": "number",
285
+ "minimum": 1,
286
+ "default": 1
287
+ }
288
+ }
289
+ ],
290
+ "responses": {
291
+ "200": {
292
+ "description": "The live quote. Always carries a quoteId; pass suggestedMinSharesOut back as minSharesOut on a locked-tier trade.",
293
+ "content": {
294
+ "application/json": {
295
+ "schema": {
296
+ "type": "object",
297
+ "properties": {
298
+ "meta": {
299
+ "$ref": "#/components/schemas/AgentMeta"
300
+ },
301
+ "quote": {
302
+ "$ref": "#/components/schemas/AgentQuote"
303
+ }
304
+ },
305
+ "required": [
306
+ "meta",
307
+ "quote"
308
+ ]
309
+ }
310
+ }
311
+ }
312
+ },
313
+ "400": {
314
+ "description": "invalid_request — marketId missing, or sizeUsd above the $1,000,000,000 technical precision bound (split the bet).",
315
+ "content": {
316
+ "application/json": {
317
+ "schema": {
318
+ "$ref": "#/components/schemas/AgentError"
319
+ }
320
+ }
321
+ }
322
+ },
323
+ "404": {
324
+ "description": "Not found — an unknown id/slug, or the agent platform flag is off (the entire /api/agent/v1 surface returns 404 while dark).",
325
+ "content": {
326
+ "application/json": {
327
+ "schema": {
328
+ "$ref": "#/components/schemas/AgentError"
329
+ }
330
+ }
331
+ }
332
+ },
333
+ "422": {
334
+ "description": "size_below_min (the $1 floor) or invalid_side.",
335
+ "content": {
336
+ "application/json": {
337
+ "schema": {
338
+ "$ref": "#/components/schemas/AgentError"
339
+ }
340
+ }
341
+ }
342
+ },
343
+ "429": {
344
+ "description": "rate_limited — 30 quotes/min per IP.",
345
+ "content": {
346
+ "application/json": {
347
+ "schema": {
348
+ "$ref": "#/components/schemas/AgentError"
349
+ }
350
+ }
351
+ }
352
+ },
353
+ "500": {
354
+ "description": "internal_error — the book or quote storage was unreadable; retry shortly.",
355
+ "content": {
356
+ "application/json": {
357
+ "schema": {
358
+ "$ref": "#/components/schemas/AgentError"
359
+ }
360
+ }
361
+ }
362
+ }
363
+ }
364
+ }
365
+ },
366
+ "/api/agent/v1/trade": {
367
+ "post": {
368
+ "operationId": "placeBet",
369
+ "summary": "Place a bet via x402 (USDC on Base). simulate:true = $0 dry-run of the full pipeline. $1 floor, NO maximum.",
370
+ "description": "Settle a real USDC bet on Base via x402 — or dry-run it for $0 with \"simulate\": true (runs the FULL validation pipeline, including locked-tier quote verification, but moves nothing). Flow: POST the bet body with no payment header → HTTP 402 challenge → sign an EIP-3009 transferWithAuthorization for exactly accepts[0].maxAmountRequired → retry the SAME body with the X-PAYMENT header. Keyless: the paying wallet IS the account. $1 floor, NO maximum; above $10 the body must also carry quoteId plus minSharesOut or maxPriceCents (from GET /api/agent/v1/quote). Idempotent on idemKey — a replay returns the original receipt and never double-settles.",
371
+ "tags": [
372
+ "trading"
373
+ ],
374
+ "x-hunch-status": "live",
375
+ "parameters": [
376
+ {
377
+ "name": "X-PAYMENT",
378
+ "in": "header",
379
+ "required": false,
380
+ "description": "base64(JSON x402 envelope) carrying the signed EIP-3009 transferWithAuthorization. Omit on the first call to receive the 402 challenge; retry the SAME body with this header to settle. Not needed when simulate is true.",
381
+ "schema": {
382
+ "type": "string"
383
+ }
384
+ }
385
+ ],
386
+ "requestBody": {
387
+ "required": true,
388
+ "content": {
389
+ "application/json": {
390
+ "schema": {
391
+ "$ref": "#/components/schemas/AgentTradeRequest"
392
+ }
393
+ }
394
+ }
395
+ },
396
+ "responses": {
397
+ "200": {
398
+ "description": "The trade receipt. simulated:true receipts carry txHash:null — no funds moved.",
399
+ "content": {
400
+ "application/json": {
401
+ "schema": {
402
+ "type": "object",
403
+ "properties": {
404
+ "meta": {
405
+ "$ref": "#/components/schemas/AgentMeta"
406
+ },
407
+ "replay": {
408
+ "type": "boolean",
409
+ "description": "true when this idemKey had already settled — the ORIGINAL receipt is returned (no double-settle)."
410
+ },
411
+ "receipt": {
412
+ "$ref": "#/components/schemas/AgentTradeReceipt"
413
+ }
414
+ },
415
+ "required": [
416
+ "meta",
417
+ "receipt"
418
+ ]
419
+ }
420
+ }
421
+ },
422
+ "headers": {
423
+ "X-Payment-Response": {
424
+ "description": "base64 settlement summary {success, transaction, network, payer}. Present after real settlement; absent on a simulate receipt.",
425
+ "schema": {
426
+ "type": "string"
427
+ }
428
+ }
429
+ }
430
+ },
431
+ "400": {
432
+ "description": "invalid_request — the body is not valid JSON or fails the strict AgentTradeRequest schema (per-field problems are listed in the error's issues extra).",
433
+ "content": {
434
+ "application/json": {
435
+ "schema": {
436
+ "$ref": "#/components/schemas/AgentError"
437
+ }
438
+ }
439
+ }
440
+ },
441
+ "402": {
442
+ "description": "x402 payment challenge — the request carried no (or an invalid) X-PAYMENT header. Sign an EIP-3009 transferWithAuthorization for exactly accepts[0].maxAmountRequired to accepts[0].payTo on Base, then retry the SAME POST body with the X-PAYMENT header (base64 of the signed envelope). The challenge resource embeds this trade's intent hash for audit.",
443
+ "content": {
444
+ "application/json": {
445
+ "schema": {
446
+ "$ref": "#/components/schemas/X402Challenge"
447
+ }
448
+ }
449
+ }
450
+ },
451
+ "404": {
452
+ "description": "Not found — an unknown id/slug, or the agent platform flag is off (the entire /api/agent/v1 surface returns 404 while dark).",
453
+ "content": {
454
+ "application/json": {
455
+ "schema": {
456
+ "$ref": "#/components/schemas/AgentError"
457
+ }
458
+ }
459
+ }
460
+ },
461
+ "409": {
462
+ "description": "market_closed (no longer accepts bets) or idem_conflict (this idemKey was used for a DIFFERENT trade — generate a fresh one).",
463
+ "content": {
464
+ "application/json": {
465
+ "schema": {
466
+ "$ref": "#/components/schemas/AgentError"
467
+ }
468
+ }
469
+ }
470
+ },
471
+ "422": {
472
+ "description": "invalid_side / invalid_wallet / size_below_min / quote_required / quote_expired / quote_mismatch / slippage_exceeded / insufficient_balance / pool_impact_exceeded / unsupported_market / payment_invalid — the error code + hint say exactly what to change.",
473
+ "content": {
474
+ "application/json": {
475
+ "schema": {
476
+ "$ref": "#/components/schemas/AgentError"
477
+ }
478
+ }
479
+ }
480
+ },
481
+ "429": {
482
+ "description": "rate_limited — 10 trades/min per wallet (also returned with status 409 semantics when the same idemKey is already settling — retry it shortly to fetch the receipt).",
483
+ "content": {
484
+ "application/json": {
485
+ "schema": {
486
+ "$ref": "#/components/schemas/AgentError"
487
+ }
488
+ }
489
+ }
490
+ },
491
+ "500": {
492
+ "description": "internal_error — possibly reconcilable: if the tx WAS submitted but recording failed, the body carries txHash; retry with the SAME idemKey to fetch the receipt (settlement is idempotent).",
493
+ "content": {
494
+ "application/json": {
495
+ "schema": {
496
+ "$ref": "#/components/schemas/AgentError"
497
+ }
498
+ }
499
+ }
500
+ },
501
+ "503": {
502
+ "description": "platform_paused — trading is temporarily paused (kill switch) or settlement is unavailable. Poll GET /api/agent/v1/health.",
503
+ "content": {
504
+ "application/json": {
505
+ "schema": {
506
+ "$ref": "#/components/schemas/AgentError"
507
+ }
508
+ }
509
+ }
510
+ }
511
+ }
512
+ }
513
+ },
514
+ "/api/agent/v1/positions": {
515
+ "get": {
516
+ "operationId": "listPositions",
517
+ "summary": "A wallet's open + resolved positions with live PnL (merges the Bankr partner rail).",
518
+ "description": "A wallet's open + resolved positions with live PnL (merges the Bankr partner rail).",
519
+ "tags": [
520
+ "positions"
521
+ ],
522
+ "x-hunch-status": "live",
523
+ "parameters": [
524
+ {
525
+ "name": "wallet",
526
+ "in": "query",
527
+ "required": true,
528
+ "description": "The betting wallet (0x + 40 hex). Merges BOTH rail identities (agent: and bankr:) so the full book is visible.",
529
+ "schema": {
530
+ "type": "string",
531
+ "pattern": "^0x[0-9a-fA-F]{40}$"
532
+ }
533
+ }
534
+ ],
535
+ "responses": {
536
+ "200": {
537
+ "description": "Open + resolved positions with live PnL, newest first.",
538
+ "content": {
539
+ "application/json": {
540
+ "schema": {
541
+ "type": "object",
542
+ "properties": {
543
+ "meta": {
544
+ "$ref": "#/components/schemas/AgentMeta"
545
+ },
546
+ "wallet": {
547
+ "type": "string"
548
+ },
549
+ "count": {
550
+ "type": "integer"
551
+ },
552
+ "summary": {
553
+ "$ref": "#/components/schemas/AgentPositionsSummary"
554
+ },
555
+ "positions": {
556
+ "type": "array",
557
+ "items": {
558
+ "$ref": "#/components/schemas/AgentPosition"
559
+ }
560
+ }
561
+ },
562
+ "required": [
563
+ "meta",
564
+ "wallet",
565
+ "count",
566
+ "summary",
567
+ "positions"
568
+ ]
569
+ }
570
+ }
571
+ }
572
+ },
573
+ "404": {
574
+ "description": "Not found — an unknown id/slug, or the agent platform flag is off (the entire /api/agent/v1 surface returns 404 while dark).",
575
+ "content": {
576
+ "application/json": {
577
+ "schema": {
578
+ "$ref": "#/components/schemas/AgentError"
579
+ }
580
+ }
581
+ }
582
+ },
583
+ "422": {
584
+ "description": "invalid_wallet — not a 0x + 40-hex Base address.",
585
+ "content": {
586
+ "application/json": {
587
+ "schema": {
588
+ "$ref": "#/components/schemas/AgentError"
589
+ }
590
+ }
591
+ }
592
+ }
593
+ }
594
+ }
595
+ },
596
+ "/api/agent/v1/result": {
597
+ "get": {
598
+ "operationId": "getResult",
599
+ "summary": "A market's resolution status, winning outcome, and payout-per-share.",
600
+ "description": "A market's resolution status, winning outcome, and payout-per-share.",
601
+ "tags": [
602
+ "positions"
603
+ ],
604
+ "x-hunch-status": "live",
605
+ "parameters": [
606
+ {
607
+ "name": "marketId",
608
+ "in": "query",
609
+ "required": true,
610
+ "description": "Market id or slug — resolved against the FULL catalogue (anything the agent may hold).",
611
+ "schema": {
612
+ "type": "string"
613
+ }
614
+ }
615
+ ],
616
+ "responses": {
617
+ "200": {
618
+ "description": "The resolution view. An unresolved market returns status \"pending\" with null outcome fields.",
619
+ "content": {
620
+ "application/json": {
621
+ "schema": {
622
+ "type": "object",
623
+ "properties": {
624
+ "meta": {
625
+ "$ref": "#/components/schemas/AgentMeta"
626
+ },
627
+ "result": {
628
+ "$ref": "#/components/schemas/AgentResult"
629
+ }
630
+ },
631
+ "required": [
632
+ "meta",
633
+ "result"
634
+ ]
635
+ }
636
+ }
637
+ }
638
+ },
639
+ "400": {
640
+ "description": "invalid_request — marketId is required.",
641
+ "content": {
642
+ "application/json": {
643
+ "schema": {
644
+ "$ref": "#/components/schemas/AgentError"
645
+ }
646
+ }
647
+ }
648
+ },
649
+ "404": {
650
+ "description": "Not found — an unknown id/slug, or the agent platform flag is off (the entire /api/agent/v1 surface returns 404 while dark).",
651
+ "content": {
652
+ "application/json": {
653
+ "schema": {
654
+ "$ref": "#/components/schemas/AgentError"
655
+ }
656
+ }
657
+ }
658
+ }
659
+ }
660
+ }
661
+ },
662
+ "/api/agent/v1/wallet/{address}/readiness": {
663
+ "get": {
664
+ "operationId": "checkWallet",
665
+ "summary": "Wallet readiness: Base USDC balance, min-bet coverage, funding guidance (gas never needed).",
666
+ "description": "Wallet readiness: Base USDC balance, min-bet coverage, funding guidance (gas never needed).",
667
+ "tags": [
668
+ "platform"
669
+ ],
670
+ "x-hunch-status": "live",
671
+ "parameters": [
672
+ {
673
+ "name": "address",
674
+ "in": "path",
675
+ "required": true,
676
+ "description": "Base wallet address (0x + 40 hex).",
677
+ "schema": {
678
+ "type": "string",
679
+ "pattern": "^0x[0-9a-fA-F]{40}$"
680
+ }
681
+ }
682
+ ],
683
+ "responses": {
684
+ "200": {
685
+ "description": "Funding readiness: Base USDC balance, min-bet coverage, funding guidance. Gas is NEVER needed — transfers are relayed; the wallet only holds USDC.",
686
+ "content": {
687
+ "application/json": {
688
+ "schema": {
689
+ "type": "object",
690
+ "properties": {
691
+ "meta": {
692
+ "$ref": "#/components/schemas/AgentMeta"
693
+ },
694
+ "readiness": {
695
+ "$ref": "#/components/schemas/AgentReadiness"
696
+ }
697
+ },
698
+ "required": [
699
+ "meta",
700
+ "readiness"
701
+ ]
702
+ }
703
+ }
704
+ }
705
+ },
706
+ "404": {
707
+ "description": "Not found — an unknown id/slug, or the agent platform flag is off (the entire /api/agent/v1 surface returns 404 while dark).",
708
+ "content": {
709
+ "application/json": {
710
+ "schema": {
711
+ "$ref": "#/components/schemas/AgentError"
712
+ }
713
+ }
714
+ }
715
+ },
716
+ "422": {
717
+ "description": "invalid_wallet — not a 0x + 40-hex Base address.",
718
+ "content": {
719
+ "application/json": {
720
+ "schema": {
721
+ "$ref": "#/components/schemas/AgentError"
722
+ }
723
+ }
724
+ }
725
+ }
726
+ }
727
+ }
728
+ },
729
+ "/api/agent/v1/stats": {
730
+ "get": {
731
+ "operationId": "getStats",
732
+ "summary": "Platform trust stats: markets, volume, payouts, auto-payout rate, proof samples.",
733
+ "description": "Platform trust stats: markets, volume, payouts, auto-payout rate, proof samples.",
734
+ "tags": [
735
+ "platform"
736
+ ],
737
+ "x-hunch-status": "live",
738
+ "responses": {
739
+ "200": {
740
+ "description": "Platform trust stats (cached ~60s): markets, lifetime bets + volume, paid-out USD, auto-payout rate, on-chain proof samples.",
741
+ "content": {
742
+ "application/json": {
743
+ "schema": {
744
+ "type": "object",
745
+ "properties": {
746
+ "meta": {
747
+ "$ref": "#/components/schemas/AgentMeta"
748
+ },
749
+ "stats": {
750
+ "$ref": "#/components/schemas/AgentStats"
751
+ }
752
+ },
753
+ "required": [
754
+ "meta",
755
+ "stats"
756
+ ]
757
+ }
758
+ }
759
+ }
760
+ },
761
+ "404": {
762
+ "description": "Not found — an unknown id/slug, or the agent platform flag is off (the entire /api/agent/v1 surface returns 404 while dark).",
763
+ "content": {
764
+ "application/json": {
765
+ "schema": {
766
+ "$ref": "#/components/schemas/AgentError"
767
+ }
768
+ }
769
+ }
770
+ }
771
+ }
772
+ }
773
+ },
774
+ "/api/agent/v1/health": {
775
+ "get": {
776
+ "operationId": "getHealth",
777
+ "summary": "Liveness + trading status. 200 even when degraded; ok:false means paused.",
778
+ "description": "Liveness + trading status. Deliberately HTTP 200 even when degraded — branch on the BODY's health.ok (false = trading paused), never on the status code.",
779
+ "tags": [
780
+ "platform"
781
+ ],
782
+ "x-hunch-status": "live",
783
+ "responses": {
784
+ "200": {
785
+ "description": "Always 200 while the platform flag is on; health.ok carries the signal.",
786
+ "content": {
787
+ "application/json": {
788
+ "schema": {
789
+ "type": "object",
790
+ "properties": {
791
+ "meta": {
792
+ "$ref": "#/components/schemas/AgentMeta"
793
+ },
794
+ "health": {
795
+ "$ref": "#/components/schemas/AgentHealth"
796
+ }
797
+ },
798
+ "required": [
799
+ "meta",
800
+ "health"
801
+ ]
802
+ }
803
+ }
804
+ }
805
+ },
806
+ "404": {
807
+ "description": "Not found — an unknown id/slug, or the agent platform flag is off (the entire /api/agent/v1 surface returns 404 while dark).",
808
+ "content": {
809
+ "application/json": {
810
+ "schema": {
811
+ "$ref": "#/components/schemas/AgentError"
812
+ }
813
+ }
814
+ }
815
+ }
816
+ }
817
+ }
818
+ }
819
+ }
820
+ };