The Graph Queries: ENS, Uniswap, Aave & More
Access indexed blockchain data through The Graph subgraphs. Query ENS registrations, Uniswap pools, Aave markets, and Lido staking stats.
Overview
The Graph indexes blockchain data and makes it queryable via GraphQL. We provide pre-built endpoints for popular subgraphs:
- ENS - Domain registrations, transfers, ownership
- Uniswap V3 - Pools, swaps, liquidity, stats
- Aave V3 - Lending markets, rates, utilization
- Lido - Staking stats, submissions
All endpoints are prefixed with /api/graph/.
Prerequisites
npm install @atv-eth/x402-sdk
# or use curl/fetch directly
ENS Subgraph
Recent Registrations
const registrations = await fetch('https://api.web3identity.com/api/graph/ens/registrations?limit=25');
const data = await registrations.json();
console.log('Recent ENS Registrations:');
data.registrations.forEach(r => {
console.log(` ${r.name}`);
console.log(` Registrant: ${r.registrant?.slice(0, 10)}...`);
console.log(` Registered: ${r.registrationDate}`);
console.log(` Expires: ${r.expiryDate}`);
});
Response:
{
"registrations": [
{
"name": "coolname.eth",
"label": "coolname",
"registrant": "0x1234567890abcdef...",
"registrationDate": "2026-02-09T08:00:00.000Z",
"expiryDate": "2027-02-09T08:00:00.000Z",
"cost": "5000000000000000000"
}
],
"count": 25,
"source": "thegraph/ens",
"timestamp": "2026-02-09T08:30:00.000Z"
}
Domain Lookup
const name = 'vitalik.eth';
const domain = await fetch(`https://api.web3identity.com/api/graph/ens/domain/${name}`);
const data = await domain.json();
console.log(`Domain: ${data.name}`);
console.log(`Owner: ${data.owner}`);
console.log(`Resolver: ${data.resolver}`);
console.log(`Created: ${data.createdAt}`);
console.log(`Expires: ${data.expiryDate}`);
console.log(`Subdomains: ${data.subdomainCount}`);
Recent Transfers
const transfers = await fetch('https://api.web3identity.com/api/graph/ens/transfers?limit=25');
const data = await transfers.json();
console.log('Recent ENS Transfers:');
data.transfers.forEach(t => {
console.log(` ${t.name} → ${t.newOwner?.slice(0, 10)}...`);
console.log(` Block: ${t.blockNumber}, TX: ${t.txHash?.slice(0, 16)}...`);
});
Domains by Owner
const owner = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045';
const domains = await fetch(`https://api.web3identity.com/api/graph/ens/owner/${owner}?limit=50`);
const data = await domains.json();
console.log(`Domains owned by ${data.owner?.slice(0, 10)}...:`);
data.domains.forEach(d => {
console.log(` ${d.name}`);
console.log(` Created: ${d.createdAt}, Expires: ${d.expiryDate}`);
});
Uniswap V3 Subgraph
Top Pools by TVL
const pools = await fetch('https://api.web3identity.com/api/graph/uniswap/pools?limit=20');
const data = await pools.json();
console.log('Top Uniswap V3 Pools by TVL:');
data.pools.forEach((pool, i) => {
console.log(`${i + 1}. ${pool.pair}`);
console.log(` Address: ${pool.address?.slice(0, 10)}...`);
console.log(` Fee: ${pool.feeTier}`);
console.log(` TVL: $${pool.tvlUsd?.toLocaleString()}`);
console.log(` Volume: $${pool.volumeUsd?.toLocaleString()}`);
});
Response:
{
"pools": [
{
"address": "0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8",
"pair": "USDC/ETH",
"token0": "USDC",
"token1": "ETH",
"feeTier": "0.3%",
"tvlUsd": 456789012.34,
"volumeUsd": 12345678901.23,
"txCount": 5678901
}
],
"count": 20,
"source": "thegraph/uniswap-v3",
"timestamp": "2026-02-09T08:30:00.000Z"
}
Pool Details
const poolAddress = '0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8';
const pool = await fetch(`https://api.web3identity.com/api/graph/uniswap/pool/${poolAddress}`);
const data = await pool.json();
console.log(`Pool: ${data.token0.symbol}/${data.token1.symbol}`);
console.log(`Fee Tier: ${data.feeTier}`);
console.log(`TVL: $${data.tvlUsd?.toLocaleString()}`);
console.log(`Total Volume: $${data.volumeUsd?.toLocaleString()}`);
console.log(`Total Transactions: ${data.txCount?.toLocaleString()}`);
console.log(`Created: ${data.createdAt}`);
Recent Swaps
const swaps = await fetch('https://api.web3identity.com/api/graph/uniswap/swaps?limit=25');
const data = await swaps.json();
console.log('Recent Uniswap Swaps:');
data.swaps.forEach(swap => {
console.log(` ${swap.pair}: $${swap.amountUsd?.toFixed(2)}`);
console.log(` Sender: ${swap.sender?.slice(0, 10)}...`);
console.log(` Time: ${swap.timestamp}`);
});
Uniswap Protocol Stats
const stats = await fetch('https://api.web3identity.com/api/graph/uniswap/stats');
const data = await stats.json();
console.log('Uniswap V3 Protocol Stats:');
console.log(` Total Pools: ${data.poolCount?.toLocaleString()}`);
console.log(` Total Transactions: ${data.txCount?.toLocaleString()}`);
console.log(` Total Volume: $${data.totalVolumeUsd?.toLocaleString()}`);
console.log(` Total TVL: $${data.tvlUsd?.toLocaleString()}`);
Aave V3 Subgraph
Lending Markets
const markets = await fetch('https://api.web3identity.com/api/graph/aave/markets?limit=25');
const data = await markets.json();
console.log('Aave V3 Markets:');
data.markets.forEach(market => {
console.log(`\n${market.symbol} (${market.name})`);
console.log(` Supply APY: ${(market.supplyApy * 100).toFixed(2)}%`);
console.log(` Borrow APY: ${(market.borrowApy * 100).toFixed(2)}%`);
console.log(` Utilization: ${(market.utilization * 100).toFixed(1)}%`);
console.log(` Total Liquidity: ${market.totalLiquidity}`);
console.log(` Total Borrowed: ${market.totalBorrowed}`);
});
Response:
{
"markets": [
{
"id": "0x...",
"name": "Wrapped Ether",
"symbol": "WETH",
"totalLiquidity": "1234567890000000000000",
"availableLiquidity": "987654321000000000000",
"totalBorrowed": "246913579000000000000",
"supplyApy": 0.0234,
"borrowApy": 0.0456,
"utilization": 0.20
}
],
"count": 25,
"source": "thegraph/aave-v3",
"timestamp": "2026-02-09T08:30:00.000Z"
}
Lido Subgraph
Staking Stats
const stats = await fetch('https://api.web3identity.com/api/graph/lido/stats');
const data = await stats.json();
console.log('Lido Staking Stats:');
console.log(` Total Pooled ETH: ${data.totalPooledEther}`);
console.log(` Total Shares: ${data.totalShares}`);
if (data.latestSubmission) {
console.log(`\nLatest Submission:`);
console.log(` Sender: ${data.latestSubmission.sender}`);
console.log(` Amount: ${data.latestSubmission.amount}`);
console.log(` Block: ${data.latestSubmission.block}`);
}
Custom Queries
Query Any Subgraph
For advanced users, you can run custom GraphQL queries:
const query = `{
domains(first: 10, where: {name_contains: "vitalik"}) {
name
owner {
id
}
}
}`;
const response = await fetch('https://api.web3identity.com/api/graph/query/ens', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query })
});
const data = await response.json();
console.log('Custom query results:', data.data);
List Available Subgraphs
const subgraphs = await fetch('https://api.web3identity.com/api/graph/subgraphs');
const data = await subgraphs.json();
console.log('Available Subgraphs:');
data.subgraphs.forEach(sg => {
console.log(` ${sg.name}: ${sg.endpoint}`);
});
Available subgraphs:
ens- ENS domainsuniswapV3- Uniswap V3aaveV3- Aave V3lido- Lido stakingcompound- Compound V2
Building an ENS Activity Monitor
async function getENSActivity(limit = 20) {
const [registrations, transfers] = await Promise.all([
fetch(`https://api.web3identity.com/api/graph/ens/registrations?limit=${limit}`).then(r => r.json()),
fetch(`https://api.web3identity.com/api/graph/ens/transfers?limit=${limit}`).then(r => r.json())
]);
const activity = [];
registrations.registrations.forEach(r => {
activity.push({
type: 'registration',
name: r.name,
actor: r.registrant,
timestamp: new Date(r.registrationDate).getTime()
});
});
transfers.transfers.forEach(t => {
activity.push({
type: 'transfer',
name: t.name,
actor: t.newOwner,
timestamp: parseInt(t.blockNumber) // Approximate
});
});
// Sort by timestamp descending
activity.sort((a, b) => b.timestamp - a.timestamp);
return activity.slice(0, limit);
}
// Usage
const activity = await getENSActivity(25);
activity.forEach(a => {
console.log(`[${a.type.toUpperCase()}] ${a.name}`);
});
Building a DeFi Dashboard
async function getDeFiOverview() {
const [uniswapStats, aaveMarkets, lidoStats] = await Promise.all([
fetch('https://api.web3identity.com/api/graph/uniswap/stats').then(r => r.json()),
fetch('https://api.web3identity.com/api/graph/aave/markets?limit=10').then(r => r.json()),
fetch('https://api.web3identity.com/api/graph/lido/stats').then(r => r.json())
]);
return {
uniswap: {
tvl: uniswapStats.tvlUsd,
totalVolume: uniswapStats.totalVolumeUsd,
pools: uniswapStats.poolCount
},
aave: {
markets: aaveMarkets.markets?.slice(0, 5).map(m => ({
symbol: m.symbol,
supplyApy: (m.supplyApy * 100).toFixed(2) + '%',
borrowApy: (m.borrowApy * 100).toFixed(2) + '%'
}))
},
lido: {
totalStaked: lidoStats.totalPooledEther
},
timestamp: new Date().toISOString()
};
}
// Usage
const overview = await getDeFiOverview();
console.log(JSON.stringify(overview, null, 2));
Endpoint Reference
| Endpoint | Description | Price |
|---|---|---|
/api/graph/ens/registrations | Recent ENS registrations | $0.01 |
/api/graph/ens/domain/:name | Domain details | $0.01 |
/api/graph/ens/transfers | Recent transfers | $0.01 |
/api/graph/ens/owner/:address | Domains by owner | $0.01 |
/api/graph/uniswap/pools | Top pools by TVL | $0.01 |
/api/graph/uniswap/pool/:address | Pool details | $0.01 |
/api/graph/uniswap/swaps | Recent swaps | $0.01 |
/api/graph/uniswap/stats | Protocol stats | $0.01 |
/api/graph/aave/markets | Lending markets | $0.01 |
/api/graph/lido/stats | Staking stats | $0.01 |
POST /api/graph/query/:subgraph | Custom query | $0.02 |
/api/graph/subgraphs | List subgraphs | Free |
Important Notes
Data Freshness
The Graph indexes data with some delay:
- Decentralized network (Uniswap, Aave): ~1-5 minutes
- Hosted service (ENS, Lido): ~10-30 seconds
- For real-time data, use RPC endpoints directly
Pagination
Use the limit query parameter (max 100):
// First page
const page1 = await fetch('/api/graph/ens/registrations?limit=50');
// For more data, use custom queries with skip
const query = `{
registrations(first: 50, skip: 50, orderBy: registrationDate, orderDirection: desc) {
...
}
}`;
Rate Limits
- Free tier: 100 calls/day
- Cache TTL: 60 seconds for most endpoints
- Custom queries may have stricter limits
Next Steps
- Bitcoin Deep Dive - Bitcoin blockchain data
- Etherscan Tools - Contract and transaction data
- Farcaster Channels - Social discovery