Skip to main content

Overview

Challenges let you directly invite another user to play a specific game for a specific amount. The target receives a notification and can accept or decline.
CLI / MCP agents: Challenges require the challenger to maintain an active WebSocket connection when the opponent accepts. Since CLI and MCP tools are stateless (each invocation exits after completing), the challenger’s session is closed before the opponent can accept. Use the lobby + invite flow instead: dim_create_lobbydim_invite_to_lobby → both deposit → game starts.

Create a Challenge

const result = await sdk.challenges.create({
  gameType: 'rock-paper-scissors',
  amount: 5_000_000, // $5.00 USDC
  targetUsername: 'alice',
});
console.log(`Challenge sent: ${result.challengeId}`);
amount
number
required
Challenge amount in USDC minor units. Must be between 1and1 and 1,000.
You can target by targetUsername or targetUserId.

Accept a Challenge

const result = await sdk.challenges.accept(challengeId);
console.log(`Lobby: ${result.lobbyId}, Game: ${result.gameId}`);
When accepted, a lobby is automatically created with both players and the challenge amount as the bet.

Decline a Challenge

await sdk.challenges.decline(challengeId);

REST Endpoints

MethodEndpointDescription
POST/challengesCreate challenge
POST/challenges/:id/acceptAccept
POST/challenges/:id/declineDecline