Skip to main content
POST
/
v2
/
markets
/
{id}
/
resolve
curl -X POST https://api.pmx.trade/v2/markets/1/resolve \
  -H "Content-Type: application/json" \
  -d '{
    "wallet": "7xKXabc123...",
    "winningSide": "YES"
  }'
{
  "success": true,
  "data": {
    "transaction": "AQAAAAAAA...base64...",
    "message": "Sign this transaction to resolve the market."
  }
}
Returns an unsigned Solana transaction that resolves the market by declaring the winning outcome. Only the market creator can call this endpoint. The API never holds private keys.

Idempotent

If the market is already resolved, the endpoint returns a success response with alreadyResolved: true instead of an error.

Auto Supabase Sync

When a market is successfully resolved, the API automatically updates the market’s status in Supabase (if configured). This ensures the website reflects the resolved state immediately without a separate API call.

Path parameters

id
integer
required
The market ID to resolve.

Request body

wallet
string
required
Wallet address of the market creator. Only the original market creator can resolve via this endpoint.
winningSide
string
required
The winning outcome: YES or NO (or the market’s custom tickers like UP/DOWN).

Response

success
boolean
alreadyResolved
boolean
true if the market was already resolved. Only present when this is the case.
data
object
Only present when the market needs resolving.
curl -X POST https://api.pmx.trade/v2/markets/1/resolve \
  -H "Content-Type: application/json" \
  -d '{
    "wallet": "7xKXabc123...",
    "winningSide": "YES"
  }'
{
  "success": true,
  "data": {
    "transaction": "AQAAAAAAA...base64...",
    "message": "Sign this transaction to resolve the market."
  }
}

Prerequisites

  • Market must be active (or returns alreadyResolved if already resolved)
  • Clock.unix_timestamp >= market.resolutionTime
  • Caller must be the market creator

Errors

ErrorWhen
403 UnauthorizedCaller is not the market creator
ResolutionTooEarlyResolution time hasn’t passed yet
NoOppositionOne side has zero supply — cannot resolve fairly

What Happens On-Chain

  1. AMM markets: LP residual is calculated as vault - winning_supply - unclaimed_fees and transferred to the creator’s USDC account.
  2. Pool markets: No LP residual. The payout pool is vault - unclaimed_fees.
  3. Status updated: Market status becomes Resolved, winning outcome is recorded.
  4. Supabase synced: If Supabase is configured, the market status is automatically updated.
There is no fee deduction at resolution. All fees are collected per-trade during the market’s lifetime and can be claimed at any time via claimFees.
See Fees & Payouts for the full math.