> For the complete documentation index, see [llms.txt](https://docs.anchored.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.anchored.finance/trading-api/trading/one-click-delegated.md).

# One Click Delegated

One Click lets the server submit transactions via an authorized proxy wallet. Required before calling any `/send` endpoint.

For user-facing safety copy, signer checks, and delegation UX, read [one-click-security-ux.md](/trading-api/trading/one-click-security-ux.md).

## Query status

```
GET /api/v1/1ct/status
```

| Field       | Type   | Description                |
| ----------- | ------ | -------------------------- |
| `status`    | string | `/send` requires `enable`. |
| `delegatee` | string | Proxy wallet address.      |

## Prepare EIP-712 payload

```
POST /api/v1/1ct/prepare
```

| Field      | Type   | Required | Description                        |
| ---------- | ------ | -------- | ---------------------------------- |
| `deadline` | number | Yes      | Signature deadline (Unix seconds). |

Response `data`:

| Field         | Type   | Description         |
| ------------- | ------ | ------------------- |
| `delegatee`   | string | Proxy address.      |
| `signPayload` | object | EIP-712 typed data. |
| `nonce`       | number | Delegate nonce.     |
| `deadline`    | number | Same as request.    |

Example `signPayload`:

```json
{
  "domain": {
    "name": "OneClickRouter",
    "version": "1",
    "chainId": 10143,
    "verifyingContract": "0x..."
  },
  "types": {
    "Delegate": [
      { "name": "user", "type": "address" },
      { "name": "delegatee", "type": "address" },
      { "name": "nonce", "type": "uint64" },
      { "name": "deadline", "type": "uint32" }
    ]
  },
  "primaryType": "Delegate",
  "message": {
    "user": "0x...",
    "delegatee": "0x...",
    "nonce": 0,
    "deadline": 1893456000
  }
}
```

## Enable

```
POST /api/v1/1ct/enable
```

| Field       | Type   | Required | Description                                  |
| ----------- | ------ | -------- | -------------------------------------------- |
| `signature` | string | Yes      | 65-byte hex EIP-712 signature (`0x` prefix). |
| `deadline`  | number | Yes      | Must match `/prepare` response.              |

### ethers v6 signing

```js
import { Wallet } from "ethers";

const { signPayload, deadline } = prepareResponse.data;
const wallet = new Wallet(process.env.USER_PRIVATE_KEY);

if (wallet.address.toLowerCase() !== signPayload.message.user.toLowerCase()) {
  throw new Error("signer address must match signPayload.message.user");
}

const signature = await wallet.signTypedData(
  { ...signPayload.domain, chainId: BigInt(signPayload.domain.chainId) },
  { Delegate: signPayload.types.Delegate },
  {
    ...signPayload.message,
    nonce: BigInt(signPayload.message.nonce),
    deadline: BigInt(signPayload.message.deadline),
  }
);
```

## Disable

```
POST /api/v1/1ct/disable
```

No body. Use empty string for HMAC `RAW_BODY`.

## Send endpoints after enable

| Operation                | Endpoint                           | Method |
| ------------------------ | ---------------------------------- | ------ |
| Place order              | `/api/v1/orders/send`              | POST   |
| Place order with deposit | `/api/v1/orders/with-deposit/send` | POST   |
| Cancel order             | `/api/v1/orders/{orderId}/send`    | DELETE |
| Cash deposit             | `/api/v1/cash/deposits/send`       | POST   |
| Cash withdrawal          | `/api/v1/cash/withdrawals/send`    | POST   |
| Stock deposit            | `/api/v1/stock/deposits/send`      | POST   |
| Stock withdrawal         | `/api/v1/stock/withdrawals/send`   | POST   |

Flow: build calldata internally → submit via One Click → auto-record tx on success.

See [guides/one-click-flow.md](/trading-api/guides/one-click-flow.md).


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.anchored.finance/trading-api/trading/one-click-delegated.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
