Skip to main content
Version: 2.0.4

Order lifecycle

Understanding the lifecycle of an order is critical for developers integrating with Garden protocol. This page outlines the various states an order (or intent) can go through during the swap process, helping you manage integration logic effectively. For a high-level explanation of the order flow, refer to the intent flow.

An order's lifecycle starts when a user creates an intent to swap assets and continues through matching, execution, and final settlement. Each stage is tracked programmatically using the OrderStatus and SwapStatus enums. To track the current status of an order, refer to get order for SDK implementations or orderbook API for API-based integrations.

Order states

The tables below classify all the order statuses, providing descriptions and the corresponding actions. The Actions column is particularly useful for API integrators, detailing the steps they need to implement for each state. For SDK implementations, these actions are already handled, so the information serves as a reference to understand the underlying process.

Order creation and matching

StatusDescriptionAction
CreatedThe order is created and waiting for a solver to match.--
MatchedA solver has matched the order.The user has to initiate the transaction on their source chain.

Settlement: User and solver execution

StatusDescriptionAction
InitiateDetectedThe user’s initiation transaction is detected on-chain but not confirmed yet.--
InitiatedThe user’s initiation is confirmed. The solver must now initiate the transaction on the destination chain.Wait for the solver to initiate.
CounterPartyInitiateDetectedThe solver’s initiation transaction is detected on-chain but not confirmed.--
CounterPartyInitiatedThe solver’s initiation is confirmed, and the user must redeem their funds on the destination chain.The user has to redeem their funds.

Redemption and completion

StatusDescriptionAction
RedeemDetectedThe user’s redeem transaction is detected on-chain but not confirmed yet.--
RedeemedThe user has redeemed their funds. The solver will now redeem their funds on the source chain.--
CounterPartyRedeemDetectedThe solver’s redeem transaction is detected on-chain but not confirmed.--
CounterPartyRedeemed / CompletedThe solver has redeemed their funds, marking the entire order as completed.--

Exceptional and failure states

StatusDescriptionAction
CounterPartySwapExpiredThe solver’s HTLC has expired.The user must wait for their HTLC to expire to claim a refund.
ExpiredThe user’s HTLC has expired.The user has to refund their funds.
RefundDetectedThe user’s refund transaction is detected on-chain but not confirmed.--
RefundedThe user’s refund is confirmed, and they have reclaimed their funds.--
DeadLineExceeded1. Initiate transaction is not detected within 1 hour. 2. Initiate transaction is not confirmed within 12 hours.--

Swap states

Each swap (user or solver side) transitions through the following states:

StatusDescription
IdleThe swap is not yet initiated.
InitiateDetectedInitiation transaction is detected but not confirmed.
InitiatedThe initiation transaction is confirmed.
RedeemDetectedRedemption transaction is detected but not confirmed.
RedeemedRedemption transaction is confirmed.
RefundDetectedRefund transaction is detected but not confirmed.
RefundedRefund transaction is confirmed.
ExpiredThe swap expired, and a refund is required.