Skip to content
Termbook
App integrations

Exit & recovery

Describe the next safe step, including cancellations and delayed withdrawals.

On this page

exit.next(context)

The exit context includes the account snapshot, slippage policy and a minimum_receive helper. The integration chooses the next bounded step. It must support ordinary closure and keeper recovery without requiring fresh cooperation from the borrower.

PluginExit
type ExitResult =
  | { status: "execute"; step_id: string; plan: PluginPlan }
  | { status: "wait"; tracking_id: string; retry_at: number }
  | { status: "blocked"; reason: string }
  | { status: "done" };

Choose the next step

StateNext step
Resting or partially filled ordersRequest cancellation, then reconcile the final fill and refund.
Delayed redemption or unstakeWait for the existing request; do not submit a duplicate.
Open positionClose, redeem or withdraw using an admitted recovery call.
Non-settlement holdingsExecute a protected conversion into the House settlement asset.
No app obligationsReturn done; facility repayment and safe closure continue separately.

step_id identifies the chosen operation at the observed state. retry_at is a Unix timestamp. blocked needs an actionable reason such as recovery-liquidity-unavailable.

Required checks

  • The destination stays under Credit Account or settlement-inbox control.
  • Output minima and input maxima are bound to the approved recovery policy.
  • Unknown liabilities or positions prevent done.
  • A request and the position it replaces are not counted twice.
  • Only admitted dust can remain; token balances cannot be discarded arbitrarily.
  • After each step, reread and verify state before advancing.
Documentation
8 results

Let’s talk

Tell us what you have in mind.

Supply liquidity