const API_KEY = process.env.SWARMS_API_KEY!;
const PRIVATE_KEY = process.env.SWARMS_PRIVATE_KEY!;
interface FrenzyLaunchResult {
success: true;
id: string;
listing_url: string;
tokenized: true;
token_address: string | null;
pool_address: string | null;
}
async function launchFrenzyAgent(): Promise<FrenzyLaunchResult> {
const response = await fetch("https://swarms.world/api/token/launch", {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Frenzy Research Agent",
description: "An AI research agent launched in Frenzy mode for maximum visibility.",
ticker: "FRNZ",
private_key: PRIVATE_KEY,
fee_selection: "frenzy",
quote_mint: "SOL",
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.message ?? data.error ?? "Token launch failed");
}
return data as FrenzyLaunchResult;
}
launchFrenzyAgent()
.then((res) => {
console.log("Agent created: ", res.listing_url);
console.log("Token address:", res.token_address);
console.log("Pool address: ", res.pool_address);
})
.catch(console.error);