Liquidity
Get Provider Balance
Read a liquidity provider position from the market contract
GET
/
lending-external-securities-v2
/
api
/
positions
/
{marketId}
/
provider-balance
/
{provider}
curl "https://api.trusset.org/lending-external-securities-v2/api/positions/{marketId}/provider-balance/0x2b6ed29a95753c3ad948348e3e7b1a251080ffb9" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/positions/${marketId}/provider-balance/${provider}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const redeemable = data.source === 'onchain' ? data.shares : null;
{
"success": true,
"data": {
"shares": "250000.0",
"currentValue": "252140.86",
"deposited": "250000.0",
"source": "onchain"
}
}
{
"success": true,
"data": {
"deposited": "250000.0",
"shares": "250000.0",
"currentValue": null,
"source": "database"
}
}
Returns one provider’s LP position. The endpoint reads the market contract directly and falls back to stored values only if the chain read fails. The
source field says which path produced the response.
When
source is database the figures are the last recorded values, not live, and currentValue is null. Do not settle or size a redemption against a database response.Path Parameters
string
required
string
required
Provider wallet or vault address, 0x-prefixed with 40 hex characters.
Response Fields
object
Show child attributes
Show child attributes
string
LP shares held, at 18 decimals. Pass this to Remove Liquidity.
string
What the shares are worth now, in borrow asset units. It includes interest accrued to liquidity providers that the pool has not yet settled. Redeeming that much also needs the pool to hold it as uncommitted liquidity.
null when source is database.string
Total the provider has deposited, in borrow asset units. Withdrawals do not reduce it, so
currentValue minus deposited is the provider’s earnings only if it has never withdrawn.string
onchain when read from the contract, database when the read failed and stored values were served instead. A provider with no active stored record, including one that has fully withdrawn, reads as 0 shares and 0 deposited on the database path.A pool whose value is fully consumed by bad debt is recapitalised by the next deposit, and every share issued before that deposit becomes void. The contract then reports a provider holding only such shares as
0 shares worth 0, with 0 deposited.curl "https://api.trusset.org/lending-external-securities-v2/api/positions/{marketId}/provider-balance/0x2b6ed29a95753c3ad948348e3e7b1a251080ffb9" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/positions/${marketId}/provider-balance/${provider}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const redeemable = data.source === 'onchain' ? data.shares : null;
{
"success": true,
"data": {
"shares": "250000.0",
"currentValue": "252140.86",
"deposited": "250000.0",
"source": "onchain"
}
}
{
"success": true,
"data": {
"deposited": "250000.0",
"shares": "250000.0",
"currentValue": null,
"source": "database"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
MISSING_MARKET_ID | 400 | marketId is longer than 100 characters |
VALIDATION_ERROR | 400 | provider is not a 0x-prefixed 40-hex-character address |
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}/provider-balance/0x2b6ed29a95753c3ad948348e3e7b1a251080ffb9" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/positions/${marketId}/provider-balance/${provider}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const redeemable = data.source === 'onchain' ? data.shares : null;
{
"success": true,
"data": {
"shares": "250000.0",
"currentValue": "252140.86",
"deposited": "250000.0",
"source": "onchain"
}
}
{
"success": true,
"data": {
"deposited": "250000.0",
"shares": "250000.0",
"currentValue": null,
"source": "database"
}
}
