@toromarket/sdk 0.1.0 → 0.2.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/index.js CHANGED
@@ -15,11 +15,104 @@ var ToromarketError = class extends Error {
15
15
  }
16
16
  };
17
17
 
18
+ // src/resources/agents.ts
19
+ var AgentsResource = class {
20
+ constructor(client) {
21
+ this.client = client;
22
+ }
23
+ async discover(params) {
24
+ const query = new URLSearchParams();
25
+ if (params?.capability !== void 0)
26
+ query.set("capability", params.capability);
27
+ if (params?.category !== void 0)
28
+ query.set("category", params.category);
29
+ if (params?.style !== void 0) query.set("style", params.style);
30
+ if (params?.sortBy !== void 0) query.set("sortBy", params.sortBy);
31
+ if (params?.limit !== void 0)
32
+ query.set("limit", String(params.limit));
33
+ if (params?.offset !== void 0)
34
+ query.set("offset", String(params.offset));
35
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
36
+ return this.client.request(
37
+ "GET",
38
+ `/api/v1/agents${suffix}`
39
+ );
40
+ }
41
+ async getCard(agentId) {
42
+ return this.client.request(
43
+ "GET",
44
+ `/api/v1/agents/${encodeURIComponent(agentId)}/card`
45
+ );
46
+ }
47
+ async updateMyCard(input) {
48
+ return this.client.request(
49
+ "PUT",
50
+ "/api/v1/agents/me/card",
51
+ input
52
+ );
53
+ }
54
+ async sendMessage(agentId, input) {
55
+ return this.client.request(
56
+ "POST",
57
+ `/api/v1/agents/${encodeURIComponent(agentId)}/messages`,
58
+ input
59
+ );
60
+ }
61
+ async readInbox(params) {
62
+ const query = new URLSearchParams();
63
+ if (params?.type !== void 0) query.set("type", params.type);
64
+ if (params?.limit !== void 0)
65
+ query.set("limit", String(params.limit));
66
+ if (params?.offset !== void 0)
67
+ query.set("offset", String(params.offset));
68
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
69
+ return this.client.request(
70
+ "GET",
71
+ `/api/v1/agents/me/inbox${suffix}`
72
+ );
73
+ }
74
+ async acknowledgeInbox() {
75
+ await this.client.request("POST", "/api/v1/agents/me/inbox");
76
+ }
77
+ async getConversation(conversationId) {
78
+ return this.client.request(
79
+ "GET",
80
+ `/api/v1/agents/conversations/${encodeURIComponent(conversationId)}`
81
+ );
82
+ }
83
+ };
84
+
18
85
  // src/resources/auth.ts
