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.
Request Body
Prediction market contract address.
Option token to buy (e.g., “Yes” or “No” token address).
Price per token in base token units (6 decimal precision for USDC).
Amount of base tokens to spend (e.g., "10000000" = 10 USDC).
Minimum tokens to receive. Protects against slippage. If the actual output is less than this, the transaction reverts.
Unix timestamp. Transaction reverts if not executed before this time.
Signed ERC-4337 UserOperation. Show UserOperation fields
"0x" for existing accounts, or account factory calldata for first tx.
Hex gas limit for execution.
Hex gas limit for verification.
Hex pre-verification gas.
Hex max priority fee per gas.
Paymaster contract data (enables gasless tx).
Hex-encoded signature from the smart account owner.
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"
}
}
UserOperation hash. Use to track the on-chain transaction status.
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.