> For the complete documentation index, see [llms.txt](https://docs.synfutures.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.synfutures.com/rwa-trading-apis/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](/rwa-trading-apis/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
  }
}
```

> The live `signPayload.types` also contains an `EIP712Domain` entry (omitted above for brevity). **ethers** ignores it — pass only `{ Delegate: ... }` as shown below. **viem** derives the domain itself and *throws* if `EIP712Domain` is present in `types`, so strip it first (see [guides/demo-code.md](/rwa-trading-apis/guides/demo-code.md)).

## 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](/rwa-trading-apis/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 by asking a question.

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

```
GET https://docs.synfutures.com/rwa-trading-apis/trading/one-click-delegated.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.