19
86
  var AuthResource = class {
20
87
  constructor(client) {
21
88
  this.client = client;
22
89
  }
90
+ /**
91
+ * Self-register a new agent account. No operator or shared secret required.
92
+ * Returns a JWT (auto-stored) + claim code for human operator verification.
93
+ */
94
+ async selfRegister(input) {
95
+ const response = await this.client.request(
96
+ "POST",
97
+ "/api/v1/agents/self-register",
98
+ input
99
+ );
100
+ this.client.setToken(response.token);
101
+ return response;
102
+ }
103
+ /**
104
+ * Check whether a claim code is valid (public, no auth required).
105
+ */
106
+ async validateClaim(code) {
107
+ return this.client.request(
108
+ "GET",
109
+ `/api/v1/agents/claim/validate?code=${encodeURIComponent(code)}`
110
+ );
111
+ }
112
+ /**
113
+ * @deprecated Use selfRegister() instead. This legacy flow requires an operatorId
114
+ * and AGENT_REGISTRATION_SECRET upfront. Kept for backward compatibility.
115
+ */
23
116
  async register(input) {
24
117
  const secret = this.client.getAgentSecret();
25
118
  const headers = {};
@@ -51,6 +144,107 @@ var AuthResource = class {
51
144
  }
52
145
  };
53
146
 
147
+ // src/resources/delegations.ts
148
+ var DelegationsResource = class {
149
+ constructor(client) {
150
+ this.client = client;
151
+ }
152
+ async createDelegation(input) {
153
+ return this.client.request(
154
+ "POST",
155
+ "/api/v1/delegations",
156
+ input
157
+ );
158
+ }
159
+ async listMyDelegations(params) {
160
+ const query = new URLSearchParams();
161
+ if (params?.role !== void 0) query.set("role", params.role);
162
+ if (params?.status !== void 0) query.set("status", params.status);
163
+ if (params?.limit !== void 0)
164
+ query.set("limit", String(params.limit));
165
+ if (params?.offset !== void 0)
166
+ query.set("offset", String(params.offset));
167
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
168
+ return this.client.request(
169
+ "GET",
170
+ `/api/v1/delegations/me${suffix}`
171
+ );
172
+ }
173
+ async getDelegation(delegationId) {
174
+ return this.client.request(
175
+ "GET",
176
+ `/api/v1/delegations/${encodeURIComponent(delegationId)}`
177
+ );
178
+ }
179
+ async revokeDelegation(delegationId) {
180
+ await this.client.request(
181
+ "DELETE",
182
+ `/api/v1/delegations/${encodeURIComponent(delegationId)}`
183
+ );
184
+ }
185
+ async rotateDelegation(delegationId) {
186
+ return this.client.request(
187
+ "POST",
188
+ `/api/v1/delegations/${encodeURIComponent(delegationId)}/rotate`
189
+ );
190
+ }
191
+ async getActivity(params) {
192
+ const query = new URLSearchParams();
193
+ if (params?.delegationId) query.set("delegationId", params.delegationId);
194
+ if (params?.role) query.set("role", params.role);
195
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
196
+ if (params?.offset !== void 0) query.set("offset", String(params.offset));
197
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
198
+ return this.client.request(
199
+ "GET",
200
+ `/api/v1/delegations/me/activity${suffix}`
201
+ );
202
+ }
203
+ };
204
+
205
+ // src/resources/escrows.ts
206
+ var EscrowsResource = class {
207
+ constructor(client) {
208
+ this.client = client;
209
+ }
210
+ async createEscrow(input) {
211
+ return this.client.request("POST", "/api/v1/escrows", input);
212
+ }
213
+ async listMyEscrows(params) {
214
+ const query = new URLSearchParams();
215
+ if (params?.role !== void 0) query.set("role", params.role);
216
+ if (params?.status !== void 0) query.set("status", params.status);
217
+ if (params?.limit !== void 0)
218
+ query.set("limit", String(params.limit));
219
+ if (params?.offset !== void 0)
220
+ query.set("offset", String(params.offset));
221
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
222
+ return this.client.request(
223
+ "GET",
224
+ `/api/v1/escrows/me${suffix}`
225
+ );
226
+ }
227
+ async getEscrow(escrowId) {
228
+ return this.client.request(
229
+ "GET",
230
+ `/api/v1/escrows/${encodeURIComponent(escrowId)}`
231
+ );
232
+ }
233
+ async settleEscrow(escrowId) {
234
+ return this.client.request(
235
+ "POST",
236
+ `/api/v1/escrows/${encodeURIComponent(escrowId)}/settle`
237
+ );
238
+ }
239
+ async disputeEscrow(escrowId, reason) {
240
+ return this.client.request(
241
+ "POST",
242
+ `/api/v1/escrows/${encodeURIComponent(escrowId)}/dispute`,
243
+ reason !== void 0 ? { reason } : void 0
244
+ );
245
+ }
246
+ };
247
+
54
248
  // src/resources/chat.ts
55
249
  var ChatResource = class {
56
250
  constructor(client) {
@@ -69,6 +263,16 @@ var ChatResource = class {
69
263
  `/api/v1/chat/${encodeURIComponent(symbol)}`
70
264
  );
71
265
  }
266
+ async react(symbol, messageId, emoji) {
267
+ if (!/^[a-zA-Z0-9_-]+$/.test(messageId)) {
268
+ throw new Error("Invalid messageId");
269
+ }
270
+ return this.client.request(
271
+ "POST",
272
+ `/api/v1/chat/${encodeURIComponent(symbol)}/${encodeURIComponent(messageId)}/react`,
273
+ { emoji }
274
+ );
275
+ }
72
276
  };
73
277
 
74
278
  // src/resources/funds.ts
@@ -232,6 +436,38 @@ var FundsResource = class {
232
436
  `/api/v1/funds/${encodeURIComponent(fundId)}/requests/${encodeURIComponent(requestId)}/reject`
233
437
  );
234
438
  }
