@pear-protocol/core-sdk 1.17.0 → 1.17.2
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/auth/index.d.ts +25 -2
- package/dist/auth/index.js +41 -16
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +212 -204
- package/dist/external/index.js +13 -8
- package/dist/external/kalshi.js +22 -3
- package/dist/external/polymarket.js +24 -3
- package/dist/http.js +34 -31
- package/dist/index.js +9 -4
- package/dist/utils.js +18 -3
- package/package.json +3 -3
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { gzipJson } from '../utils';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
class Core {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "Core");
|
|
8
|
+
}
|
|
4
9
|
client;
|
|
5
10
|
clientId;
|
|
6
11
|
constructor(client, clientId) {
|
|
@@ -12,700 +17,703 @@ class Core {
|
|
|
12
17
|
// rebalance payloads it serves, so an unrelated body is a compile error.
|
|
13
18
|
withClientId(body) {
|
|
14
19
|
if (!this.clientId) return body;
|
|
15
|
-
return {
|
|
20
|
+
return {
|
|
21
|
+
clientId: this.clientId,
|
|
22
|
+
...body
|
|
23
|
+
};
|
|
16
24
|
}
|
|
17
25
|
accounts = {
|
|
18
|
-
list: async (query, headers) => {
|
|
26
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
19
27
|
return await this.client.fetch(`/trade-accounts`, {
|
|
20
28
|
method: "GET",
|
|
21
29
|
headers,
|
|
22
30
|
query
|
|
23
31
|
});
|
|
24
|
-
},
|
|
25
|
-
create: async (body, headers) => {
|
|
32
|
+
}, "list"),
|
|
33
|
+
create: /* @__PURE__ */ __name(async (body, headers) => {
|
|
26
34
|
return await this.client.fetch(`/trade-accounts`, {
|
|
27
35
|
method: "POST",
|
|
28
36
|
headers,
|
|
29
37
|
body
|
|
30
38
|
});
|
|
31
|
-
},
|
|
32
|
-
update: async (id, body, headers) => {
|
|
39
|
+
}, "create"),
|
|
40
|
+
update: /* @__PURE__ */ __name(async (id, body, headers) => {
|
|
33
41
|
return await this.client.fetch(`/trade-accounts/${id}`, {
|
|
34
42
|
method: "PATCH",
|
|
35
43
|
headers,
|
|
36
44
|
body
|
|
37
45
|
});
|
|
38
|
-
},
|
|
39
|
-
delete: async (id, headers) => {
|
|
46
|
+
}, "update"),
|
|
47
|
+
delete: /* @__PURE__ */ __name(async (id, headers) => {
|
|
40
48
|
return await this.client.fetch(`/trade-accounts/${id}`, {
|
|
41
49
|
method: "DELETE",
|
|
42
50
|
headers
|
|
43
51
|
});
|
|
44
|
-
},
|
|
45
|
-
credentials: async (id, headers) => {
|
|
52
|
+
}, "delete"),
|
|
53
|
+
credentials: /* @__PURE__ */ __name(async (id, headers) => {
|
|
46
54
|
return await this.client.fetch(`/trade-accounts/${id}/credentials`, {
|
|
47
55
|
method: "POST",
|
|
48
56
|
headers
|
|
49
57
|
});
|
|
50
|
-
},
|
|
51
|
-
restore: async (id, headers) => {
|
|
58
|
+
}, "credentials"),
|
|
59
|
+
restore: /* @__PURE__ */ __name(async (id, headers) => {
|
|
52
60
|
return await this.client.fetch(`/trade-accounts/${id}/restore`, {
|
|
53
61
|
method: "POST",
|
|
54
62
|
headers
|
|
55
63
|
});
|
|
56
|
-
}
|
|
64
|
+
}, "restore")
|
|
57
65
|
};
|
|
58
66
|
fee = {
|
|
59
67
|
// Resolves the trading fee and connector fee recipient for the caller's selected trade account.
|
|
60
68
|
// The connector is taken from the trade account, identified by the trade-account header.
|
|
61
|
-
get: async (query, headers) => {
|
|
69
|
+
get: /* @__PURE__ */ __name(async (query, headers) => {
|
|
62
70
|
return await this.client.fetch(`/fee`, {
|
|
63
71
|
method: "GET",
|
|
64
72
|
headers,
|
|
65
73
|
query
|
|
66
74
|
});
|
|
67
|
-
},
|
|
75
|
+
}, "get"),
|
|
68
76
|
// Resolves the connector-native approval target for the caller's role — the same fee_recipients
|
|
69
77
|
// row the order path names. Takes an explicit connector rather than a trade account, so the
|
|
70
78
|
// approval flows can ask while the account is still being created.
|
|
71
|
-
recipient: async (query, headers) => {
|
|
79
|
+
recipient: /* @__PURE__ */ __name(async (query, headers) => {
|
|
72
80
|
return await this.client.fetch(`/fee/recipient`, {
|
|
73
81
|
method: "GET",
|
|
74
82
|
headers,
|
|
75
83
|
query
|
|
76
84
|
});
|
|
77
|
-
}
|
|
85
|
+
}, "recipient")
|
|
78
86
|
};
|
|
79
87
|
apiKeys = {
|
|
80
|
-
list: async (headers) => {
|
|
88
|
+
list: /* @__PURE__ */ __name(async (headers) => {
|
|
81
89
|
return await this.client.fetch(`/api-keys`, {
|
|
82
90
|
method: "GET",
|
|
83
91
|
headers
|
|
84
92
|
});
|
|
85
|
-
},
|
|
86
|
-
create: async (body, headers) => {
|
|
93
|
+
}, "list"),
|
|
94
|
+
create: /* @__PURE__ */ __name(async (body, headers) => {
|
|
87
95
|
return await this.client.fetch(`/api-keys`, {
|
|
88
96
|
method: "POST",
|
|
89
97
|
headers,
|
|
90
98
|
body
|
|
91
99
|
});
|
|
92
|
-
},
|
|
93
|
-
revoke: async (id, headers) => {
|
|
100
|
+
}, "create"),
|
|
101
|
+
revoke: /* @__PURE__ */ __name(async (id, headers) => {
|
|
94
102
|
return await this.client.fetch(`/api-keys/${id}`, {
|
|
95
103
|
method: "DELETE",
|
|
96
104
|
headers
|
|
97
105
|
});
|
|
98
|
-
}
|
|
106
|
+
}, "revoke")
|
|
99
107
|
};
|
|
100
108
|
executions = {
|
|
101
|
-
list: async (query, headers) => {
|
|
109
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
102
110
|
return await this.client.fetch(`/executions`, {
|
|
103
111
|
method: "GET",
|
|
104
112
|
headers,
|
|
105
113
|
query
|
|
106
114
|
});
|
|
107
|
-
},
|
|
108
|
-
get: async (id, headers) => {
|
|
115
|
+
}, "list"),
|
|
116
|
+
get: /* @__PURE__ */ __name(async (id, headers) => {
|
|
109
117
|
return await this.client.fetch(`/executions/${id}`, {
|
|
110
118
|
method: "GET",
|
|
111
119
|
headers
|
|
112
120
|
});
|
|
113
|
-
}
|
|
121
|
+
}, "get")
|
|
114
122
|
};
|
|
115
123
|
fills = {
|
|
116
|
-
details: async (positionId, headers) => {
|
|
124
|
+
details: /* @__PURE__ */ __name(async (positionId, headers) => {
|
|
117
125
|
return await this.client.fetch(`/fills/${positionId}`, {
|
|
118
126
|
method: "GET",
|
|
119
127
|
headers
|
|
120
128
|
});
|
|
121
|
-
},
|
|
122
|
-
list: async (query, headers) => {
|
|
129
|
+
}, "details"),
|
|
130
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
123
131
|
return await this.client.fetch(`/fills`, {
|
|
124
132
|
method: "GET",
|
|
125
133
|
headers,
|
|
126
134
|
query
|
|
127
135
|
});
|
|
128
|
-
},
|
|
129
|
-
provisionals: async (headers) => {
|
|
136
|
+
}, "list"),
|
|
137
|
+
provisionals: /* @__PURE__ */ __name(async (headers) => {
|
|
130
138
|
return await this.client.fetch(`/fills/provisionals-lite`, {
|
|
131
139
|
method: "GET",
|
|
132
140
|
headers
|
|
133
141
|
});
|
|
134
|
-
}
|
|
142
|
+
}, "provisionals")
|
|
135
143
|
};
|
|
136
144
|
funding = {
|
|
137
|
-
list: async (query, headers) => {
|
|
145
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
138
146
|
return await this.client.fetch(`/funding`, {
|
|
139
147
|
method: "GET",
|
|
140
148
|
headers,
|
|
141
149
|
query
|
|
142
150
|
});
|
|
143
|
-
}
|
|
151
|
+
}, "list")
|
|
144
152
|
};
|
|
145
153
|
ladders = {
|
|
146
|
-
list: async (query, headers) => {
|
|
154
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
147
155
|
return await this.client.fetch(`/ladders`, {
|
|
148
156
|
method: "GET",
|
|
149
157
|
headers,
|
|
150
158
|
query
|
|
151
159
|
});
|
|
152
|
-
},
|
|
153
|
-
create: async (body, headers) => {
|
|
160
|
+
}, "list"),
|
|
161
|
+
create: /* @__PURE__ */ __name(async (body, headers) => {
|
|
154
162
|
return await this.client.fetch(`/ladders`, {
|
|
155
163
|
method: "POST",
|
|
156
164
|
headers,
|
|
157
165
|
body
|
|
158
166
|
});
|
|
159
|
-
},
|
|
160
|
-
get: async (ladderId, headers) => {
|
|
167
|
+
}, "create"),
|
|
168
|
+
get: /* @__PURE__ */ __name(async (ladderId, headers) => {
|
|
161
169
|
return await this.client.fetch(`/ladders/${ladderId}`, {
|
|
162
170
|
method: "GET",
|
|
163
171
|
headers
|
|
164
172
|
});
|
|
165
|
-
},
|
|
166
|
-
cancel: async (ladderId, headers) => {
|
|
173
|
+
}, "get"),
|
|
174
|
+
cancel: /* @__PURE__ */ __name(async (ladderId, headers) => {
|
|
167
175
|
return await this.client.fetch(`/ladders/${ladderId}/cancel`, {
|
|
168
176
|
method: "POST",
|
|
169
177
|
headers
|
|
170
178
|
});
|
|
171
|
-
}
|
|
179
|
+
}, "cancel")
|
|
172
180
|
};
|
|
173
181
|
instruments = {
|
|
174
|
-
list: async (query, headers) => {
|
|
182
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
175
183
|
return await this.client.fetch(`/instruments`, {
|
|
176
184
|
method: "GET",
|
|
177
185
|
headers,
|
|
178
186
|
query
|
|
179
187
|
});
|
|
180
|
-
},
|
|
181
|
-
lite: async (query, headers) => {
|
|
188
|
+
}, "list"),
|
|
189
|
+
lite: /* @__PURE__ */ __name(async (query, headers) => {
|
|
182
190
|
return await this.client.fetch(`/instruments/lite`, {
|
|
183
191
|
method: "GET",
|
|
184
192
|
headers,
|
|
185
193
|
query
|
|
186
194
|
});
|
|
187
|
-
},
|
|
188
|
-
symbolToIdMap: async (query, headers) => {
|
|
195
|
+
}, "lite"),
|
|
196
|
+
symbolToIdMap: /* @__PURE__ */ __name(async (query, headers) => {
|
|
189
197
|
return await this.client.fetch(`/instruments/symbol-to-id-map`, {
|
|
190
198
|
method: "GET",
|
|
191
199
|
headers,
|
|
192
200
|
query
|
|
193
201
|
});
|
|
194
|
-
}
|
|
202
|
+
}, "symbolToIdMap")
|
|
195
203
|
};
|
|
196
204
|
markets = {
|
|
197
|
-
list: async (query, headers) => {
|
|
205
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
198
206
|
return await this.client.fetch(`/markets`, {
|
|
199
207
|
method: "GET",
|
|
200
208
|
headers,
|
|
201
209
|
query
|
|
202
210
|
});
|
|
203
|
-
},
|
|
204
|
-
baskets: async (query, headers) => {
|
|
211
|
+
}, "list"),
|
|
212
|
+
baskets: /* @__PURE__ */ __name(async (query, headers) => {
|
|
205
213
|
return await this.client.fetch(`/markets/baskets`, {
|
|
206
214
|
method: "GET",
|
|
207
215
|
headers,
|
|
208
216
|
query
|
|
209
217
|
});
|
|
210
|
-
},
|
|
211
|
-
basketPositions: async (body, headers) => {
|
|
218
|
+
}, "baskets"),
|
|
219
|
+
basketPositions: /* @__PURE__ */ __name(async (body, headers) => {
|
|
212
220
|
return await this.client.fetch(`/markets/baskets/positions`, {
|
|
213
221
|
method: "POST",
|
|
214
222
|
headers,
|
|
215
223
|
body
|
|
216
224
|
});
|
|
217
|
-
}
|
|
225
|
+
}, "basketPositions")
|
|
218
226
|
};
|
|
219
227
|
notifications = {
|
|
220
|
-
list: async (query, headers) => {
|
|
228
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
221
229
|
return await this.client.fetch(`/notifications`, {
|
|
222
230
|
method: "GET",
|
|
223
231
|
headers,
|
|
224
232
|
query
|
|
225
233
|
});
|
|
226
|
-
},
|
|
227
|
-
markRead: async (body, headers) => {
|
|
234
|
+
}, "list"),
|
|
235
|
+
markRead: /* @__PURE__ */ __name(async (body, headers) => {
|
|
228
236
|
return await this.client.fetch(`/notifications/read`, {
|
|
229
237
|
method: "POST",
|
|
230
238
|
headers,
|
|
231
239
|
body
|
|
232
240
|
});
|
|
233
|
-
},
|
|
234
|
-
markUnread: async (body, headers) => {
|
|
241
|
+
}, "markRead"),
|
|
242
|
+
markUnread: /* @__PURE__ */ __name(async (body, headers) => {
|
|
235
243
|
return await this.client.fetch(`/notifications/unread`, {
|
|
236
244
|
method: "POST",
|
|
237
245
|
headers,
|
|
238
246
|
body
|
|
239
247
|
});
|
|
240
|
-
}
|
|
248
|
+
}, "markUnread")
|
|
241
249
|
};
|
|
242
250
|
oracle = {
|
|
243
|
-
btcdom: async (headers) => {
|
|
251
|
+
btcdom: /* @__PURE__ */ __name(async (headers) => {
|
|
244
252
|
return await this.client.fetch(`/oracle/btcdom`, {
|
|
245
253
|
method: "GET",
|
|
246
254
|
headers
|
|
247
255
|
});
|
|
248
|
-
}
|
|
256
|
+
}, "btcdom")
|
|
249
257
|
};
|
|
250
258
|
positions = {
|
|
251
|
-
list: async (query, headers) => {
|
|
259
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
252
260
|
return await this.client.fetch(`/positions`, {
|
|
253
261
|
method: "GET",
|
|
254
262
|
headers,
|
|
255
263
|
query
|
|
256
264
|
});
|
|
257
|
-
},
|
|
258
|
-
openLite: async (headers) => {
|
|
265
|
+
}, "list"),
|
|
266
|
+
openLite: /* @__PURE__ */ __name(async (headers) => {
|
|
259
267
|
return await this.client.fetch(`/positions/lite`, {
|
|
260
268
|
method: "GET",
|
|
261
269
|
headers
|
|
262
270
|
});
|
|
263
|
-
},
|
|
271
|
+
}, "openLite"),
|
|
264
272
|
/**
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
closed: async (query, headers) => {
|
|
273
|
+
* Closed-trade history, newest close first, composed server-side.
|
|
274
|
+
*
|
|
275
|
+
* A page may hold fewer than `limit` trades and still return a `nextCursor` —
|
|
276
|
+
* page until `nextCursor` is absent, never until a page comes back short.
|
|
277
|
+
*/
|
|
278
|
+
closed: /* @__PURE__ */ __name(async (query, headers) => {
|
|
271
279
|
return await this.client.fetch(`/positions/closed`, {
|
|
272
280
|
method: "GET",
|
|
273
281
|
headers,
|
|
274
282
|
query
|
|
275
283
|
});
|
|
276
|
-
}
|
|
284
|
+
}, "closed")
|
|
277
285
|
};
|
|
278
286
|
portfolio = {
|
|
279
|
-
overview: async (query, headers) => {
|
|
287
|
+
overview: /* @__PURE__ */ __name(async (query, headers) => {
|
|
280
288
|
return await this.client.fetch(`/portfolio`, {
|
|
281
289
|
method: "GET",
|
|
282
290
|
headers,
|
|
283
291
|
query
|
|
284
292
|
});
|
|
285
|
-
},
|
|
286
|
-
analytics: async (query, headers) => {
|
|
293
|
+
}, "overview"),
|
|
294
|
+
analytics: /* @__PURE__ */ __name(async (query, headers) => {
|
|
287
295
|
return await this.client.fetch(`/portfolio/analytics`, {
|
|
288
296
|
method: "GET",
|
|
289
297
|
headers,
|
|
290
298
|
query
|
|
291
299
|
});
|
|
292
|
-
}
|
|
300
|
+
}, "analytics")
|
|
293
301
|
};
|
|
294
302
|
prices = {
|
|
295
|
-
list: async (query, headers) => {
|
|
303
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
296
304
|
return await this.client.fetch(`/prices`, {
|
|
297
305
|
method: "GET",
|
|
298
306
|
headers,
|
|
299
307
|
query
|
|
300
308
|
});
|
|
301
|
-
}
|
|
309
|
+
}, "list")
|
|
302
310
|
};
|
|
303
311
|
rebalance = {
|
|
304
|
-
manual: async (positionId, body, headers) => {
|
|
312
|
+
manual: /* @__PURE__ */ __name(async (positionId, body, headers) => {
|
|
305
313
|
return await this.client.fetch(`/rebalance/manual/${positionId}`, {
|
|
306
314
|
method: "POST",
|
|
307
315
|
headers,
|
|
308
316
|
body: this.withClientId(body)
|
|
309
317
|
});
|
|
310
|
-
},
|
|
318
|
+
}, "manual"),
|
|
311
319
|
auto: {
|
|
312
|
-
list: async (query, headers) => {
|
|
320
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
313
321
|
return await this.client.fetch(`/rebalance/auto`, {
|
|
314
322
|
method: "GET",
|
|
315
323
|
headers,
|
|
316
324
|
query
|
|
317
325
|
});
|
|
318
|
-
},
|
|
319
|
-
create: async (body, headers) => {
|
|
326
|
+
}, "list"),
|
|
327
|
+
create: /* @__PURE__ */ __name(async (body, headers) => {
|
|
320
328
|
return await this.client.fetch(`/rebalance/auto`, {
|
|
321
329
|
method: "POST",
|
|
322
330
|
headers,
|
|
323
331
|
body
|
|
324
332
|
});
|
|
325
|
-
},
|
|
326
|
-
update: async (id, body, headers) => {
|
|
333
|
+
}, "create"),
|
|
334
|
+
update: /* @__PURE__ */ __name(async (id, body, headers) => {
|
|
327
335
|
return await this.client.fetch(`/rebalance/auto/${id}`, {
|
|
328
336
|
method: "PATCH",
|
|
329
337
|
headers,
|
|
330
338
|
body
|
|
331
339
|
});
|
|
332
|
-
},
|
|
333
|
-
replace: async (id, body, headers) => {
|
|
340
|
+
}, "update"),
|
|
341
|
+
replace: /* @__PURE__ */ __name(async (id, body, headers) => {
|
|
334
342
|
return await this.client.fetch(`/rebalance/auto/${id}/replace`, {
|
|
335
343
|
method: "POST",
|
|
336
344
|
headers,
|
|
337
345
|
body
|
|
338
346
|
});
|
|
339
|
-
},
|
|
340
|
-
cancel: async (id, headers) => {
|
|
347
|
+
}, "replace"),
|
|
348
|
+
cancel: /* @__PURE__ */ __name(async (id, headers) => {
|
|
341
349
|
return await this.client.fetch(`/rebalance/auto/${id}/cancel`, {
|
|
342
350
|
method: "POST",
|
|
343
351
|
headers
|
|
344
352
|
});
|
|
345
|
-
}
|
|
353
|
+
}, "cancel")
|
|
346
354
|
},
|
|
347
|
-
listEvents: async (positionId, query, headers) => {
|
|
355
|
+
listEvents: /* @__PURE__ */ __name(async (positionId, query, headers) => {
|
|
348
356
|
return await this.client.fetch(`/rebalance/${positionId}/events`, {
|
|
349
357
|
method: "GET",
|
|
350
358
|
headers,
|
|
351
359
|
query
|
|
352
360
|
});
|
|
353
|
-
}
|
|
361
|
+
}, "listEvents")
|
|
354
362
|
};
|
|
355
363
|
referrals = {
|
|
356
364
|
/** Issue an immutable referral code to the authenticated user. */
|
|
357
|
-
create: async (body, headers) => {
|
|
365
|
+
create: /* @__PURE__ */ __name(async (body, headers) => {
|
|
358
366
|
return await this.client.fetch(`/referrals/create`, {
|
|
359
367
|
method: "POST",
|
|
360
368
|
headers,
|
|
361
369
|
body
|
|
362
370
|
});
|
|
363
|
-
},
|
|
371
|
+
}, "create"),
|
|
364
372
|
/** Permanently bind the authenticated user to an existing referral code. */
|
|
365
|
-
bind: async (body, headers) => {
|
|
373
|
+
bind: /* @__PURE__ */ __name(async (body, headers) => {
|
|
366
374
|
return await this.client.fetch(`/referrals/bind`, {
|
|
367
375
|
method: "POST",
|
|
368
376
|
headers,
|
|
369
377
|
body
|
|
370
378
|
});
|
|
371
|
-
},
|
|
379
|
+
}, "bind"),
|
|
372
380
|
/** Return referral codes owned by the authenticated user and their referrer. */
|
|
373
|
-
status: async (headers) => {
|
|
381
|
+
status: /* @__PURE__ */ __name(async (headers) => {
|
|
374
382
|
return await this.client.fetch(`/referrals/status`, {
|
|
375
383
|
method: "GET",
|
|
376
384
|
headers
|
|
377
385
|
});
|
|
378
|
-
},
|
|
386
|
+
}, "status"),
|
|
379
387
|
/** List users permanently bound to the authenticated referrer. */
|
|
380
|
-
referees: async (query, headers) => {
|
|
388
|
+
referees: /* @__PURE__ */ __name(async (query, headers) => {
|
|
381
389
|
return await this.client.fetch(`/referrals/referees`, {
|
|
382
390
|
method: "GET",
|
|
383
391
|
headers,
|
|
384
392
|
query
|
|
385
393
|
});
|
|
386
|
-
}
|
|
394
|
+
}, "referees")
|
|
387
395
|
};
|
|
388
396
|
savedBaskets = {
|
|
389
|
-
list: async (headers) => {
|
|
397
|
+
list: /* @__PURE__ */ __name(async (headers) => {
|
|
390
398
|
return await this.client.fetch(`/saved-baskets`, {
|
|
391
399
|
method: "GET",
|
|
392
400
|
headers
|
|
393
401
|
});
|
|
394
|
-
},
|
|
395
|
-
create: async (body, headers) => {
|
|
402
|
+
}, "list"),
|
|
403
|
+
create: /* @__PURE__ */ __name(async (body, headers) => {
|
|
396
404
|
return await this.client.fetch(`/saved-baskets`, {
|
|
397
405
|
method: "POST",
|
|
398
406
|
headers,
|
|
399
407
|
body
|
|
400
408
|
});
|
|
401
|
-
},
|
|
402
|
-
update: async (id, body, headers) => {
|
|
409
|
+
}, "create"),
|
|
410
|
+
update: /* @__PURE__ */ __name(async (id, body, headers) => {
|
|
403
411
|
return await this.client.fetch(`/saved-baskets/${id}`, {
|
|
404
412
|
method: "PATCH",
|
|
405
413
|
headers,
|
|
406
414
|
body
|
|
407
415
|
});
|
|
408
|
-
},
|
|
409
|
-
delete: async (id, headers) => {
|
|
416
|
+
}, "update"),
|
|
417
|
+
delete: /* @__PURE__ */ __name(async (id, headers) => {
|
|
410
418
|
return await this.client.fetch(`/saved-baskets/${id}`, {
|
|
411
419
|
method: "DELETE",
|
|
412
420
|
headers
|
|
413
421
|
});
|
|
414
|
-
}
|
|
422
|
+
}, "delete")
|
|
415
423
|
};
|
|
416
424
|
schedules = {
|
|
417
|
-
list: async (query, headers) => {
|
|
425
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
418
426
|
return await this.client.fetch(`/schedules`, {
|
|
419
427
|
method: "GET",
|
|
420
428
|
headers,
|
|
421
429
|
query
|
|
422
430
|
});
|
|
423
|
-
},
|
|
424
|
-
create: async (body, headers) => {
|
|
431
|
+
}, "list"),
|
|
432
|
+
create: /* @__PURE__ */ __name(async (body, headers) => {
|
|
425
433
|
return await this.client.fetch(`/schedules`, {
|
|
426
434
|
method: "POST",
|
|
427
435
|
headers,
|
|
428
436
|
body: this.withClientId(body)
|
|
429
437
|
});
|
|
430
|
-
},
|
|
431
|
-
cancel: async (scheduleId, headers) => {
|
|
438
|
+
}, "create"),
|
|
439
|
+
cancel: /* @__PURE__ */ __name(async (scheduleId, headers) => {
|
|
432
440
|
return await this.client.fetch(`/schedules/${scheduleId}/cancel`, {
|
|
433
441
|
method: "PATCH",
|
|
434
442
|
headers
|
|
435
443
|
});
|
|
436
|
-
},
|
|
437
|
-
cancelAll: async (headers) => {
|
|
444
|
+
}, "cancel"),
|
|
445
|
+
cancelAll: /* @__PURE__ */ __name(async (headers) => {
|
|
438
446
|
return await this.client.fetch(`/schedules/cancel-all`, {
|
|
439
447
|
method: "PATCH",
|
|
440
448
|
headers
|
|
441
449
|
});
|
|
442
|
-
}
|
|
450
|
+
}, "cancelAll")
|
|
443
451
|
};
|
|
444
452
|
sync = {
|
|
445
453
|
fills: {
|
|
446
|
-
since: async (body, headers) => {
|
|
454
|
+
since: /* @__PURE__ */ __name(async (body, headers) => {
|
|
447
455
|
return await this.client.fetch(`/sync/fills/since`, {
|
|
448
456
|
method: "POST",
|
|
449
457
|
headers,
|
|
450
458
|
body
|
|
451
459
|
});
|
|
452
|
-
},
|
|
453
|
-
reconcile: async (body, headers) => {
|
|
460
|
+
}, "since"),
|
|
461
|
+
reconcile: /* @__PURE__ */ __name(async (body, headers) => {
|
|
454
462
|
return await this.client.fetch(`/sync/fills/reconcile`, {
|
|
455
463
|
method: "POST",
|
|
456
464
|
headers,
|
|
457
465
|
body
|
|
458
466
|
});
|
|
459
|
-
},
|
|
460
|
-
confirm: async (body, headers) => {
|
|
467
|
+
}, "reconcile"),
|
|
468
|
+
confirm: /* @__PURE__ */ __name(async (body, headers) => {
|
|
461
469
|
return await this.client.fetch(`/sync/fills/confirm`, {
|
|
462
470
|
method: "POST",
|
|
463
471
|
headers,
|
|
464
472
|
body
|
|
465
473
|
});
|
|
466
|
-
},
|
|
467
|
-
create: async (body, headers) => {
|
|
474
|
+
}, "confirm"),
|
|
475
|
+
create: /* @__PURE__ */ __name(async (body, headers) => {
|
|
468
476
|
return await this.client.fetch(`/sync/fills/create`, {
|
|
469
477
|
method: "POST",
|
|
470
478
|
headers,
|
|
471
479
|
body
|
|
472
480
|
});
|
|
473
|
-
},
|
|
474
|
-
createBulk: async (body, headers) => {
|
|
481
|
+
}, "create"),
|
|
482
|
+
createBulk: /* @__PURE__ */ __name(async (body, headers) => {
|
|
475
483
|
const file = await gzipJson(body);
|
|
476
484
|
const formData = new FormData();
|
|
477
485
|
formData.append("file", file, "payload.json.gz");
|
|
478
486
|
return await this.client.fetch(`/sync/fills/create/bulk`, {
|
|
479
487
|
method: "POST",
|
|
480
|
-
headers: {
|
|
488
|
+
headers: {
|
|
489
|
+
...headers,
|
|
490
|
+
"content-type": null
|
|
491
|
+
},
|
|
481
492
|
body: formData
|
|
482
493
|
});
|
|
483
|
-
}
|
|
494
|
+
}, "createBulk")
|
|
484
495
|
},
|
|
485
496
|
funding: {
|
|
486
|
-
since: async (body, headers) => {
|
|
497
|
+
since: /* @__PURE__ */ __name(async (body, headers) => {
|
|
487
498
|
return await this.client.fetch(`/sync/funding/since`, {
|
|
488
499
|
method: "POST",
|
|
489
500
|
headers,
|
|
490
501
|
body
|
|
491
502
|
});
|
|
492
|
-
},
|
|
493
|
-
create: async (body, headers) => {
|
|
503
|
+
}, "since"),
|
|
504
|
+
create: /* @__PURE__ */ __name(async (body, headers) => {
|
|
494
505
|
return await this.client.fetch(`/sync/funding/create`, {
|
|
495
506
|
method: "POST",
|
|
496
507
|
headers,
|
|
497
508
|
body
|
|
498
509
|
});
|
|
499
|
-
},
|
|
500
|
-
createBulk: async (body, headers) => {
|
|
510
|
+
}, "create"),
|
|
511
|
+
createBulk: /* @__PURE__ */ __name(async (body, headers) => {
|
|
501
512
|
const file = await gzipJson(body);
|
|
502
513
|
const formData = new FormData();
|
|
503
514
|
formData.append("file", file, "payload.json.gz");
|
|
504
515
|
return await this.client.fetch(`/sync/funding/create/bulk`, {
|
|
505
516
|
method: "POST",
|
|
506
|
-
headers: {
|
|
517
|
+
headers: {
|
|
518
|
+
...headers,
|
|
519
|
+
"content-type": null
|
|
520
|
+
},
|
|
507
521
|
body: formData
|
|
508
522
|
});
|
|
509
|
-
}
|
|
523
|
+
}, "createBulk")
|
|
510
524
|
}
|
|
511
525
|
};
|
|
512
526
|
trade = {
|
|
513
|
-
open: async (body, headers) => {
|
|
527
|
+
open: /* @__PURE__ */ __name(async (body, headers) => {
|
|
514
528
|
return await this.client.fetch(`/trade/open`, {
|
|
515
529
|
method: "POST",
|
|
516
530
|
headers,
|
|
517
531
|
body: this.withClientId(body)
|
|
518
532
|
});
|
|
519
|
-
},
|
|
520
|
-
adjust: async (positionId, body, headers) => {
|
|
533
|
+
}, "open"),
|
|
534
|
+
adjust: /* @__PURE__ */ __name(async (positionId, body, headers) => {
|
|
521
535
|
return await this.client.fetch(`/trade/${positionId}/adjust`, {
|
|
522
536
|
method: "POST",
|
|
523
537
|
headers,
|
|
524
538
|
body: this.withClientId(body)
|
|
525
539
|
});
|
|
526
|
-
},
|
|
527
|
-
close: async (positionId, body, headers) => {
|
|
540
|
+
}, "adjust"),
|
|
541
|
+
close: /* @__PURE__ */ __name(async (positionId, body, headers) => {
|
|
528
542
|
return await this.client.fetch(`/trade/${positionId}/close`, {
|
|
529
543
|
method: "POST",
|
|
530
544
|
headers,
|
|
531
545
|
body: this.withClientId(body)
|
|
532
546
|
});
|
|
533
|
-
},
|
|
534
|
-
reverse: async (positionId, body, headers) => {
|
|
547
|
+
}, "close"),
|
|
548
|
+
reverse: /* @__PURE__ */ __name(async (positionId, body, headers) => {
|
|
535
549
|
return await this.client.fetch(`/trade/${positionId}/reverse`, {
|
|
536
550
|
method: "POST",
|
|
537
551
|
headers,
|
|
538
552
|
body
|
|
539
553
|
});
|
|
540
|
-
},
|
|
541
|
-
closeAll: async (body, headers) => {
|
|
554
|
+
}, "reverse"),
|
|
555
|
+
closeAll: /* @__PURE__ */ __name(async (body, headers) => {
|
|
542
556
|
return await this.client.fetch(`/trade/close-all`, {
|
|
543
557
|
method: "POST",
|
|
544
558
|
headers,
|
|
545
559
|
body: this.withClientId(body)
|
|
546
560
|
});
|
|
547
|
-
},
|
|
548
|
-
setLeverage: async (body, headers) => {
|
|
561
|
+
}, "closeAll"),
|
|
562
|
+
setLeverage: /* @__PURE__ */ __name(async (body, headers) => {
|
|
549
563
|
return await this.client.fetch(`/leverage`, {
|
|
550
564
|
method: "PUT",
|
|
551
565
|
headers,
|
|
552
566
|
body
|
|
553
567
|
});
|
|
554
|
-
}
|
|
568
|
+
}, "setLeverage")
|
|
555
569
|
};
|
|
556
570
|
triggers = {
|
|
557
|
-
list: async (query, headers) => {
|
|
571
|
+
list: /* @__PURE__ */ __name(async (query, headers) => {
|
|
558
572
|
return await this.client.fetch(`/triggers`, {
|
|
559
573
|
method: "GET",
|
|
560
574
|
headers,
|
|
561
575
|
query
|
|
562
576
|
});
|
|
563
|
-
},
|
|
564
|
-
open: async (body, headers) => {
|
|
577
|
+
}, "list"),
|
|
578
|
+
open: /* @__PURE__ */ __name(async (body, headers) => {
|
|
565
579
|
return await this.client.fetch(`/triggers/open`, {
|
|
566
580
|
method: "POST",
|
|
567
581
|
headers,
|
|
568
582
|
body: this.withClientId(body)
|
|
569
583
|
});
|
|
570
|
-
},
|
|
571
|
-
close: async (body, headers) => {
|
|
584
|
+
}, "open"),
|
|
585
|
+
close: /* @__PURE__ */ __name(async (body, headers) => {
|
|
572
586
|
return await this.client.fetch(`/triggers/close`, {
|
|
573
587
|
method: "POST",
|
|
574
588
|
headers,
|
|
575
589
|
body: this.withClientId(body)
|
|
576
590
|
});
|
|
577
|
-
},
|
|
578
|
-
cancel: async (triggerId, headers) => {
|
|
591
|
+
}, "close"),
|
|
592
|
+
cancel: /* @__PURE__ */ __name(async (triggerId, headers) => {
|
|
579
593
|
return await this.client.fetch(`/triggers/${triggerId}/cancel`, {
|
|
580
594
|
method: "PATCH",
|
|
581
595
|
headers
|
|
582
596
|
});
|
|
583
|
-
},
|
|
584
|
-
cancelAll: async (headers) => {
|
|
597
|
+
}, "cancel"),
|
|
598
|
+
cancelAll: /* @__PURE__ */ __name(async (headers) => {
|
|
585
599
|
return await this.client.fetch(`/triggers/cancel-all`, {
|
|
586
600
|
method: "PATCH",
|
|
587
601
|
headers
|
|
588
602
|
});
|
|
589
|
-
}
|
|
603
|
+
}, "cancelAll")
|
|
590
604
|
};
|
|
591
605
|
users = {
|
|
592
|
-
profile: async (headers) => {
|
|
606
|
+
profile: /* @__PURE__ */ __name(async (headers) => {
|
|
593
607
|
return await this.client.fetch(`/users/profile`, {
|
|
594
608
|
method: "GET",
|
|
595
609
|
headers
|
|
596
610
|
});
|
|
597
|
-
},
|
|
598
|
-
updateDisplayName: async (body, headers) => {
|
|
611
|
+
}, "profile"),
|
|
612
|
+
updateDisplayName: /* @__PURE__ */ __name(async (body, headers) => {
|
|
599
613
|
return await this.client.fetch(`/users/profile/display-name`, {
|
|
600
614
|
method: "PATCH",
|
|
601
615
|
headers,
|
|
602
616
|
body
|
|
603
617
|
});
|
|
604
|
-
},
|
|
605
|
-
updatePreferences: async (body, headers) => {
|
|
618
|
+
}, "updateDisplayName"),
|
|
619
|
+
updatePreferences: /* @__PURE__ */ __name(async (body, headers) => {
|
|
606
620
|
return await this.client.fetch(`/users/preferences`, {
|
|
607
621
|
method: "PATCH",
|
|
608
622
|
headers,
|
|
609
623
|
body
|
|
610
624
|
});
|
|
611
|
-
}
|
|
625
|
+
}, "updatePreferences")
|
|
612
626
|
};
|
|
613
627
|
misc = {
|
|
614
628
|
lighter: {
|
|
615
|
-
createApiKey: async (body, headers) => {
|
|
629
|
+
createApiKey: /* @__PURE__ */ __name(async (body, headers) => {
|
|
616
630
|
return await this.client.fetch(`/misc/lighter/create-api-key`, {
|
|
617
631
|
method: "POST",
|
|
618
632
|
headers,
|
|
619
633
|
body
|
|
620
634
|
});
|
|
621
|
-
},
|
|
622
|
-
changePubKey: async (body, headers) => {
|
|
635
|
+
}, "createApiKey"),
|
|
636
|
+
changePubKey: /* @__PURE__ */ __name(async (body, headers) => {
|
|
623
637
|
return await this.client.fetch(`/misc/lighter/change-pub-key`, {
|
|
624
638
|
method: "POST",
|
|
625
639
|
headers,
|
|
626
640
|
body
|
|
627
641
|
});
|
|
628
|
-
},
|
|
629
|
-
prepareApproveIntegrator: async (body, headers) => {
|
|
630
|
-
return await this.client.fetch(
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
headers,
|
|
645
|
-
body
|
|
646
|
-
}
|
|
647
|
-
);
|
|
648
|
-
},
|
|
649
|
-
createAuthToken: async (body, headers) => {
|
|
642
|
+
}, "changePubKey"),
|
|
643
|
+
prepareApproveIntegrator: /* @__PURE__ */ __name(async (body, headers) => {
|
|
644
|
+
return await this.client.fetch(`/misc/lighter/prepare-approve-integrator`, {
|
|
645
|
+
method: "POST",
|
|
646
|
+
headers,
|
|
647
|
+
body
|
|
648
|
+
});
|
|
649
|
+
}, "prepareApproveIntegrator"),
|
|
650
|
+
submitApproveIntegrator: /* @__PURE__ */ __name(async (body, headers) => {
|
|
651
|
+
return await this.client.fetch(`/misc/lighter/submit-approve-integrator`, {
|
|
652
|
+
method: "POST",
|
|
653
|
+
headers,
|
|
654
|
+
body
|
|
655
|
+
});
|
|
656
|
+
}, "submitApproveIntegrator"),
|
|
657
|
+
createAuthToken: /* @__PURE__ */ __name(async (body, headers) => {
|
|
650
658
|
return await this.client.fetch(`/misc/lighter/create-auth-token`, {
|
|
651
659
|
method: "POST",
|
|
652
660
|
headers,
|
|
653
661
|
body
|
|
654
662
|
});
|
|
655
|
-
}
|
|
663
|
+
}, "createAuthToken")
|
|
656
664
|
}
|
|
657
665
|
};
|
|
658
666
|
statistics = {
|
|
659
|
-
volume: async (query, headers) => {
|
|
667
|
+
volume: /* @__PURE__ */ __name(async (query, headers) => {
|
|
660
668
|
return await this.client.fetch(`/statistics/volume`, {
|
|
661
669
|
method: "GET",
|
|
662
670
|
headers,
|
|
663
671
|
query
|
|
664
672
|
});
|
|
665
|
-
},
|
|
666
|
-
oi: async (query, headers) => {
|
|
673
|
+
}, "volume"),
|
|
674
|
+
oi: /* @__PURE__ */ __name(async (query, headers) => {
|
|
667
675
|
return await this.client.fetch(`/statistics/oi`, {
|
|
668
676
|
method: "GET",
|
|
669
677
|
headers,
|
|
670
678
|
query
|
|
671
679
|
});
|
|
672
|
-
},
|
|
673
|
-
totals: async (query, headers) => {
|
|
680
|
+
}, "oi"),
|
|
681
|
+
totals: /* @__PURE__ */ __name(async (query, headers) => {
|
|
674
682
|
return await this.client.fetch(`/statistics/totals`, {
|
|
675
683
|
method: "GET",
|
|
676
684
|
headers,
|
|
677
685
|
query
|
|
678
686
|
});
|
|
679
|
-
},
|
|
680
|
-
leaderboard: async (query, headers) => {
|
|
687
|
+
}, "totals"),
|
|
688
|
+
leaderboard: /* @__PURE__ */ __name(async (query, headers) => {
|
|
681
689
|
return await this.client.fetch(`/statistics/leaderboard`, {
|
|
682
690
|
method: "GET",
|
|
683
691
|
headers,
|
|
684
692
|
query
|
|
685
693
|
});
|
|
686
|
-
}
|
|
694
|
+
}, "leaderboard")
|
|
687
695
|
};
|
|
688
696
|
tca = {
|
|
689
|
-
execution: async (executionId, headers) => {
|
|
697
|
+
execution: /* @__PURE__ */ __name(async (executionId, headers) => {
|
|
690
698
|
return await this.client.fetch(`/tca/executions/${executionId}`, {
|
|
691
699
|
method: "GET",
|
|
692
700
|
headers
|
|
693
701
|
});
|
|
694
|
-
},
|
|
695
|
-
position: async (positionId, query, headers) => {
|
|
702
|
+
}, "execution"),
|
|
703
|
+
position: /* @__PURE__ */ __name(async (positionId, query, headers) => {
|
|
696
704
|
return await this.client.fetch(`/tca/positions/${positionId}`, {
|
|
697
705
|
method: "GET",
|
|
698
706
|
headers,
|
|
699
707
|
query
|
|
700
708
|
});
|
|
701
|
-
},
|
|
702
|
-
summary: async (query, headers) => {
|
|
709
|
+
}, "position"),
|
|
710
|
+
summary: /* @__PURE__ */ __name(async (query, headers) => {
|
|
703
711
|
return await this.client.fetch(`/tca/summary`, {
|
|
704
712
|
method: "GET",
|
|
705
713
|
headers,
|
|
706
714
|
query
|
|
707
715
|
});
|
|
708
|
-
}
|
|
716
|
+
}, "summary")
|
|
709
717
|
};
|
|
710
718
|
}
|
|
711
719
|
|