Server SDK

@huddle/sdk/server runs on your Activity's server, with a secret key. Never ship that key to the client.

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

const huddle = new HuddleServer({ secretKey: process.env.HUDDLE_SECRET_KEY!, baseUrl: "https://api.huddle.cash" });
Method What it does
project() The project: cluster, Discord application ID, wallet address, linking URL
wallet(userId) / wallets(userIds) Linked wallets by Discord ID (up to 200 at once)
held(userId) Transfers held for a player
unlink(userId) Removes a player's link
linkTicket({ userId, username }) A one-click linking URL, for a player your server identified itself
claimCode({ code, userId }) Links the wallet behind a code
balance(address) / tokens(address, mint?) / assets(address, collection?) Reads, cached ~10 s
signature(sig) A transaction's status
transferSol / transferToken / mintToken Payouts from the project wallet (see payouts)
tx(key) / cancelHeld(key) A payout's status; cancel a held one
HuddleServer.verifyWebhook(secret, rawBody, header) The event, or null if the signature is wrong or stale

Discord IDs are strings everywhere: they don't fit in a JavaScript number.

NextHTTP API