Roles
Get Access Role
Check whether an address holds a role on the market, its router or its oracle
GET
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
access-role
/
{address}
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/access-role/0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27?role=ROUTER_OPERATOR" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/access-role/${address}?role=ROUTER_OPERATOR`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"address": "0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27",
"role": "ROUTER_OPERATOR",
"roleName": "OPERATOR_ROLE",
"contract": "0x8c3a5e0f2b71d94c6e08a3f5b2d7c19e4a60f835",
"granted": true,
"failed": false
}
}
{
"success": true,
"data": {
"address": "0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27",
"role": "ROUTER_OPERATOR",
"roleName": "OPERATOR_ROLE",
"contract": "0x8c3a5e0f2b71d94c6e08a3f5b2d7c19e4a60f835",
"granted": null,
"failed": true
}
}
{
"success": false,
"error": {
"code": "UNKNOWN_ROLE",
"message": "A supported role is required"
}
}
Reads from the chain whether an address holds one of the seven roles that Set Access Role grants and revokes. Use it before building a change, or to confirm which wallet can sign an administrative transaction.
For
ORACLE_SIGNER, the oracle owner reads as granted, because the owner can sign prices without a grant. Get Guardians lists every holder of MARKET_GUARDIAN.
Path Parameters
Address to check. Must be a 0x-prefixed 40-character hex address other than the zero address.
Query Parameters
One of
MARKET_ADMIN, MARKET_ISSUER, MARKET_LIQUIDATOR, MARKET_GUARDIAN, ROUTER_ADMIN, ROUTER_OPERATOR or ORACLE_SIGNER. The role table says what each one controls.Response Fields
Show child attributes
Show child attributes
The on-chain role:
DEFAULT_ADMIN_ROLE, ISSUER_ROLE, LIQUIDATOR_ROLE, GUARDIAN_ROLE, OPERATOR_ROLE, or Price signing for ORACLE_SIGNER.A failed chain read still returns
200, with granted: null and failed: true. Treat it as unknown, not as a revoked role, and retry.curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/access-role/0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27?role=ROUTER_OPERATOR" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/access-role/${address}?role=ROUTER_OPERATOR`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"address": "0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27",
"role": "ROUTER_OPERATOR",
"roleName": "OPERATOR_ROLE",
"contract": "0x8c3a5e0f2b71d94c6e08a3f5b2d7c19e4a60f835",
"granted": true,
"failed": false
}
}
{
"success": true,
"data": {
"address": "0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27",
"role": "ROUTER_OPERATOR",
"roleName": "OPERATOR_ROLE",
"contract": "0x8c3a5e0f2b71d94c6e08a3f5b2d7c19e4a60f835",
"granted": null,
"failed": true
}
}
{
"success": false,
"error": {
"code": "UNKNOWN_ROLE",
"message": "A supported role is required"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
NO_MARKET_ADDRESS | 400 | The market has no on-chain address recorded, or no market address could be resolved for a market role |
INVALID_ADDRESS | 400 | The path address is malformed or is the zero address |
UNKNOWN_ROLE | 400 | role is missing or is not one of the seven keys |
NO_ROUTER | 400 | A router role was requested and no liquidation router address could be resolved for the market |
NO_ORACLE | 400 | ORACLE_SIGNER was requested and the market records no oracle |
MISSING_MARKET_ID | 400 | marketId 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/markets/{marketId}/access-role/0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27?role=ROUTER_OPERATOR" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/access-role/${address}?role=ROUTER_OPERATOR`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"address": "0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27",
"role": "ROUTER_OPERATOR",
"roleName": "OPERATOR_ROLE",
"contract": "0x8c3a5e0f2b71d94c6e08a3f5b2d7c19e4a60f835",
"granted": true,
"failed": false
}
}
{
"success": true,
"data": {
"address": "0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27",
"role": "ROUTER_OPERATOR",
"roleName": "OPERATOR_ROLE",
"contract": "0x8c3a5e0f2b71d94c6e08a3f5b2d7c19e4a60f835",
"granted": null,
"failed": true
}
}
{
"success": false,
"error": {
"code": "UNKNOWN_ROLE",
"message": "A supported role is required"
}
}
