Fees
Sweep Infrastructure Fees
Pay the infrastructure fee the market has booked to the Trusset wallet fixed in the contract
POST
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
infrastructure-fees
/
sweep
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/infrastructure-fees/sweep" \
-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/markets/${marketId}/infrastructure-fees/sweep`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const built = await fetch(url, { method: 'POST', headers, body: JSON.stringify({}) });
const { data } = await built.json();
const tx = await wallet.sendTransaction(data.transaction);
await tx.wait();
await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"value": "0",
"chainId": 11155111
},
"functionName": "sweepInfrastructureFees",
"description": "Pay the 150.0 USDC of accrued infrastructure fees to the platform wallet 0x65ff3a731366472d40cf458332457403168c2bea",
"permissionless": true,
"requiredRole": null,
"requiredSigner": null,
"note": "Any wallet may sign this transaction. The market pays the accrued infrastructure fee to the platform wallet fixed in the contract, never to the signer.",
"destination": "0x65ff3a731366472d40cf458332457403168c2bea",
"amount": "150.0",
"amountRaw": "150000000",
"asset": {
"address": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"symbol": "USDC",
"decimals": 6
},
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/markets/clx_secmarket_001/infrastructure-fees/sweep",
"field": "txHash"
}
}
}
{
"success": true,
"data": {
"kind": "infrastructure",
"txHash": "0x5b1d7e2c90a4f36e8d0b1c7a95e4f2d38a6c0b91e7d5f4a2c3b8e06d19f7a254",
"signedBy": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"destination": "0x65ff3a731366472d40cf458332457403168c2bea",
"amount": "150.0",
"amountRaw": "150000000",
"asset": {
"address": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"symbol": "USDC",
"decimals": 6
},
"at": "2026-09-25T14:03:12.000Z"
}
}
{
"success": false,
"error": {
"code": "NO_INFRASTRUCTURE_FEES",
"message": "No infrastructure fee is payable on this market: 0.0 USDC has accrued, and the leg is booked only out of repaid interest and liquidation proceeds, so sweepInfrastructureFees would revert. Nothing to sign until interest is repaid or a liquidation settles."
}
}
Builds the
The sweep pays whatever is booked when it mines, which can exceed the amount quoted when the calldata was built. A confirmed sweep is recorded on the market as an
Confirming with
sweepInfrastructureFees transaction, which pays everything the market has booked as Trusset’s infrastructure fee to the Trusset wallet. That wallet is a constant in the market contract, 0x65FF3a731366472d40CF458332457403168c2BEA, and the market has no setter for it.
Any wallet may sign, and nothing reaches the signer. The sweep only moves money that is already booked to Trusset. Until it runs, that money sits on the market as a liability that is never lent out and that no liquidity provider can withdraw.
The booked balance has two sources. Trusset takes 15 percent of repaid interest and of interest recovered through liquidation, and 87 percent of every fixed transaction fee. Get Cashflows itemises both.
Path Parameters
string
required
Market ID.
Body Parameters
string
Hash of the sweep you broadcast. Send it to confirm the transaction and record the result. Omit it to receive the calldata.
Response Fields
object
Show child attributes
Show child attributes
string
SIGN_TRANSACTION. Returned when txHash is omitted.object
Unsigned transaction,
{ to, data, value, chainId }, targeting the market. Returned when txHash is omitted.string
sweepInfrastructureFees. Returned when txHash is omitted.string
What the transaction pays and to whom, in words. Returned when
txHash is omitted.boolean
Always
true. Returned when txHash is omitted.string
Always
null, because the sweep needs no role. Returned when txHash is omitted.string
Always
null, because any wallet may sign. Returned when txHash is omitted.string
States that the market pays the wallet fixed in the contract, never the signer. Returned when
txHash is omitted.string
The Trusset wallet, read from the market.
null when that read fails, which does not stop the sweep, because the contract pays its constant either way.string
On the calldata call, what was booked when the calldata was built. On the confirm call, what the sweep actually paid, read from the
InfrastructureFeePaid event.string
amount in the borrow asset’s smallest unit.object
The borrow asset:
address, symbol, decimals.object
Where to send the hash:
endpoint names this route and field is txHash. Returned when txHash is omitted.string
infrastructure. Returned when confirming with txHash.string
Sweep transaction hash. Returned when confirming with
txHash.string
The wallet that sent the sweep. Returned when confirming with
txHash.string
ISO 8601 time of the block the sweep mined in.
null when the block time could not be read. Returned when confirming with txHash.INFRASTRUCTURE_FEES_SWEPT transaction, visible through List Transactions.
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/infrastructure-fees/sweep" \
-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/markets/${marketId}/infrastructure-fees/sweep`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const built = await fetch(url, { method: 'POST', headers, body: JSON.stringify({}) });
const { data } = await built.json();
const tx = await wallet.sendTransaction(data.transaction);
await tx.wait();
await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"value": "0",
"chainId": 11155111
},
"functionName": "sweepInfrastructureFees",
"description": "Pay the 150.0 USDC of accrued infrastructure fees to the platform wallet 0x65ff3a731366472d40cf458332457403168c2bea",
"permissionless": true,
"requiredRole": null,
"requiredSigner": null,
"note": "Any wallet may sign this transaction. The market pays the accrued infrastructure fee to the platform wallet fixed in the contract, never to the signer.",
"destination": "0x65ff3a731366472d40cf458332457403168c2bea",
"amount": "150.0",
"amountRaw": "150000000",
"asset": {
"address": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"symbol": "USDC",
"decimals": 6
},
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/markets/clx_secmarket_001/infrastructure-fees/sweep",
"field": "txHash"
}
}
}
{
"success": true,
"data": {
"kind": "infrastructure",
"txHash": "0x5b1d7e2c90a4f36e8d0b1c7a95e4f2d38a6c0b91e7d5f4a2c3b8e06d19f7a254",
"signedBy": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"destination": "0x65ff3a731366472d40cf458332457403168c2bea",
"amount": "150.0",
"amountRaw": "150000000",
"asset": {
"address": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"symbol": "USDC",
"decimals": 6
},
"at": "2026-09-25T14:03:12.000Z"
}
}
{
"success": false,
"error": {
"code": "NO_INFRASTRUCTURE_FEES",
"message": "No infrastructure fee is payable on this market: 0.0 USDC has accrued, and the leg is booked only out of repaid interest and liquidation proceeds, so sweepInfrastructureFees would revert. Nothing to sign until interest is repaid or a liquidation settles."
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
VALIDATION_ERROR | 400 | txHash is not a 0x-prefixed 32-byte hex hash |
MISSING_MARKET_ID | 400 | The market ID in the path is longer than 100 characters |
NO_MARKET_ADDRESS | 400 | The market has no on-chain address recorded |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
NO_INFRASTRUCTURE_FEES | 409 | Nothing is booked for Trusset, so the sweep would revert. The message states what has accrued |
MARKET_FEES_UNAVAILABLE | 503 | The booked balances could not be read, so no transaction is offered. Retry shortly |
txHash can also return any transaction verification error.⌘I
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/infrastructure-fees/sweep" \
-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/markets/${marketId}/infrastructure-fees/sweep`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const built = await fetch(url, { method: 'POST', headers, body: JSON.stringify({}) });
const { data } = await built.json();
const tx = await wallet.sendTransaction(data.transaction);
await tx.wait();
await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"value": "0",
"chainId": 11155111
},
"functionName": "sweepInfrastructureFees",
"description": "Pay the 150.0 USDC of accrued infrastructure fees to the platform wallet 0x65ff3a731366472d40cf458332457403168c2bea",
"permissionless": true,
"requiredRole": null,
"requiredSigner": null,
"note": "Any wallet may sign this transaction. The market pays the accrued infrastructure fee to the platform wallet fixed in the contract, never to the signer.",
"destination": "0x65ff3a731366472d40cf458332457403168c2bea",
"amount": "150.0",
"amountRaw": "150000000",
"asset": {
"address": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"symbol": "USDC",
"decimals": 6
},
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/markets/clx_secmarket_001/infrastructure-fees/sweep",
"field": "txHash"
}
}
}
{
"success": true,
"data": {
"kind": "infrastructure",
"txHash": "0x5b1d7e2c90a4f36e8d0b1c7a95e4f2d38a6c0b91e7d5f4a2c3b8e06d19f7a254",
"signedBy": "0x5ad87a0621175206b72d10e4b8577b192e7f40ab",
"destination": "0x65ff3a731366472d40cf458332457403168c2bea",
"amount": "150.0",
"amountRaw": "150000000",
"asset": {
"address": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"symbol": "USDC",
"decimals": 6
},
"at": "2026-09-25T14:03:12.000Z"
}
}
{
"success": false,
"error": {
"code": "NO_INFRASTRUCTURE_FEES",
"message": "No infrastructure fee is payable on this market: 0.0 USDC has accrued, and the leg is booked only out of repaid interest and liquidation proceeds, so sweepInfrastructureFees would revert. Nothing to sign until interest is repaid or a liquidation settles."
}
}
