@sodax/dapp-kit 1.0.1-beta → 1.0.2-beta

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.
Files changed (40) hide show
  1. package/README.md +130 -39
  2. package/dist/index.d.mts +541 -347
  3. package/dist/index.d.ts +541 -347
  4. package/dist/index.js +317 -176
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +315 -178
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +3 -3
  9. package/src/hooks/backend/README.md +148 -49
  10. package/src/hooks/backend/index.ts +2 -0
  11. package/src/hooks/backend/types.ts +4 -0
  12. package/src/hooks/backend/useBackendAllMoneyMarketAssets.ts +31 -20
  13. package/src/hooks/backend/useBackendAllMoneyMarketBorrowers.ts +25 -7
  14. package/src/hooks/backend/useBackendIntentByHash.ts +36 -26
  15. package/src/hooks/backend/useBackendIntentByTxHash.ts +41 -29
  16. package/src/hooks/backend/useBackendMoneyMarketAsset.ts +40 -27
  17. package/src/hooks/backend/useBackendMoneyMarketAssetBorrowers.ts +45 -36
  18. package/src/hooks/backend/useBackendMoneyMarketAssetSuppliers.ts +45 -36
  19. package/src/hooks/backend/useBackendMoneyMarketPosition.ts +34 -37
  20. package/src/hooks/backend/useBackendOrderbook.ts +38 -38
  21. package/src/hooks/backend/useBackendUserIntents.ts +81 -0
  22. package/src/hooks/mm/index.ts +1 -0
  23. package/src/hooks/mm/useAToken.ts +37 -20
  24. package/src/hooks/mm/useBorrow.ts +36 -36
  25. package/src/hooks/mm/useMMAllowance.ts +33 -24
  26. package/src/hooks/mm/useMMApprove.ts +43 -48
  27. package/src/hooks/mm/useRepay.ts +32 -36
  28. package/src/hooks/mm/useReservesData.ts +35 -16
  29. package/src/hooks/mm/useReservesHumanized.ts +15 -3
  30. package/src/hooks/mm/useReservesList.ts +28 -15
  31. package/src/hooks/mm/useReservesUsdFormat.ts +30 -21
  32. package/src/hooks/mm/useSupply.ts +34 -36
  33. package/src/hooks/mm/useUserFormattedSummary.ts +42 -20
  34. package/src/hooks/mm/useUserReservesData.ts +34 -19
  35. package/src/hooks/mm/useWithdraw.ts +33 -35
  36. package/src/hooks/swap/index.ts +2 -0
  37. package/src/hooks/swap/useCancelLimitOrder.ts +53 -0
  38. package/src/hooks/swap/useCreateLimitOrder.ts +72 -0
  39. package/src/hooks/swap/useSwapAllowance.ts +7 -7
  40. package/src/hooks/swap/useSwapApprove.ts +6 -6
package/dist/index.js CHANGED
@@ -181,218 +181,236 @@ function useSpokeProvider(spokeChainId, walletProvider) {
181
181
  }, [spokeChainId, xChainType, walletProvider, rpcConfig]);
182
182
  return spokeProvider;
183
183
  }
