Liquidity
Get Provider Balance
Read a liquidity provider position from the market contract
GET
/
lending-external-securities
/
api
/
positions
/
{marketId}
/
provider-balance
/
{provider}
curl "https://api.trusset.org/lending-external-securities/api/positions/{marketId}/provider-balance/0x111...222" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities/api/positions/${marketId}/provider-balance/${provider}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.source === 'onchain') {
const earned = Number(data.currentValue) - Number(data.deposited);
}
{
"success": true,
"data": {
"shares": "250000.000000000000000000",
"currentValue": "252140.860000",
"deposited": "250000.000000",
"source": "onchain"
}
}
{
"success": true,
"data": {
"deposited": "250000",
"shares": "250000",
"currentValue": "250000",
"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 tells you which path produced the response.
Path Parameters
string
required
Market ID.
string
required
Provider wallet address, 0x-prefixed with 40 hex characters.
Response Fields
object
Show child attributes
Show child attributes
string
LP shares held, formatted at 18 decimals. Pass this to Remove Liquidity.
string
What the shares are worth now, in borrow asset units, including accrued interest.
string
Amount originally deposited, in borrow asset units. The difference against
currentValue is the provider’s earnings.string
onchain when read from the contract, database when the read failed and stored values were served instead.When
source is database the figures are the last recorded values, not live. currentValue in that case mirrors the deposited amount and excludes accrued interest. Do not settle against a database response.curl "https://api.trusset.org/lending-external-securities/api/positions/{marketId}/provider-balance/0x111...222" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities/api/positions/${marketId}/provider-balance/${provider}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.source === 'onchain') {
const earned = Number(data.currentValue) - Number(data.deposited);
}
{
"success": true,
"data": {
"shares": "250000.000000000000000000",
"currentValue": "252140.860000",
"deposited": "250000.000000",
"source": "onchain"
}
}
{
"success": true,
"data": {
"deposited": "250000",
"shares": "250000",
"currentValue": "250000",
"source": "database"
}
}
⌘I
curl "https://api.trusset.org/lending-external-securities/api/positions/{marketId}/provider-balance/0x111...222" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities/api/positions/${marketId}/provider-balance/${provider}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.source === 'onchain') {
const earned = Number(data.currentValue) - Number(data.deposited);
}
{
"success": true,
"data": {
"shares": "250000.000000000000000000",
"currentValue": "252140.860000",
"deposited": "250000.000000",
"source": "onchain"
}
}
{
"success": true,
"data": {
"deposited": "250000",
"shares": "250000",
"currentValue": "250000",
"source": "database"
}
}
