@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.js
CHANGED
|
@@ -572,9 +572,6 @@ var stakingConfigSchema = z7.object({
|
|
|
572
572
|
// src/v2/streams/hooks.ts
|
|
573
573
|
import { useMutation as useMutation2, useQuery as useQuery3 } from "@tanstack/react-query";
|
|
574
574
|
|
|
575
|
-
// src/v2/streams/queries.ts
|
|
576
|
-
import { createQueryKeys as createQueryKeys3 } from "@lukemorales/query-key-factory";
|
|
577
|
-
|
|
578
575
|
// src/v2/streams/schemas.ts
|
|
579
576
|
import { z as z8 } from "zod";
|
|
580
577
|
var customArgsBaseSchema = z8.object({
|
|
@@ -760,8 +757,7 @@ var streamSignatureRequestInputSchema = z8.object({
|
|
|
760
757
|
chainId: z8.number().nullable(),
|
|
761
758
|
customArgs: z8.intersection(
|
|
762
759
|
z8.object({
|
|
763
|
-
|
|
764
|
-
targetTokenAddress: z8.string()
|
|
760
|
+
targetTokenId: z8.string().uuid()
|
|
765
761
|
}),
|
|
766
762
|
z8.union([
|
|
767
763
|
z8.object({ tokensPerUSD: z8.string() }),
|
|
@@ -854,16 +850,26 @@ var pauseStreamSnapshotComputationBodySchema = z8.object({
|
|
|
854
850
|
streamId: z8.string().uuid(),
|
|
855
851
|
snapshotComputationPaused: z8.boolean()
|
|
856
852
|
});
|
|
857
|
-
var
|
|
858
|
-
|
|
859
|
-
|
|
853
|
+
var stopStreamInputSchema = z8.object({
|
|
854
|
+
organizationId: z8.string().uuid(),
|
|
855
|
+
streamId: z8.string().uuid(),
|
|
856
|
+
stopStream: z8.boolean()
|
|
857
|
+
});
|
|
858
|
+
var stopStreamBodySchema = z8.object({
|
|
859
|
+
streamId: z8.string().uuid(),
|
|
860
|
+
stopStream: z8.boolean()
|
|
860
861
|
});
|
|
861
|
-
var pauseStreamSnapshotComputationOutputSchema = outputSchema;
|
|
862
862
|
var deleteStreamInputSchema = z8.object({
|
|
863
863
|
organizationId: z8.string().uuid(),
|
|
864
864
|
streamId: z8.string().uuid()
|
|
865
865
|
});
|
|
866
|
-
var
|
|
866
|
+
var updateStreamOutputSchema = z8.object({
|
|
867
|
+
success: z8.boolean(),
|
|
868
|
+
message: z8.string()
|
|
869
|
+
});
|
|
870
|
+
var pauseStreamSnapshotComputationOutputSchema = updateStreamOutputSchema;
|
|
871
|
+
var stopStreamOutputSchema = updateStreamOutputSchema;
|
|
872
|
+
var deleteStreamOutputSchema = updateStreamOutputSchema;
|
|
867
873
|
|
|
868
874
|
// src/v2/streams/api.ts
|
|
869
875
|
async function getStreams(query) {
|
|
@@ -981,6 +987,18 @@ async function pauseStreamSnapshotComputation(organizationId, body) {
|
|
|
981
987
|
}
|
|
982
988
|
return result.data;
|
|
983
989
|
}
|
|
990
|
+
async function stopStream(organizationId, body) {
|
|
991
|
+
const endpoint = `/streams/${organizationId}`;
|
|
992
|
+
const data = await apiClient.fetch(endpoint, {
|
|
993
|
+
method: "PATCH",
|
|
994
|
+
body
|
|
995
|
+
});
|
|
996
|
+
const result = stopStreamOutputSchema.safeParse(data);
|
|
997
|
+
if (!result.success) {
|
|
998
|
+
throw new Error(`Failed to parse stop stream response: ${result.error.message}`);
|
|
999
|
+
}
|
|
1000
|
+
return result.data;
|
|
1001
|
+
}
|
|
984
1002
|
async function deleteStream(organizationId, streamId) {
|
|
985
1003
|
const endpoint = `/streams/${organizationId}/${streamId}`;
|
|
986
1004
|
const data = await apiClient.fetch(endpoint, {
|
|
@@ -993,7 +1011,21 @@ async function deleteStream(organizationId, streamId) {
|
|
|
993
1011
|
return result.data;
|
|
994
1012
|
}
|
|
995
1013
|
|
|
1014
|
+
// src/v2/streams/mutations.ts
|
|
1015
|
+
var streamsMutations = {
|
|
1016
|
+
pauseSnapshotComputation: (input) => pauseStreamSnapshotComputation(input.organizationId, {
|
|
1017
|
+
streamId: input.streamId,
|
|
1018
|
+
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1019
|
+
}),
|
|
1020
|
+
stop: (input) => stopStream(input.organizationId, {
|
|
1021
|
+
streamId: input.streamId,
|
|
1022
|
+
stopStream: input.stopStream
|
|
1023
|
+
}),
|
|
1024
|
+
deleteStream: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1025
|
+
};
|
|
1026
|
+
|
|
996
1027
|
// src/v2/streams/queries.ts
|
|
1028
|
+
import { createQueryKeys as createQueryKeys3 } from "@lukemorales/query-key-factory";
|
|
997
1029
|
var streamsQueries = createQueryKeys3("streams", {
|
|
998
1030
|
list: (query) => ({
|
|
999
1031
|
queryKey: [query ?? "all"],
|
|
@@ -1016,13 +1048,6 @@ var streamsQueries = createQueryKeys3("streams", {
|
|
|
1016
1048
|
queryFn: () => getStreamsSupportedChains()
|
|
1017
1049
|
}
|
|
1018
1050
|
});
|
|
1019
|
-
var streamsMutations = {
|
|
1020
|
-
pauseSnapshotComputation: (input) => pauseStreamSnapshotComputation(input.organizationId, {
|
|
1021
|
-
streamId: input.streamId,
|
|
1022
|
-
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1023
|
-
}),
|
|
1024
|
-
delete: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1025
|
-
};
|
|
1026
1051
|
|
|
1027
1052
|
// src/v2/streams/hooks.ts
|
|
1028
1053
|
function useStreams({
|
|
@@ -1060,9 +1085,15 @@ function usePauseStreamSnapshotComputation(options) {
|
|
|
1060
1085
|
...options
|
|
1061
1086
|
});
|
|
1062
1087
|
}
|
|
1088
|
+
function useStopStream(options) {
|
|
1089
|
+
return useMutation2({
|
|
1090
|
+
mutationFn: streamsMutations.stop,
|
|
1091
|
+
...options
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1063
1094
|
function useDeleteStream(options) {
|
|
1064
1095
|
return useMutation2({
|
|
1065
|
-
mutationFn: streamsMutations.
|
|
1096
|
+
mutationFn: streamsMutations.deleteStream,
|
|
1066
1097
|
...options
|
|
1067
1098
|
});
|
|
1068
1099
|
}
|
|
@@ -4757,7 +4788,6 @@ export {
|
|
|
4757
4788
|
orgUserLeaderboardResponseSchema,
|
|
4758
4789
|
organizationSchema,
|
|
4759
4790
|
organizationsMutations,
|
|
4760
|
-
outputSchema,
|
|
4761
4791
|
paginationSchema,
|
|
4762
4792
|
pauseStreamSnapshotComputation,
|
|
4763
4793
|
pauseStreamSnapshotComputationBodySchema,
|
|
@@ -4786,6 +4816,10 @@ export {
|
|
|
4786
4816
|
snapshotSchema,
|
|
4787
4817
|
stakingConfigSchema,
|
|
4788
4818
|
stepTx,
|
|
4819
|
+
stopStream,
|
|
4820
|
+
stopStreamBodySchema,
|
|
4821
|
+
stopStreamInputSchema,
|
|
4822
|
+
stopStreamOutputSchema,
|
|
4789
4823
|
streamPointSchema,
|
|
4790
4824
|
streamSchema,
|
|
4791
4825
|
streamSignatureRequestInputSchema,
|
|
@@ -4869,6 +4903,7 @@ export {
|
|
|
4869
4903
|
usePortfolioBalance,
|
|
4870
4904
|
useProduct,
|
|
4871
4905
|
useProducts,
|
|
4906
|
+
useStopStream,
|
|
4872
4907
|
useStreamPoints,
|
|
4873
4908
|
useStreamSupportedChains,
|
|
4874
4909
|
useStreamWalletDetails,
|