184
- function useBorrow(spokeToken, spokeProvider) {
184
+ function useBorrow() {
185
185
  const { sodax } = useSodaxContext();
186
186
  return reactQuery.useMutation({
187
- mutationFn: async (amount, toChainId, toAddress) => {
187
+ mutationFn: async ({ params, spokeProvider }) => {
188
188
  if (!spokeProvider) {
189
189
  throw new Error("spokeProvider is not found");
190
190
  }
191
- const response = await sodax.moneyMarket.borrow(
192
- {
193
- token: spokeToken.address,
194
- amount: viem.parseUnits(amount, 18),
195
- action: "borrow",
196
- toChainId,
197
- toAddress
198
- },
199
- spokeProvider
200
- );
191
+ const response = await sodax.moneyMarket.borrow(params, spokeProvider);
201
192
  if (!response.ok) {
202
- throw new Error("Failed to borrow tokens");
193
+ throw response.error;
203
194
  }
204
- console.log("Borrow transaction submitted:", response);
205
195
  return response;
206
196
  }
207
197
  });
208
198
  }
209
- function useRepay(spokeToken, spokeProvider) {
199
+ function useRepay() {
210
200
  const { sodax } = useSodaxContext();
211
201
  return reactQuery.useMutation({
212
- mutationFn: async (amount, toChainId, toAddress) => {
202
+ mutationFn: async ({ params, spokeProvider }) => {
213
203
  if (!spokeProvider) {
214
204
  throw new Error("spokeProvider is not found");
215
205
  }
216
- const response = await sodax.moneyMarket.repay(
217
- {
218
- token: spokeToken.address,
219
- amount: viem.parseUnits(amount, spokeToken.decimals),
220
- action: "repay",
221
- toChainId,
222
- toAddress
223
- },
224
- spokeProvider
225
- );
206
+ const response = await sodax.moneyMarket.repay(params, spokeProvider);
226
207
  if (!response.ok) {
227
- throw new Error("Failed to repay tokens");
208
+ throw response.error;
228
209
  }
229
- console.log("Repay transaction submitted:", response);
230
210
  return response;
231
211
  }
232
212
  });
233
213
  }
234
- function useSupply(spokeToken, spokeProvider) {
214
+ function useSupply() {
235
215
  const { sodax } = useSodaxContext();
236
216
  return reactQuery.useMutation({
237
- mutationFn: async (amount, toChainId, toAddress) => {
217
+ mutationFn: async ({ params, spokeProvider }) => {
238
218
  if (!spokeProvider) {
239
219
  throw new Error("spokeProvider is not found");
240
220
  }
241
- const response = await sodax.moneyMarket.supply(
242
- {
243
- token: spokeToken.address,
244
- amount: viem.parseUnits(amount, spokeToken.decimals),
245
- action: "supply",
246
- toChainId,
247
- toAddress
248
- },
249
- spokeProvider
250
- );
221
+ const response = await sodax.moneyMarket.supply(params, spokeProvider);
251
222
  if (!response.ok) {
252
- throw new Error("Failed to supply tokens");
223
+ throw response.error;
253
224
  }
254
- console.log("Supply transaction submitted:", response);
255
225
  return response;
256
226
  }
257
227
  });
258
228
  }
259
- function useWithdraw(spokeToken, spokeProvider) {
229
+ function useWithdraw() {
260
230
  const { sodax } = useSodaxContext();
261
231
  return reactQuery.useMutation({
262
- mutationFn: async (amount, toChainId, toAddress) => {
232
+ mutationFn: async ({ params, spokeProvider }) => {
263
233
  if (!spokeProvider) {
264
234
  throw new Error("spokeProvider is not found");
265
235
  }
266
- const response = await sodax.moneyMarket.withdraw(
267
- {
268
- token: spokeToken.address,
269
- // vault token on hub chain decimals is 18
270
- amount: viem.parseUnits(amount, 18),
271
- action: "withdraw",
272
- toChainId,
273
- toAddress
274
- },
275
- spokeProvider
276
- );
236
+ const response = await sodax.moneyMarket.withdraw(params, spokeProvider);
277
237
  if (!response.ok) {
278
- throw new Error("Failed to withdraw tokens");
238
+ throw response.error;
279
239
  }
280
- console.log("Withdraw transaction submitted:", response);
281
240
  return response;
282
241
  }
283
242
  });
284
243
  }
285
- function useUserReservesData(spokeProvider, address, refetchInterval = 5e3) {
244
+ function useUserReservesData(params) {
286
245
  const { sodax } = useSodaxContext();
246
+ const defaultQueryOptions = {
247
+ queryKey: ["mm", "userReservesData", params?.spokeProvider?.chainConfig.chain.id, params?.address],
248
+ enabled: !!params?.spokeProvider && !!params?.address,
249
+ refetchInterval: 5e3
250
+ };
251
+ const queryOptions = {
252
+ ...defaultQueryOptions,
253
+ ...params?.queryOptions
254
+ // override default query options if provided
255
+ };
287
256
  return reactQuery.useQuery({
288
- queryKey: ["userReserves", spokeProvider?.chainConfig.chain.id, address],
257
+ ...queryOptions,
289
258
  queryFn: async () => {
290
- if (!spokeProvider) {
259
+ if (!params?.spokeProvider || !params?.address) {
291
260
  throw new Error("Spoke provider or address is not defined");
292
261
  }
293
- return await sodax.moneyMarket.data.getUserReservesData(spokeProvider);
294
- },
295
- enabled: !!spokeProvider && !!address,
296
- refetchInterval
262
+ return await sodax.moneyMarket.data.getUserReservesData(params.spokeProvider);
263
+ }
297
264
  });
298
265
  }
299
- function useReservesData() {
266
+ function useReservesData(params) {
267
+ const defaultQueryOptions = {
268
+ queryKey: ["mm", "reservesData"],
269
+ refetchInterval: 5e3
270
+ };
271
+ const queryOptions = {
272
+ ...defaultQueryOptions,
273
+ ...params?.queryOptions
274
+ // override default query options if provided
275
+ };
300
276
  const { sodax } = useSodaxContext();
301
277
  return reactQuery.useQuery({
302
- queryKey: ["reservesData"],
278
+ ...queryOptions,
303
279
  queryFn: async () => {
304
280
  return await sodax.moneyMarket.data.getReservesData();
305
281
  }
306
282
  });
307
283
  }
308
- function useMMAllowance(token, amount, action, spokeProvider) {
284
+ function useMMAllowance({
285
+ params,
286
+ spokeProvider,
287
+ queryOptions
288
+ }) {
309
289
  const { sodax } = useSodaxContext();
290
+ const defaultQueryOptions = {
291
+ queryKey: ["mm", "allowance", params?.token, params?.action],
292
+ enabled: !!spokeProvider,
293
+ refetchInterval: 5e3
294
+ };
295
+ queryOptions = {
296
+ ...defaultQueryOptions,
297
+ ...queryOptions
298
+ // override default query options if provided
299
+ };
310
300
  return reactQuery.useQuery({
311
- queryKey: ["allowance", token.address, amount, action],
301
+ ...queryOptions,
312
302
  queryFn: async () => {
313
303
  if (!spokeProvider) throw new Error("Spoke provider is required");
314
- const actionBasedDecimals = action === "withdraw" || action === "borrow" ? 18 : token.decimals;
315
- const allowance = await sodax.moneyMarket.isAllowanceValid(
316
- {
317
- token: token.address,
318
- amount: viem.parseUnits(amount, actionBasedDecimals),
319
- action
320
- },
321
- spokeProvider
322
- );
323
- if (allowance.ok) {
324
- return allowance.value;
304
+ if (!params) throw new Error("Params are required");
305
+ const allowance = await sodax.moneyMarket.isAllowanceValid(params, spokeProvider);
306
+ if (!allowance.ok) {
307
+ throw allowance.error;
325
308
  }
326
- return false;
327
- },
328
- enabled: !!spokeProvider
309
+ return allowance.value;
310
+ }
329
311
  });
330
312
  }
331
- function useMMApprove(token, spokeProvider) {
313
+ function useMMApprove() {
332
314
  const { sodax } = useSodaxContext();
333
315
  const queryClient = reactQuery.useQueryClient();
334
- const {
335
- mutateAsync: approve,
336
- isPending,
337
- error,
338
- reset: resetError
339
- } = reactQuery.useMutation({
340
- mutationFn: async ({ amount, action }) => {
316
+ return reactQuery.useMutation({
317
+ mutationFn: async ({ params, spokeProvider }) => {
341
318
  if (!spokeProvider) {
342
319
  throw new Error("Spoke provider not found");
343
320
  }
344
- const actionBasedDecimals = action === "withdraw" || action === "borrow" ? 18 : token.decimals;
345
- const allowance = await sodax.moneyMarket.approve(
346
- {
347
- token: token.address,
348
- amount: viem.parseUnits(amount, actionBasedDecimals),
349
- action
350
- },
351
- spokeProvider
352
- );
321
+ const allowance = await sodax.moneyMarket.approve(params, spokeProvider, false);
353
322
  if (!allowance.ok) {
354
- throw new Error("Failed to approve tokens");
323
+ throw allowance.error;
355
324
  }
356
- return allowance.ok;
325
+ return allowance.value;
357
326
  },
358
- onSuccess: () => {
359
- queryClient.invalidateQueries({ queryKey: ["allowance", token.address] });
327
+ onSuccess: (_, { params, spokeProvider }) => {
328
+ console.log("onSuccess invoked with queryKey:", [
329
+ "mm",
330
+ "allowance",
331
+ spokeProvider?.chainConfig.chain.id,
332
+ params.token,
333
+ params.action
334
+ ]);
335
+ queryClient.invalidateQueries({
336
+ queryKey: ["mm", "allowance", spokeProvider?.chainConfig.chain.id, params.token, params.action]
337
+ });
360
338
  }
361
339
  });
362
- return {
363
- approve,
364
- isLoading: isPending,
365
- error,
366
- resetError
367
- };
368
340
  }
369
- function useAToken(aToken) {
341
+ function useAToken({ aToken, queryOptions }) {
370
342
  const { sodax } = useSodaxContext();
343
+ const defaultQueryOptions = {
344
+ queryKey: ["mm", "aToken", aToken],
345
+ enabled: !!aToken
346
+ };
347
+ queryOptions = {
348
+ ...defaultQueryOptions,
349
+ ...queryOptions
350
+ // override default query options if provided
351
+ };
371
352
  return reactQuery.useQuery({
372
- queryKey: ["aToken", sodax.hubProvider.chainConfig.chain.id, aToken],
353
+ ...queryOptions,
373
354
  queryFn: async () => {
374
355
  if (!aToken) {
375
356
  throw new Error("aToken address or hub provider is not defined");
376
357
  }
358
+ if (!viem.isAddress(aToken)) {
359
+ throw new Error("aToken address is not a valid address");
360
+ }
377
361
  const aTokenData = await sodax.moneyMarket.data.getATokenData(aToken);
378
362
  return {
379
363
  ...aTokenData,
380
364
  xChainId: sodax.hubProvider.chainConfig.chain.id
381
365
  };
382
- },
383
- enabled: !!aToken
366
+ }
384
367
  });
385
368
  }
386
- function useReservesUsdFormat() {
369
+ function useReservesUsdFormat(params) {
387
370
  const { sodax } = useSodaxContext();
371
+ const defaultQueryOptions = { queryKey: ["mm", "reservesUsdFormat"] };
372
+ const queryOptions = {
373
+ ...defaultQueryOptions,
374
+ ...params?.queryOptions
375
+ // override default query options if provided
376
+ };
388
377
  return reactQuery.useQuery({
389
- queryKey: ["reservesUsdFormat"],
378
+ ...queryOptions,
390
379
  queryFn: async () => {
391
380
  const reserves = await sodax.moneyMarket.data.getReservesHumanized();
392
381
  return sodax.moneyMarket.data.formatReservesUSD(sodax.moneyMarket.data.buildReserveDataWithPrice(reserves));
393
382
  }
394
383
  });
395
384
  }
385
+ function useUserFormattedSummary(params) {
386
+ const { sodax } = useSodaxContext();
387
+ const defaultQueryOptions = {
388
+ queryKey: ["mm", "userFormattedSummary", params?.spokeProvider?.chainConfig.chain.id, params?.address],
389
+ enabled: !!params?.spokeProvider && !!params?.address,
390
+ refetchInterval: 5e3
391
+ };
392
+ const queryOptions = {
393
+ ...defaultQueryOptions,
394
+ ...params?.queryOptions
395
+ // override default query options if provided
396
+ };
397
+ return reactQuery.useQuery({
398
+ ...queryOptions,
399
+ queryFn: async () => {
400
+ if (!params?.spokeProvider || !params?.address) {
401
+ throw new Error("Spoke provider or address is not defined");
402
+ }
403
+ const reserves = await sodax.moneyMarket.data.getReservesHumanized();
404
+ const formattedReserves = sodax.moneyMarket.data.formatReservesUSD(
405
+ sodax.moneyMarket.data.buildReserveDataWithPrice(reserves)
406
+ );
407
+ const userReserves = await sodax.moneyMarket.data.getUserReservesHumanized(params?.spokeProvider);
408
+ return sodax.moneyMarket.data.formatUserSummary(
409
+ sodax.moneyMarket.data.buildUserSummaryRequest(reserves, formattedReserves, userReserves)
410
+ );
411
+ }
412
+ });
413
+ }
396
414
  var useQuote = (payload) => {
397
415
  const { sodax } = useSodaxContext();
398
416
  const queryKey = React.useMemo(() => {
@@ -514,135 +532,254 @@ function useCancelSwap(spokeProvider) {
514
532
  }
515
533
  });
516
534
  }
517
- var useBackendIntentByTxHash = (txHash, refetchInterval = 1e3) => {
535
+ function useCreateLimitOrder(spokeProvider) {
518
536
  const { sodax } = useSodaxContext();
537
+ return reactQuery.useMutation({
538
+ mutationFn: async (params) => {
539
+ if (!spokeProvider) {
540
+ throw new Error("Spoke provider not found");
541
+ }
542
+ return sodax.swaps.createLimitOrder({
543
+ intentParams: params,
544
+ spokeProvider
545
+ });
546
+ }
547
+ });
548
+ }
549
+ function useCancelLimitOrder() {
550
+ const { sodax } = useSodaxContext();
551
+ return reactQuery.useMutation({
552
+ mutationFn: async ({ intent, spokeProvider, timeout }) => {
553
+ return sodax.swaps.cancelLimitOrder({
554
+ intent,
555
+ spokeProvider,
556
+ timeout
557
+ });
558
+ }
559
+ });
560
+ }
561
+ var useBackendIntentByTxHash = (params) => {
562
+ const { sodax } = useSodaxContext();
563
+ const defaultQueryOptions = {
564
+ queryKey: ["api", "intent", "txHash", params?.params?.txHash],
565
+ enabled: !!params?.params?.txHash && params?.params?.txHash.length > 0,
566
+ retry: 3,
567
+ refetchInterval: 1e3
568
+ };
569
+ const queryOptions = {
570
+ ...defaultQueryOptions,
571
+ ...params?.queryOptions
572
+ };
519
573
  return reactQuery.useQuery({
520
- queryKey: ["backend", "intent", "txHash", txHash],
574
+ ...queryOptions,
521
575
  queryFn: async () => {
522
- if (!txHash) {
576
+ if (!params?.params?.txHash) {
523
577
  return void 0;
524
578
  }
525
- return sodax.backendApi.getIntentByTxHash(txHash);
526
- },
527
- refetchInterval,
528
- enabled: !!txHash && txHash.length > 0,
529
- retry: 3
579
+ return sodax.backendApi.getIntentByTxHash(params.params.txHash);
580
+ }
530
581
  });
531
582
  };
532
- var useBackendIntentByHash = (intentHash) => {
583
+ var useBackendIntentByHash = (params) => {
533
584
  const { sodax } = useSodaxContext();
585
+ const defaultQueryOptions = {
586
+ queryKey: ["api", "intent", "hash", params?.params?.intentHash],
587
+ enabled: !!params?.params?.intentHash && params?.params?.intentHash.length > 0,
588
+ retry: 3
589
+ };
590
+ const queryOptions = {
591
+ ...defaultQueryOptions,
592
+ ...params?.queryOptions
593
+ };
534
594
  return reactQuery.useQuery({
535
- queryKey: ["backend", "intent", "hash", intentHash],
595
+ ...queryOptions,
536
596
  queryFn: async () => {
537
- if (!intentHash) {
597
+ if (!params?.params?.intentHash) {
538
598
  return void 0;
539
599
  }
540
- return sodax.backendApi.getIntentByHash(intentHash);
541
- },
542
- enabled: !!intentHash && intentHash.length > 0,
543
- retry: 3
600
+ return sodax.backendApi.getIntentByHash(params.params.intentHash);
601
+ }
544
602
  });
545
603
  };
546
- var useBackendOrderbook = (params) => {
604
+ var useBackendUserIntents = ({
605
+ params,
606
+ queryOptions
607
+ }) => {
547
608
  const { sodax } = useSodaxContext();
609
+ const defaultQueryOptions = {
610
+ queryKey: ["api", "intent", "user", params],
611
+ enabled: !!params && !!params.userAddress && params.userAddress.length > 0,
612
+ retry: 3
613
+ };
614
+ queryOptions = {
615
+ ...defaultQueryOptions,
616
+ ...queryOptions
617
+ // override default query options if provided
618
+ };
548
619
  return reactQuery.useQuery({
549
- queryKey: ["backend", "solver", "orderbook", params],
620
+ ...queryOptions,
550
621
  queryFn: async () => {
551
- if (!params || !params.offset || !params.limit) {
622
+ if (!params?.userAddress) {
552
623
  return void 0;
553
624
  }
554
- return sodax.backendApi.getOrderbook(params);
555
- },
556
- enabled: !!params && !!params.offset && !!params.limit,
625
+ return sodax.backendApi.getUserIntents(params);
626
+ }
627
+ });
628
+ };
629
+ var useBackendOrderbook = (params) => {
630
+ const { sodax } = useSodaxContext();
631
+ const defaultQueryOptions = {
632
+ queryKey: ["api", "solver", "orderbook", params?.pagination?.offset, params?.pagination?.limit],
633
+ enabled: !!params?.pagination && !!params?.pagination.offset && !!params?.pagination.limit,
557
634
  staleTime: 30 * 1e3,
558
635
  // 30 seconds for real-time data
559
636
  retry: 3
637
+ };
638
+ const queryOptions = {
639
+ ...defaultQueryOptions,
640
+ ...params?.queryOptions
641
+ // override default query options if provided
642
+ };
643
+ return reactQuery.useQuery({
644
+ ...queryOptions,
645
+ queryFn: async () => {
646
+ if (!params?.pagination || !params?.pagination.offset || !params?.pagination.limit) {
647
+ return void 0;
648
+ }
649
+ return sodax.backendApi.getOrderbook(params.pagination);
650
+ }
560
651
  });
561
652
  };
562
- var useBackendMoneyMarketPosition = (userAddress) => {
653
+ var useBackendMoneyMarketPosition = (params) => {
563
654
  const { sodax } = useSodaxContext();
655
+ const defaultQueryOptions = {
656
+ queryKey: ["api", "mm", "position", params?.userAddress],
657
+ enabled: !!params?.userAddress && params?.userAddress.length > 0,
658
+ retry: 3
659
+ };
660
+ const queryOptions = {
661
+ ...defaultQueryOptions,
662
+ ...params?.queryOptions
663
+ };
564
664
  return reactQuery.useQuery({
565
- queryKey: ["backend", "moneymarket", "position", userAddress],
665
+ ...queryOptions,
566
666
  queryFn: async () => {
567
- if (!userAddress) {
667
+ if (!params?.userAddress) {
568
668
  return void 0;
569
669
  }
570
- return sodax.backendApi.getMoneyMarketPosition(userAddress);
571
- },
572
- enabled: !!userAddress && userAddress.length > 0,
573
- retry: 3
670
+ return sodax.backendApi.getMoneyMarketPosition(params.userAddress);
671
+ }
574
672
  });
575
673
  };
576
- var useBackendAllMoneyMarketAssets = () => {
674
+ var useBackendAllMoneyMarketAssets = (params) => {
577
675
  const { sodax } = useSodaxContext();
676
+ const defaultQueryOptions = {
677
+ queryKey: ["api", "mm", "assets", "all"],
678
+ enabled: true,
679
+ retry: 3
680
+ };
681
+ const queryOptions = {
682
+ ...defaultQueryOptions,
683
+ ...params?.queryOptions
684
+ };
578
685
  return reactQuery.useQuery({
579
- queryKey: ["backend", "moneymarket", "assets", "all"],
686
+ ...queryOptions,
580
687
  queryFn: async () => {
581
688
  return sodax.backendApi.getAllMoneyMarketAssets();
582
- },
583
- retry: 3
689
+ }
584
690
  });
585
691
  };
586
- var useBackendMoneyMarketAsset = (reserveAddress) => {
692
+ var useBackendMoneyMarketAsset = (params) => {
587
693
  const { sodax } = useSodaxContext();
694
+ const defaultQueryOptions = {
695
+ queryKey: ["api", "mm", "asset", params?.params?.reserveAddress],
696
+ enabled: !!params?.params?.reserveAddress && params?.params?.reserveAddress.length > 0,
697
+ retry: 3
698
+ };
699
+ const queryOptions = {
700
+ ...defaultQueryOptions,
701
+ ...params?.queryOptions
702
+ };
588
703
  return reactQuery.useQuery({
589
- queryKey: ["backend", "moneymarket", "asset", reserveAddress],
704
+ ...queryOptions,
590
705
  queryFn: async () => {
591
- if (!reserveAddress) {
706
+ if (!params?.params?.reserveAddress) {
592
707
  return void 0;
593
708
  }
594
- return sodax.backendApi.getMoneyMarketAsset(reserveAddress);
595
- },
596
- enabled: !!reserveAddress && reserveAddress.length > 0,
597
- retry: 3
709
+ return sodax.backendApi.getMoneyMarketAsset(params.params.reserveAddress);
710
+ }
598
711
  });
599
712
  };
600
713
  var useBackendMoneyMarketAssetBorrowers = (params) => {
601
714
  const { sodax } = useSodaxContext();
715
+ const defaultQueryOptions = {
716
+ queryKey: ["api", "mm", "asset", "borrowers", params],
717
+ enabled: !!params?.params?.reserveAddress && !!params.pagination.offset && !!params.pagination.limit,
718
+ retry: 3
719
+ };
720
+ const queryOptions = {
721
+ ...defaultQueryOptions,
722
+ ...params?.queryOptions
723
+ };
602
724
  return reactQuery.useQuery({
603
- queryKey: ["backend", "moneymarket", "asset", "borrowers", params],
725
+ ...queryOptions,
604
726
  queryFn: async () => {
605
- if (!params.reserveAddress || !params.offset || !params.limit) {
727
+ if (!params?.params?.reserveAddress || !params.pagination.offset || !params.pagination.limit) {
606
728
  return void 0;
607
729
  }
608
- return sodax.backendApi.getMoneyMarketAssetBorrowers(params.reserveAddress, {
609
- offset: params.offset,
610
- limit: params.limit
730
+ return sodax.backendApi.getMoneyMarketAssetBorrowers(params.params.reserveAddress, {
731
+ offset: params.pagination.offset,
732
+ limit: params.pagination.limit
611
733
  });
612
- },
613
- enabled: !!params.reserveAddress && !!params.offset && !!params.limit,
614
- retry: 3
734
+ }
615
735
  });
616
736
  };
617
737
  var useBackendMoneyMarketAssetSuppliers = (params) => {
618
738
  const { sodax } = useSodaxContext();
739
+ const defaultQueryOptions = {
740
+ queryKey: ["api", "mm", "asset", "suppliers", params],
741
+ enabled: !!params?.params?.reserveAddress && !!params.pagination.offset && !!params.pagination.limit,
742
+ retry: 3
743
+ };
744
+ const queryOptions = {
745
+ ...defaultQueryOptions,
746
+ ...params?.queryOptions
747
+ };
619
748
  return reactQuery.useQuery({
620
- queryKey: ["backend", "moneymarket", "asset", "suppliers", params],
749
+ ...queryOptions,
621
750
  queryFn: async () => {
622
- if (!params.reserveAddress || !params.offset || !params.limit) {
751
+ if (!params?.params?.reserveAddress || !params.pagination.offset || !params.pagination.limit) {
623
752
  return void 0;
624
753
  }
625
- return sodax.backendApi.getMoneyMarketAssetSuppliers(params.reserveAddress, {
626
- offset: params.offset,
627
- limit: params.limit
754
+ return sodax.backendApi.getMoneyMarketAssetSuppliers(params.params.reserveAddress, {
755
+ offset: params.pagination.offset,
756
+ limit: params.pagination.limit
628
757
  });
629
- },
630
- enabled: !!params.reserveAddress && !!params.offset && !!params.limit,
631
- retry: 3
758
+ }
632
759
  });
633
760
  };
634
761
  var useBackendAllMoneyMarketBorrowers = (params) => {
635
762
  const { sodax } = useSodaxContext();
763
+ const defaultQueryOptions = {
764
+ queryKey: ["api", "mm", "borrowers", "all", params],
765
+ enabled: !!params && !!params.pagination.offset && !!params.pagination.limit,
766
+ retry: 3
767
+ };
768
+ const queryOptions = {
769
+ ...defaultQueryOptions,
770
+ ...params?.queryOptions
771
+ };
636
772
  return reactQuery.useQuery({
637
- queryKey: ["backend", "moneymarket", "borrowers", "all", params],
773
+ ...queryOptions,
638
774
  queryFn: async () => {
639
- if (!params || !params.offset || !params.limit) {
775
+ if (!params || !params.pagination.offset || !params.pagination.limit) {
640
776
  return void 0;
641
777
  }
642
- return sodax.backendApi.getAllMoneyMarketBorrowers(params);
643
- },
644
- enabled: !!params && !!params.offset && !!params.limit,
645
- retry: 3
778
+ return sodax.backendApi.getAllMoneyMarketBorrowers({
779
+ offset: params.pagination.offset,
780
+ limit: params.pagination.limit
781
+ });
782
+ }
646
783
  });
647
784
  };
648
785
  function useBridgeAllowance(params, spokeProvider) {
@@ -1298,14 +1435,17 @@ exports.useBackendMoneyMarketAssetBorrowers = useBackendMoneyMarketAssetBorrower
1298
1435
  exports.useBackendMoneyMarketAssetSuppliers = useBackendMoneyMarketAssetSuppliers;
1299
1436
  exports.useBackendMoneyMarketPosition = useBackendMoneyMarketPosition;
1300
1437
  exports.useBackendOrderbook = useBackendOrderbook;
1438
+ exports.useBackendUserIntents = useBackendUserIntents;
1301
1439
  exports.useBorrow = useBorrow;
1302
1440
  exports.useBridge = useBridge;
1303
1441
  exports.useBridgeAllowance = useBridgeAllowance;
1304
1442
  exports.useBridgeApprove = useBridgeApprove;
1443
+ exports.useCancelLimitOrder = useCancelLimitOrder;
1305
1444
  exports.useCancelSwap = useCancelSwap;
1306
1445
  exports.useCancelUnstake = useCancelUnstake;
1307
1446
  exports.useClaim = useClaim;
1308
1447
  exports.useConvertedAssets = useConvertedAssets;
1448
+ exports.useCreateLimitOrder = useCreateLimitOrder;
1309
1449
  exports.useDeriveUserWalletAddress = useDeriveUserWalletAddress;
1310
1450
  exports.useEstimateGas = useEstimateGas;
1311
1451
  exports.useGetBridgeableAmount = useGetBridgeableAmount;
@@ -1344,6 +1484,7 @@ exports.useUnstakeAllowance = useUnstakeAllowance;
1344
1484
  exports.useUnstakeApprove = useUnstakeApprove;
1345
1485
  exports.useUnstakingInfo = useUnstakingInfo;
1346
1486
  exports.useUnstakingInfoWithPenalty = useUnstakingInfoWithPenalty;
1487
+ exports.useUserFormattedSummary = useUserFormattedSummary;
1347
1488
  exports.useUserReservesData = useUserReservesData;
1348
1489
  exports.useWithdraw = useWithdraw;
1349
1490
  //# sourceMappingURL=index.js.map