@turtleclub/hooks 0.5.0-beta.94 → 0.5.0-beta.96
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.cjs +59 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +54 -19
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/v2/streams/api.ts +22 -0
- package/src/v2/streams/hooks.ts +17 -2
- package/src/v2/streams/index.ts +3 -0
- package/src/v2/streams/mutations.ts +20 -0
- package/src/v2/streams/queries.ts +1 -18
- package/src/v2/streams/schemas.ts +21 -7
package/dist/index.cjs
CHANGED
|
@@ -166,7 +166,6 @@ __export(index_exports, {
|
|
|
166
166
|
orgUserLeaderboardResponseSchema: () => orgUserLeaderboardResponseSchema,
|
|
167
167
|
organizationSchema: () => organizationSchema,
|
|
168
168
|
organizationsMutations: () => organizationsMutations,
|
|
169
|
-
outputSchema: () => outputSchema,
|
|
170
169
|
paginationSchema: () => paginationSchema,
|
|
171
170
|
pauseStreamSnapshotComputation: () => pauseStreamSnapshotComputation,
|
|
172
171
|
pauseStreamSnapshotComputationBodySchema: () => pauseStreamSnapshotComputationBodySchema,
|
|
@@ -195,6 +194,10 @@ __export(index_exports, {
|
|
|
195
194
|
snapshotSchema: () => snapshotSchema,
|
|
196
195
|
stakingConfigSchema: () => stakingConfigSchema,
|
|
197
196
|
stepTx: () => stepTx,
|
|
197
|
+
stopStream: () => stopStream,
|
|
198
|
+
stopStreamBodySchema: () => stopStreamBodySchema,
|
|
199
|
+
stopStreamInputSchema: () => stopStreamInputSchema,
|
|
200
|
+
stopStreamOutputSchema: () => stopStreamOutputSchema,
|
|
198
201
|
streamPointSchema: () => streamPointSchema,
|
|
199
202
|
streamSchema: () => streamSchema,
|
|
200
203
|
streamSignatureRequestInputSchema: () => streamSignatureRequestInputSchema,
|
|
@@ -278,6 +281,7 @@ __export(index_exports, {
|
|
|
278
281
|
usePortfolioBalance: () => usePortfolioBalance,
|
|
279
282
|
useProduct: () => useProduct,
|
|
280
283
|
useProducts: () => useProducts,
|
|
284
|
+
useStopStream: () => useStopStream,
|
|
281
285
|
useStreamPoints: () => useStreamPoints,
|
|
282
286
|
useStreamSupportedChains: () => useStreamSupportedChains,
|
|
283
287
|
useStreamWalletDetails: () => useStreamWalletDetails,
|
|
@@ -889,9 +893,6 @@ var stakingConfigSchema = import_zod7.z.object({
|
|
|
889
893
|
// src/v2/streams/hooks.ts
|
|
890
894
|
var import_react_query4 = require("@tanstack/react-query");
|
|
891
895
|
|
|
892
|
-
// src/v2/streams/queries.ts
|
|
893
|
-
var import_query_key_factory3 = require("@lukemorales/query-key-factory");
|
|
894
|
-
|
|
895
896
|
// src/v2/streams/schemas.ts
|
|
896
897
|
var import_zod8 = require("zod");
|
|
897
898
|
var customArgsBaseSchema = import_zod8.z.object({
|
|
@@ -1077,8 +1078,7 @@ var streamSignatureRequestInputSchema = import_zod8.z.object({
|
|
|
1077
1078
|
chainId: import_zod8.z.number().nullable(),
|
|
1078
1079
|
customArgs: import_zod8.z.intersection(
|
|
1079
1080
|
import_zod8.z.object({
|
|
1080
|
-
|
|
1081
|
-
targetTokenAddress: import_zod8.z.string()
|
|
1081
|
+
targetTokenId: import_zod8.z.string().uuid()
|
|
1082
1082
|
}),
|
|
1083
1083
|
import_zod8.z.union([
|
|
1084
1084
|
import_zod8.z.object({ tokensPerUSD: import_zod8.z.string() }),
|
|
@@ -1171,16 +1171,26 @@ var pauseStreamSnapshotComputationBodySchema = import_zod8.z.object({
|
|
|
1171
1171
|
streamId: import_zod8.z.string().uuid(),
|
|
1172
1172
|
snapshotComputationPaused: import_zod8.z.boolean()
|
|
1173
1173
|
});
|
|
1174
|
-
var
|
|
1175
|
-
|
|
1176
|
-
|
|
1174
|
+
var stopStreamInputSchema = import_zod8.z.object({
|
|
1175
|
+
organizationId: import_zod8.z.string().uuid(),
|
|
1176
|
+
streamId: import_zod8.z.string().uuid(),
|
|
1177
|
+
stopStream: import_zod8.z.boolean()
|
|
1178
|
+
});
|
|
1179
|
+
var stopStreamBodySchema = import_zod8.z.object({
|
|
1180
|
+
streamId: import_zod8.z.string().uuid(),
|
|
1181
|
+
stopStream: import_zod8.z.boolean()
|
|
1177
1182
|
});
|
|
1178
|
-
var pauseStreamSnapshotComputationOutputSchema = outputSchema;
|
|
1179
1183
|
var deleteStreamInputSchema = import_zod8.z.object({
|
|
1180
1184
|
organizationId: import_zod8.z.string().uuid(),
|
|
1181
1185
|
streamId: import_zod8.z.string().uuid()
|
|
1182
1186
|
});
|
|
1183
|
-
var
|
|
1187
|
+
var updateStreamOutputSchema = import_zod8.z.object({
|
|
1188
|
+
success: import_zod8.z.boolean(),
|
|
1189
|
+
message: import_zod8.z.string()
|
|
1190
|
+
});
|
|
1191
|
+
var pauseStreamSnapshotComputationOutputSchema = updateStreamOutputSchema;
|
|
1192
|
+
var stopStreamOutputSchema = updateStreamOutputSchema;
|
|
1193
|
+
var deleteStreamOutputSchema = updateStreamOutputSchema;
|
|
1184
1194
|
|
|
1185
1195
|
// src/v2/streams/api.ts
|
|
1186
1196
|
async function getStreams(query) {
|
|
@@ -1298,6 +1308,18 @@ async function pauseStreamSnapshotComputation(organizationId, body) {
|
|
|
1298
1308
|
}
|
|
1299
1309
|
return result.data;
|
|
1300
1310
|
}
|
|
1311
|
+
async function stopStream(organizationId, body) {
|
|
1312
|
+
const endpoint = `/streams/${organizationId}`;
|
|
1313
|
+
const data = await apiClient.fetch(endpoint, {
|
|
1314
|
+
method: "PATCH",
|
|
1315
|
+
body
|
|
1316
|
+
});
|
|
1317
|
+
const result = stopStreamOutputSchema.safeParse(data);
|
|
1318
|
+
if (!result.success) {
|
|
1319
|
+
throw new Error(`Failed to parse stop stream response: ${result.error.message}`);
|
|
1320
|
+
}
|
|
1321
|
+
return result.data;
|
|
1322
|
+
}
|
|
1301
1323
|
async function deleteStream(organizationId, streamId) {
|
|
1302
1324
|
const endpoint = `/streams/${organizationId}/${streamId}`;
|
|
1303
1325
|
const data = await apiClient.fetch(endpoint, {
|
|
@@ -1310,7 +1332,21 @@ async function deleteStream(organizationId, streamId) {
|
|
|
1310
1332
|
return result.data;
|
|
1311
1333
|
}
|
|
1312
1334
|
|
|
1335
|
+
// src/v2/streams/mutations.ts
|
|
1336
|
+
var streamsMutations = {
|
|
1337
|
+
pauseSnapshotComputation: (input) => pauseStreamSnapshotComputation(input.organizationId, {
|
|
1338
|
+
streamId: input.streamId,
|
|
1339
|
+
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1340
|
+
}),
|
|
1341
|
+
stop: (input) => stopStream(input.organizationId, {
|
|
1342
|
+
streamId: input.streamId,
|
|
1343
|
+
stopStream: input.stopStream
|
|
1344
|
+
}),
|
|
1345
|
+
deleteStream: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1313
1348
|
// src/v2/streams/queries.ts
|
|
1349
|
+
var import_query_key_factory3 = require("@lukemorales/query-key-factory");
|
|
1314
1350
|
var streamsQueries = (0, import_query_key_factory3.createQueryKeys)("streams", {
|
|
1315
1351
|
list: (query) => ({
|
|
1316
1352
|
queryKey: [query ?? "all"],
|
|
@@ -1333,13 +1369,6 @@ var streamsQueries = (0, import_query_key_factory3.createQueryKeys)("streams", {
|
|
|
1333
1369
|
queryFn: () => getStreamsSupportedChains()
|
|
1334
1370
|
}
|
|
1335
1371
|
});
|
|
1336
|
-
var streamsMutations = {
|
|
1337
|
-
pauseSnapshotComputation: (input) => pauseStreamSnapshotComputation(input.organizationId, {
|
|
1338
|
-
streamId: input.streamId,
|
|
1339
|
-
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1340
|
-
}),
|
|
1341
|
-
delete: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1342
|
-
};
|
|
1343
1372
|
|
|
1344
1373
|
// src/v2/streams/hooks.ts
|
|
1345
1374
|
function useStreams({
|
|
@@ -1377,9 +1406,15 @@ function usePauseStreamSnapshotComputation(options) {
|
|
|
1377
1406
|
...options
|
|
1378
1407
|
});
|
|
1379
1408
|
}
|
|
1409
|
+
function useStopStream(options) {
|
|
1410
|
+
return (0, import_react_query4.useMutation)({
|
|
1411
|
+
mutationFn: streamsMutations.stop,
|
|
1412
|
+
...options
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1380
1415
|
function useDeleteStream(options) {
|
|
1381
1416
|
return (0, import_react_query4.useMutation)({
|
|
1382
|
-
mutationFn: streamsMutations.
|
|
1417
|
+
mutationFn: streamsMutations.deleteStream,
|
|
1383
1418
|
...options
|
|
1384
1419
|
});
|
|
1385
1420
|
}
|
|
@@ -5072,7 +5107,6 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5072
5107
|
orgUserLeaderboardResponseSchema,
|
|
5073
5108
|
organizationSchema,
|
|
5074
5109
|
organizationsMutations,
|
|
5075
|
-
outputSchema,
|
|
5076
5110
|
paginationSchema,
|
|
5077
5111
|
pauseStreamSnapshotComputation,
|
|
5078
5112
|
pauseStreamSnapshotComputationBodySchema,
|
|
@@ -5101,6 +5135,10 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5101
5135
|
snapshotSchema,
|
|
5102
5136
|
stakingConfigSchema,
|
|
5103
5137
|
stepTx,
|
|
5138
|
+
stopStream,
|
|
5139
|
+
stopStreamBodySchema,
|
|
5140
|
+
stopStreamInputSchema,
|
|
5141
|
+
stopStreamOutputSchema,
|
|
5104
5142
|
streamPointSchema,
|
|
5105
5143
|
streamSchema,
|
|
5106
5144
|
streamSignatureRequestInputSchema,
|
|
@@ -5184,6 +5222,7 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5184
5222
|
usePortfolioBalance,
|
|
5185
5223
|
useProduct,
|
|
5186
5224
|
useProducts,
|
|
5225
|
+
useStopStream,
|
|
5187
5226
|
useStreamPoints,
|
|
5188
5227
|
useStreamSupportedChains,
|
|
5189
5228
|
useStreamWalletDetails,
|