@turtleclub/hooks 0.5.0-beta.89 → 0.5.0-beta.90
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 +83 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +93 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/v2/streams/api.ts +39 -0
- package/src/v2/streams/hooks.ts +36 -2
- package/src/v2/streams/queries.ts +18 -1
- package/src/v2/streams/schemas.ts +36 -0
package/dist/index.cjs
CHANGED
|
@@ -69,6 +69,9 @@ __export(index_exports, {
|
|
|
69
69
|
createWithdrawInteraction: () => createWithdrawInteraction,
|
|
70
70
|
deleteIncentive: () => deleteIncentive,
|
|
71
71
|
deleteProduct: () => deleteProduct,
|
|
72
|
+
deleteStream: () => deleteStream,
|
|
73
|
+
deleteStreamInputSchema: () => deleteStreamInputSchema,
|
|
74
|
+
deleteStreamOutputSchema: () => deleteStreamOutputSchema,
|
|
72
75
|
depositSchema: () => depositSchema,
|
|
73
76
|
depositSubstep: () => depositSubstep,
|
|
74
77
|
depositsResponseSchema: () => depositsResponseSchema,
|
|
@@ -163,7 +166,12 @@ __export(index_exports, {
|
|
|
163
166
|
orgUserLeaderboardResponseSchema: () => orgUserLeaderboardResponseSchema,
|
|
164
167
|
organizationSchema: () => organizationSchema,
|
|
165
168
|
organizationsMutations: () => organizationsMutations,
|
|
169
|
+
outputSchema: () => outputSchema,
|
|
166
170
|
paginationSchema: () => paginationSchema,
|
|
171
|
+
pauseStreamSnapshotComputation: () => pauseStreamSnapshotComputation,
|
|
172
|
+
pauseStreamSnapshotComputationBodySchema: () => pauseStreamSnapshotComputationBodySchema,
|
|
173
|
+
pauseStreamSnapshotComputationInputSchema: () => pauseStreamSnapshotComputationInputSchema,
|
|
174
|
+
pauseStreamSnapshotComputationOutputSchema: () => pauseStreamSnapshotComputationOutputSchema,
|
|
167
175
|
portfolioBalanceResponseSchema: () => portfolioBalanceResponseSchema,
|
|
168
176
|
portfolioHoldingsSchema: () => portfolioHoldingsSchema,
|
|
169
177
|
portfolioSchema: () => portfolioSchema,
|
|
@@ -194,6 +202,7 @@ __export(index_exports, {
|
|
|
194
202
|
streamWalletDetailsSchema: () => streamWalletDetailsSchema,
|
|
195
203
|
streamWalletSchema: () => streamWalletSchema,
|
|
196
204
|
streamWalletSnapshotSchema: () => streamWalletSnapshotSchema,
|
|
205
|
+
streamsMutations: () => streamsMutations,
|
|
197
206
|
streamsQueries: () => streamsQueries,
|
|
198
207
|
submitCoverPurchase: () => submitCoverPurchase,
|
|
199
208
|
submitCoverPurchaseDataSchema: () => submitCoverPurchaseDataSchema,
|
|
@@ -241,6 +250,7 @@ __export(index_exports, {
|
|
|
241
250
|
useCreateWithdrawInteraction: () => useCreateWithdrawInteraction,
|
|
242
251
|
useDeleteIncentive: () => useDeleteIncentive,
|
|
243
252
|
useDeleteProduct: () => useDeleteProduct,
|
|
253
|
+
useDeleteStream: () => useDeleteStream,
|
|
244
254
|
useDepositAction: () => useDepositAction,
|
|
245
255
|
useDepositFlow: () => useDepositFlow,
|
|
246
256
|
useDepositSelection: () => useDepositSelection,
|
|
@@ -264,6 +274,7 @@ __export(index_exports, {
|
|
|
264
274
|
useOpportunity: () => useOpportunity,
|
|
265
275
|
useOrgLeaderboard: () => useOrgLeaderboard,
|
|
266
276
|
useOrgUserLeaderboard: () => useOrgUserLeaderboard,
|
|
277
|
+
usePauseStreamSnapshotComputation: () => usePauseStreamSnapshotComputation,
|
|
267
278
|
usePortfolioBalance: () => usePortfolioBalance,
|
|
268
279
|
useProduct: () => useProduct,
|
|
269
280
|
useProducts: () => useProducts,
|
|
@@ -1142,6 +1153,25 @@ var streamWalletDetailsSchema = import_zod8.z.object({
|
|
|
1142
1153
|
var getStreamWalletDetailsResponseSchema = import_zod8.z.object({
|
|
1143
1154
|
wallet: streamWalletDetailsSchema
|
|
1144
1155
|
});
|
|
1156
|
+
var pauseStreamSnapshotComputationInputSchema = import_zod8.z.object({
|
|
1157
|
+
organizationId: import_zod8.z.string().uuid(),
|
|
1158
|
+
streamId: import_zod8.z.string().uuid(),
|
|
1159
|
+
snapshotComputationPaused: import_zod8.z.boolean()
|
|
1160
|
+
});
|
|
1161
|
+
var pauseStreamSnapshotComputationBodySchema = import_zod8.z.object({
|
|
1162
|
+
streamId: import_zod8.z.string().uuid(),
|
|
1163
|
+
snapshotComputationPaused: import_zod8.z.boolean()
|
|
1164
|
+
});
|
|
1165
|
+
var outputSchema = import_zod8.z.object({
|
|
1166
|
+
success: import_zod8.z.boolean(),
|
|
1167
|
+
message: import_zod8.z.string()
|
|
1168
|
+
});
|
|
1169
|
+
var pauseStreamSnapshotComputationOutputSchema = outputSchema;
|
|
1170
|
+
var deleteStreamInputSchema = import_zod8.z.object({
|
|
1171
|
+
organizationId: import_zod8.z.string().uuid(),
|
|
1172
|
+
streamId: import_zod8.z.string().uuid()
|
|
1173
|
+
});
|
|
1174
|
+
var deleteStreamOutputSchema = outputSchema;
|
|
1145
1175
|
|
|
1146
1176
|
// src/v2/streams/api.ts
|
|
1147
1177
|
async function getStreams(query) {
|
|
@@ -1247,6 +1277,29 @@ async function requestStreamSignature(organizationId, input) {
|
|
|
1247
1277
|
}
|
|
1248
1278
|
return result.data;
|
|
1249
1279
|
}
|
|
1280
|
+
async function pauseStreamSnapshotComputation(organizationId, body) {
|
|
1281
|
+
const endpoint = `/streams/${organizationId}`;
|
|
1282
|
+
const data = await apiClient.fetch(endpoint, {
|
|
1283
|
+
method: "PATCH",
|
|
1284
|
+
body
|
|
1285
|
+
});
|
|
1286
|
+
const result = pauseStreamSnapshotComputationOutputSchema.safeParse(data);
|
|
1287
|
+
if (!result.success) {
|
|
1288
|
+
throw new Error(`Failed to parse pause stream snapshot response: ${result.error.message}`);
|
|
1289
|
+
}
|
|
1290
|
+
return result.data;
|
|
1291
|
+
}
|
|
1292
|
+
async function deleteStream(organizationId, streamId) {
|
|
1293
|
+
const endpoint = `/streams/${organizationId}/${streamId}`;
|
|
1294
|
+
const data = await apiClient.fetch(endpoint, {
|
|
1295
|
+
method: "DELETE"
|
|
1296
|
+
});
|
|
1297
|
+
const result = deleteStreamOutputSchema.safeParse(data);
|
|
1298
|
+
if (!result.success) {
|
|
1299
|
+
throw new Error(`Failed to parse delete stream response: ${result.error.message}`);
|
|
1300
|
+
}
|
|
1301
|
+
return result.data;
|
|
1302
|
+
}
|
|
1250
1303
|
|
|
1251
1304
|
// src/v2/streams/queries.ts
|
|
1252
1305
|
var streamsQueries = (0, import_query_key_factory3.createQueryKeys)("streams", {
|
|
@@ -1271,6 +1324,13 @@ var streamsQueries = (0, import_query_key_factory3.createQueryKeys)("streams", {
|
|
|
1271
1324
|
queryFn: () => getStreamsSupportedChains()
|
|
1272
1325
|
}
|
|
1273
1326
|
});
|
|
1327
|
+
var streamsMutations = {
|
|
1328
|
+
pauseSnapshotComputation: (input) => pauseStreamSnapshotComputation(input.organizationId, {
|
|
1329
|
+
streamId: input.streamId,
|
|
1330
|
+
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1331
|
+
}),
|
|
1332
|
+
delete: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1333
|
+
};
|
|
1274
1334
|
|
|
1275
1335
|
// src/v2/streams/hooks.ts
|
|
1276
1336
|
function useStreams({
|
|
@@ -1302,6 +1362,18 @@ function useStreamSupportedChains({
|
|
|
1302
1362
|
} = {}) {
|
|
1303
1363
|
return (0, import_react_query4.useQuery)(createQueryOptions(streamsQueries.supportedChains, options));
|
|
1304
1364
|
}
|
|
1365
|
+
function usePauseStreamSnapshotComputation(options) {
|
|
1366
|
+
return (0, import_react_query4.useMutation)({
|
|
1367
|
+
mutationFn: streamsMutations.pauseSnapshotComputation,
|
|
1368
|
+
...options
|
|
1369
|
+
});
|
|
1370
|
+
}
|
|
1371
|
+
function useDeleteStream(options) {
|
|
1372
|
+
return (0, import_react_query4.useMutation)({
|
|
1373
|
+
mutationFn: streamsMutations.delete,
|
|
1374
|
+
...options
|
|
1375
|
+
});
|
|
1376
|
+
}
|
|
1305
1377
|
|
|
1306
1378
|
// src/v2/opportunities/schema.ts
|
|
1307
1379
|
var opportunityTypeEnum = import_zod9.z.enum(["vault", "lending", "staking", "stablecoin", "draft", ""]);
|
|
@@ -4891,6 +4963,9 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
4891
4963
|
createWithdrawInteraction,
|
|
4892
4964
|
deleteIncentive,
|
|
4893
4965
|
deleteProduct,
|
|
4966
|
+
deleteStream,
|
|
4967
|
+
deleteStreamInputSchema,
|
|
4968
|
+
deleteStreamOutputSchema,
|
|
4894
4969
|
depositSchema,
|
|
4895
4970
|
depositSubstep,
|
|
4896
4971
|
depositsResponseSchema,
|
|
@@ -4985,7 +5060,12 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
4985
5060
|
orgUserLeaderboardResponseSchema,
|
|
4986
5061
|
organizationSchema,
|
|
4987
5062
|
organizationsMutations,
|
|
5063
|
+
outputSchema,
|
|
4988
5064
|
paginationSchema,
|
|
5065
|
+
pauseStreamSnapshotComputation,
|
|
5066
|
+
pauseStreamSnapshotComputationBodySchema,
|
|
5067
|
+
pauseStreamSnapshotComputationInputSchema,
|
|
5068
|
+
pauseStreamSnapshotComputationOutputSchema,
|
|
4989
5069
|
portfolioBalanceResponseSchema,
|
|
4990
5070
|
portfolioHoldingsSchema,
|
|
4991
5071
|
portfolioSchema,
|
|
@@ -5016,6 +5096,7 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5016
5096
|
streamWalletDetailsSchema,
|
|
5017
5097
|
streamWalletSchema,
|
|
5018
5098
|
streamWalletSnapshotSchema,
|
|
5099
|
+
streamsMutations,
|
|
5019
5100
|
streamsQueries,
|
|
5020
5101
|
submitCoverPurchase,
|
|
5021
5102
|
submitCoverPurchaseDataSchema,
|
|
@@ -5063,6 +5144,7 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5063
5144
|
useCreateWithdrawInteraction,
|
|
5064
5145
|
useDeleteIncentive,
|
|
5065
5146
|
useDeleteProduct,
|
|
5147
|
+
useDeleteStream,
|
|
5066
5148
|
useDepositAction,
|
|
5067
5149
|
useDepositFlow,
|
|
5068
5150
|
useDepositSelection,
|
|
@@ -5086,6 +5168,7 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5086
5168
|
useOpportunity,
|
|
5087
5169
|
useOrgLeaderboard,
|
|
5088
5170
|
useOrgUserLeaderboard,
|
|
5171
|
+
usePauseStreamSnapshotComputation,
|
|
5089
5172
|
usePortfolioBalance,
|
|
5090
5173
|
useProduct,
|
|
5091
5174
|
useProducts,
|