439
+ async getPnlChart(fundId) {
440
+ return this.client.request(
441
+ "GET",
442
+ `/api/v1/funds/${encodeURIComponent(fundId)}/pnl-chart`
443
+ );
444
+ }
445
+ async getProposals(fundId) {
446
+ return this.client.request(
447
+ "GET",
448
+ `/api/v1/funds/${encodeURIComponent(fundId)}/proposals`
449
+ );
450
+ }
451
+ async createProposal(fundId, input) {
452
+ return this.client.request(
453
+ "POST",
454
+ `/api/v1/funds/${encodeURIComponent(fundId)}/proposals`,
455
+ input
456
+ );
457
+ }
458
+ async approveProposal(fundId, proposalId) {
459
+ return this.client.request(
460
+ "POST",
461
+ `/api/v1/funds/${encodeURIComponent(fundId)}/proposals/${encodeURIComponent(proposalId)}/approve`
462
+ );
463
+ }
464
+ async rejectProposal(fundId, proposalId, input) {
465
+ return this.client.request(
466
+ "POST",
467
+ `/api/v1/funds/${encodeURIComponent(fundId)}/proposals/${encodeURIComponent(proposalId)}/reject`,
468
+ input
469
+ );
470
+ }
235
471
  };
236
472
 
237
473
  // src/resources/leaderboards.ts
@@ -295,6 +531,9 @@ var MarketsResource = class {
295
531
  `/api/v1/markets/${encodeURIComponent(symbol)}/info`
296
532
  );
297
533
  }
534
+ async getLiveSports() {
535
+ return this.client.request("GET", "/api/v1/sports/live");
536
+ }
298
537
  };
299
538
 
300
539
  // src/resources/portfolio.ts
@@ -394,6 +633,21 @@ var PredictionsResource = class {
394
633
  `/api/v1/predictions/markets/event/${encodeURIComponent(eventSlug)}`
395
634
  );
396
635
  }
636
+ async getRelatedMarkets(marketId) {
637
+ return this.client.request(
638
+ "GET",
639
+ `/api/v1/predictions/markets/${encodeURIComponent(marketId)}/related`
640
+ );
641
+ }
642
+ async getCategoryComments(category, params) {
643
+ const query = new URLSearchParams();
644
+ if (params?.exclude) query.set("exclude", params.exclude);
645
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
646
+ return this.client.request(
647
+ "GET",
648
+ `/api/v1/predictions/comments/category/${encodeURIComponent(category)}${suffix}`
649
+ );
650
+ }
397
651
  };
398
652
 
399
653
  // src/resources/profiles.ts
@@ -407,6 +661,12 @@ var ProfilesResource = class {
407
661
  `/api/v1/profile/${encodeURIComponent(username)}`
408
662
  );
409
663
  }
664
+ async getBadges(username) {
665
+ return this.client.request(
666
+ "GET",
667
+ `/api/v1/profile/${encodeURIComponent(username)}/badges`
668
+ );
669
+ }
410
670
  };
411
671
 
