React Hooks#
All public Aave v4 React SDK hooks.
useChain#
Declarative hook to fetch a specific chain by ID.
Arguments:
request.chainId: ChainId- Chain ID to querypause?: boolean- Pause the query (default: false)
Returns:
data: Chain | null | undefined- Chain information or null if not foundloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the chain
useChainAction#
Imperative hook to fetch chain data on demand. Does not watch for updated data; use it to retrieve data as part of a larger workflow.
import { useChainAction } from "@aave/react";
const [execute, state] = useChainAction();
const result = await execute(request);Arguments:
request.chainId: ChainId- Chain ID
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching the chainstate.called: boolean- Whether the hook has been calledstate.data: Chain | null | undefined- Chain data or null if not foundresult: Result<Chain | null, UnexpectedError>- Type-safe success or failure value:Ok<Chain | null>- Chain data or null if not foundErr<UnexpectedError>- Error fetching the chain
useChains#
Declarative hook to fetch all supported chains.
Arguments:
request.query: ChainsRequestQueryone of:filter: ChainsFilter- Filter for chains (e.g.,ChainsFilter.ALL)chainIds: [ChainId!]- Fetch by chain IDs
pause?: boolean- Pause the query (default: false)
Returns:
data: Chain[] | undefined- Array of supported chainsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the chains
useClaimRewards#
Imperative transaction hook to claim rewards for a user on a specific chain.
import { useClaimRewards } from "@aave/react";
const [execute, state] = useClaimRewards((transaction) => sendTransaction(transaction),);
const result = await execute(request);Arguments:
request.ids: [RewardId!]- Reward IDs to claimrequest.user: EvmAddress- User claiming the rewardsrequest.chainId: ChainId- Chain to claim on
Returns:
state.loading: boolean- Loading statestate.error: E | undefined- Error executing the transactionstate.called: boolean- Whether the hook has been calledstate.data: TransactionReceipt | undefined- Transaction receiptresult: Result<TransactionReceipt, E>- Type-safe success or failure value:Ok<TransactionReceipt>- Transaction receiptErr<E>- Error executing the transaction
Where E is one of:
SendTransactionErrorCancelErrorTimeoutErrorTransactionError
useActivities#
Declarative hook to fetch paginated list of user activities.
Arguments:
request.query: ActivitiesRequestQueryone of:hub: HubInput- Fetch by hubspoke: SpokeInput- Fetch by spokechainIds: [ChainId!]- Fetch by chain IDstxHash: TxHashInput- Fetch by transaction hash
request.user?: EvmAddress- User address (optional)request.currency?: Currency- Currency for value conversions (default: USD)pause?: boolean- Pause the query (default: false)
Returns:
data?.items: ActivityItem[]- List of activitiesdata?.pageInfo: PageInfo- Pagination informationloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the activities
useActivitiesAction#
Imperative hook to fetch paginated list of user activities.
import { useActivitiesAction } from "@aave/react";
const [execute, state] = useActivitiesAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)
Arguments:
request.query: ActivitiesRequestQueryone of:hub: HubInput- Fetch by hubspoke: SpokeInput- Fetch by spokechainIds: [ChainId!]- Fetch by chain IDstxHash: TxHashInput- Fetch by transaction hash
request.user?: EvmAddress- User address (optional)
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching the activitiesstate.called: boolean- Whether the hook has been calledstate.data: PaginatedActivitiesResult | undefined- Paginated activities resultresult: Result<PaginatedActivitiesResult, UnexpectedError>- Type-safe success or failure value:Ok<PaginatedActivitiesResult>- Paginated activities resultErr<UnexpectedError>- Error fetching the activities
useAsset#
Declarative hook to fetch information about a specific asset (ERC20 token).
Arguments:
request.query: AssetRequestQueryone of:token: Erc20Input- ERC-20 tokenaddress: EvmAddress- Token contract addresschainId: ChainId- Chain ID where the token exists
assetId: AssetId- Asset ID
request.currency?: Currency- Currency for value conversions (optional)request.timeWindow?: TimeWindow- Time window for historical data (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: Asset | null | undefined- Asset information or null if not foundloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the asset
useAssetBorrowHistory#
Declarative hook to fetch historical borrow data for an asset.
Arguments:
request.token.address: EvmAddress- Asset contract addressrequest.token.chainId: ChainId- Chain IDrequest.window: TimeWindow- Time window for historical datapause?: boolean- Pause the query (default: false)
Returns:
data: AssetBorrowSample[] | undefined- Array of historical borrow data pointsdata[].date: Date- Sample datedata[].amount: DecimalNumber- Total borrowed amountdata[].highestApy: PercentNumber- Highest borrow APY across hubsdata[].lowestApy: PercentNumber- Lowest borrow APY across hubsdata[].averageApy: PercentNumber- Average borrow APY across all hubsdata[].breakdown: AssetSampleBreakdown[]- Per-hub APY breakdown
loading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the borrow history
useAssetPriceHistory#
Declarative hook to fetch historical price data for an asset.
Arguments:
request.token.address: EvmAddress- Asset contract addressrequest.token.chainId: ChainId- Chain IDrequest.currency: Currency- Currency for the datarequest.window: TimeWindow- Time window for historical datapause?: boolean- Pause the query (default: false)
Returns:
data: AssetPriceSample[] | undefined- Array of historical price data pointsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the price history
useAssetSupplyHistory#
Declarative hook to fetch historical supply data for an asset.
Arguments:
request.token.address: EvmAddress- Asset contract addressrequest.token.chainId: ChainId- Chain IDrequest.window: TimeWindow- Time window for historical datapause?: boolean- Pause the query (default: false)
Returns:
data: AssetSupplySample[] | undefined- Array of historical supply data pointsdata[].date: Date- Sample datedata[].amount: DecimalNumber- Total supplied amountdata[].highestApy: PercentNumber- Highest supply APY across hubsdata[].lowestApy: PercentNumber- Lowest supply APY across hubsdata[].averageApy: PercentNumber- Average supply APY across all hubsdata[].breakdown: AssetSampleBreakdown[]- Per-hub APY breakdown
loading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the supply history
useProtocolHistory#
Declarative hook to fetch protocol-wide historical data (deposits, borrows).
Arguments:
request.currency: Currency- Currency for exchange amounts (default: USD)request.window: TimeWindow- Time window for historical data (default: LAST_DAY)pause?: boolean- Pause the query (default: false)
Returns:
data: ProtocolHistorySample[] | undefined- Array of protocol history data pointsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the protocol history
useBorrow#
Imperative transaction hook to borrow assets from the protocol.
import { useBorrow } from "@aave/react";
const [execute, state] = useBorrow((plan) => { switch (plan.__typename) { case "TransactionRequest": return sendTransaction(plan); case "PreContractActionRequired": return sendTransaction(plan.transaction); }});
const result = await execute(request);Arguments:
request.chainId: ChainId- Chain IDrequest.reserve: EvmAddress- Reserve addressrequest.amount: BigDecimal- Amount to borrowrequest.onBehalfOf?: EvmAddress- Borrow on behalf of another address (optional)
Returns:
state.loading: boolean- Loading statestate.error: E | undefined- Error executing the transactionstate.called: boolean- Whether the hook has been calledstate.data: TransactionReceipt | undefined- Transaction receiptresult: Result<TransactionReceipt, E>- Type-safe success or failure value:Ok<TransactionReceipt>- Transaction receiptErr<E>- Error executing the transaction
Where E is one of:
SendTransactionErrorCancelErrorTimeoutErrorTransactionErrorValidationError<InsufficientBalanceError>
useBorrowApyHistory#
Declarative hook to fetch borrow APY history for a specific reserve over time.
Arguments:
request.spoke.address: EvmAddress- Spoke contract addressrequest.spoke.chainId: ChainId- Chain IDrequest.reserve: ReserveId- Reserve IDrequest.window: TimeWindow- Time window for historical datapause?: boolean- Pause the query (default: false)
Returns:
data: ApySample[] | undefined- Array of historical APY data pointsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the borrow APY history
useSignTypedData#
Imperative transaction hook to sign EIP-712 typed data for ERC-20 permits and swap intents.
This hook provides a unified interface for signing all types of typed data in the Aave SDK. It returns a raw signature that is automatically wrapped with deadline information by transaction hooks like useSupply, useRepay, and useTokenSwap.
Arguments:
typedData: TypedData- The EIP-712 typed data to sign.
Returns:
state.loading: boolean- Loading statestate.error: SignTypedDataError | undefined- Error signing the typed datastate.called: boolean- Whether the hook has been calledstate.data: Signature | undefined- Raw signature (deadline wrapping is handled automatically by transaction hooks)result: Result<Signature, SignTypedDataError>- Type-safe success or failure value:Ok<Signature>- Raw signatureErr<SignTypedDataError>- Error signing the typed data
useExchangeRate#
Declarative hook to fetch the current exchange rate between two currencies.
Arguments:
request.from: AssetInput- Source asset (erc20 or native)request.to: Currency- Target currencypause?: boolean- Pause the query (default: false)
Returns:
data: ExchangeAmount | undefined- Exchange rate valueloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the exchange rate
useExchangeRateAction#
Imperative hook to fetch exchange rate between two currencies.
import { useExchangeRateAction } from "@aave/react";
const [execute, state] = useExchangeRateAction();
const result = await execute(request);Arguments:
request.from: AssetInput- Source asset (erc20 or native)request.to: Currency- Target currencyrequest.at?: Date- Historical date (optional)
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching the exchange ratestate.called: boolean- Whether the hook has been calledstate.data: ExchangeAmount | undefined- Exchange rate valueresult: Result<ExchangeAmount, UnexpectedError>- Type-safe success or failure value:Ok<ExchangeAmount>- Exchange rate valueErr<UnexpectedError>- Error fetching the exchange rate
useHub#
Declarative hook to fetch a specific hub by address and chain ID.
Arguments:
request.query: HubRequestQueryone of:hubInput: HubInput- Hub address and chain IDaddress: EvmAddress- Hub contract addresschainId: ChainId- Chain ID where the hub exists
hubId: HubId- Hub ID
request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: Hub | null | undefined- Hub information or null if not foundloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the hub
useHubAssets#
Declarative hook to fetch hub assets for a specific chain and optional hub/user filtering.
Arguments:
request.query: HubAssetsRequestQueryone of:hubInput: HubInput- Hub address and chain IDaddress: EvmAddress- Hub contract addresschainId: ChainId- Chain ID
hubId: HubId- Hub ID
request.user?: EvmAddress- Filter by user address (optional)request.orderBy?: HubAssetsRequestOrderByone of:assetName: OrderDirection- Sort by asset nameavailableLiquidity: OrderDirection- Sort by available liquiditysupplyApy: OrderDirection- Sort by supply APYborrowApy: OrderDirection- Sort by borrow APY
request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: HubAsset[] | undefined- Array of hub assetsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the hub assets
useHubAssetInterestRateModel#
Declarative hook to fetch the interest rate model curve for a specific hub asset.
Arguments:
request.query: HubAssetInterestRateModelRequestQuery:hubAssetId: HubAssetId- Hub asset ID
request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: HubAssetInterestRateModelPoint[] | undefined- Array of interest rate model data pointsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the interest rate model
useHubAssetInterestRateModelAction#
Imperative hook to fetch interest rate model data for a hub asset.
import { useHubAssetInterestRateModelAction } from "@aave/react";
const [execute, state] = useHubAssetInterestRateModelAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)
Arguments:
request.query: HubAssetInterestRateModelRequestQuery:hubAssetId: HubAssetId- Hub asset ID
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching the interest rate modelstate.called: boolean- Whether the hook has been calledstate.data: HubAssetInterestRateModelPoint[] | undefined- Array of interest rate model data pointsresult: Result<HubAssetInterestRateModelPoint[], UnexpectedError>- Type-safe success or failure value:Ok<HubAssetInterestRateModelPoint[]>- Array of interest rate model data pointsErr<UnexpectedError>- Error fetching the interest rate model
useHubSummaryHistory#
Declarative hook to fetch historical summary data for a specific hub.
Arguments:
request.query: HubSummaryHistoryRequestQueryone of:hubInput: HubInput- Hub address and chain IDaddress: EvmAddress- Hub contract addresschainId: ChainId- Chain ID where the hub exists
hubId: HubId- Hub ID
request.currency?: Currency- Currency for value conversions (default: USD)request.window?: TimeWindow- Time window for historical data (default: LAST_DAY)pause?: boolean- Pause the query (default: false)
Returns:
data: HubSummarySample[] | undefined- Array of historical hub summary data pointsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the hub summary history
useHubSpokeConfigs#
Declarative hook to fetch per-asset configuration for a specific hub and spoke pair.
Arguments:
request.hubId: HubId- Hub IDrequest.spokeId: SpokeId- Spoke IDrequest.currency?: Currency- Currency for nested amount conversions (default: USD)request.timeWindow?: TimeWindow- Time window for nested change calculations (default: LAST_DAY)pause?: boolean- Pause the query (default: false)
Returns:
data: HubSpokeConfig[] | undefined- Array of hub-spoke asset configurationsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the configs
useHubs#
Declarative hook to fetch all available hubs.
Arguments:
request.query: HubsRequestQueryone of:tokens: [Erc20Input!]- Filter by underlying tokensaddress: EvmAddress- Token contract addresschainId: ChainId- Token chain ID
chainIds: [ChainId!]- Filter by chain IDs
request.orderBy?: HubsRequestOrderByone of:name: OrderDirection- Sort by hub nametotalBorrowed: OrderDirection- Sort by total borrowed amounttotalSupplied: OrderDirection- Sort by total supplied amount
pause?: boolean- Pause the query (default: false)
Returns:
data: Hub[] | undefined- Array of hubsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the hubs
useHubsAction#
Imperative hook to fetch hubs data.
import { useHubsAction } from "@aave/react";
const [execute, state] = useHubsAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)
Arguments:
request.query: HubsRequestQueryone of:tokens: [Erc20Input!]- Filter by underlying tokensaddress: EvmAddress- Token contract addresschainId: ChainId- Token chain ID
chainIds: [ChainId!]- Filter by chain IDs
request.orderBy?: HubsRequestOrderByone of:name: OrderDirection- Sort by hub nametotalBorrowed: OrderDirection- Sort by total borrowed amounttotalSupplied: OrderDirection- Sort by total supplied amount
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching the hubsstate.called: boolean- Whether the hook has been calledstate.data: Hub[] | undefined- Array of hubsresult: Result<Hub[], UnexpectedError>- Type-safe success or failure value:Ok<Hub[]>- Array of hubsErr<UnexpectedError>- Error fetching the hubs
useLiquidatePosition#
Imperative transaction hook to liquidate an undercollateralized position.
import { useLiquidatePosition } from "@aave/react";
const [execute, state] = useLiquidatePosition((plan) => { switch (plan.__typename) { case "TransactionRequest": return sendTransaction(plan); case "Erc20Approval": return sendTransaction(plan.byTransaction); case "PreContractActionRequired": return sendTransaction(plan.transaction); }});
const result = await execute(request);Arguments:
request.chainId: ChainId- Chain IDrequest.debtReserve: EvmAddress- Debt reserve addressrequest.collateralReserve: EvmAddress- Collateral reserve addressrequest.user: EvmAddress- User address to liquidaterequest.debtToCover: BigDecimal- Amount of debt to cover
Returns:
state.loading: boolean- Loading statestate.error: E | undefined- Error executing the transactionstate.called: boolean- Whether the hook has been calledstate.data: TransactionReceipt | undefined- Transaction receiptresult: Result<TransactionReceipt, E>- Type-safe success or failure value:Ok<TransactionReceipt>- Transaction receiptErr<E>- Error executing the transaction
Where E is one of:
SendTransactionErrorCancelErrorTimeoutErrorTransactionErrorValidationError<InsufficientBalanceError>
useMultichainAsset#
Declarative hook to fetch information about an asset (ERC-20 token) aggregated across multiple chains, matched by its token info ID or symbol.
Arguments:
request.query: MultichainAssetRequestQueryone of:tokenInfo: TokenInfoId- Token info IDsymbol: String- Token symbol (e.g."USDC")
request.chainIds?: [ChainId!]- Restrict aggregation to specific chains (optional)request.includeRewards?: boolean- Fold Merkl rewards into APY ranges (default: true)currency?: Currency- Currency for value conversions (default: USD)timeWindow?: TimeWindow- Time window for historical changes (default: LastDay)pause?: boolean- Pause the query (default: false)
Returns:
data: MultichainAsset | undefined- Aggregated asset data (assetsandsummary)loading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the asset
useNetworkFee#
Declarative hook to fetch the network fee for an activity (experimental).
Arguments:
request.query: UseNetworkFeeRequestQueryone of:activity: ActivityItem- Calculate fee for past activityestimate: PreviewAction- Estimate fee for preview action, one of:supply: SupplyRequest- Supply actionborrow: BorrowRequest- Borrow actionrepay: RepayRequest- Repay actionwithdraw: WithdrawRequest- Withdraw actionsetUserSuppliesAsCollateral: SetUserSuppliesAsCollateralRequest- Collateral changesupdateUserPositionConditions: UpdateUserPositionConditionsRequest- Position condition updates
request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: NativeAmount | undefined- Network fee amountloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the network fee
usePreview#
Declarative hook to preview the outcome of a transaction before executing.
Arguments:
request.action: PreviewActionInputone of:supply: SupplyRequest- Preview a supply actionborrow: BorrowRequest- Preview a borrow actionrepay: RepayRequest- Preview a repay actionwithdraw: WithdrawRequest- Preview a withdraw actionsetUserSuppliesAsCollateral: SetUserSuppliesAsCollateralRequest- Preview a collateral change
request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: PreviewUserPosition | undefined- Preview of user position after the actionloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the preview
usePreviewAction#
Imperative hook to preview the outcome of a transaction before executing.
import { usePreviewAction } from "@aave/react";
const [execute, state] = usePreviewAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)
Arguments:
request.action: PreviewActionInputone of:supply: SupplyRequest- Preview a supply actionborrow: BorrowRequest- Preview a borrow actionrepay: RepayRequest- Preview a repay actionwithdraw: WithdrawRequest- Preview a withdraw actionsetUserSuppliesAsCollateral: SetUserSuppliesAsCollateralRequest- Preview a collateral change
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching the previewstate.called: boolean- Whether the hook has been calledstate.data: PreviewUserPosition | undefined- Preview of user position after the actionresult: Result<PreviewUserPosition, UnexpectedError>- Type-safe success or failure value:Ok<PreviewUserPosition>- Preview of user position after the actionErr<UnexpectedError>- Error fetching the preview
useRenounceSpokeUserPositionManager#
Imperative transaction hook to renounce a position manager of a user for a specific spoke.
import { useRenounceSpokeUserPositionManager } from "@aave/react";
const [execute, state] = useRenounceSpokeUserPositionManager((transaction) => sendTransaction(transaction),);
const result = await execute(request);Arguments:
request.spoke: SpokeId- Spoke IDrequest.manager: EvmAddress- Address to remove as a position managerrequest.managing: EvmAddress- Address thatmanagerwas managing
Returns:
state.loading: boolean- Loading statestate.error: E | undefined- Error executing the transactionstate.called: boolean- Whether the hook has been calledstate.data: TransactionReceipt | undefined- Transaction receiptresult: Result<TransactionReceipt, E>- Type-safe success or failure value:Ok<TransactionReceipt>- Transaction receiptErr<E>- Error executing the transaction
Where E is one of:
SendTransactionErrorCancelErrorTimeoutErrorTransactionError
useRepay#
Imperative transaction hook to repay borrowed assets.
import { useRepay } from "@aave/react";
const [execute, state] = useRepay((plan) => { switch (plan.__typename) { case "TransactionRequest": return sendTransaction(plan); case "Erc20Approval": return sendTransaction(plan.byTransaction); case "PreContractActionRequired": return sendTransaction(plan.transaction); }});
const result = await execute(request);Arguments:
request.chainId: ChainId- Chain IDrequest.reserve: EvmAddress- Reserve addressrequest.amount: BigDecimal- Amount to repayrequest.onBehalfOf?: EvmAddress- Repay on behalf of another address (optional)
Returns:
state.loading: boolean- Loading statestate.error: E | undefined- Error executing the transactionstate.called: boolean- Whether the hook has been calledstate.data: TransactionReceipt | undefined- Transaction receiptresult: Result<TransactionReceipt, E>- Type-safe success or failure value:Ok<TransactionReceipt>- Transaction receiptErr<E>- Error executing the transaction
Where E is one of:
SendTransactionErrorCancelErrorTimeoutErrorTransactionErrorValidationError<InsufficientBalanceError>
useReserve#
Declarative hook to fetch a specific reserve by reserve ID, spoke, and chain.
Arguments:
request.query: ReserveRequestQueryone of:reserveId: ReserveId- Reserve IDreserveInput: ReserveInput- Reserve inputchainId: ChainId- Chain IDspoke: EvmAddress- Spoke contract addressonChainId: OnChainReserveId- On-chain reserve ID
request.user?: EvmAddress- User address for position-specific data (optional)request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: Reserve | null | undefined- Reserve information or null if not foundloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the reserve
useReserveAction#
Imperative hook to fetch reserve data.
import { useReserveAction } from "@aave/react";
const [execute, state] = useReserveAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)
Arguments:
request.reserve: ReserveId- Reserve IDrequest.user?: EvmAddress- User address for position-specific data (optional)
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching the reservestate.called: boolean- Whether the hook has been calledstate.data: Reserve | null | undefined- Reserve data or null if not foundresult: Result<Reserve | null, UnexpectedError>- Type-safe success or failure value:Ok<Reserve | null>- Reserve data or null if not foundErr<UnexpectedError>- Error fetching the reserve
useReserves#
Declarative hook to fetch reserves based on specified criteria.
Arguments:
request.query: ReservesRequestQueryone of:spoke: SpokeInput- Get reserves for a spokeaddress: EvmAddress- Spoke contract addresschainId: ChainId- Chain ID
spokeId: SpokeId- Get reserves by spoke IDtokens: [Erc20Input!]- Get reserves with underlying tokensaddress: EvmAddress- Token contract addresschainId: ChainId- Token chain ID
hubToken: HubTokenInput- Get reserves on hub for underlyingchainId: ChainId- Chain IDhub: EvmAddress- Hub contract addresstoken: EvmAddress- Token address
chainIds: [ChainId!]- Get reserves on chainsspokeToken: SpokeTokenInput- Get reserves for spoke for underlyingspoke: SpokeId- Spoke IDtoken: EvmAddress- Token address
hub: HubInput- Get reserves on hubuserPositionId: UserPositionId- Get reserves by user position IDcategories: TokenCategory[]- Get reserves by token categoriesTokenCategory.Stablecoin- Stablecoin categoryTokenCategory.EthCorrelated- ETH-correlated category
request.filter?: ReservesRequestFilter- Filter criteria (optional):Supply,Borrow,Collateral, orAllrequest.orderBy?: ReservesRequestOrderByone of:assetName: OrderDirection- Sort by asset nameuserBalance: OrderDirection- Sort by user balancesupplyApy: OrderDirection- Sort by supply APYsupplyAvailable: OrderDirection- Sort by available supplyborrowApy: OrderDirection- Sort by borrow APYborrowAvailable: OrderDirection- Sort by available borrowcollateralFactor: OrderDirection- Sort by collateral factor
request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: Reserve[] | undefined- Array of reservesloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching reserves
useReservesAction#
Imperative hook to fetch reserves list.
import { useReservesAction } from "@aave/react";
const [execute, state] = useReservesAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)
Arguments:
request.query: ReservesRequestQueryone of:spoke: SpokeInput- Get all reserves for a spoketokens: [Erc20Input!]- Get all reserves with underlying tokensaddress: EvmAddress- Token contract addresschainId: ChainId- Token chain ID
hubToken: HubTokenInput- Get all reserves on a hub for an underlyingchainId: ChainId- Chain IDhub: EvmAddress- Hub contract addresstoken: EvmAddress- Token address
chainIds: [ChainId!]- Get all reserves on a list of chainsspokeToken: SpokeTokenInput- Get all reserves for a spoke for an underlyingspoke: SpokeId- Spoke IDtoken: EvmAddress- Token address
hub: HubInput- Get all tokens on a hubuserPositionId: UserPositionId- Get all reserves by user position IDcategories: TokenCategory[]- Get all reserves by token categoriesTokenCategory.Stablecoin- Stablecoin categoryTokenCategory.EthCorrelated- ETH-correlated category
request.filter?: ReservesRequestFilter- Filter criteria (optional):Supply,Borrow,Collateral, orAll
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching reservesstate.called: boolean- Whether the hook has been calledstate.data: Reserve[] | undefined- Array of reservesresult: Result<Reserve[], UnexpectedError>- Type-safe success or failure value:Ok<Reserve[]>- Array of reservesErr<UnexpectedError>- Error fetching reserves
useReserveHolders#
Declarative hook to fetch a paginated list of top holders for a specific reserve.
Arguments:
request.reserve: ReserveRequestQueryone of:reserveId: ReserveId- Reserve ID
request.filter?: ReserveHoldersFilter- Filter by holder type (default:Supplied):ReserveHoldersFilter.Supplied- Wallets that have supplied to this reserveReserveHoldersFilter.Borrowed- Wallets that have borrowed from this reserve
request.pageSize?: PageSize- Number of results per page (default:TEN)request.cursor?: Cursor- Pagination cursorpause?: boolean- Pause the query (default: false)
Returns:
data: PaginatedReserveHoldersResult | undefineddata.items: ReserveHolder[]- Array of holdersaddress: EvmAddress- Holder wallet addressamount: Erc20Amount- Amount supplied or borrowedweight: PercentNumber- Percentage share of the total
data.pageInfo: PaginatedResultInfo- Pagination info withnextandprevcursors
loading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching holders
useReserveHoldersAction#
Imperative hook to fetch reserve holders on demand (e.g., for pagination).
import { useReserveHoldersAction } from "@aave/react";
const [execute, state] = useReserveHoldersAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)
Arguments:
request.reserve: ReserveRequestQuery- Reserve query (seeuseReserveHolders)request.filter?: ReserveHoldersFilter- Holder type filterrequest.pageSize?: PageSize- Page sizerequest.cursor?: Cursor- Pagination cursor
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching holdersstate.called: boolean- Whether the hook has been calledstate.data: PaginatedReserveHoldersResult | undefined- Paginated resultresult: Result<PaginatedReserveHoldersResult, UnexpectedError>- Type-safe success or failure value:Ok<PaginatedReserveHoldersResult>- Paginated holder dataErr<UnexpectedError>- Error fetching holders
useSendTransaction#
Send transactions through connected wallet.
useSetSpokeUserPositionManager#
Imperative transaction hook to set a position manager for a spoke.
import { useSetSpokeUserPositionManager } from "@aave/react";
const [execute, state] = useSetSpokeUserPositionManager((transaction) => sendTransaction(transaction),);
const result = await execute(request);Arguments:
request.chainId: ChainId- Chain IDrequest.spoke: SpokeId- Spoke IDrequest.manager: EvmAddress- Position manager address
Returns:
state.loading: boolean- Loading statestate.error: E | undefined- Error executing the transactionstate.called: boolean- Whether the hook has been calledstate.data: TransactionReceipt | undefined- Transaction receiptresult: Result<TransactionReceipt, E>- Type-safe success or failure value:Ok<TransactionReceipt>- Transaction receiptErr<E>- Error executing the transaction
Where E is one of:
SendTransactionErrorCancelErrorTimeoutErrorTransactionError
useSetUserSuppliesAsCollateral#
Imperative transaction hook to enable or disable assets as collateral.
import { useSetUserSuppliesAsCollateral } from "@aave/react";
const [execute, state] = useSetUserSuppliesAsCollateral((transaction) => sendTransaction(transaction),);
const result = await execute(request);Arguments:
request.changes: UserSupplyAsCollateral[]- Array of collateral changeschanges[].reserve: ReserveId- Reserve IDchanges[].enableCollateral: boolean- Enable or disable as collateral
request.sender: EvmAddress- User's address
Returns:
state.loading: boolean- Loading statestate.error: E | undefined- Error executing the transactionstate.called: boolean- Whether the hook has been calledstate.data: TransactionReceipt | undefined- Transaction receiptresult: Result<TransactionReceipt, E>- Type-safe success or failure value:Ok<TransactionReceipt>- Transaction receiptErr<Error>- Error executing the transaction
Where E is one of:
SendTransactionErrorCancelErrorTimeoutErrorTransactionError
useSpoke#
Declarative hook to fetch a specific spoke by address and chain ID.
Arguments:
request.query.spoke.address: EvmAddress- Spoke contract addressrequest.query.spoke.chainId: ChainId- Chain IDpause?: boolean- Pause the query (default: false)
Returns:
data: Spoke | null | undefined- Spoke information or null if not foundloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the spoke
useSpokePositionManagers#
Declarative hook to fetch paginated list of position managers for a spoke.
Arguments:
request.spoke: SpokeInput- Spoke address and chain IDpause?: boolean- Pause the query (default: false)
Returns:
data: PaginatedSpokePositionManagerResult | undefined- Paginated list of position managersloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching position managers
useSpokeSummaryHistory#
Declarative hook to fetch historical deposits and borrows for a specific spoke.
Arguments:
request.query: SpokeSummaryHistoryRequestQueryone of:spokeInput: SpokeInput- Spoke address and chain IDspokeId: SpokeId- Spoke ID
request.currency?: Currency- Currency for value conversions (default: USD)request.window?: TimeWindow- Time window for historical data (default: LAST_DAY)pause?: boolean- Pause the query (default: false)
Returns:
data: SpokeSummarySample[] | undefined- Array of historical spoke summary data pointsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the spoke summary history
useSpokes#
Declarative hook to fetch spokes based on specified criteria.
Arguments:
request.chainIds?: ChainId[]- Filter by specific chain IDs (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: Spoke[] | undefined- Array of spokesloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the spokes
useSpokeUserPositionManagers#
Declarative hook to fetch paginated list of user's position managers for a spoke.
Arguments:
request.spoke: SpokeInput- Spoke address and chain IDrequest.user: EvmAddress- User addresspause?: boolean- Pause the query (default: false)
Returns:
data: PaginatedSpokeUserPositionManagerResult | undefined- Paginated list of user's position managersloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching user position managers
useSwapStatus#
Declarative hook to monitor the status of a swap operation in real-time.
Arguments:
request.id: string- Swap receipt ID fromSwapReceipt.idpause?: boolean- Pause the query (default: false)
Returns:
data: SwapStatus | undefined- Current swap status, one of:SwapOpen- Swap is open and waiting for executionSwapPendingSignature- Swap is waiting for user signatureSwapFulfilled- Swap completed successfullySwapCancelled- Swap was cancelledSwapExpired- Swap expired before execution
loading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the swap status
useSupply#
Imperative transaction hook to supply assets to the protocol.
import { useSupply } from "@aave/react";
const [execute, state] = useSupply((plan) => { switch (plan.__typename) { case "TransactionRequest": return sendTransaction(plan); case "Erc20Approval": return sendTransaction(plan.byTransaction); case "PreContractActionRequired": return sendTransaction(plan.transaction); }});
const result = await execute(request);Arguments:
request.chainId: ChainId- Chain IDrequest.reserve: EvmAddress- Reserve addressrequest.amount: BigDecimal- Amount to supplyrequest.onBehalfOf?: EvmAddress- Supply on behalf of another address (optional)
Returns:
state.loading: boolean- Loading statestate.error: E | undefined- Error executing the transactionstate.called: boolean- Whether the hook has been calledstate.data: TransactionReceipt | undefined- Transaction receiptresult: Result<TransactionReceipt, E>- Type-safe success or failure value:Ok<TransactionReceipt>- Transaction receiptErr<E>- Error executing the transaction
Where E is one of:
SendTransactionErrorCancelErrorTimeoutErrorTransactionErrorValidationError<InsufficientBalanceError>
useSupplyApyHistory#
Declarative hook to fetch supply APY history for a specific reserve over time.
Arguments:
request.spoke.address: EvmAddress- Spoke contract addressrequest.spoke.chainId: ChainId- Chain IDrequest.reserve: ReserveId- Reserve IDrequest.window: TimeWindow- Time window for historical datapause?: boolean- Pause the query (default: false)
Returns:
data: ApySample[] | undefined- Array of historical APY data pointsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the supply APY history
useUpdateUserPositionConditions#
Imperative transaction hook to update a user's position conditions (dynamic config and/or risk premium).
import { useUpdateUserPositionConditions, UserPositionConditionsUpdate,} from "@aave/react";
const [execute, state] = useUpdateUserPositionConditions((transaction) => sendTransaction(transaction),);
const result = await execute({ userPositionId: userPosition.id, update: UserPositionConditionsUpdate.AllDynamicConfig,});Arguments:
request.userPositionId: UserPositionId- User position identifierrequest.update: UserPositionConditionsUpdate- Type of update to perform:UserPositionConditionsUpdate.JustRiskPremium- Update only the risk premiumUserPositionConditionsUpdate.AllDynamicConfig- Update all dynamic config (includes risk premium)
Returns:
state.loading: boolean- Loading statestate.error: E | undefined- Error executing the transactionstate.called: boolean- Whether the hook has been calledstate.data: TransactionReceipt | undefined- Transaction receiptresult: Result<TransactionReceipt, E>- Type-safe success or failure value:Ok<TransactionReceipt>- Transaction receiptErr<E>- Error executing the transaction
Where E is one of:
SendTransactionErrorCancelErrorTimeoutErrorTransactionErrorUnexpectedError
useUserBalances#
Declarative hook to fetch user wallet balances across specified chains.
Arguments:
request.user: EvmAddress- User addressrequest.filter: UserBalancesRequestFilterone of:chains: UserBalancesByChains- Balances on specified chainschainIds: ChainId[]- Chain IDs to querybyReservesType: ReservesRequestFilter- Reserve type filter (default: ALL)
hub: UserBalancesByHub- Balances for hub assetsaddress: EvmAddress- Hub addresschainId: ChainId- Hub chain IDbyReservesType: ReservesRequestFilter- Reserve type filter (default: ALL)
spoke: UserBalancesBySpoke- Balances for spoke reservesaddress: EvmAddress- Spoke addresschainId: ChainId- Spoke chain IDbyReservesType: ReservesRequestFilter- Reserve type filter (default: ALL)
userPosition: UserBalancesByUserPosition- Balances for user positionuserPositionId: UserPositionId- User position IDbyReservesType: ReservesRequestFilter- Reserve type filter (default: ALL)
request.orderBy?: UserBalancesRequestOrderByone of:name: OrderDirection- Sort by token namebalance: OrderDirection- Sort by balance
request.includeZeroBalances?: boolean- Include zero balances (default: false)request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: UserBalance[] | undefined- Array of user wallet balancesloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching user balances
useUserBalancesAction#
Imperative hook to fetch user wallet balances.
import { useUserBalancesAction } from "@aave/react";
const [execute, state] = useUserBalancesAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)
Arguments:
request.user: EvmAddress- User addressrequest.filter: UserBalancesRequestFilterone of:chains: UserBalancesByChains- Balances on specified chainschainIds: ChainId[]- Chain IDs to querybyReservesType: ReservesRequestFilter- Reserve type filter (default: ALL)
hub: UserBalancesByHub- Balances for hub assetsaddress: EvmAddress- Hub addresschainId: ChainId- Hub chain IDbyReservesType: ReservesRequestFilter- Reserve type filter (default: ALL)
spoke: UserBalancesBySpoke- Balances for spoke reservesaddress: EvmAddress- Spoke addresschainId: ChainId- Spoke chain IDbyReservesType: ReservesRequestFilter- Reserve type filter (default: ALL)
userPosition: UserBalancesByUserPosition- Balances for user positionuserPositionId: UserPositionId- User position IDbyReservesType: ReservesRequestFilter- Reserve type filter (default: ALL)
tokens: UserBalancesByTokens- Balances for specific tokenschainTokens: ChainTokenInput[]- Array of chain-token pairschainId: ChainId- Chain IDtoken: TokenInputone of:native: AlwaysTrue- Native tokenerc20: EvmAddress- ERC20 token address
byReservesType?: ReservesRequestFilter- Reserve type filter (default: ALL)
request.orderBy?: UserBalancesRequestOrderByone of:name: OrderDirection- Sort by token namebalance: OrderDirection- Sort by balance
request.includeZeroBalances?: boolean- Include zero balances (default: false)
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching user balancesstate.called: boolean- Whether the hook has been calledstate.data: UserBalance[] | undefined- Array of user wallet balancesresult: Result<UserBalance[], UnexpectedError>- Type-safe success or failure value:Ok<UserBalance[]>- Array of user wallet balancesErr<UnexpectedError>- Error fetching user balances
useUserBorrows#
Declarative hook to fetch all user borrow positions.
Arguments:
request.query: UserBorrowsRequestQueryone of:userSpoke: UserSpokeInput- Get borrows for user on spokespoke: SpokeId- Spoke IDuser: EvmAddress- User address
userToken: UserToken- Get borrows for user for tokenuser: EvmAddress- User addresstoken: Erc20Input- Token inputaddress: EvmAddress- Token contract addresschainId: ChainId- Token chain ID
userPositionId: UserPositionId- Get borrows for user positionuserChains: UserChains- Get borrows for user across chainsuser: EvmAddress- User addresschainIds: [ChainId!]- Chain IDs
userHub: UserHub- Get borrows for user on hubuser: EvmAddress- User addresshub: UserHubInput- Hub input (hub ID or hub details)
request.orderBy?: UserBorrowsRequestOrderByone of:assetName: OrderDirection- Sort by asset namecreated: OrderDirection- Sort by creation dateamount: OrderDirection- Sort by borrow amountapy: OrderDirection- Sort by APY
request.includeZeroBalances?: boolean- Include zero balances (default: false)request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: UserBorrowItem[] | undefined- Array of user borrow positionsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching user borrows
useUserBorrowsAction#
Imperative hook to fetch user borrow positions.
import { useUserBorrowsAction } from "@aave/react";
const [execute, state] = useUserBorrowsAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)
Arguments:
request.query: UserBorrowsRequestQueryone of:userSpoke: UserSpokeInput- Get borrows for user on a spokespoke: SpokeId- Spoke IDuser: EvmAddress- User address
userToken: UserToken- Get borrows for user for a specific tokenuser: EvmAddress- User addresstoken: Erc20Input- Token inputaddress: EvmAddress- Token contract addresschainId: ChainId- Token chain ID
userPositionId: UserPositionId- Get borrows for a user positionuserChains: UserChains- Get borrows for user across chainsuser: EvmAddress- User addresschainIds: [ChainId!]- Chain IDs
userHub: UserHub- Get borrows for user on hubuser: EvmAddress- User addresshub: UserHubInput- Hub input (hub ID or hub details)
request.orderBy?: UserBorrowsRequestOrderByone of:assetName: OrderDirection- Sort by asset namecreated: OrderDirection- Sort by creation dateamount: OrderDirection- Sort by borrow amountapy: OrderDirection- Sort by APY
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching user borrowsstate.called: boolean- Whether the hook has been calledstate.data: UserBorrowItem[] | undefined- Array of user borrow positionsresult: Result<UserBorrowItem[], UnexpectedError>- Type-safe success or failure value:Ok<UserBorrowItem[]>- Array of user borrow positionsErr<UnexpectedError>- Error fetching user borrows
useUserClaimableRewards#
Declarative hook to fetch all claimable rewards for a user on a specific chain.
Arguments:
request.user: EvmAddress- User addressrequest.chainId: ChainId- Chain IDpause?: boolean- Pause the query (default: false)
Returns:
data: UserClaimableReward[] | undefined- Claimable rewardsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the rewards
useUserClaimableRewardsAction#
Imperative hook to fetch a user's claimable rewards on demand. Does not watch for updated data; use it to retrieve data as part of a larger workflow.
import { useUserClaimableRewardsAction } from "@aave/react";
const [execute, state] = useUserClaimableRewardsAction();
const result = await execute(request);Arguments:
request.user: EvmAddress- User addressrequest.chainId: ChainId- Chain ID
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching the rewardsstate.called: boolean- Whether the hook has been calledstate.data: UserClaimableReward[] | undefined- Claimable rewardsresult: Result<UserClaimableReward[], UnexpectedError>- Type-safe success or failure value:Ok<UserClaimableReward[]>- Claimable rewardsErr<UnexpectedError>- Error fetching the rewards
useUserPosition#
Declarative hook to fetch a specific user position by ID.
Arguments:
request.id: UserPositionId- Unique position identifierrequest.user: EvmAddress- User addressrequest.currency?: Currency- Currency for value conversions (optional)request.timeWindow?: TimeWindow- Time window for historical data (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: UserPosition | null | undefined- User position or null if not foundloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the user position
useUserPositions#
Declarative hook to fetch all user positions across specified chains.
Arguments:
request.user: EvmAddress- User addressrequest.filter: UserPositionsRequestFilterone of:tokens: [Erc20Input!]- Filter by tokensaddress: EvmAddress- Token contract addresschainId: ChainId- Token chain ID
chainIds: [ChainId!]- Filter by chain IDs
request.orderBy?: UserPositionsRequestOrderByone of:created: OrderDirection- Sort by creation datebalance: OrderDirection- Sort by position balancenetApy: OrderDirection- Sort by net APYhealthFactor: OrderDirection- Sort by health factornetCollateral: OrderDirection- Sort by net collateral
request.currency?: Currency- Currency for value conversions (optional)request.timeWindow?: TimeWindow- Time window for historical data (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: UserPosition[] | undefined- Array of user positionsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching user positions
useUserPositionsAction#
Imperative hook to fetch user positions.
import { useUserPositionsAction } from "@aave/react";
const [execute, state] = useUserPositionsAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)options.timeWindow?: TimeWindow- Time window for historical data (optional)
Arguments:
request.user: EvmAddress- User addressrequest.filter: UserPositionsRequestFilterone of:tokens: [Erc20Input!]- Filter by tokensaddress: EvmAddress- Token contract addresschainId: ChainId- Token chain ID
chainIds: [ChainId!]- Filter by chain IDs
request.orderBy?: UserPositionsRequestOrderByone of:created: OrderDirection- Sort by creation datebalance: OrderDirection- Sort by position balancenetApy: OrderDirection- Sort by net APYhealthFactor: OrderDirection- Sort by health factornetCollateral: OrderDirection- Sort by net collateral
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching user positionsstate.called: boolean- Whether the hook has been calledstate.data: UserPosition[] | undefined- Array of user positionsresult: Result<UserPosition[], UnexpectedError>- Type-safe success or failure value:Ok<UserPosition[]>- Array of user positionsErr<UnexpectedError>- Error fetching user positions
Declarative hook to fetch the risk premium breakdown for a user position or spoke.
Arguments:
request.user: EvmAddress- User addressrequest.query: UserRiskPremiumBreakdownRequestQueryone of:userPositionId: UserPositionId- Get breakdown for user positionuserSpoke: UserSpokeInput- Get breakdown for user on spokeuser: EvmAddress- User addressspoke: SpokeId- Spoke ID
pause?: boolean- Pause the query (default: false)
Returns:
data: UserRiskPremiumBreakdownItem[] | undefined- Array of risk premium breakdown itemsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the risk premium breakdown
useUserSupplies#
Declarative hook to fetch all user supply positions.
Arguments:
request.query: UserSuppliesRequestQueryone of:userSpoke: UserSpokeInput- Get supplies for user on spokespoke: SpokeId- Spoke IDuser: EvmAddress- User address
userToken: UserToken- Get supplies for user for tokenuser: EvmAddress- User addresstoken: Erc20Input- Token inputaddress: EvmAddress- Token contract addresschainId: ChainId- Token chain ID
userPositionId: UserPositionId- Get supplies for user positionuserChains: UserChains- Get supplies for user across chainsuser: EvmAddress- User addresschainIds: [ChainId!]- Chain IDs
userHub: UserHub- Get supplies for user on hubuser: EvmAddress- User addresshub: UserHubInput- Hub input (hub ID or hub details)
request.orderBy?: UserSuppliesRequestOrderByone of:assetName: OrderDirection- Sort by asset namecreated: OrderDirection- Sort by creation dateamount: OrderDirection- Sort by supply amountapy: OrderDirection- Sort by APY
request.includeZeroBalances?: boolean- Include zero balances (default: false)request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: UserSupplyItem[] | undefined- Array of user supply positionsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching user supplies
useUserSuppliesAction#
Imperative hook to fetch user supply positions.
import { useUserSuppliesAction } from "@aave/react";
const [execute, state] = useUserSuppliesAction(options);
const result = await execute(request);Options:
options.currency?: Currency- Currency for value conversions (default: USD)
Arguments:
request.query: UserSuppliesRequestQueryone of:userSpoke: UserSpokeInput- Get supplies for user on a spokespoke: SpokeId- Spoke IDuser: EvmAddress- User address
userToken: UserToken- Get supplies for user for a specific tokenuser: EvmAddress- User addresstoken: Erc20Input- Token inputaddress: EvmAddress- Token contract addresschainId: ChainId- Token chain ID
userPositionId: UserPositionId- Get supplies for a user positionuserChains: UserChains- Get supplies for user across chainsuser: EvmAddress- User addresschainIds: [ChainId!]- Chain IDs
userHub: UserHub- Get supplies for user on hubuser: EvmAddress- User addresshub: UserHubInput- Hub input (hub ID or hub details)
request.orderBy?: UserSuppliesRequestOrderByone of:assetName: OrderDirection- Sort by asset namecreated: OrderDirection- Sort by creation dateamount: OrderDirection- Sort by supply amountapy: OrderDirection- Sort by APY
Returns:
state.loading: boolean- Loading statestate.error: UnexpectedError | undefined- Error fetching user suppliesstate.called: boolean- Whether the hook has been calledstate.data: UserSupplyItem[] | undefined- Array of user supply positionsresult: Result<UserSupplyItem[], UnexpectedError>- Type-safe success or failure value:Ok<UserSupplyItem[]>- Array of user supply positionsErr<UnexpectedError>- Error fetching user supplies
useUserSummary#
Declarative hook to fetch a user's financial summary.
Arguments:
request.user: EvmAddress- User addressrequest.filter?.spoke.address: EvmAddress- Filter by spoke address (optional)request.filter?.spoke.chainId: ChainId- Filter by chain ID (optional)request.currency?: Currency- Currency for value conversions (optional)request.timeWindow?: TimeWindow- Time window for historical data (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: UserSummary | undefined- Aggregated metrics including total collateral, total debt, health factor, etc.loading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the user summary
useUserSummaryHistory#
Declarative hook to fetch user summary history over time.
Arguments:
request.user: EvmAddress- User addressrequest.window: TimeWindow- Time window for historical datarequest.filter?.chainIds: ChainId[]- Filter by specific chain IDs (optional)request.currency?: Currency- Currency for value conversions (optional)pause?: boolean- Pause the query (default: false)
Returns:
data: UserSummaryHistoryItem[] | undefined- Array of historical user summary data pointsloading: boolean- Loading stateerror: UnexpectedError | undefined- Error fetching the user summary history
useWithdraw#
Imperative transaction hook to withdraw supplied assets.
import { useWithdraw } from "@aave/react";
const [execute, state] = useWithdraw((plan) => { switch (plan.__typename) { case "TransactionRequest": return sendTransaction(plan); case "PreContractActionRequired": return sendTransaction(plan.transaction); }});
const result = await execute(request);Arguments:
request.chainId: ChainId- Chain IDrequest.reserve: EvmAddress- Reserve addressrequest.amount: BigDecimal- Amount to withdrawrequest.to?: EvmAddress- Recipient address (optional, defaults to caller)
Returns:
state.loading: boolean- Loading statestate.error: E | undefined- Error executing the transactionstate.called: boolean- Whether the hook has been calledstate.data: TransactionReceipt | undefined- Transaction receiptresult: Result<TransactionReceipt, E>- Type-safe success or failure value:Ok<TransactionReceipt>- Transaction receiptErr<E>- Error executing the transaction
Where E is one of:
SendTransactionErrorCancelErrorTimeoutErrorTransactionErrorUnexpectedErrorValidationError<InsufficientBalanceError>