@sigrex/client 2.1.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.
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/index.d.mts +9623 -0
- package/dist/index.d.ts +9623 -0
- package/dist/index.js +1840 -0
- package/dist/index.mjs +1787 -0
- package/package.json +40 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1787 @@
|
|
|
1
|
+
// src/crypto.ts
|
|
2
|
+
import crypto from "crypto";
|
|
3
|
+
function generateHmacSignature(secret, method, path, timestamp, body) {
|
|
4
|
+
const methodUpper = method.toUpperCase();
|
|
5
|
+
const hasBody = (methodUpper === "POST" || methodUpper === "PUT") && body !== void 0 && body !== null;
|
|
6
|
+
const bodyStr = hasBody ? JSON.stringify(body) : "";
|
|
7
|
+
const message = methodUpper + path + bodyStr + timestamp;
|
|
8
|
+
return crypto.createHmac("sha256", secret).update(message).digest("hex");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// src/services/exchanges.ts
|
|
12
|
+
var ExchangesService = class {
|
|
13
|
+
constructor(client) {
|
|
14
|
+
this.client = client;
|
|
15
|
+
}
|
|
16
|
+
client;
|
|
17
|
+
/**
|
|
18
|
+
* Get all exchanges with optional filtering
|
|
19
|
+
*/
|
|
20
|
+
async list(queryParams) {
|
|
21
|
+
return this.client.request({
|
|
22
|
+
method: "GET",
|
|
23
|
+
path: `/api/v2/exchange`,
|
|
24
|
+
queryParams
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get all CEX exchanges
|
|
29
|
+
*/
|
|
30
|
+
async listCex() {
|
|
31
|
+
return this.client.request({
|
|
32
|
+
method: "GET",
|
|
33
|
+
path: `/api/v2/exchange/cex`
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get all DEX exchanges by chain ID
|
|
38
|
+
*/
|
|
39
|
+
async getDex(chain) {
|
|
40
|
+
return this.client.request({
|
|
41
|
+
method: "GET",
|
|
42
|
+
path: `/api/v2/exchange/dex/${chain}`
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get all Prediction exchanges
|
|
47
|
+
*/
|
|
48
|
+
async listPrediction() {
|
|
49
|
+
return this.client.request({
|
|
50
|
+
method: "GET",
|
|
51
|
+
path: `/api/v2/exchange/prediction`
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get all exchanges with exchange rates
|
|
56
|
+
*/
|
|
57
|
+
async listWithExchangeRate() {
|
|
58
|
+
return this.client.request({
|
|
59
|
+
method: "GET",
|
|
60
|
+
path: `/api/v2/exchange/with-exchange-rate`
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/services/llmSessions.ts
|
|
66
|
+
var LlmSessionsService = class {
|
|
67
|
+
constructor(client) {
|
|
68
|
+
this.client = client;
|
|
69
|
+
}
|
|
70
|
+
client;
|
|
71
|
+
/**
|
|
72
|
+
* Get all LLM sessions
|
|
73
|
+
*/
|
|
74
|
+
async list() {
|
|
75
|
+
return this.client.request({
|
|
76
|
+
method: "GET",
|
|
77
|
+
path: `/api/v2/strategy/llm-session`
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create a new LLM session
|
|
82
|
+
*/
|
|
83
|
+
async create(body) {
|
|
84
|
+
return this.client.request({
|
|
85
|
+
method: "POST",
|
|
86
|
+
path: `/api/v2/strategy/llm-session`,
|
|
87
|
+
body
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get the total number of LLM sessions
|
|
92
|
+
*/
|
|
93
|
+
async getTotal() {
|
|
94
|
+
return this.client.request({
|
|
95
|
+
method: "GET",
|
|
96
|
+
path: `/api/v2/strategy/llm-session/total`
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get LLM session by ID
|
|
101
|
+
*/
|
|
102
|
+
async get(id) {
|
|
103
|
+
return this.client.request({
|
|
104
|
+
method: "GET",
|
|
105
|
+
path: `/api/v2/strategy/llm-session/${id}`
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Update LLM session
|
|
110
|
+
*/
|
|
111
|
+
async update(id, body) {
|
|
112
|
+
return this.client.request({
|
|
113
|
+
method: "PUT",
|
|
114
|
+
path: `/api/v2/strategy/llm-session/${id}`,
|
|
115
|
+
body
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Delete LLM session
|
|
120
|
+
*/
|
|
121
|
+
async delete(id) {
|
|
122
|
+
return this.client.request({
|
|
123
|
+
method: "DELETE",
|
|
124
|
+
path: `/api/v2/strategy/llm-session/${id}`
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Duplicate an LLM session
|
|
129
|
+
*/
|
|
130
|
+
async duplicate(body) {
|
|
131
|
+
return this.client.request({
|
|
132
|
+
method: "POST",
|
|
133
|
+
path: `/api/v2/strategy/llm-session/duplicate`,
|
|
134
|
+
body
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Reset LLM session triggers, history or responses
|
|
139
|
+
*/
|
|
140
|
+
async reset(id, body) {
|
|
141
|
+
return this.client.request({
|
|
142
|
+
method: "PUT",
|
|
143
|
+
path: `/api/v2/strategy/llm-session/${id}/reset`,
|
|
144
|
+
body
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Update LLM session status
|
|
149
|
+
*/
|
|
150
|
+
async status(id, body) {
|
|
151
|
+
return this.client.request({
|
|
152
|
+
method: "PUT",
|
|
153
|
+
path: `/api/v2/strategy/llm-session/${id}/status`,
|
|
154
|
+
body
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Update LLM session public visibility
|
|
159
|
+
*/
|
|
160
|
+
async public(id, body) {
|
|
161
|
+
return this.client.request({
|
|
162
|
+
method: "PUT",
|
|
163
|
+
path: `/api/v2/strategy/llm-session/${id}/public`,
|
|
164
|
+
body
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get all LLM session folders
|
|
169
|
+
*/
|
|
170
|
+
async listFolder() {
|
|
171
|
+
return this.client.request({
|
|
172
|
+
method: "GET",
|
|
173
|
+
path: `/api/v2/strategy/llm-session/folder`
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Create a new LLM session folder
|
|
178
|
+
*/
|
|
179
|
+
async postFolder(body) {
|
|
180
|
+
return this.client.request({
|
|
181
|
+
method: "POST",
|
|
182
|
+
path: `/api/v2/strategy/llm-session/folder`,
|
|
183
|
+
body
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Get LLM Sessions from root folder
|
|
188
|
+
*/
|
|
189
|
+
async listFolderRoot() {
|
|
190
|
+
return this.client.request({
|
|
191
|
+
method: "GET",
|
|
192
|
+
path: `/api/v2/strategy/llm-session/folder/root`
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Get LLM session folder by ID
|
|
197
|
+
*/
|
|
198
|
+
async getFolder(id) {
|
|
199
|
+
return this.client.request({
|
|
200
|
+
method: "GET",
|
|
201
|
+
path: `/api/v2/strategy/llm-session/folder/${id}`
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Update LLM session folder
|
|
206
|
+
*/
|
|
207
|
+
async updateFolder(id, body) {
|
|
208
|
+
return this.client.request({
|
|
209
|
+
method: "PUT",
|
|
210
|
+
path: `/api/v2/strategy/llm-session/folder/${id}`,
|
|
211
|
+
body
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Delete LLM session folder
|
|
216
|
+
*/
|
|
217
|
+
async deleteFolder(id) {
|
|
218
|
+
return this.client.request({
|
|
219
|
+
method: "DELETE",
|
|
220
|
+
path: `/api/v2/strategy/llm-session/folder/${id}`
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// src/services/llmReactions.ts
|
|
226
|
+
var LlmReactionsService = class {
|
|
227
|
+
constructor(client) {
|
|
228
|
+
this.client = client;
|
|
229
|
+
}
|
|
230
|
+
client;
|
|
231
|
+
/**
|
|
232
|
+
* Get all LLM reactions
|
|
233
|
+
*/
|
|
234
|
+
async list() {
|
|
235
|
+
return this.client.request({
|
|
236
|
+
method: "GET",
|
|
237
|
+
path: `/api/v2/strategy/reaction/llm`
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Create a new LLM reaction
|
|
242
|
+
*/
|
|
243
|
+
async create(body) {
|
|
244
|
+
return this.client.request({
|
|
245
|
+
method: "POST",
|
|
246
|
+
path: `/api/v2/strategy/reaction/llm`,
|
|
247
|
+
body
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Get LLM reaction by ID
|
|
252
|
+
*/
|
|
253
|
+
async get(id) {
|
|
254
|
+
return this.client.request({
|
|
255
|
+
method: "GET",
|
|
256
|
+
path: `/api/v2/strategy/reaction/llm/${id}`
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Update LLM reaction
|
|
261
|
+
*/
|
|
262
|
+
async update(id, body) {
|
|
263
|
+
return this.client.request({
|
|
264
|
+
method: "PUT",
|
|
265
|
+
path: `/api/v2/strategy/reaction/llm/${id}`,
|
|
266
|
+
body
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Delete LLM reaction
|
|
271
|
+
*/
|
|
272
|
+
async delete(id) {
|
|
273
|
+
return this.client.request({
|
|
274
|
+
method: "DELETE",
|
|
275
|
+
path: `/api/v2/strategy/reaction/llm/${id}`
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Get the total number of LLM Reaction
|
|
280
|
+
*/
|
|
281
|
+
async getTotal() {
|
|
282
|
+
return this.client.request({
|
|
283
|
+
method: "GET",
|
|
284
|
+
path: `/api/v2/strategy/reaction/llm/total`
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Duplicate an LLM reaction
|
|
289
|
+
*/
|
|
290
|
+
async duplicate(body) {
|
|
291
|
+
return this.client.request({
|
|
292
|
+
method: "POST",
|
|
293
|
+
path: `/api/v2/strategy/reaction/llm/duplicate`,
|
|
294
|
+
body
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Reset LLM reaction triggers, history or responses
|
|
299
|
+
*/
|
|
300
|
+
async reset(id, body) {
|
|
301
|
+
return this.client.request({
|
|
302
|
+
method: "PUT",
|
|
303
|
+
path: `/api/v2/strategy/reaction/llm/${id}/reset`,
|
|
304
|
+
body
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Update LLM reaction status
|
|
309
|
+
*/
|
|
310
|
+
async status(id, body) {
|
|
311
|
+
return this.client.request({
|
|
312
|
+
method: "PUT",
|
|
313
|
+
path: `/api/v2/strategy/reaction/llm/${id}/status`,
|
|
314
|
+
body
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Update LLM reaction public visibility
|
|
319
|
+
*/
|
|
320
|
+
async public(id, body) {
|
|
321
|
+
return this.client.request({
|
|
322
|
+
method: "PUT",
|
|
323
|
+
path: `/api/v2/strategy/reaction/llm/${id}/public`,
|
|
324
|
+
body
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Get all LLM reaction folders
|
|
329
|
+
*/
|
|
330
|
+
async listFolder() {
|
|
331
|
+
return this.client.request({
|
|
332
|
+
method: "GET",
|
|
333
|
+
path: `/api/v2/strategy/reaction/llm/folder`
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Create a new LLM reaction folder
|
|
338
|
+
*/
|
|
339
|
+
async postFolder(body) {
|
|
340
|
+
return this.client.request({
|
|
341
|
+
method: "POST",
|
|
342
|
+
path: `/api/v2/strategy/reaction/llm/folder`,
|
|
343
|
+
body
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Get LLM reactions from root folder
|
|
348
|
+
*/
|
|
349
|
+
async listFolderRoot() {
|
|
350
|
+
return this.client.request({
|
|
351
|
+
method: "GET",
|
|
352
|
+
path: `/api/v2/strategy/reaction/llm/folder/root`
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Get LLM reaction folder by ID
|
|
357
|
+
*/
|
|
358
|
+
async getFolder(id) {
|
|
359
|
+
return this.client.request({
|
|
360
|
+
method: "GET",
|
|
361
|
+
path: `/api/v2/strategy/reaction/llm/folder/${id}`
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Update LLM reaction folder
|
|
366
|
+
*/
|
|
367
|
+
async updateFolder(id, body) {
|
|
368
|
+
return this.client.request({
|
|
369
|
+
method: "PUT",
|
|
370
|
+
path: `/api/v2/strategy/reaction/llm/folder/${id}`,
|
|
371
|
+
body
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Delete LLM reaction folder
|
|
376
|
+
*/
|
|
377
|
+
async deleteFolder(id) {
|
|
378
|
+
return this.client.request({
|
|
379
|
+
method: "DELETE",
|
|
380
|
+
path: `/api/v2/strategy/reaction/llm/folder/${id}`
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// src/services/codeReactions.ts
|
|
386
|
+
var CodeReactionsService = class {
|
|
387
|
+
constructor(client) {
|
|
388
|
+
this.client = client;
|
|
389
|
+
}
|
|
390
|
+
client;
|
|
391
|
+
/**
|
|
392
|
+
* Get all code reactions
|
|
393
|
+
*/
|
|
394
|
+
async list() {
|
|
395
|
+
return this.client.request({
|
|
396
|
+
method: "GET",
|
|
397
|
+
path: `/api/v2/strategy/reaction/code`
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Create a new code reaction
|
|
402
|
+
*/
|
|
403
|
+
async create(body) {
|
|
404
|
+
return this.client.request({
|
|
405
|
+
method: "POST",
|
|
406
|
+
path: `/api/v2/strategy/reaction/code`,
|
|
407
|
+
body
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Get the total number of Code Reactions
|
|
412
|
+
*/
|
|
413
|
+
async getTotal() {
|
|
414
|
+
return this.client.request({
|
|
415
|
+
method: "GET",
|
|
416
|
+
path: `/api/v2/strategy/reaction/code/total`
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Get code reaction by ID
|
|
421
|
+
*/
|
|
422
|
+
async get(id) {
|
|
423
|
+
return this.client.request({
|
|
424
|
+
method: "GET",
|
|
425
|
+
path: `/api/v2/strategy/reaction/code/${id}`
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Update code reaction
|
|
430
|
+
*/
|
|
431
|
+
async update(id, body) {
|
|
432
|
+
return this.client.request({
|
|
433
|
+
method: "PUT",
|
|
434
|
+
path: `/api/v2/strategy/reaction/code/${id}`,
|
|
435
|
+
body
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Delete code reaction
|
|
440
|
+
*/
|
|
441
|
+
async delete(id) {
|
|
442
|
+
return this.client.request({
|
|
443
|
+
method: "DELETE",
|
|
444
|
+
path: `/api/v2/strategy/reaction/code/${id}`
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Duplicate a code reaction
|
|
449
|
+
*/
|
|
450
|
+
async duplicate(body) {
|
|
451
|
+
return this.client.request({
|
|
452
|
+
method: "POST",
|
|
453
|
+
path: `/api/v2/strategy/reaction/code/duplicate`,
|
|
454
|
+
body
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Reset code reaction triggers and/or storage
|
|
459
|
+
*/
|
|
460
|
+
async reset(id, body) {
|
|
461
|
+
return this.client.request({
|
|
462
|
+
method: "PUT",
|
|
463
|
+
path: `/api/v2/strategy/reaction/code/${id}/reset`,
|
|
464
|
+
body
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Update code reaction status
|
|
469
|
+
*/
|
|
470
|
+
async status(id, body) {
|
|
471
|
+
return this.client.request({
|
|
472
|
+
method: "PUT",
|
|
473
|
+
path: `/api/v2/strategy/reaction/code/${id}/status`,
|
|
474
|
+
body
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Update code reaction public visibility
|
|
479
|
+
*/
|
|
480
|
+
async public(id, body) {
|
|
481
|
+
return this.client.request({
|
|
482
|
+
method: "PUT",
|
|
483
|
+
path: `/api/v2/strategy/reaction/code/${id}/public`,
|
|
484
|
+
body
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Delete code reaction storage
|
|
489
|
+
*/
|
|
490
|
+
async store(id) {
|
|
491
|
+
return this.client.request({
|
|
492
|
+
method: "DELETE",
|
|
493
|
+
path: `/api/v2/strategy/reaction/code/${id}/store`
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Get all code reaction folders
|
|
498
|
+
*/
|
|
499
|
+
async listFolder() {
|
|
500
|
+
return this.client.request({
|
|
501
|
+
method: "GET",
|
|
502
|
+
path: `/api/v2/strategy/reaction/code/folder`
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Create a new code reaction folder
|
|
507
|
+
*/
|
|
508
|
+
async postFolder(body) {
|
|
509
|
+
return this.client.request({
|
|
510
|
+
method: "POST",
|
|
511
|
+
path: `/api/v2/strategy/reaction/code/folder`,
|
|
512
|
+
body
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Get code reactions from root folder
|
|
517
|
+
*/
|
|
518
|
+
async listFolderRoot() {
|
|
519
|
+
return this.client.request({
|
|
520
|
+
method: "GET",
|
|
521
|
+
path: `/api/v2/strategy/reaction/code/folder/root`
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Get code reaction folder by ID
|
|
526
|
+
*/
|
|
527
|
+
async getFolder(id) {
|
|
528
|
+
return this.client.request({
|
|
529
|
+
method: "GET",
|
|
530
|
+
path: `/api/v2/strategy/reaction/code/folder/${id}`
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Update code reaction folder
|
|
535
|
+
*/
|
|
536
|
+
async updateFolder(id, body) {
|
|
537
|
+
return this.client.request({
|
|
538
|
+
method: "PUT",
|
|
539
|
+
path: `/api/v2/strategy/reaction/code/folder/${id}`,
|
|
540
|
+
body
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Delete code reaction folder
|
|
545
|
+
*/
|
|
546
|
+
async deleteFolder(id) {
|
|
547
|
+
return this.client.request({
|
|
548
|
+
method: "DELETE",
|
|
549
|
+
path: `/api/v2/strategy/reaction/code/folder/${id}`
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
// src/services/codeStrategies.ts
|
|
555
|
+
var CodeStrategiesService = class {
|
|
556
|
+
constructor(client) {
|
|
557
|
+
this.client = client;
|
|
558
|
+
}
|
|
559
|
+
client;
|
|
560
|
+
/**
|
|
561
|
+
* Get all code strategies
|
|
562
|
+
*/
|
|
563
|
+
async list() {
|
|
564
|
+
return this.client.request({
|
|
565
|
+
method: "GET",
|
|
566
|
+
path: `/api/v2/strategy/code`
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Create a new code strategy
|
|
571
|
+
*/
|
|
572
|
+
async create(body) {
|
|
573
|
+
return this.client.request({
|
|
574
|
+
method: "POST",
|
|
575
|
+
path: `/api/v2/strategy/code`,
|
|
576
|
+
body
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Get the total number of Code Strategies
|
|
581
|
+
*/
|
|
582
|
+
async getTotal() {
|
|
583
|
+
return this.client.request({
|
|
584
|
+
method: "GET",
|
|
585
|
+
path: `/api/v2/strategy/code/total`
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Get code strategy by ID
|
|
590
|
+
*/
|
|
591
|
+
async get(id) {
|
|
592
|
+
return this.client.request({
|
|
593
|
+
method: "GET",
|
|
594
|
+
path: `/api/v2/strategy/code/${id}`
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Update code strategy
|
|
599
|
+
*/
|
|
600
|
+
async update(id, body) {
|
|
601
|
+
return this.client.request({
|
|
602
|
+
method: "PUT",
|
|
603
|
+
path: `/api/v2/strategy/code/${id}`,
|
|
604
|
+
body
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Delete code strategy
|
|
609
|
+
*/
|
|
610
|
+
async delete(id) {
|
|
611
|
+
return this.client.request({
|
|
612
|
+
method: "DELETE",
|
|
613
|
+
path: `/api/v2/strategy/code/${id}`
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Duplicate a code strategy
|
|
618
|
+
*/
|
|
619
|
+
async duplicate(body) {
|
|
620
|
+
return this.client.request({
|
|
621
|
+
method: "POST",
|
|
622
|
+
path: `/api/v2/strategy/code/duplicate`,
|
|
623
|
+
body
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Reset code strategy triggers and/or storage
|
|
628
|
+
*/
|
|
629
|
+
async reset(id, body) {
|
|
630
|
+
return this.client.request({
|
|
631
|
+
method: "PUT",
|
|
632
|
+
path: `/api/v2/strategy/code/${id}/reset`,
|
|
633
|
+
body
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Update code strategy status
|
|
638
|
+
*/
|
|
639
|
+
async status(id, body) {
|
|
640
|
+
return this.client.request({
|
|
641
|
+
method: "PUT",
|
|
642
|
+
path: `/api/v2/strategy/code/${id}/status`,
|
|
643
|
+
body
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Update code strategy public visibility
|
|
648
|
+
*/
|
|
649
|
+
async public(id, body) {
|
|
650
|
+
return this.client.request({
|
|
651
|
+
method: "PUT",
|
|
652
|
+
path: `/api/v2/strategy/code/${id}/public`,
|
|
653
|
+
body
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Delete code strategy storage
|
|
658
|
+
*/
|
|
659
|
+
async store(id) {
|
|
660
|
+
return this.client.request({
|
|
661
|
+
method: "DELETE",
|
|
662
|
+
path: `/api/v2/strategy/code/${id}/store`
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Get all code strategy folders
|
|
667
|
+
*/
|
|
668
|
+
async listFolder() {
|
|
669
|
+
return this.client.request({
|
|
670
|
+
method: "GET",
|
|
671
|
+
path: `/api/v2/strategy/code/folder`
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Create a new code strategy folder
|
|
676
|
+
*/
|
|
677
|
+
async postFolder(body) {
|
|
678
|
+
return this.client.request({
|
|
679
|
+
method: "POST",
|
|
680
|
+
path: `/api/v2/strategy/code/folder`,
|
|
681
|
+
body
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Get code strategies from root folder
|
|
686
|
+
*/
|
|
687
|
+
async listFolderRoot() {
|
|
688
|
+
return this.client.request({
|
|
689
|
+
method: "GET",
|
|
690
|
+
path: `/api/v2/strategy/code/folder/root`
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Get code strategy folder by ID
|
|
695
|
+
*/
|
|
696
|
+
async getFolder(id) {
|
|
697
|
+
return this.client.request({
|
|
698
|
+
method: "GET",
|
|
699
|
+
path: `/api/v2/strategy/code/folder/${id}`
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Update code strategy folder
|
|
704
|
+
*/
|
|
705
|
+
async updateFolder(id, body) {
|
|
706
|
+
return this.client.request({
|
|
707
|
+
method: "PUT",
|
|
708
|
+
path: `/api/v2/strategy/code/folder/${id}`,
|
|
709
|
+
body
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Delete code strategy folder
|
|
714
|
+
*/
|
|
715
|
+
async deleteFolder(id) {
|
|
716
|
+
return this.client.request({
|
|
717
|
+
method: "DELETE",
|
|
718
|
+
path: `/api/v2/strategy/code/folder/${id}`
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
// src/services/cexBots.ts
|
|
724
|
+
var CexBotsService = class {
|
|
725
|
+
constructor(client) {
|
|
726
|
+
this.client = client;
|
|
727
|
+
}
|
|
728
|
+
client;
|
|
729
|
+
/**
|
|
730
|
+
* Get all CEX signal bots
|
|
731
|
+
*/
|
|
732
|
+
async list() {
|
|
733
|
+
return this.client.request({
|
|
734
|
+
method: "GET",
|
|
735
|
+
path: `/api/v2/bot/signal/cex`
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Create a new CEX signal bot
|
|
740
|
+
*/
|
|
741
|
+
async create(body) {
|
|
742
|
+
return this.client.request({
|
|
743
|
+
method: "POST",
|
|
744
|
+
path: `/api/v2/bot/signal/cex`,
|
|
745
|
+
body
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Get the total number of CEX signal bots
|
|
750
|
+
*/
|
|
751
|
+
async getTotal() {
|
|
752
|
+
return this.client.request({
|
|
753
|
+
method: "GET",
|
|
754
|
+
path: `/api/v2/bot/signal/cex/total`
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Get CEX signal bot by ID
|
|
759
|
+
*/
|
|
760
|
+
async get(id) {
|
|
761
|
+
return this.client.request({
|
|
762
|
+
method: "GET",
|
|
763
|
+
path: `/api/v2/bot/signal/cex/${id}`
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Update CEX signal bot
|
|
768
|
+
*/
|
|
769
|
+
async update(id, body) {
|
|
770
|
+
return this.client.request({
|
|
771
|
+
method: "PUT",
|
|
772
|
+
path: `/api/v2/bot/signal/cex/${id}`,
|
|
773
|
+
body
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Delete CEX signal bot
|
|
778
|
+
*/
|
|
779
|
+
async delete(id) {
|
|
780
|
+
return this.client.request({
|
|
781
|
+
method: "DELETE",
|
|
782
|
+
path: `/api/v2/bot/signal/cex/${id}`
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Update CEX signal bot status
|
|
787
|
+
*/
|
|
788
|
+
async status(id, body) {
|
|
789
|
+
return this.client.request({
|
|
790
|
+
method: "PUT",
|
|
791
|
+
path: `/api/v2/bot/signal/cex/${id}/status`,
|
|
792
|
+
body
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Duplicate a CEX signal bot
|
|
797
|
+
*/
|
|
798
|
+
async duplicate(body) {
|
|
799
|
+
return this.client.request({
|
|
800
|
+
method: "POST",
|
|
801
|
+
path: `/api/v2/bot/signal/cex/duplicate`,
|
|
802
|
+
body
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Get all CEX signal bot folders
|
|
807
|
+
*/
|
|
808
|
+
async listFolder() {
|
|
809
|
+
return this.client.request({
|
|
810
|
+
method: "GET",
|
|
811
|
+
path: `/api/v2/bot/signal/cex/folder`
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Create a new CEX signal bot folder
|
|
816
|
+
*/
|
|
817
|
+
async postFolder(body) {
|
|
818
|
+
return this.client.request({
|
|
819
|
+
method: "POST",
|
|
820
|
+
path: `/api/v2/bot/signal/cex/folder`,
|
|
821
|
+
body
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Get CEX signal bots from root folder
|
|
826
|
+
*/
|
|
827
|
+
async listFolderRoot() {
|
|
828
|
+
return this.client.request({
|
|
829
|
+
method: "GET",
|
|
830
|
+
path: `/api/v2/bot/signal/cex/folder/root`
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Get CEX signal bot folder by ID
|
|
835
|
+
*/
|
|
836
|
+
async getFolder(id) {
|
|
837
|
+
return this.client.request({
|
|
838
|
+
method: "GET",
|
|
839
|
+
path: `/api/v2/bot/signal/cex/folder/${id}`
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Update CEX signal bot folder
|
|
844
|
+
*/
|
|
845
|
+
async updateFolder(id, body) {
|
|
846
|
+
return this.client.request({
|
|
847
|
+
method: "PUT",
|
|
848
|
+
path: `/api/v2/bot/signal/cex/folder/${id}`,
|
|
849
|
+
body
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Delete CEX signal bot folder
|
|
854
|
+
*/
|
|
855
|
+
async deleteFolder(id) {
|
|
856
|
+
return this.client.request({
|
|
857
|
+
method: "DELETE",
|
|
858
|
+
path: `/api/v2/bot/signal/cex/folder/${id}`
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
// src/services/predictionBots.ts
|
|
864
|
+
var PredictionBotsService = class {
|
|
865
|
+
constructor(client) {
|
|
866
|
+
this.client = client;
|
|
867
|
+
}
|
|
868
|
+
client;
|
|
869
|
+
/**
|
|
870
|
+
* Get prediction market by slug
|
|
871
|
+
*/
|
|
872
|
+
async getMarket(slug) {
|
|
873
|
+
return this.client.request({
|
|
874
|
+
method: "GET",
|
|
875
|
+
path: `/api/v2/bot/signal/prediction/market/${slug}`
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Get all prediction signal bots
|
|
880
|
+
*/
|
|
881
|
+
async list() {
|
|
882
|
+
return this.client.request({
|
|
883
|
+
method: "GET",
|
|
884
|
+
path: `/api/v2/bot/signal/prediction`
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Create a new prediction signal bot
|
|
889
|
+
*/
|
|
890
|
+
async create(body) {
|
|
891
|
+
return this.client.request({
|
|
892
|
+
method: "POST",
|
|
893
|
+
path: `/api/v2/bot/signal/prediction`,
|
|
894
|
+
body
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Get the total number of Prediction signal bots
|
|
899
|
+
*/
|
|
900
|
+
async getTotal() {
|
|
901
|
+
return this.client.request({
|
|
902
|
+
method: "GET",
|
|
903
|
+
path: `/api/v2/bot/signal/prediction/total`
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* Get prediction signal bot by ID
|
|
908
|
+
*/
|
|
909
|
+
async get(id) {
|
|
910
|
+
return this.client.request({
|
|
911
|
+
method: "GET",
|
|
912
|
+
path: `/api/v2/bot/signal/prediction/${id}`
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Update prediction signal bot
|
|
917
|
+
*/
|
|
918
|
+
async update(id, body) {
|
|
919
|
+
return this.client.request({
|
|
920
|
+
method: "PUT",
|
|
921
|
+
path: `/api/v2/bot/signal/prediction/${id}`,
|
|
922
|
+
body
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Delete prediction signal bot
|
|
927
|
+
*/
|
|
928
|
+
async delete(id) {
|
|
929
|
+
return this.client.request({
|
|
930
|
+
method: "DELETE",
|
|
931
|
+
path: `/api/v2/bot/signal/prediction/${id}`
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Update prediction signal bot status
|
|
936
|
+
*/
|
|
937
|
+
async status(id, body) {
|
|
938
|
+
return this.client.request({
|
|
939
|
+
method: "PUT",
|
|
940
|
+
path: `/api/v2/bot/signal/prediction/${id}/status`,
|
|
941
|
+
body
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Duplicate a prediction signal bot
|
|
946
|
+
*/
|
|
947
|
+
async duplicate(body) {
|
|
948
|
+
return this.client.request({
|
|
949
|
+
method: "POST",
|
|
950
|
+
path: `/api/v2/bot/signal/prediction/duplicate`,
|
|
951
|
+
body
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* Get all prediction signal bot folders
|
|
956
|
+
*/
|
|
957
|
+
async listFolder() {
|
|
958
|
+
return this.client.request({
|
|
959
|
+
method: "GET",
|
|
960
|
+
path: `/api/v2/bot/signal/prediction/folder`
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Create a new prediction signal bot folder
|
|
965
|
+
*/
|
|
966
|
+
async postFolder(body) {
|
|
967
|
+
return this.client.request({
|
|
968
|
+
method: "POST",
|
|
969
|
+
path: `/api/v2/bot/signal/prediction/folder`,
|
|
970
|
+
body
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Get prediction signal bots from root folder
|
|
975
|
+
*/
|
|
976
|
+
async listFolderRoot() {
|
|
977
|
+
return this.client.request({
|
|
978
|
+
method: "GET",
|
|
979
|
+
path: `/api/v2/bot/signal/prediction/folder/root`
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Get prediction signal bot folder by ID
|
|
984
|
+
*/
|
|
985
|
+
async getFolder(id) {
|
|
986
|
+
return this.client.request({
|
|
987
|
+
method: "GET",
|
|
988
|
+
path: `/api/v2/bot/signal/prediction/folder/${id}`
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Update prediction signal bot folder
|
|
993
|
+
*/
|
|
994
|
+
async updateFolder(id, body) {
|
|
995
|
+
return this.client.request({
|
|
996
|
+
method: "PUT",
|
|
997
|
+
path: `/api/v2/bot/signal/prediction/folder/${id}`,
|
|
998
|
+
body
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Delete prediction signal bot folder
|
|
1003
|
+
*/
|
|
1004
|
+
async deleteFolder(id) {
|
|
1005
|
+
return this.client.request({
|
|
1006
|
+
method: "DELETE",
|
|
1007
|
+
path: `/api/v2/bot/signal/prediction/folder/${id}`
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1012
|
+
// src/services/dexBots.ts
|
|
1013
|
+
var DexBotsService = class {
|
|
1014
|
+
constructor(client) {
|
|
1015
|
+
this.client = client;
|
|
1016
|
+
}
|
|
1017
|
+
client;
|
|
1018
|
+
/**
|
|
1019
|
+
* Get all DEX signal bots
|
|
1020
|
+
*/
|
|
1021
|
+
async list() {
|
|
1022
|
+
return this.client.request({
|
|
1023
|
+
method: "GET",
|
|
1024
|
+
path: `/api/v2/bot/signal/dex`
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Create a new DEX signal bot
|
|
1029
|
+
*/
|
|
1030
|
+
async create(body) {
|
|
1031
|
+
return this.client.request({
|
|
1032
|
+
method: "POST",
|
|
1033
|
+
path: `/api/v2/bot/signal/dex`,
|
|
1034
|
+
body
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Get the total number of DEX signal bots
|
|
1039
|
+
*/
|
|
1040
|
+
async getTotal() {
|
|
1041
|
+
return this.client.request({
|
|
1042
|
+
method: "GET",
|
|
1043
|
+
path: `/api/v2/bot/signal/dex/total`
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Get DEX signal bot by ID
|
|
1048
|
+
*/
|
|
1049
|
+
async get(id) {
|
|
1050
|
+
return this.client.request({
|
|
1051
|
+
method: "GET",
|
|
1052
|
+
path: `/api/v2/bot/signal/dex/${id}`
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Update DEX signal bot
|
|
1057
|
+
*/
|
|
1058
|
+
async update(id, body) {
|
|
1059
|
+
return this.client.request({
|
|
1060
|
+
method: "PUT",
|
|
1061
|
+
path: `/api/v2/bot/signal/dex/${id}`,
|
|
1062
|
+
body
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Delete DEX signal bot
|
|
1067
|
+
*/
|
|
1068
|
+
async delete(id) {
|
|
1069
|
+
return this.client.request({
|
|
1070
|
+
method: "DELETE",
|
|
1071
|
+
path: `/api/v2/bot/signal/dex/${id}`
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Get DEX signal bot by chain and address
|
|
1076
|
+
*/
|
|
1077
|
+
async getByChainAndAddress(chainId, address) {
|
|
1078
|
+
return this.client.request({
|
|
1079
|
+
method: "GET",
|
|
1080
|
+
path: `/api/v2/bot/signal/dex/${chainId}/${address}`
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Get bot factory by chain and exchange
|
|
1085
|
+
*/
|
|
1086
|
+
async getFactory(chainId, exchangeId) {
|
|
1087
|
+
return this.client.request({
|
|
1088
|
+
method: "GET",
|
|
1089
|
+
path: `/api/v2/bot/signal/dex/factory/${chainId}/${exchangeId}`
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Update DEX signal bot status
|
|
1094
|
+
*/
|
|
1095
|
+
async status(id, body) {
|
|
1096
|
+
return this.client.request({
|
|
1097
|
+
method: "PUT",
|
|
1098
|
+
path: `/api/v2/bot/signal/dex/${id}/status`,
|
|
1099
|
+
body
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Get all DEX signal bot folders
|
|
1104
|
+
*/
|
|
1105
|
+
async listFolder() {
|
|
1106
|
+
return this.client.request({
|
|
1107
|
+
method: "GET",
|
|
1108
|
+
path: `/api/v2/bot/signal/dex/folder`
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Create a new DEX signal bot folder
|
|
1113
|
+
*/
|
|
1114
|
+
async postFolder(body) {
|
|
1115
|
+
return this.client.request({
|
|
1116
|
+
method: "POST",
|
|
1117
|
+
path: `/api/v2/bot/signal/dex/folder`,
|
|
1118
|
+
body
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Get DEX signal bots from root folder
|
|
1123
|
+
*/
|
|
1124
|
+
async listFolderRoot() {
|
|
1125
|
+
return this.client.request({
|
|
1126
|
+
method: "GET",
|
|
1127
|
+
path: `/api/v2/bot/signal/dex/folder/root`
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Get DEX signal bot folder by ID
|
|
1132
|
+
*/
|
|
1133
|
+
async getFolder(id) {
|
|
1134
|
+
return this.client.request({
|
|
1135
|
+
method: "GET",
|
|
1136
|
+
path: `/api/v2/bot/signal/dex/folder/${id}`
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Update DEX signal bot folder
|
|
1141
|
+
*/
|
|
1142
|
+
async updateFolder(id, body) {
|
|
1143
|
+
return this.client.request({
|
|
1144
|
+
method: "PUT",
|
|
1145
|
+
path: `/api/v2/bot/signal/dex/folder/${id}`,
|
|
1146
|
+
body
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Delete DEX signal bot folder
|
|
1151
|
+
*/
|
|
1152
|
+
async deleteFolder(id) {
|
|
1153
|
+
return this.client.request({
|
|
1154
|
+
method: "DELETE",
|
|
1155
|
+
path: `/api/v2/bot/signal/dex/folder/${id}`
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1160
|
+
// src/services/botWebhooks.ts
|
|
1161
|
+
var BotWebhooksService = class {
|
|
1162
|
+
constructor(client) {
|
|
1163
|
+
this.client = client;
|
|
1164
|
+
}
|
|
1165
|
+
client;
|
|
1166
|
+
/**
|
|
1167
|
+
* Get all bot webhooks
|
|
1168
|
+
*/
|
|
1169
|
+
async list() {
|
|
1170
|
+
return this.client.request({
|
|
1171
|
+
method: "GET",
|
|
1172
|
+
path: `/api/v2/webhook/bot`
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Create a new bot webhook
|
|
1177
|
+
*/
|
|
1178
|
+
async create(body) {
|
|
1179
|
+
return this.client.request({
|
|
1180
|
+
method: "POST",
|
|
1181
|
+
path: `/api/v2/webhook/bot`,
|
|
1182
|
+
body
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Get bot webhook by ID
|
|
1187
|
+
*/
|
|
1188
|
+
async get(id) {
|
|
1189
|
+
return this.client.request({
|
|
1190
|
+
method: "GET",
|
|
1191
|
+
path: `/api/v2/webhook/bot/${id}`
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Update bot webhook
|
|
1196
|
+
*/
|
|
1197
|
+
async update(id, body) {
|
|
1198
|
+
return this.client.request({
|
|
1199
|
+
method: "PUT",
|
|
1200
|
+
path: `/api/v2/webhook/bot/${id}`,
|
|
1201
|
+
body
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Delete bot webhook
|
|
1206
|
+
*/
|
|
1207
|
+
async delete(id) {
|
|
1208
|
+
return this.client.request({
|
|
1209
|
+
method: "DELETE",
|
|
1210
|
+
path: `/api/v2/webhook/bot/${id}`
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Get webhook shares
|
|
1215
|
+
*/
|
|
1216
|
+
async shares(id) {
|
|
1217
|
+
return this.client.request({
|
|
1218
|
+
method: "GET",
|
|
1219
|
+
path: `/api/v2/webhook/bot/${id}/shares`
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Share webhook with user
|
|
1224
|
+
*/
|
|
1225
|
+
async(id, body) {
|
|
1226
|
+
return this.client.request({
|
|
1227
|
+
method: "POST",
|
|
1228
|
+
path: `/api/v2/webhook/bot/share/${id}`,
|
|
1229
|
+
body
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Remove webhook share
|
|
1234
|
+
*/
|
|
1235
|
+
async deleteShare(id, body) {
|
|
1236
|
+
return this.client.request({
|
|
1237
|
+
method: "DELETE",
|
|
1238
|
+
path: `/api/v2/webhook/bot/share/${id}`,
|
|
1239
|
+
body
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Get CEX signal bots for webhook
|
|
1244
|
+
*/
|
|
1245
|
+
async listBotSignalCex(id, queryParams) {
|
|
1246
|
+
return this.client.request({
|
|
1247
|
+
method: "GET",
|
|
1248
|
+
path: `/api/v2/webhook/bot/bot/signal/${id}/cex`,
|
|
1249
|
+
queryParams
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Get DEX signal bots for webhook
|
|
1254
|
+
*/
|
|
1255
|
+
async listBotSignalDex(id, queryParams) {
|
|
1256
|
+
return this.client.request({
|
|
1257
|
+
method: "GET",
|
|
1258
|
+
path: `/api/v2/webhook/bot/bot/signal/${id}/dex`,
|
|
1259
|
+
queryParams
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Get prediction signal bots by webhook ID
|
|
1264
|
+
*/
|
|
1265
|
+
async listBotSignalPrediction(id, queryParams) {
|
|
1266
|
+
return this.client.request({
|
|
1267
|
+
method: "GET",
|
|
1268
|
+
path: `/api/v2/webhook/bot/bot/signal/${id}/prediction`,
|
|
1269
|
+
queryParams
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Update webhook status
|
|
1274
|
+
*/
|
|
1275
|
+
async status(id, body) {
|
|
1276
|
+
return this.client.request({
|
|
1277
|
+
method: "PUT",
|
|
1278
|
+
path: `/api/v2/webhook/bot/${id}/status`,
|
|
1279
|
+
body
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Get all shared webhooks for user
|
|
1284
|
+
*/
|
|
1285
|
+
async listShared() {
|
|
1286
|
+
return this.client.request({
|
|
1287
|
+
method: "GET",
|
|
1288
|
+
path: `/api/v2/webhook/bot/shared`
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Get webhooks shared with specific user
|
|
1293
|
+
*/
|
|
1294
|
+
async getWithShared(id) {
|
|
1295
|
+
return this.client.request({
|
|
1296
|
+
method: "GET",
|
|
1297
|
+
path: `/api/v2/webhook/bot/shared/with/${id}`
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Get webhooks shared by specific user
|
|
1302
|
+
*/
|
|
1303
|
+
async getByShared(id) {
|
|
1304
|
+
return this.client.request({
|
|
1305
|
+
method: "GET",
|
|
1306
|
+
path: `/api/v2/webhook/bot/shared/by/${id}`
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
};
|
|
1310
|
+
|
|
1311
|
+
// src/services/dataWebhooks.ts
|
|
1312
|
+
var DataWebhooksService = class {
|
|
1313
|
+
constructor(client) {
|
|
1314
|
+
this.client = client;
|
|
1315
|
+
}
|
|
1316
|
+
client;
|
|
1317
|
+
/**
|
|
1318
|
+
* Get all data webhooks
|
|
1319
|
+
*/
|
|
1320
|
+
async list() {
|
|
1321
|
+
return this.client.request({
|
|
1322
|
+
method: "GET",
|
|
1323
|
+
path: `/api/v2/webhook/data`
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Create a new data webhook
|
|
1328
|
+
*/
|
|
1329
|
+
async create(body) {
|
|
1330
|
+
return this.client.request({
|
|
1331
|
+
method: "POST",
|
|
1332
|
+
path: `/api/v2/webhook/data`,
|
|
1333
|
+
body
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Get data webhook by ID
|
|
1338
|
+
*/
|
|
1339
|
+
async get(id) {
|
|
1340
|
+
return this.client.request({
|
|
1341
|
+
method: "GET",
|
|
1342
|
+
path: `/api/v2/webhook/data/${id}`
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Update data webhook
|
|
1347
|
+
*/
|
|
1348
|
+
async update(id, body) {
|
|
1349
|
+
return this.client.request({
|
|
1350
|
+
method: "PUT",
|
|
1351
|
+
path: `/api/v2/webhook/data/${id}`,
|
|
1352
|
+
body
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Delete data webhook
|
|
1357
|
+
*/
|
|
1358
|
+
async delete(id) {
|
|
1359
|
+
return this.client.request({
|
|
1360
|
+
method: "DELETE",
|
|
1361
|
+
path: `/api/v2/webhook/data/${id}`
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Get webhook shares
|
|
1366
|
+
*/
|
|
1367
|
+
async shares(id) {
|
|
1368
|
+
return this.client.request({
|
|
1369
|
+
method: "GET",
|
|
1370
|
+
path: `/api/v2/webhook/data/${id}/shares`
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Get LLM reactions for webhook
|
|
1375
|
+
*/
|
|
1376
|
+
async llmReactions(id, queryParams) {
|
|
1377
|
+
return this.client.request({
|
|
1378
|
+
method: "GET",
|
|
1379
|
+
path: `/api/v2/webhook/data/${id}/llm-reactions`,
|
|
1380
|
+
queryParams
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Get code reactions for webhook
|
|
1385
|
+
*/
|
|
1386
|
+
async codeReactions(id, queryParams) {
|
|
1387
|
+
return this.client.request({
|
|
1388
|
+
method: "GET",
|
|
1389
|
+
path: `/api/v2/webhook/data/${id}/code-reactions`,
|
|
1390
|
+
queryParams
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Share webhook with user
|
|
1395
|
+
*/
|
|
1396
|
+
async(id, body) {
|
|
1397
|
+
return this.client.request({
|
|
1398
|
+
method: "POST",
|
|
1399
|
+
path: `/api/v2/webhook/data/share/${id}`,
|
|
1400
|
+
body
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Remove webhook share
|
|
1405
|
+
*/
|
|
1406
|
+
async deleteShare(id, body) {
|
|
1407
|
+
return this.client.request({
|
|
1408
|
+
method: "DELETE",
|
|
1409
|
+
path: `/api/v2/webhook/data/share/${id}`,
|
|
1410
|
+
body
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* Update webhook status
|
|
1415
|
+
*/
|
|
1416
|
+
async status(id, body) {
|
|
1417
|
+
return this.client.request({
|
|
1418
|
+
method: "PUT",
|
|
1419
|
+
path: `/api/v2/webhook/data/${id}/status`,
|
|
1420
|
+
body
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Get all shared data webhooks for user
|
|
1425
|
+
*/
|
|
1426
|
+
async listShared() {
|
|
1427
|
+
return this.client.request({
|
|
1428
|
+
method: "GET",
|
|
1429
|
+
path: `/api/v2/webhook/data/shared`
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Get data webhooks shared with specific user
|
|
1434
|
+
*/
|
|
1435
|
+
async getWithShared(id) {
|
|
1436
|
+
return this.client.request({
|
|
1437
|
+
method: "GET",
|
|
1438
|
+
path: `/api/v2/webhook/data/shared/with/${id}`
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Get data webhooks shared by specific user
|
|
1443
|
+
*/
|
|
1444
|
+
async getByShared(id) {
|
|
1445
|
+
return this.client.request({
|
|
1446
|
+
method: "GET",
|
|
1447
|
+
path: `/api/v2/webhook/data/shared/by/${id}`
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1452
|
+
// src/services/exchangeApiKeys.ts
|
|
1453
|
+
var ExchangeApiKeysService = class {
|
|
1454
|
+
constructor(client) {
|
|
1455
|
+
this.client = client;
|
|
1456
|
+
}
|
|
1457
|
+
client;
|
|
1458
|
+
/**
|
|
1459
|
+
* Get all exchange API keys for user
|
|
1460
|
+
*/
|
|
1461
|
+
async list() {
|
|
1462
|
+
return this.client.request({
|
|
1463
|
+
method: "GET",
|
|
1464
|
+
path: `/api/v2/api/exchange`
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Create a new exchange API key
|
|
1469
|
+
*/
|
|
1470
|
+
async create(body) {
|
|
1471
|
+
return this.client.request({
|
|
1472
|
+
method: "POST",
|
|
1473
|
+
path: `/api/v2/api/exchange`,
|
|
1474
|
+
body
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Get signal bots that use an API key
|
|
1479
|
+
*/
|
|
1480
|
+
async getSignalBot(id, queryParams) {
|
|
1481
|
+
return this.client.request({
|
|
1482
|
+
method: "GET",
|
|
1483
|
+
path: `/api/v2/api/exchange/bot/signal/${id}`,
|
|
1484
|
+
queryParams
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Update API key status
|
|
1489
|
+
*/
|
|
1490
|
+
async status(id, body) {
|
|
1491
|
+
return this.client.request({
|
|
1492
|
+
method: "PUT",
|
|
1493
|
+
path: `/api/v2/api/exchange/${id}/status`,
|
|
1494
|
+
body
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
/**
|
|
1498
|
+
* Delete an exchange API key
|
|
1499
|
+
*/
|
|
1500
|
+
async delete(id) {
|
|
1501
|
+
return this.client.request({
|
|
1502
|
+
method: "DELETE",
|
|
1503
|
+
path: `/api/v2/api/exchange/${id}`
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* Test exchange API key credentials
|
|
1508
|
+
*/
|
|
1509
|
+
async postTest(body) {
|
|
1510
|
+
return this.client.request({
|
|
1511
|
+
method: "POST",
|
|
1512
|
+
path: `/api/v2/api/exchange/test`,
|
|
1513
|
+
body
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
// src/services/llmApiKeys.ts
|
|
1519
|
+
var LlmApiKeysService = class {
|
|
1520
|
+
constructor(client) {
|
|
1521
|
+
this.client = client;
|
|
1522
|
+
}
|
|
1523
|
+
client;
|
|
1524
|
+
/**
|
|
1525
|
+
* Get all enabled LLM services
|
|
1526
|
+
*/
|
|
1527
|
+
async listServices() {
|
|
1528
|
+
return this.client.request({
|
|
1529
|
+
method: "GET",
|
|
1530
|
+
path: `/api/v2/api/llm/services`
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Get models for a specific service
|
|
1535
|
+
*/
|
|
1536
|
+
async getModels(serviceId) {
|
|
1537
|
+
return this.client.request({
|
|
1538
|
+
method: "GET",
|
|
1539
|
+
path: `/api/v2/api/llm/models/${serviceId}`
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Update model for an API key
|
|
1544
|
+
*/
|
|
1545
|
+
async model(id, body) {
|
|
1546
|
+
return this.client.request({
|
|
1547
|
+
method: "PUT",
|
|
1548
|
+
path: `/api/v2/api/llm/${id}/model`,
|
|
1549
|
+
body
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Get all LLM API keys for user
|
|
1554
|
+
*/
|
|
1555
|
+
async list() {
|
|
1556
|
+
return this.client.request({
|
|
1557
|
+
method: "GET",
|
|
1558
|
+
path: `/api/v2/api/llm`
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1561
|
+
/**
|
|
1562
|
+
* Create a new LLM API key
|
|
1563
|
+
*/
|
|
1564
|
+
async create(body) {
|
|
1565
|
+
return this.client.request({
|
|
1566
|
+
method: "POST",
|
|
1567
|
+
path: `/api/v2/api/llm`,
|
|
1568
|
+
body
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Delete an LLM API key
|
|
1573
|
+
*/
|
|
1574
|
+
async delete(id) {
|
|
1575
|
+
return this.client.request({
|
|
1576
|
+
method: "DELETE",
|
|
1577
|
+
path: `/api/v2/api/llm/${id}`
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
};
|
|
1581
|
+
|
|
1582
|
+
// src/services/predictionApiKeys.ts
|
|
1583
|
+
var PredictionApiKeysService = class {
|
|
1584
|
+
constructor(client) {
|
|
1585
|
+
this.client = client;
|
|
1586
|
+
}
|
|
1587
|
+
client;
|
|
1588
|
+
/**
|
|
1589
|
+
* Get all prediction API keys
|
|
1590
|
+
*/
|
|
1591
|
+
async list() {
|
|
1592
|
+
return this.client.request({
|
|
1593
|
+
method: "GET",
|
|
1594
|
+
path: `/api/v2/api/prediction`
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
/**
|
|
1598
|
+
* Create a new prediction API key
|
|
1599
|
+
*/
|
|
1600
|
+
async create(body) {
|
|
1601
|
+
return this.client.request({
|
|
1602
|
+
method: "POST",
|
|
1603
|
+
path: `/api/v2/api/prediction`,
|
|
1604
|
+
body
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Get prediction signal bots by API ID
|
|
1609
|
+
*/
|
|
1610
|
+
async getSignalBot(id, queryParams) {
|
|
1611
|
+
return this.client.request({
|
|
1612
|
+
method: "GET",
|
|
1613
|
+
path: `/api/v2/api/prediction/bot/signal/${id}`,
|
|
1614
|
+
queryParams
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Update prediction API key status
|
|
1619
|
+
*/
|
|
1620
|
+
async status(id, body) {
|
|
1621
|
+
return this.client.request({
|
|
1622
|
+
method: "PUT",
|
|
1623
|
+
path: `/api/v2/api/prediction/${id}/status`,
|
|
1624
|
+
body
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Delete prediction API key
|
|
1629
|
+
*/
|
|
1630
|
+
async delete(id) {
|
|
1631
|
+
return this.client.request({
|
|
1632
|
+
method: "DELETE",
|
|
1633
|
+
path: `/api/v2/api/prediction/${id}`
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Test prediction API credentials
|
|
1638
|
+
*/
|
|
1639
|
+
async postTest(body) {
|
|
1640
|
+
return this.client.request({
|
|
1641
|
+
method: "POST",
|
|
1642
|
+
path: `/api/v2/api/prediction/test`,
|
|
1643
|
+
body
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
// src/client.ts
|
|
1649
|
+
var SigrexError = class extends Error {
|
|
1650
|
+
status;
|
|
1651
|
+
statusText;
|
|
1652
|
+
body;
|
|
1653
|
+
constructor(status, statusText, body) {
|
|
1654
|
+
const message = body?.error || body?.message || `${status} ${statusText}`;
|
|
1655
|
+
super(message);
|
|
1656
|
+
this.name = "SigrexError";
|
|
1657
|
+
this.status = status;
|
|
1658
|
+
this.statusText = statusText;
|
|
1659
|
+
this.body = body;
|
|
1660
|
+
}
|
|
1661
|
+
};
|
|
1662
|
+
var SigrexBaseClient = class {
|
|
1663
|
+
options;
|
|
1664
|
+
constructor(options) {
|
|
1665
|
+
if (!options.apiKey) {
|
|
1666
|
+
throw new Error("API key is required.");
|
|
1667
|
+
}
|
|
1668
|
+
if (!options.apiSecret && !options.signer) {
|
|
1669
|
+
throw new Error("Either apiSecret or a custom signer function must be provided.");
|
|
1670
|
+
}
|
|
1671
|
+
const localFetch = options.fetch || typeof globalThis !== "undefined" && globalThis.fetch || typeof window !== "undefined" && window.fetch;
|
|
1672
|
+
if (!localFetch) {
|
|
1673
|
+
throw new Error("Fetch API is not available. Please provide a custom fetch implementation or upgrade your environment.");
|
|
1674
|
+
}
|
|
1675
|
+
this.options = {
|
|
1676
|
+
apiKey: options.apiKey,
|
|
1677
|
+
apiSecret: options.apiSecret,
|
|
1678
|
+
signer: options.signer,
|
|
1679
|
+
baseUrl: options.baseUrl || "https://api.sigrex.io",
|
|
1680
|
+
fetch: localFetch
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* Sends a signed HTTP request to the Sigrex API.
|
|
1685
|
+
*/
|
|
1686
|
+
async request(req) {
|
|
1687
|
+
const methodUpper = req.method.toUpperCase();
|
|
1688
|
+
const timestamp = Math.floor(Date.now() / 1e3).toString();
|
|
1689
|
+
const url = new URL(req.path.startsWith("/") ? req.path : `/${req.path}`, this.options.baseUrl);
|
|
1690
|
+
if (req.queryParams) {
|
|
1691
|
+
for (const [key, val] of Object.entries(req.queryParams)) {
|
|
1692
|
+
if (val !== void 0 && val !== null) {
|
|
1693
|
+
url.searchParams.append(key, String(val));
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
const signaturePath = url.pathname + url.search;
|
|
1698
|
+
let signature;
|
|
1699
|
+
if (this.options.signer) {
|
|
1700
|
+
const hasBody = (methodUpper === "POST" || methodUpper === "PUT") && req.body !== void 0 && req.body !== null;
|
|
1701
|
+
const bodyStr = hasBody ? JSON.stringify(req.body) : "";
|
|
1702
|
+
const message = methodUpper + signaturePath + bodyStr + timestamp;
|
|
1703
|
+
signature = await this.options.signer(message);
|
|
1704
|
+
} else if (this.options.apiSecret) {
|
|
1705
|
+
signature = generateHmacSignature(
|
|
1706
|
+
this.options.apiSecret,
|
|
1707
|
+
methodUpper,
|
|
1708
|
+
signaturePath,
|
|
1709
|
+
timestamp,
|
|
1710
|
+
req.body
|
|
1711
|
+
);
|
|
1712
|
+
} else {
|
|
1713
|
+
throw new Error("Either apiSecret or a custom signer function must be provided.");
|
|
1714
|
+
}
|
|
1715
|
+
const headers = {
|
|
1716
|
+
"api-key": this.options.apiKey,
|
|
1717
|
+
"timestamp": timestamp,
|
|
1718
|
+
"signature": signature
|
|
1719
|
+
};
|
|
1720
|
+
if (req.body !== void 0 && req.body !== null) {
|
|
1721
|
+
headers["Content-Type"] = "application/json";
|
|
1722
|
+
}
|
|
1723
|
+
const fetchOptions = {
|
|
1724
|
+
method: methodUpper,
|
|
1725
|
+
headers
|
|
1726
|
+
};
|
|
1727
|
+
if (req.body !== void 0 && req.body !== null) {
|
|
1728
|
+
fetchOptions.body = JSON.stringify(req.body);
|
|
1729
|
+
}
|
|
1730
|
+
const response = await this.options.fetch(url.toString(), fetchOptions);
|
|
1731
|
+
let responseData;
|
|
1732
|
+
const contentType = response.headers.get("content-type");
|
|
1733
|
+
if (contentType && contentType.includes("application/json")) {
|
|
1734
|
+
responseData = await response.json();
|
|
1735
|
+
} else {
|
|
1736
|
+
responseData = await response.text();
|
|
1737
|
+
}
|
|
1738
|
+
if (!response.ok) {
|
|
1739
|
+
throw new SigrexError(response.status, response.statusText, responseData);
|
|
1740
|
+
}
|
|
1741
|
+
return responseData;
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
var SigrexClient = class extends SigrexBaseClient {
|
|
1745
|
+
exchanges = new ExchangesService(this);
|
|
1746
|
+
strategies = {
|
|
1747
|
+
llmSessions: new LlmSessionsService(this),
|
|
1748
|
+
reactions: {
|
|
1749
|
+
llm: new LlmReactionsService(this),
|
|
1750
|
+
code: new CodeReactionsService(this)
|
|
1751
|
+
},
|
|
1752
|
+
code: new CodeStrategiesService(this)
|
|
1753
|
+
};
|
|
1754
|
+
bots = {
|
|
1755
|
+
cex: new CexBotsService(this),
|
|
1756
|
+
prediction: new PredictionBotsService(this),
|
|
1757
|
+
dex: new DexBotsService(this)
|
|
1758
|
+
};
|
|
1759
|
+
webhooks = {
|
|
1760
|
+
bot: new BotWebhooksService(this),
|
|
1761
|
+
data: new DataWebhooksService(this)
|
|
1762
|
+
};
|
|
1763
|
+
apiKeys = {
|
|
1764
|
+
exchange: new ExchangeApiKeysService(this),
|
|
1765
|
+
llm: new LlmApiKeysService(this),
|
|
1766
|
+
prediction: new PredictionApiKeysService(this)
|
|
1767
|
+
};
|
|
1768
|
+
};
|
|
1769
|
+
export {
|
|
1770
|
+
BotWebhooksService,
|
|
1771
|
+
CexBotsService,
|
|
1772
|
+
CodeReactionsService,
|
|
1773
|
+
CodeStrategiesService,
|
|
1774
|
+
DataWebhooksService,
|
|
1775
|
+
DexBotsService,
|
|
1776
|
+
ExchangeApiKeysService,
|
|
1777
|
+
ExchangesService,
|
|
1778
|
+
LlmApiKeysService,
|
|
1779
|
+
LlmReactionsService,
|
|
1780
|
+
LlmSessionsService,
|
|
1781
|
+
PredictionApiKeysService,
|
|
1782
|
+
PredictionBotsService,
|
|
1783
|
+
SigrexBaseClient,
|
|
1784
|
+
SigrexClient,
|
|
1785
|
+
SigrexError,
|
|
1786
|
+
generateHmacSignature
|
|
1787
|
+
};
|