Distributor Fees
Pay Operator Fees
Calldata that pays the vault’s unattributed distributor slice to the vault owner
POST
/
lending-external-securities-v2
/
api
/
vaults
/
{vaultId}
/
operator-fees
/
pay
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/vaults/cmssh8t2u0003cghxkx1w1fwd/operator-fees/pay" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{}'
const url = `https://api.trusset.org/lending-external-securities-v2/api/vaults/${vaultId}/operator-fees/pay`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const res = await fetch(url, { method: 'POST', headers, body: JSON.stringify({}) });
const { data } = await res.json();
const transactions = data.steps ? data.steps.map((step) => step.transaction) : [data.transaction];
let tx;
for (const transaction of transactions) {
tx = await signer.sendTransaction(transaction);
await tx.wait();
}
await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x4d0cfe39a3431b145d1a1393d901a36d459a1b13",
"data": "0x3799fd63",
"value": "0",
"chainId": 11155111
},
"functionName": "payOperatorFees",
"permissionless": true,
"recipient": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"amount": "5.625",
"amountRaw": "5625000",
"description": "Pay the 5.625 USDC unattributed distributor slice to the vault owner 0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"note": "Any wallet may sign this transaction. The vault pays its owner, never the signer.",
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/vaults/cmssh8t2u0003cghxkx1w1fwd/operator-fees/pay",
"field": "txHash"
}
}
}
{
"success": true,
"data": {
"txHash": "0xa05ac2618cc57644ff005eaa0c358110f3949ba14a0fb0c732eda4f5f4bca5e5",
"action": "operator",
"signer": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"amount": "5.625",
"amountRaw": "5625000",
"events": ["OPERATOR_PAID"]
}
}
{
"success": false,
"data": null,
"error": {
"code": "NOTHING_ACCRUED",
"message": "No unattributed distributor fee is waiting for the operator in this vault."
}
}
Builds
The route validates every field of the schema it shares with the other distributor actions, even where this action ignores it.
The confirmation response, after the backend has verified the receipt:
Confirming with
payOperatorFees() on the vault. It pays the vault owner the part of the collected distributor slices that no distributor earned. That is what shares without a distributor earned, plus anything that accrued while no shares were in issue. operator.claimable on Get Earnings shows the amount.
Any wallet may sign, and the vault pays its owner, never the signer. The API builds the call only for the instance that operates the vault. Only fees already collected into the vault are payable: run Collect Distributor Fees for each market first.
Holders bound to your instance’s own distributor wallet earn through Pay Distributor, like any other distributor’s holders. This call pays only the unattributed part.
Path Parameters
string
required
Vault ID.
Body Parameters
string
Hash of the mined payout,
0x and 64 hex characters. Send it to confirm and record the result. Omit it to receive the calldata; no other field is needed to build.Response Fields
The calldata response:object
Show child attributes
Show child attributes
string
SIGN_TRANSACTION.object
to (the vault), data, value ("0") and chainId.string
payOperatorFees.boolean
Always
true: any wallet may sign.string
The vault owner, which the vault pays.
string
What the vault holds for its owner when the calldata was built, formatted at the vault’s asset decimals.
string
The same amount in base units.
string
The transaction in words.
string
States that the vault pays its owner, never the signer.
object
endpoint, this route with the vault ID filled in, and field, always txHash.array
Present instead of
transaction, with action: "SIGN_TRANSACTIONS", when the vault must first record a market’s write-off: one recordMarketLoss step per such market, then the payout. Each step is { action, transaction, functionName, description }. confirmStepIndex points at the last step, recordsWriteOffs lists { marketAddress, amountRaw } per market, and writeOffNote explains them. Any wallet may sign every step. Confirm with the hash of the last one.object
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/vaults/cmssh8t2u0003cghxkx1w1fwd/operator-fees/pay" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{}'
const url = `https://api.trusset.org/lending-external-securities-v2/api/vaults/${vaultId}/operator-fees/pay`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const res = await fetch(url, { method: 'POST', headers, body: JSON.stringify({}) });
const { data } = await res.json();
const transactions = data.steps ? data.steps.map((step) => step.transaction) : [data.transaction];
let tx;
for (const transaction of transactions) {
tx = await signer.sendTransaction(transaction);
await tx.wait();
}
await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x4d0cfe39a3431b145d1a1393d901a36d459a1b13",
"data": "0x3799fd63",
"value": "0",
"chainId": 11155111
},
"functionName": "payOperatorFees",
"permissionless": true,
"recipient": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"amount": "5.625",
"amountRaw": "5625000",
"description": "Pay the 5.625 USDC unattributed distributor slice to the vault owner 0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"note": "Any wallet may sign this transaction. The vault pays its owner, never the signer.",
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/vaults/cmssh8t2u0003cghxkx1w1fwd/operator-fees/pay",
"field": "txHash"
}
}
}
{
"success": true,
"data": {
"txHash": "0xa05ac2618cc57644ff005eaa0c358110f3949ba14a0fb0c732eda4f5f4bca5e5",
"action": "operator",
"signer": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"amount": "5.625",
"amountRaw": "5625000",
"events": ["OPERATOR_PAID"]
}
}
{
"success": false,
"data": null,
"error": {
"code": "NOTHING_ACCRUED",
"message": "No unattributed distributor fee is waiting for the operator in this vault."
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
VALIDATION_ERROR | 400 | A body field is malformed |
NOT_VAULT_OPERATOR | 403 | Your instance does not operate this vault. The contract would still take the call from any signer |
VAULT_NOT_FOUND | 404 | No such vault, or it is not visible to your instance |
VAULT_NOT_DEPLOYED | 409 | The vault has no on-chain address on record |
VAULT_UPGRADE_REQUIRED | 409 | The vault runs an implementation from before distributor attribution |
NOTHING_ACCRUED | 409 | No unattributed distributor fee is waiting for the operator. Collect the vault’s slice from its markets first |
VAULT_STATE_UNAVAILABLE | 503 | The vault implementation, its operator balance or owner, whether a market wrote off accrual the vault has not recorded, or your standing in an unpublished vault could not be read. Retry shortly |
CHAIN_UNAVAILABLE | 503 | The chain could not be read, so nothing was decided. Retry shortly |
SERVICE_UNAVAILABLE | 503 | The vault records or your instance’s verified wallets could not be read. Retry shortly |
VAULT_DISTRIBUTOR_ACTION_FAILED | 500 | Unexpected failure. Retry, or contact support with the request ID |
txHash can also return TX_NOT_FOUND (404), TX_REVERTED, TX_WRONG_TARGET or TX_WRONG_FUNCTION (400), and TX_NOT_VERIFIED (400) when the transaction carries no operator payout on this vault. See transaction verification errors.⌘I
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/vaults/cmssh8t2u0003cghxkx1w1fwd/operator-fees/pay" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{}'
const url = `https://api.trusset.org/lending-external-securities-v2/api/vaults/${vaultId}/operator-fees/pay`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const res = await fetch(url, { method: 'POST', headers, body: JSON.stringify({}) });
const { data } = await res.json();
const transactions = data.steps ? data.steps.map((step) => step.transaction) : [data.transaction];
let tx;
for (const transaction of transactions) {
tx = await signer.sendTransaction(transaction);
await tx.wait();
}
await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x4d0cfe39a3431b145d1a1393d901a36d459a1b13",
"data": "0x3799fd63",
"value": "0",
"chainId": 11155111
},
"functionName": "payOperatorFees",
"permissionless": true,
"recipient": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"amount": "5.625",
"amountRaw": "5625000",
"description": "Pay the 5.625 USDC unattributed distributor slice to the vault owner 0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"note": "Any wallet may sign this transaction. The vault pays its owner, never the signer.",
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/vaults/cmssh8t2u0003cghxkx1w1fwd/operator-fees/pay",
"field": "txHash"
}
}
}
{
"success": true,
"data": {
"txHash": "0xa05ac2618cc57644ff005eaa0c358110f3949ba14a0fb0c732eda4f5f4bca5e5",
"action": "operator",
"signer": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"amount": "5.625",
"amountRaw": "5625000",
"events": ["OPERATOR_PAID"]
}
}
{
"success": false,
"data": null,
"error": {
"code": "NOTHING_ACCRUED",
"message": "No unattributed distributor fee is waiting for the operator in this vault."
}
}