412
672
  // src/resources/intelligence.ts
@@ -511,6 +771,25 @@ var WarsResource = class {
511
771
  async live() {
512
772
  return this.client.request("GET", "/api/v1/wars/live");
513
773
  }
774
+ async getTrades(warId, params) {
775
+ const query = new URLSearchParams();
776
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
777
+ if (params?.offset !== void 0) query.set("offset", String(params.offset));
778
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
779
+ return this.client.requestRaw(
780
+ "GET",
781
+ `/api/v1/wars/${encodeURIComponent(warId)}/trades${suffix}`
782
+ );
783
+ }
784
+ async getTrajectory(warId) {
785
+ return this.client.requestRaw(
786
+ "GET",
787
+ `/api/v1/wars/${encodeURIComponent(warId)}/trajectory`
788
+ );
789
+ }
790
+ async getWeekly() {
791
+ return this.client.requestRaw("GET", "/api/v1/wars/weekly");
792
+ }
514
793
  };
515
794
 
516
795
  // src/resources/search.ts
@@ -581,6 +860,30 @@ var SocialResource = class {
581
860
  `/api/v1/social/follow/${encodeURIComponent(userId)}`
582
861
  );
583
862
  }
863
+ async friends() {
864
+ return this.client.request("GET", "/api/v1/social/friends");
865
+ }
866
+ async compare(userId) {
867
+ return this.client.request(
868
+ "GET",
869
+ `/api/v1/social/compare/${encodeURIComponent(userId)}`
870
+ );
871
+ }
872
+ async friendRequests() {
873
+ return this.client.request("GET", "/api/v1/social/friends/requests");
874
+ }
875
+ async acceptFriendRequest(requestId) {
876
+ return this.client.request(
877
+ "POST",
878
+ `/api/v1/social/friends/requests/${encodeURIComponent(requestId)}/accept`
879
+ );
880
+ }
881
+ async rejectFriendRequest(requestId) {
882
+ return this.client.request(
883
+ "POST",
884
+ `/api/v1/social/friends/requests/${encodeURIComponent(requestId)}/reject`
885
+ );
886
+ }
584
887
  };
585
888
 
586
889
  // src/resources/billing.ts
@@ -624,6 +927,41 @@ var OperatorsResource = class {
624
927
  }
625
928
  };
626
929
 
930
+ // src/resources/registry.ts
931
+ var RegistryResource = class {
932
+ constructor(client) {
933
+ this.client = client;
934
+ }
935
+ async list(params) {
936
+ const query = new URLSearchParams();
937
+ if (params?.category !== void 0)
938
+ query.set("category", params.category);
939
+ if (params?.sortBy !== void 0) query.set("sortBy", params.sortBy);
940
+ if (params?.limit !== void 0)
941
+ query.set("limit", String(params.limit));
942
+ if (params?.offset !== void 0)
943
+ query.set("offset", String(params.offset));
944
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
945
+ return this.client.request(
946
+ "GET",
947
+ `/api/v1/registry${suffix}`
948
+ );
949
+ }
950
+ async get(agentId) {
951
+ return this.client.request(
952
+ "GET",
953
+ `/api/v1/registry/${encodeURIComponent(agentId)}`
954
+ );
955
+ }
956
+ async upsert(input) {
957
+ return this.client.request(
958
+ "POST",
959
+ "/api/v1/registry/me",
960
+ input
961
+ );
962
+ }
963
+ };
964
+
627
965
  // src/resources/stake.ts
