> For the complete documentation index, see [llms.txt](https://docs.opinion.trade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opinion.trade/developer-guide/opinion-clob-typescript-sdk/builder-mode/place-order.md).

# Place Order

> Submit a signed order on behalf of a user.

## Usage (Recommended)

Use `placeOrderForUserFromBuildResult()` with the output from `buildOrderForSigning()`:

```typescript
import { BuilderClient, OrderSide, OrderType } from '@opinion-labs/opinion-clob-sdk';

const builder = new BuilderClient({
  host: 'https://openapi.opinion.trade/openapi',
  builderApiKey: 'YOUR_BUILDER_KEY',
  chainId: 56,
});

// Step 1: Build the order
const orderData = await builder.buildOrderForSigning({
  marketId: 123,
  tokenId: 'token_id',
  userWalletAddress: safeAddress,
  side: OrderSide.BUY,
  orderType: OrderType.LIMIT_ORDER,
  amount: 10,
  price: '0.5',
  signerAddress: userEOA,
});

// Step 2: User signs the struct hash
const signature = await user.signHash(orderData.structHash);

// Step 3: Place the order (convenience method)
const result = await builder.placeOrderForUserFromBuildResult(
  orderData,
  signature,
  safeAddress,
);
```

## Convenience Method

```typescript
async placeOrderForUserFromBuildResult(
  buildResult: BuildOrderResult,
  signature: string,
  userWalletAddress: string,
): Promise<Record<string, unknown>>
```

| Parameter           | Type             | Required | Description                                           |
| ------------------- | ---------------- | -------- | ----------------------------------------------------- |
| `buildResult`       | BuildOrderResult | Yes      | Result from `buildOrderForSigning()`                  |
| `signature`         | string           | Yes      | User's signature (0x-prefixed hex string)             |
| `userWalletAddress` | string           | Yes      | User's Safe wallet address (must match `order.maker`) |

## Full Method

For advanced use cases, you can call `placeOrderForUser()` directly:

```typescript
const result = await builder.placeOrderForUser({
  order: orderData.order,
  signature: signature,
  userWalletAddress: safeAddress,
  marketId: orderData.marketId,
  orderType: orderData.orderType,
  price: orderData.price,
  currencyAddress: orderData.currencyAddress,
});
```

| Parameter           | Type                    | Required | Description                                           |
| ------------------- | ----------------------- | -------- | ----------------------------------------------------- |
| `order`             | Record\<string, string> | Yes      | Order struct from `buildOrderForSigning()`            |
| `signature`         | string                  | Yes      | User's signature (0x-prefixed hex string)             |
| `userWalletAddress` | string                  | Yes      | User's Safe wallet address (must match `order.maker`) |
| `marketId`          | number                  | No       | Market ID                                             |
| `orderType`         | number                  | No       | Order type (1=market, 2=limit)                        |
| `price`             | string                  | No       | Order price                                           |
| `currencyAddress`   | string                  | No       | Quote token address                                   |

## Notes

* The convenience method `placeOrderForUserFromBuildResult()` is recommended. It automatically extracts `marketId`, `orderType`, `price`, and `currencyAddress` from the build result.
* The `order.maker` must match `userWalletAddress` or the request will be rejected.
* The signature must be a hex string starting with `0x`.
* Order placement is gasless (counts toward the 2,000/day limit).


---

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

```
GET https://docs.opinion.trade/developer-guide/opinion-clob-typescript-sdk/builder-mode/place-order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
