> ## Documentation Index
> Fetch the complete documentation index at: https://docs.passage.coinlist.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Ondo Swap

> Buy and sell tokenized stocks with Ondo. One prop switches direction, what each side approves, and the two-call order both share.

Ondo supplies **tokenized stocks** - `AAPLon`, `TSLAon` and the rest. An Ondo offer arrives with `type: "ondo::swap"` and runs both ways: a **buy** spends USDC to receive the tokenized asset, a **sell** delivers the asset and settles the proceeds in USDC.

> [!NOTE]
>
> **Recommended:** render [`CheckoutContainer`](https://docs.passage.coinlist.co/sdk/checkout). It detects `ondo::swap`, reads the direction from its `side` prop, and renders the whole flow. This page covers what is specific to Ondo, and the levels below the component.

Both directions are the same offer, the same contract, and the same two-call order. `offer.type` is `ondo::swap` whichever way the trade runs, because the side is a property of your page rather than of the catalog: the same asset is buyable and sellable at once.

## What Ondo needs from you

Nothing beyond the offer, a chain, your wallets, a direction and the option the user is ordering (`optionId`, required even on an offer with one option - see [Which option the order is for](#which-option-the-order-is-for)). There is no separate sell container, and no Ondo config is required - the `side` prop is what picks the flow:

```tsx theme={null}
"use client";

import {
  CheckoutContainer,
  type CheckoutWalletSelection,
} from "@passage-cl/react";
import type {
  OfferDetail,
  OfferOptionId,
  OrderBookSide,
} from "@passage-cl/react/universal";

export function OndoCheckout({
  offer,
  optionId,
  wallets,
  side,
}: {
  offer: OfferDetail;
  // The id of the offer option whose requirements your page showed.
  optionId: OfferOptionId;
  wallets: CheckoutWalletSelection;
  side: OrderBookSide;
}) {
  return (
    <CheckoutContainer
      // The side belongs in the key: the flow holds an approval granted for
      // whichever coin that side spends. So does the option the order is for.
      key={`${offer.id}:ethereum_mainnet:${side}:${optionId}`}
      offer={offer}
      chain="ethereum_mainnet"
      side={side}
      optionId={optionId}
      wallets={wallets}
    />
  );
}
```

That is the whole integration. `side` defaults to `"buy"`, so a buy page can leave it out and a sell page passes `side="sell"`. A page with a buy/sell toggle passes whatever the toggle selects, and puts it in the `key`.

`side` is a prop rather than something the offer says because no offer can answer it: `offer.type` is `ondo::swap` both ways. See [`side`: buy or sell](https://docs.passage.coinlist.co/sdk/checkout#side-buy-or-sell).

> [!WARNING]
>
> **`side` is read once, at mount.** The flow holds a committed quote and an approval granted for one specific token, so a re-render with a different `side` is ignored rather than obeyed. Remount with a `key` covering the offer, the chain, the side and the option, as above.

The SDK derives **Ondo's API symbol** (for example `AAPLon`) from `offer.asset.code`. That is the key of every Ondo request - the trading status, the price and both builds - and there is no setting to override it.

`config["ondo::swap"]` accepts one optional field, `onOrderConfirmed(order)`, fired once a swap has mined, either way. The confirmation dialog shows regardless; add it only if you want to navigate, refresh a portfolio, or log.

### Which option the order is for

Every Ondo order, buy or sell, names one of the offer's options (`offer.options`). The SDK sends that option's id with the order, and frontline runs that option's requirements before it builds the transaction. An offer can have several options, each with its own requirements and minimum, so the order has to say which one the user was shown.

`CheckoutContainer` reads the option from its `optionId` prop, and the prop is **required**, even on an offer with one option. The SDK never picks an option for you, because a default would break silently the day the offer gains a second one. If your page auto-selects an option, pick it yourself and pass its id.

An `optionId` the offer does not list (which includes any id on an offer with no options) replaces the flow with an "Option not available" screen (`reason: "unknown-option"`) and logs `checkout blocked` at `error`. The checkout sends no request, so the user never pays gas for an approval that frontline would then refuse.

On a buy, the amount step also checks the amount against that option's minimum purchase (`minimumPurchaseUsd`). A sell has no minimum.

```tsx theme={null}
"use client";

import {
  CheckoutContainer,
  type CheckoutWalletSelection,
} from "@passage-cl/react";
import type { OfferDetail, OfferOption } from "@passage-cl/react/universal";

export function OndoBuyForOption({
  offer,
  option,
  wallets,
}: {
  offer: OfferDetail;
  // One of offer.options: the option whose requirements your page showed.
  option: OfferOption;
  wallets: CheckoutWalletSelection;
}) {
  return (
    <CheckoutContainer
      key={`${offer.id}:ethereum_mainnet:buy:${option.id}`}
      offer={offer}
      chain="ethereum_mainnet"
      optionId={option.id}
      wallets={wallets}
    />
  );
}
```

Like `side`, `optionId` is read once, at mount: the amount step checked that option's minimum, and the order goes out under that option. To switch options, put the option in the `key`, as above.

> [!NOTE]
>
> **Quotes are priced against Ondo production whatever chain you pass**, because Ondo runs no sandbox. On a testnet the price is real and the money is not.

## Placing an order takes two calls

This is the one structural thing to know about Ondo, and it is the same both ways. An order is prepare then execute, not one call, and the split is where the trader's decisions are:

1. **`prepareBuy` / `prepareSell`** approves the swap contract to move the amount, then builds the transaction that moves it. The result is a **committed quote**: firm calldata with an `expiresAt`, valid for about a minute.
2. The trader reviews firm numbers - what goes, the fee, what arrives.
3. **`executeSwap`** broadcasts that calldata verbatim and waits for it to mine. It is one method for both directions, because broadcasting reads calldata and a deadline and knows about neither.

Bundling them behind one button would burn most of the transaction's \~60-second life on the approval and hand the trader an expired quote. The approval deliberately comes **first**: building first would spend an attestation on calldata that had already expired by the time they could act on it.

In `CheckoutContainer` the split maps onto the steps:

* **Confirming the amount** runs `prepareBuy` or `prepareSell`: the approval prompts, then the build. A failure shows beside the amount step's button. If the user has not met the option's requirements, it reads "Complete the requirements for this offer before placing an order." If the approval has not reached the build yet, it reads "Your approval has not landed yet. Please try again in a moment." A blocked wallet and any other failed build read "Could not get a quote for that amount. Please try again."
* **The review step** offers the committed quote for at most 15 seconds, or until its `expiresAt` if that comes sooner, with a countdown above the button. Once it runs out, **Place order** is disabled until the user picks **Refresh quote**, which builds a new transaction and spends another attestation. Nothing refreshes on a timer.
* **Place order** runs `executeSwap`. While the order is placing, the quote line is hidden: the order goes out against the numbers already signed, so there is nothing more to say about the quote until it settles.

The review step's disclaimer links Ondo's terms at `https://coinlist.co/terms/ondo`. The link is fixed, because the disclaimer names Ondo's terms specifically.

> [!WARNING]
>
> The builders spend an attestation on every call. The two reads - `getTradingStatus` and `getQuote` - are free to poll while the user sizes an order. Budget one build per order placed, plus one per refresh the user asks for.

> [!NOTE]
>
> **Buy and sell caps are independent.** `getTradingStatus` takes a required `side` and reports `tradable` with size limits for that side only. A working buy does not imply a working sell, and the market can be open one way and closed the other.

## When the market is closed

Ondo assets trade only while the market is open, and Ondo pauses briefly at every US session change (04:00 and 16:00 ET). While the trading status for the page's side reports `not-tradable`, the checkout replaces the flow with a "Trading is closed right now" screen and pauses the price poll. The trading-status poll keeps running underneath, so the checkout comes back by itself once the market opens. There is no retry button, because a retry before then fails the same way.

The screen appears only while the user is still on the step the flow opened on and no order dialog is showing. A market that closes later in the flow is reported by the step it interrupts.

At L1, `passage.ondo.getQuote` rejects a quote for a closed market with an `HttpError` (status 409, API code `not_tradable`). `isOndoNotTradableError(error)` from `@passage-cl/react/universal` recognizes it, so you can tell "wait for the market" apart from a failed request.

## What the two directions do not share

Only the transport is common. Beyond it, the amounts mean different things:

| | Buy | Sell |
| - | - | - |
| `amount` you pass | The **funding coin**, USDC, in its base units | The **asset**, in its base units |
| What gets approved | USDC on `chain` | The **asset** on `chain`, not a stablecoin |
| Where the token's address and decimals come from | `TOKEN_REGISTRY` | The sell quote, and nowhere else |
| What the response commits to | An exact quantity | A range: expected, with a floor beneath it |

The same integer means a different size on each side, so a size carried across a toggle is wrong by whatever the price is.

### Buying

The quantity is attested and exact, with no floor beneath it. The fee is **taken off the deposit rather than added on top**, so the approval never has to cover more than `spendInputAmount`.

> [!NOTE]
>
> **No CoinList fee is applied to a read quote, and no read discloses one.** Ondo prices exactly the amount passed, so sizing a quote against a user's approval without subtracting the fee first overstates what they receive.

### Selling

A sale is the mirror of a purchase: it approves the **asset** and receives USDC.

That matters because the SDK ships no registry entry for a provider's asset. `TOKEN_REGISTRY` knows the stablecoins swaps are funded with and nothing else, so on a sale:

* the **contract address** the balance is read on and the approval is granted for, and
* the **decimals** the typed amount is parsed at

both come off the sell quote (`OndoQuote.assetAddress`, `OndoQuote.asset.decimals`) and nowhere else. `useOndoSellCheckoutViewModel` does that resolution for you; a host composing its own viewmodel has to read the quote before it can read a balance.

The **settlement coin is USDC**, and it is display-only: the scale of every amount on a built sale comes off the response's `receive_output_decimals`, which is the only authority on how the proceeds are counted.

A built sale carries two figures rather than one. `expected` is what the sale should return; `minimum` is the floor the calldata enforces on chain. A fill below `minimum` reverts, so that - not `expected` - is what a seller is actually guaranteed. **Show both.**

### Skipping the wallet step

A sell page is usually reached from a position, and a position already names the wallet that holds it. Set [`CheckoutWalletSelection.preselected`](https://docs.passage.coinlist.co/sdk/wallets#skipping-the-wallet-step) and the checkout opens on the amount, renumbering the two cards that remain:

```ts theme={null}
import type { CheckoutWalletSelection } from "@passage-cl/react";

const wallets: CheckoutWalletSelection = {
  embedded,
  external,
  externalAdapter, // your connector, or null for embedded wallets only
  preselected: walletHoldingThePosition, // an EvmWallet, or null to let the user pick
};
```

The wallet does not have to appear in `embedded` or `external` - you supply a ready `EvmWallet` either way. Like `side`, it is read once at mount, so add `wallets.preselected?.address` to the `key` if it can change on one page.

Both directions honor `preselected`, so a buy page that already knows the wallet, such as a host with a single embedded wallet, can skip the step too. After an order, the flow resets to the amount step rather than to a wallet step it never had.

### When the wallet disconnects

The checkout holds the confirmed wallet by its address and looks it up in the `wallets` you pass on every render. A fresh `EvmWallet` object at the same address is picked up without any reset.

When you stop supplying a wallet at that address (the user disconnected it, or the external wallet switched accounts), the checkout reopens the wallet step with "Your wallet disconnected - reconnect or choose another." It waits until no step is busy: an approval or a swap the wallet is sending settles first, and after `swap-unconfirmed` the review step keeps its warning until the user leaves it.

A flow opened on `preselected` has no wallet step to go back to. Its next send fails and shows the same disconnected copy. Your `EvmWallet` reports a changed or disconnected account by throwing `WalletDisconnectedError` from `@passage-cl/react/universal`. See [Let wallet errors propagate](https://docs.passage.coinlist.co/sdk/wallets.md#let-wallet-errors-propagate).

### When the user signed in with their wallet

A user who signs in with their wallet rather than a CoinList login has a wallet session, which acts for one wallet on one chain. `CheckoutContainer` settles the session before it mounts either direction of the flow, and shows a skeleton until `PassageProvider` is ready. Then the first row that matches applies:

| Session | What the checkout does |
| - | - |
| No session, a CoinList login, or a session that failed to load | Opens as this page describes. |
| Wallet session on another chain than the checkout's | Signs the user out, then opens as for no session. |
| Wallet session, and the option has any requirement | Shows "Sign in to continue" and "This offer needs a CoinList account." |
| Wallet session, and `wallets.external` is `null` or a different address | Shows "Connect your wallet", naming the wallet the user signed in with. |
| Any other wallet session | Opens on the amount, paying from that wallet, with no wallet step. It sets `preselected` for you. |

Neither card has a button, so your page renders its own way forward.

The checkout applies these rows on every render. A new wallet session remounts it, with no `key` from you, and a `wallets.external` that stops being the session's wallet replaces it with the card.

If the option's requirements cannot be read, the checkout skips that row, and CoinList decides when the order is built: confirming the amount shows the requirements message above.

A wallet session cannot read offers in the browser, because `useOffers` and `useOfferDetails` need a CoinList user. Read the offer on your server and pass it in.

> [accordion] Build your own UI with hooks (L2)
>
> `useOndoBuyCheckoutViewModel` and `useOndoSellCheckoutViewModel` each wrap a whole flow - trading status, quotes, the wallet step, the approval, the review and the broadcast - and return `{ state, onEvent }`. They take the same options: `offer`, `chain`, `wallets`, `optionId`, `enabled?` and `onOrderConfirmed?`. `optionId` works as the `CheckoutContainer` prop does: it is required, even on an offer with one option, and it is read once.
>
> ```tsx theme={null}
> "use client";
>
> import {
>   useOndoSellCheckoutViewModel,
>   type CheckoutWalletSelection,
> } from "@passage-cl/react";
> import type {
>   OfferOptionId,
>   OndoSwapOfferDetail,
> } from "@passage-cl/react/universal";
>
> export function OndoSellCheckout({
>   offer,
>   optionId,
>   wallets,
> }: {
>   offer: OndoSwapOfferDetail;
>   optionId: OfferOptionId;
>   wallets: CheckoutWalletSelection;
> }) {
>   const { state, onEvent } = useOndoSellCheckoutViewModel({
>     offer,
>     chain: "ethereum_mainnet",
>     optionId,
>     wallets,
>   });
>
>   switch (state.type) {
>     case "error":
>       // state.reason: "unsupported-chain" | "unknown-option" | "not-tradable"
>       return <MyCheckoutUnavailable reason={state.reason} />;
>     case "content":
>       // state.wallet is null when `preselected` skipped the wallet step.
>       // state.amount, state.review, state.sidebar, state.orderConfirmed
>       return <MySellFlow state={state} onEvent={onEvent} />;
>     default: {
>       const exhaustive: never = state;
>       return exhaustive;
>     }
>   }
> }
> ```
>
> `OndoBuyCheckoutUiState` and `OndoSellCheckoutUiState` are both discriminated unions with a flow-level `error` arm, whose `reason` is one of:
>
> * **`unsupported-chain`**: the offer names no CoinList swap contract on the chain you passed. The viewmodel discovers that before any step runs, so nothing is fetched and no timer starts.
> * **`unknown-option`**: `optionId` names an option the offer does not show. The viewmodel settles this at mount too, so nothing is fetched, and only a new `optionId` (a remount) clears it.
> * **`not-tradable`**: the market is closed for this side, and the user is still on the step the flow opened on. The trading-status poll keeps running, so the state returns to `content` once the market opens.
>
> `switch` exhaustively and assign the `default` to `const exhaustive: never = state` so a new arm is a compile error rather than a blank screen.
>
> These viewmodels do not check the session, which `CheckoutContainer` does for you (see [When the user signed in with their wallet](#when-the-user-signed-in-with-their-wallet)). To run the same check over your own UI, call `useCheckoutSessionViewModel` (alpha) with `offer`, `optionId`, `chain`, and `wallets`, plus `enabled: false` while your UI is paused. Mount your viewmodel once its `state.type` is `open`, passing `state.wallets` and keying it by `state.session`.
>
> Inside the `content` arm of either flow, `wallet` is `null` exactly when the host preselected a wallet. That `null` is the whole skip - it is what you render nothing for, and the single fact both remaining step numbers derive from. The review step's `quote` is an `OndoQuoteStatusUi`, the same type on both sides: `valid` with a countdown label, `refreshing`, `expired`, `refresh-failed` with a message, or `placing`. The viewmodel reports `placing` exactly while the place-order button is loading. Render no quote line for it, and give it a case in any exhaustive `switch`.
>
> The step viewmodels are not exported. The data hooks the god viewmodels are built from are, so you can assemble your own viewmodel instead:
>
> | Hook | Returns | `enabled` |
> | - | - | - |
> | `useOndoTradingStatus` | Whether that side's market is open, and its caps. Takes `symbol` and `side`. Pass its state to `isNotTradable(state)` to read a closed market. | required |
> | `useOndoPrice` | A pollable read quote. Takes `symbol`, `side` and a size. | required |
> | `useOndoBuyTransaction` | The committed purchase for a request (`BuildOndoBuyParams`, `offerOptionId` included), with its expiry. Pass the transaction `prepareBuy` returned as `data` to adopt it without a second build. Never polls. | required |
> | `useOndoSellTransaction` | The committed sale for a request (`BuildOndoSellParams`, `offerOptionId` included), with its expiry. Same `data` seed. Never polls. | required |
> | `useErc20Balance` | The seller's balance of the asset, keyed by the address off the quote. | required |
>
> Each returns a `state` union of `DISABLED`, `LOADING`, `ERROR` and `CONTENT`. `DISABLED` means the hook is switched off with no answer in hand. On the Ondo hooks, a seed or an earlier answer survives being switched off. `useErc20Balance` drops its balance and reports `DISABLED` whenever it is switched off. An Ondo `ERROR` carries an `OndoLoadErrorReason`: `not-authenticated`, `generic-error` or `not-tradable`.
>
> `useErc20Balance` is the address-keyed counterpart to `useErc20TokenBalances`: a token whose contract address arrives at runtime has no registry symbol to look up, which is exactly the sell case. A `tokenAddress` of `null` fetches nothing, which is the normal state before the first quote lands.
>
> Every hook that fetches or polls takes `enabled`, and all of them must be called unconditionally. See [SDK structure](https://docs.passage.coinlist.co/sdk/structure.md#hooks) for the conventions they share.

> [accordion] Drive it yourself with the client (L1)
>
> `passage.ondo` is a plain namespace with no React. The reads and the two builders exist on both the browser client and `PassageServer`; the wallet-driven halves are client-only, because a backend has no wallet to sign with. The reads and builders take a CoinList login or a wallet session, and throw `NotAuthenticatedError` with neither. A wallet session builds only for its own wallet and chain: CoinList answers any other with a 403 `HttpError`, which `prepareBuy` and `prepareSell` report as `build-transaction`.
>
> | Method | Kind | Notes |
> | - | - | - |
> | `getTradingStatus(params)` | read | Free to poll. Requires `side`. Returns `tradable` with size caps, or `not-tradable`. |
> | `getQuote(params)` | read | Free to poll. Requires `side`. A sell quote carries `assetAddress` and the asset's decimals. Rejects with a 409 `HttpError` while the market is closed (`isOndoNotTradableError`). |
> | `buildBuyTransaction(params)` | write | Spends an attestation. Requires `offerOptionId`. `POST /v1/ondo/swap/buy`. |
> | `buildSellTransaction(params)` | write | Spends an attestation. Requires `offerOptionId`. `POST /v1/ondo/swap/sell`. |
> | `prepareBuy(params)` | client only | Approves the funding coin, then builds. Requires `offerOptionId`. Step-tagged result. |
> | `prepareSell(params)` | client only | Approves the asset, then builds. Requires `offerOptionId`. Step-tagged result. |
> | `executeSwap(params)` | client only | Broadcasts and confirms, either direction. Step-tagged result. |
>
> A purchase reads its token from the registry. A sale has to read the quote first, because that is the only place the asset's address and decimals are published:
>
> ```ts theme={null}
> // Selling. The quote is the only source of the asset's address and decimals,
> // so price one whole share first, then parse what the user typed.
> const quote = await passage.ondo.getQuote({
>   symbol: AssetSymbol("AAPLon"),
>   side: "sell",
>   tokenAmount: BlockchainAmount({ raw: 1n, decimals: AssetDecimals(0) }),
> });
>
> const parsed = parseBlockchainAmount(amountInput, quote.asset.decimals);
> if (!parsed.valid) return;
> const amount = parsed.amount;
>
> // The option whose requirements the user was shown. This offer has one;
> // on an offer with several, use the one your page displayed.
> const option = offer.options.length === 1 ? offer.options[0] : undefined;
> if (option === undefined) return;
>
> const prepared = await passage.ondo.prepareSell({
>   wallet,                                   // your EvmWallet
>   symbol: AssetSymbol("AAPLon"),            // Ondo's API symbol
>   chain: "ethereum_mainnet",
>   swapContracts: offer.swapContracts,       // the spender, resolved per chain
>   offerOptionId: option.id,                 // frontline runs this option's requirements
>   tokenAddress: quote.assetAddress,         // the ASSET, not a stablecoin
>   amount,                                   // BlockchainAmount, asset base units
>   onProgress: (phase) => setBusy(phase),
> });
>
> if (prepared.type === "error") {
>   // prepared.error.step: "unsupported-chain" | "allowance-check"
>   //   | "approval" | "approval-reverted" | "insufficient-allowance"
>   //   | "build-transaction" | "build-refused"
>   // On "build-refused", prepared.error.reason says why: "requirements-not-met"
>   return;
> }
>
> // prepared.transaction.expected  - what the sale should return
> // prepared.transaction.minimum   - the floor the calldata enforces
>
> const filled = await passage.ondo.executeSwap({
>   wallet,
>   transaction: prepared.transaction,
>   chain: "ethereum_mainnet",
>   onProgress: (phase) => setBusy(phase),
> });
>
> if (filled.type === "success") {
>   // filled.txHash, filled.transaction
> } else {
>   // filled.error.step: "quote-expired" | "swap" | "swap-unconfirmed"
>   //   | "swap-reverted"
> }
> ```
>
> `prepareBuy` is the same call with `tokenAddress` set to the funding coin and `amount` in its base units, and it needs no quote first.
>
> **`offerOptionId` is required on all four order methods** - `prepareBuy`, `prepareSell`, `buildBuyTransaction` and `buildSellTransaction` - and the SDK sends it to frontline as `offer_option_id`. Take it from `offer.options`: it must be the id of the option whose requirements the user was shown. Frontline runs that option's requirements before it builds. The field is required even on an offer with one option, so that you cannot forget it on an offer with several, where frontline refuses to pick one for you. `prepareBuy` and `prepareSell` send it with the build, which comes after the approval: frontline refuses an id that the offer does not list, so the prepare methods report `build-transaction` after the user has already paid gas for the approval. Check the id against `offer.options` before you call them.
>
> Both flows are **total**: every failure comes back step-tagged rather than thrown, so you map each one to your own copy. `prepareBuy` and `prepareSell` return the same `OndoSwapPreparationError` - every arm names a *remedy*, and an unsupported chain or a refused approval is fixed the same way whichever token was being approved.
>
> **Preparation phases**, in order. An allowance that already covers the order skips the approval phases:
>
> `checking-allowance` → *(`resetting-allowance` (wallet popup) → `confirming-allowance-reset`, only for stale non-zero allowances)* → **`approving`** *(wallet popup)* → `confirming-approval` → `building-transaction`
>
> **`executeSwap` phases**: **`broadcasting-swap`** *(wallet popup)* → `confirming-swap`
>
> Four error steps are worth calling out:
>
> * **`insufficient-allowance`** is separated from the generic build failure because it has a remedy. Reaching it means the approval that just mined is not the one the backend sees, usually an RPC node a block behind. That is a **retry**, not a re-approval.
> * **`build-refused`** means CoinList declined to build for a reason the user can act on, so retrying fails the same way until they do. Its `reason` is an `OndoSwapRefusal`, whose one value is `requirements-not-met`: the user has not completed the requirements of the option `offerOptionId` names. It arrives after the approval, which stays mined. A blocked wallet has no error code, so it stays `build-transaction`. Called directly, `buildBuyTransaction` and `buildSellTransaction` reject with an `HttpError` instead (status 422, API code `requirements_not_met`).
> * **`quote-expired`** is a refusal to broadcast rather than a failed broadcast. It would revert on-chain and cost the trader gas, and it is fixed by building a fresh transaction.
> * **`swap-unconfirmed`** means the swap was sent but waiting for its receipt failed. It may still mine, so placing the order again could fill it twice. The error carries the `txHash`: look it up before doing anything else. `swap`, by contrast, means the wallet never sent it, so placing again is safe. Its `cause` is a `WalletError`: a swap that reverts at gas estimation, before the wallet sends it, is `{ type: "contract_reverted", reason }`, with the contract's revert reason where it gave one. The SDK's review step disables its button after `swap-unconfirmed` until the user leaves the step, with "Your order was sent but has not confirmed yet. Check your wallet before placing another."
>
> `executeSwap` broadcasts the calldata **verbatim**. Never re-encode it: the contract verifies a signature over the exact arguments inside.

## Which contract the trader approves

The ERC-20 spender comes off the offer, not from a constant in the SDK, and it works the same way on both sides. `OndoSwapOfferDetail.swapContracts` lists every chain the offer can be swapped on with the CoinList contract each settles through, and `swapSpender` reads one out:

```ts theme={null}
import { swapSpender } from "@passage-cl/react/universal";

const spender = swapSpender(offer.swapContracts, chain); // EvmContractAddress | null
```

`null` means this offer cannot be swapped on that chain - an answer, not an error. `CheckoutContainer` and both Ondo viewmodels check it before anything runs and render a flow-level `error` state with `reason: "unsupported-chain"`, so no wallet picker, balance read or price poll happens on a chain the order could never settle on.

> [!NOTE]
>
> The address varies by **environment** as well as by chain, which is why one constant could not express it: beta and production both run `ethereum_sepolia` and deploy a different contract on each. `ondoSwapContractAddress(chain)` was removed in v0.12.0 for that reason.

## Next steps

> [card] [Building the Checkout flow](https://docs.passage.coinlist.co/sdk/checkout.md)
>
> The recommended path: one container for every provider, and both directions.

> [card] [Wallets](https://docs.passage.coinlist.co/sdk/wallets.md)
>
> The `EvmWallet` seam, and `preselected` for skipping the wallet step.

> [card] [Superstate Swap](https://docs.passage.coinlist.co/sdk/swap-flow.md)
>
> The other swap provider, and what it needs from you.

> [card] [Errors and edge cases](https://docs.passage.coinlist.co/sdk/errors.md)
>
> Every error shape the flows return, and how to handle it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.