Settlement
Get Settlement Calldata
Rebuild the settlement transaction for a pending settlement
GET
/
orderbooks
/
external-securities
/
api
/
settlements
/
{settlementId}
/
calldata
curl "https://api.trusset.org/orderbooks/external-securities/api/settlements/0f7c2a19-64b8-4d02-9e51-73ab0c5d6f18/calldata" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/external-securities/api/settlements/${settlementId}/calldata`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.alreadySettled) {
const tx = await operator.sendTransaction(data.transaction);
await tx.wait();
await fetch(
`https://api.trusset.org/orderbooks/external-securities/api/settlements/${settlementId}/confirm`,
{
method: 'POST',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({ txHash: tx.hash })
}
);
}
{
"success": true,
"data": {
"settlementId": "0f7c2a19-64b8-4d02-9e51-73ab0c5d6f18",
"status": "PENDING",
"tradeCount": 1,
"skipped": [],
"confirmWith": { "endpoint": "POST /settlements/:settlementId/confirm", "field": "txHash" },
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x489aee4ae9546081d55848f157e03192e826988c",
"data": "0x..."
},
"functionName": "settleTrade",
"description": "Settle trade 0x8a1c... between 0xABC7... and 0x9F8c...",
"expectedSigner": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"tradeRef": "0x8a1c3f70d24e5b8916af02c5d7e34b18906fa2c1d5083e7649bb102f37cd5a44"
}
}
{
"success": true,
"data": {
"settlementId": "0f7c2a19-64b8-4d02-9e51-73ab0c5d6f18",
"status": "CONFIRMED",
"txHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"alreadySettled": true
}
}
{
"success": false,
"data": null,
"error": {
"code": "SETTLEMENT_OPERATOR_UNAUTHORIZED",
"message": "The configured settlement operator is not authorized on this security. The token issuer must authorize it on the custody contract."
}
}
Returns the unsigned transaction that settles one pending settlement. Use it to recover a payload you did not keep from Submit Order, and to work through the queue from List Pending Settlements.
The transaction is rebuilt each time from the signed orders behind the trades, and simulated as the book’s current settlement operator before it is returned. A settlement that can no longer succeed is diagnosed here rather than reverting on chain at your expense.
Only the trades still awaiting settlement are included, so a partially confirmed settlement produces a smaller transaction on the second attempt.
Path Parameters
string
required
Settlement ID.
Response Fields
object
Show child attributes
Show child attributes
string
Settlement ID.
string
The settlement’s current status.
integer
Trades this transaction covers.
array
Trades excluded from the transaction, each with
tradeId and reason.object
The endpoint and field to confirm with once broadcast.
string
SIGN_TRANSACTION.string
settleTrade for one fill, batchSettleTrades for several.string
What the transaction settles.
string
The operator the transaction was simulated as.
string
On a single fill, the trade reference the contract records.
string
On a batch, the batch reference.
integer
On a batch, the number of fills.
boolean
Present and
true when the settlement is already confirmed or has no pending trades. No transaction is returned.A settlement whose revert is permanent is marked
FAILED and unwound as it is diagnosed. Permanent means a cancelled or expired signature, an invalidated nonce, an over-filled order, a self-trade, or a side or market mismatch. The trades are reversed and both reservations released, and the request returns the diagnosis rather than a transaction. A transient failure, such as an unreachable node, leaves the settlement pending and is safe to retry.curl "https://api.trusset.org/orderbooks/external-securities/api/settlements/0f7c2a19-64b8-4d02-9e51-73ab0c5d6f18/calldata" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/external-securities/api/settlements/${settlementId}/calldata`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.alreadySettled) {
const tx = await operator.sendTransaction(data.transaction);
await tx.wait();
await fetch(
`https://api.trusset.org/orderbooks/external-securities/api/settlements/${settlementId}/confirm`,
{
method: 'POST',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({ txHash: tx.hash })
}
);
}
{
"success": true,
"data": {
"settlementId": "0f7c2a19-64b8-4d02-9e51-73ab0c5d6f18",
"status": "PENDING",
"tradeCount": 1,
"skipped": [],
"confirmWith": { "endpoint": "POST /settlements/:settlementId/confirm", "field": "txHash" },
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x489aee4ae9546081d55848f157e03192e826988c",
"data": "0x..."
},
"functionName": "settleTrade",
"description": "Settle trade 0x8a1c... between 0xABC7... and 0x9F8c...",
"expectedSigner": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"tradeRef": "0x8a1c3f70d24e5b8916af02c5d7e34b18906fa2c1d5083e7649bb102f37cd5a44"
}
}
{
"success": true,
"data": {
"settlementId": "0f7c2a19-64b8-4d02-9e51-73ab0c5d6f18",
"status": "CONFIRMED",
"txHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"alreadySettled": true
}
}
{
"success": false,
"data": null,
"error": {
"code": "SETTLEMENT_OPERATOR_UNAUTHORIZED",
"message": "The configured settlement operator is not authorized on this security. The token issuer must authorize it on the custody contract."
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
SETTLEMENT_NOT_FOUND | 404 | No settlement with that ID on your instance, or it is not an external securities settlement |
SETTLEMENT_NOT_BUILDABLE | 409 | No settleable fills remain. skipped names why each was excluded |
SETTLEMENT_REJECTED | 409 | The simulation reverted. Carries reason naming the contract error |
SETTLEMENT_OPERATOR_UNAUTHORIZED | 409 | The book’s settlement operator is not authorized on this security |
DELIVERY_NOT_ALLOWED | 409 | The token’s compliance layer refuses the delivery. Carries deliveryCode, and tokenRestrictionCode where the token reports its own |
CHAIN_UNAVAILABLE | 502 | The custody contract could not be read |
SERVICE_NOT_ENABLED | 403 | The Trading service is not enabled on this instance |
⌘I
curl "https://api.trusset.org/orderbooks/external-securities/api/settlements/0f7c2a19-64b8-4d02-9e51-73ab0c5d6f18/calldata" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/orderbooks/external-securities/api/settlements/${settlementId}/calldata`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (!data.alreadySettled) {
const tx = await operator.sendTransaction(data.transaction);
await tx.wait();
await fetch(
`https://api.trusset.org/orderbooks/external-securities/api/settlements/${settlementId}/confirm`,
{
method: 'POST',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({ txHash: tx.hash })
}
);
}
{
"success": true,
"data": {
"settlementId": "0f7c2a19-64b8-4d02-9e51-73ab0c5d6f18",
"status": "PENDING",
"tradeCount": 1,
"skipped": [],
"confirmWith": { "endpoint": "POST /settlements/:settlementId/confirm", "field": "txHash" },
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x489aee4ae9546081d55848f157e03192e826988c",
"data": "0x..."
},
"functionName": "settleTrade",
"description": "Settle trade 0x8a1c... between 0xABC7... and 0x9F8c...",
"expectedSigner": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"tradeRef": "0x8a1c3f70d24e5b8916af02c5d7e34b18906fa2c1d5083e7649bb102f37cd5a44"
}
}
{
"success": true,
"data": {
"settlementId": "0f7c2a19-64b8-4d02-9e51-73ab0c5d6f18",
"status": "CONFIRMED",
"txHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"alreadySettled": true
}
}
{
"success": false,
"data": null,
"error": {
"code": "SETTLEMENT_OPERATOR_UNAUTHORIZED",
"message": "The configured settlement operator is not authorized on this security. The token issuer must authorize it on the custody contract."
}
}
