Quickstart

Huddle gives a Discord Activity Solana wallets, balances and payouts. You'll need an Activity (a web app launched from a voice channel), its Discord application, and ten minutes.

1. Create the project

In the dashboard, sign in with a Solana wallet and create a project on devnet. Then:

  • Settings → Discord application ID: paste your app's Application ID from the Discord Developer Portal. Huddle only accepts players' Discord tokens issued to this application.
  • API keys: create a publishable key (hdl_pub_…, ships in the Activity) and a secret key (hdl_live_…, stays on your server).
  • Overview → Managed wallet: create it and send it some devnet SOL. Payouts come from here.
  • Transactions: set the max per payout (SOL transfers are off until you do) and your hourly limits.

2. Map the API in Discord

Activities can only reach the network through Discord's proxy. In the Developer Portal, Activities → URL Mappings, add the prefix /huddle → api.huddle.cash (the Huddle API). The client SDK uses /.proxy/huddle by default.

3. In the Activity

npm install @huddle/sdk @discord/embedded-app-sdk
import { DiscordSDK } from "@discord/embedded-app-sdk";
import { Huddle } from "@huddle/sdk";

const discordSdk = new DiscordSDK(CLIENT_ID);
await discordSdk.ready();
const { code } = await discordSdk.commands.authorize({
  client_id: CLIENT_ID, response_type: "code", state: "", prompt: "none", scope: ["identify"],
});
const response = await fetch("/.proxy/api/token", {
  method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ code }),
});
const { access_token } = await response.json();  // your server exchanges the code (client secret)
await discordSdk.commands.authenticate({ access_token });

const huddle = new Huddle({ publishableKey: "hdl_pub_…", accessToken: access_token, discordSdk });
const me = await huddle.me();                // { user, wallet, held, cluster }
if (!me.wallet) await huddle.link();         // one click: opens their browser, resolves once linked

4. On your server

import { HuddleServer } from "@huddle/sdk/server";

const huddle = new HuddleServer({ secretKey: process.env.HUDDLE_SECRET_KEY!, baseUrl: "https://api.huddle.cash" });

const result = await huddle.transferSol({
  to: { userId: winnerDiscordId, hold: true },   // no wallet yet? held, sent when they link
  amount: "0.001",
  idempotencyKey: `round:${roundId}`,            // the same key never pays twice
});
// result.status: "confirmed" | "submitted" | "held" | "failed"

That's the whole loop. Next: linking, payouts and holds, webhooks.

NextLinking a wallet