Quick Draw, the example Activity

Everyone in the voice channel waits. The screen turns green: the first click wins the round, and the winner is paid in SOL from the project wallet. Click too early and you're out for the round. It lives in examples/quickdraw.

How it's built

  • The Activity (src/main.ts): Discord's Embedded App SDK signs the player in (authorize, then the server exchanges the code, then authenticate). The Huddle client SDK shows their wallet, links one in a click, and lists what is held for them: "0.001 SOL is waiting for you".

  • The game server (server/index.ts): rounds over a WebSocket, one room per Activity instance. When someone wins:

    await huddle.transferSol({
      to: { userId: winner.id, hold: true },
      amount: REWARD_SOL,
      idempotencyKey: `quickdraw:${instanceId}:${round}`,
    });
    

    The webhook (/webhooks/huddle, signature verified) updates the room when a payout confirms or a player links.

Run it

Locally, every browser tab is a player (development tokens, no Discord needed). In Discord, through a tunnel and the Activity's URL mappings. The steps are in examples/quickdraw/README.md.

There is no entry fee and nothing to bet: the developer's wallet pays the rewards.