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-languagemessage. A blocked step is never silently skipped, so surface every blocker to the user.decisionPoints: choices the user must make. CallclosePlanagain withdecisionsfilled in. Each carries adefault, which is advisory: nothing is applied for an unanswered decision, andcloseTransactionsrefuses it withneeds_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 blockerroute_lookup_unavailable, not as an asset with no route. A convertible classic asset’ssubject.quote(ClassicConversionQuote) holdsestimatedReceiveandminAmountOut, 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’sparams.minAmountOut, and the build refuses a route that no longer clears it.quoteis absent when no route exists, and for a balance a position’s exit has yet to pay in.- A Soroban token’s
subject.quoteaddspriceImpactBps(null when it could not be measured),flags(TokenQuoteFlag[]) and, when both swap providers answered,runnerUp. A flagged conversion (high_impactabove 5%,impact_unknown, orprovider_disagreementabove 10%) is offered withoutrecommendedand is not the default. To convert it, also answer itsconversion_impact:<contract>decision withacknowledgedand the sameparams.minAmountOutas the convert answer; until then the plan carries the blockerconversion_impact_not_acknowledged.closeTransactionsdoes not re-check that confirmation: the floor you pin is what bounds the swap. A token with no quote carriessubject.reason(TokenUnquotedReason):quote_limit,provider_unavailable(plan again in a moment),no_routeormetadata_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 asplanHashon the firstcloseTransactionscall after the user reviews this plan, with the same answers. If the sequence has moved or the answers differ, that call answers409 state_changedinstead 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 yourverify, bound what such a change can do.
closeTransactions re-reads live on-chain state and re-derives the work, so run it only after the user has reviewed the plan.