Market Data
Get Custody Balance
Read a wallet’s balance inside the commodity custody contract
GET
/
orderbooks
/
commodities
/
api
/
custody
/
{custodyContract}
/
balance
/
{userAddress}
/
{tokenAddress}
curl "https://api.trusset.org/orderbooks/commodities/api/custody/0xf3dac9cf19da1c95a80de890e200bc86e0c6f2da/balance/0xabc7f1093d5e26b804a1c3f78de025916b47c0d3/0xd8f3ba9de5b7b83f66d1a7b1ad96c1a64b811ff9" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/commodities/api/custody/${custody}/balance/${user}/${token}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"total": "12000000000000000000",
"locked": "2000000000000000000",
"available": "10000000000000000000"
}
}
Returns what one wallet holds of one token inside a custody contract, split into what is free and what is committed to resting orders.
Amounts are on-chain base units in the token’s own decimals, not order book units. Convert before comparing against an order’s
quantity or price.
The contract is read live. If the read fails, the endpoint answers with zeros rather than an error, so a zero balance and an unreachable node look alike. Treat a sudden zero as suspect if the wallet was funded.
Path Parameters
Response Fields
curl "https://api.trusset.org/orderbooks/commodities/api/custody/0xf3dac9cf19da1c95a80de890e200bc86e0c6f2da/balance/0xabc7f1093d5e26b804a1c3f78de025916b47c0d3/0xd8f3ba9de5b7b83f66d1a7b1ad96c1a64b811ff9" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/commodities/api/custody/${custody}/balance/${user}/${token}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"total": "12000000000000000000",
"locked": "2000000000000000000",
"available": "10000000000000000000"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
VALIDATION_ERROR | 400 | One of the three path addresses is malformed |
SERVICE_NOT_ENABLED | 403 | The Trading service is not enabled on this instance |
⌘I
curl "https://api.trusset.org/orderbooks/commodities/api/custody/0xf3dac9cf19da1c95a80de890e200bc86e0c6f2da/balance/0xabc7f1093d5e26b804a1c3f78de025916b47c0d3/0xd8f3ba9de5b7b83f66d1a7b1ad96c1a64b811ff9" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/commodities/api/custody/${custody}/balance/${user}/${token}`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"total": "12000000000000000000",
"locked": "2000000000000000000",
"available": "10000000000000000000"
}
}
