Skip to main content
POST /api/v1/market/place-order
Auth required: Yes Buys outcome tokens by depositing base tokens (e.g., USDC) into the market’s APMM pool. The transaction is executed gaslessly via an ERC-4337 UserOperation.
This endpoint uses side: 1 for buying. For selling, see Sell Tokens (Withdraw).

Request Body

marketAddress
string
required
Prediction market contract address.
optionAddress
string
required
Option token to buy (e.g., “Yes” or “No” token address).
side
number
required
Must be 1 (buy/deposit).
price
string
required
Price per token in base token units (6 decimal precision for USDC).
amount
string
required
Amount of base tokens to spend (e.g., "10000000" = 10 USDC).
minReceiveAmount
string
required
Minimum tokens to receive. Protects against slippage. If the actual output is less than this, the transaction reverts.
deadline
string
required
Unix timestamp. Transaction reverts if not executed before this time.
userOperation
object
required
Signed ERC-4337 UserOperation.

Example

curl -X POST "https://api-staging.promethex.market/api/v1/market/place-order" \
  -H "Authorization: Bearer $PRIVY_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "marketAddress": "0x1234...abcd",
    "optionAddress": "0xaaaa...1111",
    "side": 1,
    "price": "650000",
    "amount": "10000000",
    "minReceiveAmount": "9500000",
    "deadline": "1740000000",
    "userOperation": {
      "sender": "0xSenderAddress...",
      "nonce": "0x01",
      "initCode": "0x",
      "callData": "0xCallData...",
      "callGasLimit": "0x30000",
      "verificationGasLimit": "0x20000",
      "preVerificationGas": "0x10000",
      "maxFeePerGas": "0x3B9ACA00",
      "maxPriorityFeePerGas": "0x3B9ACA00",
      "paymasterAndData": "0xPaymaster...",
      "signature": "0xSignature..."
    }
  }'

Response

{
  "code": 0,
  "data": {
    "opHash": "0xabcdef...",
    "orderUuid": "order-123-456"
  }
}
opHash
string
UserOperation hash. Use to track the on-chain transaction status.
orderUuid
string
Internal order identifier.

Execution Flow

Client                   PrometheX API            Bundler / Chain
  │                          │                         │
  ├── Build UserOp           │                         │
  ├── Sign UserOp            │                         │
  ├── POST /place-order ──► │                         │
  │                          ├── Validate order        │
  │                          ├── Submit to bundler ──► │
  │  ◄── { opHash } ─────── │                         │
  │                          │                         ├── Execute on-chain
  │                          │  ◄── Tx confirmed ──── │
  │  ◄── SSE: position_changed ─── │                  │
After confirmation, the user’s position is updated and an SSE event user:position_changed is emitted.
The userOperation must be properly constructed and signed via ERC-4337. See the Authentication page for details on signing.