@turtleclub/hooks 0.5.0-beta.97 → 0.5.0-beta.99
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 +72 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +66 -79
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/src/v2/covers/api.ts +66 -66
- package/src/v2/covers/hooks.ts +38 -38
- package/src/v2/covers/index.ts +16 -16
- package/src/v2/covers/schema.ts +42 -42
- package/src/v2/nfts/api.ts +25 -25
- package/src/v2/nfts/hooks.ts +26 -26
- package/src/v2/nfts/index.ts +13 -13
- package/src/v2/nfts/queries.ts +10 -10
- package/src/v2/nfts/schema.ts +12 -12
- package/src/v2/organizations/schema.ts +1 -1
- package/src/v2/streams/api.ts +8 -30
- package/src/v2/streams/hooks.ts +6 -26
- package/src/v2/streams/mutations.ts +3 -16
- package/src/v2/streams/schemas.ts +67 -50
package/dist/index.cjs
CHANGED
|
@@ -167,10 +167,6 @@ __export(index_exports, {
|
|
|
167
167
|
organizationSchema: () => organizationSchema,
|
|
168
168
|
organizationsMutations: () => organizationsMutations,
|
|
169
169
|
paginationSchema: () => paginationSchema,
|
|
170
|
-
pauseStreamSnapshotComputation: () => pauseStreamSnapshotComputation,
|
|
171
|
-
pauseStreamSnapshotComputationBodySchema: () => pauseStreamSnapshotComputationBodySchema,
|
|
172
|
-
pauseStreamSnapshotComputationInputSchema: () => pauseStreamSnapshotComputationInputSchema,
|
|
173
|
-
pauseStreamSnapshotComputationOutputSchema: () => pauseStreamSnapshotComputationOutputSchema,
|
|
174
170
|
portfolioBalanceResponseSchema: () => portfolioBalanceResponseSchema,
|
|
175
171
|
portfolioHoldingsSchema: () => portfolioHoldingsSchema,
|
|
176
172
|
portfolioSchema: () => portfolioSchema,
|
|
@@ -194,10 +190,6 @@ __export(index_exports, {
|
|
|
194
190
|
snapshotSchema: () => snapshotSchema,
|
|
195
191
|
stakingConfigSchema: () => stakingConfigSchema,
|
|
196
192
|
stepTx: () => stepTx,
|
|
197
|
-
stopStream: () => stopStream,
|
|
198
|
-
stopStreamBodySchema: () => stopStreamBodySchema,
|
|
199
|
-
stopStreamInputSchema: () => stopStreamInputSchema,
|
|
200
|
-
stopStreamOutputSchema: () => stopStreamOutputSchema,
|
|
201
193
|
streamPointSchema: () => streamPointSchema,
|
|
202
194
|
streamSchema: () => streamSchema,
|
|
203
195
|
streamSignatureRequestInputSchema: () => streamSignatureRequestInputSchema,
|
|
@@ -229,6 +221,11 @@ __export(index_exports, {
|
|
|
229
221
|
updateProduct: () => updateProduct,
|
|
230
222
|
updateProductInputSchema: () => updateProductInputSchema,
|
|
231
223
|
updateProductResponseSchema: () => updateProductResponseSchema,
|
|
224
|
+
updateStream: () => updateStream,
|
|
225
|
+
updateStreamBodySchema: () => updateStreamBodySchema,
|
|
226
|
+
updateStreamCustomArgsSchema: () => updateStreamCustomArgsSchema,
|
|
227
|
+
updateStreamInputSchema: () => updateStreamInputSchema,
|
|
228
|
+
updateStreamOutputSchema: () => updateStreamOutputSchema,
|
|
232
229
|
uploadIncentiveIcon: () => uploadIncentiveIcon,
|
|
233
230
|
uploadIncentiveIconRequestSchema: () => uploadIncentiveIconRequestSchema,
|
|
234
231
|
uploadIncentiveIconResponseSchema: () => uploadIncentiveIconResponseSchema,
|
|
@@ -277,11 +274,9 @@ __export(index_exports, {
|
|
|
277
274
|
useOpportunity: () => useOpportunity,
|
|
278
275
|
useOrgLeaderboard: () => useOrgLeaderboard,
|
|
279
276
|
useOrgUserLeaderboard: () => useOrgUserLeaderboard,
|
|
280
|
-
usePauseStreamSnapshotComputation: () => usePauseStreamSnapshotComputation,
|
|
281
277
|
usePortfolioBalance: () => usePortfolioBalance,
|
|
282
278
|
useProduct: () => useProduct,
|
|
283
279
|
useProducts: () => useProducts,
|
|
284
|
-
useStopStream: () => useStopStream,
|
|
285
280
|
useStreamPoints: () => useStreamPoints,
|
|
286
281
|
useStreamSupportedChains: () => useStreamSupportedChains,
|
|
287
282
|
useStreamWalletDetails: () => useStreamWalletDetails,
|
|
@@ -296,6 +291,7 @@ __export(index_exports, {
|
|
|
296
291
|
useUpdateDistributorEarnDetails: () => useUpdateDistributorEarnDetails,
|
|
297
292
|
useUpdateIncentive: () => useUpdateIncentive,
|
|
298
293
|
useUpdateProduct: () => useUpdateProduct,
|
|
294
|
+
useUpdateStream: () => useUpdateStream,
|
|
299
295
|
useUploadIncentiveIcon: () => useUploadIncentiveIcon,
|
|
300
296
|
useUploadProductLogo: () => useUploadProductLogo,
|
|
301
297
|
useUserById: () => useUserById,
|
|
@@ -807,7 +803,7 @@ var organizationSchema = import_zod6.z.object({
|
|
|
807
803
|
import_zod6.z.object({
|
|
808
804
|
id: import_zod6.z.string().uuid(),
|
|
809
805
|
permissionId: import_zod6.z.string().uuid(),
|
|
810
|
-
status: import_zod6.z.enum(["
|
|
806
|
+
status: import_zod6.z.enum(["pending", "approved", "rejected", "revoked"]),
|
|
811
807
|
permissionName: import_zod6.z.string()
|
|
812
808
|
})
|
|
813
809
|
).optional(),
|
|
@@ -915,6 +911,11 @@ var snapshotCustomArgsAprSchema = customArgsBaseSchema.extend({
|
|
|
915
911
|
var snapshotCustomArgsTokensPerDaySchema = customArgsBaseSchema.extend({
|
|
916
912
|
tokensPerDay: import_zod8.z.string()
|
|
917
913
|
});
|
|
914
|
+
var snapshotCustomArgsSchema = import_zod8.z.union([
|
|
915
|
+
snapshotCustomArgsTokensPerUsdSchema,
|
|
916
|
+
snapshotCustomArgsAprSchema,
|
|
917
|
+
snapshotCustomArgsTokensPerDaySchema
|
|
918
|
+
]);
|
|
918
919
|
var streamCustomArgsTokensPerUsdSchema = snapshotCustomArgsTokensPerUsdSchema.extend({
|
|
919
920
|
targetToken: supportedTokenSchema
|
|
920
921
|
});
|
|
@@ -924,6 +925,28 @@ var streamCustomArgsAprSchema = snapshotCustomArgsAprSchema.extend({
|
|
|
924
925
|
var streamCustomArgsTokensPerDaySchema = snapshotCustomArgsTokensPerDaySchema.extend({
|
|
925
926
|
targetToken: supportedTokenSchema
|
|
926
927
|
});
|
|
928
|
+
var streamCustomArgsSchema = import_zod8.z.union([
|
|
929
|
+
streamCustomArgsTokensPerUsdSchema,
|
|
930
|
+
streamCustomArgsAprSchema,
|
|
931
|
+
streamCustomArgsTokensPerDaySchema
|
|
932
|
+
]);
|
|
933
|
+
var updateStreamCustomArgsBaseSchema = import_zod8.z.object({
|
|
934
|
+
targetTokenId: import_zod8.z.string().uuid().optional()
|
|
935
|
+
});
|
|
936
|
+
var updateStreamCustomArgsTokensPerUsdSchema = updateStreamCustomArgsBaseSchema.extend({
|
|
937
|
+
tokensPerUSD: import_zod8.z.string()
|
|
938
|
+
});
|
|
939
|
+
var updateStreamCustomArgsAprSchema = updateStreamCustomArgsBaseSchema.extend({
|
|
940
|
+
apr: import_zod8.z.string()
|
|
941
|
+
});
|
|
942
|
+
var updateStreamCustomArgsTokensPerDaySchema = updateStreamCustomArgsBaseSchema.extend({
|
|
943
|
+
tokensPerDay: import_zod8.z.string()
|
|
944
|
+
});
|
|
945
|
+
var updateStreamCustomArgsSchema = import_zod8.z.union([
|
|
946
|
+
updateStreamCustomArgsTokensPerUsdSchema,
|
|
947
|
+
updateStreamCustomArgsAprSchema,
|
|
948
|
+
updateStreamCustomArgsTokensPerDaySchema
|
|
949
|
+
]);
|
|
927
950
|
var snapshotSchema = import_zod8.z.object({
|
|
928
951
|
amountBase: import_zod8.z.string(),
|
|
929
952
|
amountDistributed: import_zod8.z.string(),
|
|
@@ -939,11 +962,7 @@ var snapshotSchema = import_zod8.z.object({
|
|
|
939
962
|
turtleTvl: import_zod8.z.string().nullable().optional(),
|
|
940
963
|
turtleNetTvl: import_zod8.z.string().nullable().optional(),
|
|
941
964
|
customMetrics: import_zod8.z.record(import_zod8.z.unknown()).optional(),
|
|
942
|
-
customArgs:
|
|
943
|
-
snapshotCustomArgsTokensPerUsdSchema,
|
|
944
|
-
snapshotCustomArgsAprSchema,
|
|
945
|
-
snapshotCustomArgsTokensPerDaySchema
|
|
946
|
-
]).optional()
|
|
965
|
+
customArgs: snapshotCustomArgsSchema.optional()
|
|
947
966
|
});
|
|
948
967
|
var streamPointSchema = import_zod8.z.object({
|
|
949
968
|
id: import_zod8.z.string(),
|
|
@@ -1026,11 +1045,7 @@ var streamSchema = import_zod8.z.object({
|
|
|
1026
1045
|
contractAddress: import_zod8.z.string().nullable(),
|
|
1027
1046
|
createdAt: import_zod8.z.string().datetime(),
|
|
1028
1047
|
creationConfirmedAt: import_zod8.z.string().datetime().nullable(),
|
|
1029
|
-
customArgs:
|
|
1030
|
-
streamCustomArgsTokensPerUsdSchema,
|
|
1031
|
-
streamCustomArgsAprSchema,
|
|
1032
|
-
streamCustomArgsTokensPerDaySchema
|
|
1033
|
-
]),
|
|
1048
|
+
customArgs: streamCustomArgsSchema,
|
|
1034
1049
|
endTimestamp: import_zod8.z.string().datetime().nullable(),
|
|
1035
1050
|
fee: feeSchema.nullable(),
|
|
1036
1051
|
hashCommitmentPaused: import_zod8.z.boolean(),
|
|
@@ -1084,16 +1099,7 @@ var getStreamsSupportedChainsOutputSchema = import_zod8.z.object({
|
|
|
1084
1099
|
var streamSignatureRequestInputSchema = import_zod8.z.object({
|
|
1085
1100
|
adapters: adaptersSchema,
|
|
1086
1101
|
chainId: import_zod8.z.number().nullable(),
|
|
1087
|
-
customArgs:
|
|
1088
|
-
import_zod8.z.object({
|
|
1089
|
-
targetTokenId: import_zod8.z.string().uuid()
|
|
1090
|
-
}),
|
|
1091
|
-
import_zod8.z.union([
|
|
1092
|
-
import_zod8.z.object({ tokensPerUSD: import_zod8.z.string() }),
|
|
1093
|
-
import_zod8.z.object({ apr: import_zod8.z.string() }),
|
|
1094
|
-
import_zod8.z.object({ tokensPerDay: import_zod8.z.string() })
|
|
1095
|
-
])
|
|
1096
|
-
),
|
|
1102
|
+
customArgs: snapshotCustomArgsSchema,
|
|
1097
1103
|
endTimestamp: import_zod8.z.string().nullable(),
|
|
1098
1104
|
pointId: import_zod8.z.string().uuid().nullable(),
|
|
1099
1105
|
rewardToken: import_zod8.z.string().nullable(),
|
|
@@ -1170,24 +1176,32 @@ var streamWalletDetailsSchema = import_zod8.z.object({
|
|
|
1170
1176
|
var getStreamWalletDetailsResponseSchema = import_zod8.z.object({
|
|
1171
1177
|
wallet: streamWalletDetailsSchema
|
|
1172
1178
|
});
|
|
1173
|
-
var
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1179
|
+
var updateStreamMutableFieldsSchema = import_zod8.z.object({
|
|
1180
|
+
customArgs: updateStreamCustomArgsSchema.optional(),
|
|
1181
|
+
snapshotComputationPaused: import_zod8.z.boolean().optional(),
|
|
1182
|
+
merkleTreeComputationPaused: import_zod8.z.boolean().optional(),
|
|
1183
|
+
hashCommitmentPaused: import_zod8.z.boolean().optional(),
|
|
1184
|
+
stopStream: import_zod8.z.boolean().optional(),
|
|
1185
|
+
endTimestamp: import_zod8.z.string().datetime().nullable().optional(),
|
|
1186
|
+
setNilEndTimestamp: import_zod8.z.boolean().optional()
|
|
1181
1187
|
});
|
|
1182
|
-
var
|
|
1183
|
-
|
|
1184
|
-
streamId: import_zod8.z.string().uuid(),
|
|
1185
|
-
stopStream: import_zod8.z.boolean()
|
|
1188
|
+
var updateStreamFieldsSchema = import_zod8.z.object({
|
|
1189
|
+
streamId: import_zod8.z.string().uuid()
|
|
1186
1190
|
});
|
|
1187
|
-
var
|
|
1188
|
-
|
|
1189
|
-
|
|
1191
|
+
var updateStreamBodyBaseSchema = updateStreamFieldsSchema.merge(updateStreamMutableFieldsSchema);
|
|
1192
|
+
var hasUpdateStreamFields = (input) => {
|
|
1193
|
+
return Object.values(input).some((value) => value !== void 0);
|
|
1194
|
+
};
|
|
1195
|
+
var updateStreamBodySchema = updateStreamBodyBaseSchema.refine(
|
|
1196
|
+
({ streamId: _streamId, ...updateFields }) => hasUpdateStreamFields(updateFields),
|
|
1197
|
+
{
|
|
1198
|
+
message: "At least one stream update field must be provided"
|
|
1199
|
+
}
|
|
1200
|
+
);
|
|
1201
|
+
var updateStreamInputBaseSchema = updateStreamBodyBaseSchema.extend({
|
|
1202
|
+
organizationId: import_zod8.z.string().uuid()
|
|
1190
1203
|
});
|
|
1204
|
+
var updateStreamInputSchema = updateStreamInputBaseSchema;
|
|
1191
1205
|
var deleteStreamInputSchema = import_zod8.z.object({
|
|
1192
1206
|
organizationId: import_zod8.z.string().uuid(),
|
|
1193
1207
|
streamId: import_zod8.z.string().uuid()
|
|
@@ -1196,8 +1210,6 @@ var updateStreamOutputSchema = import_zod8.z.object({
|
|
|
1196
1210
|
success: import_zod8.z.boolean(),
|
|
1197
1211
|
message: import_zod8.z.string()
|
|
1198
1212
|
});
|
|
1199
|
-
var pauseStreamSnapshotComputationOutputSchema = updateStreamOutputSchema;
|
|
1200
|
-
var stopStreamOutputSchema = updateStreamOutputSchema;
|
|
1201
1213
|
var deleteStreamOutputSchema = updateStreamOutputSchema;
|
|
1202
1214
|
|
|
1203
1215
|
// src/v2/streams/api.ts
|
|
@@ -1304,27 +1316,15 @@ async function requestStreamSignature(organizationId, input) {
|
|
|
1304
1316
|
}
|
|
1305
1317
|
return result.data;
|
|
1306
1318
|
}
|
|
1307
|
-
async function
|
|
1319
|
+
async function updateStream(organizationId, body) {
|
|
1308
1320
|
const endpoint = `/streams/${organizationId}`;
|
|
1309
1321
|
const data = await apiClient.fetch(endpoint, {
|
|
1310
1322
|
method: "PATCH",
|
|
1311
1323
|
body
|
|
1312
1324
|
});
|
|
1313
|
-
const result =
|
|
1325
|
+
const result = updateStreamOutputSchema.safeParse(data);
|
|
1314
1326
|
if (!result.success) {
|
|
1315
|
-
throw new Error(`Failed to parse
|
|
1316
|
-
}
|
|
1317
|
-
return result.data;
|
|
1318
|
-
}
|
|
1319
|
-
async function stopStream(organizationId, body) {
|
|
1320
|
-
const endpoint = `/streams/${organizationId}`;
|
|
1321
|
-
const data = await apiClient.fetch(endpoint, {
|
|
1322
|
-
method: "PATCH",
|
|
1323
|
-
body
|
|
1324
|
-
});
|
|
1325
|
-
const result = stopStreamOutputSchema.safeParse(data);
|
|
1326
|
-
if (!result.success) {
|
|
1327
|
-
throw new Error(`Failed to parse stop stream response: ${result.error.message}`);
|
|
1327
|
+
throw new Error(`Failed to parse update stream response: ${result.error.message}`);
|
|
1328
1328
|
}
|
|
1329
1329
|
return result.data;
|
|
1330
1330
|
}
|
|
@@ -1342,14 +1342,7 @@ async function deleteStream(organizationId, streamId) {
|
|
|
1342
1342
|
|
|
1343
1343
|
// src/v2/streams/mutations.ts
|
|
1344
1344
|
var streamsMutations = {
|
|
1345
|
-
|
|
1346
|
-
streamId: input.streamId,
|
|
1347
|
-
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1348
|
-
}),
|
|
1349
|
-
stop: (input) => stopStream(input.organizationId, {
|
|
1350
|
-
streamId: input.streamId,
|
|
1351
|
-
stopStream: input.stopStream
|
|
1352
|
-
}),
|
|
1345
|
+
update: ({ organizationId, ...body }) => updateStream(organizationId, body),
|
|
1353
1346
|
deleteStream: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1354
1347
|
};
|
|
1355
1348
|
|
|
@@ -1408,15 +1401,9 @@ function useStreamSupportedChains({
|
|
|
1408
1401
|
} = {}) {
|
|
1409
1402
|
return (0, import_react_query4.useQuery)(createQueryOptions(streamsQueries.supportedChains, options));
|
|
1410
1403
|
}
|
|
1411
|
-
function
|
|
1412
|
-
return (0, import_react_query4.useMutation)({
|
|
1413
|
-
mutationFn: streamsMutations.pauseSnapshotComputation,
|
|
1414
|
-
...options
|
|
1415
|
-
});
|
|
1416
|
-
}
|
|
1417
|
-
function useStopStream(options) {
|
|
1404
|
+
function useUpdateStream(options) {
|
|
1418
1405
|
return (0, import_react_query4.useMutation)({
|
|
1419
|
-
mutationFn: streamsMutations.
|
|
1406
|
+
mutationFn: streamsMutations.update,
|
|
1420
1407
|
...options
|
|
1421
1408
|
});
|
|
1422
1409
|
}
|
|
@@ -5116,10 +5103,6 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5116
5103
|
organizationSchema,
|
|
5117
5104
|
organizationsMutations,
|
|
5118
5105
|
paginationSchema,
|
|
5119
|
-
pauseStreamSnapshotComputation,
|
|
5120
|
-
pauseStreamSnapshotComputationBodySchema,
|
|
5121
|
-
pauseStreamSnapshotComputationInputSchema,
|
|
5122
|
-
pauseStreamSnapshotComputationOutputSchema,
|
|
5123
5106
|
portfolioBalanceResponseSchema,
|
|
5124
5107
|
portfolioHoldingsSchema,
|
|
5125
5108
|
portfolioSchema,
|
|
@@ -5143,10 +5126,6 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5143
5126
|
snapshotSchema,
|
|
5144
5127
|
stakingConfigSchema,
|
|
5145
5128
|
stepTx,
|
|
5146
|
-
stopStream,
|
|
5147
|
-
stopStreamBodySchema,
|
|
5148
|
-
stopStreamInputSchema,
|
|
5149
|
-
stopStreamOutputSchema,
|
|
5150
5129
|
streamPointSchema,
|
|
5151
5130
|
streamSchema,
|
|
5152
5131
|
streamSignatureRequestInputSchema,
|
|
@@ -5178,6 +5157,11 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5178
5157
|
updateProduct,
|
|
5179
5158
|
updateProductInputSchema,
|
|
5180
5159
|
updateProductResponseSchema,
|
|
5160
|
+
updateStream,
|
|
5161
|
+
updateStreamBodySchema,
|
|
5162
|
+
updateStreamCustomArgsSchema,
|
|
5163
|
+
updateStreamInputSchema,
|
|
5164
|
+
updateStreamOutputSchema,
|
|
5181
5165
|
uploadIncentiveIcon,
|
|
5182
5166
|
uploadIncentiveIconRequestSchema,
|
|
5183
5167
|
uploadIncentiveIconResponseSchema,
|
|
@@ -5226,11 +5210,9 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5226
5210
|
useOpportunity,
|
|
5227
5211
|
useOrgLeaderboard,
|
|
5228
5212
|
useOrgUserLeaderboard,
|
|
5229
|
-
usePauseStreamSnapshotComputation,
|
|
5230
5213
|
usePortfolioBalance,
|
|
5231
5214
|
useProduct,
|
|
5232
5215
|
useProducts,
|
|
5233
|
-
useStopStream,
|
|
5234
5216
|
useStreamPoints,
|
|
5235
5217
|
useStreamSupportedChains,
|
|
5236
5218
|
useStreamWalletDetails,
|
|
@@ -5245,6 +5227,7 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5245
5227
|
useUpdateDistributorEarnDetails,
|
|
5246
5228
|
useUpdateIncentive,
|
|
5247
5229
|
useUpdateProduct,
|
|
5230
|
+
useUpdateStream,
|
|
5248
5231
|
useUploadIncentiveIcon,
|
|
5249
5232
|
useUploadProductLogo,
|
|
5250
5233
|
useUserById,
|