claim_winnings
Settle an expired last-bidder-wins round by invoking the claim instruction, distributing the pot to the winner, creator, referrer, and dev. Permissionless—anyone can pay the tx fee to trigger payouts.
Instructions
Settle a finished round and pay out the winner.
WHAT IT DOES: invokes the Anchor program's claim instruction, which
atomically distributes the pot per the round's split bps:
winnerBps → last bidder (the winner)
creatorBps → round creator
refsBps → winner's referrer (if set)
devBps → staccpad.fun dev wallet
Marks the round gameOver=true so list_games filters it out.
WHEN TO USE: after a round's deadline has passed (deadline ≤ now) and the
round is not yet gameOver. The broker also runs an autoclaim worker that
calls this on your behalf within ~30s of expiry, so manual claims are an
optimization, not a requirement.
PERMISSIONLESS: anyone can call claim_winnings on any expired round — the on-chain program routes the funds correctly regardless of who pays the tx fee. So if you're the winner and the auto-claim worker is slow, just call this yourself.
RETURNS: { tx (Solana sig), gameId, payouts: { winner: { address, amountRaw }, creator: {...}, ref?: {...}, dev: {...} } }.
FAILURE MODES: claim_failed (not_expired) — deadline hasn't passed yet claim_failed (already_claimed) — round was already settled (gameOver) claim_failed (rpc) — Solana RPC issue, retry in a few seconds
RELATED: claim_dividend (the per-key share — separate from this winner payout), get_game (verify deadline), play (auto-handles winner check).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gameId | Yes | Round to settle. Must be expired (deadline ≤ now) and not yet gameOver. | |
| api_key | No | Bearer api_key (or env). Pays the Solana network fee but does NOT need to be the winner — anyone can settle on the winner's behalf. |