When a market resolves, the winning outcome (YES or NO) is determined by the UMA oracle.
2
Redeem winning tokens
Holders of the winning token can redeem each token for $1 USDC. Losing tokens become worthless.
3
Gasless claim via SDK
The SDK signs an EIP-712 RedeemPositions permit and submits it to the relayer. No native gas is needed.
Check Resolution Status
Before claiming, verify the market is resolved:
Claim from a Single Market
claim_winnings() takes the market's contract address (not the market ID). You can find it from the Market object:
The method performs these steps internally:
1
Query on-chain state
Queries the market contract on-chain for resolution status and condition data.
2
Check balances
Checks your balance of the winning token.
3
Sign permit
Signs an EIP-712 RedeemPositions permit.
4
Submit to relayer
Submits to the relayer for gasless execution.
It raises ValueError if:
The market is not resolved yet
You hold no winning tokens
Batch Claim from Multiple Markets
Claim winnings from several resolved markets in a single batch transaction:
Markets that are not resolved or where you have no winning tokens are skipped automatically. The method only raises ValueError if none of the markets have claimable winnings.
Find Markets with Claimable Winnings
Scan your positions for resolved markets you can claim from:
Monitor Claim Status
After submitting a claim, track its progress:
CLAIM_ONLY_MODE
The reference bot (examples/price_action_bot.py) supports a claim-only mode that disables trading and only claims winnings from previously traded markets:
This is useful when you want to:
Claim winnings without placing new orders
Clean up positions from a previous trading session
Run a background process that periodically claims resolved markets
Complete Example
A standalone script that discovers and claims all available winnings:
# Get the market to find the contract address
markets = client.get_markets()
market = next(m for m in markets if m.id == market_id)
# Claim winnings
try:
result = client.claim_winnings(
market_contract_address=market.contract_address
)
print(f"Claim submitted: {result}")
except ValueError as e:
print(f"Cannot claim: {e}")
contract_addresses = [
"0xMarket1ContractAddress...",
"0xMarket2ContractAddress...",
"0xMarket3ContractAddress...",
]
try:
result = client.batch_claim_winnings(contract_addresses)
print(f"Batch claim submitted: {result}")
except ValueError as e:
print(f"No markets to claim: {e}")
# Get all your positions
positions = client.get_user_positions(
address=client.address,
chain_id=client.chain_id,
)
# Get markets and check which are resolved
markets = client.get_markets(chain_id=client.chain_id)
market_map = {m.id: m for m in markets}
claimable = []
for pos in positions:
market = market_map.get(pos.market_id)
if not market or not market.resolved:
continue
# Check if we hold winning tokens
if market.winning_outcome == 0 and pos.yes_shares > 0:
claimable.append(market)
print(f"Claimable: {market.question}")
print(f" YES shares: {pos.yes_shares / 1e6:.2f} (payout: ${pos.yes_shares / 1e6:.2f} USDC)")
elif market.winning_outcome == 1 and pos.no_shares > 0:
claimable.append(market)
print(f"Claimable: {market.question}")
print(f" NO shares: {pos.no_shares / 1e6:.2f} (payout: ${pos.no_shares / 1e6:.2f} USDC)")
# Batch claim all
if claimable:
addresses = [m.contract_address for m in claimable]
result = client.batch_claim_winnings(addresses)
print(f"\nBatch claim submitted: {result}")
else:
print("No claimable winnings found.")
# Check pending claims
pending = client.get_pending_claims()
for c in pending:
print(f"Pending: market={c.market_address} payout={c.payout / 1e6:.2f} USDC tx={c.tx_hash}")
# Check failed claims
failed = client.get_failed_claims()
for c in failed:
print(f"Failed: market={c.market_address} payout={c.payout / 1e6:.2f} USDC tx={c.tx_hash}")