> 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-python-sdk/builder-mode/enable-trading.md).

# Enable Trading

> Build, sign, and submit an Enable Trading transaction for a user's Safe wallet.

Enable Trading is a one-time setup that approves the CTF Exchange and ConditionalTokens contracts to spend the user's quote tokens. Without this, the user cannot place orders.

## Usage

```python
# Step 1: Build the transaction
tx_result = builder.build_enable_trading_tx(safe_address)

# Step 2: User signs the EIP-712 data
signature = user.sign_typed_data(tx_result["eip712_data"])

# Step 3: Submit to backend for relay
result = builder.submit_safe_tx(
    wallet_address=user_address,      # User's EOA address
    safe_tx_result=tx_result,
    signature=signature,
)
```

## Parameters

### `build_enable_trading_tx()`

| Parameter      | Type | Required | Description                                                                 |
| -------------- | ---- | -------- | --------------------------------------------------------------------------- |
| `safe_address` | str  | Yes      | User's Safe wallet address                                                  |
| `quote_tokens` | dict | No       | `{token_address: ctf_exchange_address}`. If not provided, fetched from API. |

### `submit_safe_tx()`

| Parameter        | Type | Required | Description                             |
| ---------------- | ---- | -------- | --------------------------------------- |
| `wallet_address` | str  | Yes      | User's EOA wallet address (Safe owner)  |
| `safe_tx_result` | dict | Yes      | Result from `build_enable_trading_tx()` |
| `signature`      | str  | Yes      | User's signature on the EIP-712 data    |

## Response

`build_enable_trading_tx()` returns:

```python
{
    "safe_tx": <SafeTx>,             # SafeTx object
    "eip712_data": { ... },          # EIP-712 structured data for user signing
    "safe_tx_hash": "0xabcdef...",   # Hash of the Safe transaction
    "submission_data_template": { ... },
}
```

`submit_safe_tx()` returns the API response dict.

## Notes

* Requires `rpc_url` to be set in the `BuilderClient` constructor.
* This only needs to be done **once per user**. Check `get_user()["enable_trading"]` before calling.
* The backend relays the transaction on-chain; no gas is needed from the user.
* On-chain confirmation takes approximately 30-60 seconds after submission.
* Safe TX signing uses `user.sign_typed_data(eip712_data)`, which is different from order signing (`user.sign_hash(struct_hash)`).


---

# 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.opinion.trade/developer-guide/opinion-clob-python-sdk/builder-mode/enable-trading.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.
