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(solana): add stake attestation handling and lamports transfer validation
nirholas379dc3ac3671
diff --git a/api/_lib/solana-attestations.js b/api/_lib/solana-attestations.jsindex 0597504db..493a84d02 100644--- a/api/_lib/solana-attestations.js+++ b/api/_lib/solana-attestations.js@@ -16,8 +16,10 @@ export const KIND_MAP = {accept: 'threews.accept.v1',revoke: 'threews.revoke.v1',dispute: 'threews.dispute.v1',+ stake: 'threews.stake.v1',};export const KINDS_ALL = Object.values(KIND_MAP);+export const MIN_STAKE_LAMPORTS = 1_000_000n; // 0.001 SOL// Validate a parsed memo payload against its schema. Returns true iff well-formed.export function validatePayload(p) {@@ -36,11 +38,28 @@ export function validatePayload(p) {case 'threews.revoke.v1':case 'threews.dispute.v1':return typeof p.target_signature === 'string';+ case 'threews.stake.v1':+ return Number.isInteger(p.score) && p.score >= 1 && p.score <= 5;default:return false;}}+// For stake attestations: the lamports the attester (signer) sent in the same tx.+// Returns 0n if no positive transfer from attester is detected.+export function lamportsTransferredFromAttester(tx, attester) {+ if (!tx?.meta || !attester) return 0n;+ const keys = (tx.transaction.message.staticAccountKeys || tx.transaction.message.accountKeys || [])+ .map((k) => (typeof k?.toBase58 === 'function' ? k.toBase58() : String(k)));+ const idx = keys.indexOf(attester);+ if (idx < 0) return 0n;+ const pre = BigInt(tx.meta.preBalances?.[idx] ?? 0);+ const post = BigInt(tx.meta.postBalances?.[idx] ?? 0);+ const fee = BigInt(tx.meta.fee ?? 0);+ const delta = pre - post - fee;+ return delta > 0n ? delta : 0n;+}+// Extract the JSON envelope from a confirmed-tx's memo log.// SPL Memo emits `Program log: Memo (len): "<json>"`.export function extractMemoPayload(tx) {@@ -97,10 +116,21 @@ export async function crawlAgentAttestations({ agentAsset, network, ownerWallet,if (!KINDS_ALL.includes(payload.kind)) { skipped++; continue; }const attester = attesterFromTx(tx);- const verified = computeVerified({ payload, attester, ownerWallet });const taskId = payload.task_id || null;const target = payload.target_signature || null;+ // For stake attestations, fold the lamports actually transferred into the payload+ // and require it to meet the minimum. Unverified if the transfer is below threshold.+ let stakedLamports = 0n;+ if (payload.kind === 'threews.stake.v1') {+ stakedLamports = lamportsTransferredFromAttester(tx, attester);+ payload.lamports = stakedLamports.toString();+ }++ const verified = payload.kind === 'threews.stake.v1'+ ? stakedLamports >= MIN_STAKE_LAMPORTS+ : computeVerified({ payload, attester, ownerWallet });+const result = await sql`insert into solana_attestations (signature, network, slot, block_time, agent_asset, attester,diff --git a/vercel-env-vars.txt b/vercel-env-vars.txtnew file mode 100644index 000000000..dd5a73576--- /dev/null+++ b/vercel-env-vars.txt@@ -0,0 +1,7 @@++ANTHROPIC_API_KEY=+AGENT_RELAYER_KEY=+VOYAGE_API_KEY=+JWT_KID=k1+UPSTASH_REDIS_REST_URL=+UPSTASH_REDIS_REST_TOKEN=