> ## Documentation Index
> Fetch the complete documentation index at: https://pond.dflow.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Equity Transaction Flow

> How a tokenized equity trade moves from order to settlement

Tokenized equities trade through the same [`/order`](https://pond.dflow.net/resources/trading-api/order/order) endpoint as crypto. DFlow requests quotes from market makers, picks the best one, and returns a transaction for the user to sign. What happens after the user signs depends on the quote's **fill mechanism**.

## Overview

```mermaid theme={null}
sequenceDiagram
  participant App
  participant DFlow
  participant MM as Market Makers

  App->>DFlow: Request /equities
  DFlow-->>App: Equity mints
  App->>DFlow: Request /order
  DFlow->>MM: Request quotes
  MM-->>DFlow: Quotes, each with its fill mechanism
  DFlow->>DFlow: Pick the best quote
  Note over DFlow: The winning quote's fill mechanism<br/>decides what happens next
  DFlow-->>App: Transaction to sign
  App->>App: User signs
```

1. The app gets tradable equities from [`/equities`](https://pond.dflow.net/resources/trading-api/equities/equities).
2. The app requests an order from `/order` with the equity mint as the input or output mint.
3. DFlow requests quotes from market makers. DFlow accepts quotes from multiple makers when they exist.
4. DFlow picks the best quote and returns a transaction for the user to sign.
5. The user signs.

Each quote names the way the maker will fill the trade: a **direct fill** or an **escrow fill**.

* A **direct fill** settles the trade in one transaction. When the response has `submitEndpointRequired: true`, the market maker co-signs after the user and submits it.
* An **escrow fill** settles the trade in two transactions. The user's first transaction opens an escrow, an onchain account that stays open until the maker fills or cancels. The market maker then delivers the equities in a second transaction, which closes the escrow.

A trade can fill in full or in part under either one.

## Direct Fill

When the response has `submitEndpointRequired: true`, the app returns the user's signed transaction to the [submit transaction endpoint](https://pond.dflow.net/resources/equities-submit-api/submit-transaction.md), and DFlow forwards it to the maker. Before signing, the maker does a **last look**: a final check that the price still holds. If it does, the maker co-signs and submits. If it does not, the maker rejects and nothing is submitted.

```mermaid theme={null}
sequenceDiagram
  participant App
  participant DFlow
  participant MM as Market Maker
  participant Chain as Solana

  App->>DFlow: Return signed transaction<br/>(/submit-transaction)
  DFlow->>MM: Forward signed transaction
  MM->>MM: Last look: check the price still holds
  alt If the maker accepts
    rect rgba(90, 140, 255, 0.16)
      MM->>Chain: Co-sign and submit
      Note over Chain: Swap settles, in full or in part
      DFlow-->>App: Result
    end
  else If the maker rejects
    rect rgba(205, 170, 110, 0.28)
      MM-->>DFlow: Reject
      DFlow-->>App: Error
    end
  end
```

Because the maker submits the transaction, the app does not send it to a Solana RPC. [Submit Equity Transactions](https://pond.dflow.net/equities/orders.md#submit-equity-transactions) covers which responses use the endpoint.

## Escrow Fill

The app submits the first transaction itself, which opens the escrow. The maker buys the equities offchain, then fills the escrow in the second transaction, which sends the equities to the user. If the maker cannot fill, it cancels the escrow instead.

```mermaid theme={null}
sequenceDiagram
  participant App
  participant MM as Market Maker
  participant Chain as Solana

  App->>Chain: Submit transaction
  Note over Chain: Opens an escrow
  App->>Chain: Watch the escrow account
  MM->>MM: Buy the equities offchain
  alt If the maker fills
    rect rgba(90, 140, 255, 0.16)
      MM->>Chain: Fill: equities to the user, escrow closes
      Note over Chain: Fills in full or in part
    end
  else If the maker cancels
    rect rgba(205, 170, 110, 0.28)
      MM->>Chain: Cancel the escrow
    end
  end
```

To see whether the escrow fills, cancels, or expires, the app watches for transactions involving the escrow account. See [Detecting Escrow Fill Outcomes](https://pond.dflow.net/equities/onchain-fill-parsing.md#detecting-escrow-fill-outcomes).
