Read positions
id (the on-chain index — feeds manage builds), a globally-unique positionId, collateral/debt, current vs. liquidation LTV, leverage, net USD value, and live APY.
Build a manage/close transaction
Actions
The response is the same
{ approvals, tx, meta } bundle — sign it the same way. Re-read positions after the transaction confirms to refresh your UI.
Exit health — surface it to your users
Each position carriesexitLiquidity, measured against its full unwind notional (closing swaps all the collateral, not just equity):
exceedsCleanExitSize: true means a close will slip — a market can be deep while that specific position is larger than the depth that exits cleanly.
Users are never trapped. A one-shot
close needs a live swap route and fails closed if it’s gone. But repay (paying in the loan token) and remove_collateral need no swap at all — repay the debt, then withdraw the collateral in-kind. Build that path into your UI as the fallback, and use exceedsCleanExitSize to prompt users to unwind early.