@aave/react 4.0.0-next.5 → 4.0.0-next.7
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/README.md +8 -3
- package/dist/chunk-FIYWA5XQ.js +2 -0
- package/dist/chunk-FIYWA5XQ.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -72
- package/dist/index.d.ts +36 -72
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{misc-gmAnSdm5.d.ts → misc-BUJSXsyz.d.ts} +11 -13
- package/dist/{misc-BkG5G4yl.d.cts → misc-CB94S1RB.d.cts} +11 -13
- package/dist/viem/index.cjs +1 -1
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +2 -1
- package/dist/viem/index.d.ts +2 -1
- package/dist/viem/index.js +1 -1
- package/dist/viem/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/chunk-YJ6HF5HO.js +0 -2
- package/dist/chunk-YJ6HF5HO.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AaveProvider.tsx","../src/hubs.ts","../src/protocol.ts","../src/reserves.ts","../src/spokes.ts","../src/swap.ts","../src/transactions.ts","../src/user.ts"],"names":["AaveProvider","children","client","React","AaveContextProvider","useHub","suspense","pause","currency","DEFAULT_QUERY_OPTIONS","request","useSuspendableQuery","HubQuery","useHubs","HubsQuery","useHubAssets","HubAssetsQuery","useHubsAction","options","useAaveClient","useAsyncTask","hubs","useAsset","timeWindow","AssetQuery","useAssetPriceHistory","AssetPriceHistoryQuery","useAssetSupplyHistory","AssetSupplyHistoryQuery","useAssetBorrowHistory","AssetBorrowHistoryQuery","useReserve","ReserveQuery","useReserveAction","reserve","useReserves","selector","ReservesQuery","useReservesAction","reserves","useBorrowApyHistory","BorrowApyHistoryQuery","useSupplyApyHistory","SupplyApyHistoryQuery","useSpoke","SpokeQuery","useSpokes","SpokesQuery","useSpokePositionManagers","SpokePositionManagersQuery","useSpokeUserPositionManagers","SpokeUserPositionManagersQuery","useSwapQuote","SwapQuoteQuery","useSwapQuoteAction","swapQuote","useSwappableTokens","SwappableTokensQuery","useUserSwaps","UserSwapsQuery","isERC20PermitSignature","signature","useSwapTokens","handler","executeSwap","useCallback","plan","cancel","PendingTransaction","pendingTransaction","okAsync","errAsync","ValidationError","prepareSwap","preparePlan","swap","signedTypedData","invariant","CannotCancelSwapError","ResultAwareError","useCancelSwap","swapStatus","status","prepareSwapCancel","result","cancelSwap","refreshQueriesForReserveChange","chainId","spoke","decodeReserveId","UserPositionsQuery","variables","data","position","UserPositionQuery","_","UserSummaryQuery","isSpokeInputVariant","isChainIdsVariant","id","item","UserBalancesQuery","useSupply","supply","useBorrow","borrow","useRepay","repay","useWithdraw","withdraw","useRenounceSpokeUserPositionManager","renounceSpokeUserPositionManager","transaction","useUpdateUserRiskPremium","updateUserRiskPremium","useUpdateUserDynamicConfig","updateUserDynamicConfig","useSetUserSupplyAsCollateral","setUserSupplyAsCollateral","token","isHubInputVariant","decodeHubId","useLiquidatePosition","liquidatePosition","useSetSpokeUserPositionManager","setSpokeUserPositionManager","usePreviewAction","preview","usePreview","PreviewQuery","useActivities","ActivitiesQuery","useActivitiesAction","activities","useUserSupplies","UserSuppliesQuery","useUserSuppliesAction","userSupplies","useUserBorrows","UserBorrowsQuery","useUserBorrowsAction","userBorrows","useUserSummary","useUserPositions","useUserPositionsAction","userPositions","useUserPosition","useUserBalances","useUserBalancesAction","userBalances","useUserSummaryHistory","UserSummaryHistoryQuery"],"mappings":"4/CAuCO,SAASA,EAAAA,CAAa,CAAE,SAAAC,CAAAA,CAAU,MAAA,CAAAC,CAAO,CAAA,CAAsB,CACpE,OAAOC,CAAAA,CAAA,aAAA,CAACC,EAAA,CAAoB,MAAA,CAAQF,GAASD,CAAS,CACxD,CCmDO,SAASI,GAAO,CACrB,QAAA,CAAAC,EAAW,K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,CACA,KAAA,CAAAC,CACF,CAAC,CACH,CA8BO,SAAS6I,EAAAA,CACdlI,EAA0CT,qBAAAA,CACyB,CACnE,IAAMP,GAAAA,CAASiB,CAAAA,GAEf,OAAOC,CAAAA,CACJV,GACC2I,YAAAA,CAAanJ,GAAAA,CAAQQ,EAAS,CAAE,QAAA,CAAUQ,EAAQ,QAAS,CAAC,EAC9D,CAAChB,GAAAA,CAAQgB,EAAQ,QAAQ,CAC3B,CACF,CAyEO,SAASoI,GAAsB,CACpC,QAAA,CAAAhJ,EAAW,KAAA,CACX,KAAA,CAAAC,EAAQ,KAAA,CACR,QAAA,CAAAC,EAAWC,qBAAAA,CAAsB,QAAA,CACjC,GAAGC,CACL,CAAA,CAGiE,CAC/D,OAAOC,GAAAA,CAAoB,CACzB,QAAA,CAAU4I,uBAAAA,CACV,UAAW,CACT,OAAA,CAAA7I,EACA,QAAA,CAAAF,CACF,EACA,QAAA,CAAAF,CAAAA,CACA,MAAAC,CAAAA,CACA,KAAA,CAAO,KACT,CAAC,CACH","file":"index.js","sourcesContent":["import type { AaveClient } from '@aave/client';\n// biome-ignore lint/correctness/noUnusedImports: intentional\nimport React, { type ReactNode } from 'react';\n\nimport { AaveContextProvider } from './context';\n\n/**\n * <AaveProvider> props\n */\nexport type AaveProviderProps = {\n /**\n * The children to render\n */\n children: ReactNode;\n /**\n * The Aave client instance to use\n */\n client: AaveClient;\n};\n\n/**\n * Manages the internal state of the Aave SDK.\n *\n * ```tsx\n * import { AaveProvider, AaveClient, production } from '@aave/react';\n *\n * const client = AaveClient.create({\n * environment: production,\n * });\n *\n * function App() {\n * return (\n * <AaveProvider client={client}>\n * // ...\n * </AaveProvider>\n * );\n * }\n * ```\n */\nexport function AaveProvider({ children, client }: AaveProviderProps) {\n return <AaveContextProvider client={client}>{children}</AaveContextProvider>;\n}\n","import {\n type CurrencyQueryOptions,\n DEFAULT_QUERY_OPTIONS,\n type UnexpectedError,\n} from '@aave/client';\nimport { hubs } from '@aave/client/actions';\nimport {\n type Hub,\n type HubAsset,\n HubAssetsQuery,\n type HubAssetsRequest,\n HubQuery,\n type HubRequest,\n HubsQuery,\n type HubsRequest,\n} from '@aave/graphql';\nimport type { NullishDeep, Prettify } from '@aave/types';\nimport { useAaveClient } from './context';\nimport {\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type ReadResult,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n type UseAsyncTask,\n useAsyncTask,\n useSuspendableQuery,\n} from './helpers';\n\nexport type UseHubArgs = Prettify<HubRequest & CurrencyQueryOptions>;\n\n/**\n * Fetch a specific hub by ID or by address and chain ID.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useHub({\n * query: { hubId: hubId('SGVsbG8h') },\n * suspense: true,\n * });\n * // data will be Hub | null\n * ```\n */\nexport function useHub(\n args: UseHubArgs & Suspendable,\n): SuspenseResult<Hub | null>;\n/**\n * Fetch a specific hub by ID or by address and chain ID.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useHub({\n * query: { hubId: hubId('SGVsbG8h') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useHub(\n args: Pausable<UseHubArgs> & Suspendable,\n): PausableSuspenseResult<Hub | null>;\n/**\n * Fetch a specific hub by ID or by address and chain ID.\n *\n * ```tsx\n * const { data, error, loading } = useHub({\n * query: { hubId: hubId('SGVsbG8h') },\n * });\n * // data will be Hub | null\n * ```\n */\nexport function useHub(args: UseHubArgs): ReadResult<Hub | null>;\n/**\n * Fetch a specific hub by ID or by address and chain ID.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useHub({\n * query: { hubId: hubId('SGVsbG8h') },\n * pause: true,\n * });\n * ```\n */\nexport function useHub(\n args: Pausable<UseHubArgs>,\n): PausableReadResult<Hub | null>;\n\nexport function useHub({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseHubArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Hub | null, UnexpectedError> {\n return useSuspendableQuery({\n document: HubQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseHubsArgs = Prettify<HubsRequest & CurrencyQueryOptions>;\n\n/**\n * Fetch multiple hubs based on specified criteria.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useHubs({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * });\n * ```\n */\nexport function useHubs(args: UseHubsArgs & Suspendable): SuspenseResult<Hub[]>;\n/**\n * Fetch multiple hubs based on specified criteria.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useHubs({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useHubs(\n args: Pausable<UseHubsArgs> & Suspendable,\n): PausableSuspenseResult<Hub[]>;\n/**\n * Fetch multiple hubs based on specified criteria.\n *\n * ```tsx\n * const { data, error, loading } = useHubs({\n * query: { chainIds: [chainId(1)] },\n * });\n * ```\n */\nexport function useHubs(args: UseHubsArgs): ReadResult<Hub[]>;\n/**\n * Fetch multiple hubs based on specified criteria.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useHubs({\n * query: { chainIds: [chainId(1)] },\n * pause: true,\n * });\n * ```\n */\nexport function useHubs(args: Pausable<UseHubsArgs>): PausableReadResult<Hub[]>;\n\nexport function useHubs({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseHubsArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Hub[], UnexpectedError> {\n return useSuspendableQuery({\n document: HubsQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseHubAssetsArgs = Prettify<\n HubAssetsRequest & CurrencyQueryOptions\n>;\n\n/**\n * Fetch hub assets for a specific hub by ID or by address and chain ID.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useHubAssets({\n * query: { hubId: hubId('SGVsbG8h') },\n * user: evmAddress('0x456...'), // optional\n * suspense: true,\n * });\n * ```\n */\nexport function useHubAssets(\n args: UseHubAssetsArgs & Suspendable,\n): SuspenseResult<HubAsset[]>;\n/**\n * Fetch hub assets for a specific hub by ID or by address and chain ID.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useHubAssets({\n * query: { hubId: hubId('SGVsbG8h') },\n * user: evmAddress('0x456...'), // optional\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useHubAssets(\n args: Pausable<UseHubAssetsArgs> & Suspendable,\n): PausableSuspenseResult<HubAsset[]>;\n/**\n * Fetch hub assets for a specific hub by ID or by address and chain ID.\n *\n * ```tsx\n * const { data, error, loading } = useHubAssets({\n * query: { hubId: hubId('SGVsbG8h') },\n * user: evmAddress('0x456...'), // optional\n * });\n * ```\n */\nexport function useHubAssets(args: UseHubAssetsArgs): ReadResult<HubAsset[]>;\n/**\n * Fetch hub assets for a specific hub by ID or by address and chain ID.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useHubAssets({\n * query: { hubId: hubId('SGVsbG8h') },\n * user: evmAddress('0x456...'), // optional\n * pause: true,\n * });\n * ```\n */\nexport function useHubAssets(\n args: Pausable<UseHubAssetsArgs>,\n): PausableReadResult<HubAsset[]>;\n\nexport function useHubAssets({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseHubAssetsArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<HubAsset[], UnexpectedError> {\n return useSuspendableQuery({\n document: HubAssetsQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link hubs} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on the hubs.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useHubsAction();\n *\n * // …\n *\n * const result = await execute({\n * query: {\n * chainIds: [chainId(1)]\n * }\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // Hub[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useHubsAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<HubsRequest, Hub[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: HubsRequest) =>\n hubs(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n","import {\n type CurrencyQueryOptions,\n DEFAULT_QUERY_OPTIONS,\n type TimeWindowQueryOptions,\n type UnexpectedError,\n} from '@aave/client';\nimport {\n type Asset,\n AssetBorrowHistoryQuery,\n type AssetBorrowHistoryRequest,\n type AssetBorrowSample,\n AssetPriceHistoryQuery,\n type AssetPriceHistoryRequest,\n type AssetPriceSample,\n AssetQuery,\n type AssetRequest,\n AssetSupplyHistoryQuery,\n type AssetSupplyHistoryRequest,\n type AssetSupplySample,\n} from '@aave/graphql';\nimport type { NullishDeep, Prettify } from '@aave/types';\nimport {\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type ReadResult,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n useSuspendableQuery,\n} from './helpers';\n\nexport type UseAssetArgs = Prettify<\n AssetRequest & CurrencyQueryOptions & TimeWindowQueryOptions\n>;\n\n/**\n * Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useAsset({\n * query: { assetId: assetId('SGVsbG8h') },\n * suspense: true,\n * });\n * // data will be Asset | null\n * ```\n */\nexport function useAsset(\n args: UseAssetArgs & Suspendable,\n): SuspenseResult<Asset | null>;\n/**\n * Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useAsset({\n * query: { assetId: assetId('SGVsbG8h') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useAsset(\n args: Pausable<UseAssetArgs> & Suspendable,\n): PausableSuspenseResult<Asset | null>;\n/**\n * Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.\n *\n * ```tsx\n * const { data, error, loading } = useAsset({\n * query: { assetId: assetId('SGVsbG8h') },\n * });\n * // data will be Asset | null\n * ```\n */\nexport function useAsset(args: UseAssetArgs): ReadResult<Asset | null>;\n/**\n * Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useAsset({\n * query: { assetId: assetId('SGVsbG8h') },\n * pause: true,\n * });\n * ```\n */\nexport function useAsset(\n args: Pausable<UseAssetArgs>,\n): PausableReadResult<Asset | null>;\n\nexport function useAsset({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseAssetArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Asset | null, UnexpectedError> {\n return useSuspendableQuery({\n document: AssetQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseAssetPriceHistoryArgs = AssetPriceHistoryRequest;\n\n/**\n * Fetch historical price data for a specific asset.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useAssetPriceHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * currency: Currency.Usd,\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * });\n * ```\n */\nexport function useAssetPriceHistory(\n args: UseAssetPriceHistoryArgs & Suspendable,\n): SuspenseResult<AssetPriceSample[]>;\n/**\n * Fetch historical price data for a specific asset.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useAssetPriceHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useAssetPriceHistory(\n args: Pausable<UseAssetPriceHistoryArgs> & Suspendable,\n): PausableSuspenseResult<AssetPriceSample[]>;\n/**\n * Fetch historical price data for a specific asset.\n *\n * ```tsx\n * const { data, error, loading } = useAssetPriceHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * currency: Currency.Usd,\n * window: TimeWindow.LastWeek,\n * });\n * ```\n */\nexport function useAssetPriceHistory(\n args: UseAssetPriceHistoryArgs,\n): ReadResult<AssetPriceSample[]>;\n/**\n * Fetch historical price data for a specific asset.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useAssetPriceHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * pause: true,\n * });\n * ```\n */\nexport function useAssetPriceHistory(\n args: Pausable<UseAssetPriceHistoryArgs>,\n): PausableReadResult<AssetPriceSample[]>;\n\nexport function useAssetPriceHistory({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseAssetPriceHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<AssetPriceSample[], UnexpectedError> {\n return useSuspendableQuery({\n document: AssetPriceHistoryQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n\nexport type UseAssetSupplyHistoryArgs = AssetSupplyHistoryRequest;\n\n/**\n * Fetch historical supply data for a specific asset.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useAssetSupplyHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * });\n * ```\n */\nexport function useAssetSupplyHistory(\n args: UseAssetSupplyHistoryArgs & Suspendable,\n): SuspenseResult<AssetSupplySample[]>;\n/**\n * Fetch historical supply data for a specific asset.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useAssetSupplyHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useAssetSupplyHistory(\n args: Pausable<UseAssetSupplyHistoryArgs> & Suspendable,\n): PausableSuspenseResult<AssetSupplySample[]>;\n/**\n * Fetch historical supply data for a specific asset.\n *\n * ```tsx\n * const { data, error, loading } = useAssetSupplyHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * window: TimeWindow.LastWeek,\n * });\n * ```\n */\nexport function useAssetSupplyHistory(\n args: UseAssetSupplyHistoryArgs,\n): ReadResult<AssetSupplySample[]>;\n/**\n * Fetch historical supply data for a specific asset.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useAssetSupplyHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * pause: true,\n * });\n * ```\n */\nexport function useAssetSupplyHistory(\n args: Pausable<UseAssetSupplyHistoryArgs>,\n): PausableReadResult<AssetSupplySample[]>;\n\nexport function useAssetSupplyHistory({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseAssetSupplyHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<AssetSupplySample[], UnexpectedError> {\n return useSuspendableQuery({\n document: AssetSupplyHistoryQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n\nexport type UseAssetBorrowHistoryArgs = AssetBorrowHistoryRequest;\n\n/**\n * Fetch historical borrow data for a specific asset.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useAssetBorrowHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * });\n * ```\n */\nexport function useAssetBorrowHistory(\n args: UseAssetBorrowHistoryArgs & Suspendable,\n): SuspenseResult<AssetBorrowSample[]>;\n/**\n * Fetch historical borrow data for a specific asset.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useAssetBorrowHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useAssetBorrowHistory(\n args: Pausable<UseAssetBorrowHistoryArgs> & Suspendable,\n): PausableSuspenseResult<AssetBorrowSample[]>;\n/**\n * Fetch historical borrow data for a specific asset.\n *\n * ```tsx\n * const { data, error, loading } = useAssetBorrowHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * window: TimeWindow.LastWeek,\n * });\n * ```\n */\nexport function useAssetBorrowHistory(\n args: UseAssetBorrowHistoryArgs,\n): ReadResult<AssetBorrowSample[]>;\n/**\n * Fetch historical borrow data for a specific asset.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useAssetBorrowHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * pause: true,\n * });\n * ```\n */\nexport function useAssetBorrowHistory(\n args: Pausable<UseAssetBorrowHistoryArgs>,\n): PausableReadResult<AssetBorrowSample[]>;\n\nexport function useAssetBorrowHistory({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseAssetBorrowHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<AssetBorrowSample[], UnexpectedError> {\n return useSuspendableQuery({\n document: AssetBorrowHistoryQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n","import {\n type CurrencyQueryOptions,\n DEFAULT_QUERY_OPTIONS,\n type UnexpectedError,\n} from '@aave/client';\nimport { reserve, reserves } from '@aave/client/actions';\nimport {\n type APYSample,\n type BorrowAPYHistoryRequest,\n BorrowApyHistoryQuery,\n type Reserve,\n ReserveQuery,\n type ReserveRequest,\n ReservesQuery,\n type ReservesRequest,\n type SupplyAPYHistoryRequest,\n SupplyApyHistoryQuery,\n} from '@aave/graphql';\nimport type { NullishDeep, Prettify } from '@aave/types';\nimport { useAaveClient } from './context';\nimport {\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type ReadResult,\n type Selector,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n type UseAsyncTask,\n useAsyncTask,\n useSuspendableQuery,\n} from './helpers';\n\nexport type UseReserveArgs = Prettify<ReserveRequest & CurrencyQueryOptions>;\n\n/**\n * Fetch a specific reserve by reserve ID, spoke, and chain.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useReserve({\n * reserve: reserveId('SGVsbG8h'),\n * user: evmAddress('0xabc...'),\n * suspense: true,\n * });\n * // data will be Reserve | null\n * ```\n */\nexport function useReserve(\n args: UseReserveArgs & Suspendable,\n): SuspenseResult<Reserve | null>;\n/**\n * Fetch a specific reserve by reserve ID, spoke, and chain.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useReserve({\n * reserve: reserveId('SGVsbG8h'),\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useReserve(\n args: Pausable<UseReserveArgs> & Suspendable,\n): PausableSuspenseResult<Reserve | null>;\n/**\n * Fetch a specific reserve by reserve ID, spoke, and chain.\n *\n * ```tsx\n * const { data, error, loading } = useReserve({\n * reserve: reserveId('SGVsbG8h'),\n * user: evmAddress('0xabc...'),\n * });\n * // data will be Reserve | null\n * ```\n */\nexport function useReserve(args: UseReserveArgs): ReadResult<Reserve | null>;\n/**\n * Fetch a specific reserve by reserve ID, spoke, and chain.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useReserve({\n * reserve: reserveId('SGVsbG8h'),\n * pause: true,\n * });\n * ```\n */\nexport function useReserve(\n args: Pausable<UseReserveArgs>,\n): PausableReadResult<Reserve | null>;\n\nexport function useReserve({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseReserveArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Reserve | null, UnexpectedError> {\n return useSuspendableQuery({\n document: ReserveQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link reserve} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on the reserve.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useReserveAction();\n *\n * // …\n *\n * const result = await execute({\n * reserve: reserveId('SGVsbG8h'),\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // Reserve | null\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useReserveAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<ReserveRequest, Reserve | null, UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: ReserveRequest) =>\n reserve(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n\nexport type UseReservesArgs<T = Reserve[]> = Prettify<\n ReservesRequest &\n CurrencyQueryOptions & {\n /**\n * A function that maps the full list of reserves\n * into a derived or narrowed value.\n *\n * Example: pick a single reserve based on a criteria.\n *\n * @experimental This is experimental and may be subject to breaking changes.\n */\n selector?: Selector<Reserve[], T>;\n }\n>;\n\n/**\n * Fetch reserves based on specified criteria.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * filter: ReservesRequestFilter.All,\n * orderBy: { name: 'ASC' },\n * suspense: true,\n * });\n * ```\n *\n * **Reserves with Highest Supply APY**\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * suspense: true,\n * selector: pickHighestSupplyApyReserve,\n * });\n * ```\n *\n * **Reserves with Lowest Borrow APY**\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * suspense: true,\n * selector: pickLowestBorrowApyReserve,\n * });\n * ```\n */\nexport function useReserves<T = Reserve[]>(\n args: UseReservesArgs<T> & Suspendable,\n): SuspenseResult<T>;\n/**\n * Fetch reserves based on specified criteria.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useReserves<T = Reserve[]>(\n args: Pausable<UseReservesArgs<T>> & Suspendable,\n): PausableSuspenseResult<T>;\n/**\n * Fetch reserves based on specified criteria.\n *\n * ```tsx\n * const { data, error, loading } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * filter: ReservesRequestFilter.All,\n * orderBy: { name: 'ASC' },\n * });\n * ```\n *\n * **Reserves with Highest Supply APY**\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * selector: pickHighestSupplyApyReserve,\n * });\n * ```\n *\n * **Reserves with Lowest Borrow APY**\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * selector: pickLowestBorrowApyReserve,\n * });\n * ```\n */\nexport function useReserves<T = Reserve[]>(\n args: UseReservesArgs<T>,\n): ReadResult<T>;\n/**\n * Fetch reserves based on specified criteria.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * pause: true,\n * });\n * ```\n */\nexport function useReserves<T = Reserve[]>(\n args: Pausable<UseReservesArgs<T>>,\n): PausableReadResult<T>;\n\nexport function useReserves<T = Reserve[]>({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n selector,\n ...request\n}: NullishDeep<UseReservesArgs<T>> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<T, UnexpectedError> {\n return useSuspendableQuery({\n document: ReservesQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n selector: (selector || undefined) as Selector<Reserve[], T> | undefined,\n });\n}\n\n/**\n * Low-level hook to execute a {@link reserves} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on the reserves.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useReservesAction();\n *\n * // …\n *\n * const result = await execute({\n * query: {\n * spoke: {\n * address: evmAddress('0x1234…'),\n * chainId: chainId(1)\n * }\n * }\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // Reserve[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n *\n * **Reserves with Highest Supply APY**\n * ```ts\n * const [execute, { called, data, error, loading }] = useReservesAction();\n *\n * // …\n *\n * const result = await execute(…).map(pickHighestSupplyApyReserve);\n *\n * if (result.isOk()) {\n * console.log(result.value); // Reserve | null\n * } else {\n * console.error(result.error);\n * }\n * ```\n *\n * **Reserves with Lowest Borrow APY**\n * ```ts\n * const [execute, { called, data, error, loading }] = useReservesAction();\n *\n * // …\n *\n * const result = await execute(…).map(pickLowestBorrowApyReserve);\n *\n * if (result.isOk()) {\n * console.log(result.value); // Reserve | null\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useReservesAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<ReservesRequest, Reserve[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: ReservesRequest) =>\n reserves(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n\nexport type UseBorrowApyHistoryArgs = BorrowAPYHistoryRequest;\n\n/**\n * Fetch borrow APY history for a specific reserve over time.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useBorrowApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * });\n * ```\n */\nexport function useBorrowApyHistory(\n args: UseBorrowApyHistoryArgs & Suspendable,\n): SuspenseResult<APYSample[]>;\n/**\n * Fetch borrow APY history for a specific reserve over time.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useBorrowApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useBorrowApyHistory(\n args: Pausable<UseBorrowApyHistoryArgs> & Suspendable,\n): PausableSuspenseResult<APYSample[]>;\n/**\n * Fetch borrow APY history for a specific reserve over time.\n *\n * ```tsx\n * const { data, error, loading } = useBorrowApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * });\n * ```\n */\nexport function useBorrowApyHistory(\n args: UseBorrowApyHistoryArgs,\n): ReadResult<APYSample[]>;\n/**\n * Fetch borrow APY history for a specific reserve over time.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useBorrowApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * pause: true,\n * });\n * ```\n */\nexport function useBorrowApyHistory(\n args: Pausable<UseBorrowApyHistoryArgs>,\n): PausableReadResult<APYSample[]>;\n\nexport function useBorrowApyHistory({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseBorrowApyHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<APYSample[], UnexpectedError> {\n return useSuspendableQuery({\n document: BorrowApyHistoryQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n\nexport type UseSupplyApyHistoryArgs = SupplyAPYHistoryRequest;\n\n/**\n * Fetch supply APY history for a specific reserve over time.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSupplyApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * });\n * ```\n */\nexport function useSupplyApyHistory(\n args: UseSupplyApyHistoryArgs & Suspendable,\n): SuspenseResult<APYSample[]>;\n/**\n * Fetch supply APY history for a specific reserve over time.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSupplyApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSupplyApyHistory(\n args: Pausable<UseSupplyApyHistoryArgs> & Suspendable,\n): PausableSuspenseResult<APYSample[]>;\n/**\n * Fetch supply APY history for a specific reserve over time.\n *\n * ```tsx\n * const { data, error, loading } = useSupplyApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * });\n * ```\n */\nexport function useSupplyApyHistory(\n args: UseSupplyApyHistoryArgs,\n): ReadResult<APYSample[]>;\n/**\n * Fetch supply APY history for a specific reserve over time.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSupplyApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * pause: true,\n * });\n * ```\n */\nexport function useSupplyApyHistory(\n args: Pausable<UseSupplyApyHistoryArgs>,\n): PausableReadResult<APYSample[]>;\n\nexport function useSupplyApyHistory({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSupplyApyHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<APYSample[], UnexpectedError> {\n return useSuspendableQuery({\n document: SupplyApyHistoryQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n","import type { UnexpectedError } from '@aave/client';\nimport {\n type PaginatedSpokePositionManagerResult,\n type PaginatedSpokeUserPositionManagerResult,\n type Spoke,\n SpokePositionManagersQuery,\n type SpokePositionManagersRequest,\n SpokeQuery,\n type SpokeRequest,\n SpokesQuery,\n type SpokesRequest,\n SpokeUserPositionManagersQuery,\n type SpokeUserPositionManagersRequest,\n} from '@aave/graphql';\nimport type { NullishDeep } from '@aave/types';\nimport {\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type ReadResult,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n useSuspendableQuery,\n} from './helpers';\n\nexport type UseSpokeArgs = SpokeRequest;\n\n/**\n * Fetch a specific spoke.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSpoke({\n * query: { spokeId: spokeId('SGVsbG8h') },\n * suspense: true,\n * });\n * // data will be Spoke | null\n * ```\n */\nexport function useSpoke(\n args: UseSpokeArgs & Suspendable,\n): SuspenseResult<Spoke | null>;\n/**\n * Fetch a specific spoke.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSpoke({\n * query: { spokeId: spokeId('SGVsbG8h') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSpoke(\n args: Pausable<UseSpokeArgs> & Suspendable,\n): PausableSuspenseResult<Spoke | null>;\n/**\n * Fetch a specific spoke.\n *\n * ```tsx\n * const { data, error, loading } = useSpoke({\n * query: { spokeId: spokeId('SGVsbG8h') },\n * });\n * // data will be Spoke | null\n * ```\n */\nexport function useSpoke(args: UseSpokeArgs): ReadResult<Spoke | null>;\n/**\n * Fetch a specific spoke.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSpoke({\n * query: { spokeId: spokeId('SGVsbG8h') },\n * pause: true,\n * });\n * ```\n */\nexport function useSpoke(\n args: Pausable<UseSpokeArgs>,\n): PausableReadResult<Spoke | null>;\n\nexport function useSpoke({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSpokeArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Spoke | null, UnexpectedError> {\n return useSuspendableQuery({\n document: SpokeQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseSpokesArgs = SpokesRequest;\n\n/**\n * Fetch spokes based on specified criteria.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSpokes({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * });\n * ```\n */\nexport function useSpokes(\n args: UseSpokesArgs & Suspendable,\n): SuspenseResult<Spoke[]>;\n/**\n * Fetch spokes based on specified criteria.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSpokes({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSpokes(\n args: Pausable<UseSpokesArgs> & Suspendable,\n): PausableSuspenseResult<Spoke[]>;\n/**\n * Fetch spokes based on specified criteria.\n *\n * ```tsx\n * const { data, error, loading } = useSpokes({\n * query: { chainIds: [chainId(1)] },\n * });\n * ```\n */\nexport function useSpokes(args: UseSpokesArgs): ReadResult<Spoke[]>;\n/**\n * Fetch spokes based on specified criteria.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSpokes({\n * query: { chainIds: [chainId(1)] },\n * pause: true,\n * });\n * ```\n */\nexport function useSpokes(\n args: Pausable<UseSpokesArgs>,\n): PausableReadResult<Spoke[]>;\n\nexport function useSpokes({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSpokesArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Spoke[], UnexpectedError> {\n return useSuspendableQuery({\n document: SpokesQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseSpokePositionManagersArgs = SpokePositionManagersRequest;\n\n/**\n * Fetches all the positions manager for a specific spoke.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSpokePositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * suspense: true,\n * });\n * ```\n */\nexport function useSpokePositionManagers(\n args: UseSpokePositionManagersArgs & Suspendable,\n): SuspenseResult<PaginatedSpokePositionManagerResult>;\n/**\n * Fetches all the positions manager for a specific spoke.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSpokePositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSpokePositionManagers(\n args: Pausable<UseSpokePositionManagersArgs> & Suspendable,\n): PausableSuspenseResult<PaginatedSpokePositionManagerResult>;\n/**\n * Fetches all the positions manager for a specific spoke.\n *\n * ```tsx\n * const { data, error, loading } = useSpokePositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * });\n * ```\n */\nexport function useSpokePositionManagers(\n args: UseSpokePositionManagersArgs,\n): ReadResult<PaginatedSpokePositionManagerResult>;\n/**\n * Fetches all the positions manager for a specific spoke.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSpokePositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * pause: true,\n * });\n * ```\n */\nexport function useSpokePositionManagers(\n args: Pausable<UseSpokePositionManagersArgs>,\n): PausableReadResult<PaginatedSpokePositionManagerResult>;\n\nexport function useSpokePositionManagers({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSpokePositionManagersArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<PaginatedSpokePositionManagerResult, UnexpectedError> {\n return useSuspendableQuery({\n document: SpokePositionManagersQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseSpokeUserPositionManagersArgs = SpokeUserPositionManagersRequest;\n\n/**\n * Fetches all the position managers of a user for a specific spoke\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSpokeUserPositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * user: evmAddress('0x123...'),\n * suspense: true,\n * });\n * ```\n */\nexport function useSpokeUserPositionManagers(\n args: UseSpokeUserPositionManagersArgs & Suspendable,\n): SuspenseResult<PaginatedSpokeUserPositionManagerResult>;\n/**\n * Fetches all the position managers of a user for a specific spoke\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSpokeUserPositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * user: evmAddress('0x123...'),\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSpokeUserPositionManagers(\n args: Pausable<UseSpokeUserPositionManagersArgs> & Suspendable,\n): PausableSuspenseResult<PaginatedSpokeUserPositionManagerResult>;\n/**\n * Fetches all the position managers of a user for a specific spoke\n *\n * ```tsx\n * const { data, error, loading } = useSpokeUserPositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * user: evmAddress('0x123...'),\n * });\n * ```\n */\nexport function useSpokeUserPositionManagers(\n args: UseSpokeUserPositionManagersArgs,\n): ReadResult<PaginatedSpokeUserPositionManagerResult>;\n/**\n * Fetches all the position managers of a user for a specific spoke\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSpokeUserPositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * user: evmAddress('0x123...'),\n * pause: true,\n * });\n * ```\n */\nexport function useSpokeUserPositionManagers(\n args: Pausable<UseSpokeUserPositionManagersArgs>,\n): PausableReadResult<PaginatedSpokeUserPositionManagerResult>;\n\nexport function useSpokeUserPositionManagers({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSpokeUserPositionManagersArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<\n PaginatedSpokeUserPositionManagerResult,\n UnexpectedError\n> {\n return useSuspendableQuery({\n document: SpokeUserPositionManagersQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n });\n}\n","import {\n type CurrencyQueryOptions,\n DEFAULT_QUERY_OPTIONS,\n errAsync,\n ValidationError,\n} from '@aave/client';\nimport {\n cancelSwap,\n prepareSwap,\n prepareSwapCancel,\n swap,\n swapQuote,\n swapStatus,\n} from '@aave/client/actions';\nimport type {\n CancelError,\n SigningError,\n TimeoutError,\n TransactionError,\n UnexpectedError,\n} from '@aave/core';\nimport type {\n InsufficientBalanceError,\n PaginatedUserSwapsResult,\n PrepareSwapCancelRequest,\n SwapByIntentTypedData,\n SwapByIntentWithApprovalRequired,\n SwapCancelled,\n SwapExecutionPlan,\n SwapQuote,\n SwapQuoteRequest,\n SwapReceipt,\n SwapTransactionRequest,\n UserSwapsRequest,\n} from '@aave/graphql';\nimport {\n type CancelSwapTypedData,\n type ERC20PermitSignature,\n type PrepareSwapRequest,\n type SwapApprovalRequired,\n SwappableTokensQuery,\n type SwappableTokensRequest,\n SwapQuoteQuery,\n type Token,\n type TransactionRequest,\n UserSwapsQuery,\n} from '@aave/graphql';\nimport {\n invariant,\n type NullishDeep,\n okAsync,\n type Prettify,\n type ResultAsync,\n ResultAwareError,\n} from '@aave/types';\nimport { useCallback } from 'react';\nimport { useAaveClient } from './context';\nimport {\n type CancelOperation,\n cancel,\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n PendingTransaction,\n type PendingTransactionError,\n type ReadResult,\n type SendTransactionError,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n useSuspendableQuery,\n} from './helpers';\nimport { type UseAsyncTask, useAsyncTask } from './helpers/tasks';\n\nexport type UseSwapQuoteArgs = Prettify<\n SwapQuoteRequest & CurrencyQueryOptions\n>;\n\n/**\n * @internal\n * Fetch a swap quote for the specified trade parameters.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSwapQuote({\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * suspense: true,\n * });\n * ```\n */\nexport function useSwapQuote(\n args: UseSwapQuoteArgs & Suspendable,\n): SuspenseResult<SwapQuote>;\n/**\n * @internal\n * Fetch a swap quote for the specified trade parameters.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSwapQuote({\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * from: evmAddress('0x742d35cc...'),\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSwapQuote(\n args: Pausable<UseSwapQuoteArgs> & Suspendable,\n): PausableSuspenseResult<SwapQuote>;\n/**\n * @internal\n * Fetch a swap quote for the specified trade parameters.\n *\n * ```tsx\n * const { data, error, loading } = useSwapQuote({\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * });\n * ```\n */\nexport function useSwapQuote(args: UseSwapQuoteArgs): ReadResult<SwapQuote>;\n/**\n * @internal\n * Fetch a swap quote for the specified trade parameters.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSwapQuote({\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * from: evmAddress('0x742d35cc...'),\n * pause: true,\n * });\n * ```\n */\nexport function useSwapQuote(\n args: Pausable<UseSwapQuoteArgs>,\n): PausableReadResult<SwapQuote>;\n\n/**\n * @internal\n */\nexport function useSwapQuote({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseSwapQuoteArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<SwapQuote, UnexpectedError> {\n return useSuspendableQuery({\n document: SwapQuoteQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * @internal\n * Low-level hook to execute a swap quote action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on the swap quote.\n * Use this hook to retrieve quotes on demand as part of a larger workflow\n * (e.g., in an event handler to get a fresh quote before executing a swap).\n *\n * ```ts\n * const [getQuote, { called, data, error, loading }] = useSwapQuoteAction();\n *\n * // …\n *\n * const result = await getQuote({\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * });\n *\n * if (result.isOk()) {\n * console.log('Swap quote:', result.value);\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useSwapQuoteAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<SwapQuoteRequest, SwapQuote, UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: SwapQuoteRequest) =>\n swapQuote(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n\nexport type UseSwappableTokensArgs = SwappableTokensRequest;\n\n/**\n * @internal\n * Fetch the list of tokens available for swapping on a specific chain.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSwappableTokens({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * });\n * ```\n */\nexport function useSwappableTokens(\n args: UseSwappableTokensArgs & Suspendable,\n): SuspenseResult<Token[]>;\n/**\n * @internal\n * Fetch the list of tokens available for swapping on a specific chain.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSwappableTokens({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSwappableTokens(\n args: Pausable<UseSwappableTokensArgs> & Suspendable,\n): PausableSuspenseResult<Token[]>;\n/**\n * @internal\n * Fetch the list of tokens available for swapping on a specific chain.\n *\n * ```tsx\n * const { data, error, loading } = useSwappableTokens({\n * query: { chainIds: [chainId(1)] },\n * });\n * ```\n */\nexport function useSwappableTokens(\n args: UseSwappableTokensArgs,\n): ReadResult<Token[]>;\n/**\n * @internal\n * Fetch the list of tokens available for swapping on a specific chain.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSwappableTokens({\n * query: { chainIds: [chainId(1)] },\n * pause: true,\n * });\n * ```\n */\nexport function useSwappableTokens(\n args: Pausable<UseSwappableTokensArgs>,\n): PausableReadResult<Token[]>;\n\n/**\n * @internal\n */\nexport function useSwappableTokens({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSwappableTokensArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Token[], UnexpectedError> {\n return useSuspendableQuery({\n document: SwappableTokensQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseUserSwapsArgs = Prettify<\n UserSwapsRequest & CurrencyQueryOptions\n>;\n\n/**\n * @internal\n * Fetch the user's swap history for a specific chain.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserSwaps({\n * chainId: chainId(1),\n * user: evmAddress('0x742d35cc...'),\n * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],\n * suspense: true,\n * });\n * ```\n */\nexport function useUserSwaps(\n args: UseUserSwapsArgs & Suspendable,\n): SuspenseResult<PaginatedUserSwapsResult>;\n/**\n * @internal\n * Fetch the user's swap history for a specific chain.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserSwaps({\n * chainId: chainId(1),\n * user: evmAddress('0x742d35cc...'),\n * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserSwaps(\n args: Pausable<UseUserSwapsArgs> & Suspendable,\n): PausableSuspenseResult<PaginatedUserSwapsResult>;\n/**\n * @internal\n * Fetch the user's swap history for a specific chain.\n *\n * ```tsx\n * const { data, error, loading } = useUserSwaps({\n * chainId: chainId(1),\n * user: evmAddress('0x742d35cc...'),\n * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],\n * });\n * ```\n */\nexport function useUserSwaps(\n args: UseUserSwapsArgs,\n): ReadResult<PaginatedUserSwapsResult>;\n/**\n * @internal\n * Fetch the user's swap history for a specific chain.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserSwaps({\n * chainId: chainId(1),\n * user: evmAddress('0x742d35cc...'),\n * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],\n * pause: true,\n * });\n * ```\n */\nexport function useUserSwaps(\n args: Pausable<UseUserSwapsArgs>,\n): PausableReadResult<PaginatedUserSwapsResult>;\n\n/**\n * @internal\n */\nexport function useUserSwaps({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseUserSwapsArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<PaginatedUserSwapsResult, UnexpectedError> {\n return useSuspendableQuery({\n document: UserSwapsQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseSwapTokensRequest = Prettify<\n PrepareSwapRequest & CurrencyQueryOptions\n>;\n\nexport type SwapIntent =\n | SwapByIntentTypedData\n | SwapByIntentWithApprovalRequired\n | SwapTransactionRequest\n | SwapApprovalRequired;\n\nexport type SwapHandlerOptions = {\n cancel: CancelOperation;\n};\n\nexport type SwapHandler = (\n intent: SwapIntent,\n options: SwapHandlerOptions,\n) => ResultAsync<\n ERC20PermitSignature | SwapReceipt,\n SendTransactionError | PendingTransactionError\n>;\n\nfunction isERC20PermitSignature(\n signature: unknown,\n): signature is ERC20PermitSignature {\n return (\n typeof signature === 'object' &&\n signature !== null &&\n 'deadline' in signature &&\n 'value' in signature\n );\n}\n\n/**\n * @internal\n * Orchestrate the swap execution plan.\n *\n * ```tsx\n * const [sendTransaction, sending] = useSendTransaction(wallet);\n * const [signSwapByIntentWith, signing] = useSignSwapByIntentWith(wallet);\n *\n * const [swap, swapping] = useSwapTokens((plan) => {\n * switch (plan.__typename) {\n * case 'SwapByIntentTypedData':\n * return signSwapByIntentWith(plan);\n *\n * case 'SwapApprovalRequired':\n * case 'SwapByIntentWithApprovalRequired':\n * return sendTransaction(plan.transaction);\n *\n * case 'SwapTransactionRequest':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * const result = await swap({\n * market: {\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * user: evmAddress('0x742d35cc...'),\n * },\n * });\n *\n * if (result.isErr()) {\n * console.error(result.error);\n * return;\n * }\n *\n * // result.value: SwapReceipt\n * ```\n */\nexport function useSwapTokens(\n handler: SwapHandler,\n): UseAsyncTask<\n PrepareSwapRequest,\n SwapReceipt,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n const executeSwap = useCallback(\n (\n plan: SwapExecutionPlan,\n ): ResultAsync<\n SwapReceipt,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n > => {\n switch (plan.__typename) {\n case 'SwapTransactionRequest':\n return handler(plan, { cancel })\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => {\n return okAsync(plan.orderReceipt);\n });\n case 'SwapApprovalRequired':\n return handler(plan, { cancel })\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => {\n return okAsync(plan.originalTransaction.orderReceipt);\n });\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n case 'SwapReceipt':\n return okAsync(plan);\n }\n },\n [handler],\n );\n\n return useAsyncTask(\n ({\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n }: UseSwapTokensRequest) =>\n prepareSwap(client, request, { currency }).andThen((preparePlan) => {\n switch (preparePlan.__typename) {\n case 'SwapByTransaction':\n return swap(client, {\n transaction: { quoteId: preparePlan.quote.quoteId },\n }).andThen(executeSwap);\n\n case 'SwapByIntent':\n return handler(preparePlan.data, { cancel }).andThen(\n (signedTypedData) => {\n invariant(\n isERC20PermitSignature(signedTypedData),\n 'Invalid signature',\n );\n\n return swap(client, {\n intent: {\n quoteId: preparePlan.quote.quoteId,\n signature: signedTypedData.value,\n },\n }).andThen(executeSwap);\n },\n );\n\n case 'SwapByIntentWithApprovalRequired':\n return handler(preparePlan, { cancel })\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(preparePlan.data, { cancel }))\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen((signedTypedData) => {\n invariant(\n isERC20PermitSignature(signedTypedData),\n 'Invalid signature',\n );\n return swap(client, {\n intent: {\n quoteId: preparePlan.quote.quoteId,\n signature: signedTypedData.value,\n },\n }).andThen(executeSwap);\n });\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(preparePlan));\n }\n }),\n [client, handler, executeSwap],\n );\n}\n\nexport type CancelSwapHandler = (\n data: CancelSwapTypedData | TransactionRequest,\n) => ResultAsync<\n ERC20PermitSignature | PendingTransaction,\n SigningError | UnexpectedError\n>;\n\nexport class CannotCancelSwapError extends ResultAwareError {\n name = 'CannotCancelSwapError' as const;\n}\n\nexport type CancelSwapError =\n | CancelError\n | CannotCancelSwapError\n | SigningError\n | TimeoutError\n | TransactionError\n | UnexpectedError;\n\n/**\n * @internal\n * Executes the complete swap cancellation workflow combining preparation and execution.\n *\n * ```tsx\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [signSwapCancelWith] = useSignSwapCancelWith(wallet);\n *\n * const [cancelSwap, {loading, error}] = useCancelSwap((plan: CancelSwapTypedData | TransactionRequest) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n *\n * case 'CancelSwapTypedData':\n * return signSwapCancelWith(plan);\n * }\n * });\n *\n * const result = await cancelSwap({\n * id: swapId('123...'),\n * });\n *\n * if (result.isErr()) {\n * console.error(result.error);\n * return;\n * }\n *\n * // result.value: SwapCancelled\n * console.log('Swap cancelled:', result.value);\n * ```\n */\nexport function useCancelSwap(\n handler: CancelSwapHandler,\n): UseAsyncTask<PrepareSwapCancelRequest, SwapCancelled, CancelSwapError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request) =>\n swapStatus(client, { id: request.id }).andThen((status) => {\n switch (status.__typename) {\n case 'SwapOpen':\n case 'SwapPendingSignature':\n return prepareSwapCancel(client, request)\n .andThen((result) => handler(result.data))\n .andThen((signedTypedData) => {\n invariant(\n isERC20PermitSignature(signedTypedData),\n 'Invalid signature',\n );\n\n return cancelSwap(client, {\n intent: { id: request.id, signature: signedTypedData.value },\n });\n })\n .andThen((plan) => {\n if (plan.__typename === 'SwapCancelled') {\n return okAsync(plan);\n }\n\n return (\n handler(plan)\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n // TODO: verify that if fails cause too early, we need to waitForSwapOutcome(client)({ id: request.id })\n .andThen(() => swapStatus(client, { id: request.id }))\n .andThen((status) => {\n if (status.__typename === 'SwapCancelled') {\n return okAsync(status);\n }\n return errAsync(\n new CannotCancelSwapError('Failed to cancel swap'),\n );\n })\n );\n });\n\n case 'SwapCancelled':\n return okAsync(status);\n\n default:\n return errAsync(\n new CannotCancelSwapError('Swap cannot longer be cancelled'),\n );\n }\n }),\n [client, handler],\n );\n}\n","import type {\n AaveClient,\n ActivitiesRequest,\n CurrencyQueryOptions,\n PaginatedActivitiesResult,\n UnexpectedError,\n} from '@aave/client';\nimport { DEFAULT_QUERY_OPTIONS } from '@aave/client';\nimport {\n activities,\n borrow,\n liquidatePosition,\n preview,\n renounceSpokeUserPositionManager,\n repay,\n setSpokeUserPositionManager,\n setUserSupplyAsCollateral,\n supply,\n updateUserDynamicConfig,\n updateUserRiskPremium,\n withdraw,\n} from '@aave/client/actions';\nimport { ValidationError } from '@aave/core';\nimport {\n ActivitiesQuery,\n type BorrowRequest,\n decodeHubId,\n decodeReserveId,\n HubQuery,\n HubsQuery,\n type InsufficientBalanceError,\n isChainIdsVariant,\n isHubInputVariant,\n isSpokeInputVariant,\n type LiquidatePositionRequest,\n PreviewQuery,\n type PreviewRequest,\n type PreviewUserPosition,\n type RenounceSpokeUserPositionManagerRequest,\n type RepayRequest,\n ReservesQuery,\n type SetSpokeUserPositionManagerRequest,\n type SetUserSupplyAsCollateralRequest,\n SpokePositionManagersQuery,\n SpokesQuery,\n type SupplyRequest,\n type UpdateUserDynamicConfigRequest,\n type UpdateUserRiskPremiumRequest,\n UserBalancesQuery,\n UserPositionQuery,\n UserPositionsQuery,\n UserSummaryQuery,\n type WithdrawRequest,\n} from '@aave/graphql';\nimport {\n errAsync,\n type NullishDeep,\n type Prettify,\n type TxHash,\n} from '@aave/types';\nimport { useAaveClient } from './context';\nimport {\n cancel,\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type PendingTransactionError,\n type ReadResult,\n type SendTransactionError,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n type TransactionHandler,\n type UseAsyncTask,\n useAsyncTask,\n useSuspendableQuery,\n} from './helpers';\n\nfunction refreshQueriesForReserveChange(\n client: AaveClient,\n request: SupplyRequest | BorrowRequest | RepayRequest | WithdrawRequest,\n) {\n const { chainId, spoke } = decodeReserveId(request.reserve);\n return async () =>\n Promise.all([\n // update user positions\n await client.refreshQueryWhere(\n UserPositionsQuery,\n (variables, data) =>\n variables.request.user === request.sender &&\n data.some(\n (position) =>\n position.spoke.chain.chainId === chainId &&\n position.spoke.address === spoke,\n ),\n ),\n await client.refreshQueryWhere(\n UserPositionQuery,\n (_, data) =>\n data?.spoke.chain.chainId === chainId &&\n data?.spoke.address === spoke &&\n data.user === request.sender,\n ),\n\n // update user summary\n await client.refreshQueryWhere(UserSummaryQuery, (variables) =>\n variables.request.user === request.sender &&\n isSpokeInputVariant(variables.request.filter)\n ? variables.request.filter.spoke.chainId === chainId &&\n variables.request.filter.spoke.address === spoke\n : isChainIdsVariant(variables.request.filter)\n ? variables.request.filter.chainIds.some((id) => id === chainId)\n : false,\n ),\n\n // update reserves\n await client.refreshQueryWhere(ReservesQuery, (_, data) =>\n data.some((reserve) => reserve.id === request.reserve),\n ),\n\n // update spokes\n await client.refreshQueryWhere(SpokesQuery, (_, data) =>\n data.some(\n (item) => item.chain.chainId === chainId && item.address === spoke,\n ),\n ),\n\n // update user balances\n await client.refreshQueryWhere(\n UserBalancesQuery,\n // update any user balances for the given user\n (variables) => variables.request.user === request.sender,\n ),\n\n // update hubs\n await client.refreshQueryWhere(\n HubsQuery,\n (variables) =>\n isChainIdsVariant(variables.request) &&\n variables.request.chainIds.some((id) => id === chainId),\n ),\n ]);\n}\n\n/**\n * A hook that provides a way to supply assets to an Aave reserve.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [supply, { loading, error }] = useSupply((plan, { cancel }) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n * case 'Erc20ApprovalRequired':\n * case 'PreContractActionRequired':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * // …\n *\n * const result = await supply({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'ValidationError':\n * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transactions.\n */\nexport function useSupply(\n handler: TransactionHandler,\n): UseAsyncTask<\n SupplyRequest,\n TxHash,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: SupplyRequest) =>\n supply(client, request)\n .andThen((plan) => {\n switch (plan.__typename) {\n case 'TransactionRequest':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'Erc20ApprovalRequired':\n case 'PreContractActionRequired':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n }\n })\n .andTee(refreshQueriesForReserveChange(client, request)),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to borrow assets from an Aave reserve.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [borrow, { loading, error }] = useBorrow((plan, { cancel }) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n * case 'Erc20ApprovalRequired':\n * case 'PreContractActionRequired':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * // …\n *\n * const result = await borrow({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'ValidationError':\n * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transactions.\n */\nexport function useBorrow(\n handler: TransactionHandler,\n): UseAsyncTask<\n BorrowRequest,\n TxHash,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: BorrowRequest) =>\n borrow(client, request)\n .andThen((plan) => {\n switch (plan.__typename) {\n case 'TransactionRequest':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'Erc20ApprovalRequired':\n case 'PreContractActionRequired':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n }\n })\n .andTee(refreshQueriesForReserveChange(client, request)),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to repay borrowed assets to an Aave reserve.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [repay, { loading, error }] = useRepay((plan, { cancel }) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n * case 'Erc20ApprovalRequired':\n * case 'PreContractActionRequired':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * // …\n *\n * const result = await repay({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'ValidationError':\n * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transactions.\n */\nexport function useRepay(\n handler: TransactionHandler,\n): UseAsyncTask<\n RepayRequest,\n TxHash,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: RepayRequest) =>\n repay(client, request)\n .andThen((plan) => {\n switch (plan.__typename) {\n case 'TransactionRequest':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'Erc20ApprovalRequired':\n case 'PreContractActionRequired':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n }\n })\n .andTee(refreshQueriesForReserveChange(client, request)),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to withdraw supplied assets from an Aave reserve.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [withdraw, { loading, error }] = useWithdraw((plan, { cancel }) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n * case 'Erc20ApprovalRequired':\n * case 'PreContractActionRequired':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * // …\n *\n * const result = await withdraw({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'ValidationError':\n * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transactions.\n */\nexport function useWithdraw(\n handler: TransactionHandler,\n): UseAsyncTask<\n WithdrawRequest,\n TxHash,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: WithdrawRequest) =>\n withdraw(client, request)\n .andThen((plan) => {\n switch (plan.__typename) {\n case 'TransactionRequest':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'Erc20ApprovalRequired':\n case 'PreContractActionRequired':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n }\n })\n .andTee(refreshQueriesForReserveChange(client, request)),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to renounce a position manager of a user for a specific spoke.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [renounceSpokeUserPositionManager, { loading, error }] = useRenounceSpokeUserPositionManager(sendTransaction);\n *\n * // …\n *\n * const result = await renounceSpokeUserPositionManager({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transaction.\n */\n\nexport function useRenounceSpokeUserPositionManager(\n handler: TransactionHandler,\n): UseAsyncTask<\n RenounceSpokeUserPositionManagerRequest,\n TxHash,\n SendTransactionError | PendingTransactionError\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: RenounceSpokeUserPositionManagerRequest) =>\n renounceSpokeUserPositionManager(client, request)\n .andThen((transaction) => handler(transaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction)\n .andTee(() =>\n client.refreshQueryWhere(\n SpokePositionManagersQuery,\n (variables) => variables.request.spoke === request.spoke,\n ),\n ),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to update the user risk premium for a spoke.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [updateUserRiskPremium, { loading, error }] = useUpdateUserRiskPremium((transaction, { cancel }) => {\n * return sendTransaction(transaction);\n * });\n *\n * // …\n *\n * const result = await updateUserRiskPremium({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transaction.\n */\n\nexport function useUpdateUserRiskPremium(\n handler: TransactionHandler,\n): UseAsyncTask<\n UpdateUserRiskPremiumRequest,\n TxHash,\n SendTransactionError | PendingTransactionError\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: UpdateUserRiskPremiumRequest) =>\n updateUserRiskPremium(client, request)\n .andThen((transaction) => handler(transaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction)\n .andTee(async () =>\n Promise.all([\n client.refreshQueryWhere(\n UserPositionsQuery,\n (variables, data) =>\n variables.request.user === request.sender &&\n data.some((position) => position.spoke.id === request.spoke),\n ),\n client.refreshQueryWhere(\n UserPositionQuery,\n (_, data) =>\n data?.spoke.id === request.spoke &&\n data.user === request.sender,\n ),\n ]),\n ),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to update the user dynamic configuration for a spoke.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [updateUserDynamicConfig, { loading, error }] = useUpdateUserDynamicConfig((transaction, { cancel }) => {\n * return sendTransaction(transaction);\n * });\n *\n * // …\n *\n * const result = await updateUserDynamicConfig({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transaction.\n */\n\nexport function useUpdateUserDynamicConfig(\n handler: TransactionHandler,\n): UseAsyncTask<\n UpdateUserDynamicConfigRequest,\n TxHash,\n SendTransactionError | PendingTransactionError\n> {\n const client = useAaveClient();\n\n // TODO update relevant active queries once the location of dynamic config is clarified\n return useAsyncTask(\n (request: UpdateUserDynamicConfigRequest) =>\n updateUserDynamicConfig(client, request)\n .andThen((transaction) => handler(transaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction),\n [client, handler],\n );\n}\n\n/**\n * Hook for setting whether a user's supply should be used as collateral.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [setUserSupplyAsCollateral, { loading, error }] = useSetUserSupplyAsCollateral((transaction, { cancel }) => {\n * return sendTransaction(transaction);\n * });\n *\n * const result = await setUserSupplyAsCollateral({\n * reserve: reserveId('SGVsbG8h'),\n * sender: evmAddress('0x456...'),\n * enableCollateral: true,\n * });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transaction.\n */\nexport function useSetUserSupplyAsCollateral(\n handler: TransactionHandler,\n): UseAsyncTask<\n SetUserSupplyAsCollateralRequest,\n TxHash,\n SendTransactionError | PendingTransactionError\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: SetUserSupplyAsCollateralRequest) => {\n const { chainId, spoke } = decodeReserveId(request.reserve);\n return setUserSupplyAsCollateral(client, request)\n .andThen((transaction) => handler(transaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction)\n .andTee(() =>\n Promise.all([\n // update user positions\n client.refreshQueryWhere(\n UserPositionsQuery,\n (variables, data) =>\n variables.request.user === request.sender &&\n data.some(\n (position) =>\n position.spoke.chain.chainId === chainId &&\n position.spoke.address === spoke,\n ),\n ),\n client.refreshQueryWhere(\n UserPositionQuery,\n (_, data) =>\n data?.spoke.chain.chainId === chainId &&\n data?.spoke.address === spoke &&\n data.user === request.sender,\n ),\n\n // update user summary\n client.refreshQueryWhere(UserSummaryQuery, (variables) =>\n variables.request.user === request.sender &&\n isSpokeInputVariant(variables.request.filter)\n ? variables.request.filter.spoke.chainId === chainId &&\n variables.request.filter.spoke.address === spoke\n : isChainIdsVariant(variables.request.filter)\n ? variables.request.filter.chainIds.some(\n (id) => id === chainId,\n )\n : false,\n ),\n\n // update reserves\n client.refreshQueryWhere(ReservesQuery, (_, data) =>\n data.some((reserve) => reserve.id === request.reserve),\n ),\n\n // update spokes\n client.refreshQueryWhere(SpokesQuery, (_, data) =>\n data.some(\n (item) =>\n item.chain.chainId === chainId && item.address === spoke,\n ),\n ),\n\n // update hubs\n client.refreshQueryWhere(HubsQuery, (variables) =>\n isChainIdsVariant(variables.request.query)\n ? variables.request.query.chainIds.some((id) => id === chainId)\n : variables.request.query.tokens.some(\n (token) => token.chainId === chainId,\n ),\n ),\n client.refreshQueryWhere(HubQuery, (variables) =>\n isHubInputVariant(variables.request.query)\n ? variables.request.query.hubInput.chainId === chainId\n : decodeHubId(variables.request.query.hubId).chainId ===\n chainId,\n ),\n ]),\n );\n },\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to liquidate a user's position.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [liquidatePosition, { loading, error }] = useLiquidatePosition((plan, { cancel }) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n * case 'Erc20ApprovalRequired':\n * case 'PreContractActionRequired':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * // …\n *\n * const result = await liquidatePosition({\n * collateral: reserveId('SGVsbG8h'),\n * debt: reserveId('Q2lhbyE= '),\n * amount: amount,\n * liquidator: liquidator,\n * borrower: borrower,\n * });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'ValidationError':\n * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transactions.\n */\nexport function useLiquidatePosition(\n handler: TransactionHandler,\n): UseAsyncTask<\n LiquidatePositionRequest,\n TxHash,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: LiquidatePositionRequest) =>\n // TODO: update the relevant read queries\n liquidatePosition(client, request).andThen((plan) => {\n switch (plan.__typename) {\n case 'TransactionRequest':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'Erc20ApprovalRequired':\n case 'PreContractActionRequired':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n }\n }),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to set or remove a position manager for a user on a specific spoke.\n *\n * **Position managers** can perform transactions on behalf of other users, including:\n * - Supply assets\n * - Borrow assets\n * - Withdraw assets\n * - Enable/disable collateral\n *\n * The `signature` parameter is an **ERC712 signature** that must be signed by the **user**\n * (the account granting permissions) to authorize the position manager. The signature contains:\n * - `value`: The actual cryptographic signature\n * - `deadline`: Unix timestamp when the authorization expires\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [setSpokeUserPositionManager, { loading, error }] = useSetSpokeUserPositionManager((transaction, { cancel }) => {\n * return sendTransaction(transaction);\n * });\n *\n * const result = await setSpokeUserPositionManager({\n * spoke: spokeId('SGVsbG8h'),\n * manager: evmAddress('0x9abc…'), // Address that will become the position manager\n * approve: true, // true to approve, false to remove the manager\n * user: evmAddress('0xdef0…'), // User granting the permission (must sign the signature)\n * signature: {\n * value: '0x1234...', // ERC712 signature signed by the user\n * deadline: 1735689600, // Unix timestamp when signature expires\n * },\n * });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transaction.\n */\nexport function useSetSpokeUserPositionManager(\n handler: TransactionHandler,\n): UseAsyncTask<\n SetSpokeUserPositionManagerRequest,\n TxHash,\n SendTransactionError | PendingTransactionError\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: SetSpokeUserPositionManagerRequest) =>\n setSpokeUserPositionManager(client, request)\n .andThen((transaction) => handler(transaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction)\n .andTee(() =>\n client.refreshQueryWhere(\n SpokePositionManagersQuery,\n (variables) => variables.request.spoke === request.spoke,\n ),\n ),\n [client, handler],\n );\n}\n\n/**\n * Preview the impact of a potential action on a user's position.\n *\n * ```tsx\n * const [getPreview, previewing] = usePreviewAction();\n *\n * const loading = previewing.loading;\n * const error = previewing.error;\n *\n * // …\n *\n * const result = await getPreview({\n * action: {\n * supply: {\n * reserve: reserveId('SGVsbG8h'),\n * amount: {\n * erc20: {\n * value: '1000',\n * },\n * },\n * sender: evmAddress('0x9abc…'),\n * },\n * },\n * });\n *\n * if (result.isErr()) {\n * console.error(result.error);\n * return;\n * }\n *\n * console.log('Preview result:', result.value);\n * ```\n */\nexport function usePreviewAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<PreviewRequest, PreviewUserPosition, UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: PreviewRequest) =>\n preview(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n\nexport type UsePreviewArgs = Prettify<PreviewRequest & CurrencyQueryOptions>;\n\n/**\n * Fetch a preview of the impact of a potential action on a user's position.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = usePreview({\n * action: {\n * supply: {\n * reserve: reserveId('SGVsbG8h'),\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * supplier: evmAddress('0x9abc…'),\n * },\n * },\n * suspense: true,\n * });\n * ```\n */\nexport function usePreview(\n args: UsePreviewArgs & Suspendable,\n): SuspenseResult<PreviewUserPosition>;\n/**\n * Fetch a preview of the impact of a potential action on a user's position.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = usePreview({\n * action: {\n * supply: {\n * reserve: reserveId('SGVsbG8h'),\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * supplier: evmAddress('0x9abc…'),\n * },\n * },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function usePreview(\n args: Pausable<UsePreviewArgs> & Suspendable,\n): PausableSuspenseResult<PreviewUserPosition>;\n/**\n * Fetch a preview of the impact of a potential action on a user's position.\n *\n * ```tsx\n * const { data, error, loading } = usePreview({\n * action: {\n * supply: {\n * reserve: reserveId('SGVsbG8h'),\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * supplier: evmAddress('0x9abc…'),\n * },\n * },\n * });\n * ```\n */\nexport function usePreview(\n args: UsePreviewArgs,\n): ReadResult<PreviewUserPosition>;\n/**\n * Fetch a preview of the impact of a potential action on a user's position.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = usePreview({\n * action: {\n * supply: {\n * reserve: reserveId('SGVsbG8h'),\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * supplier: evmAddress('0x9abc…'),\n * },\n * },\n * pause: true,\n * });\n * ```\n */\nexport function usePreview(\n args: Pausable<UsePreviewArgs>,\n): PausableReadResult<PreviewUserPosition>;\n\nexport function usePreview({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UsePreviewArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<PreviewUserPosition, UnexpectedError> {\n return useSuspendableQuery({\n document: PreviewQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseActivitiesArgs = Prettify<\n ActivitiesRequest & CurrencyQueryOptions\n>;\n\n/**\n * Fetch paginated list of activities.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useActivities({\n * query: {\n * chainId: chainId(1),\n * },\n * user: evmAddress('0x742d35cc…'),\n * suspense: true,\n * });\n *\n * // data.items: ActivityItem[]\n * ```\n */\nexport function useActivities(\n args: UseActivitiesArgs & Suspendable,\n): SuspenseResult<PaginatedActivitiesResult>;\n/**\n * Fetch paginated list of activities.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useActivities({\n * query: {\n * chainId: chainId(1),\n * },\n * user: evmAddress('0x742d35cc…'),\n * suspense: true,\n * pause: true,\n * });\n *\n * // data?.items: ActivityItem[] | undefined\n * ```\n */\nexport function useActivities(\n args: Pausable<UseActivitiesArgs> & Suspendable,\n): PausableSuspenseResult<PaginatedActivitiesResult>;\n/**\n * Fetch paginated list of activities.\n *\n * ```tsx\n * const { data, error, loading } = useActivities({\n * query: {\n * chainId: chainId(1),\n * },\n * user: evmAddress('0x742d35cc…'),\n * });\n * ```\n */\nexport function useActivities(\n args: UseActivitiesArgs,\n): ReadResult<PaginatedActivitiesResult>;\n/**\n * Fetch paginated list of activities.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading } = useActivities({\n * query: {\n * chainId: chainId(1),\n * },\n * user: evmAddress('0x742d35cc…'),\n * pause: true,\n * });\n *\n * // data?.items: ActivityItem[] | undefined\n * // error: UnexpectedError | undefined\n * // loading: boolean | undefined\n * ```\n */\nexport function useActivities(\n args: Pausable<UseActivitiesArgs>,\n): PausableReadResult<PaginatedActivitiesResult>;\n\nexport function useActivities({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseActivitiesArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<PaginatedActivitiesResult, UnexpectedError> {\n return useSuspendableQuery({\n document: ActivitiesQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link activities} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook does not actively watch for updates. Use it to fetch activities on demand\n * (e.g., in an event handler when paginating or refining filters).\n *\n * @param options - The query options.\n * @returns The user history.\n */\nexport function useActivitiesAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<ActivitiesRequest, PaginatedActivitiesResult, UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: ActivitiesRequest) =>\n activities(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n","import {\n type CurrencyQueryOptions,\n DEFAULT_QUERY_OPTIONS,\n type TimeWindowQueryOptions,\n type UnexpectedError,\n} from '@aave/client';\nimport type { UserPositionQueryOptions } from '@aave/client/actions';\nimport {\n userBalances,\n userBorrows,\n userPositions,\n userSupplies,\n} from '@aave/client/actions';\nimport {\n type UserBalance,\n UserBalancesQuery,\n type UserBalancesRequest,\n type UserBorrowItem,\n UserBorrowsQuery,\n type UserBorrowsRequest,\n type UserPosition,\n UserPositionQuery,\n type UserPositionRequest,\n UserPositionsQuery,\n type UserPositionsRequest,\n type UserSummary,\n type UserSummaryHistoryItem,\n UserSummaryHistoryQuery,\n type UserSummaryHistoryRequest,\n UserSummaryQuery,\n type UserSummaryRequest,\n UserSuppliesQuery,\n type UserSuppliesRequest,\n type UserSupplyItem,\n} from '@aave/graphql';\nimport type { NullishDeep, Prettify } from '@aave/types';\nimport { useAaveClient } from './context';\nimport {\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type ReadResult,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n type UseAsyncTask,\n useAsyncTask,\n useSuspendableQuery,\n} from './helpers';\n\nexport type UseUserSuppliesArgs = Prettify<\n UserSuppliesRequest & CurrencyQueryOptions\n>;\n\n/**\n * Fetch all user supply positions.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserSupplies({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * suspense: true,\n * });\n * ```\n */\nexport function useUserSupplies(\n args: UseUserSuppliesArgs & Suspendable,\n): SuspenseResult<UserSupplyItem[]>;\n/**\n * Fetch all user supply positions.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserSupplies({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * suspense: true,\n * pause: true,\n * });\n *\n * // data?.length: number | undefined\n * ```\n */\nexport function useUserSupplies(\n args: Pausable<UseUserSuppliesArgs> & Suspendable,\n): PausableSuspenseResult<UserSupplyItem[]>;\n/**\n * Fetch all user supply positions.\n *\n * ```tsx\n * const { data, error, loading } = useUserSupplies({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * });\n * ```\n */\nexport function useUserSupplies(\n args: UseUserSuppliesArgs,\n): ReadResult<UserSupplyItem[]>;\n/**\n * Fetch all user supply positions.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserSupplies({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * pause: true,\n * });\n *\n * // data?.length: number | undefined\n * // error: UnexpectedError | undefined\n * // loading: boolean | undefined\n * // paused: boolean\n * ```\n */\nexport function useUserSupplies(\n args: Pausable<UseUserSuppliesArgs>,\n): PausableReadResult<UserSupplyItem[]>;\n\nexport function useUserSupplies({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseUserSuppliesArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserSupplyItem[], UnexpectedError> {\n return useSuspendableQuery({\n document: UserSuppliesQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link userSupplies} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on user supplies.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useUserSuppliesAction();\n *\n * // …\n *\n * const result = await execute({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // UserSupplyItem[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useUserSuppliesAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<UserSuppliesRequest, UserSupplyItem[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: UserSuppliesRequest) =>\n userSupplies(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n\nexport type UseUserBorrowsArgs = Prettify<\n UserBorrowsRequest & CurrencyQueryOptions\n>;\n\n/**\n * Fetch all user borrow positions.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserBorrows({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * suspense: true,\n * });\n * ```\n */\nexport function useUserBorrows(\n args: UseUserBorrowsArgs & Suspendable,\n): SuspenseResult<UserBorrowItem[]>;\n/**\n * Fetch all user borrow positions.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserBorrows({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserBorrows(\n args: Pausable<UseUserBorrowsArgs> & Suspendable,\n): PausableSuspenseResult<UserBorrowItem[]>;\n/**\n * Fetch all user borrow positions.\n *\n * ```tsx\n * const { data, error, loading } = useUserBorrows({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * });\n * ```\n */\nexport function useUserBorrows(\n args: UseUserBorrowsArgs,\n): ReadResult<UserBorrowItem[]>;\n/**\n * Fetch all user borrow positions.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserBorrows({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * pause: true,\n * });\n * ```\n */\nexport function useUserBorrows(\n args: Pausable<UseUserBorrowsArgs>,\n): PausableReadResult<UserBorrowItem[]>;\n\nexport function useUserBorrows({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseUserBorrowsArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserBorrowItem[], UnexpectedError> {\n return useSuspendableQuery({\n document: UserBorrowsQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link userBorrows} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on user borrows.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useUserBorrowsAction();\n *\n * // …\n *\n * const result = await execute({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // UserBorrowItem[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useUserBorrowsAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<UserBorrowsRequest, UserBorrowItem[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: UserBorrowsRequest) =>\n userBorrows(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n\nexport type UseUserSummaryArgs = Prettify<\n UserSummaryRequest & TimeWindowQueryOptions & CurrencyQueryOptions\n>;\n\n/**\n * Fetch a user's financial summary.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserSummary({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * },\n * suspense: true,\n * });\n * ```\n */\nexport function useUserSummary(\n args: UseUserSummaryArgs & Suspendable,\n): SuspenseResult<UserSummary>;\n/**\n * Fetch a user's financial summary.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserSummary({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserSummary(\n args: Pausable<UseUserSummaryArgs> & Suspendable,\n): PausableSuspenseResult<UserSummary>;\n/**\n * Fetch a user's financial summary.\n *\n * ```tsx\n * const { data, error, loading } = useUserSummary({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * },\n * });\n * ```\n */\nexport function useUserSummary(\n args: UseUserSummaryArgs,\n): ReadResult<UserSummary>;\n/**\n * Fetch a user's financial summary.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserSummary({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * },\n * pause: true,\n * });\n * ```\n */\nexport function useUserSummary(\n args: Pausable<UseUserSummaryArgs>,\n): PausableReadResult<UserSummary>;\n\nexport function useUserSummary({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseUserSummaryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserSummary, UnexpectedError> {\n return useSuspendableQuery({\n document: UserSummaryQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseUserPositionsArgs = Prettify<\n UserPositionsRequest & UserPositionQueryOptions\n>;\n\n/**\n * Fetch all user positions across specified chains.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserPositions({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * orderBy: { balance: 'DESC' },\n * suspense: true,\n * });\n * ```\n */\nexport function useUserPositions(\n args: UseUserPositionsArgs & Suspendable,\n): SuspenseResult<UserPosition[]>;\n/**\n * Fetch all user positions across specified chains.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserPositions({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * orderBy: { balance: 'DESC' },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserPositions(\n args: Pausable<UseUserPositionsArgs> & Suspendable,\n): PausableSuspenseResult<UserPosition[]>;\n/**\n * Fetch all user positions across specified chains.\n *\n * ```tsx\n * const { data, error, loading } = useUserPositions({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * orderBy: { balance: 'DESC' },\n * });\n * ```\n */\nexport function useUserPositions(\n args: UseUserPositionsArgs,\n): ReadResult<UserPosition[]>;\n/**\n * Fetch all user positions across specified chains.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserPositions({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * orderBy: { balance: 'DESC' },\n * pause: true,\n * });\n * ```\n */\nexport function useUserPositions(\n args: Pausable<UseUserPositionsArgs>,\n): PausableReadResult<UserPosition[]>;\n\nexport function useUserPositions({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseUserPositionsArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserPosition[], UnexpectedError> {\n return useSuspendableQuery({\n document: UserPositionsQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link userPositions} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on user positions.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useUserPositionsAction();\n *\n * // …\n *\n * const result = await execute({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * chainIds: [chainId(1), chainId(137)]\n * },\n * orderBy: { balance: 'DESC' },\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // UserPosition[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useUserPositionsAction(\n options: UserPositionQueryOptions = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<UserPositionsRequest, UserPosition[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: UserPositionsRequest) =>\n userPositions(client, request, {\n currency: options.currency,\n timeWindow: options.timeWindow,\n }),\n [client, options.currency, options.timeWindow],\n );\n}\n\nexport type UseUserPositionArgs = Prettify<\n UserPositionRequest & UserPositionQueryOptions\n>;\n\n/**\n * Fetch a specific user position by ID.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserPosition({\n * id: userPositionId('SGVsbG8h'),\n * user: evmAddress('0x742d35cc…'),\n * suspense: true,\n * });\n * ```\n */\nexport function useUserPosition(\n args: UseUserPositionArgs & Suspendable,\n): SuspenseResult<UserPosition>;\n/**\n * Fetch a specific user position by ID.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserPosition({\n * id: userPositionId('SGVsbG8h'),\n * user: evmAddress('0x742d35cc…'),\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserPosition(\n args: Pausable<UseUserPositionArgs> & Suspendable,\n): PausableSuspenseResult<UserPosition>;\n/**\n * Fetch a specific user position by ID.\n *\n * ```tsx\n * const { data, error, loading } = useUserPosition({\n * id: userPositionId('SGVsbG8h'),\n * user: evmAddress('0x742d35cc…'),\n * });\n * ```\n */\nexport function useUserPosition(\n args: UseUserPositionArgs,\n): ReadResult<UserPosition>;\n/**\n * Fetch a specific user position by ID.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserPosition({\n * id: userPositionId('SGVsbG8h'),\n * user: evmAddress('0x742d35cc…'),\n * pause: true,\n * });\n * ```\n */\nexport function useUserPosition(\n args: Pausable<UseUserPositionArgs>,\n): PausableReadResult<UserPosition>;\n\nexport function useUserPosition({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseUserPositionArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserPosition | null, UnexpectedError> {\n return useSuspendableQuery({\n document: UserPositionQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseUserBalancesArgs = Prettify<\n UserBalancesRequest & CurrencyQueryOptions\n>;\n\n/**\n * Fetch all user balances across specified chains.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserBalances({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * suspense: true,\n * });\n * ```\n */\nexport function useUserBalances(\n args: UseUserBalancesArgs & Suspendable,\n): SuspenseResult<UserBalance[]>;\n/**\n * Fetch all user balances across specified chains.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserBalances({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserBalances(\n args: Pausable<UseUserBalancesArgs> & Suspendable,\n): PausableSuspenseResult<UserBalance[]>;\n/**\n * Fetch all user balances across specified chains.\n *\n * ```tsx\n * const { data, error, loading } = useUserBalances({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * });\n * ```\n */\nexport function useUserBalances(\n args: UseUserBalancesArgs,\n): ReadResult<UserBalance[]>;\n/**\n * Fetch all user balances across specified chains.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserBalances({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * pause: true,\n * });\n * ```\n */\nexport function useUserBalances(\n args: Pausable<UseUserBalancesArgs>,\n): PausableReadResult<UserBalance[]>;\n\nexport function useUserBalances({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseUserBalancesArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserBalance[], UnexpectedError> {\n return useSuspendableQuery({\n document: UserBalancesQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link userBalances} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on user balances.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useUserBalancesAction();\n *\n * // …\n *\n * const result = await execute({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * chainIds: [chainId(1), chainId(137)]\n * },\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // UserBalance[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useUserBalancesAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<UserBalancesRequest, UserBalance[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: UserBalancesRequest) =>\n userBalances(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n\nexport type UseUserSummaryHistoryArgs = Prettify<\n UserSummaryHistoryRequest & CurrencyQueryOptions\n>;\n\n/**\n * Fetch user summary history over time.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserSummaryHistory({\n * user: evmAddress('0x742d35cc…'),\n * window: TimeWindow.LastWeek,\n * filter: { chainIds: [chainId(1)] },\n * suspense: true,\n * });\n * ```\n */\nexport function useUserSummaryHistory(\n args: UseUserSummaryHistoryArgs & Suspendable,\n): SuspenseResult<UserSummaryHistoryItem[]>;\n/**\n * Fetch user summary history over time.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserSummaryHistory({\n * user: evmAddress('0x742d35cc…'),\n * window: TimeWindow.LastWeek,\n * filter: { chainIds: [chainId(1)] },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserSummaryHistory(\n args: Pausable<UseUserSummaryHistoryArgs> & Suspendable,\n): PausableSuspenseResult<UserSummaryHistoryItem[]>;\n/**\n * Fetch user summary history over time.\n *\n * ```tsx\n * const { data, error, loading } = useUserSummaryHistory({\n * user: evmAddress('0x742d35cc…'),\n * window: TimeWindow.LastWeek,\n * filter: { chainIds: [chainId(1)] },\n * });\n * ```\n */\nexport function useUserSummaryHistory(\n args: UseUserSummaryHistoryArgs,\n): ReadResult<UserSummaryHistoryItem[]>;\n/**\n * Fetch user summary history over time.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserSummaryHistory({\n * user: evmAddress('0x742d35cc…'),\n * window: TimeWindow.LastWeek,\n * filter: { chainIds: [chainId(1)] },\n * pause: true,\n * });\n * ```\n */\nexport function useUserSummaryHistory(\n args: Pausable<UseUserSummaryHistoryArgs>,\n): PausableReadResult<UserSummaryHistoryItem[]>;\n\nexport function useUserSummaryHistory({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseUserSummaryHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserSummaryHistoryItem[], UnexpectedError> {\n return useSuspendableQuery({\n document: UserSummaryHistoryQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/AaveProvider.tsx","../src/hubs.ts","../src/protocol.ts","../src/reserves.ts","../src/spokes.ts","../src/swap.ts","../src/transactions.ts","../src/user.ts"],"names":["AaveProvider","children","client","React","AaveContextProvider","useHub","suspense","pause","currency","DEFAULT_QUERY_OPTIONS","timeWindow","request","useSuspendableQuery","HubQuery","useHubs","HubsQuery","useHubAssets","HubAssetsQuery","useHubsAction","options","useAaveClient","useAsyncTask","hubs","useAsset","AssetQuery","useAssetPriceHistory","AssetPriceHistoryQuery","useAssetSupplyHistory","AssetSupplyHistoryQuery","useAssetBorrowHistory","AssetBorrowHistoryQuery","useReserve","ReserveQuery","useReserveAction","reserve","useReserves","selector","ReservesQuery","useReservesAction","reserves","useBorrowApyHistory","BorrowApyHistoryQuery","useSupplyApyHistory","SupplyApyHistoryQuery","useSpoke","SpokeQuery","useSpokes","SpokesQuery","useSpokePositionManagers","SpokePositionManagersQuery","useSpokeUserPositionManagers","SpokeUserPositionManagersQuery","useSwapQuote","SwapQuoteQuery","useSwapQuoteAction","swapQuote","useSwappableTokens","SwappableTokensQuery","useUserSwaps","UserSwapsQuery","isERC20PermitSignature","signature","useSwapTokens","handler","executeSwap","useCallback","plan","cancel","PendingTransaction","pendingTransaction","okAsync","errAsync","ValidationError","prepareSwap","preparePlan","swap","signedTypedData","invariant","CannotCancelSwapError","ResultAwareError","useCancelSwap","swapStatus","status","prepareSwapCancel","result","cancelSwap","refreshQueriesForReserveChange","chainId","spoke","decodeReserveId","UserPositionsQuery","variables","data","position","UserPositionQuery","_","UserSummaryQuery","isSpokeInputVariant","isChainIdsVariant","id","item","UserBalancesQuery","useSupply","supply","useBorrow","borrow","useRepay","repay","useWithdraw","withdraw","useRenounceSpokeUserPositionManager","renounceSpokeUserPositionManager","transaction","useUpdateUserPositionConditions","updateUserPositionConditions","userPositionId","useSetUserSuppliesAsCollateral","reserveIds","change","reserveDetails","reserveId","setUserSuppliesAsCollateral","token","isHubInputVariant","decodeHubId","useLiquidatePosition","liquidatePosition","useSetSpokeUserPositionManager","setSpokeUserPositionManager","usePreviewAction","preview","usePreview","PreviewQuery","useActivities","ActivitiesQuery","useActivitiesAction","activities","useUserSupplies","UserSuppliesQuery","useUserSuppliesAction","userSupplies","useUserBorrows","UserBorrowsQuery","useUserBorrowsAction","userBorrows","useUserSummary","useUserPositions","useUserPositionsAction","userPositions","useUserPosition","useUserBalances","useUserBalancesAction","userBalances","useUserSummaryHistory","UserSummaryHistoryQuery"],"mappings":"s+CAuCO,SAASA,EAAAA,CAAa,CAAE,SAAAC,CAAAA,CAAU,MAAA,CAAAC,CAAO,CAAA,CAAsB,CACpE,OAAOC,CAAAA,CAAA,aAAA,CAACC,EAAA,CAAoB,MAAA,CAAQF,GAASD,CAAS,CACxD,CCsDO,SAASI,GAAO,CACrB,QAAA,CAAAC,CAAAA,CAAW,KAAA,CACX,KAAA,CAAAC,CAAAA,CAAQ,MACR,QAAA,CAAAC,CAAAA,CAAWC,sBAAsB,QAAA,CACjC,UAAA,CAAAC,EAAaD,qBAAAA,CAAsB,UAAA,CACnC,GAAGE,CACL,CAAA,CAGmD,CACjD,OAAOC,CAAAA,CAAoB,CACzB,QAAA,CAAUC,QAAAA,CACV,UAAW,CACT,OAAA,CAAAF,CAAAA,CACA,QAAA,CAAAH,CAAAA,CACA,UAAA,CAAAE,CACF,CAAA,CACA,QAAA,CAAAJ,EACA,KAAA,CAAAC,CACF,CAAC,CACH,CA2DO,SAASO,EAAAA,CAAQ,CACtB,SAAAR,CAAAA,CAAW,KAAA,CACX,MAAAC,CAAAA,CAAQ,KAAA,CACR,SAAAC,CAAAA,CAAWC,qBAAAA,CAAsB,QAAA,CACjC,UAAA,CAAAC,CAAAA,CAAaD,qBAAAA,CAAsB,WACnC,GAAGE,CACL,EAG8C,CAC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SAASgJ,EAAAA,CACdpI,GAAAA,CAA0CV,sBACyB,CACnE,IAAMP,EAASkB,CAAAA,EAAc,CAE7B,OAAOC,CAAAA,CACJV,CAAAA,EACC6I,YAAAA,CAAatJ,CAAAA,CAAQS,CAAAA,CAAS,CAAE,SAAUQ,GAAAA,CAAQ,QAAS,CAAC,CAAA,CAC9D,CAACjB,EAAQiB,GAAAA,CAAQ,QAAQ,CAC3B,CACF,CAyEO,SAASsI,EAAAA,CAAsB,CACpC,SAAAnJ,CAAAA,CAAW,KAAA,CACX,MAAAC,CAAAA,CAAQ,KAAA,CACR,QAAA,CAAAC,CAAAA,CAAWC,qBAAAA,CAAsB,QAAA,CACjC,GAAGE,CACL,CAAA,CAGiE,CAC/D,OAAOC,CAAAA,CAAoB,CACzB,QAAA,CAAU8I,uBAAAA,CACV,UAAW,CACT,OAAA,CAAA/I,EACA,QAAA,CAAAH,CACF,EACA,QAAA,CAAAF,CAAAA,CACA,MAAAC,CAAAA,CACA,KAAA,CAAO,KACT,CAAC,CACH","file":"index.js","sourcesContent":["import type { AaveClient } from '@aave/client';\n// biome-ignore lint/correctness/noUnusedImports: intentional\nimport React, { type ReactNode } from 'react';\n\nimport { AaveContextProvider } from './context';\n\n/**\n * <AaveProvider> props\n */\nexport type AaveProviderProps = {\n /**\n * The children to render\n */\n children: ReactNode;\n /**\n * The Aave client instance to use\n */\n client: AaveClient;\n};\n\n/**\n * Manages the internal state of the Aave SDK.\n *\n * ```tsx\n * import { AaveProvider, AaveClient, production } from '@aave/react';\n *\n * const client = AaveClient.create({\n * environment: production,\n * });\n *\n * function App() {\n * return (\n * <AaveProvider client={client}>\n * // ...\n * </AaveProvider>\n * );\n * }\n * ```\n */\nexport function AaveProvider({ children, client }: AaveProviderProps) {\n return <AaveContextProvider client={client}>{children}</AaveContextProvider>;\n}\n","import {\n type CurrencyQueryOptions,\n DEFAULT_QUERY_OPTIONS,\n type TimeWindowQueryOptions,\n type UnexpectedError,\n} from '@aave/client';\nimport { hubs } from '@aave/client/actions';\nimport {\n type Hub,\n type HubAsset,\n HubAssetsQuery,\n type HubAssetsRequest,\n HubQuery,\n type HubRequest,\n HubsQuery,\n type HubsRequest,\n} from '@aave/graphql';\nimport type { NullishDeep, Prettify } from '@aave/types';\nimport { useAaveClient } from './context';\nimport {\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type ReadResult,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n type UseAsyncTask,\n useAsyncTask,\n useSuspendableQuery,\n} from './helpers';\n\nexport type UseHubArgs = Prettify<\n HubRequest & CurrencyQueryOptions & TimeWindowQueryOptions\n>;\n\n/**\n * Fetch a specific hub by ID or by address and chain ID.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useHub({\n * query: { hubId: hubId('SGVsbG8h') },\n * suspense: true,\n * });\n * // data will be Hub | null\n * ```\n */\nexport function useHub(\n args: UseHubArgs & Suspendable,\n): SuspenseResult<Hub | null>;\n/**\n * Fetch a specific hub by ID or by address and chain ID.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useHub({\n * query: { hubId: hubId('SGVsbG8h') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useHub(\n args: Pausable<UseHubArgs> & Suspendable,\n): PausableSuspenseResult<Hub | null>;\n/**\n * Fetch a specific hub by ID or by address and chain ID.\n *\n * ```tsx\n * const { data, error, loading } = useHub({\n * query: { hubId: hubId('SGVsbG8h') },\n * });\n * // data will be Hub | null\n * ```\n */\nexport function useHub(args: UseHubArgs): ReadResult<Hub | null>;\n/**\n * Fetch a specific hub by ID or by address and chain ID.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useHub({\n * query: { hubId: hubId('SGVsbG8h') },\n * pause: true,\n * });\n * ```\n */\nexport function useHub(\n args: Pausable<UseHubArgs>,\n): PausableReadResult<Hub | null>;\n\nexport function useHub({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseHubArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Hub | null, UnexpectedError> {\n return useSuspendableQuery({\n document: HubQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseHubsArgs = Prettify<\n HubsRequest & CurrencyQueryOptions & TimeWindowQueryOptions\n>;\n\n/**\n * Fetch multiple hubs based on specified criteria.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useHubs({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * });\n * ```\n */\nexport function useHubs(args: UseHubsArgs & Suspendable): SuspenseResult<Hub[]>;\n/**\n * Fetch multiple hubs based on specified criteria.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useHubs({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useHubs(\n args: Pausable<UseHubsArgs> & Suspendable,\n): PausableSuspenseResult<Hub[]>;\n/**\n * Fetch multiple hubs based on specified criteria.\n *\n * ```tsx\n * const { data, error, loading } = useHubs({\n * query: { chainIds: [chainId(1)] },\n * });\n * ```\n */\nexport function useHubs(args: UseHubsArgs): ReadResult<Hub[]>;\n/**\n * Fetch multiple hubs based on specified criteria.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useHubs({\n * query: { chainIds: [chainId(1)] },\n * pause: true,\n * });\n * ```\n */\nexport function useHubs(args: Pausable<UseHubsArgs>): PausableReadResult<Hub[]>;\n\nexport function useHubs({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseHubsArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Hub[], UnexpectedError> {\n return useSuspendableQuery({\n document: HubsQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseHubAssetsArgs = Prettify<\n HubAssetsRequest & CurrencyQueryOptions & TimeWindowQueryOptions\n>;\n\n/**\n * Fetch hub assets for a specific hub by ID or by address and chain ID.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useHubAssets({\n * query: { hubId: hubId('SGVsbG8h') },\n * user: evmAddress('0x456...'), // optional\n * suspense: true,\n * });\n * ```\n */\nexport function useHubAssets(\n args: UseHubAssetsArgs & Suspendable,\n): SuspenseResult<HubAsset[]>;\n/**\n * Fetch hub assets for a specific hub by ID or by address and chain ID.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useHubAssets({\n * query: { hubId: hubId('SGVsbG8h') },\n * user: evmAddress('0x456...'), // optional\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useHubAssets(\n args: Pausable<UseHubAssetsArgs> & Suspendable,\n): PausableSuspenseResult<HubAsset[]>;\n/**\n * Fetch hub assets for a specific hub by ID or by address and chain ID.\n *\n * ```tsx\n * const { data, error, loading } = useHubAssets({\n * query: { hubId: hubId('SGVsbG8h') },\n * user: evmAddress('0x456...'), // optional\n * });\n * ```\n */\nexport function useHubAssets(args: UseHubAssetsArgs): ReadResult<HubAsset[]>;\n/**\n * Fetch hub assets for a specific hub by ID or by address and chain ID.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useHubAssets({\n * query: { hubId: hubId('SGVsbG8h') },\n * user: evmAddress('0x456...'), // optional\n * pause: true,\n * });\n * ```\n */\nexport function useHubAssets(\n args: Pausable<UseHubAssetsArgs>,\n): PausableReadResult<HubAsset[]>;\n\nexport function useHubAssets({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseHubAssetsArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<HubAsset[], UnexpectedError> {\n return useSuspendableQuery({\n document: HubAssetsQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link hubs} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on the hubs.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useHubsAction();\n *\n * // …\n *\n * const result = await execute({\n * query: {\n * chainIds: [chainId(1)]\n * }\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // Hub[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useHubsAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<HubsRequest, Hub[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: HubsRequest) =>\n hubs(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n","import {\n type CurrencyQueryOptions,\n DEFAULT_QUERY_OPTIONS,\n type TimeWindowQueryOptions,\n type UnexpectedError,\n} from '@aave/client';\nimport {\n type Asset,\n AssetBorrowHistoryQuery,\n type AssetBorrowHistoryRequest,\n type AssetBorrowSample,\n AssetPriceHistoryQuery,\n type AssetPriceHistoryRequest,\n type AssetPriceSample,\n AssetQuery,\n type AssetRequest,\n AssetSupplyHistoryQuery,\n type AssetSupplyHistoryRequest,\n type AssetSupplySample,\n} from '@aave/graphql';\nimport type { NullishDeep, Prettify } from '@aave/types';\nimport {\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type ReadResult,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n useSuspendableQuery,\n} from './helpers';\n\nexport type UseAssetArgs = Prettify<\n AssetRequest & CurrencyQueryOptions & TimeWindowQueryOptions\n>;\n\n/**\n * Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useAsset({\n * query: { assetId: assetId('SGVsbG8h') },\n * suspense: true,\n * });\n * // data will be Asset | null\n * ```\n */\nexport function useAsset(\n args: UseAssetArgs & Suspendable,\n): SuspenseResult<Asset | null>;\n/**\n * Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useAsset({\n * query: { assetId: assetId('SGVsbG8h') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useAsset(\n args: Pausable<UseAssetArgs> & Suspendable,\n): PausableSuspenseResult<Asset | null>;\n/**\n * Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.\n *\n * ```tsx\n * const { data, error, loading } = useAsset({\n * query: { assetId: assetId('SGVsbG8h') },\n * });\n * // data will be Asset | null\n * ```\n */\nexport function useAsset(args: UseAssetArgs): ReadResult<Asset | null>;\n/**\n * Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useAsset({\n * query: { assetId: assetId('SGVsbG8h') },\n * pause: true,\n * });\n * ```\n */\nexport function useAsset(\n args: Pausable<UseAssetArgs>,\n): PausableReadResult<Asset | null>;\n\nexport function useAsset({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseAssetArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Asset | null, UnexpectedError> {\n return useSuspendableQuery({\n document: AssetQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseAssetPriceHistoryArgs = AssetPriceHistoryRequest;\n\n/**\n * Fetch historical price data for a specific asset.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useAssetPriceHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * currency: Currency.Usd,\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * });\n * ```\n */\nexport function useAssetPriceHistory(\n args: UseAssetPriceHistoryArgs & Suspendable,\n): SuspenseResult<AssetPriceSample[]>;\n/**\n * Fetch historical price data for a specific asset.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useAssetPriceHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useAssetPriceHistory(\n args: Pausable<UseAssetPriceHistoryArgs> & Suspendable,\n): PausableSuspenseResult<AssetPriceSample[]>;\n/**\n * Fetch historical price data for a specific asset.\n *\n * ```tsx\n * const { data, error, loading } = useAssetPriceHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * currency: Currency.Usd,\n * window: TimeWindow.LastWeek,\n * });\n * ```\n */\nexport function useAssetPriceHistory(\n args: UseAssetPriceHistoryArgs,\n): ReadResult<AssetPriceSample[]>;\n/**\n * Fetch historical price data for a specific asset.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useAssetPriceHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * pause: true,\n * });\n * ```\n */\nexport function useAssetPriceHistory(\n args: Pausable<UseAssetPriceHistoryArgs>,\n): PausableReadResult<AssetPriceSample[]>;\n\nexport function useAssetPriceHistory({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseAssetPriceHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<AssetPriceSample[], UnexpectedError> {\n return useSuspendableQuery({\n document: AssetPriceHistoryQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n\nexport type UseAssetSupplyHistoryArgs = AssetSupplyHistoryRequest;\n\n/**\n * Fetch historical supply data for a specific asset.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useAssetSupplyHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * });\n * ```\n */\nexport function useAssetSupplyHistory(\n args: UseAssetSupplyHistoryArgs & Suspendable,\n): SuspenseResult<AssetSupplySample[]>;\n/**\n * Fetch historical supply data for a specific asset.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useAssetSupplyHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useAssetSupplyHistory(\n args: Pausable<UseAssetSupplyHistoryArgs> & Suspendable,\n): PausableSuspenseResult<AssetSupplySample[]>;\n/**\n * Fetch historical supply data for a specific asset.\n *\n * ```tsx\n * const { data, error, loading } = useAssetSupplyHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * window: TimeWindow.LastWeek,\n * });\n * ```\n */\nexport function useAssetSupplyHistory(\n args: UseAssetSupplyHistoryArgs,\n): ReadResult<AssetSupplySample[]>;\n/**\n * Fetch historical supply data for a specific asset.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useAssetSupplyHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * pause: true,\n * });\n * ```\n */\nexport function useAssetSupplyHistory(\n args: Pausable<UseAssetSupplyHistoryArgs>,\n): PausableReadResult<AssetSupplySample[]>;\n\nexport function useAssetSupplyHistory({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseAssetSupplyHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<AssetSupplySample[], UnexpectedError> {\n return useSuspendableQuery({\n document: AssetSupplyHistoryQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n\nexport type UseAssetBorrowHistoryArgs = AssetBorrowHistoryRequest;\n\n/**\n * Fetch historical borrow data for a specific asset.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useAssetBorrowHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * });\n * ```\n */\nexport function useAssetBorrowHistory(\n args: UseAssetBorrowHistoryArgs & Suspendable,\n): SuspenseResult<AssetBorrowSample[]>;\n/**\n * Fetch historical borrow data for a specific asset.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useAssetBorrowHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useAssetBorrowHistory(\n args: Pausable<UseAssetBorrowHistoryArgs> & Suspendable,\n): PausableSuspenseResult<AssetBorrowSample[]>;\n/**\n * Fetch historical borrow data for a specific asset.\n *\n * ```tsx\n * const { data, error, loading } = useAssetBorrowHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * window: TimeWindow.LastWeek,\n * });\n * ```\n */\nexport function useAssetBorrowHistory(\n args: UseAssetBorrowHistoryArgs,\n): ReadResult<AssetBorrowSample[]>;\n/**\n * Fetch historical borrow data for a specific asset.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useAssetBorrowHistory({\n * token: { chainId: chainId(1), address: evmAddress('0x123...') },\n * pause: true,\n * });\n * ```\n */\nexport function useAssetBorrowHistory(\n args: Pausable<UseAssetBorrowHistoryArgs>,\n): PausableReadResult<AssetBorrowSample[]>;\n\nexport function useAssetBorrowHistory({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseAssetBorrowHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<AssetBorrowSample[], UnexpectedError> {\n return useSuspendableQuery({\n document: AssetBorrowHistoryQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n","import {\n type CurrencyQueryOptions,\n DEFAULT_QUERY_OPTIONS,\n type TimeWindowQueryOptions,\n type UnexpectedError,\n} from '@aave/client';\nimport { reserve, reserves } from '@aave/client/actions';\nimport {\n type APYSample,\n type BorrowAPYHistoryRequest,\n BorrowApyHistoryQuery,\n type Reserve,\n ReserveQuery,\n type ReserveRequest,\n ReservesQuery,\n type ReservesRequest,\n type SupplyAPYHistoryRequest,\n SupplyApyHistoryQuery,\n} from '@aave/graphql';\nimport type { NullishDeep, Prettify } from '@aave/types';\nimport { useAaveClient } from './context';\nimport {\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type ReadResult,\n type Selector,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n type UseAsyncTask,\n useAsyncTask,\n useSuspendableQuery,\n} from './helpers';\n\nexport type UseReserveArgs = Prettify<\n ReserveRequest & CurrencyQueryOptions & TimeWindowQueryOptions\n>;\n\n/**\n * Fetch a specific reserve by reserve ID, spoke, and chain.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useReserve({\n * reserve: reserveId('SGVsbG8h'),\n * user: evmAddress('0xabc...'),\n * suspense: true,\n * });\n * // data will be Reserve | null\n * ```\n */\nexport function useReserve(\n args: UseReserveArgs & Suspendable,\n): SuspenseResult<Reserve | null>;\n/**\n * Fetch a specific reserve by reserve ID, spoke, and chain.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useReserve({\n * reserve: reserveId('SGVsbG8h'),\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useReserve(\n args: Pausable<UseReserveArgs> & Suspendable,\n): PausableSuspenseResult<Reserve | null>;\n/**\n * Fetch a specific reserve by reserve ID, spoke, and chain.\n *\n * ```tsx\n * const { data, error, loading } = useReserve({\n * reserve: reserveId('SGVsbG8h'),\n * user: evmAddress('0xabc...'),\n * });\n * // data will be Reserve | null\n * ```\n */\nexport function useReserve(args: UseReserveArgs): ReadResult<Reserve | null>;\n/**\n * Fetch a specific reserve by reserve ID, spoke, and chain.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useReserve({\n * reserve: reserveId('SGVsbG8h'),\n * pause: true,\n * });\n * ```\n */\nexport function useReserve(\n args: Pausable<UseReserveArgs>,\n): PausableReadResult<Reserve | null>;\n\nexport function useReserve({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseReserveArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Reserve | null, UnexpectedError> {\n return useSuspendableQuery({\n document: ReserveQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link reserve} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on the reserve.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useReserveAction();\n *\n * // …\n *\n * const result = await execute({\n * reserve: reserveId('SGVsbG8h'),\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // Reserve | null\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useReserveAction(\n options: Required<CurrencyQueryOptions> &\n TimeWindowQueryOptions = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<ReserveRequest, Reserve | null, UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: ReserveRequest) =>\n reserve(client, request, {\n currency: options.currency,\n timeWindow: options.timeWindow ?? DEFAULT_QUERY_OPTIONS.timeWindow,\n }),\n [client, options.currency, options.timeWindow],\n );\n}\n\nexport type UseReservesArgs<T = Reserve[]> = Prettify<\n ReservesRequest &\n CurrencyQueryOptions &\n TimeWindowQueryOptions & {\n /**\n * A function that maps the full list of reserves\n * into a derived or narrowed value.\n *\n * Example: pick a single reserve based on a criteria.\n *\n * @experimental This is experimental and may be subject to breaking changes.\n */\n selector?: Selector<Reserve[], T>;\n }\n>;\n\n/**\n * Fetch reserves based on specified criteria.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * filter: ReservesRequestFilter.All,\n * orderBy: { name: 'ASC' },\n * suspense: true,\n * });\n * ```\n *\n * **Reserves with Highest Supply APY**\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * suspense: true,\n * selector: pickHighestSupplyApyReserve,\n * });\n * ```\n *\n * **Reserves with Lowest Borrow APY**\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * suspense: true,\n * selector: pickLowestBorrowApyReserve,\n * });\n * ```\n */\nexport function useReserves<T = Reserve[]>(\n args: UseReservesArgs<T> & Suspendable,\n): SuspenseResult<T>;\n/**\n * Fetch reserves based on specified criteria.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useReserves<T = Reserve[]>(\n args: Pausable<UseReservesArgs<T>> & Suspendable,\n): PausableSuspenseResult<T>;\n/**\n * Fetch reserves based on specified criteria.\n *\n * ```tsx\n * const { data, error, loading } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * filter: ReservesRequestFilter.All,\n * orderBy: { name: 'ASC' },\n * });\n * ```\n *\n * **Reserves with Highest Supply APY**\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * selector: pickHighestSupplyApyReserve,\n * });\n * ```\n *\n * **Reserves with Lowest Borrow APY**\n * ```tsx\n * const { data } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * selector: pickLowestBorrowApyReserve,\n * });\n * ```\n */\nexport function useReserves<T = Reserve[]>(\n args: UseReservesArgs<T>,\n): ReadResult<T>;\n/**\n * Fetch reserves based on specified criteria.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useReserves({\n * query: {\n * spoke: {\n * address: evmAddress('0x123...'),\n * chainId: chainId(1)\n * }\n * },\n * pause: true,\n * });\n * ```\n */\nexport function useReserves<T = Reserve[]>(\n args: Pausable<UseReservesArgs<T>>,\n): PausableReadResult<T>;\n\nexport function useReserves<T = Reserve[]>({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n selector,\n ...request\n}: NullishDeep<UseReservesArgs<T>> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<T, UnexpectedError> {\n return useSuspendableQuery({\n document: ReservesQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n selector: (selector || undefined) as Selector<Reserve[], T> | undefined,\n });\n}\n\n/**\n * Low-level hook to execute a {@link reserves} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on the reserves.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useReservesAction();\n *\n * // …\n *\n * const result = await execute({\n * query: {\n * spoke: {\n * address: evmAddress('0x1234…'),\n * chainId: chainId(1)\n * }\n * }\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // Reserve[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n *\n * **Reserves with Highest Supply APY**\n * ```ts\n * const [execute, { called, data, error, loading }] = useReservesAction();\n *\n * // …\n *\n * const result = await execute(…).map(pickHighestSupplyApyReserve);\n *\n * if (result.isOk()) {\n * console.log(result.value); // Reserve | null\n * } else {\n * console.error(result.error);\n * }\n * ```\n *\n * **Reserves with Lowest Borrow APY**\n * ```ts\n * const [execute, { called, data, error, loading }] = useReservesAction();\n *\n * // …\n *\n * const result = await execute(…).map(pickLowestBorrowApyReserve);\n *\n * if (result.isOk()) {\n * console.log(result.value); // Reserve | null\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useReservesAction(\n options: Required<CurrencyQueryOptions> &\n TimeWindowQueryOptions = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<ReservesRequest, Reserve[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: ReservesRequest) =>\n reserves(client, request, {\n currency: options.currency,\n timeWindow: options.timeWindow ?? DEFAULT_QUERY_OPTIONS.timeWindow,\n }),\n [client, options.currency, options.timeWindow],\n );\n}\n\nexport type UseBorrowApyHistoryArgs = BorrowAPYHistoryRequest;\n\n/**\n * Fetch borrow APY history for a specific reserve over time.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useBorrowApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * });\n * ```\n */\nexport function useBorrowApyHistory(\n args: UseBorrowApyHistoryArgs & Suspendable,\n): SuspenseResult<APYSample[]>;\n/**\n * Fetch borrow APY history for a specific reserve over time.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useBorrowApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useBorrowApyHistory(\n args: Pausable<UseBorrowApyHistoryArgs> & Suspendable,\n): PausableSuspenseResult<APYSample[]>;\n/**\n * Fetch borrow APY history for a specific reserve over time.\n *\n * ```tsx\n * const { data, error, loading } = useBorrowApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * });\n * ```\n */\nexport function useBorrowApyHistory(\n args: UseBorrowApyHistoryArgs,\n): ReadResult<APYSample[]>;\n/**\n * Fetch borrow APY history for a specific reserve over time.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useBorrowApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * pause: true,\n * });\n * ```\n */\nexport function useBorrowApyHistory(\n args: Pausable<UseBorrowApyHistoryArgs>,\n): PausableReadResult<APYSample[]>;\n\nexport function useBorrowApyHistory({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseBorrowApyHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<APYSample[], UnexpectedError> {\n return useSuspendableQuery({\n document: BorrowApyHistoryQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n\nexport type UseSupplyApyHistoryArgs = SupplyAPYHistoryRequest;\n\n/**\n * Fetch supply APY history for a specific reserve over time.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSupplyApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * });\n * ```\n */\nexport function useSupplyApyHistory(\n args: UseSupplyApyHistoryArgs & Suspendable,\n): SuspenseResult<APYSample[]>;\n/**\n * Fetch supply APY history for a specific reserve over time.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSupplyApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSupplyApyHistory(\n args: Pausable<UseSupplyApyHistoryArgs> & Suspendable,\n): PausableSuspenseResult<APYSample[]>;\n/**\n * Fetch supply APY history for a specific reserve over time.\n *\n * ```tsx\n * const { data, error, loading } = useSupplyApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * });\n * ```\n */\nexport function useSupplyApyHistory(\n args: UseSupplyApyHistoryArgs,\n): ReadResult<APYSample[]>;\n/**\n * Fetch supply APY history for a specific reserve over time.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSupplyApyHistory({\n * reserve: reserveId('SGVsbG8h'),\n * window: TimeWindow.LastWeek,\n * pause: true,\n * });\n * ```\n */\nexport function useSupplyApyHistory(\n args: Pausable<UseSupplyApyHistoryArgs>,\n): PausableReadResult<APYSample[]>;\n\nexport function useSupplyApyHistory({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSupplyApyHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<APYSample[], UnexpectedError> {\n return useSuspendableQuery({\n document: SupplyApyHistoryQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n","import type { UnexpectedError } from '@aave/client';\nimport {\n type PaginatedSpokePositionManagerResult,\n type PaginatedSpokeUserPositionManagerResult,\n type Spoke,\n SpokePositionManagersQuery,\n type SpokePositionManagersRequest,\n SpokeQuery,\n type SpokeRequest,\n SpokesQuery,\n type SpokesRequest,\n SpokeUserPositionManagersQuery,\n type SpokeUserPositionManagersRequest,\n} from '@aave/graphql';\nimport type { NullishDeep } from '@aave/types';\nimport {\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type ReadResult,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n useSuspendableQuery,\n} from './helpers';\n\nexport type UseSpokeArgs = SpokeRequest;\n\n/**\n * Fetch a specific spoke.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSpoke({\n * query: { spokeId: spokeId('SGVsbG8h') },\n * suspense: true,\n * });\n * // data will be Spoke | null\n * ```\n */\nexport function useSpoke(\n args: UseSpokeArgs & Suspendable,\n): SuspenseResult<Spoke | null>;\n/**\n * Fetch a specific spoke.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSpoke({\n * query: { spokeId: spokeId('SGVsbG8h') },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSpoke(\n args: Pausable<UseSpokeArgs> & Suspendable,\n): PausableSuspenseResult<Spoke | null>;\n/**\n * Fetch a specific spoke.\n *\n * ```tsx\n * const { data, error, loading } = useSpoke({\n * query: { spokeId: spokeId('SGVsbG8h') },\n * });\n * // data will be Spoke | null\n * ```\n */\nexport function useSpoke(args: UseSpokeArgs): ReadResult<Spoke | null>;\n/**\n * Fetch a specific spoke.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSpoke({\n * query: { spokeId: spokeId('SGVsbG8h') },\n * pause: true,\n * });\n * ```\n */\nexport function useSpoke(\n args: Pausable<UseSpokeArgs>,\n): PausableReadResult<Spoke | null>;\n\nexport function useSpoke({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSpokeArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Spoke | null, UnexpectedError> {\n return useSuspendableQuery({\n document: SpokeQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseSpokesArgs = SpokesRequest;\n\n/**\n * Fetch spokes based on specified criteria.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSpokes({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * });\n * ```\n */\nexport function useSpokes(\n args: UseSpokesArgs & Suspendable,\n): SuspenseResult<Spoke[]>;\n/**\n * Fetch spokes based on specified criteria.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSpokes({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSpokes(\n args: Pausable<UseSpokesArgs> & Suspendable,\n): PausableSuspenseResult<Spoke[]>;\n/**\n * Fetch spokes based on specified criteria.\n *\n * ```tsx\n * const { data, error, loading } = useSpokes({\n * query: { chainIds: [chainId(1)] },\n * });\n * ```\n */\nexport function useSpokes(args: UseSpokesArgs): ReadResult<Spoke[]>;\n/**\n * Fetch spokes based on specified criteria.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSpokes({\n * query: { chainIds: [chainId(1)] },\n * pause: true,\n * });\n * ```\n */\nexport function useSpokes(\n args: Pausable<UseSpokesArgs>,\n): PausableReadResult<Spoke[]>;\n\nexport function useSpokes({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSpokesArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Spoke[], UnexpectedError> {\n return useSuspendableQuery({\n document: SpokesQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseSpokePositionManagersArgs = SpokePositionManagersRequest;\n\n/**\n * Fetches all the positions manager for a specific spoke.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSpokePositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * suspense: true,\n * });\n * ```\n */\nexport function useSpokePositionManagers(\n args: UseSpokePositionManagersArgs & Suspendable,\n): SuspenseResult<PaginatedSpokePositionManagerResult>;\n/**\n * Fetches all the positions manager for a specific spoke.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSpokePositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSpokePositionManagers(\n args: Pausable<UseSpokePositionManagersArgs> & Suspendable,\n): PausableSuspenseResult<PaginatedSpokePositionManagerResult>;\n/**\n * Fetches all the positions manager for a specific spoke.\n *\n * ```tsx\n * const { data, error, loading } = useSpokePositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * });\n * ```\n */\nexport function useSpokePositionManagers(\n args: UseSpokePositionManagersArgs,\n): ReadResult<PaginatedSpokePositionManagerResult>;\n/**\n * Fetches all the positions manager for a specific spoke.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSpokePositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * pause: true,\n * });\n * ```\n */\nexport function useSpokePositionManagers(\n args: Pausable<UseSpokePositionManagersArgs>,\n): PausableReadResult<PaginatedSpokePositionManagerResult>;\n\nexport function useSpokePositionManagers({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSpokePositionManagersArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<PaginatedSpokePositionManagerResult, UnexpectedError> {\n return useSuspendableQuery({\n document: SpokePositionManagersQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseSpokeUserPositionManagersArgs = SpokeUserPositionManagersRequest;\n\n/**\n * Fetches all the position managers of a user for a specific spoke\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSpokeUserPositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * user: evmAddress('0x123...'),\n * suspense: true,\n * });\n * ```\n */\nexport function useSpokeUserPositionManagers(\n args: UseSpokeUserPositionManagersArgs & Suspendable,\n): SuspenseResult<PaginatedSpokeUserPositionManagerResult>;\n/**\n * Fetches all the position managers of a user for a specific spoke\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSpokeUserPositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * user: evmAddress('0x123...'),\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSpokeUserPositionManagers(\n args: Pausable<UseSpokeUserPositionManagersArgs> & Suspendable,\n): PausableSuspenseResult<PaginatedSpokeUserPositionManagerResult>;\n/**\n * Fetches all the position managers of a user for a specific spoke\n *\n * ```tsx\n * const { data, error, loading } = useSpokeUserPositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * user: evmAddress('0x123...'),\n * });\n * ```\n */\nexport function useSpokeUserPositionManagers(\n args: UseSpokeUserPositionManagersArgs,\n): ReadResult<PaginatedSpokeUserPositionManagerResult>;\n/**\n * Fetches all the position managers of a user for a specific spoke\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSpokeUserPositionManagers({\n * spoke: spokeId('SGVsbG8h'),\n * user: evmAddress('0x123...'),\n * pause: true,\n * });\n * ```\n */\nexport function useSpokeUserPositionManagers(\n args: Pausable<UseSpokeUserPositionManagersArgs>,\n): PausableReadResult<PaginatedSpokeUserPositionManagerResult>;\n\nexport function useSpokeUserPositionManagers({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSpokeUserPositionManagersArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<\n PaginatedSpokeUserPositionManagerResult,\n UnexpectedError\n> {\n return useSuspendableQuery({\n document: SpokeUserPositionManagersQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n });\n}\n","import {\n type CurrencyQueryOptions,\n DEFAULT_QUERY_OPTIONS,\n errAsync,\n ValidationError,\n} from '@aave/client';\nimport {\n cancelSwap,\n prepareSwap,\n prepareSwapCancel,\n swap,\n swapQuote,\n swapStatus,\n} from '@aave/client/actions';\nimport type {\n CancelError,\n SigningError,\n TimeoutError,\n TransactionError,\n UnexpectedError,\n} from '@aave/core';\nimport type {\n InsufficientBalanceError,\n PaginatedUserSwapsResult,\n PrepareSwapCancelRequest,\n SwapByIntentTypedData,\n SwapByIntentWithApprovalRequired,\n SwapCancelled,\n SwapExecutionPlan,\n SwapQuote,\n SwapQuoteRequest,\n SwapReceipt,\n SwapTransactionRequest,\n UserSwapsRequest,\n} from '@aave/graphql';\nimport {\n type CancelSwapTypedData,\n type ERC20PermitSignature,\n type PrepareSwapRequest,\n type SwapApprovalRequired,\n SwappableTokensQuery,\n type SwappableTokensRequest,\n SwapQuoteQuery,\n type Token,\n type TransactionRequest,\n UserSwapsQuery,\n} from '@aave/graphql';\nimport {\n invariant,\n type NullishDeep,\n okAsync,\n type Prettify,\n type ResultAsync,\n ResultAwareError,\n} from '@aave/types';\nimport { useCallback } from 'react';\nimport { useAaveClient } from './context';\nimport {\n type CancelOperation,\n cancel,\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n PendingTransaction,\n type PendingTransactionError,\n type ReadResult,\n type SendTransactionError,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n useSuspendableQuery,\n} from './helpers';\nimport { type UseAsyncTask, useAsyncTask } from './helpers/tasks';\n\nexport type UseSwapQuoteArgs = Prettify<\n SwapQuoteRequest & CurrencyQueryOptions\n>;\n\n/**\n * @internal\n * Fetch a swap quote for the specified trade parameters.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSwapQuote({\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * suspense: true,\n * });\n * ```\n */\nexport function useSwapQuote(\n args: UseSwapQuoteArgs & Suspendable,\n): SuspenseResult<SwapQuote>;\n/**\n * @internal\n * Fetch a swap quote for the specified trade parameters.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSwapQuote({\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * from: evmAddress('0x742d35cc...'),\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSwapQuote(\n args: Pausable<UseSwapQuoteArgs> & Suspendable,\n): PausableSuspenseResult<SwapQuote>;\n/**\n * @internal\n * Fetch a swap quote for the specified trade parameters.\n *\n * ```tsx\n * const { data, error, loading } = useSwapQuote({\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * });\n * ```\n */\nexport function useSwapQuote(args: UseSwapQuoteArgs): ReadResult<SwapQuote>;\n/**\n * @internal\n * Fetch a swap quote for the specified trade parameters.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSwapQuote({\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * from: evmAddress('0x742d35cc...'),\n * pause: true,\n * });\n * ```\n */\nexport function useSwapQuote(\n args: Pausable<UseSwapQuoteArgs>,\n): PausableReadResult<SwapQuote>;\n\n/**\n * @internal\n */\nexport function useSwapQuote({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseSwapQuoteArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<SwapQuote, UnexpectedError> {\n return useSuspendableQuery({\n document: SwapQuoteQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * @internal\n * Low-level hook to execute a swap quote action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on the swap quote.\n * Use this hook to retrieve quotes on demand as part of a larger workflow\n * (e.g., in an event handler to get a fresh quote before executing a swap).\n *\n * ```ts\n * const [getQuote, { called, data, error, loading }] = useSwapQuoteAction();\n *\n * // …\n *\n * const result = await getQuote({\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * });\n *\n * if (result.isOk()) {\n * console.log('Swap quote:', result.value);\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useSwapQuoteAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<SwapQuoteRequest, SwapQuote, UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: SwapQuoteRequest) =>\n swapQuote(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n\nexport type UseSwappableTokensArgs = SwappableTokensRequest;\n\n/**\n * @internal\n * Fetch the list of tokens available for swapping on a specific chain.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useSwappableTokens({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * });\n * ```\n */\nexport function useSwappableTokens(\n args: UseSwappableTokensArgs & Suspendable,\n): SuspenseResult<Token[]>;\n/**\n * @internal\n * Fetch the list of tokens available for swapping on a specific chain.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useSwappableTokens({\n * query: { chainIds: [chainId(1)] },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useSwappableTokens(\n args: Pausable<UseSwappableTokensArgs> & Suspendable,\n): PausableSuspenseResult<Token[]>;\n/**\n * @internal\n * Fetch the list of tokens available for swapping on a specific chain.\n *\n * ```tsx\n * const { data, error, loading } = useSwappableTokens({\n * query: { chainIds: [chainId(1)] },\n * });\n * ```\n */\nexport function useSwappableTokens(\n args: UseSwappableTokensArgs,\n): ReadResult<Token[]>;\n/**\n * @internal\n * Fetch the list of tokens available for swapping on a specific chain.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useSwappableTokens({\n * query: { chainIds: [chainId(1)] },\n * pause: true,\n * });\n * ```\n */\nexport function useSwappableTokens(\n args: Pausable<UseSwappableTokensArgs>,\n): PausableReadResult<Token[]>;\n\n/**\n * @internal\n */\nexport function useSwappableTokens({\n suspense = false,\n pause = false,\n ...request\n}: NullishDeep<UseSwappableTokensArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<Token[], UnexpectedError> {\n return useSuspendableQuery({\n document: SwappableTokensQuery,\n variables: {\n request,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseUserSwapsArgs = Prettify<\n UserSwapsRequest & CurrencyQueryOptions\n>;\n\n/**\n * @internal\n * Fetch the user's swap history for a specific chain.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserSwaps({\n * chainId: chainId(1),\n * user: evmAddress('0x742d35cc...'),\n * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],\n * suspense: true,\n * });\n * ```\n */\nexport function useUserSwaps(\n args: UseUserSwapsArgs & Suspendable,\n): SuspenseResult<PaginatedUserSwapsResult>;\n/**\n * @internal\n * Fetch the user's swap history for a specific chain.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserSwaps({\n * chainId: chainId(1),\n * user: evmAddress('0x742d35cc...'),\n * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserSwaps(\n args: Pausable<UseUserSwapsArgs> & Suspendable,\n): PausableSuspenseResult<PaginatedUserSwapsResult>;\n/**\n * @internal\n * Fetch the user's swap history for a specific chain.\n *\n * ```tsx\n * const { data, error, loading } = useUserSwaps({\n * chainId: chainId(1),\n * user: evmAddress('0x742d35cc...'),\n * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],\n * });\n * ```\n */\nexport function useUserSwaps(\n args: UseUserSwapsArgs,\n): ReadResult<PaginatedUserSwapsResult>;\n/**\n * @internal\n * Fetch the user's swap history for a specific chain.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserSwaps({\n * chainId: chainId(1),\n * user: evmAddress('0x742d35cc...'),\n * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],\n * pause: true,\n * });\n * ```\n */\nexport function useUserSwaps(\n args: Pausable<UseUserSwapsArgs>,\n): PausableReadResult<PaginatedUserSwapsResult>;\n\n/**\n * @internal\n */\nexport function useUserSwaps({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseUserSwapsArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<PaginatedUserSwapsResult, UnexpectedError> {\n return useSuspendableQuery({\n document: UserSwapsQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseSwapTokensRequest = Prettify<\n PrepareSwapRequest & CurrencyQueryOptions\n>;\n\nexport type SwapIntent =\n | SwapByIntentTypedData\n | SwapByIntentWithApprovalRequired\n | SwapTransactionRequest\n | SwapApprovalRequired;\n\nexport type SwapHandlerOptions = {\n cancel: CancelOperation;\n};\n\nexport type SwapHandler = (\n intent: SwapIntent,\n options: SwapHandlerOptions,\n) => ResultAsync<\n ERC20PermitSignature | SwapReceipt,\n SendTransactionError | PendingTransactionError\n>;\n\nfunction isERC20PermitSignature(\n signature: unknown,\n): signature is ERC20PermitSignature {\n return (\n typeof signature === 'object' &&\n signature !== null &&\n 'deadline' in signature &&\n 'value' in signature\n );\n}\n\n/**\n * @internal\n * Orchestrate the swap execution plan.\n *\n * ```tsx\n * const [sendTransaction, sending] = useSendTransaction(wallet);\n * const [signSwapByIntentWith, signing] = useSignSwapByIntentWith(wallet);\n *\n * const [swap, swapping] = useSwapTokens((plan) => {\n * switch (plan.__typename) {\n * case 'SwapByIntentTypedData':\n * return signSwapByIntentWith(plan);\n *\n * case 'SwapApprovalRequired':\n * case 'SwapByIntentWithApprovalRequired':\n * return sendTransaction(plan.transaction);\n *\n * case 'SwapTransactionRequest':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * const result = await swap({\n * market: {\n * chainId: chainId(1),\n * buy: { erc20: evmAddress('0xA0b86a33E6...') },\n * sell: { erc20: evmAddress('0x6B175474E...') },\n * amount: bigDecimal('1000'),\n * kind: SwapKind.SELL,\n * user: evmAddress('0x742d35cc...'),\n * },\n * });\n *\n * if (result.isErr()) {\n * console.error(result.error);\n * return;\n * }\n *\n * // result.value: SwapReceipt\n * ```\n */\nexport function useSwapTokens(\n handler: SwapHandler,\n): UseAsyncTask<\n PrepareSwapRequest,\n SwapReceipt,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n const executeSwap = useCallback(\n (\n plan: SwapExecutionPlan,\n ): ResultAsync<\n SwapReceipt,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n > => {\n switch (plan.__typename) {\n case 'SwapTransactionRequest':\n return handler(plan, { cancel })\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => {\n return okAsync(plan.orderReceipt);\n });\n case 'SwapApprovalRequired':\n return handler(plan, { cancel })\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => {\n return okAsync(plan.originalTransaction.orderReceipt);\n });\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n case 'SwapReceipt':\n return okAsync(plan);\n }\n },\n [handler],\n );\n\n return useAsyncTask(\n ({\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n }: UseSwapTokensRequest) =>\n prepareSwap(client, request, { currency }).andThen((preparePlan) => {\n switch (preparePlan.__typename) {\n case 'SwapByTransaction':\n return swap(client, {\n transaction: { quoteId: preparePlan.quote.quoteId },\n }).andThen(executeSwap);\n\n case 'SwapByIntent':\n return handler(preparePlan.data, { cancel }).andThen(\n (signedTypedData) => {\n invariant(\n isERC20PermitSignature(signedTypedData),\n 'Invalid signature',\n );\n\n return swap(client, {\n intent: {\n quoteId: preparePlan.quote.quoteId,\n signature: signedTypedData.value,\n },\n }).andThen(executeSwap);\n },\n );\n\n case 'SwapByIntentWithApprovalRequired':\n return handler(preparePlan, { cancel })\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(preparePlan.data, { cancel }))\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen((signedTypedData) => {\n invariant(\n isERC20PermitSignature(signedTypedData),\n 'Invalid signature',\n );\n return swap(client, {\n intent: {\n quoteId: preparePlan.quote.quoteId,\n signature: signedTypedData.value,\n },\n }).andThen(executeSwap);\n });\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(preparePlan));\n }\n }),\n [client, handler, executeSwap],\n );\n}\n\nexport type CancelSwapHandler = (\n data: CancelSwapTypedData | TransactionRequest,\n) => ResultAsync<\n ERC20PermitSignature | PendingTransaction,\n SigningError | UnexpectedError\n>;\n\nexport class CannotCancelSwapError extends ResultAwareError {\n name = 'CannotCancelSwapError' as const;\n}\n\nexport type CancelSwapError =\n | CancelError\n | CannotCancelSwapError\n | SigningError\n | TimeoutError\n | TransactionError\n | UnexpectedError;\n\n/**\n * @internal\n * Executes the complete swap cancellation workflow combining preparation and execution.\n *\n * ```tsx\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [signSwapCancelWith] = useSignSwapCancelWith(wallet);\n *\n * const [cancelSwap, {loading, error}] = useCancelSwap((plan: CancelSwapTypedData | TransactionRequest) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n *\n * case 'CancelSwapTypedData':\n * return signSwapCancelWith(plan);\n * }\n * });\n *\n * const result = await cancelSwap({\n * id: swapId('123...'),\n * });\n *\n * if (result.isErr()) {\n * console.error(result.error);\n * return;\n * }\n *\n * // result.value: SwapCancelled\n * console.log('Swap cancelled:', result.value);\n * ```\n */\nexport function useCancelSwap(\n handler: CancelSwapHandler,\n): UseAsyncTask<PrepareSwapCancelRequest, SwapCancelled, CancelSwapError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request) =>\n swapStatus(client, { id: request.id }).andThen((status) => {\n switch (status.__typename) {\n case 'SwapOpen':\n case 'SwapPendingSignature':\n return prepareSwapCancel(client, request)\n .andThen((result) => handler(result.data))\n .andThen((signedTypedData) => {\n invariant(\n isERC20PermitSignature(signedTypedData),\n 'Invalid signature',\n );\n\n return cancelSwap(client, {\n intent: { id: request.id, signature: signedTypedData.value },\n });\n })\n .andThen((plan) => {\n if (plan.__typename === 'SwapCancelled') {\n return okAsync(plan);\n }\n\n return (\n handler(plan)\n .map(PendingTransaction.ensure)\n .andThen((pendingTransaction) => pendingTransaction.wait())\n // TODO: verify that if fails cause too early, we need to waitForSwapOutcome(client)({ id: request.id })\n .andThen(() => swapStatus(client, { id: request.id }))\n .andThen((status) => {\n if (status.__typename === 'SwapCancelled') {\n return okAsync(status);\n }\n return errAsync(\n new CannotCancelSwapError('Failed to cancel swap'),\n );\n })\n );\n });\n\n case 'SwapCancelled':\n return okAsync(status);\n\n default:\n return errAsync(\n new CannotCancelSwapError('Swap cannot longer be cancelled'),\n );\n }\n }),\n [client, handler],\n );\n}\n","import type {\n AaveClient,\n ActivitiesRequest,\n CurrencyQueryOptions,\n PaginatedActivitiesResult,\n TimeWindowQueryOptions,\n UnexpectedError,\n} from '@aave/client';\nimport { DEFAULT_QUERY_OPTIONS } from '@aave/client';\nimport {\n activities,\n borrow,\n liquidatePosition,\n preview,\n renounceSpokeUserPositionManager,\n repay,\n setSpokeUserPositionManager,\n setUserSuppliesAsCollateral,\n supply,\n updateUserPositionConditions,\n withdraw,\n} from '@aave/client/actions';\nimport { ValidationError } from '@aave/core';\nimport {\n ActivitiesQuery,\n type BorrowRequest,\n decodeHubId,\n decodeReserveId,\n HubQuery,\n HubsQuery,\n type InsufficientBalanceError,\n isChainIdsVariant,\n isHubInputVariant,\n isSpokeInputVariant,\n type LiquidatePositionRequest,\n PreviewQuery,\n type PreviewRequest,\n type PreviewUserPosition,\n type RenounceSpokeUserPositionManagerRequest,\n type RepayRequest,\n ReservesQuery,\n type SetSpokeUserPositionManagerRequest,\n type SetUserSuppliesAsCollateralRequest,\n SpokePositionManagersQuery,\n SpokesQuery,\n type SupplyRequest,\n type UpdateUserPositionConditionsRequest,\n UserBalancesQuery,\n UserPositionQuery,\n UserPositionsQuery,\n UserSummaryQuery,\n type WithdrawRequest,\n} from '@aave/graphql';\nimport {\n errAsync,\n type NullishDeep,\n type Prettify,\n type TxHash,\n} from '@aave/types';\nimport { useAaveClient } from './context';\nimport {\n cancel,\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type PendingTransactionError,\n type ReadResult,\n type SendTransactionError,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n type TransactionHandler,\n type UseAsyncTask,\n useAsyncTask,\n useSuspendableQuery,\n} from './helpers';\n\nfunction refreshQueriesForReserveChange(\n client: AaveClient,\n request: SupplyRequest | BorrowRequest | RepayRequest | WithdrawRequest,\n) {\n const { chainId, spoke } = decodeReserveId(request.reserve);\n return async () =>\n Promise.all([\n // update user positions\n await client.refreshQueryWhere(\n UserPositionsQuery,\n (variables, data) =>\n variables.request.user === request.sender &&\n data.some(\n (position) =>\n position.spoke.chain.chainId === chainId &&\n position.spoke.address === spoke,\n ),\n ),\n await client.refreshQueryWhere(\n UserPositionQuery,\n (_, data) =>\n data?.spoke.chain.chainId === chainId &&\n data?.spoke.address === spoke &&\n data.user === request.sender,\n ),\n\n // update user summary\n await client.refreshQueryWhere(UserSummaryQuery, (variables) =>\n variables.request.user === request.sender &&\n isSpokeInputVariant(variables.request.filter)\n ? variables.request.filter.spoke.chainId === chainId &&\n variables.request.filter.spoke.address === spoke\n : isChainIdsVariant(variables.request.filter)\n ? variables.request.filter.chainIds.some((id) => id === chainId)\n : false,\n ),\n\n // update reserves\n await client.refreshQueryWhere(ReservesQuery, (_, data) =>\n data.some((reserve) => reserve.id === request.reserve),\n ),\n\n // update spokes\n await client.refreshQueryWhere(SpokesQuery, (_, data) =>\n data.some(\n (item) => item.chain.chainId === chainId && item.address === spoke,\n ),\n ),\n\n // update user balances\n await client.refreshQueryWhere(\n UserBalancesQuery,\n // update any user balances for the given user\n (variables) => variables.request.user === request.sender,\n ),\n\n // update hubs\n await client.refreshQueryWhere(\n HubsQuery,\n (variables) =>\n isChainIdsVariant(variables.request) &&\n variables.request.chainIds.some((id) => id === chainId),\n ),\n ]);\n}\n\n/**\n * A hook that provides a way to supply assets to an Aave reserve.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [supply, { loading, error }] = useSupply((plan, { cancel }) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n * case 'Erc20ApprovalRequired':\n * case 'PreContractActionRequired':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * // …\n *\n * const result = await supply({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'ValidationError':\n * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transactions.\n */\nexport function useSupply(\n handler: TransactionHandler,\n): UseAsyncTask<\n SupplyRequest,\n TxHash,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: SupplyRequest) =>\n supply(client, request)\n .andThen((plan) => {\n switch (plan.__typename) {\n case 'TransactionRequest':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'Erc20ApprovalRequired':\n case 'PreContractActionRequired':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n }\n })\n .andTee(refreshQueriesForReserveChange(client, request)),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to borrow assets from an Aave reserve.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [borrow, { loading, error }] = useBorrow((plan, { cancel }) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n * case 'Erc20ApprovalRequired':\n * case 'PreContractActionRequired':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * // …\n *\n * const result = await borrow({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'ValidationError':\n * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transactions.\n */\nexport function useBorrow(\n handler: TransactionHandler,\n): UseAsyncTask<\n BorrowRequest,\n TxHash,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: BorrowRequest) =>\n borrow(client, request)\n .andThen((plan) => {\n switch (plan.__typename) {\n case 'TransactionRequest':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'Erc20ApprovalRequired':\n case 'PreContractActionRequired':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n }\n })\n .andTee(refreshQueriesForReserveChange(client, request)),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to repay borrowed assets to an Aave reserve.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [repay, { loading, error }] = useRepay((plan, { cancel }) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n * case 'Erc20ApprovalRequired':\n * case 'PreContractActionRequired':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * // …\n *\n * const result = await repay({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'ValidationError':\n * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transactions.\n */\nexport function useRepay(\n handler: TransactionHandler,\n): UseAsyncTask<\n RepayRequest,\n TxHash,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: RepayRequest) =>\n repay(client, request)\n .andThen((plan) => {\n switch (plan.__typename) {\n case 'TransactionRequest':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'Erc20ApprovalRequired':\n case 'PreContractActionRequired':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n }\n })\n .andTee(refreshQueriesForReserveChange(client, request)),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to withdraw supplied assets from an Aave reserve.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [withdraw, { loading, error }] = useWithdraw((plan, { cancel }) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n * case 'Erc20ApprovalRequired':\n * case 'PreContractActionRequired':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * // …\n *\n * const result = await withdraw({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'ValidationError':\n * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transactions.\n */\nexport function useWithdraw(\n handler: TransactionHandler,\n): UseAsyncTask<\n WithdrawRequest,\n TxHash,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: WithdrawRequest) =>\n withdraw(client, request)\n .andThen((plan) => {\n switch (plan.__typename) {\n case 'TransactionRequest':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'Erc20ApprovalRequired':\n case 'PreContractActionRequired':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n }\n })\n .andTee(refreshQueriesForReserveChange(client, request)),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to renounce a position manager of a user for a specific spoke.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [renounceSpokeUserPositionManager, { loading, error }] = useRenounceSpokeUserPositionManager(sendTransaction);\n *\n * // …\n *\n * const result = await renounceSpokeUserPositionManager({ ... });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transaction.\n */\n\nexport function useRenounceSpokeUserPositionManager(\n handler: TransactionHandler,\n): UseAsyncTask<\n RenounceSpokeUserPositionManagerRequest,\n TxHash,\n SendTransactionError | PendingTransactionError\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: RenounceSpokeUserPositionManagerRequest) =>\n renounceSpokeUserPositionManager(client, request)\n .andThen((transaction) => handler(transaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction)\n .andTee(() =>\n client.refreshQueryWhere(\n SpokePositionManagersQuery,\n (variables) => variables.request.spoke === request.spoke,\n ),\n ),\n [client, handler],\n );\n}\n\n/**\n * Hook for updating user position conditions (dynamic config and/or risk premium).\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [update, { loading, error }] = useUpdateUserPositionConditions((transaction, { cancel }) => {\n * return sendTransaction(transaction);\n * });\n *\n * // …\n *\n * const result = await update({\n * userPositionId: userPosition.id,\n * dynamicConfig: true,\n * riskPremium: true,\n * });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transaction.\n */\n\nexport function useUpdateUserPositionConditions(\n handler: TransactionHandler,\n): UseAsyncTask<\n UpdateUserPositionConditionsRequest,\n TxHash,\n SendTransactionError | PendingTransactionError\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: UpdateUserPositionConditionsRequest) =>\n updateUserPositionConditions(client, request)\n .andThen((transaction) => handler(transaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction)\n .andTee(async () => {\n const { userPositionId } = request;\n return Promise.all([\n client.refreshQueryWhere(UserPositionsQuery, (_, data) =>\n data.some((position) => position.id === userPositionId),\n ),\n client.refreshQueryWhere(\n UserPositionQuery,\n (_, data) => data?.id === userPositionId,\n ),\n ]);\n }),\n [client, handler],\n );\n}\n\n/**\n * Hook for updating the collateral status of user's supplies.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [setUserSuppliesAsCollateral, { loading, error }] = useSetUserSuppliesAsCollateral((transaction, { cancel }) => {\n * return sendTransaction(transaction);\n * });\n *\n * const result = await setUserSuppliesAsCollateral({\n * changes: [\n * {\n * reserve: reserve.id,\n * enableCollateral: true\n * }\n * ],\n * sender: evmAddress('0x456...')\n * });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transaction.\n */\nexport function useSetUserSuppliesAsCollateral(\n handler: TransactionHandler,\n): UseAsyncTask<\n SetUserSuppliesAsCollateralRequest,\n TxHash,\n SendTransactionError | PendingTransactionError\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: SetUserSuppliesAsCollateralRequest) => {\n const reserveIds = request.changes.map((change) => change.reserve);\n const reserveDetails = reserveIds.map((reserveId) =>\n decodeReserveId(reserveId),\n );\n return setUserSuppliesAsCollateral(client, request)\n .andThen((transaction) => handler(transaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction)\n .andTee(() =>\n Promise.all([\n // update user positions\n ...reserveDetails.map(({ chainId, spoke }) =>\n client.refreshQueryWhere(\n UserPositionsQuery,\n (variables, data) =>\n variables.request.user === request.sender &&\n data.some(\n (position) =>\n position.spoke.chain.chainId === chainId &&\n position.spoke.address === spoke,\n ),\n ),\n ),\n ...reserveDetails.map(({ chainId, spoke }) =>\n client.refreshQueryWhere(\n UserPositionQuery,\n (_, data) =>\n data?.spoke.chain.chainId === chainId &&\n data?.spoke.address === spoke &&\n data.user === request.sender,\n ),\n ),\n\n // update user summary\n ...reserveDetails.map(({ chainId, spoke }) =>\n client.refreshQueryWhere(UserSummaryQuery, (variables) =>\n variables.request.user === request.sender &&\n isSpokeInputVariant(variables.request.filter)\n ? variables.request.filter.spoke.chainId === chainId &&\n variables.request.filter.spoke.address === spoke\n : isChainIdsVariant(variables.request.filter)\n ? variables.request.filter.chainIds.some(\n (id) => id === chainId,\n )\n : false,\n ),\n ),\n\n // update reserves\n client.refreshQueryWhere(ReservesQuery, (_, data) =>\n data.some((reserve) => reserveIds.includes(reserve.id)),\n ),\n\n // update spokes\n ...reserveDetails.map(({ chainId, spoke }) =>\n client.refreshQueryWhere(SpokesQuery, (_, data) =>\n data.some(\n (item) =>\n item.chain.chainId === chainId && item.address === spoke,\n ),\n ),\n ),\n\n // update hubs\n ...reserveDetails.map(({ chainId }) =>\n client.refreshQueryWhere(HubsQuery, (variables) =>\n isChainIdsVariant(variables.request.query)\n ? variables.request.query.chainIds.some(\n (id) => id === chainId,\n )\n : variables.request.query.tokens.some(\n (token) => token.chainId === chainId,\n ),\n ),\n ),\n ...reserveDetails.map(({ chainId }) =>\n client.refreshQueryWhere(HubQuery, (variables) =>\n isHubInputVariant(variables.request.query)\n ? variables.request.query.hubInput.chainId === chainId\n : decodeHubId(variables.request.query.hubId).chainId ===\n chainId,\n ),\n ),\n ]),\n );\n },\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to liquidate a user's position.\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [liquidatePosition, { loading, error }] = useLiquidatePosition((plan, { cancel }) => {\n * switch (plan.__typename) {\n * case 'TransactionRequest':\n * return sendTransaction(plan);\n * case 'Erc20ApprovalRequired':\n * case 'PreContractActionRequired':\n * return sendTransaction(plan.transaction);\n * }\n * });\n *\n * // …\n *\n * const result = await liquidatePosition({\n * collateral: reserveId('SGVsbG8h'),\n * debt: reserveId('Q2lhbyE= '),\n * amount: amount,\n * liquidator: liquidator,\n * borrower: borrower,\n * });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'ValidationError':\n * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transactions.\n */\nexport function useLiquidatePosition(\n handler: TransactionHandler,\n): UseAsyncTask<\n LiquidatePositionRequest,\n TxHash,\n | SendTransactionError\n | PendingTransactionError\n | ValidationError<InsufficientBalanceError>\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: LiquidatePositionRequest) =>\n // TODO: update the relevant read queries\n liquidatePosition(client, request).andThen((plan) => {\n switch (plan.__typename) {\n case 'TransactionRequest':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'Erc20ApprovalRequired':\n case 'PreContractActionRequired':\n return handler(plan, { cancel })\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(() => handler(plan.originalTransaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction);\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(plan));\n }\n }),\n [client, handler],\n );\n}\n\n/**\n * A hook that provides a way to set or remove a position manager for a user on a specific spoke.\n *\n * **Position managers** can perform transactions on behalf of other users, including:\n * - Supply assets\n * - Borrow assets\n * - Withdraw assets\n * - Enable/disable collateral\n *\n * The `signature` parameter is an **ERC712 signature** that must be signed by the **user**\n * (the account granting permissions) to authorize the position manager. The signature contains:\n * - `value`: The actual cryptographic signature\n * - `deadline`: Unix timestamp when the authorization expires\n *\n * ```ts\n * const [sendTransaction] = useSendTransaction(wallet);\n * const [setSpokeUserPositionManager, { loading, error }] = useSetSpokeUserPositionManager((transaction, { cancel }) => {\n * return sendTransaction(transaction);\n * });\n *\n * const result = await setSpokeUserPositionManager({\n * spoke: spokeId('SGVsbG8h'),\n * manager: evmAddress('0x9abc…'), // Address that will become the position manager\n * approve: true, // true to approve, false to remove the manager\n * user: evmAddress('0xdef0…'), // User granting the permission (must sign the signature)\n * signature: {\n * value: '0x1234...', // ERC712 signature signed by the user\n * deadline: 1735689600, // Unix timestamp when signature expires\n * },\n * });\n *\n * if (result.isErr()) {\n * switch (result.error.name) {\n * case 'CancelError':\n * // The user cancelled the operation\n * return;\n *\n * case 'SigningError':\n * console.error(`Failed to sign the transaction: ${result.error.message}`);\n * break;\n *\n * case 'TimeoutError':\n * console.error(`Transaction timed out: ${result.error.message}`);\n * break;\n *\n * case 'TransactionError':\n * console.error(`Transaction failed: ${result.error.message}`);\n * break;\n *\n * case 'UnexpectedError':\n * console.error(result.error.message);\n * break;\n * }\n * return;\n * }\n *\n * console.log('Transaction sent with hash:', result.value);\n * ```\n *\n * @param handler - The handler that will be used to handle the transaction.\n */\nexport function useSetSpokeUserPositionManager(\n handler: TransactionHandler,\n): UseAsyncTask<\n SetSpokeUserPositionManagerRequest,\n TxHash,\n SendTransactionError | PendingTransactionError\n> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: SetSpokeUserPositionManagerRequest) =>\n setSpokeUserPositionManager(client, request)\n .andThen((transaction) => handler(transaction, { cancel }))\n .andThen((pendingTransaction) => pendingTransaction.wait())\n .andThen(client.waitForTransaction)\n .andTee(() =>\n client.refreshQueryWhere(\n SpokePositionManagersQuery,\n (variables) => variables.request.spoke === request.spoke,\n ),\n ),\n [client, handler],\n );\n}\n\n/**\n * Preview the impact of a potential action on a user's position.\n *\n * ```tsx\n * const [getPreview, previewing] = usePreviewAction();\n *\n * const loading = previewing.loading;\n * const error = previewing.error;\n *\n * // …\n *\n * const result = await getPreview({\n * action: {\n * supply: {\n * reserve: reserveId('SGVsbG8h'),\n * amount: {\n * erc20: {\n * value: '1000',\n * },\n * },\n * sender: evmAddress('0x9abc…'),\n * },\n * },\n * });\n *\n * if (result.isErr()) {\n * console.error(result.error);\n * return;\n * }\n *\n * console.log('Preview result:', result.value);\n * ```\n */\nexport function usePreviewAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<PreviewRequest, PreviewUserPosition, UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: PreviewRequest) =>\n preview(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n\nexport type UsePreviewArgs = Prettify<PreviewRequest & CurrencyQueryOptions>;\n\n/**\n * Fetch a preview of the impact of a potential action on a user's position.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = usePreview({\n * action: {\n * supply: {\n * reserve: reserveId('SGVsbG8h'),\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * supplier: evmAddress('0x9abc…'),\n * },\n * },\n * suspense: true,\n * });\n * ```\n */\nexport function usePreview(\n args: UsePreviewArgs & Suspendable,\n): SuspenseResult<PreviewUserPosition>;\n/**\n * Fetch a preview of the impact of a potential action on a user's position.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = usePreview({\n * action: {\n * supply: {\n * reserve: reserveId('SGVsbG8h'),\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * supplier: evmAddress('0x9abc…'),\n * },\n * },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function usePreview(\n args: Pausable<UsePreviewArgs> & Suspendable,\n): PausableSuspenseResult<PreviewUserPosition>;\n/**\n * Fetch a preview of the impact of a potential action on a user's position.\n *\n * ```tsx\n * const { data, error, loading } = usePreview({\n * action: {\n * supply: {\n * reserve: reserveId('SGVsbG8h'),\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * supplier: evmAddress('0x9abc…'),\n * },\n * },\n * });\n * ```\n */\nexport function usePreview(\n args: UsePreviewArgs,\n): ReadResult<PreviewUserPosition>;\n/**\n * Fetch a preview of the impact of a potential action on a user's position.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = usePreview({\n * action: {\n * supply: {\n * reserve: reserveId('SGVsbG8h'),\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * supplier: evmAddress('0x9abc…'),\n * },\n * },\n * pause: true,\n * });\n * ```\n */\nexport function usePreview(\n args: Pausable<UsePreviewArgs>,\n): PausableReadResult<PreviewUserPosition>;\n\nexport function usePreview({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UsePreviewArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<PreviewUserPosition, UnexpectedError> {\n return useSuspendableQuery({\n document: PreviewQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseActivitiesArgs = Prettify<\n ActivitiesRequest & CurrencyQueryOptions & TimeWindowQueryOptions\n>;\n\n/**\n * Fetch paginated list of activities.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useActivities({\n * query: {\n * chainId: chainId(1),\n * },\n * user: evmAddress('0x742d35cc…'),\n * suspense: true,\n * });\n *\n * // data.items: ActivityItem[]\n * ```\n */\nexport function useActivities(\n args: UseActivitiesArgs & Suspendable,\n): SuspenseResult<PaginatedActivitiesResult>;\n/**\n * Fetch paginated list of activities.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useActivities({\n * query: {\n * chainId: chainId(1),\n * },\n * user: evmAddress('0x742d35cc…'),\n * suspense: true,\n * pause: true,\n * });\n *\n * // data?.items: ActivityItem[] | undefined\n * ```\n */\nexport function useActivities(\n args: Pausable<UseActivitiesArgs> & Suspendable,\n): PausableSuspenseResult<PaginatedActivitiesResult>;\n/**\n * Fetch paginated list of activities.\n *\n * ```tsx\n * const { data, error, loading } = useActivities({\n * query: {\n * chainId: chainId(1),\n * },\n * user: evmAddress('0x742d35cc…'),\n * });\n * ```\n */\nexport function useActivities(\n args: UseActivitiesArgs,\n): ReadResult<PaginatedActivitiesResult>;\n/**\n * Fetch paginated list of activities.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading } = useActivities({\n * query: {\n * chainId: chainId(1),\n * },\n * user: evmAddress('0x742d35cc…'),\n * pause: true,\n * });\n *\n * // data?.items: ActivityItem[] | undefined\n * // error: UnexpectedError | undefined\n * // loading: boolean | undefined\n * ```\n */\nexport function useActivities(\n args: Pausable<UseActivitiesArgs>,\n): PausableReadResult<PaginatedActivitiesResult>;\n\nexport function useActivities({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseActivitiesArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<PaginatedActivitiesResult, UnexpectedError> {\n return useSuspendableQuery({\n document: ActivitiesQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link activities} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook does not actively watch for updates. Use it to fetch activities on demand\n * (e.g., in an event handler when paginating or refining filters).\n *\n * @param options - The query options.\n * @returns The user history.\n */\nexport function useActivitiesAction(\n options: Required<CurrencyQueryOptions> &\n TimeWindowQueryOptions = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<ActivitiesRequest, PaginatedActivitiesResult, UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: ActivitiesRequest) =>\n activities(client, request, {\n currency: options.currency,\n timeWindow: options.timeWindow ?? DEFAULT_QUERY_OPTIONS.timeWindow,\n }),\n [client, options.currency, options.timeWindow],\n );\n}\n","import {\n type CurrencyQueryOptions,\n DEFAULT_QUERY_OPTIONS,\n type TimeWindowQueryOptions,\n type UnexpectedError,\n} from '@aave/client';\nimport type { UserPositionQueryOptions } from '@aave/client/actions';\nimport {\n userBalances,\n userBorrows,\n userPositions,\n userSupplies,\n} from '@aave/client/actions';\nimport {\n type UserBalance,\n UserBalancesQuery,\n type UserBalancesRequest,\n type UserBorrowItem,\n UserBorrowsQuery,\n type UserBorrowsRequest,\n type UserPosition,\n UserPositionQuery,\n type UserPositionRequest,\n UserPositionsQuery,\n type UserPositionsRequest,\n type UserSummary,\n type UserSummaryHistoryItem,\n UserSummaryHistoryQuery,\n type UserSummaryHistoryRequest,\n UserSummaryQuery,\n type UserSummaryRequest,\n UserSuppliesQuery,\n type UserSuppliesRequest,\n type UserSupplyItem,\n} from '@aave/graphql';\nimport type { NullishDeep, Prettify } from '@aave/types';\nimport { useAaveClient } from './context';\nimport {\n type Pausable,\n type PausableReadResult,\n type PausableSuspenseResult,\n type ReadResult,\n type Suspendable,\n type SuspendableResult,\n type SuspenseResult,\n type UseAsyncTask,\n useAsyncTask,\n useSuspendableQuery,\n} from './helpers';\n\nexport type UseUserSuppliesArgs = Prettify<\n UserSuppliesRequest & CurrencyQueryOptions & TimeWindowQueryOptions\n>;\n\n/**\n * Fetch all user supply positions.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserSupplies({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * suspense: true,\n * });\n * ```\n */\nexport function useUserSupplies(\n args: UseUserSuppliesArgs & Suspendable,\n): SuspenseResult<UserSupplyItem[]>;\n/**\n * Fetch all user supply positions.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserSupplies({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * suspense: true,\n * pause: true,\n * });\n *\n * // data?.length: number | undefined\n * ```\n */\nexport function useUserSupplies(\n args: Pausable<UseUserSuppliesArgs> & Suspendable,\n): PausableSuspenseResult<UserSupplyItem[]>;\n/**\n * Fetch all user supply positions.\n *\n * ```tsx\n * const { data, error, loading } = useUserSupplies({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * });\n * ```\n */\nexport function useUserSupplies(\n args: UseUserSuppliesArgs,\n): ReadResult<UserSupplyItem[]>;\n/**\n * Fetch all user supply positions.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserSupplies({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * pause: true,\n * });\n *\n * // data?.length: number | undefined\n * // error: UnexpectedError | undefined\n * // loading: boolean | undefined\n * // paused: boolean\n * ```\n */\nexport function useUserSupplies(\n args: Pausable<UseUserSuppliesArgs>,\n): PausableReadResult<UserSupplyItem[]>;\n\nexport function useUserSupplies({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseUserSuppliesArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserSupplyItem[], UnexpectedError> {\n return useSuspendableQuery({\n document: UserSuppliesQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link userSupplies} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on user supplies.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useUserSuppliesAction();\n *\n * // …\n *\n * const result = await execute({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // UserSupplyItem[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useUserSuppliesAction(\n options: Required<CurrencyQueryOptions> &\n TimeWindowQueryOptions = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<UserSuppliesRequest, UserSupplyItem[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: UserSuppliesRequest) =>\n userSupplies(client, request, {\n currency: options.currency,\n timeWindow: options.timeWindow ?? DEFAULT_QUERY_OPTIONS.timeWindow,\n }),\n [client, options.currency, options.timeWindow],\n );\n}\n\nexport type UseUserBorrowsArgs = Prettify<\n UserBorrowsRequest & CurrencyQueryOptions & TimeWindowQueryOptions\n>;\n\n/**\n * Fetch all user borrow positions.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserBorrows({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * suspense: true,\n * });\n * ```\n */\nexport function useUserBorrows(\n args: UseUserBorrowsArgs & Suspendable,\n): SuspenseResult<UserBorrowItem[]>;\n/**\n * Fetch all user borrow positions.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserBorrows({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserBorrows(\n args: Pausable<UseUserBorrowsArgs> & Suspendable,\n): PausableSuspenseResult<UserBorrowItem[]>;\n/**\n * Fetch all user borrow positions.\n *\n * ```tsx\n * const { data, error, loading } = useUserBorrows({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * });\n * ```\n */\nexport function useUserBorrows(\n args: UseUserBorrowsArgs,\n): ReadResult<UserBorrowItem[]>;\n/**\n * Fetch all user borrow positions.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserBorrows({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * pause: true,\n * });\n * ```\n */\nexport function useUserBorrows(\n args: Pausable<UseUserBorrowsArgs>,\n): PausableReadResult<UserBorrowItem[]>;\n\nexport function useUserBorrows({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseUserBorrowsArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserBorrowItem[], UnexpectedError> {\n return useSuspendableQuery({\n document: UserBorrowsQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link userBorrows} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on user borrows.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useUserBorrowsAction();\n *\n * // …\n *\n * const result = await execute({\n * query: {\n * userSpoke: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * user: evmAddress('0x742d35cc…'),\n * },\n * },\n * orderBy: { name: 'ASC' },\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // UserBorrowItem[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useUserBorrowsAction(\n options: Required<CurrencyQueryOptions> &\n TimeWindowQueryOptions = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<UserBorrowsRequest, UserBorrowItem[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: UserBorrowsRequest) =>\n userBorrows(client, request, {\n currency: options.currency,\n timeWindow: options.timeWindow ?? DEFAULT_QUERY_OPTIONS.timeWindow,\n }),\n [client, options.currency, options.timeWindow],\n );\n}\n\nexport type UseUserSummaryArgs = Prettify<\n UserSummaryRequest & TimeWindowQueryOptions & CurrencyQueryOptions\n>;\n\n/**\n * Fetch a user's financial summary.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserSummary({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * },\n * suspense: true,\n * });\n * ```\n */\nexport function useUserSummary(\n args: UseUserSummaryArgs & Suspendable,\n): SuspenseResult<UserSummary>;\n/**\n * Fetch a user's financial summary.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserSummary({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserSummary(\n args: Pausable<UseUserSummaryArgs> & Suspendable,\n): PausableSuspenseResult<UserSummary>;\n/**\n * Fetch a user's financial summary.\n *\n * ```tsx\n * const { data, error, loading } = useUserSummary({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * },\n * });\n * ```\n */\nexport function useUserSummary(\n args: UseUserSummaryArgs,\n): ReadResult<UserSummary>;\n/**\n * Fetch a user's financial summary.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserSummary({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },\n * },\n * pause: true,\n * });\n * ```\n */\nexport function useUserSummary(\n args: Pausable<UseUserSummaryArgs>,\n): PausableReadResult<UserSummary>;\n\nexport function useUserSummary({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseUserSummaryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserSummary, UnexpectedError> {\n return useSuspendableQuery({\n document: UserSummaryQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseUserPositionsArgs = Prettify<\n UserPositionsRequest & UserPositionQueryOptions\n>;\n\n/**\n * Fetch all user positions across specified chains.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserPositions({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * orderBy: { balance: 'DESC' },\n * suspense: true,\n * });\n * ```\n */\nexport function useUserPositions(\n args: UseUserPositionsArgs & Suspendable,\n): SuspenseResult<UserPosition[]>;\n/**\n * Fetch all user positions across specified chains.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserPositions({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * orderBy: { balance: 'DESC' },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserPositions(\n args: Pausable<UseUserPositionsArgs> & Suspendable,\n): PausableSuspenseResult<UserPosition[]>;\n/**\n * Fetch all user positions across specified chains.\n *\n * ```tsx\n * const { data, error, loading } = useUserPositions({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * orderBy: { balance: 'DESC' },\n * });\n * ```\n */\nexport function useUserPositions(\n args: UseUserPositionsArgs,\n): ReadResult<UserPosition[]>;\n/**\n * Fetch all user positions across specified chains.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserPositions({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * orderBy: { balance: 'DESC' },\n * pause: true,\n * });\n * ```\n */\nexport function useUserPositions(\n args: Pausable<UseUserPositionsArgs>,\n): PausableReadResult<UserPosition[]>;\n\nexport function useUserPositions({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseUserPositionsArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserPosition[], UnexpectedError> {\n return useSuspendableQuery({\n document: UserPositionsQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link userPositions} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on user positions.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useUserPositionsAction();\n *\n * // …\n *\n * const result = await execute({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * chainIds: [chainId(1), chainId(137)]\n * },\n * orderBy: { balance: 'DESC' },\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // UserPosition[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useUserPositionsAction(\n options: UserPositionQueryOptions = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<UserPositionsRequest, UserPosition[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: UserPositionsRequest) =>\n userPositions(client, request, {\n currency: options.currency,\n timeWindow: options.timeWindow,\n }),\n [client, options.currency, options.timeWindow],\n );\n}\n\nexport type UseUserPositionArgs = Prettify<\n UserPositionRequest & UserPositionQueryOptions\n>;\n\n/**\n * Fetch a specific user position by ID.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserPosition({\n * id: userPositionId('SGVsbG8h'),\n * user: evmAddress('0x742d35cc…'),\n * suspense: true,\n * });\n * ```\n */\nexport function useUserPosition(\n args: UseUserPositionArgs & Suspendable,\n): SuspenseResult<UserPosition>;\n/**\n * Fetch a specific user position by ID.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserPosition({\n * id: userPositionId('SGVsbG8h'),\n * user: evmAddress('0x742d35cc…'),\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserPosition(\n args: Pausable<UseUserPositionArgs> & Suspendable,\n): PausableSuspenseResult<UserPosition>;\n/**\n * Fetch a specific user position by ID.\n *\n * ```tsx\n * const { data, error, loading } = useUserPosition({\n * id: userPositionId('SGVsbG8h'),\n * user: evmAddress('0x742d35cc…'),\n * });\n * ```\n */\nexport function useUserPosition(\n args: UseUserPositionArgs,\n): ReadResult<UserPosition>;\n/**\n * Fetch a specific user position by ID.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserPosition({\n * id: userPositionId('SGVsbG8h'),\n * user: evmAddress('0x742d35cc…'),\n * pause: true,\n * });\n * ```\n */\nexport function useUserPosition(\n args: Pausable<UseUserPositionArgs>,\n): PausableReadResult<UserPosition>;\n\nexport function useUserPosition({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n timeWindow = DEFAULT_QUERY_OPTIONS.timeWindow,\n ...request\n}: NullishDeep<UseUserPositionArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserPosition | null, UnexpectedError> {\n return useSuspendableQuery({\n document: UserPositionQuery,\n variables: {\n request,\n currency,\n timeWindow,\n },\n suspense,\n pause,\n });\n}\n\nexport type UseUserBalancesArgs = Prettify<\n UserBalancesRequest & CurrencyQueryOptions\n>;\n\n/**\n * Fetch all user balances across specified chains.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserBalances({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * suspense: true,\n * });\n * ```\n */\nexport function useUserBalances(\n args: UseUserBalancesArgs & Suspendable,\n): SuspenseResult<UserBalance[]>;\n/**\n * Fetch all user balances across specified chains.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserBalances({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserBalances(\n args: Pausable<UseUserBalancesArgs> & Suspendable,\n): PausableSuspenseResult<UserBalance[]>;\n/**\n * Fetch all user balances across specified chains.\n *\n * ```tsx\n * const { data, error, loading } = useUserBalances({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * });\n * ```\n */\nexport function useUserBalances(\n args: UseUserBalancesArgs,\n): ReadResult<UserBalance[]>;\n/**\n * Fetch all user balances across specified chains.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserBalances({\n * user: evmAddress('0x742d35cc…'),\n * chainIds: [chainId(1), chainId(137)],\n * pause: true,\n * });\n * ```\n */\nexport function useUserBalances(\n args: Pausable<UseUserBalancesArgs>,\n): PausableReadResult<UserBalance[]>;\n\nexport function useUserBalances({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseUserBalancesArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserBalance[], UnexpectedError> {\n return useSuspendableQuery({\n document: UserBalancesQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n });\n}\n\n/**\n * Low-level hook to execute a {@link userBalances} action directly.\n *\n * @experimental This hook is experimental and may be subject to breaking changes.\n * @remarks\n * This hook **does not** actively watch for updated data on user balances.\n * Use this hook to retrieve data on demand as part of a larger workflow\n * (e.g., in an event handler in order to move to the next step).\n *\n * ```ts\n * const [execute, { called, data, error, loading }] = useUserBalancesAction();\n *\n * // …\n *\n * const result = await execute({\n * user: evmAddress('0x742d35cc…'),\n * filter: {\n * chainIds: [chainId(1), chainId(137)]\n * },\n * });\n *\n * if (result.isOk()) {\n * console.log(result.value); // UserBalance[]\n * } else {\n * console.error(result.error);\n * }\n * ```\n */\nexport function useUserBalancesAction(\n options: Required<CurrencyQueryOptions> = DEFAULT_QUERY_OPTIONS,\n): UseAsyncTask<UserBalancesRequest, UserBalance[], UnexpectedError> {\n const client = useAaveClient();\n\n return useAsyncTask(\n (request: UserBalancesRequest) =>\n userBalances(client, request, { currency: options.currency }),\n [client, options.currency],\n );\n}\n\nexport type UseUserSummaryHistoryArgs = Prettify<\n UserSummaryHistoryRequest & CurrencyQueryOptions\n>;\n\n/**\n * Fetch user summary history over time.\n *\n * This signature supports React Suspense:\n *\n * ```tsx\n * const { data } = useUserSummaryHistory({\n * user: evmAddress('0x742d35cc…'),\n * window: TimeWindow.LastWeek,\n * filter: { chainIds: [chainId(1)] },\n * suspense: true,\n * });\n * ```\n */\nexport function useUserSummaryHistory(\n args: UseUserSummaryHistoryArgs & Suspendable,\n): SuspenseResult<UserSummaryHistoryItem[]>;\n/**\n * Fetch user summary history over time.\n *\n * Pausable suspense mode.\n *\n * ```tsx\n * const { data } = useUserSummaryHistory({\n * user: evmAddress('0x742d35cc…'),\n * window: TimeWindow.LastWeek,\n * filter: { chainIds: [chainId(1)] },\n * suspense: true,\n * pause: true,\n * });\n * ```\n */\nexport function useUserSummaryHistory(\n args: Pausable<UseUserSummaryHistoryArgs> & Suspendable,\n): PausableSuspenseResult<UserSummaryHistoryItem[]>;\n/**\n * Fetch user summary history over time.\n *\n * ```tsx\n * const { data, error, loading } = useUserSummaryHistory({\n * user: evmAddress('0x742d35cc…'),\n * window: TimeWindow.LastWeek,\n * filter: { chainIds: [chainId(1)] },\n * });\n * ```\n */\nexport function useUserSummaryHistory(\n args: UseUserSummaryHistoryArgs,\n): ReadResult<UserSummaryHistoryItem[]>;\n/**\n * Fetch user summary history over time.\n *\n * Pausable loading state mode.\n *\n * ```tsx\n * const { data, error, loading, paused } = useUserSummaryHistory({\n * user: evmAddress('0x742d35cc…'),\n * window: TimeWindow.LastWeek,\n * filter: { chainIds: [chainId(1)] },\n * pause: true,\n * });\n * ```\n */\nexport function useUserSummaryHistory(\n args: Pausable<UseUserSummaryHistoryArgs>,\n): PausableReadResult<UserSummaryHistoryItem[]>;\n\nexport function useUserSummaryHistory({\n suspense = false,\n pause = false,\n currency = DEFAULT_QUERY_OPTIONS.currency,\n ...request\n}: NullishDeep<UseUserSummaryHistoryArgs> & {\n suspense?: boolean;\n pause?: boolean;\n}): SuspendableResult<UserSummaryHistoryItem[], UnexpectedError> {\n return useSuspendableQuery({\n document: UserSummaryHistoryQuery,\n variables: {\n request,\n currency,\n },\n suspense,\n pause,\n batch: false, // Do not batch this since it's a slower than average query\n });\n}\n"]}
|