Markets
Get Supply Caps
Read collateral caps and current usage
GET
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
supply-caps
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/supply-caps" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/supply-caps`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const capped = data && Number(data.maxTotalCollateral) > 0;
const headroom = capped ? Number(data.maxTotalCollateral) - Number(data.currentTotalCollateral) : Infinity;
{
"success": true,
"data": {
"maxTotalCollateral": "50000.0",
"maxUserCollateral": "10000.0",
"currentTotalCollateral": "5000.0"
}
}
{
"success": true,
"data": {
"maxTotalCollateral": "0.0",
"maxUserCollateral": "0.0",
"currentTotalCollateral": "5000.0"
}
}
Returns the market’s global and per-borrower collateral caps alongside the collateral currently locked. Use this before quoting a borrower a size. Open Loan and Add Collateral refuse a request that would pass either cap with
SUPPLY_CAP_EXCEEDED or USER_SUPPLY_CAP_EXCEEDED before a wallet signs, and the contract reverts on it too.
The per-borrower cap counts everything a borrower holds as collateral across all of their loans on this market, not the size of one loan. All three values are formatted in the collateral token’s own decimals.
Path Parameters
string
required
Response Fields
object
Returns
data: null if the contract read fails. Both caps are set through Update Market Config.curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/supply-caps" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/supply-caps`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const capped = data && Number(data.maxTotalCollateral) > 0;
const headroom = capped ? Number(data.maxTotalCollateral) - Number(data.currentTotalCollateral) : Infinity;
{
"success": true,
"data": {
"maxTotalCollateral": "50000.0",
"maxUserCollateral": "10000.0",
"currentTotalCollateral": "5000.0"
}
}
{
"success": true,
"data": {
"maxTotalCollateral": "0.0",
"maxUserCollateral": "0.0",
"currentTotalCollateral": "5000.0"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
NO_MARKET_ADDRESS | 400 | The market has no on-chain address recorded |
MISSING_MARKET_ID | 400 | marketId is longer than 100 characters |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
⌘I
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/supply-caps" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/supply-caps`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const capped = data && Number(data.maxTotalCollateral) > 0;
const headroom = capped ? Number(data.maxTotalCollateral) - Number(data.currentTotalCollateral) : Infinity;
{
"success": true,
"data": {
"maxTotalCollateral": "50000.0",
"maxUserCollateral": "10000.0",
"currentTotalCollateral": "5000.0"
}
}
{
"success": true,
"data": {
"maxTotalCollateral": "0.0",
"maxUserCollateral": "0.0",
"currentTotalCollateral": "5000.0"
}
}
