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
# 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()
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()
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:
submit_safe_tx() returns the API response dict.
Notes
Requires
rpc_urlto be set in theBuilderClientconstructor.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)).