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

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

```
GET https://docs.opinion.trade/developer-guide/opinion-clob-python-sdk/builder-mode/enable-trading.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.
