Borrowing
Get Escrowed Collateral
Read collateral the custody adapter holds in escrow for a holder
GET
/
lending-external-securities-v2
/
api
/
positions
/
{marketId}
/
escrowed-collateral
/
{holderAddress}
curl "https://api.trusset.org/lending-external-securities-v2/api/positions/{marketId}/escrowed-collateral/0xabc7f1093d5e26b804a1c3f78de025916b47c0d3" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/positions/${marketId}/escrowed-collateral/${holder}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const claimable = data.escrowedCollateralRaw !== '0';
{
"success": true,
"data": {
"holderAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
"adapterAddress": "0x4d2b93f70e18c6a5d34b027fe95c81a6730d77ae",
"escrowedCollateral": "250.0",
"escrowedCollateralRaw": "250000000000000000000"
}
}
{
"success": false,
"error": {
"code": "NOT_CUSTODY_MODE",
"message": "Escrow only applies to custody-mode markets"
}
}
{
"success": false,
"error": {
"code": "ESCROW_UNREADABLE",
"message": "The custody adapter escrow could not be read from the network right now."
}
}
Returns the collateral tokens a
This is collateral escrow, held by the custody adapter in the collateral token. A realization surplus is a different balance: the market holds it in the settlement token (stablecoin) after a liquidation paid out more than the debt. Read that one with Get Escrowed Surplus.
CUSTODY market’s adapter holds in escrow for one address. The figure is per holder, not per loan. Every blocked return to that address on this market adds to the same balance.
Escrow is a fail-safe rather than a failure. The adapter returns collateral when a repaid loan closes, when the borrower withdraws collateral, and when a liquidation releases the part it did not seize. If the collateral token refuses that transfer, the adapter escrows the amount instead of reverting the whole operation. The holder reclaims it through Claim Escrowed Collateral once the restriction is lifted.
Custody-mode markets only. A
FREEZE market never escrows, because collateral never leaves the borrower’s wallet, and the call is refused with NOT_CUSTODY_MODE.Path Parameters
string
required
string
required
Address to read the escrow for,
0x followed by 40 hex characters.Response Fields
object
Show child attributes
Show child attributes
curl "https://api.trusset.org/lending-external-securities-v2/api/positions/{marketId}/escrowed-collateral/0xabc7f1093d5e26b804a1c3f78de025916b47c0d3" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/positions/${marketId}/escrowed-collateral/${holder}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const claimable = data.escrowedCollateralRaw !== '0';
{
"success": true,
"data": {
"holderAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
"adapterAddress": "0x4d2b93f70e18c6a5d34b027fe95c81a6730d77ae",
"escrowedCollateral": "250.0",
"escrowedCollateralRaw": "250000000000000000000"
}
}
{
"success": false,
"error": {
"code": "NOT_CUSTODY_MODE",
"message": "Escrow only applies to custody-mode markets"
}
}
{
"success": false,
"error": {
"code": "ESCROW_UNREADABLE",
"message": "The custody adapter escrow could not be read from the network right now."
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
VALIDATION_ERROR | 400 | holderAddress is not 0x followed by 40 hex characters |
NOT_CUSTODY_MODE | 400 | The market runs in FREEZE mode |
ESCROW_UNREADABLE | 400 | The market records no custody adapter, or the adapter could not be read from the network. Retry shortly |
MISSING_MARKET_ID | 400 | The market ID 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/positions/{marketId}/escrowed-collateral/0xabc7f1093d5e26b804a1c3f78de025916b47c0d3" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/positions/${marketId}/escrowed-collateral/${holder}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const claimable = data.escrowedCollateralRaw !== '0';
{
"success": true,
"data": {
"holderAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
"adapterAddress": "0x4d2b93f70e18c6a5d34b027fe95c81a6730d77ae",
"escrowedCollateral": "250.0",
"escrowedCollateralRaw": "250000000000000000000"
}
}
{
"success": false,
"error": {
"code": "NOT_CUSTODY_MODE",
"message": "Escrow only applies to custody-mode markets"
}
}
{
"success": false,
"error": {
"code": "ESCROW_UNREADABLE",
"message": "The custody adapter escrow could not be read from the network right now."
}
}
