Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
/**
* Vanity-launch helper: grind a vanity mint address client-side, POST it to
* /api/pump/launch-prep so the unsigned tx is built around the vanity pubkey,
* then return the prep payload + the locally-held mint keypair for co-signing.
*
* The mint secret never leaves the browser.
*
* Usage:
* const { prep, mintKeypair } = await launchWithVanity({
* agentId, walletAddress, name, symbol, uri,
* // prefix defaults to the `3ws` brand mark when omitted
* onProgress: ({ rate, eta }) => console.log(rate, eta),
* });
* // ...co-sign prep.tx_base64 with both `mintKeypair` and the user wallet,
* // submit, then POST /api/pump/launch-confirm with the tx_signature.
*/
import { Keypair } from '@solana/web3.js';
import { grindVanity } from './grinder.js';
import { THREE_WS_MARK } from './brand.js';
/**
* @param {object} args
* @param {string} args.agentId
* @param {string} args.walletAddress
* @param {string} args.name
* @param {string} args.symbol
* @param {string} args.uri
* @param {'mainnet'|'devnet'} [args.network]
* @param {number} [args.buybackBps]
* @param {number} [args.solBuyIn]
* @param {string} [args.prefix]
* @param {string} [args.suffix]
* @param {boolean} [args.ignoreCase]
* @param {AbortSignal} [args.signal]
* @param {(p: { attempts: number, rate: number, eta: string }) => void} [args.onProgress]
* @param {typeof fetch} [args.fetchImpl]
* @param {string} [args.endpoint='/api/pump/launch-prep']
* @returns {Promise<{ prep: object, mintKeypair: Keypair }>}
*/
export async function launchWithVanity(args) {
let { prefix, suffix, ignoreCase } = args;
const { signal, onProgress } = args;
// Every three.ws launch leads with the `3ws` brand mark. When the caller
// supplies no explicit pattern, default to grinding the mark (case-insensitive
// — keeps the grind sub-second). Power users may still pass an explicit
// prefix/suffix to append extra characters after the mark.
if (!prefix && !suffix) {
prefix = THREE_WS_MARK;
ignoreCase = true;
}
const ground = await grindVanity({ prefix, suffix, ignoreCase, signal, onProgress });
const mintKeypair = Keypair.fromSecretKey(ground.secretKey);
const fetchImpl = args.fetchImpl || globalThis.fetch;
const res = await fetchImpl(args.endpoint || '/api/pump/launch-prep', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
agent_id: args.agentId,
wallet_address: args.walletAddress,
name: args.name,
symbol: args.symbol,
uri: args.uri,
network: args.network ?? 'mainnet',
buyback_bps: args.buybackBps ?? 0,
holder_reward: args.holderReward ?? false,
sol_buy_in: args.solBuyIn ?? 0,
mint_address: mintKeypair.publicKey.toBase58(),
}),
});
if (!res.ok) {
const body = await res.json().catch(() => ({}));
throw new Error(`launch-prep failed: ${res.status} ${body.error_description ?? body.error ?? ''}`);
}
const prep = await res.json();
if (prep.mint !== mintKeypair.publicKey.toBase58()) {
throw new Error('server returned a different mint than the vanity pubkey we sent');
}
return { prep, mintKeypair, vanity: { attempts: ground.attempts, durationMs: ground.durationMs, workers: ground.workers } };
}