> ## 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.

# CoinList Token Sale

> CoinList token sales: the SDK's token-sale checkout, recording a participation with passage.tokenSale.execute, and tracking participations afterwards.

CoinList supplies its own **token sales**. An offer arrives with `type: "coinlist::token_sale"`, and the user commits a stablecoin to buy into it. During the flow the user signs an ERC-20 `approve` to the sale's funding contract, and the SDK records a **participation** against that approval. CoinList takes it from there on its own clock: it verifies the approval, pulls the payment through the allowance in a batch, and allocates tokens and refunds any excess when the sale settles.

> [!NOTE]
>
> **Recommended:** render [`CheckoutContainer`](https://docs.passage.coinlist.co/sdk/checkout). It routes on `offer.type`, so your integration handles every provider without knowing which one an offer belongs to.

## What the token sale needs from you

**Nothing.** Since v0.13.0 `CheckoutContainer` mounts the SDK's own token-sale checkout (it used to hand this branch back to you through a required `render` slot, which is gone). The funding contract, the coins and the price are all read off the offer, so the `"coinlist::token_sale"` config entry is optional and takes one listener, `onOrderPlaced`, fired once the participation is recorded. The dialog shows either way. Which option the user buys is the `optionId` prop. It is required, and since v0.16.0 the SDK never picks an option for you: pass the id of the `OfferOption` the user chose from `offer.options`.

```tsx theme={null}
import { type CheckoutConfig, CheckoutContainer } from "@passage-cl/react";

const config: CheckoutConfig = {
  "coinlist::token_sale": {
    onOrderPlaced: (order) =>
      console.log("Participation recorded", order.participation.id),
  },
};

export function TokenSaleCheckout() {
  return (
    <CheckoutContainer
      key={`${offer.id}:${chain}:${optionId}`}
      offer={offer}
      chain={chain}
      optionId={optionId}
      wallets={wallets}
      config={config}
    />
  );
}
```

`optionId` is read **once, at mount**, so put it in the `key` if the user can switch options on one page. Do the same for `chain`, because changing it in place is unsupported. The token-sale entry and `useCoinListTokenSaleCheckoutViewModel` are `@alpha`: public, but outside the compatibility contract.

The checkout runs three steps:

1. **Wallet** - the shared wallet step. It is skipped when you set `wallets.preselected` (see [Wallets](https://docs.passage.coinlist.co/sdk/wallets.md#skipping-the-wallet-step)).
2. **Amount** - entered in USD and paid 1:1 in a stablecoin from the offer's funding assets that the SDK can pay with on the chain: USDC, USDT, or USDZ (CoinList's test dollar, on Ethereum Sepolia only), with balances and a Max button. It is checked against the option's minimum, and blocked outside the sale window, with a message that the sale has not opened or has ended. The sale panel beside the steps counts down to the start.
3. **Review** - estimated tokens at the option's price, price per token, the receiving wallet and the total. The disclaimer links the option's sale agreement.

Placing the order runs `passage.tokenSale.execute`. On success the **Order placed** dialog opens, the steps reset, and `onOrderPlaced` is called with the wallet, amount, coin, participation, and approval hash. The quantity shown is an estimate: the sale decides each allocation when it settles.

If the approval mines but the participation fails to record, **Place order** records it again against that approval, with no second wallet prompt. Going back to an earlier step drops the approval, because a new amount needs one of its own.

If your app stops supplying the wallet the user confirmed on the wallet step (it disconnected, or switched to another account), the checkout returns to the wallet step with "Your wallet disconnected - reconnect or choose another." It waits until no order is being placed. A checkout opened on `wallets.preselected` has no wallet step to return to, so it shows that message only when a wallet prompt fails.

A sale that cannot take an order on the checkout's chain renders an unavailable screen in place of the steps. Each reason is a misconfiguration of the offer or of your props, so the checkout also logs `checkout blocked` with the reason once, at `error`, through your `Config.logger`:

| Reason | When |
| - | - |
| `unsupported-chain` | The offer names no funding contract on `chain`. |
| `unknown-option` | `optionId` is not one of the offer's options. |
| `no-price` | The option has no fixed price, such as an auction, or its price is malformed or zero. Only fixed-price options can be bought. |
| `no-payable-asset` | None of the offer's funding assets is a coin the SDK can pay with on `chain`. |

> [!NOTE]
>
> The funding contract comes from the offer: `CoinListTokenSaleOfferDetail.fundingContracts`, one `{ chain, address }` per chain, mapped from the API's `funding_contracts`. An offer payload without that key fails mapping with a `ValidationError`. An empty list is valid and means the sale takes no orders anywhere.

The checkout does not check requirements such as KYC. Gate the page on [`RequirementsChecklistContainer`](https://docs.passage.coinlist.co/sdk/requirements) first, as for every other checkout.

It does not check the session either, and a token sale needs a CoinList user. So don't render it on a wallet session (a user signed in with their wallet instead of a CoinList login, where `usePassage().authState.signInMethod.method` is `"wallet"`). There, placing the order fails, at the latest when it records the participation, after the wallet has approved.

## Prerequisites

* Completed [OAuth](https://docs.passage.coinlist.co/sdk/oauth-authentication.md) with a working `PassageProvider`
* A token-sale `OfferDetail` (`CoinListTokenSaleOfferDetail`) and the `OfferOption` the user picked (from [Display offer details](https://docs.passage.coinlist.co/sdk/sale-details.md))
* A wallet integration exposed as an `EvmWallet`. The partner demo uses [wagmi](https://wagmi.sh/) + [Reown AppKit](https://reown.com/appkit); any stack that can send transactions works. The adapter is the same one every flow uses - see [Wallets](https://docs.passage.coinlist.co/sdk/wallets.md).

```bash theme={null}
npm install @passage-cl/react wagmi @wagmi/core viem @reown/appkit @reown/appkit-adapter-wagmi @tanstack/react-query
```

> [accordion] Build your own UI with hooks (L2)
>
> `useCoinListTokenSaleCheckoutViewModel({ offer, chain, optionId, wallets, enabled?, onOrderPlaced? })` drives the whole checkout above and returns `{ state, onEvent }`. Call it behind your own markup when you want the SDK's logic and state but not its UI. `state` is `{ type: "error", reason }` for a sale that cannot take an order (the reasons in the table above), or `{ type: "content" }` with `wallet` (`null` when the wallet step was skipped), `amount`, `review`, `sidebar`, and `orderPlaced` slices.
>
> For reading what the user already bought, `useCoinListTokenSaleParticipations` is the data hook - see [Track participations](#track-participations) below. `useErc20TokenBalances` reads the user's stablecoin balances.
>
> For a buy flow of your own without the viewmodel, drive `passage.tokenSale.execute` from your component state. It is a single call that returns a step-tagged result, so there is little to hold beyond the amount and the current phase. The L1 walkthrough below shows exactly that.

> [accordion] Drive it yourself with the client (L1)
>
> `passage.tokenSale` runs the whole flow end-to-end: it resolves the funding contract and the coin from the offer, reads the allowance, submits the ERC-20 `approve`, and records the participation, so you do not hand-roll the on-chain plumbing.
>
> ### Flow at a glance
>
> ```mermaid theme={null}
> flowchart LR
>   connect[connect_wallet]
>   idle[enter_amount]
>   investing[investing]
>   success[success]
>   error[error]
>
>   connect -->|wallet connected| idle
>   idle -->|user confirms amount| investing
>   investing -->|approve mined + recorded| success
>   investing -->|rejected / reverted| error
>   error -->|retry| idle
> ```
>
> 1. **connect\_wallet** - your wallet UI; the SDK only needs the connected account.
>
> 2. **enter\_amount** - the user picks a coin the offer accepts (`offerDetail.fundingAssets`) and enters an amount.
>
> 3. **investing** - `passage.tokenSale.execute` reads the allowance, runs the ERC-20 approval, and records the participation, reporting progress phases.
>
> 4. **success / error** - show the recorded participation, or a readable error.
>
> > [!NOTE]
> >
> > Unlike a Superstate swap, a token sale needs **no wallet allowlisting step** - there's no ownership challenge to sign. The user only signs the ERC-20 `approve`. CoinList moves the payment afterwards, through that allowance.
>
> ### Step 1: Pin the sale parameters
>
> Keep the chain and the coin in one place. `TOKEN_REGISTRY` knows the ERC-20 metadata and per-chain address for USDC, USDT, and USDZ. USDZ is CoinList's test dollar and exists on Ethereum Sepolia only: `TOKEN_REGISTRY.usdzAddress(chain)` returns `null` on every other chain. The funding contract is not a constant: `execute` reads it off the offer.
>
> ```ts constants.ts theme={null}
> import {
>   type EthereumChain,
>   TOKEN_REGISTRY,
>   USDC_SYMBOL,
> } from "@passage-cl/react/universal";
>
> export const SALE_CHAIN: EthereumChain = "ethereum_sepolia";
>
> // The stablecoin the user pays with (USDC, 6 decimals). It must be one of the
> // offer's funding assets.
> export const PAYMENT_ASSET = USDC_SYMBOL;
> export const PAYMENT_TOKEN = TOKEN_REGISTRY.erc20(PAYMENT_ASSET);
>
> // BCP-47 locale used for amount formatting.
> export const LOCALE = "en-US";
> ```
>
> > [!NOTE]
> >
> > This page runs on **Sepolia**. To move to mainnet, set `SALE_CHAIN` to `"ethereum_mainnet"`. The offer must name a funding contract on that chain, or `execute` refuses with `unsupported-chain` - `TOKEN_REGISTRY` already knows the mainnet USDC/USDT addresses.
>
> ### Step 2: Bring your wallet
>
> The token-sale flow drives **any** wallet through the same `EvmWallet` interface as every other flow. It only ever calls `address`, `writeContract`, and `awaitTx` - there is no message to sign - so an adapter you already wrote works unchanged.
>
> > [card] [Wallets: the EvmWallet seam](https://docs.passage.coinlist.co/sdk/wallets.md)
> >
> > The five members, the wagmi + AppKit adapter, and how wallet errors are classified.
>
> ```ts theme={null}
> import { buildEvmWallet } from "./wagmiEvmWallet";
> ```
>
> ### Step 3: Execute the sale
>
> `passage.tokenSale.execute` runs the whole on-chain sequence and returns a discriminated result. It never throws. Pass the offer itself: the funding contract, the coin's token address, and its asset id are all read off it. The `amount` is a `BlockchainAmount` in the coin's base units - parse the user's input with `parseBlockchainAmount`.
>
> ```tsx theme={null}
> const parsed = parseBlockchainAmount(amountInput, PAYMENT_TOKEN.decimals);
> if (!parsed.valid || parsed.amount.raw <= 0n) return;
>
> const result = await passage.tokenSale.execute({
>   wallet,
>   offer: offerDetail,     // the CoinListTokenSaleOfferDetail
>   optionId: option.id,    // the OfferOption the user picked
>   chain: SALE_CHAIN,
>   inputAsset: PAYMENT_ASSET,
>   amount: parsed.amount,
>   onProgress: (phase) => setBusy(phase),
> });
>
> if (result.type === "success") {
>   // result: participation, approvalTxHash
>   const explorerUrl = txExplorerUrl(SALE_CHAIN, result.approvalTxHash);
> } else {
>   // result.error.step: "unsupported-chain" | "unsupported-asset" | "unknown-option"
>   //   | "allowance-check" | "allowance-reset" | "allowance-reset-reverted"
>   //   | "approval" | "approval-reverted" | "participation"
>   setError("The investment did not go through.");
> }
> ```
>
> The first three steps are refusals before the wallet is asked for anything: the offer names no funding contract on the chain, does not accept the coin there, or has no option with that id.
>
> `allowance-reset` and `approval` carry a `cause` of type `WalletError`. A `cause` of `{ type: "disconnected" }` means the wallet is no longer connected, or no longer on the account its `address` names, so nothing was sent: ask the user to reconnect or choose another wallet rather than retry. Your `EvmWallet` reports this by throwing `WalletDisconnectedError` from `@passage-cl/react/universal`; an EIP-1193 `4100` error and wagmi's `ConnectorNotConnectedError` count the same. See [Wallets](https://docs.passage.coinlist.co/sdk/wallets.md).
>
> Phases (wallet popups marked):
>
> `checking-allowance` → *(`resetting-allowance` → `confirming-allowance-reset`, only when the wallet already holds a non-zero allowance)* → **`approving`** *(wallet popup)* → `confirming-approval` → `recording-participation`
>
> The reset, when it runs, is a transaction of its own and opens a wallet popup too.
>
> > [!NOTE]
> >
> > An `approve` is submitted on **every** participation, even when the existing allowance already covers the amount: the backend requires a fresh approval transaction hash and verifies it on-chain before recording. When the wallet already holds a non-zero allowance for the funding contract, `execute` first resets it to zero in a transaction of its own, whatever the coin, because USDT-style tokens reject a non-zero to non-zero `approve`. A failure there is reported as `allowance-reset` or `allowance-reset-reverted`, distinct from the main approval's `approval` and `approval-reverted`, so you can tell which of the two prompts failed.
>
> When recording fails after the approval mined (`error.step === "participation"`), the error carries the `approvalTxHash`. Retry against it with `approval: { type: "mined", txHash }`: `execute` then skips straight to `recording-participation` and asks the wallet for nothing. Use it only for the same amount, since a new amount needs a new approval.
>
> ```tsx theme={null}
> const retry = await passage.tokenSale.execute({
>   wallet,
>   offer: offerDetail,
>   optionId: option.id,
>   chain: SALE_CHAIN,
>   inputAsset: PAYMENT_ASSET,
>   amount: committedAmount,
>   approval: { type: "mined", txHash: approvalTxHash },
> });
> ```
>
> ### Putting it together
>
> A complete, minimal invest component. It reuses `constants.ts` (Step 1) and the `buildEvmWallet` adapter from [Wallets](https://docs.passage.coinlist.co/sdk/wallets.md). When recording fails after the approval mined, it keeps the approval hash and retries against it, until the user changes the amount.
>
> ```tsx MinimalInvest.tsx theme={null}
> "use client";
>
> import {
>   type TokenSaleExecutionPhase,
>   usePassage,
> } from "@passage-cl/react";
> import {
>   type CoinListTokenSaleOfferDetail,
>   EvmWalletAddress,
>   formatAmount,
>   type OfferOption,
>   parseBlockchainAmount,
>   txExplorerUrl,
> } from "@passage-cl/react/universal";
> import { useAppKit, useAppKitAccount } from "@reown/appkit/react";
> import { useState } from "react";
> import type { Hash } from "viem";
> import { useConfig, useWalletClient } from "wagmi";
> import { LOCALE, PAYMENT_ASSET, PAYMENT_TOKEN, SALE_CHAIN } from "./constants";
> import { buildEvmWallet } from "./wagmiEvmWallet";
>
> const GENERIC_ERROR = "Something went wrong. Please try again.";
>
> export function MinimalInvest({
>   offer,
>   option,
> }: {
>   offer: CoinListTokenSaleOfferDetail;
>   option: OfferOption;
> }) {
>   const { passage, isReady } = usePassage();
>   const { open } = useAppKit();
>   const { address, isConnected } = useAppKitAccount();
>   const { data: walletClient } = useWalletClient();
>   const config = useConfig();
>
>   const [amountInput, setAmountInput] = useState("");
>   const [busy, setBusy] = useState<TokenSaleExecutionPhase | null>(null);
>   const [error, setError] = useState<string | null>(null);
>   // An approval that mined for this amount while recording failed.
>   const [minedApproval, setMinedApproval] = useState<Hash | null>(null);
>   const [confirmed, setConfirmed] = useState<{ explorerUrl: string } | null>(
>     null,
>   );
>
>   const parsed = parseBlockchainAmount(amountInput, PAYMENT_TOKEN.decimals);
>   const hasAmount = parsed.valid && parsed.amount.raw > 0n;
>
>   const handleInvest = async () => {
>     if (!isReady || !walletClient || !address || !parsed.valid || !hasAmount) {
>       return;
>     }
>     setError(null);
>     try {
>       const wallet = buildEvmWallet({
>         address: EvmWalletAddress(address),
>         walletClient,
>         config,
>       });
>       const result = await passage.tokenSale.execute({
>         wallet,
>         offer,
>         optionId: option.id,
>         chain: SALE_CHAIN,
>         inputAsset: PAYMENT_ASSET,
>         amount: parsed.amount,
>         approval:
>           minedApproval === null
>             ? { type: "fresh" }
>             : { type: "mined", txHash: minedApproval },
>         onProgress: setBusy,
>       });
>       if (result.type === "success") {
>         setConfirmed({
>           explorerUrl: txExplorerUrl(SALE_CHAIN, result.approvalTxHash),
>         });
>       } else if (result.error.step === "participation") {
>         setMinedApproval(result.error.approvalTxHash);
>         setError("Your approval went through, but recording failed. Try again.");
>       } else {
>         setError(GENERIC_ERROR);
>       }
>     } catch {
>       setError(GENERIC_ERROR);
>     } finally {
>       setBusy(null);
>     }
>   };
>
>   if (confirmed) {
>     return (
>       <div>
>         <h3>Order placed</h3>
>         <p>Your participation in {offer.name} is being processed.</p>
>         <a href={confirmed.explorerUrl} target="_blank" rel="noreferrer">
>           View approval transaction
>         </a>
>       </div>
>     );
>   }
>
>   if (!isConnected || !address) {
>     return <button onClick={() => open()}>Connect wallet</button>;
>   }
>
>   return (
>     <div>
>       <input
>         inputMode="decimal"
>         placeholder={`Amount in ${PAYMENT_TOKEN.symbol}`}
>         value={amountInput}
>         onChange={(e) => {
>           if (e.target.value === "" || /^\d*\.?\d*$/.test(e.target.value)) {
>             setAmountInput(e.target.value);
>             // A new amount needs a new approval.
>             setMinedApproval(null);
>           }
>         }}
>       />
>
>       {parsed.valid && hasAmount && (
>         <p>
>           You invest {formatAmount(parsed.amount, LOCALE)} {PAYMENT_TOKEN.symbol}
>         </p>
>       )}
>
>       <button
>         onClick={handleInvest}
>         disabled={!isReady || !walletClient || !hasAmount || busy !== null}
>       >
>         Invest
>       </button>
>
>       {busy && <p>{investPhaseLabel(busy)}</p>}
>       {error && <p role="alert">{error}</p>}
>     </div>
>   );
> }
>
> function investPhaseLabel(phase: TokenSaleExecutionPhase): string {
>   switch (phase) {
>     case "resetting-allowance":
>       return `Reset your ${PAYMENT_TOKEN.symbol} allowance in your wallet…`;
>     case "approving":
>       return `Approve ${PAYMENT_TOKEN.symbol} in your wallet…`;
>     case "recording-participation":
>       return "Recording your participation…";
>     default:
>       return "Working…";
>   }
> }
> ```
>
> ### Going further
>
> * **Show the user's balance** - `passage.erc20.getBalance({ tokenAddress, owner, chain })` reads the connected wallet's balance for a payment token, so you can validate the amount or render a Max button before investing. `useErc20TokenBalances({ address, chain, assets, enabled })` is the polling hook form; it returns `{ state }`, whose `CONTENT` arm carries a `balances` map.
> * **Lower-level control** - if you drive the ERC-20 `approve` yourself (a custom wallet, batching, a different confirmation UX), skip `passage.tokenSale.execute` and record the participation directly with `passage.tokenSale.createParticipation`, passing the `approvalTransactionHash` you obtained. The spender is the offer's funding contract on your chain, from `offer.fundingContracts`. `execute` is the batteries-included version of exactly that sequence.

## Track participations

A **participation** is the record CoinList keeps of a user taking part in a token sale. It moves through its statuses on the backend's clock - `prepared` → `pending` → `submitted` → `completed` as the approval is verified and the payment committed, then `remit_submitted` → `remitted` when the sale settles and refunds what the allocation did not use (`failed` and `remit_failed` are the failure states). None of it is pushed to the SDK.

> [!NOTE]
>
> To show participations without building any UI, render `ClaimContainer` (`@alpha`) with the token-sale offer in its `offers` prop. It lists every participation the user placed in that offer, across its options and paying wallets, newest first, and polls like the hook below. Nothing is claimed: the sale pushes the tokens and the refund itself, so its only action is a retry after a load error. It renders nothing for a signed-out user or a wallet session. It still takes the required `wallets` prop, but a token sale's list covers the whole account, so the card reads no wallet.
>
> Since v0.16.0 `offers` takes one offer or a list (it was `offer`, one offer). A list can mix token sales and Centrifuge vaults: they share one "Your orders" card, with vault rows first, then every sale's participations newest first. The card answers for every offer or none: one error with one **Please try again** link if any read fails, and a loader until all have answered. On a wallet session a token sale adds no rows, so a mixed list shows its vault rows only. `useClaimViewModel` is the viewmodel behind it, and replaces `useCoinListTokenSaleClaimViewModel`, which is gone.

### Recommended: useCoinListTokenSaleParticipations

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

import { useCoinListTokenSaleParticipations } from "@passage-cl/react";
import type { OfferId } from "@passage-cl/react/universal";

export function Participations({ offerId }: { offerId?: OfferId }) {
  const { participationsState, refetch } =
    useCoinListTokenSaleParticipations(offerId);

  switch (participationsState.type) {
    case "DISABLED":
      return null;
    case "LOADING":
      return <p>Loading…</p>;
    case "ERROR":
      // reason: "not-authenticated" | "generic-error"
      return (
        <p role="alert">
          Could not load participations ({participationsState.reason}).{" "}
          <button onClick={refetch}>Try again</button>
        </p>
      );
    case "CONTENT":
      return (
        <ul>
          {participationsState.participations.map((participation) => (
            <li key={participation.id}>
              {participation.displayAmount} {participation.asset.code} -{" "}
              {participation.status}
            </li>
          ))}
        </ul>
      );
    default: {
      const exhaustive: never = participationsState;
      return exhaustive;
    }
  }
}
```

The first argument is optional: omit it to list every participation for the signed-in user, pass one `OfferId` for one offer, or pass a list of ids (since v0.16.0). A list is read offer by offer, in parallel, and the results arrive as one flat list once every offer has answered. Any offer's read failing fails that read for the whole list. The read is keyed by the ids, so a new array of the same ids on each render does not refetch. The hook was `useParticipations` before v0.13.0. It now:

* **Polls** `passage.tokenSale.list` (once per offer) every 15 seconds while the page is visible, and reads once more when the page becomes visible again. Pass `pollInterval` (a `Seconds`) to change the interval. That is also how an order placed through `CheckoutContainer` on the same page appears, with nothing for you to wire.
* **Keeps the list on a failed poll.** A failed tick with a list in hand stays `CONTENT`, so `ERROR` means no list has arrived yet. A `not-authenticated` failure is the exception: it drops the list and reports `ERROR`. A wallet session always reports it.
* **Reports `DISABLED`** when `enabled: false` is set before any read has answered. A list already in hand survives being switched off.
* **Returns `refetch()`**, which reads again now (a no-op while disabled).

Pass `data` to seed it with participations pre-fetched via `PassageServer#tokenSale.list()`. The seed opens the state and skips only the first client-side read; the poll and `refetch` still read. See [SDK structure](https://docs.passage.coinlist.co/sdk/structure.md#hooks).

### Reading and writing imperatively

`passage.tokenSale` is available on both the browser client and `PassageServer`, except `execute`, which needs a wallet.

| Method | Returns |
| - | - |
| `list(offerId?)` | Every participation, auto-paginating. Optionally scoped to one offer. |
| `listPage(params)` | One page, when you implement your own pagination. |
| `get(id)` | A single participation. |
| `createParticipation(params)` | Records a participation. Requires the hash of the ERC-20 approval you submitted first. |
| `execute(params)` | Client only. Approves and records in one call. |

```ts theme={null}
const existing = await passage.tokenSale.list(offerId);

const created = await passage.tokenSale.createParticipation({
  offerId,
  offerOptionId,
  chain: "ethereum_mainnet",
  walletAddress,                  // an EvmWalletAddress
  amount: "1000.00",              // decimal token amount, not base units
  assetId,
  approvalTransactionHash,        // required; verified on-chain before recording
});
```

`createParticipation` takes the same `EthereumChain` and `EvmWalletAddress` as every other flow. The `Blockchain` and `WalletAddress` types it took before v0.13.0 are gone. On the way back, a `Participation`'s `chain` is a `Chain`, or `null` for a chain the SDK does not model, and its `walletAddress` is an `EvmWalletAddress` or `null`.

> [!NOTE]
>
> `amount` is a **decimal token amount** (`"100"` for 100 USDC), not raw base units. The SDK maps the camelCase keys to the API's snake\_case fields; see the [API reference](https://docs.passage.coinlist.co/api-reference) for the raw request and response schema.

Every method except `execute` requires a CoinList user and throws `NotAuthenticatedError` otherwise, on a wallet session too. `execute` never throws: without a CoinList user, it returns an error step instead. That step can be `participation`, after the wallet has already approved, because recording is the first step that needs a CoinList user.

## Common questions

> [accordion] Why an approve instead of a transfer?
>
> CoinList moves the payment itself, after on-chain verification. The user only signs an allowance up to the amount they want to invest, and nothing leaves their wallet during the flow. CoinList then verifies the approval and pulls the payment through the allowance into the sale's funding contract in a batch, usually within a minute or so. That lets CoinList check every participation before it commits the payment, and batch the transfers.

> [accordion] Why is an approval always submitted?
>
> The backend hard-requires an approval transaction hash on every participation and verifies that exact transaction on-chain (sender, token, spender, and approved amount) before confirming. A participation recorded without a fresh approval always fails, so `passage.tokenSale.execute` submits one even when the standing allowance already covers the amount - the allowance read only decides whether a reset-to-zero is needed first.

> [accordion] Do I need wagmi / Reown AppKit specifically?
>
> No. Anything implementing the `EvmWallet` interface works - viem directly, Privy, ethers with a thin adapter. The token-sale flow only calls `address`, `writeContract`, and `awaitTx`; it never sees your wallet library. It's the same `EvmWallet` every other flow uses.

> [accordion] What if recording fails after the approval mined?
>
> The error comes back as `{ step: "participation", approvalTxHash }`. The approval is already on-chain, so call `passage.tokenSale.execute` again with `approval: { type: "mined", txHash: approvalTxHash }` and the same amount, rather than re-running the whole flow - the user doesn't need to approve again.

> [accordion] What about chains other than Ethereum?
>
> The flow generalizes: the same `EvmWallet` adapter maps each `EthereumChain` to a network, `TOKEN_REGISTRY` knows the payment-token addresses per chain, and the offer's `fundingContracts` names the chains a sale takes orders on. Your account manager will confirm which chains and assets are enabled for your offers.

## Next step

> [card] [Building the Checkout flow](https://docs.passage.coinlist.co/sdk/checkout.md)
>
> The recommended path: one container that renders whichever provider an offer belongs to.


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