API
Two public endpoints feed the components. Open to any origin, cached for a minute. Read them directly if you build your own UI.
GET /api/earn
The vault, the tokens people can supply with, and the preset routes with live rates.
{
"vault": {
"address": "0x…", "asset": "0xA0b8…eB48", "chainId": 1,
"sharePrice": 1.06, "rate": 0.0588,
"rateNote": "variable · measured from the share price over 30 days",
"withdrawableUsd": 992910, "supplyOpen": true,
"inputs": [
{ "symbol": "USDC", "address": "0xA0b8…eB48", "decimals": 6 },
{ "symbol": "USDT", "address": "0xdAC1…1ec7", "decimals": 6,
"swap": { "venue": "Curve", "pool": "0xbEbc…1C7", "i": 2, "j": 1, "maxSlippage": 0.003 } }
]
},
"routes": [
{ "id": "flexible", "title": "Flexible savings", "risk": 1, "rate": 0.0588,
"action": { "kind": "supply" }, "available": true, … }
],
"updatedAt": "2026-10-07T12:00:00.000Z"
}Rates are fractions (0.0588 = 5.88%). available: false means the route's market doesn't exist yet; show it as coming.
loop
The mcUSDC / USDC Morpho market the one-click loop runs on (the Loop component and the Boosted route). Build the transaction with buildLoop / buildUnloop from lib/mercato-loop.
"loop": {
"available": true, "marketId": "0x…",
"market": { "loanToken": "0xA0b8…eB48", "collateralToken": "0x…", "oracle": "0x…", "irm": "0x870a…00BC", "lltv": "770000000000000000" },
"lltv": 0.77, "maxLtv": 0.693, // the highest LTV offered when opening
"presets": [1.5, 2, 3], // leverage
"borrowRate": 0.0393, "liquidityUsd": 1986245
}collateralRoutes
Routes that take a token you hold, borrow USDC against it and deposit it as mcUSDC in one transaction (the Collateral route component). Today: AVT → mcUSDC. priceUsd is for display; the market prices the collateral with its own oracle. Until the market exists, marketId and market are null and available is false.
"collateralRoutes": [{
"id": "avt", "label": "AVT → mcUSDC", "available": false,
"collateral": { "symbol": "AVT", "address": "0x0d88…824F", "decimals": 18, "logo": "https://mercato.sh/brand/avt.png" },
"priceUsd": 0.2678, "priceSource": "Coinbase",
"marketId": null, "market": null,
"lltv": 0.385, "ltvPresets": [0.15, 0.2, 0.25, 0.33],
"borrowRate": null,
"rewards": null, // { symbol, apr, paidBy } once a rewards campaign exists
"liquidityUsd": 0
}]GET /api/earn/position
One wallet's balance and what it has earned so far, in USDC — Morpho's own figures.
{ "balance": 1012.48, "earned": 12.48 }Your own proxy
Serve the same two paths from your server and point the components at it once:
<MercatoProvider api="https://your.app/api/mercato">{children}</MercatoProvider>