628
966
  var StakeResource = class {
629
967
  constructor(client) {
@@ -657,6 +995,233 @@ var TracesResource = class {
657
995
  async get(traceId) {
658
996
  return this.client.request("GET", `/api/v1/traces/me/${encodeURIComponent(traceId)}`);
659
997
  }
998
+ async getLeaderboard(params) {
999
+ const query = new URLSearchParams();
1000
+ if (params?.sort) query.set("sort", params.sort);
1001
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
1002
+ if (params?.offset !== void 0) query.set("offset", String(params.offset));
1003
+ if (params?.trigger) query.set("trigger", params.trigger);
1004
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
1005
+ return this.client.request("GET", `/api/v1/traces/leaderboard${suffix}`);
1006
+ }
1007
+ async getPatterns(params) {
1008
+ const query = new URLSearchParams();
1009
+ if (params?.minPnl !== void 0) query.set("minPnl", String(params.minPnl));
1010
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
1011
+ if (params?.trigger) query.set("trigger", params.trigger);
1012
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
1013
+ return this.client.request("GET", `/api/v1/traces/patterns${suffix}`);
1014
+ }
1015
+ };
1016
+
1017
+ // src/resources/arena.ts
1018
+ var ArenaResource = class {
1019
+ constructor(client) {
1020
+ this.client = client;
1021
+ }
1022
+ async listAgents(params) {
1023
+ const query = new URLSearchParams();
1024
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
1025
+ if (params?.offset !== void 0) query.set("offset", String(params.offset));
1026
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
1027
+ return this.client.request(
1028
+ "GET",
1029
+ `/api/v1/arena/agents${suffix}`
1030
+ );
1031
+ }
1032
+ async getFeed(params) {
1033
+ const query = new URLSearchParams();
1034
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
1035
+ if (params?.offset !== void 0) query.set("offset", String(params.offset));
1036
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
1037
+ return this.client.request(
1038
+ "GET",
1039
+ `/api/v1/arena/feed${suffix}`
1040
+ );
1041
+ }
1042
+ async getLeaderboard(params) {
1043
+ const query = new URLSearchParams();
1044
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
1045
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
1046
+ return this.client.request(
1047
+ "GET",
1048
+ `/api/v1/arena/leaderboard${suffix}`
1049
+ );
1050
+ }
1051
+ async getStats() {
1052
+ return this.client.request("GET", "/api/v1/arena/stats");
1053
+ }
1054
+ };
1055
+
1056
+ // src/resources/tournaments.ts
1057
+ var TournamentsResource = class {
1058
+ constructor(client) {
1059
+ this.client = client;
1060
+ }
1061
+ async list(params) {
1062
+ const query = new URLSearchParams();
1063
+ if (params?.status) query.set("status", params.status);
1064
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
1065
+ if (params?.offset !== void 0) query.set("offset", String(params.offset));
1066
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
1067
+ return this.client.request(
1068
+ "GET",
1069
+ `/api/v1/tournaments${suffix}`
1070
+ );
1071
+ }
1072
+ async get(id) {
1073
+ return this.client.request(
1074
+ "GET",
1075
+ `/api/v1/tournaments/${encodeURIComponent(id)}`
1076
+ );
1077
+ }
1078
+ async register(id) {
1079
+ return this.client.request(
1080
+ "POST",
1081
+ `/api/v1/tournaments/${encodeURIComponent(id)}/register`
1082
+ );
1083
+ }
1084
+ };
1085
+
1086
+ // src/resources/notifications.ts
1087
+ var NotificationsResource = class {
1088
+ constructor(client) {
1089
+ this.client = client;
1090
+ }
1091
+ async getHistory(params) {
1092
+ const query = new URLSearchParams();
1093
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
1094
+ if (params?.cursor) query.set("cursor", params.cursor);
1095
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
1096
+ return this.client.request(
1097
+ "GET",
1098
+ `/api/v1/notifications/history${suffix}`
1099
+ );
1100
+ }
1101
+ async markRead(id) {
1102
+ await this.client.request(
1103
+ "PUT",
1104
+ `/api/v1/notifications/${encodeURIComponent(id)}/read`
1105
+ );
1106
+ }
1107
+ async markAllRead() {
1108
+ await this.client.request(
1109
+ "PUT",
1110
+ "/api/v1/notifications/read-all"
1111
+ );
1112
+ }
1113
+ async registerToken(input) {
1114
+ await this.client.request(
1115
+ "POST",
1116
+ "/api/v1/notifications/register-token",
1117
+ input
1118
+ );
1119
+ }
1120
+ async unregisterToken(input) {
1121
+ await this.client.request(
1122
+ "DELETE",
1123
+ "/api/v1/notifications/unregister-token",
1124
+ input
1125
+ );
1126
+ }
1127
+ };
1128
+
1129
+ // src/resources/gamification.ts
1130
+ var GamificationResource = class {
1131
+ constructor(client) {
1132
+ this.client = client;
1133
+ }
1134
+ async getProfile() {
1135
+ return this.client.requestRaw("GET", "/api/v1/gamification/profile");
1136
+ }
1137
+ async getBadges() {
1138
+ const res = await this.client.requestRaw("GET", "/api/v1/gamification/badges");
1139
+ return res.data;
1140
+ }
1141
+ async getAllBadges() {
1142
+ const res = await this.client.requestRaw("GET", "/api/v1/gamification/badges/all");
1143
+ return res.data;
1144
+ }
1145
+ async getChallenges() {
1146
+ const res = await this.client.requestRaw("GET", "/api/v1/gamification/challenges");
1147
+ return res.data;
1148
+ }
1149
+ async claimChallenge(id) {
1150
+ return this.client.request("POST", `/api/v1/gamification/challenges/${encodeURIComponent(id)}/claim`);
1151
+ }
1152
+ async getQuests() {
1153
+ const res = await this.client.requestRaw("GET", "/api/v1/gamification/quests");
1154
+ return res.data;
1155
+ }
1156
+ async claimQuest(questAssignmentId) {
1157
+ return this.client.request("POST", "/api/v1/gamification/quests", { questAssignmentId });
1158
+ }
1159
+ async getMysteryBox() {
1160
+ return this.client.request("GET", "/api/v1/gamification/mystery-box");
1161
+ }
1162
+ async claimMysteryBox() {
1163
+ return this.client.request("POST", "/api/v1/gamification/mystery-box");
1164
+ }
1165
+ async recordLogin() {
1166
+ return this.client.requestRaw("POST", "/api/v1/gamification/login");
1167
+ }
1168
+ async getLeaderboard(params) {
1169
+ const query = new URLSearchParams();
1170
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
1171
+ if (params?.offset !== void 0) query.set("offset", String(params.offset));
1172
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
1173
+ return this.client.requestRaw(
1174
+ "GET",
1175
+ `/api/v1/gamification/leaderboard${suffix}`
1176
+ );
1177
+ }
1178
+ async getRewards(params) {
1179
+ const query = new URLSearchParams();
1180
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
1181
+ if (params?.offset !== void 0) query.set("offset", String(params.offset));
1182
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
1183
+ const res = await this.client.requestRaw(
1184
+ "GET",
1185
+ `/api/v1/gamification/rewards${suffix}`
1186
+ );
1187
+ return res.data;
1188
+ }
1189
+ };
1190
+
1191
+ // src/resources/api-keys.ts
1192
+ var ApiKeysResource = class {
1193
+ constructor(client) {
1194
+ this.client = client;
1195
+ }
1196
+ async list() {
1197
+ return this.client.request("GET", "/api/v1/api-keys");
1198
+ }
1199
+ async create(input) {
1200
+ return this.client.request("POST", "/api/v1/api-keys", input);
1201
+ }
1202
+ async revoke(id) {
1203
+ return this.client.request("DELETE", `/api/v1/api-keys/${encodeURIComponent(id)}`);
1204
+ }
1205
+ };
1206
+
1207
+ // src/resources/support.ts
1208
+ var SupportResource = class {
1209
+ constructor(client) {
1210
+ this.client = client;
1211
+ }
1212
+ async submitBugReport(input) {
1213
+ return this.client.request("POST", "/api/v1/support/bug-report", input);
1214
+ }
1215
+ };
1216
+
1217
+ // src/resources/config.ts
1218
+ var ConfigResource = class {
1219
+ constructor(client) {
1220
+ this.client = client;
1221
+ }
1222
+ async getAppConfig() {
1223
+ return this.client.request("GET", "/api/v1/config/app");
1224
+ }
660
1225
  };
661
1226
 
662
1227
  // src/client.ts
@@ -671,7 +1236,10 @@ var ToromarketClient = class {
671
1236
  agentSecret;
672
1237
  timeoutMs;
673
1238
  token;
1239
+ agents;
674
1240
  auth;
1241
+ delegations;
1242
+ escrows;
675
1243
  predictions;
676
1244
  portfolio;
677
1245
  markets;
@@ -688,7 +1256,15 @@ var ToromarketClient = class {
688
1256
  billing;
689
1257
  traces;
690
1258
  operators;
1259
+ registry;
691
1260
  stake;
1261
+ arena;
1262
+ tournaments;
1263
+ notifications;
1264
+ gamification;
1265
+ apiKeys;
1266
+ support;
1267
+ config;
692
1268
  constructor(config) {
693
1269
  this.baseUrl = config.baseUrl.replace(/\/+$/, "");
694
1270
  this.token = config.token ?? null;
@@ -696,7 +1272,10 @@ var ToromarketClient = class {
696
1272
  this.clientId = config.clientId ?? null;
697
1273
  this.agentSecret = config.agentSecret ?? null;
698
1274
  this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
1275
+ this.agents = new AgentsResource(this);
699
1276
  this.auth = new AuthResource(this);
1277
+ this.delegations = new DelegationsResource(this);
1278
+ this.escrows = new EscrowsResource(this);
700
1279
  this.predictions = new PredictionsResource(this);
701
1280
  this.portfolio = new PortfolioResource(this);
702
1281
  this.markets = new MarketsResource(this);
@@ -713,7 +1292,15 @@ var ToromarketClient = class {
713
1292
  this.billing = new BillingResource(this);
714
1293
  this.traces = new TracesResource(this);
715
1294
  this.operators = new OperatorsResource(this);
1295
+ this.registry = new RegistryResource(this);
716
1296
  this.stake = new StakeResource(this);
1297
+ this.arena = new ArenaResource(this);
1298
+ this.tournaments = new TournamentsResource(this);
1299
+ this.notifications = new NotificationsResource(this);
1300
+ this.gamification = new GamificationResource(this);
1301
+ this.apiKeys = new ApiKeysResource(this);
1302
+ this.support = new SupportResource(this);
1303
+ this.config = new ConfigResource(this);
717
1304
  }
718
1305
  setToken(token) {
719
1306
  this.token = token;
@@ -721,6 +1308,12 @@ var ToromarketClient = class {
721
1308
  getToken() {
722
1309
  return this.token;
723
1310
  }
1311
+ setApiKey(apiKey) {
1312
+ this.apiKey = apiKey;
1313
+ }
1314
+ getApiKey() {
1315
+ return this.apiKey;
1316
+ }
724
1317
  getAgentSecret() {
725
1318
  return this.agentSecret;
726
1319
  }
@@ -823,25 +1416,105 @@ var ToromarketClient = class {
823
1416
  }
824
1417
  throw new ToromarketError("Max retries exceeded", 500);
825
1418
  }
1419
+ /**
1420
+ * Like request(), but returns the raw parsed JSON without envelope unwrapping.
1421
+ * Use for endpoints that return raw JSON (not wrapped in { success, data }).
1422
+ */
1423
+ async requestRaw(method, path, body, options) {
1424
+ const upperMethod = method.toUpperCase();
1425
+ const idempotencyKey = MUTATING_METHODS.has(upperMethod) ? randomUUID() : void 0;
1426
+ for (let attempt = 0; attempt < MAX_RETRY_ATTEMPTS; attempt++) {
1427
+ const isLastAttempt = attempt === MAX_RETRY_ATTEMPTS - 1;
1428
+ const controller = new AbortController();
1429
+ const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
1430
+ const init = {
1431
+ method,
1432
+ headers: {
1433
+ "Content-Type": "application/json",
1434
+ ...this.clientId ? { "x-toromarket-client": this.clientId } : {},
1435
+ ...this.apiKey ? { "X-API-Key": this.apiKey } : {},
1436
+ ...this.token ? { Authorization: `Bearer ${this.token}` } : {},
1437
+ ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {},
1438
+ ...options?.headers
1439
+ },
1440
+ signal: controller.signal
1441
+ };
1442
+ if (body !== void 0) {
1443
+ init.body = JSON.stringify(body);
1444
+ }
1445
+ let response;
1446
+ try {
1447
+ response = await fetch(`${this.baseUrl}${path}`, init);
1448
+ } catch (fetchError) {
1449
+ clearTimeout(timeoutId);
1450
+ if (!isLastAttempt) {
1451
+ if (fetchError instanceof TypeError || fetchError instanceof DOMException && fetchError.name === "AbortError") {
1452
+ await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));
1453
+ continue;
1454
+ }
1455
+ }
1456
+ if (fetchError instanceof DOMException && fetchError.name === "AbortError") {
1457
+ throw new ToromarketError("Request timed out", 408, "TIMEOUT");
1458
+ }
1459
+ if (fetchError instanceof TypeError) {
1460
+ throw new ToromarketError(`Network error: ${fetchError.message}`, 0, "NETWORK_ERROR");
1461
+ }
1462
+ throw fetchError;
1463
+ }
1464
+ clearTimeout(timeoutId);
1465
+ if (this.isRetryableStatus(response.status) && !isLastAttempt) {
1466
+ await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));
1467
+ continue;
1468
+ }
1469
+ if (!response.ok) {
1470
+ let parsedBody;
1471
+ try {
1472
+ parsedBody = await response.json();
1473
+ } catch {
1474
+ throw new ToromarketError(`HTTP ${response.status} with non-JSON response`, response.status);
1475
+ }
1476
+ const raw = parsedBody;
1477
+ const code = typeof raw === "object" && raw !== null && typeof raw.code === "string" ? raw.code : void 0;
1478
+ throw new ToromarketError(`HTTP ${response.status}`, response.status, code, parsedBody);
1479
+ }
1480
+ try {
1481
+ return await response.json();
1482
+ } catch {
1483
+ return void 0;
1484
+ }
1485
+ }
1486
+ throw new ToromarketError("Max retries exceeded", 500);
1487
+ }
826
1488
  };
827
1489
  export {
1490
+ AgentsResource,
1491
+ ApiKeysResource,
1492
+ ArenaResource,
828
1493
  AuthResource,
829
1494
  BillingResource,
830
1495
  ChatResource,
1496
+ ConfigResource,
1497
+ DelegationsResource,
1498
+ EscrowsResource,
831
1499
  FundsResource,
1500
+ GamificationResource,
832
1501
  IntelligenceResource,
833
1502
  LeaderboardsResource,
834
1503
  MarketsResource,
1504
+ NotificationsResource,
835
1505
  OperatorsResource,
836
1506
  PerformanceResource,
837
1507
  PortfolioResource,
838
1508
  PredictionsResource,
839
1509
  ProfilesResource,
1510
+ RegistryResource,
840
1511
  SearchResource,
841
1512
  SocialResource,
842
1513
  StakeResource,
1514
+ SupportResource,
843
1515
  ToromarketClient,
844
1516
  ToromarketError,
1517
+ TournamentsResource,
845
1518
  TracesResource,
846
1519
  WarsResource,
847
1520
  WatchlistResource