@@ -36,8 +36,10 @@ import type {
3636 UserSwapsRequest ,
3737} from '@aave/graphql' ;
3838import {
39+ BorrowSwapQuoteQuery ,
3940 type ERC20PermitSignature ,
4041 type PositionSwapByIntentApprovalsRequired ,
42+ type PrepareBorrowSwapRequest ,
4143 type PreparePositionSwapRequest ,
4244 type PrepareTokenSwapRequest ,
4345 SupplySwapQuoteQuery ,
@@ -512,6 +514,116 @@ export function useSupplySwapQuote({
512514
513515// ------------------------------------------------------------
514516
517+ export type UseBorrowSwapQuoteArgs = Prettify <
518+ PrepareBorrowSwapRequest & CurrencyQueryOptions
519+ > ;
520+
521+ /**
522+ * @experimental
523+ * Fetch a quote for a borrow swap operation with the specified parameters.
524+ *
525+ * This signature supports React Suspense:
526+ *
527+ * ```tsx
528+ * const { data } = useBorrowSwapQuote({
529+ * market: {
530+ * sellPosition: userBorrowItem.id,
531+ * buyReserve: reserve.id,
532+ * amount: bigDecimal('1000'),
533+ * user: evmAddress('0x742d35cc…'),
534+ * },
535+ * suspense: true,
536+ * });
537+ * ```
538+ */
539+ export function useBorrowSwapQuote (
540+ args : UseBorrowSwapQuoteArgs & Suspendable ,
541+ ) : SuspenseResult < SwapQuote > ;
542+ /**
543+ * @experimental
544+ * Fetch a quote for a borrow swap operation with the specified parameters.
545+ *
546+ * Pausable suspense mode.
547+ *
548+ * ```tsx
549+ * const { data } = useBorrowSwapQuote({
550+ * market: {
551+ * sellPosition: userBorrowItem.id,
552+ * buyReserve: reserve.id,
553+ * amount: bigDecimal('1000'),
554+ * user: evmAddress('0x742d35cc…'),
555+ * },
556+ * suspense: true,
557+ * pause: true,
558+ * });
559+ * ```
560+ */
561+ export function useBorrowSwapQuote (
562+ args : Pausable < UseBorrowSwapQuoteArgs > & Suspendable ,
563+ ) : PausableSuspenseResult < SwapQuote > ;
564+ /**
565+ * @experimental
566+ * Fetch a quote for a borrow swap operation with the specified parameters.
567+ *
568+ * ```tsx
569+ * const { data, error, loading } = useBorrowSwapQuote({
570+ * market: {
571+ * sellPosition: userBorrowItem.id,
572+ * buyReserve: reserve.id,
573+ * amount: bigDecimal('1000'),
574+ * user: evmAddress('0x742d35cc…'),
575+ * },
576+ * });
577+ * ```
578+ */
579+ export function useBorrowSwapQuote (
580+ args : UseBorrowSwapQuoteArgs ,
581+ ) : ReadResult < SwapQuote > ;
582+ /**
583+ * @experimental
584+ * Fetch a quote for a borrow swap operation with the specified parameters.
585+ *
586+ * Pausable loading state mode.
587+ *
588+ * ```tsx
589+ * const { data, error, loading, paused } = useBorrowSwapQuote({
590+ * market: {
591+ * sellPosition: userBorrowItem.id,
592+ * buyReserve: reserve.id,
593+ * amount: bigDecimal('1000'),
594+ * user: evmAddress('0x742d35cc…'),
595+ * },
596+ * pause: true,
597+ * });
598+ * ```
599+ */
600+ export function useBorrowSwapQuote (
601+ args : Pausable < UseBorrowSwapQuoteArgs > ,
602+ ) : PausableReadResult < SwapQuote > ;
603+
604+ export function useBorrowSwapQuote ( {
605+ suspense = false ,
606+ pause = false ,
607+ currency = DEFAULT_QUERY_OPTIONS . currency ,
608+ ...request
609+ } : NullishDeep < UseBorrowSwapQuoteArgs > & {
610+ suspense ?: boolean ;
611+ pause ?: boolean ;
612+ } ) : SuspendableResult < SwapQuote , UnexpectedError > {
613+ return useSuspendableQuery ( {
614+ document : BorrowSwapQuoteQuery ,
615+ variables : {
616+ request,
617+ currency,
618+ } ,
619+ selector : ( data ) => data . quote ,
620+ suspense,
621+ pause,
622+ } ) ;
623+ }
624+
625+ // ------------------------------------------------------------
626+
515627export type SwapHandlerOptions = {
516628 cancel : CancelOperation ;
517629} ;
0 commit comments