Skip to main content
closePlan returns the whole plan for an account without building a transaction. Use it to show the user what will happen, and to stop early when something cannot close safely.

Response

  • status: the plan’s state.
  • blockers: positions or steps that cannot be closed safely, each with a plain-language message. A blocked step is never silently skipped, so surface every blocker to the user.
  • decisionPoints: choices the user must make. Call closePlan again with decisions filled in. Each carries a default, which is advisory: nothing is applied for an unanswered decision, and closeTransactions refuses it with needs_decisions. Non-convertible assets carry an empty default; a convertible asset still defaults to converting. No decision ever recommends returning an asset to its issuer, and a failed route lookup is reported as the retryable blocker route_lookup_unavailable, not as an asset with no route. A convertible classic asset’s subject.quote (ClassicConversionQuote) holds estimatedReceive and minAmountOut, both in stroops of XLM, priced at the balance the step will move. It is display data: pass a floor you showed the user as the convert answer’s params.minAmountOut, and the build refuses a route that no longer clears it. quote is absent when no route exists, and for a balance a position’s exit has yet to pay in.
  • A Soroban token’s subject.quote adds priceImpactBps (null when it could not be measured), flags (TokenQuoteFlag[]) and, when both swap providers answered, runnerUp. A flagged conversion (high_impact above 5%, impact_unknown, or provider_disagreement above 10%) is offered without recommended and is not the default. To convert it, also answer its conversion_impact:<contract> decision with acknowledged and the same params.minAmountOut as the convert answer; until then the plan carries the blocker conversion_impact_not_acknowledged. closeTransactions does not re-check that confirmation: the floor you pin is what bounds the swap. A token with no quote carries subject.reason (TokenUnquotedReason): quote_limit, provider_unavailable (plan again in a moment), no_route or metadata_unreadable.
  • estimate: the fee in stroops and the reserve XLM freed.
  • execution: the estimated transaction count and a breakdown per transaction.
  • planHash: identifies the plan: a hash of the source, the destination, the answers and the account’s sequence number. Pass it back as planHash on the first closeTransactions call after the user reviews this plan, with the same answers. If the sequence has moved or the answers differ, that call answers 409 state_changed instead of building. A change by someone else that leaves the sequence alone, such as an incoming payment, a filled offer or a new claimable balance, does not change the hash; the round’s own check of every entry against the ledger, and your verify, bound what such a change can do.
The plan is a preview. closeTransactions re-reads live on-chain state and re-derives the work, so run it only after the user has reviewed the plan.