Prerequisites
- A Privy account (email, social login, or wallet)
- A Privy JWT token (obtained via the Privy SDK)
curl or any HTTP client
All examples use the staging environment. Replace api-staging with api for production.
Step 1: Authenticate
Log in via the Privy SDK to obtain a JWT, then register with PrometheX:
curl -X POST "https://api-staging.promethex.market/api/v1/user/login" \
-H "Authorization: Bearer $PRIVY_JWT" \
-H "Content-Type: application/json" \
-d '{
"address": "0xYourSmartAccountAddress",
"userName": "alice"
}'
Response:
{
"code": 0,
"data": {
"uid": "12345",
"isNewUser": true
}
}
Step 2: List Markets
Browse available prediction markets:
curl "https://api-staging.promethex.market/api/v1/market/get-markets?page=1&pageSize=5&sortType=hot"
Response (truncated):
{
"code": 0,
"data": {
"totalCount": 142,
"markets": [
{
"marketAddress": "0x1234...abcd",
"title": "Will BTC exceed $100k by March 2026?",
"status": "running",
"options": [
{ "optionAddress": "0xaaaa...1111", "title": "Yes", "price": "0.65" },
{ "optionAddress": "0xbbbb...2222", "title": "No", "price": "0.35" }
]
}
]
}
}
Step 3: Get Market Detail
Fetch full details for a specific market:
curl "https://api-staging.promethex.market/api/v1/market/get-market-detail?marketAddress=0x1234...abcd"
Step 4: Execute a Trade
Buy “Yes” tokens on the market. This requires a signed ERC-4337 UserOperation for gasless execution:
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": "0x...",
"nonce": "0x...",
"initCode": "0x",
"callData": "0x...",
"callGasLimit": "0x...",
"verificationGasLimit": "0x...",
"preVerificationGas": "0x...",
"maxFeePerGas": "0x...",
"maxPriorityFeePerGas": "0x...",
"paymasterAndData": "0x...",
"signature": "0x..."
}
}'
Response:
{
"code": 0,
"data": {
"opHash": "0xabcdef...",
"orderUuid": "order-123-456"
}
}
The userOperation must be properly constructed and signed via ERC-4337. See the Authentication page for details on signing.
Step 5: Check Your Position
View your open positions:
curl "https://api-staging.promethex.market/api/v1/market/get-user-positions?page=1&pageSize=10" \
-H "Authorization: Bearer $PRIVY_JWT"
Response:
{
"code": 0,
"data": {
"total": 1,
"positions": [
{
"marketAddress": "0x1234...abcd",
"marketTitle": "Will BTC exceed $100k by March 2026?",
"optionTitle": "Yes",
"amount": "10000000",
"avgPrice": "0.65",
"currentPrice": "0.67",
"pnl": "200000",
"pnlPercent": "3.1"
}
]
}
}
Next Steps