@illalabs/interfaces 0.10.4 → 0.10.5
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.
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/polymarketBody.d.ts +369 -0
- package/dist/schemas/polymarketBody.d.ts.map +1 -0
- package/dist/schemas/polymarketBody.js +113 -0
- package/dist/schemas/polymarketBody.js.map +1 -0
- package/package.json +1 -1
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Validation schema for POST /api/v1/polymarket/post-order request body.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the MCP `polymarket_post_order` tool input schema.
|
|
6
|
+
*/
|
|
7
|
+
export declare const postOrderBodySchema: z.ZodObject<{
|
|
8
|
+
order: z.ZodObject<{
|
|
9
|
+
salt: z.ZodString;
|
|
10
|
+
maker: z.ZodString;
|
|
11
|
+
signer: z.ZodString;
|
|
12
|
+
tokenId: z.ZodString;
|
|
13
|
+
makerAmount: z.ZodString;
|
|
14
|
+
takerAmount: z.ZodString;
|
|
15
|
+
expiration: z.ZodString;
|
|
16
|
+
side: z.ZodEnum<["0", "1"]>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
side: "0" | "1";
|
|
19
|
+
salt: string;
|
|
20
|
+
maker: string;
|
|
21
|
+
signer: string;
|
|
22
|
+
tokenId: string;
|
|
23
|
+
makerAmount: string;
|
|
24
|
+
takerAmount: string;
|
|
25
|
+
expiration: string;
|
|
26
|
+
}, {
|
|
27
|
+
side: "0" | "1";
|
|
28
|
+
salt: string;
|
|
29
|
+
maker: string;
|
|
30
|
+
signer: string;
|
|
31
|
+
tokenId: string;
|
|
32
|
+
makerAmount: string;
|
|
33
|
+
takerAmount: string;
|
|
34
|
+
expiration: string;
|
|
35
|
+
}>;
|
|
36
|
+
signature: z.ZodString;
|
|
37
|
+
authData: z.ZodObject<{
|
|
38
|
+
signature: z.ZodString;
|
|
39
|
+
timestamp: z.ZodString;
|
|
40
|
+
nonce: z.ZodString;
|
|
41
|
+
address: z.ZodString;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
nonce: string;
|
|
44
|
+
address: string;
|
|
45
|
+
timestamp: string;
|
|
46
|
+
signature: string;
|
|
47
|
+
}, {
|
|
48
|
+
nonce: string;
|
|
49
|
+
address: string;
|
|
50
|
+
timestamp: string;
|
|
51
|
+
signature: string;
|
|
52
|
+
}>;
|
|
53
|
+
additionalSignatures: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
signature: z.ZodString;
|
|
56
|
+
metadata: z.ZodUnion<[z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"SAFE_CREATE">;
|
|
58
|
+
safeAddress: z.ZodString;
|
|
59
|
+
eoaAddress: z.ZodString;
|
|
60
|
+
safeFactory: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
type: "SAFE_CREATE";
|
|
63
|
+
safeAddress: string;
|
|
64
|
+
eoaAddress: string;
|
|
65
|
+
safeFactory?: string | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
type: "SAFE_CREATE";
|
|
68
|
+
safeAddress: string;
|
|
69
|
+
eoaAddress: string;
|
|
70
|
+
safeFactory?: string | undefined;
|
|
71
|
+
}>, z.ZodObject<{
|
|
72
|
+
type: z.ZodLiteral<"SAFE_EXECUTE">;
|
|
73
|
+
safeAddress: z.ZodString;
|
|
74
|
+
eoaAddress: z.ZodString;
|
|
75
|
+
nonce: z.ZodString;
|
|
76
|
+
to: z.ZodString;
|
|
77
|
+
data: z.ZodString;
|
|
78
|
+
operation: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
type: "SAFE_EXECUTE";
|
|
81
|
+
data: string;
|
|
82
|
+
to: string;
|
|
83
|
+
nonce: string;
|
|
84
|
+
safeAddress: string;
|
|
85
|
+
eoaAddress: string;
|
|
86
|
+
operation: 0 | 1;
|
|
87
|
+
}, {
|
|
88
|
+
type: "SAFE_EXECUTE";
|
|
89
|
+
data: string;
|
|
90
|
+
to: string;
|
|
91
|
+
nonce: string;
|
|
92
|
+
safeAddress: string;
|
|
93
|
+
eoaAddress: string;
|
|
94
|
+
operation: 0 | 1;
|
|
95
|
+
}>]>;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
id: string;
|
|
98
|
+
metadata: {
|
|
99
|
+
type: "SAFE_CREATE";
|
|
100
|
+
safeAddress: string;
|
|
101
|
+
eoaAddress: string;
|
|
102
|
+
safeFactory?: string | undefined;
|
|
103
|
+
} | {
|
|
104
|
+
type: "SAFE_EXECUTE";
|
|
105
|
+
data: string;
|
|
106
|
+
to: string;
|
|
107
|
+
nonce: string;
|
|
108
|
+
safeAddress: string;
|
|
109
|
+
eoaAddress: string;
|
|
110
|
+
operation: 0 | 1;
|
|
111
|
+
};
|
|
112
|
+
signature: string;
|
|
113
|
+
}, {
|
|
114
|
+
id: string;
|
|
115
|
+
metadata: {
|
|
116
|
+
type: "SAFE_CREATE";
|
|
117
|
+
safeAddress: string;
|
|
118
|
+
eoaAddress: string;
|
|
119
|
+
safeFactory?: string | undefined;
|
|
120
|
+
} | {
|
|
121
|
+
type: "SAFE_EXECUTE";
|
|
122
|
+
data: string;
|
|
123
|
+
to: string;
|
|
124
|
+
nonce: string;
|
|
125
|
+
safeAddress: string;
|
|
126
|
+
eoaAddress: string;
|
|
127
|
+
operation: 0 | 1;
|
|
128
|
+
};
|
|
129
|
+
signature: string;
|
|
130
|
+
}>, "many">>;
|
|
131
|
+
orderType: z.ZodOptional<z.ZodEnum<["GTC", "GTD", "FOK"]>>;
|
|
132
|
+
transactionsSucceeded: z.ZodDefault<z.ZodBoolean>;
|
|
133
|
+
}, "strip", z.ZodTypeAny, {
|
|
134
|
+
signature: string;
|
|
135
|
+
order: {
|
|
136
|
+
side: "0" | "1";
|
|
137
|
+
salt: string;
|
|
138
|
+
maker: string;
|
|
139
|
+
signer: string;
|
|
140
|
+
tokenId: string;
|
|
141
|
+
makerAmount: string;
|
|
142
|
+
takerAmount: string;
|
|
143
|
+
expiration: string;
|
|
144
|
+
};
|
|
145
|
+
authData: {
|
|
146
|
+
nonce: string;
|
|
147
|
+
address: string;
|
|
148
|
+
timestamp: string;
|
|
149
|
+
signature: string;
|
|
150
|
+
};
|
|
151
|
+
transactionsSucceeded: boolean;
|
|
152
|
+
orderType?: "GTC" | "GTD" | "FOK" | undefined;
|
|
153
|
+
additionalSignatures?: {
|
|
154
|
+
id: string;
|
|
155
|
+
metadata: {
|
|
156
|
+
type: "SAFE_CREATE";
|
|
157
|
+
safeAddress: string;
|
|
158
|
+
eoaAddress: string;
|
|
159
|
+
safeFactory?: string | undefined;
|
|
160
|
+
} | {
|
|
161
|
+
type: "SAFE_EXECUTE";
|
|
162
|
+
data: string;
|
|
163
|
+
to: string;
|
|
164
|
+
nonce: string;
|
|
165
|
+
safeAddress: string;
|
|
166
|
+
eoaAddress: string;
|
|
167
|
+
operation: 0 | 1;
|
|
168
|
+
};
|
|
169
|
+
signature: string;
|
|
170
|
+
}[] | undefined;
|
|
171
|
+
}, {
|
|
172
|
+
signature: string;
|
|
173
|
+
order: {
|
|
174
|
+
side: "0" | "1";
|
|
175
|
+
salt: string;
|
|
176
|
+
maker: string;
|
|
177
|
+
signer: string;
|
|
178
|
+
tokenId: string;
|
|
179
|
+
makerAmount: string;
|
|
180
|
+
takerAmount: string;
|
|
181
|
+
expiration: string;
|
|
182
|
+
};
|
|
183
|
+
authData: {
|
|
184
|
+
nonce: string;
|
|
185
|
+
address: string;
|
|
186
|
+
timestamp: string;
|
|
187
|
+
signature: string;
|
|
188
|
+
};
|
|
189
|
+
orderType?: "GTC" | "GTD" | "FOK" | undefined;
|
|
190
|
+
additionalSignatures?: {
|
|
191
|
+
id: string;
|
|
192
|
+
metadata: {
|
|
193
|
+
type: "SAFE_CREATE";
|
|
194
|
+
safeAddress: string;
|
|
195
|
+
eoaAddress: string;
|
|
196
|
+
safeFactory?: string | undefined;
|
|
197
|
+
} | {
|
|
198
|
+
type: "SAFE_EXECUTE";
|
|
199
|
+
data: string;
|
|
200
|
+
to: string;
|
|
201
|
+
nonce: string;
|
|
202
|
+
safeAddress: string;
|
|
203
|
+
eoaAddress: string;
|
|
204
|
+
operation: 0 | 1;
|
|
205
|
+
};
|
|
206
|
+
signature: string;
|
|
207
|
+
}[] | undefined;
|
|
208
|
+
transactionsSucceeded?: boolean | undefined;
|
|
209
|
+
}>;
|
|
210
|
+
/** Inferred type for the post-order request body. */
|
|
211
|
+
export type PostOrderBody = z.infer<typeof postOrderBodySchema>;
|
|
212
|
+
/**
|
|
213
|
+
* Validation schema for POST /api/v1/polymarket/post-redeem request body.
|
|
214
|
+
*
|
|
215
|
+
* Submits a signed Safe redemption transaction to the Polymarket relayer.
|
|
216
|
+
*/
|
|
217
|
+
export declare const postRedeemBodySchema: z.ZodObject<{
|
|
218
|
+
signature: z.ZodString;
|
|
219
|
+
safeAddress: z.ZodString;
|
|
220
|
+
eoaAddress: z.ZodString;
|
|
221
|
+
nonce: z.ZodString;
|
|
222
|
+
to: z.ZodString;
|
|
223
|
+
data: z.ZodString;
|
|
224
|
+
operation: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
225
|
+
signerWallet: z.ZodOptional<z.ZodString>;
|
|
226
|
+
}, "strip", z.ZodTypeAny, {
|
|
227
|
+
data: string;
|
|
228
|
+
to: string;
|
|
229
|
+
nonce: string;
|
|
230
|
+
signature: string;
|
|
231
|
+
safeAddress: string;
|
|
232
|
+
eoaAddress: string;
|
|
233
|
+
operation: 0 | 1;
|
|
234
|
+
signerWallet?: string | undefined;
|
|
235
|
+
}, {
|
|
236
|
+
data: string;
|
|
237
|
+
to: string;
|
|
238
|
+
nonce: string;
|
|
239
|
+
signature: string;
|
|
240
|
+
safeAddress: string;
|
|
241
|
+
eoaAddress: string;
|
|
242
|
+
operation: 0 | 1;
|
|
243
|
+
signerWallet?: string | undefined;
|
|
244
|
+
}>;
|
|
245
|
+
/** Inferred type for the post-redeem request body. */
|
|
246
|
+
export type PostRedeemBody = z.infer<typeof postRedeemBodySchema>;
|
|
247
|
+
/**
|
|
248
|
+
* Validation schema for POST /api/v1/polymarket/post-withdraw request body.
|
|
249
|
+
*
|
|
250
|
+
* Submits a signed Safe withdraw transaction to the Polymarket relayer.
|
|
251
|
+
*/
|
|
252
|
+
export declare const postWithdrawBodySchema: z.ZodObject<{
|
|
253
|
+
signature: z.ZodString;
|
|
254
|
+
safeAddress: z.ZodString;
|
|
255
|
+
eoaAddress: z.ZodString;
|
|
256
|
+
nonce: z.ZodString;
|
|
257
|
+
to: z.ZodString;
|
|
258
|
+
data: z.ZodString;
|
|
259
|
+
operation: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
260
|
+
signerWallet: z.ZodOptional<z.ZodString>;
|
|
261
|
+
}, "strip", z.ZodTypeAny, {
|
|
262
|
+
data: string;
|
|
263
|
+
to: string;
|
|
264
|
+
nonce: string;
|
|
265
|
+
signature: string;
|
|
266
|
+
safeAddress: string;
|
|
267
|
+
eoaAddress: string;
|
|
268
|
+
operation: 0 | 1;
|
|
269
|
+
signerWallet?: string | undefined;
|
|
270
|
+
}, {
|
|
271
|
+
data: string;
|
|
272
|
+
to: string;
|
|
273
|
+
nonce: string;
|
|
274
|
+
signature: string;
|
|
275
|
+
safeAddress: string;
|
|
276
|
+
eoaAddress: string;
|
|
277
|
+
operation: 0 | 1;
|
|
278
|
+
signerWallet?: string | undefined;
|
|
279
|
+
}>;
|
|
280
|
+
/** Inferred type for the post-withdraw request body. */
|
|
281
|
+
export type PostWithdrawBody = z.infer<typeof postWithdrawBodySchema>;
|
|
282
|
+
/**
|
|
283
|
+
* Validation schema for POST /api/v1/polymarket/get-orders request body.
|
|
284
|
+
*
|
|
285
|
+
* Fetches open orders from the Polymarket CLOB API using auth credentials.
|
|
286
|
+
*/
|
|
287
|
+
export declare const getOrdersBodySchema: z.ZodObject<{
|
|
288
|
+
authData: z.ZodObject<{
|
|
289
|
+
signature: z.ZodString;
|
|
290
|
+
timestamp: z.ZodString;
|
|
291
|
+
nonce: z.ZodString;
|
|
292
|
+
address: z.ZodString;
|
|
293
|
+
}, "strip", z.ZodTypeAny, {
|
|
294
|
+
nonce: string;
|
|
295
|
+
address: string;
|
|
296
|
+
timestamp: string;
|
|
297
|
+
signature: string;
|
|
298
|
+
}, {
|
|
299
|
+
nonce: string;
|
|
300
|
+
address: string;
|
|
301
|
+
timestamp: string;
|
|
302
|
+
signature: string;
|
|
303
|
+
}>;
|
|
304
|
+
signerWallet: z.ZodOptional<z.ZodString>;
|
|
305
|
+
}, "strip", z.ZodTypeAny, {
|
|
306
|
+
authData: {
|
|
307
|
+
nonce: string;
|
|
308
|
+
address: string;
|
|
309
|
+
timestamp: string;
|
|
310
|
+
signature: string;
|
|
311
|
+
};
|
|
312
|
+
signerWallet?: string | undefined;
|
|
313
|
+
}, {
|
|
314
|
+
authData: {
|
|
315
|
+
nonce: string;
|
|
316
|
+
address: string;
|
|
317
|
+
timestamp: string;
|
|
318
|
+
signature: string;
|
|
319
|
+
};
|
|
320
|
+
signerWallet?: string | undefined;
|
|
321
|
+
}>;
|
|
322
|
+
/** Inferred type for the get-orders request body. */
|
|
323
|
+
export type GetOrdersBody = z.infer<typeof getOrdersBodySchema>;
|
|
324
|
+
/**
|
|
325
|
+
* Validation schema for POST /api/v1/polymarket/cancel-order request body.
|
|
326
|
+
*
|
|
327
|
+
* Cancels an order on the Polymarket CLOB API.
|
|
328
|
+
*/
|
|
329
|
+
export declare const cancelOrderBodySchema: z.ZodObject<{
|
|
330
|
+
authData: z.ZodObject<{
|
|
331
|
+
signature: z.ZodString;
|
|
332
|
+
timestamp: z.ZodString;
|
|
333
|
+
nonce: z.ZodString;
|
|
334
|
+
address: z.ZodString;
|
|
335
|
+
}, "strip", z.ZodTypeAny, {
|
|
336
|
+
nonce: string;
|
|
337
|
+
address: string;
|
|
338
|
+
timestamp: string;
|
|
339
|
+
signature: string;
|
|
340
|
+
}, {
|
|
341
|
+
nonce: string;
|
|
342
|
+
address: string;
|
|
343
|
+
timestamp: string;
|
|
344
|
+
signature: string;
|
|
345
|
+
}>;
|
|
346
|
+
orderId: z.ZodString;
|
|
347
|
+
signerWallet: z.ZodOptional<z.ZodString>;
|
|
348
|
+
}, "strip", z.ZodTypeAny, {
|
|
349
|
+
authData: {
|
|
350
|
+
nonce: string;
|
|
351
|
+
address: string;
|
|
352
|
+
timestamp: string;
|
|
353
|
+
signature: string;
|
|
354
|
+
};
|
|
355
|
+
orderId: string;
|
|
356
|
+
signerWallet?: string | undefined;
|
|
357
|
+
}, {
|
|
358
|
+
authData: {
|
|
359
|
+
nonce: string;
|
|
360
|
+
address: string;
|
|
361
|
+
timestamp: string;
|
|
362
|
+
signature: string;
|
|
363
|
+
};
|
|
364
|
+
orderId: string;
|
|
365
|
+
signerWallet?: string | undefined;
|
|
366
|
+
}>;
|
|
367
|
+
/** Inferred type for the cancel-order request body. */
|
|
368
|
+
export type CancelOrderBody = z.infer<typeof cancelOrderBodySchema>;
|
|
369
|
+
//# sourceMappingURL=polymarketBody.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polymarketBody.d.ts","sourceRoot":"","sources":["../../src/schemas/polymarketBody.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmDxB;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsB9B,CAAC;AAEH,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAiBhE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAwB,CAAC;AAE1D,sDAAsD;AACtD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAwB,CAAC;AAE5D,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG9B,CAAC;AAEH,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIhC,CAAC;AAEH,uDAAuD;AACvD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Zod schema for the signed order fields. */
|
|
3
|
+
const signedOrderSchema = z.object({
|
|
4
|
+
salt: z.string().describe("Unique salt for the order"),
|
|
5
|
+
maker: z.string().describe("Maker address"),
|
|
6
|
+
signer: z.string().describe("Signer address"),
|
|
7
|
+
tokenId: z.string().describe("Condition token ID for the market outcome"),
|
|
8
|
+
makerAmount: z.string().describe("Amount the maker is willing to pay (in USDC base units)"),
|
|
9
|
+
takerAmount: z.string().describe("Amount the maker wants to receive (in outcome tokens)"),
|
|
10
|
+
expiration: z.string().describe("Order expiration timestamp"),
|
|
11
|
+
side: z.enum(["0", "1"]).describe("Order side: 0 = BUY, 1 = SELL"),
|
|
12
|
+
});
|
|
13
|
+
/** Zod schema for auth data needed to derive API credentials. */
|
|
14
|
+
const authDataSchema = z.object({
|
|
15
|
+
signature: z.string().describe("Auth signature"),
|
|
16
|
+
timestamp: z.string().describe("Auth timestamp"),
|
|
17
|
+
nonce: z.string().describe("Auth nonce"),
|
|
18
|
+
address: z.string().describe("Auth address"),
|
|
19
|
+
});
|
|
20
|
+
/** Zod schema for Safe operation types. */
|
|
21
|
+
const safeOperationSchema = z.union([z.literal(0), z.literal(1)]);
|
|
22
|
+
/** Zod schema for Safe operation metadata. */
|
|
23
|
+
const operationMetadataSchema = z.union([
|
|
24
|
+
z.object({
|
|
25
|
+
type: z.literal("SAFE_CREATE"),
|
|
26
|
+
safeAddress: z.string(),
|
|
27
|
+
eoaAddress: z.string(),
|
|
28
|
+
safeFactory: z.string().optional(),
|
|
29
|
+
}),
|
|
30
|
+
z.object({
|
|
31
|
+
type: z.literal("SAFE_EXECUTE"),
|
|
32
|
+
safeAddress: z.string(),
|
|
33
|
+
eoaAddress: z.string(),
|
|
34
|
+
nonce: z.string(),
|
|
35
|
+
to: z.string(),
|
|
36
|
+
data: z.string(),
|
|
37
|
+
operation: safeOperationSchema,
|
|
38
|
+
}),
|
|
39
|
+
]);
|
|
40
|
+
/** Zod schema for additional signed operations (Safe deploy/approvals). */
|
|
41
|
+
const signedOperationSchema = z.object({
|
|
42
|
+
id: z.string(),
|
|
43
|
+
signature: z.string(),
|
|
44
|
+
metadata: operationMetadataSchema,
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Validation schema for POST /api/v1/polymarket/post-order request body.
|
|
48
|
+
*
|
|
49
|
+
* Mirrors the MCP `polymarket_post_order` tool input schema.
|
|
50
|
+
*/
|
|
51
|
+
export const postOrderBodySchema = z.object({
|
|
52
|
+
order: signedOrderSchema.describe("The signed order data"),
|
|
53
|
+
signature: z.string().describe("The EIP-712 order signature"),
|
|
54
|
+
authData: authDataSchema.describe("Auth data for deriving Polymarket API credentials"),
|
|
55
|
+
additionalSignatures: z
|
|
56
|
+
.array(signedOperationSchema)
|
|
57
|
+
.optional()
|
|
58
|
+
.describe("Additional signed operations (Safe deploy/approval signatures) required before order submission"),
|
|
59
|
+
orderType: z
|
|
60
|
+
.enum(["GTC", "GTD", "FOK"])
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("Order type: GTC (Good 'Til Canceled, default), GTD (Good 'Til Date), FOK (Fill or Kill)"),
|
|
63
|
+
transactionsSucceeded: z
|
|
64
|
+
.boolean()
|
|
65
|
+
.default(true)
|
|
66
|
+
.describe("Whether prerequisite transactions (e.g., USDC transfers) succeeded. Defaults to true if omitted"),
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Shared schema for Safe execute operations (used by redeem and withdraw).
|
|
70
|
+
* Contains the signed SAFE_EXECUTE transaction data submitted to the Polymarket relayer.
|
|
71
|
+
*/
|
|
72
|
+
const safeExecuteBodySchema = z.object({
|
|
73
|
+
signature: z.string().describe("The signed SAFE_EXECUTE message"),
|
|
74
|
+
safeAddress: z.string().describe("Safe wallet address"),
|
|
75
|
+
eoaAddress: z.string().describe("EOA address"),
|
|
76
|
+
nonce: z.string().describe("Safe nonce"),
|
|
77
|
+
to: z.string().describe("Target contract address"),
|
|
78
|
+
data: z.string().describe("Encoded transaction data (hex)"),
|
|
79
|
+
operation: safeOperationSchema.describe("Operation type: 0 = Call, 1 = DelegateCall"),
|
|
80
|
+
signerWallet: z.string().optional().describe("Smart wallet user's EOA address"),
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Validation schema for POST /api/v1/polymarket/post-redeem request body.
|
|
84
|
+
*
|
|
85
|
+
* Submits a signed Safe redemption transaction to the Polymarket relayer.
|
|
86
|
+
*/
|
|
87
|
+
export const postRedeemBodySchema = safeExecuteBodySchema;
|
|
88
|
+
/**
|
|
89
|
+
* Validation schema for POST /api/v1/polymarket/post-withdraw request body.
|
|
90
|
+
*
|
|
91
|
+
* Submits a signed Safe withdraw transaction to the Polymarket relayer.
|
|
92
|
+
*/
|
|
93
|
+
export const postWithdrawBodySchema = safeExecuteBodySchema;
|
|
94
|
+
/**
|
|
95
|
+
* Validation schema for POST /api/v1/polymarket/get-orders request body.
|
|
96
|
+
*
|
|
97
|
+
* Fetches open orders from the Polymarket CLOB API using auth credentials.
|
|
98
|
+
*/
|
|
99
|
+
export const getOrdersBodySchema = z.object({
|
|
100
|
+
authData: authDataSchema.describe("Auth data for deriving Polymarket API credentials"),
|
|
101
|
+
signerWallet: z.string().optional().describe("Smart wallet user's EOA address"),
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* Validation schema for POST /api/v1/polymarket/cancel-order request body.
|
|
105
|
+
*
|
|
106
|
+
* Cancels an order on the Polymarket CLOB API.
|
|
107
|
+
*/
|
|
108
|
+
export const cancelOrderBodySchema = z.object({
|
|
109
|
+
authData: authDataSchema.describe("Auth data for deriving Polymarket API credentials"),
|
|
110
|
+
orderId: z.string().describe("The order ID to cancel"),
|
|
111
|
+
signerWallet: z.string().optional().describe("Smart wallet user's EOA address"),
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=polymarketBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polymarketBody.js","sourceRoot":"","sources":["../../src/schemas/polymarketBody.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8CAA8C;AAC9C,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IACtD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAC7C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IACzE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;IAC3F,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IACzF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IAC7D,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,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