> For the complete documentation index, see [llms.txt](https://niftix.gitbook.io/niftix-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://niftix.gitbook.io/niftix-docs/welcome/how-it-works.md).

# How Niftix works

Niftix uses a Solana **escrow program**. Assets sit in a program-controlled vault until both sides are deposited and the swap is executed.

```mermaid
flowchart LR
  A[Create offer] --> B[Creator deposits]
  B --> C[Awaiting counterparty]
  C --> D[Counterparty accepts + deposits]
  D --> E[Execute / settle]
  E --> F[Completed]
  C --> X[Cancel or expire]
  D --> X
  X --> Y[Withdraw if needed]
```

## Lifecycle

1. **Create** — You define offering assets, requested assets, visibility, and expiry.
2. **Deposit (creator)** — Your offering assets move into escrow (usually in the same transaction as create).
3. **Awaiting counterparty** — The offer is live for others (or a private receiver / link).
4. **Accept & deposit** — The other trader deposits the requesting side.
5. **Execute** — Assets settle to each wallet. Often batched with accept for simple SOL/NFT offers.
6. **Done** — Status becomes completed. Fees (if any) are taken from SOL legs at execute.

## Status labels you may see

| Status                | Meaning                                               |
| --------------------- | ----------------------------------------------------- |
| Awaiting counterparty | Creator deposited; waiting for someone to accept      |
| Ready                 | Both sides deposited; settlement pending or available |
| Completed             | Swap executed on-chain                                |
| Cancelled             | Creator cancelled before the counterparty deposited   |
| Expired               | Past expiry; recovery / withdraw rules apply          |

## Buttons on the swap page

| Button                 | When you see it                                    |
| ---------------------- | -------------------------------------------------- |
| **Accept & Deposit**   | Eligible counterparty; offer still awaiting accept |
| **Execute Swap**       | Both sides ready; settle if not already batched    |
| **Cancel Offer**       | Creator, until the counterparty deposits           |
| **Expire Offer**       | After deadline, participant-driven expire          |
| **Withdraw My Assets** | Recover deposits after cancel / expire             |

## Why Phantom may show “net” SOL

Accept often runs **accept + deposit + execute** together. Phantom’s balance change is **net** for the whole transaction (what you send minus what you receive), not only the “Requesting” amount. Advanced may show Niftix instructions as **Unknown** if the wallet has not indexed the program IDL.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://niftix.gitbook.io/niftix-docs/welcome/how-it-works.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
