| name | peer-market |
| description | Query ZKP2P market intelligence — spreads, volume, liquidity, LP performance, and orderbook data via Peerlytics API and protocol indexer. Use when the user wants market data, spread analysis, volume trends, LP rankings, or protocol analytics from ZKP2P. |
ZKP2P Market Intelligence Skill
Overview
Two complementary data sources provide full market intelligence for ZKP2P:
| Source | What It Provides | Access |
|---|
| Peerlytics | Aggregated analytics: spreads, volume trends, LP rankings, orderbook | x402 (USDC micropayment) or API key |
| ZKP2P Indexer | Raw on-chain state: deposits, intents, vault performance, rates | Open GraphQL endpoint |
Use Peerlytics for market-level insights (what spreads look like, who the top LPs are, where volume is flowing). Use the indexer for granular on-chain state (individual deposit configurations, intent histories, vault delegation details).
Peerlytics Setup
Install the SDK:
npm install @peerlytics/sdk
Access via API Key
import { Peerlytics } from '@peerlytics/sdk';
const client = new Peerlytics({
apiKey: 'YOUR_API_KEY',
});
Access via x402 (No API Key Required)
The x402 model lets agents pay per request with USDC on Base -- no registration, no API key provisioning.
- Agent makes API request without authentication
- Server responds with HTTP 402 + payment requirements (USDC amount, Base recipient address)
- Agent sends USDC microtransaction on Base
- Agent retries request with
X-Payment-Proof header containing the tx hash
- Server validates the on-chain payment and returns data
Cost per query: ~$0.001-0.01 USDC depending on endpoint complexity.
Market Summary (Spreads)
Query current market spread data by platform and currency:
const market = await client.getMarketSummary({
platform: ['venmo', 'wise', 'revolut'],
currency: ['USD', 'EUR'],
});
A rate of 1.02 means $1.02 fiat per $1.00 USDC -- the 2% is the LP's spread.
Analytics Period (Volume Trends)
Query volume and metrics for a time range:
const period = await client.getPeriod('mtd');
For time-series breakdowns (daily, hourly, flows, deposits):
const daily = await client.getChunk('mtd', 'daily');
LP Rankings (Leaderboard)
Query maker and taker leaderboards:
const leaderboard = await client.getLeaderboard({ limit: 20 });
Orderbook
Live liquidity is available at orderbook.peerlytics.xyz (web UI) and via the API. The orderbook is rate-level aggregated (not individual deposits):
const orderbook = await client.getOrderbook({
currency: 'USD',
platform: 'venmo',
minSize: 100,
});
Indexer Queries
The ZKP2P indexer exposes on-chain state via GraphQL.
Staging endpoint: https://indexer.hyperindex.xyz/00be13d/v1/graphql
Active Deposits with Rates
query ActiveDeposits {
Deposit(
where: { acceptingIntents: { _eq: true }, availableBalance_gt: "0" }
order_by: { availableBalance: desc }
limit: 50
) {
id
depositor
token
depositAmount
availableBalance
acceptingIntents
retainOnEmpty
intentAmountMin
intentAmountMax
rateManagerId
methodCurrencies {
paymentMethod
currencyCode
conversionRate
managerRate
isActive
}
}
}
Intent History and Fulfillment Stats
query IntentHistory($depositor: String!) {
Intent(
where: { deposit: { depositor: { _eq: $depositor } } }
order_by: { createdAt: desc }
limit: 100
) {
id
intentHash
amount
status
paymentMethod
fiatCurrency
conversionRate
createdAt
fulfilledAt
managerFee
managerFeeAmount
rateManagerId
}
}
Vault Performance
query VaultPerformance($rateManagerId: String!) {
ManagerAggregateStats(where: { rateManagerId: { _eq: $rateManagerId } }) {
totalFilledVolume
totalFeeAmount
totalPnlUsdCents
fulfilledIntents
currentDelegatedBalance
currentDelegatedDeposits
updatedAt
}
ManagerStats(
where: { rateManagerId: { _eq: $rateManagerId } }
order_by: { createdAt: desc }
limit: 20
) {
intentId
amount
spreadBps
pnlUsdCents
managerFee
managerFeeAmount
quoteConversionRate
marketRate
createdAt
}
}
Quote API
Get the best available rate for a given amount and platform combination. Uses @zkp2p/sdk:
import { OfframpClient } from '@zkp2p/sdk';
const client = new OfframpClient({ walletClient, chainId: 8453, runtimeEnv: 'production', apiKey: 'KEY' });
const quote = await client.getQuote({
paymentPlatforms: ['venmo', 'wise'],
fiatCurrency: 'USD',
amount: '100',
user: AGENT_WALLET,
recipient: AGENT_WALLET,
destinationChainId: 8453,
destinationToken: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
includeNearbyQuotes: true,
nearbyQuotesCount: 5,
});
Quote Parameters
| Parameter | Type | Required | Description |
|---|
paymentPlatforms | string[] | Yes | Platforms to consider (e.g., ['venmo', 'wise']) |
fiatCurrency | string | Yes | Fiat currency code (e.g., 'USD') |
amount | string | Yes | USDC amount to quote |
user | string | Yes | Requester's wallet address |
recipient | string | Yes | Token recipient address |
destinationChainId | number | Yes | Target chain (8453 = Base) |
destinationToken | string | Yes | Token address (USDC on Base) |
isExactFiat | boolean | No | If true, amount is in fiat units instead of USDC |
includeNearbyQuotes | boolean | No | Include alternative rates near the best |
nearbyQuotesCount | number | No | Number of nearby quotes (1-10, default 3) |
nearbySearchRange | number | No | Max percentage deviation for nearby quotes |
Access Patterns
x402 vs API Key
| Feature | x402 | API Key |
|---|
| Setup | None -- pay with USDC on Base | Register at peerlytics.xyz |
| Authentication | Payment proof in request header | X-API-Key header |
| Cost | Per-request (~$0.001-0.01 USDC) | Tiered subscription |
| Rate Limits | Based on payment | Based on tier |
| Best For | Agents, bots, permissionless access | Applications with predictable usage |
x402 Flow
- Agent makes API request without authentication
- Server responds with HTTP 402 + payment requirements (USDC amount, Base recipient address)
- Agent sends USDC microtransaction on Base
- Agent retries request with
X-Payment-Proof header containing the tx hash
- Server validates the on-chain payment and returns data
Common Analysis Patterns
Spread Comparison Across Platforms
const market = await client.getMarketSummary({ currency: 'USD' });
const tightest = market.markets
.filter(m => m.median !== null)
.sort((a, b) => (a.median ?? Infinity) - (b.median ?? Infinity));
Volume Period Comparison
const summary = await client.getSummary();
const mtdVolume = summary.periods.mtd.metrics.volume;
const ytdVolume = summary.periods.ytd.metrics.volume;
const volumeChange = summary.changes.volume.mtd_vs_prior_month;
Liquidity Depth by Rate Tier
query LiquidityByRate {
tight: Deposit_aggregate(
where: {
acceptingIntents: { _eq: true },
methodCurrencies: {
paymentMethod: { _eq: "venmo" },
currencyCode: { _eq: "USD" },
conversionRate_lte: "1015000000000000000"
}
}
) { aggregate { sum { availableBalance } count } }
mid: Deposit_aggregate(
where: {
acceptingIntents: { _eq: true },
methodCurrencies: {
paymentMethod: { _eq: "venmo" },
currencyCode: { _eq: "USD" },
conversionRate_gt: "1015000000000000000",
conversionRate_lte: "1030000000000000000"
}
}
) { aggregate { sum { availableBalance } count } }
wide: Deposit_aggregate(
where: {
acceptingIntents: { _eq: true },
methodCurrencies: {
paymentMethod: { _eq: "venmo" },
currencyCode: { _eq: "USD" },
conversionRate_gt: "1030000000000000000"
}
}
) { aggregate { sum { availableBalance } count } }
}
Vault Benchmarking
query VaultBenchmark {
ManagerAggregateStats(
order_by: { totalFilledVolume: desc }
limit: 10
) {
rateManagerId
manager
totalFilledVolume
totalFeeAmount
totalPnlUsdCents
fulfilledIntents
currentDelegatedBalance
currentDelegatedDeposits
}
}
Environment
| Production | Staging |
|---|
| Chain | Base (8453) | Base Sepolia (84532) |
| Peerlytics API | https://peerlytics.xyz | - |
| Core API | https://api.zkp2p.xyz | https://api-staging.zkp2p.xyz |
| Indexer | - | https://indexer.hyperindex.xyz/00be13d/v1/graphql |