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
feat(nfts): implement NFT portfolio and wallet activity skills using Helius DAS API fix(App.svelte): update remote server address validation to allow empty address fix(SettingsModal.svelte): remove default address from tooltip content fix(stores.js): change default remote server address to empty string
nirholascb48ea8f0814
diff --git a/.env.example b/.env.exampleindex 26e9ecc5b..e84e20400 100644--- a/.env.example+++ b/.env.example@@ -133,6 +133,16 @@ PUMPFUN_BOT_TOKEN=# do NOT leave this value set for normal cron operation.ERC8004_CRAWL_LOOKBACK=+# ── Helius — NFT portfolio, enhanced transactions, wallet monitoring ──────────+# Used by: /api/agents/nfts (nft-portfolio + wallet-activity skills),+# /api/nft/resolve, /api/wallet/balances, /api/tx/explain,+# and pump.fun wallet webhooks.+# Get a free key at https://dev.helius.xyz (free tier: 100k req/mo DAS + RPC).+HELIUS_API_KEY=+# Shared secret echoed by Helius in the 'authorization' header on webhook pushes.+# Generate: openssl rand -base64 32+HELIUS_WEBHOOK_AUTH=+# ── Solana RPC overrides (used by Solana attestation crawler + pump skills) ──# Defaults to public mainnet/devnet — set Helius/Triton/QuickNode for prod.SOLANA_RPC_URL=diff --git a/api/agents/nfts.js b/api/agents/nfts.jsnew file mode 100644index 000000000..5c40de349--- /dev/null+++ b/api/agents/nfts.js@@ -0,0 +1,156 @@+/**+ * GET /api/agents/nfts+ * --------------------+ * Returns the NFT portfolio for a Solana wallet using Helius DAS API.+ * Backs the `nft-portfolio` agent skill.+ *+ * Query:+ * ?wallet=<base58> — required Solana wallet address+ * &limit=20 — max items (1-50, default 20)+ * &page=1 — pagination page (default 1)+ *+ * Auth: session OR bearer (scope `mcp` or `profile`).+ * Requires HELIUS_API_KEY env var.+ */++import { cors, json, method, error, wrap } from '../_lib/http.js';+import { limits, clientIp } from '../_lib/rate-limit.js';+import { getSessionUser, authenticateBearer, extractBearer, hasScope } from '../_lib/auth.js';++const HELIUS_RPC = () => {+ const k = process.env.HELIUS_API_KEY;+ if (!k) throw Object.assign(new Error('HELIUS_API_KEY not configured'), { status: 503, code: 'not_configured' });+ return `https://mainnet.helius-rpc.com/?api-key=${k}`;+};++const RECENT_TX_URL = () => {+ const k = process.env.HELIUS_API_KEY;+ if (!k) throw Object.assign(new Error('HELIUS_API_KEY not configured'), { status: 503, code: 'not_configured' });+ return `https://api.helius.xyz/v0/addresses/{address}/transactions?api-key=${k}`;+};++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;+ if (!method(req, res, ['GET'])) return;++ const session = await getSessionUser(req);+ const bearer = session ? null : await authenticateBearer(extractBearer(req));+ if (!session && !bearer) return error(res, 401, 'unauthorized', 'sign in required');+ if (bearer && !hasScope(bearer.scope, 'mcp') && !hasScope(bearer.scope, 'profile')) {+ return error(res, 403, 'insufficient_scope', 'requires mcp or profile scope');+ }++ const rl = await limits.authIp(clientIp(req));+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');++ const op = req.query.op || 'portfolio';++ if (op === 'portfolio') return handlePortfolio(req, res);+ if (op === 'activity') return handleActivity(req, res);+ return error(res, 400, 'bad_request', 'op must be portfolio or activity');+});++async function handlePortfolio(req, res) {+ const wallet = String(req.query.wallet || '').trim();+ if (!wallet) return error(res, 400, 'bad_request', 'wallet required');++ const limit = Math.min(50, Math.max(1, parseInt(req.query.limit) || 20));+ const page = Math.max(1, parseInt(req.query.page) || 1);++ let rpcUrl;+ try {+ rpcUrl = HELIUS_RPC();+ } catch (e) {+ return error(res, e.status || 503, e.code || 'not_configured', e.message);+ }++ const resp = await fetch(rpcUrl, {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({+ jsonrpc: '2.0',+ id: 1,+ method: 'getAssetsByOwner',+ params: {+ ownerAddress: wallet,+ page,+ limit,+ displayOptions: {+ showFungible: false,+ showNativeBalance: false,+ showCollectionMetadata: true,+ showUnverifiedCollections: false,+ showZeroBalance: false,+ },+ },+ }),+ });++ if (!resp.ok) {+ const txt = await resp.text().catch(() => resp.status.toString());+ return error(res, 502, 'upstream_error', `Helius DAS error ${resp.status}: ${txt}`);+ }++ const data = await resp.json();+ if (data.error) {+ return error(res, 502, 'upstream_error', data.error.message || JSON.stringify(data.error));+ }++ const raw = data.result || {};+ const items = (raw.items || []).map((a) => ({+ id: a.id,+ name: a.content?.metadata?.name || a.id,+ symbol: a.content?.metadata?.symbol || '',+ description: a.content?.metadata?.description || '',+ image: a.content?.links?.image || a.content?.files?.find((f) => f.mime?.startsWith('image/'))?.uri || null,+ model: a.content?.files?.find((f) => f.mime?.startsWith('model/'))?.uri || null,+ collection: a.grouping?.find((g) => g.group_key === 'collection')?.group_value || null,+ collectionName: a.grouping?.find((g) => g.group_key === 'collection')?.collection_metadata?.name || null,+ compressed: a.compression?.compressed ?? false,+ burnt: a.burnt ?? false,+ }));++ return json(res, 200, {+ wallet,+ total: raw.total ?? items.length,+ page: raw.page ?? page,+ limit: raw.limit ?? limit,+ items,+ });+}++async function handleActivity(req, res) {+ const wallet = String(req.query.wallet || '').trim();+ if (!wallet) return error(res, 400, 'bad_request', 'wallet required');++ const limit = Math.min(20, Math.max(1, parseInt(req.query.limit) || 10));++ let baseUrl;+ try {+ baseUrl = RECENT_TX_URL();+ } catch (e) {+ return error(res, e.status || 503, e.code || 'not_configured', e.message);+ }++ const url = baseUrl.replace('{address}', encodeURIComponent(wallet)) + `&limit=${limit}`;+ const resp = await fetch(url);++ if (!resp.ok) {+ const txt = await resp.text().catch(() => resp.status.toString());+ return error(res, 502, 'upstream_error', `Helius enhanced tx error ${resp.status}: ${txt}`);+ }++ const txns = await resp.json();+ const items = (Array.isArray(txns) ? txns : []).map((tx) => ({+ signature: tx.signature,+ type: tx.type || 'unknown',+ timestamp: tx.timestamp,+ description: tx.description || '',+ fee: tx.fee,+ feePayer: tx.feePayer,+ tokenTransfers: tx.tokenTransfers || [],+ nativeTransfers: tx.nativeTransfers || [],+ }));++ return json(res, 200, { wallet, items });+}diff --git a/chat/src/App.svelte b/chat/src/App.svelteindex cbbb9b4dd..d8b6d92a7 100644--- a/chat/src/App.svelte+++ b/chat/src/App.svelte@@ -1427,7 +1427,7 @@// started the helper.const remoteServerConfigured =$remoteServer.password !== '' ||- $remoteServer.address !== 'http://localhost:8081';+ $remoteServer.address !== '';if ($localProvidersEnabled || remoteServerConfigured) {try {tree = await (diff --git a/chat/src/SettingsModal.svelte b/chat/src/SettingsModal.svelteindex 32dfd98de..6b7e510eb 100644--- a/chat/src/SettingsModal.svelte+++ b/chat/src/SettingsModal.svelte@@ -340,14 +340,14 @@<span class="mb-2 flex items-center"><span class="ml-[3px]">Tool server address </span><Tooltip- content="Start the three.ws chat tool server, then enter the address and passphrase here. The default address is http://localhost:8081"+ content="Start the three.ws chat tool server, then enter the address and passphrase here."class="ml-2"/></span><inputtype="text"bind:value={$remoteServer.address}- placeholder="Enter server address (default http://localhost:8081)"+ placeholder="Enter server address"class="rounded-lg border border-slate-300 px-3 py-2 text-sm text-slate-800 transition-colors placeholder:text-gray-500 focus:border-slate-400 focus:outline-none"/></label>diff --git a/chat/src/stores.js b/chat/src/stores.jsindex 54564393c..a88ac46d4 100644--- a/chat/src/stores.js+++ b/chat/src/stores.js@@ -53,7 +53,7 @@ export function setAPIKeysFromObject(obj) {mistralAPIKey.set(obj.mistral || '');}-export const remoteServer = persisted('remoteServer', { address: 'http://localhost:8081', password: '' });+export const remoteServer = persisted('remoteServer', { address: '', password: '' });export const localProvidersEnabled = persisted('localProvidersEnabled', false);export const syncServer = persisted('syncServer', {address: syncHostedAddress,diff --git a/src/agent-skills-nfts.js b/src/agent-skills-nfts.jsnew file mode 100644index 000000000..23e0ae3fd--- /dev/null+++ b/src/agent-skills-nfts.js@@ -0,0 +1,159 @@+/**+ * NFT portfolio & wallet activity skills+ * ----------------------------------------+ * Wraps the Helius DAS API (via /api/agents/nfts) so an agent can:+ * - nft-portfolio → list NFTs owned by a wallet address+ * - wallet-activity → show recent parsed transactions for a wallet+ *+ * Both skills are read-only and require HELIUS_API_KEY server-side.+ * The agent can display NFT image previews and describe on-chain activity+ * in plain language.+ *+ * Powered by: helius-sdk / Helius DAS API+ * Docs: https://docs.helius.dev/compression-and-das-api/digital-asset-standard-api+ */++async function fetchJson(url) {+ const r = await fetch(url, { credentials: 'include' });+ if (!r.ok) throw new Error(`request failed: ${r.status}`);+ return r.json();+}++function formatNftList(items) {+ if (!items.length) return 'No NFTs found for this wallet.';+ return items+ .slice(0, 10)+ .map((nft, i) => {+ const col = nft.collectionName ? ` [${nft.collectionName}]` : '';+ return `${i + 1}. ${nft.name}${col}`;+ })+ .join('\n');+}++function formatActivity(items) {+ if (!items.length) return 'No recent transactions found.';+ return items+ .slice(0, 8)+ .map((tx) => {+ const time = tx.timestamp ? new Date(tx.timestamp * 1000).toLocaleDateString() : '—';+ const desc = tx.description || tx.type || 'transaction';+ return `• ${time}: ${desc}`;+ })+ .join('\n');+}++/**+ * Register NFT portfolio and wallet activity skills onto an AgentSkills instance.+ * @param {import('./agent-skills.js').AgentSkills} skills+ */+export function registerNftSkills(skills) {+ // ── nft-portfolio ────────────────────────────────────────────────────────+ skills.register({+ name: 'nft-portfolio',+ description: 'List NFTs owned by a Solana wallet address using Helius DAS.',+ instruction:+ 'Returns the NFT portfolio for a given Solana wallet. Shows names, collections, and image URLs. Useful for displaying what digital assets a user owns.',+ animationHint: 'curiosity',+ voicePattern: 'Looking up NFTs for {{wallet}}…',+ mcpExposed: true,+ inputSchema: {+ type: 'object',+ properties: {+ wallet: {+ type: 'string',+ description: 'Solana wallet address (base58) or SNS name (e.g. "satoshi.sol")',+ },+ limit: {+ type: 'integer',+ minimum: 1,+ maximum: 50,+ default: 20,+ description: 'Max NFTs to return',+ },+ },+ required: ['wallet'],+ },+ handler: async (args) => {+ const wallet = String(args?.wallet || '').trim();+ if (!wallet) return { success: false, output: 'wallet address required', sentiment: -0.2 };+ const limit = Math.min(50, Math.max(1, Number(args?.limit) || 20));+ try {+ const data = await fetchJson(+ `/api/agents/nfts?op=portfolio&wallet=${encodeURIComponent(wallet)}&limit=${limit}`,+ );+ const items = data.items || [];+ const summary = formatNftList(items);+ const total = data.total ?? items.length;+ return {+ success: true,+ output:+ items.length === 0+ ? `No NFTs found for ${wallet.slice(0, 8)}…`+ : `Found ${total} NFT${total !== 1 ? 's' : ''} for ${wallet.slice(0, 8)}…:\n${summary}`,+ sentiment: items.length > 0 ? 0.4 : 0.0,+ data: { wallet, total, items },+ };+ } catch (err) {+ return {+ success: false,+ output: `Could not fetch NFTs: ${err.message}`,+ sentiment: -0.3,+ };+ }+ },+ });++ // ── wallet-activity ──────────────────────────────────────────────────────+ skills.register({+ name: 'wallet-activity',+ description: 'Show recent parsed on-chain transactions for a Solana wallet.',+ instruction:+ 'Returns the latest transactions for a wallet in plain English using Helius enhanced transaction parsing. Useful for summarizing recent on-chain activity.',+ animationHint: 'think',+ voicePattern: 'Checking recent activity for {{wallet}}…',+ mcpExposed: true,+ inputSchema: {+ type: 'object',+ properties: {+ wallet: {+ type: 'string',+ description: 'Solana wallet address (base58)',+ },+ limit: {+ type: 'integer',+ minimum: 1,+ maximum: 20,+ default: 10,+ description: 'Max transactions to return',+ },+ },+ required: ['wallet'],+ },+ handler: async (args) => {+ const wallet = String(args?.wallet || '').trim();+ if (!wallet) return { success: false, output: 'wallet address required', sentiment: -0.2 };+ const limit = Math.min(20, Math.max(1, Number(args?.limit) || 10));+ try {+ const data = await fetchJson(+ `/api/agents/nfts?op=activity&wallet=${encodeURIComponent(wallet)}&limit=${limit}`,+ );+ const items = data.items || [];+ const summary = formatActivity(items);+ return {+ success: true,+ output: items.length === 0+ ? `No recent transactions found for ${wallet.slice(0, 8)}…`+ : `Recent activity for ${wallet.slice(0, 8)}…:\n${summary}`,+ sentiment: 0.1,+ data: { wallet, items },+ };+ } catch (err) {+ return {+ success: false,+ output: `Could not fetch wallet activity: ${err.message}`,+ sentiment: -0.3,+ };+ }+ },+ });+}diff --git a/src/agent-skills.js b/src/agent-skills.jsindex 463c1d3e7..01fa400cd 100644--- a/src/agent-skills.js+++ b/src/agent-skills.js@@ -18,6 +18,8 @@ import { registerPumpFunAutonomousSkills } from './agent-skills-pumpfun-autonomoimport { registerPumpFunComposeSkills } from './agent-skills-pumpfun-compose.js';import { attachPumpFunMemoryHooks } from './agent-skills-pumpfun-hooks.js';import { registerJupiterSkills } from './agent-skills-jupiter.js';+import { registerBlinksSkills } from './agent-skills-blinks.js';+import { registerNftSkills } from './agent-skills-nfts.js';/*** @typedef {Object} SkillContext@@ -65,6 +67,8 @@ export class AgentSkills {registerPumpFunComposeSkills(this);attachPumpFunMemoryHooks(protocol, memory);registerJupiterSkills(this);+ registerBlinksSkills(this);+ registerNftSkills(this);}// ── Registry ──────────────────────────────────────────────────────────────