Multi-protocol portfolio snapshot
Fetch a wallet’s positions across all protocols in a single request. Each protocol returns its own typed response — use inline fragments to select the fields you need.Copy
Ask AI
query {
walletPositions(inputs: [
{ protocol: "morpho", chainId: 1, walletAddress: "0x..." }
{ protocol: "aave", chainId: 1, walletAddress: "0x..." }
{ protocol: "pendle", chainId: 1, walletAddress: "0x..." }
{ protocol: "fluid", chainId: 1, walletAddress: "0x..." }
{ protocol: "compound", chainId: 1, walletAddress: "0x..." }
{ protocol: "neutrl", chainId: 1, walletAddress: "0x..." }
{ protocol: "avantis", chainId: 8453, walletAddress: "0x..." }
{ protocol: "avant", chainId: 43114, walletAddress: "0x..." }
{ protocol: "midas", chainId: 1, walletAddress: "0x..." }
]) {
data {
... on MorphoWalletPositions { protocol chainId walletAddress }
... on AaveWalletPositions { protocol chainId walletAddress }
... on PendleWalletPositions { protocol chainId walletAddress }
... on FluidWalletPositions { protocol chainId walletAddress }
... on CompoundWalletPositions { protocol chainId walletAddress }
... on NeutrlWalletPositions { protocol chainId walletAddress }
... on AvantisWalletPositions { protocol chainId walletAddress }
... on AvantWalletPositions { protocol chainId walletAddress }
... on MidasWalletPositions { protocol chainId walletAddress }
}
errors {
protocol chainId walletAddress
error { code message retryable }
}
}
}
Maximum 5 inputs per request. Split larger queries across multiple requests.
Vault yield comparison
Compare yields across vault-style protocols by querying positions with APY fields:Copy
Ask AI
query {
walletPositions(inputs: [
{ protocol: "morpho", chainId: 1, walletAddress: "0x..." }
{ protocol: "neutrl", chainId: 1, walletAddress: "0x..." }
{ protocol: "avantis", chainId: 8453, walletAddress: "0x..." }
{ protocol: "avant", chainId: 43114, walletAddress: "0x..." }
]) {
data {
... on MorphoWalletPositions {
protocol
vaultV2Positions { vaultName assetsUsd apy }
}
... on NeutrlWalletPositions {
protocol
vaultPosition { balanceUsd apy }
}
... on AvantisWalletPositions {
protocol
vaultPosition { balanceUsd apy }
}
... on AvantWalletPositions {
protocol
vaultPosition { balanceUsd apy }
}
}
errors { protocol error { code message } }
}
}
APY format varies by protocol. Most return decimals (e.g.,
0.0485 = 4.85%). Fluid returns percentages directly (e.g., 4.85 = 4.85%). See Protocols Overview for details.Lending & borrowing summary
Get supply/borrow positions with health metrics from lending protocols:Copy
Ask AI
query {
walletPositions(inputs: [
{ protocol: "aave", chainId: 1, walletAddress: "0x..." }
{ protocol: "compound", chainId: 1, walletAddress: "0x..." }
{ protocol: "morpho", chainId: 1, walletAddress: "0x..." }
]) {
data {
... on AaveWalletPositions {
protocol
marketStates { netWorth healthFactor totalCollateralBase totalDebtBase }
supplyPositions { currency { symbol } balanceUsd apy { formatted } isCollateral }
borrowPositions { currency { symbol } debtUsd apy { formatted } }
}
... on CompoundWalletPositions {
protocol
supplyPositions { baseAsset { symbol } balanceUsd apr }
borrowPositions { baseAsset { symbol } debtUsd apr }
collateralPositions { asset { symbol } balanceUsd }
rewardPositions { rewardToken { symbol } accruedUsd }
}
... on MorphoWalletPositions {
protocol
marketPositions {
loanAsset { symbol }
collateralAsset { symbol }
supply { assetsUsd }
borrow { assetsUsd }
marketMetrics { supplyApy borrowApy lltv utilization }
}
}
}
errors { protocol error { code message } }
}
}
Cross-chain positions for one protocol
Check a wallet’s Aave positions across all supported chains:Copy
Ask AI
query {
walletPositions(inputs: [
{ protocol: "aave", chainId: 1, walletAddress: "0x..." }
{ protocol: "aave", chainId: 8453, walletAddress: "0x..." }
{ protocol: "aave", chainId: 42161, walletAddress: "0x..." }
{ protocol: "aave", chainId: 10, walletAddress: "0x..." }
{ protocol: "aave", chainId: 43114, walletAddress: "0x..." }
]) {
data {
... on AaveWalletPositions {
protocol
chainId
marketStates { marketName netWorth healthFactor }
supplyPositions { currency { symbol } balanceUsd }
borrowPositions { currency { symbol } debtUsd }
}
}
errors { protocol chainId error { code message retryable } }
}
}
Pool & market data
Fetch pool-level details for specific vaults or markets. Thedata field is a JSON string — parse it to access the typed object.
- Morpho vault
- Morpho market
- Pendle market
- Aave market
Pass a vault address (42 characters) to get vault pool data:Parsed
Copy
Ask AI
query {
poolDetails(inputs: [
{ protocol: "morpho", chainId: 1, poolAddress: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb" }
]) {
data { protocol chainId poolAddress data }
errors { protocol error { code message } }
}
}
data field:Copy
Ask AI
{
"type": "morpho-vault-pool",
"name": "Morpho Blue USDC",
"symbol": "mbUSDC",
"apy": 0.072,
"netApy": 0.068,
"totalAssetsUsd": 52000000.0
}
Pass a market unique key (66 characters) to get market pool data:Parsed
Copy
Ask AI
query {
poolDetails(inputs: [
{ protocol: "morpho", chainId: 1, poolAddress: "0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc" }
]) {
data { protocol chainId poolAddress data }
errors { protocol error { code message } }
}
}
data field:Copy
Ask AI
{
"type": "morpho-market-pool",
"loanAsset": { "symbol": "USDC" },
"collateralAsset": { "symbol": "WETH" },
"metrics": {
"supplyApy": 0.042,
"borrowApy": 0.058,
"utilization": 0.72
},
"lltv": 0.86
}
Copy
Ask AI
query {
poolDetails(inputs: [
{ protocol: "pendle", chainId: 1, poolAddress: "0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2" }
]) {
data { protocol chainId poolAddress data }
errors { protocol error { code message } }
}
}
data field:Copy
Ask AI
{
"type": "pendle-market-pool",
"name": "stETH 26DEC2025",
"expiry": "2025-12-26T00:00:00Z",
"impliedApy": 0.038,
"underlyingApy": 0.034,
"liquidity": 45000000.0,
"totalTvl": 120000000.0
}
Copy
Ask AI
query {
poolDetails(inputs: [
{ protocol: "aave", chainId: 1, poolAddress: "0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e" }
]) {
data { protocol chainId poolAddress data }
errors { protocol error { code message } }
}
}
data field:Copy
Ask AI
{
"type": "aave-market-pool",
"marketName": "Aave V3 Ethereum",
"totalMarketSize": 28534000000.0,
"totalAvailableLiquidity": 12890000000.0,
"reserves": [
{
"underlyingToken": { "symbol": "WETH" },
"supplyApy": 0.0198,
"borrowApy": 0.0285,
"sizeUsd": 7722750000.0
}
]
}
The
data field in poolDetails responses is a JSON string. Parse it with JSON.parse() before accessing its properties.Handling partial failures
When one protocol fails, the others still return data. Always check bothdata and errors:
Copy
Ask AI
const response = await fetch("https://api.definitiv.io/graphql", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "pk_your_api_key_here"
},
body: JSON.stringify({
query: `{
walletPositions(inputs: [
{ protocol: "morpho", chainId: 1, walletAddress: "0x..." }
{ protocol: "aave", chainId: 1, walletAddress: "0x..." }
]) {
data {
... on MorphoWalletPositions { protocol vaultV2Positions { vaultName assetsUsd } }
... on AaveWalletPositions { protocol supplyPositions { currency { symbol } balanceUsd } }
}
errors { protocol error { code message retryable } }
}
}`
})
});
const { data } = await response.json();
const { data: positions, errors } = data.walletPositions;
// Process successful results
for (const position of positions) {
console.log(`${position.protocol}: OK`);
}
// Handle failures
for (const err of errors) {
if (err.error.retryable) {
console.log(`${err.protocol}: failed (retryable) — ${err.error.message}`);
} else {
console.log(`${err.protocol}: failed — ${err.error.message}`);
}
}