Intent Lifecycle
SW4P uses one shared intent model for routes that extend beyond the narrower helper corridor. An intent is submitted once, quoted once, and then moves through a solver auction and settlement lifecycle.
Lifecycle States
The backend state machine in sw4p-backend/src/intent.rs exposes these states:
| State | Meaning |
|---|---|
INTENT_SUBMITTED | Intent accepted before quote persistence is complete. |
AUCTION_OPEN | Solver auction is open and the house filler baseline exists. |
INTENT_QUOTING | A quote is being prepared or refreshed. |
INTENT_QUOTED | A quote exists and can still be cancelled or escalated. |
INTENT_FILLING | The winning filler is executing the fill. |
INTENT_FILLED | Fill execution completed and settlement handoff is ready. |
INTENT_SETTLING | The settlement path is running. |
INTENT_SETTLED | Settlement finished but final completion handling may still be in flight. |
INTENT_COMPLETED | Terminal success. |
INTENT_EXPIRED | Auction or fill deadline expired. |
INTENT_FAILED | Terminal failure. |
INTENT_CANCELLED | User-initiated cancellation before irreversible execution. |
Canonical Flow
- Client calls
submitIntent(). - Backend validates the request and persists the quoted intent.
- Route planning picks the baseline route description and fee model.
- If solver auctions are enabled, the backend opens an auction and transitions
the intent to
AUCTION_OPEN. - The house filler baseline quote is published to the auction book.
- External solvers can connect to
/sdk/v2/auctions/feed, authenticate, and receive auction events. - External solvers can submit better quotes through the auction API.
- When the auction closes, the best quote wins. If no external quote beats the baseline, the house filler wins.
- The winning filler executes the fill and confirms it.
- Settlement completes and the intent reaches
INTENT_COMPLETED,INTENT_FAILED, orINTENT_EXPIRED.
What Builders Should Poll
- Use
getIntentStatus()as the canonical status surface. - Treat
stateas the durable lifecycle field. - Use
quote,fill_tx_hash,settlement_tx_hash, andoutput_amountas supporting evidence, not as substitutes for state transitions.
Cancellation Rules
Not every state is cancellable. The backend explicitly treats
INTENT_SUBMITTED, AUCTION_OPEN, INTENT_QUOTING, and INTENT_QUOTED as
cancellable states. Once the intent is filling or settling, cancellation is no
longer a safe assumption.
Operator Note
Operator visibility for auctions lives in: