Venue
Get Custody Contract
Resolve the external securities custody contract for your network
GET
/
orderbooks
/
external-securities
/
api
/
custody-contract
curl "https://api.trusset.org/orderbooks/external-securities/api/custody-contract" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
'https://api.trusset.org/orderbooks/external-securities/api/custody-contract',
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.available) throw new Error('external securities custody is not deployed on this network');
{
"success": true,
"data": {
"custodyContract": "0x489aee4ae9546081d55848f157e03192e826988c",
"instanceType": "DEVELOPMENT",
"available": true
}
}
{
"success": true,
"data": {
"custodyContract": null,
"instanceType": "PRODUCTION",
"available": false
}
}
Returns the
TRexCustody address your instance settles through, resolved from the network your API key is bound to. There is one contract per network and it is the same for every issuer on that network.
Ask for it rather than hardcoding it. The address differs between the test and production networks, and a book created against the wrong one is rejected with INVALID_CONFIG.
available is false when no custody contract is deployed on your instance’s network yet. Creating a book on that network then returns 503 CUSTODY_NOT_DEPLOYED.
Response Fields
object
curl "https://api.trusset.org/orderbooks/external-securities/api/custody-contract" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
'https://api.trusset.org/orderbooks/external-securities/api/custody-contract',
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.available) throw new Error('external securities custody is not deployed on this network');
{
"success": true,
"data": {
"custodyContract": "0x489aee4ae9546081d55848f157e03192e826988c",
"instanceType": "DEVELOPMENT",
"available": true
}
}
{
"success": true,
"data": {
"custodyContract": null,
"instanceType": "PRODUCTION",
"available": false
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
SERVICE_NOT_ENABLED | 403 | The Trading service is not enabled on this instance |
⌘I
curl "https://api.trusset.org/orderbooks/external-securities/api/custody-contract" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
'https://api.trusset.org/orderbooks/external-securities/api/custody-contract',
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.available) throw new Error('external securities custody is not deployed on this network');
{
"success": true,
"data": {
"custodyContract": "0x489aee4ae9546081d55848f157e03192e826988c",
"instanceType": "DEVELOPMENT",
"available": true
}
}
{
"success": true,
"data": {
"custodyContract": null,
"instanceType": "PRODUCTION",
"available": false
}
}
