Skip to content

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.

feat: add Solana SPL token dependency and enhance agent-pumpfun dashboard with new SNS elements

nirholas76ac745e815b
diff --git a/api/_lib/env.js b/api/_lib/env.js
index be1fc3635..583ee93e1 100644
--- a/api/_lib/env.js
+++ b/api/_lib/env.js
@@ -135,6 +135,34 @@ export const env = {
// Per-chain RPC URLs for on-chain delegation calls.
// Pattern: RPC_URL_<CHAINID> e.g. RPC_URL_84532 for Base Sepolia.
// Falls back to public RPC nodes when unset; set Alchemy/Infura URLs for production.
+ // ── x402 (HTTP 402 micropayments) ───────────────────────────────────────
+ // Solana mainnet payTo wallet that receives USDC for paid /api/mcp calls.
+ get X402_PAY_TO() {
+ return opt('X402_PAY_TO', 'BUrwd1nK6tFeeJMyzRHDo6AuVbnSfUULfvwq21X93nSN');
+ },
+ // USDC mint on the configured network.
+ get X402_ASSET_MINT() {
+ return opt('X402_ASSET_MINT', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
+ },
+ // Network ID per x402 spec.
+ get X402_NETWORK() {
+ return opt('X402_NETWORK', 'solana');
+ },
+ // Price per /api/mcp call, expressed in the asset's base units (USDC has 6 decimals,
+ // so "1000" = 0.001 USDC).
+ get X402_MAX_AMOUNT_REQUIRED() {
+ return opt('X402_MAX_AMOUNT_REQUIRED', '1000');
+ },
+ // Facilitator service that verifies and settles signed payment payloads.
+ // Public Solana facilitator: https://facilitator.payai.network
+ get X402_FACILITATOR_URL() {
+ return trimSlash(opt('X402_FACILITATOR_URL', 'https://facilitator.payai.network'));
+ },
+ // Optional bearer token for self-hosted/private facilitators.
+ get X402_FACILITATOR_TOKEN() {
+ return opt('X402_FACILITATOR_TOKEN');
+ },
+
getRpcUrl(chainId) {
return (
opt(`RPC_URL_${chainId}`) ||
diff --git a/package-lock.json b/package-lock.json
index 9493cd629..be5bc3fd9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -27,6 +27,7 @@
"@pump-fun/pump-swap-sdk": "^1.15.0",
"@sentry/node": "^10.50.0",
"@solana/kit": "^6.8.0",
+ "@solana/spl-token": "^0.4.14",
"@solana/web3.js": "^1.98.4",
"@upstash/ratelimit": "^2.0.5",
"@upstash/redis": "^1.34.3",
diff --git a/package.json b/package.json
index a20662c5e..a2a9809f2 100644
--- a/package.json
+++ b/package.json
@@ -78,6 +78,7 @@
"@pump-fun/pump-swap-sdk": "^1.15.0",
"@sentry/node": "^10.50.0",
"@solana/kit": "^6.8.0",
+ "@solana/spl-token": "^0.4.14",
"@solana/web3.js": "^1.98.4",
"@upstash/ratelimit": "^2.0.5",
"@upstash/redis": "^1.34.3",
diff --git a/public/dashboard/agent-pumpfun.html b/public/dashboard/agent-pumpfun.html
index d730dba93..c4f3e30a0 100644
--- a/public/dashboard/agent-pumpfun.html
+++ b/public/dashboard/agent-pumpfun.html
@@ -184,6 +184,23 @@
</div>
</section>
+ <section class="panel" id="sns-panel">
+ <h2>SNS identity <span class="muted" style="font-size: 13px; font-weight: normal">(Solana Name Service)</span></h2>
+ <p class="muted" style="margin: 0 0 10px; font-size: 13px">
+ Attach a <code>.sol</code> domain owned by this agent's wallet so it can be referenced by name.
+ </p>
+ <dl class="kv">
+ <dt>Current</dt>
+ <dd id="sns-current" class="muted">—</dd>
+ </dl>
+ <div id="sns-domain-list" class="row" style="margin-top: 8px; flex-wrap: wrap; gap: 6px"></div>
+ <div class="row" style="margin-top: 10px">
+ <button class="btn ghost" id="sns-refresh-btn">Refresh domains</button>
+ <button class="btn ghost" id="sns-clear-btn" hidden>Clear SNS id</button>
+ <a id="sns-register-link" class="muted" href="https://www.sns.id" target="_blank" rel="noopener">Register a name on sns.id</a>
+ </div>
+ </section>
+
<section class="panel">
<h2>Launch a pump.fun token</h2>
<div class="row">
@@ -287,6 +304,11 @@
agentAddress: $('#agent-address'),
agentBalance: $('#agent-balance'),
explorerLink: $('#explorer-link'),
+ snsCurrent: $('#sns-current'),
+ snsDomainList: $('#sns-domain-list'),
+ snsRefreshBtn: $('#sns-refresh-btn'),
+ snsClearBtn: $('#sns-clear-btn'),
+ snsRegisterLink: $('#sns-register-link'),
launchName: $('#launch-name'),
launchSymbol: $('#launch-symbol'),
launchVanity: $('#launch-vanity'),
diff --git a/src/agent-skills-pumpfun-autonomous.js b/src/agent-skills-pumpfun-autonomous.js
index ff5a6522c..c8d418c0c 100644
--- a/src/agent-skills-pumpfun-autonomous.js
+++ b/src/agent-skills-pumpfun-autonomous.js
@@ -66,6 +66,9 @@ export function registerPumpFunAutonomousSkills(skills) {
uri: { type: 'string', description: 'Pre-uploaded metadata URI' },
solAmount: { type: 'number', description: 'Optional initial dev-buy in SOL' },
network: { type: 'string', enum: ['mainnet', 'devnet'] },
+ vanityPrefix: { type: 'string', maxLength: 6 },
+ vanitySuffix: { type: 'string', maxLength: 6 },
+ vanityIgnoreCase: { type: 'boolean' },
},
required: ['symbol', 'uri'],
},
@@ -77,6 +80,9 @@ export function registerPumpFunAutonomousSkills(skills) {
uri: args.uri,
solAmount: args.solAmount,
network: args.network,
+ vanityPrefix: args.vanityPrefix,
+ vanitySuffix: args.vanitySuffix,
+ vanityIgnoreCase: args.vanityIgnoreCase,
});
return {
success: true,
@@ -103,6 +109,9 @@ export function registerPumpFunAutonomousSkills(skills) {
symbol: { type: 'string' },
solAmount: { type: 'number' },
network: { type: 'string', enum: ['mainnet', 'devnet'] },
+ vanityPrefix: { type: 'string', maxLength: 6 },
+ vanitySuffix: { type: 'string', maxLength: 6 },
+ vanityIgnoreCase: { type: 'boolean' },
},
},
handler: async (args, ctx) => {
@@ -118,7 +127,16 @@ export function registerPumpFunAutonomousSkills(skills) {
'AGENT';
return skills.perform(
'pumpfun-self-launch',
- { name: ctx.identity?.name, symbol, uri, solAmount: args.solAmount, network: args.network },
+ {
+ name: ctx.identity?.name,
+ symbol,
+ uri,
+ solAmount: args.solAmount,
+ network: args.network,
+ vanityPrefix: args.vanityPrefix,
+ vanitySuffix: args.vanitySuffix,
+ vanityIgnoreCase: args.vanityIgnoreCase,
+ },
ctx,
);
},
diff --git a/src/agent-solana-wallet.js b/src/agent-solana-wallet.js
index a9450c288..4f04113fd 100644
--- a/src/agent-solana-wallet.js
+++ b/src/agent-solana-wallet.js
@@ -8,13 +8,36 @@
* vanity_prefix }. Server verifies and stores the
* encrypted secret.
*
+ * On mount the card pulls fresh state from GET /api/agents/:id/solana.
+ * Server-side ownership is enforced; a 403 hides the card. A 404 means
+ * no wallet yet → show the provisioning UI.
+ *
* Existing wallets are non-destructive: a "Replace" button calls DELETE first.
*/
import { openVanityModal } from './erc8004/vanity-modal.js';
import { grindVanity } from './solana/vanity/grinder.js';
-const ENDPOINT = (id) => `/api/agents/${encodeURIComponent(id)}/solana`;
+const ENDPOINT = (id, qs = '') =>
+ `/api/agents/${encodeURIComponent(id)}/solana${qs ? `?${qs}` : ''}`;
+
+/**
+ * Fetch current wallet state from the server.
+ * @returns {Promise<{ status: 'ok'|'none'|'forbidden'|'error',
+ * data?: { address: string, lamports: number|null, sol: number|null,
+ * vanity_prefix: string|null, source: string|null, network: string },
+ * error?: string }>}
+ */
+export async function fetchAgentSolanaWallet(agentId, network = 'mainnet') {
+ const resp = await fetch(ENDPOINT(agentId, `network=${encodeURIComponent(network)}`), {
+ credentials: 'include',
+ });
+ if (resp.status === 403) return { status: 'forbidden' };
+ const json = await resp.json().catch(() => ({}));
+ if (resp.status === 404) return { status: 'none' };
+ if (!resp.ok) return { status: 'error', error: json?.error?.message || `HTTP ${resp.status}` };
+ return { status: 'ok', data: json.data };
+}
/**
* Provision (or replace) the agent's Solana wallet.
@@ -90,6 +113,11 @@ const STYLE = `
.agent-sol-wallet .progress { font-size: .75rem; color: #555; margin-top: .55rem; font-family: ui-monospace, monospace; }
.agent-sol-wallet .err { color: #b71c1c; font-size: .75rem; margin-top: .5rem; }
.agent-sol-wallet .src { font-size: .7rem; color: #888; margin-left: .35rem; }
+.agent-sol-wallet .balance { display: flex; align-items: center; gap: .5rem; margin-top: .55rem; font-size: .8rem; color: #333; }
+.agent-sol-wallet .balance .sol { font-family: ui-monospace, monospace; font-weight: 600; }
+.agent-sol-wallet .balance .net { margin-left: auto; font-size: .7rem; }
+.agent-sol-wallet .balance select { font: inherit; font-size: .7rem; padding: .15rem .25rem; border: 1px solid #ddd; border-radius: 4px; background: #fff; }
+.agent-sol-wallet .skel { color: #999; font-size: .75rem; padding: .35rem 0; }
`;
let _styleInjected = false;
diff --git a/vercel.json b/vercel.json
index 6705bf98d..c76d3b9f9 100644
--- a/vercel.json
+++ b/vercel.json
@@ -51,6 +51,7 @@
{ "src": "/deploy", "dest": "/app.html" },
{ "src": "/dashboard", "dest": "/dashboard/index.html" },
{ "src": "/dashboard/", "dest": "/dashboard/index.html" },
+ { "src": "/dashboard/agent-pumpfun", "dest": "/dashboard/agent-pumpfun.html" },
{ "src": "/dashboard/(.*)", "dest": "/dashboard/$1" },
{ "src": "/hydrate", "dest": "/hydrate/index.html" },
{ "src": "/hydrate/", "dest": "/hydrate/index.html" },