> For the complete documentation index, see [llms.txt](https://polydash.gitbook.io/polydash-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://polydash.gitbook.io/polydash-docs/agents-and-api/trading-endpoints.md).

# Trading and commitment endpoints

These endpoints return unsigned transactions for actions on an existing launch. They use the same signing model as launches: you sign and broadcast with your own wallet.

## Shared request fields

| Field         | Meaning                                                                                                                       |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `token`       | Launch or token address (required)                                                                                            |
| `from`        | Wallet that will sign. Simulation runs from this address (required)                                                           |
| `amount`      | Decimal base-unit string. Meaning depends on the endpoint                                                                     |
| `slippageBps` | Integer basis points for buy and sell. Default 100, maximum 5,000. `minAmountOut = amountOut x (10000 - slippageBps) / 10000` |

## Endpoints

| Endpoint                       | `amount`                      | Notes                                                                                                                             |
| ------------------------------ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `POST /tx/buy`                 | ETH to spend, in wei          | Sent as `value`                                                                                                                   |
| `POST /tx/sell`                | Tokens to sell, in base units | Returns an exact approve step before the sell when needed                                                                         |
| `POST /tx/commit`              | ETH to commit, in wei         | Minimum 100000000000000 (0.0001 ETH). Only during a commitment window                                                             |
| `POST /tx/uncommit`            | none                          | Full uncommit while the window is open                                                                                            |
| `POST /tx/withdraw-commitment` | none                          | Withdraw an unprocessed commitment                                                                                                |
| `POST /tx/claim-refund`        | none                          | Claim a refund                                                                                                                    |
| `POST /tx/claim-fees`          | none                          | `from` must be the launch creator. After graduation, new creator fees accrue in the hook pool and are claimed from the token page |

## Example: buy

```bash
curl -s https://polypad.family/api/agents/v1/tx/buy \
  -H 'content-type: application/json' \
  -d '{
    "token": "0xLAUNCH_OR_TOKEN_ADDRESS",
    "from": "0xYOUR_SIGNER_ADDRESS",
    "amount": "1000000000000000",
    "slippageBps": 100
  }'
```

## Response shape

| Field          | Meaning                                                                              |
| -------------- | ------------------------------------------------------------------------------------ |
| `ok`           | Boolean                                                                              |
| `chainId`      | 4663                                                                                 |
| `action`       | The action name                                                                      |
| `token`        | Token summary                                                                        |
| `transactions` | List of `{step, kind, description, chainId, from, to, data, value, gas, simulated}`  |
| `quote`        | For buy and sell: `amountIn`, `amountOut`, `minAmountOut`, `slippageBps`, and `fees` |
| `simulation`   | `{success, gas}` or `{success: false, reason}`                                       |
| `signing`      | A reminder to sign each transaction in order with your own wallet                    |
| `custody`      | `non-custodial`                                                                      |

Step 1 of each list is simulated with `eth_call` from the `from` address. Later steps, such as a sell after an approval, are marked `simulated: false` and must be sent after the earlier steps confirm. `gas` is an estimate multiplied by 1.2.

## Quote

```bash
curl -s "https://polypad.family/api/agents/v1/quote?token=0xLAUNCH_OR_TOKEN_ADDRESS&side=buy&amount=1000000000000000"
```

Returns `amountIn`, `amountOut`, the fee breakdown in wei, and the token summary. A quote is a reading at one moment. It is not a promise of what a later trade will receive.

## Risks

Curve prices move. Slippage settings limit a single trade. They do not limit loss. The contracts are **Not audited.**


---

# 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://polydash.gitbook.io/polydash-docs/agents-and-api/trading-endpoints.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.
