Linking a wallet

Discord Activities run in an iframe behind Discord's proxy. Wallet extensions don't exist there, on desktop or on mobile. So the wallet step happens in the player's own browser, and Huddle makes sure it lands on the right Discord account.

One click, from the Activity

const { address } = await huddle.link();
  1. The client SDK asks Huddle for a ticket with the player's Discord token. Huddle checks the token with Discord (and that it was issued to your application) and ties the ticket to that Discord user.
  2. The SDK opens the ticket's page with discordSdk.commands.openExternalLink. The page already says "Link a wallet to @nova in Your Activity".
  3. The player picks a wallet (Phantom, Solflare, Backpack, any Wallet Standard wallet) and signs a free message. No transaction, nothing to pay, and the popup shows exactly what it is.
  4. The wallet is linked. link() resolves in the Activity, your server gets a wallet_linked webhook, and anything held for the player is sent.

A ticket works once and for 15 minutes. A player can have 5 open at most.

With a code (fallback)

Some players prefer to open the page themselves. Without a ticket, <API>/link/<your-project> hands out a code (K7Q2-XM9F, 15 minutes, one use) after the signature. The player types it in your Activity:

await huddle.claimCode(code);

Rules

  • A wallet belongs to one Discord account per project. Linking it from another account moves it, and the previous account gets wallet_unlinked.
  • huddle.unlink() removes the player's link; your server can do it with unlink(userId).
  • Huddle stores Discord user IDs, usernames, avatar hashes and public addresses. Never keys, never tokens (only hashes of tickets and codes).
NextPayouts and holds