Positions
Get Position
One wallet’s shares and their current value
GET
/
lending-external-securities-v2
/
api
/
vaults
/
{vaultId}
/
position
/
{holderAddress}
curl "https://api.trusset.org/lending-external-securities-v2/api/vaults/cmssh8t2u0003cghxkx1w1fwd/position/0x6a6cba16dad34f7ea7ecbcdbf050f8146b942d6b" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/vaults/${vaultId}/position/${wallet}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.holder && !data.holder.readFailed) {
console.log(`${data.holder.shares} shares worth ${data.holder.value}`);
}
{
"success": true,
"data": {
"vaultId": "cmssh8t2u0003cghxkx1w1fwd",
"holder": {
"holderAddress": "0x6a6cba16dad34f7ea7ecbcdbf050f8146b942d6b",
"shares": "1000.0",
"sharesRaw": "1000000000",
"value": "1012.5",
"readFailed": false
},
"sharePrice": "1.012500000005613861"
}
}
{
"success": false,
"data": null,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": [{ "field": "", "message": "Invalid" }]
}
}
A compact answer for portfolio displays: the wallet’s share balance, that balance at the current share price, and the share price itself. If you want the vault’s full state alongside a position, use Get Vault with
?address=. Both calls run the same vault read, so a vault is visible here under the same rules.
Path Parameters
string
required
Vault ID.
string
required
Wallet to read. Must be a
0x address of 40 hex characters. Anything else answers VALIDATION_ERROR without touching the chain.Response Fields
object
Show child attributes
Show child attributes
string
The vault read.
object
holderAddress, shares, sharesRaw, value, readFailed. When readFailed is true, shares, sharesRaw and value are null, not zero. The whole block is null for a vault with no recorded address.string
Current share price as an 18-decimal string, or
null when the vault read failed.curl "https://api.trusset.org/lending-external-securities-v2/api/vaults/cmssh8t2u0003cghxkx1w1fwd/position/0x6a6cba16dad34f7ea7ecbcdbf050f8146b942d6b" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/vaults/${vaultId}/position/${wallet}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.holder && !data.holder.readFailed) {
console.log(`${data.holder.shares} shares worth ${data.holder.value}`);
}
{
"success": true,
"data": {
"vaultId": "cmssh8t2u0003cghxkx1w1fwd",
"holder": {
"holderAddress": "0x6a6cba16dad34f7ea7ecbcdbf050f8146b942d6b",
"shares": "1000.0",
"sharesRaw": "1000000000",
"value": "1012.5",
"readFailed": false
},
"sharePrice": "1.012500000005613861"
}
}
{
"success": false,
"data": null,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": [{ "field": "", "message": "Invalid" }]
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
VALIDATION_ERROR | 400 | holderAddress is not a 0x address |
VAULT_NOT_FOUND | 404 | No such vault, or it is not visible to your instance |
VAULT_STATE_UNAVAILABLE | 503 | Whether your instance is a distributor of record in an unpublished vault could not be read from the chain. Retry shortly |
SERVICE_UNAVAILABLE | 503 | The vault records or your instance’s verified wallets could not be read. Retry shortly |
VAULT_READ_FAILED | 500 | Unexpected failure. Retry, or contact support with the request ID |
⌘I
curl "https://api.trusset.org/lending-external-securities-v2/api/vaults/cmssh8t2u0003cghxkx1w1fwd/position/0x6a6cba16dad34f7ea7ecbcdbf050f8146b942d6b" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/vaults/${vaultId}/position/${wallet}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.holder && !data.holder.readFailed) {
console.log(`${data.holder.shares} shares worth ${data.holder.value}`);
}
{
"success": true,
"data": {
"vaultId": "cmssh8t2u0003cghxkx1w1fwd",
"holder": {
"holderAddress": "0x6a6cba16dad34f7ea7ecbcdbf050f8146b942d6b",
"shares": "1000.0",
"sharesRaw": "1000000000",
"value": "1012.5",
"readFailed": false
},
"sharePrice": "1.012500000005613861"
}
}
{
"success": false,
"data": null,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": [{ "field": "", "message": "Invalid" }]
}
}
