operatedBy. Show the operator wherever you show the vault. The operator manages its vault in the Issuer Portal, not on this API. That covers creating a vault or vault group, allocating into markets, setting a draw cap, pausing deposits and managing roles.
trusset.lending.vaults covers reading vaults, depositing, redeeming and the distributor fees. Every write follows the signing model.
Find a vault
list returns your instance’s vaults first, then every vault published on your network and environment, then unpublished vaults in which your instance is a distributor of record. Each row carries an onChain block, so a directory can show share price and size without a call per vault.
get adds a holder’s position when you name a wallet in address. On a vault your instance operates it also carries the operator’s view in implementation, jitLiquidity and roles.
sharePrice is an 18-decimal string whatever the asset’s decimals. Every other amount in the block is formatted at assetDecimals. Size a redemption against redeemableNow, not against idleAssets: it adds what each funded market has free to the vault’s idle funds.
The smaller reads answer one question each:
transactions returns the full ledger. On another operator’s vault it returns one wallet’s own deposits and redemptions plus the vault’s market losses, and address names that wallet. Without it, the list on someone else’s vault is empty rather than an error. limit runs from 1 to 200.
Deposit
The depositor signs an approval on the vault’s asset, then the deposit, and receives shares at the current share price. When a market the vault funded wrote off accrual the vault has not recorded, onerecordMarketLoss step per such market comes first, and any wallet may sign those. With { signer } the SDK fills holderAddress from the signer.
DEPOSITOR_NOT_VERIFIED naming the register that refused, and against its balance, with INSUFFICIENT_BALANCE. The vault enforces its registers on chain either way.
Show the attribution before the depositor signs
The instance whose API key builds a holder’s first attributed deposit becomes that holder’s distributor. The vault binds the holder once and never rebinds it, and credits the distributor a share of the interest the holder’s shares earn. Prepare the deposit to read what it will do:
Show
attribution.warning before the depositor signs. The binding follows the wallet that signs, so name the signing wallet as holderAddress.
When a vault refuses deposits
Four refusals are about the vault rather than the depositor, and none affects redemptions.VAULT_BOOK_INCOMPLETE means a funded market is not answering, so the vault cannot total its book. VAULT_WIPED_OUT means shares are in issue against assets totalling zero. VAULT_MARKET_IMPAIRED means a funded market carries a loan below its liquidation threshold or seized debt awaiting sale. VAULT_RECOVERY_PENDING means the vault wrote off a market that answers again, and the value that can come back belongs to the holders who bore the loss.
Deposit into a vault group
A vault group is one product with two to four currency pockets, each a vault holding one settlement token. A deposit goes into one pocket and stays in its currency. Name the pocket by exactly one ofcurrency and asset; the SDK refuses both or neither before any request.
currency matches a pocket’s asset symbol first, such as USDC, then its settlement currency, such as USD. Two pockets in the same currency make a currency ambiguous, which answers GROUP_CURRENCY_AMBIGUOUS; name the asset then. The deposit is confirmed on the pocket, so to confirm one you broadcast yourself, pass the pocket’s vaultId from the prepared plan:
Redeem
The holder signs one transaction, with no approval, and the payout goes to the signing wallet. Nothing can pause a redemption. Prepare it first to read the fill estimate:shares is parsed at the vault’s asset decimals. The confirmed amount comes from the vault’s Redeemed event and is what was actually paid, so compare it with the value of the shares to detect a partial fill. Without a signer, holderAddress is required, because the vault burns that wallet’s own shares.
Collect and pay distributor fees
Each market sets aside a distributor share of the interest borrowers repay. The vault’s slice waits on each market until someone collects it. Collecting pays nobody out: the vault credits the part earned by attributed shares to their distributors, and the rest to the operator. Two payouts follow.earnings shows where your instance stands: what it was paid, what the vault holds for it, and each market’s waiting claim. Every amount is { raw, value }.
collectDistributorFees collects one market at a time, and answers NOTHING_ACCRUED when the market holds nothing for the vault. With { signer } the SDK names the signer as signerAddress, and the API simulates the collection from it first. payDistributor pays your instance’s distributor wallet unless distributor names another of your verified wallets. The instance that operates the vault may pay any distributor, which still pays that distributor’s own payout wallet.
The operator’s own credit, earned by shares no distributor brought, goes to the vault’s fee recipient. Only the instance that operates the vault can build this call.
recordMarketLoss step per such market. The SDK signs them in order and confirms with the last step.
Move a payout wallet
Only the distributor’s current payout wallet can sign. Until it is first moved, that is the distributor address itself. Holders stay bound to the distributor; only the destination of its fees moves.{ signer } the SDK names the signer as signerAddress, and the API refuses with NOT_DISTRIBUTOR_WALLET unless it is the current payout wallet.
Approve a distributor
On the current vault implementation a deposit can bind a new holder only to the vault owner or to a distributor the operator approved. Only the vault owner can sign, and only the instance that operates the vault can build the call. Withdrawing an approval stops new bindings only: holders already bound stay bound.distributor and approved come from the vault’s DistributorApprovalSet event, so they state what the chain recorded.
