User Positions
Monitor user positions and account health across Aave markets.
User Positions
Track user supplied and borrowed assets across Aave markets.
- React
- TypeScript
- GraphQL
Use the useUserSupplies and useUserBorrows hooks to fetch user supplied and borrowed assets.
Fetch user positions across one or more markets.
Account Health
Monitor user account health and risk metrics across Aave positions.
The health factor is calculated only when a user has at least one active borrow position. If the user has no positions or only supply positions, the health factor will be null.
- React
- TypeScript
- GraphQL
Use the useUserMarketState hook to fetch user account health and market state.
Monitor account health for a specific market.
User Market State
import { useUserMarketState, evmAddress, chainId } from "@aave/react";
// …
const { data, loading, error } = useUserMarketState({ market: evmAddress("0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2"), user: evmAddress("0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234"), chainId: chainId(1),});
if (loading) { return <p>Loading account health...</p>;}
if (error) { return <p>Error: {error.message}</p>;}
return ( <div> <p>Health Factor: {data.healthFactor}</p> <p>Net Worth: {data.netWorth}</p> <p>eMode Enabled: {data.eModeEnabled}</p> </div>);