@turtleclub/hooks 0.5.0-beta.35 → 0.5.0-beta.37

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 CHANGED
@@ -51,6 +51,9 @@ __export(index_exports, {
51
51
  createMembershipAgreement: () => createMembershipAgreement,
52
52
  createMembershipRequestSchema: () => createMembershipRequestSchema,
53
53
  createMembershipResponseSchema: () => createMembershipResponseSchema,
54
+ createStreamPoint: () => createStreamPoint,
55
+ createStreamPointBodySchema: () => createStreamPointBodySchema,
56
+ createStreamPointOutputSchema: () => createStreamPointOutputSchema,
54
57
  createWithdrawAction: () => createWithdrawAction,
55
58
  createWithdrawInteraction: () => createWithdrawInteraction,
56
59
  depositSchema: () => depositSchema,
@@ -87,6 +90,9 @@ __export(index_exports, {
87
90
  getPortfolioBalance: () => getPortfolioBalance,
88
91
  getProducts: () => getProducts,
89
92
  getSourcePriority: () => getSourcePriority,
93
+ getStreamPoints: () => getStreamPoints,
94
+ getStreamPointsOutputSchema: () => getStreamPointsOutputSchema,
95
+ getStreamPointsQuerySchema: () => getStreamPointsQuerySchema,
90
96
  getStreamWalletDetails: () => getStreamWalletDetails,
91
97
  getStreamWalletDetailsResponseSchema: () => getStreamWalletDetailsResponseSchema,
92
98
  getStreamWallets: () => getStreamWallets,
@@ -135,6 +141,7 @@ __export(index_exports, {
135
141
  routerSubstep: () => routerSubstep,
136
142
  snapshotSchema: () => snapshotSchema,
137
143
  stepTx: () => stepTx,
144
+ streamPointSchema: () => streamPointSchema,
138
145
  streamSchema: () => streamSchema,
139
146
  streamSignatureRequestInputSchema: () => streamSignatureRequestInputSchema,
140
147
  streamSignatureRequestOutputSchema: () => streamSignatureRequestOutputSchema,
@@ -182,7 +189,7 @@ __export(index_exports, {
182
189
  usePortfolioBalance: () => usePortfolioBalance,
183
190
  useProduct: () => useProduct,
184
191
  useProducts: () => useProducts,
185
- useRequestStreamSignature: () => useRequestStreamSignature,
192
+ useStreamPoints: () => useStreamPoints,
186
193
  useStreamSupportedChains: () => useStreamSupportedChains,
187
194
  useStreamWalletDetails: () => useStreamWalletDetails,
188
195
  useStreamWallets: () => useStreamWallets,
@@ -1255,6 +1262,16 @@ var snapshotSchema = import_zod10.z.object({
1255
1262
  userCount: import_zod10.z.number().nullable().optional(),
1256
1263
  tvl: import_zod10.z.string().nullable().optional()
1257
1264
  });
1265
+ var streamPointSchema = import_zod10.z.object({
1266
+ id: import_zod10.z.string(),
1267
+ orgId: import_zod10.z.string().optional(),
1268
+ symbol: import_zod10.z.string(),
1269
+ name: import_zod10.z.string(),
1270
+ decimals: import_zod10.z.coerce.number().optional(),
1271
+ logoUrl: import_zod10.z.string().url().nullable().optional(),
1272
+ createdAt: import_zod10.z.string().optional(),
1273
+ updatedAt: import_zod10.z.string().optional()
1274
+ });
1258
1275
  var customArgsTokensPerUsdSchema = import_zod10.z.object({
1259
1276
  tokensPerUSD: import_zod10.z.string(),
1260
1277
  targetChainId: import_zod10.z.number(),
@@ -1290,7 +1307,14 @@ var rewardTokenSchema = import_zod10.z.object({
1290
1307
  symbol: import_zod10.z.string(),
1291
1308
  streamsMinAmount: import_zod10.z.string().nullable().optional()
1292
1309
  }).nullable();
1310
+ var adaptersSchema = import_zod10.z.array(
1311
+ import_zod10.z.object({
1312
+ type: import_zod10.z.string(),
1313
+ params: import_zod10.z.record(import_zod10.z.string(), import_zod10.z.number())
1314
+ })
1315
+ );
1293
1316
  var streamSchema = import_zod10.z.object({
1317
+ adapters: adaptersSchema,
1294
1318
  admin: import_zod10.z.string().nullable(),
1295
1319
  chainId: import_zod10.z.number().nullable(),
1296
1320
  chargedFee: import_zod10.z.string().nullable(),
@@ -1318,6 +1342,18 @@ var streamSchema = import_zod10.z.object({
1318
1342
  var getStreamsOutputSchema = import_zod10.z.object({
1319
1343
  streams: import_zod10.z.array(streamSchema)
1320
1344
  });
1345
+ var getStreamPointsOutputSchema = import_zod10.z.object({
1346
+ points: import_zod10.z.array(streamPointSchema)
1347
+ });
1348
+ var createStreamPointBodySchema = import_zod10.z.object({
1349
+ name: import_zod10.z.string(),
1350
+ symbol: import_zod10.z.string(),
1351
+ decimals: import_zod10.z.number().optional(),
1352
+ logoUrl: import_zod10.z.string().url().nullable().optional()
1353
+ });
1354
+ var createStreamPointOutputSchema = import_zod10.z.object({
1355
+ point: streamPointSchema
1356
+ });
1321
1357
  var getStreamsSupportedChainsOutputSchema = import_zod10.z.object({
1322
1358
  success: import_zod10.z.boolean(),
1323
1359
  chains: import_zod10.z.array(
@@ -1336,6 +1372,7 @@ var getStreamsSupportedChainsOutputSchema = import_zod10.z.object({
1336
1372
  )
1337
1373
  });
1338
1374
  var streamSignatureRequestInputSchema = import_zod10.z.object({
1375
+ adapters: adaptersSchema,
1339
1376
  chainId: import_zod10.z.number().nullable(),
1340
1377
  customArgs: import_zod10.z.intersection(
1341
1378
  import_zod10.z.object({
@@ -1345,6 +1382,7 @@ var streamSignatureRequestInputSchema = import_zod10.z.object({
1345
1382
  import_zod10.z.union([import_zod10.z.object({ tokensPerUSD: import_zod10.z.string() }), import_zod10.z.object({ apr: import_zod10.z.string() })])
1346
1383
  ),
1347
1384
  endTimestamp: import_zod10.z.string().nullable(),
1385
+ pointId: import_zod10.z.string().uuid().nullable(),
1348
1386
  rewardToken: import_zod10.z.string().nullable(),
1349
1387
  startTimestamp: import_zod10.z.string(),
1350
1388
  totalAmount: import_zod10.z.string().nullable(),
@@ -1376,6 +1414,12 @@ var getStreamsQuerySchema = import_zod10.z.object({
1376
1414
  withSnapshots: import_zod10.z.boolean().optional(),
1377
1415
  usersCount: import_zod10.z.boolean().optional()
1378
1416
  });
1417
+ var getStreamPointsQuerySchema = import_zod10.z.object({
1418
+ id: import_zod10.z.string().optional().nullable(),
1419
+ organizationId: import_zod10.z.string().optional().nullable(),
1420
+ symbol: import_zod10.z.string().optional().nullable(),
1421
+ name: import_zod10.z.string().optional().nullable()
1422
+ });
1379
1423
  var streamWalletSnapshotSchema = import_zod10.z.object({
1380
1424
  timestamp: import_zod10.z.string().datetime(),
1381
1425
  rewardsAccumulated: import_zod10.z.string(),
@@ -1434,6 +1478,37 @@ async function getStreams(query) {
1434
1478
  }
1435
1479
  return result.data.streams;
1436
1480
  }
1481
+ async function getStreamPoints(query) {
1482
+ const params = new URLSearchParams();
1483
+ if (query?.id) params.set("id", query.id);
1484
+ if (query?.organizationId) params.set("organizationId", query.organizationId);
1485
+ if (query?.symbol) params.set("symbol", query.symbol);
1486
+ if (query?.name) params.set("name", query.name);
1487
+ const queryString = params.toString();
1488
+ const endpoint = `/streams/points${queryString ? `?${queryString}` : ""}`;
1489
+ const data = await apiClient.fetch(endpoint, { method: "GET" });
1490
+ const result = getStreamPointsOutputSchema.safeParse(data);
1491
+ if (!result.success) {
1492
+ console.error(
1493
+ "Zod Validation Error in getStreamPoints:",
1494
+ JSON.stringify(result.error.format(), null, 2)
1495
+ );
1496
+ throw new Error(`Failed to parse stream points: ${result.error.message}`);
1497
+ }
1498
+ return result.data.points;
1499
+ }
1500
+ async function createStreamPoint(organizationId, body) {
1501
+ const endpoint = `/streams/points/${organizationId}`;
1502
+ const data = await apiClient.fetch(endpoint, {
1503
+ method: "POST",
1504
+ body
1505
+ });
1506
+ const result = createStreamPointOutputSchema.safeParse(data);
1507
+ if (!result.success) {
1508
+ throw new Error(`Failed to parse create point response: ${result.error.message}`);
1509
+ }
1510
+ return result.data;
1511
+ }
1437
1512
  async function getStreamWallets(query) {
1438
1513
  const params = new URLSearchParams();
1439
1514
  if (query?.page) params.set("page", query.page.toString());
@@ -1474,7 +1549,7 @@ async function getStreamsSupportedChains() {
1474
1549
  return result.data.chains;
1475
1550
  }
1476
1551
  async function requestStreamSignature(organizationId, input) {
1477
- const endpoint = `/streams/request_signature/${organizationId}`;
1552
+ const endpoint = `/streams/create/${organizationId}`;
1478
1553
  const data = await apiClient.fetch(endpoint, {
1479
1554
  method: "POST",
1480
1555
  body: input
@@ -1492,6 +1567,10 @@ var streamsQueries = (0, import_query_key_factory10.createQueryKeys)("streams",
1492
1567
  queryKey: [query ?? "all"],
1493
1568
  queryFn: () => getStreams(query)
1494
1569
  }),
1570
+ points: (query) => ({
1571
+ queryKey: [query ?? "all"],
1572
+ queryFn: () => getStreamPoints(query)
1573
+ }),
1495
1574
  wallets: (query) => ({
1496
1575
  queryKey: [query],
1497
1576
  queryFn: () => getStreamWallets(query)
@@ -2605,6 +2684,12 @@ function useStreams({
2605
2684
  } = {}) {
2606
2685
  return (0, import_react_query14.useQuery)(createQueryOptions(streamsQueries.list(query), options));
2607
2686
  }
2687
+ function useStreamPoints({
2688
+ query,
2689
+ options
2690
+ } = {}) {
2691
+ return (0, import_react_query14.useQuery)(createQueryOptions(streamsQueries.points(query), options));
2692
+ }
2608
2693
  function useStreamWallets({
2609
2694
  query,
2610
2695
  options
@@ -2622,14 +2707,6 @@ function useStreamSupportedChains({
2622
2707
  } = {}) {
2623
2708
  return (0, import_react_query14.useQuery)(createQueryOptions(streamsQueries.supportedChains, options));
2624
2709
  }
2625
- function useRequestStreamSignature({
2626
- options
2627
- } = {}) {
2628
- return (0, import_react_query14.useMutation)({
2629
- mutationFn: ({ organizationId, data }) => requestStreamSignature(organizationId, data),
2630
- ...options
2631
- });
2632
- }
2633
2710
 
2634
2711
  // src/v2/swap/useSwapRoute.ts
2635
2712
  var import_react8 = require("react");
@@ -2865,6 +2942,9 @@ var queries = (0, import_query_key_factory16.mergeQueryKeys)(
2865
2942
  createMembershipAgreement,
2866
2943
  createMembershipRequestSchema,
2867
2944
  createMembershipResponseSchema,
2945
+ createStreamPoint,
2946
+ createStreamPointBodySchema,
2947
+ createStreamPointOutputSchema,
2868
2948
  createWithdrawAction,
2869
2949
  createWithdrawInteraction,
2870
2950
  depositSchema,
@@ -2901,6 +2981,9 @@ var queries = (0, import_query_key_factory16.mergeQueryKeys)(
2901
2981
  getPortfolioBalance,
2902
2982
  getProducts,
2903
2983
  getSourcePriority,
2984
+ getStreamPoints,
2985
+ getStreamPointsOutputSchema,
2986
+ getStreamPointsQuerySchema,
2904
2987
  getStreamWalletDetails,
2905
2988
  getStreamWalletDetailsResponseSchema,
2906
2989
  getStreamWallets,
@@ -2949,6 +3032,7 @@ var queries = (0, import_query_key_factory16.mergeQueryKeys)(
2949
3032
  routerSubstep,
2950
3033
  snapshotSchema,
2951
3034
  stepTx,
3035
+ streamPointSchema,
2952
3036
  streamSchema,
2953
3037
  streamSignatureRequestInputSchema,
2954
3038
  streamSignatureRequestOutputSchema,
@@ -2996,7 +3080,7 @@ var queries = (0, import_query_key_factory16.mergeQueryKeys)(
2996
3080
  usePortfolioBalance,
2997
3081
  useProduct,
2998
3082
  useProducts,
2999
- useRequestStreamSignature,
3083
+ useStreamPoints,
3000
3084
  useStreamSupportedChains,
3001
3085
  useStreamWalletDetails,
3002
3086
  useStreamWallets,