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: x402 payment session governance and cron seed

nirholas3faa528fabd4
diff --git a/api/cron/x402-seed-cron.js b/api/cron/x402-seed-cron.js
new file mode 100644
index 000000000..c5e75f947
--- /dev/null
+++ b/api/cron/x402-seed-cron.js
@@ -0,0 +1,315 @@
+// GET /api/cron/x402-seed-cron
+//
+// Per-minute cron that seeds the x402 activity feed with 60 real Solana
+// micropayments per tick — one per second equivalent, fired in parallel.
+//
+// Each invocation:
+// 1. Loads the seeder keypair (X402_SEED_SOLANA_SECRET_BASE58 or fallback).
+// 2. Probes /api/x402/dance-tip once to get live payment requirements.
+// 3. Fetches a single blockhash + mint info shared across all 60 transactions.
+// 4. Builds 60 signed USDC TransferChecked transactions (synchronous).
+// 5. Fires all 60 in parallel against dance-tip with X-PAYMENT headers.
+//
+// The payments are real on-chain USDC transfers from the seeder wallet.
+// The Solana x402 facilitator co-signs (feePayer) and broadcasts each tx.
+// Every successful tip is inserted into club_tips + the x402 activity feed.
+//
+// Env:
+// X402_SEED_SOLANA_SECRET_BASE58 base58 64-byte ed25519 seeder keypair
+// X402_SEED_ENABLED set to 'false' to pause (default: enabled)
+// X402_SEED_BATCH_SIZE calls per tick (default: 60)
+
+import { readFileSync } from 'node:fs';
+import bs58 from 'bs58';
+import {
+ Connection, PublicKey, Keypair, TransactionMessage, VersionedTransaction,
+ ComputeBudgetProgram,
+} from '@solana/web3.js';
+import {
+ getAssociatedTokenAddressSync, createTransferCheckedInstruction,
+ createAssociatedTokenAccountIdempotentInstruction,
+ TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, getMint,
+} from '@solana/spl-token';
+
+import { json, wrapCron } from '../_lib/http.js';
+import { env } from '../_lib/env.js';
+import { constantTimeEquals } from '../_lib/crypto.js';
+import { getRedis } from '../_lib/redis.js';
+import { solanaConnection } from '../_lib/solana/connection.js';
+import { logger } from '../_lib/usage.js';
+
+const log = logger('x402-seed-cron');
+
+const ORIGIN = () => env.APP_ORIGIN || 'https://three.ws';
+const USDC_MINT = env.X402_ASSET_MINT_SOLANA;
+const SOLANA_RPC = env.SOLANA_RPC_URL;
+const FETCH_TIMEOUT_MS = 20_000;
+
+// Mirror of x402-pay.js FEED_KEY so our seeded payments appear on the /pay feed.
+const FEED_KEY = 'x402:pay:feed';
+const FEED_MAX = 50;
+
+const DANCERS = ['1', '2', '3', '4'];
+const STYLES = [
+ 'hiphop', 'rumba', 'silly', 'thriller', 'capoeira',
+ 'twerk', 'spin', 'climb', 'combo',
+];
+
+function requireCron(req, res) {
+ const secret = process.env.CRON_SECRET || env.CRON_SECRET;
+ if (!secret) {
+ res.status(503).json({ error: 'not_configured', message: 'CRON_SECRET unset' });
+ return false;
+ }
+ const auth = req.headers['authorization'] || '';
+ const presented = auth.startsWith('Bearer ') ? auth.slice(7) : '';
+ if (!constantTimeEquals(presented, secret)) {
+ res.status(401).json({ error: 'unauthorized' });
+ return false;
+ }
+ return true;
+}
+
+function loadSeedKeypair() {
+ // Dedicated seeder key — allows a separate wallet funded only for seeding
+ // without touching the shared agent/demo wallet.
+ const b58 = process.env.X402_SEED_SOLANA_SECRET_BASE58
+ || process.env.X402_AGENT_SOLANA_SECRET_BASE58;
+ if (b58) {
+ const raw = bs58.decode(b58);
+ if (raw.length !== 64) throw new Error(`seed keypair decoded to ${raw.length} bytes; expected 64`);
+ return Keypair.fromSecretKey(raw);
+ }
+ // Local dev fallback — same path x402-pay.js uses.
+ if (process.env.NODE_ENV !== 'production') {
+ try {
+ const arr = JSON.parse(readFileSync('/home/codespace/.config/x402-test-wallets/solana.json', 'utf8'));
+ return Keypair.fromSecretKey(Uint8Array.from(arr));
+ } catch { /* fall through */ }
+ }
+ throw new Error('seed keypair not configured (set X402_SEED_SOLANA_SECRET_BASE58)');
+}
+
+// Pick a random element from an array.
+function pick(arr) { return arr[Math.floor(Math.random() * arr.length)]; }
+
+// Fetch one JSON endpoint — short timeout, returns { ok, status, body }.
+async function fetchJson(url, opts = {}) {
+ const controller = new AbortController();
+ const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
+ try {
+ const res = await fetch(url, {
+ ...opts,
+ signal: controller.signal,
+ headers: { 'user-agent': 'threews-x402-seed/1.0', ...opts.headers },
+ });
+ let body = null;
+ const ct = res.headers.get('content-type') || '';
+ if (ct.includes('application/json')) {
+ try { body = await res.json(); } catch { /* non-JSON */ }
+ } else {
+ const text = await res.text();
+ try { body = JSON.parse(text); } catch { body = text; }
+ }
+ return { ok: res.ok, status: res.status, body };
+ } finally {
+ clearTimeout(timer);
+ }
+}
+
+// Parse a 402 challenge body to find the Solana accept entry.
+function parseSolanaAccept(challengeBody) {
+ if (!challengeBody || !Array.isArray(challengeBody.accepts)) return null;
+ return challengeBody.accepts.find(
+ (a) => typeof a?.network === 'string' && a.network.startsWith('solana'),
+ ) || null;
+}
+
+// Build and sign a USDC TransferChecked versioned transaction for x402.
+// Caller provides a pre-fetched blockhash and mint to avoid per-call RPCs.
+function buildPaymentTx({ accept, buyer, blockhash, mintInfo, receiverAtaExists }) {
+ const mint = new PublicKey(accept.asset);
+ const payTo = new PublicKey(accept.payTo);
+ const feePayer = new PublicKey(accept.extra.feePayer);
+ const amount = BigInt(accept.amount);
+
+ const senderAta = getAssociatedTokenAddressSync(
+ mint, buyer.publicKey, false, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID,
+ );
+ const receiverAta = getAssociatedTokenAddressSync(
+ mint, payTo, false, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID,
+ );
+
+ const ixs = [
+ ComputeBudgetProgram.setComputeUnitLimit({ units: 60_000 }),
+ ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }),
+ ];
+ if (!receiverAtaExists) {
+ ixs.push(createAssociatedTokenAccountIdempotentInstruction(
+ feePayer, receiverAta, payTo, mint,
+ TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID,
+ ));
+ }
+ ixs.push(createTransferCheckedInstruction(
+ senderAta, mint, receiverAta, buyer.publicKey,
+ amount, mintInfo.decimals, [], TOKEN_PROGRAM_ID,
+ ));
+
+ const message = new TransactionMessage({
+ payerKey: feePayer,
+ recentBlockhash: blockhash,
+ instructions: ixs,
+ }).compileToV0Message();
+ const vtx = new VersionedTransaction(message);
+ vtx.sign([buyer]);
+ return Buffer.from(vtx.serialize()).toString('base64');
+}
+
+// Push an entry to the shared x402 activity feed in Redis.
+async function pushFeedEntry(entry) {
+ const r = getRedis();
+ if (!r) return;
+ try {
+ await r.lpush(FEED_KEY, JSON.stringify(entry));
+ await r.ltrim(FEED_KEY, 0, FEED_MAX - 1);
+ } catch (err) {
+ log.warn('feed_push_failed', { message: err?.message });
+ }
+}
+
+// ── Main handler ──────────────────────────────────────────────────────────────
+
+export default wrapCron(async (req, res) => {
+ if (req.method !== 'GET') return json(res, 405, { error: 'method_not_allowed' });
+ if (!requireCron(req, res)) return;
+
+ if (process.env.X402_SEED_ENABLED === 'false') {
+ return json(res, 200, { ok: true, skipped: true, reason: 'X402_SEED_ENABLED=false' });
+ }
+
+ const BATCH_SIZE = Math.max(1, Math.min(
+ 120,
+ Number(process.env.X402_SEED_BATCH_SIZE || 60),
+ ));
+
+ const origin = ORIGIN();
+
+ // ── Step 1: probe dance-tip for live payment requirements ─────────────────
+ const probeUrl = `${origin}/api/x402/dance-tip?dancer=1&dance=hiphop`;
+ const probe = await fetchJson(probeUrl);
+ if (probe.status !== 402 || !probe.body) {
+ return json(res, 200, {
+ ok: false,
+ reason: `dance-tip probe returned ${probe.status} (expected 402)`,
+ });
+ }
+ const accept = parseSolanaAccept(probe.body);
+ if (!accept) {
+ return json(res, 200, { ok: false, reason: 'no Solana accept in 402 challenge' });
+ }
+ if (!accept.extra?.feePayer) {
+ return json(res, 200, { ok: false, reason: 'Solana accept missing feePayer' });
+ }
+ if (!USDC_MINT || accept.asset !== USDC_MINT) {
+ return json(res, 200, {
+ ok: false,
+ reason: `unexpected asset in accept: ${accept.asset} (expected ${USDC_MINT})`,
+ });
+ }
+
+ // ── Step 2: load keypair, fetch shared blockhash + mint info ──────────────
+ let buyer;
+ try { buyer = loadSeedKeypair(); } catch (err) {
+ return json(res, 200, { ok: false, reason: err.message });
+ }
+
+ const conn = solanaConnection({ url: SOLANA_RPC, commitment: 'confirmed' });
+ const [{ blockhash }, mintInfo, receiverAtaInfo] = await Promise.all([
+ conn.getLatestBlockhash('confirmed'),
+ getMint(conn, new PublicKey(accept.asset)),
+ conn.getAccountInfo(getAssociatedTokenAddressSync(
+ new PublicKey(accept.asset),
+ new PublicKey(accept.payTo),
+ false, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID,
+ )),
+ ]);
+ const receiverAtaExists = receiverAtaInfo !== null;
+
+ // ── Step 3: build BATCH_SIZE signed transactions (synchronous) ────────────
+ const txBases = Array.from({ length: BATCH_SIZE }, () =>
+ buildPaymentTx({ accept, buyer, blockhash, mintInfo, receiverAtaExists }),
+ );
+
+ // ── Step 4: fire all in parallel ──────────────────────────────────────────
+ const resourceUrl = `${origin}/api/x402/dance-tip`;
+ const paymentPayloadTemplate = {
+ x402Version: 2,
+ scheme: 'exact',
+ network: accept.network,
+ resource: { url: resourceUrl, mimeType: 'application/json' },
+ accepted: accept,
+ };
+
+ const results = await Promise.allSettled(
+ txBases.map((txBase64, i) => {
+ const dancer = DANCERS[i % DANCERS.length];
+ const style = pick(STYLES);
+ const xPayment = Buffer.from(JSON.stringify({
+ ...paymentPayloadTemplate,
+ payload: { transaction: txBase64 },
+ })).toString('base64');
+
+ return fetchJson(
+ `${origin}/api/x402/dance-tip?dancer=${dancer}&dance=${style}`,
+ { headers: { 'X-PAYMENT': xPayment } },
+ ).then((r) => ({ ok: r.ok, status: r.status, dancer, style, ticket: r.body }));
+ }),
+ );
+
+ // ── Step 5: record successful payments in the x402 feed ──────────────────
+ const succeeded = results
+ .filter((r) => r.status === 'fulfilled' && r.value.ok)
+ .map((r) => r.value);
+ const failed = results.filter(
+ (r) => r.status === 'rejected' || (r.status === 'fulfilled' && !r.value.ok),
+ ).length;
+
+ const feedTs = Date.now();
+ if (succeeded.length > 0) {
+ // Push one aggregated feed entry per tick so the activity feed ticks
+ // without flooding it with 60 individual rows.
+ void pushFeedEntry({
+ ts: feedTs,
+ tool: 'dance-tip',
+ argsSummary: `seed ×${succeeded.length}`,
+ network: accept.network,
+ amount: accept.amount,
+ batch: succeeded.length,
+ payer: buyer.publicKey.toBase58(),
+ payTo: accept.payTo,
+ }).catch(() => {});
+ }
+
+ const payerAddress = buyer.publicKey.toBase58();
+ log.info('x402_seed_tick', {
+ batch: BATCH_SIZE,
+ succeeded: succeeded.length,
+ failed,
+ payer: payerAddress,
+ payTo: accept.payTo,
+ amount_atomics: accept.amount,
+ });
+
+ return json(res, 200, {
+ ok: true,
+ batch: BATCH_SIZE,
+ succeeded: succeeded.length,
+ failed,
+ payer: payerAddress,
+ payTo: accept.payTo,
+ network: accept.network,
+ amount_atomics: accept.amount,
+ price_usdc: (Number(accept.amount) / 1e6).toFixed(4),
+ total_usdc: ((succeeded.length * Number(accept.amount)) / 1e6).toFixed(4),
+ });
+});
diff --git a/api/pay/execute.js b/api/pay/execute.js
index 7de6c6025..8ac84fc84 100644
--- a/api/pay/execute.js
+++ b/api/pay/execute.js
@@ -12,9 +12,7 @@
// 1. Verifies the session token and reads the session's network preference
// 2. Probes the endpoint for its 402 challenge, selecting the right network accept
// 3. Enforces governance (budget, allowlist, per-tx cap) and reserves budget atomically
-// 4. Signs the payment using the platform payer wallet for the session's network:
-// • solana → Solana USDC SPL transfer (X402_AGENT_SOLANA_SECRET_BASE58)
-// • base → EIP-3009 transferWithAuthorization via viem (X402_EVM_AGENT_PRIVATE_KEY)
+// 4. Signs the payment using the platform Solana payer wallet (X402_AGENT_SOLANA_SECRET_BASE58)
// 5. Presents X-PAYMENT header and returns the endpoint's response
// 6. Records the execution in payment_session_executions
// 7. On failure, rolls back the budget reservation so the session isn't charged
@@ -49,12 +47,8 @@ import {
recordExecution,
SpendGovernorError,
} from '../_lib/pay/spend-governor.js';
-import { createPrivateKeySigner, buildEvmExactPayload } from '../_lib/x402/a2a-client.js';
-
-// Known USDC mint addresses per network
+// Known USDC mint address on Solana
const USDC_SOLANA_MINT = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
-const USDC_BASE_ADDRESS = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
-const BASE_CHAIN_ID = 8453; // eip155:8453
const SOLANA_RPC = env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';
const FETCH_TIMEOUT_MS = 20_000;
@@ -82,22 +76,6 @@ function loadSolanaKeypair() {
throw e;
}
-// ── Platform payer: EVM ──────────────────────────────────────────────────────
-let _evmSigner = null;
-
-async function loadEvmSigner() {
- if (_evmSigner) return _evmSigner;
- const privateKey = process.env.X402_EVM_AGENT_PRIVATE_KEY;
- if (!privateKey) {
- const e = new Error('Platform EVM payer wallet not configured (set X402_EVM_AGENT_PRIVATE_KEY)');
- e.status = 503;
- e.code = 'wallet_unconfigured';
- throw e;
- }
- _evmSigner = await createPrivateKeySigner(privateKey);
- return _evmSigner;
-}
-
// ── SSRF-guarded fetch ──────────────────────────────────────────────────────
async function guardedFetch(rawUrl, { method = 'GET', headers = {}, body } = {}) {
const url = validatePublicUrl(rawUrl);
@@ -136,20 +114,8 @@ function b64decodeJson(s) {
try { return JSON.parse(Buffer.from(String(s), 'base64').toString('utf8')); } catch { return null; }
}
-// Classify a network string into 'solana' | 'base' | 'evm' | 'unknown'
-function classifyNetwork(network) {
- if (!network) return 'unknown';
- if (typeof network === 'string' && network.startsWith('solana')) return 'solana';
- if (network === 'eip155:8453' || network === 'base') return 'base';
- if (/^eip155:\d+$/.test(network)) return 'evm';
- return 'unknown';
-}
-
-// ── Probe a 402 endpoint and select the best matching accept ────────────────
-// networkPreference: 'solana' | 'base' | 'evm' — used to pick the right
-// accept from the challenge's offers. Falls back to Solana if preferred network
-// isn't available.
-async function probe402(rawUrl, { method, body, networkPreference = 'solana' }) {
+// ── Probe a 402 endpoint and select a Solana USDC accept ────────────────────
+async function probe402(rawUrl, { method, body }) {
let res;
try {
res = await guardedFetch(rawUrl, { method, body });
@@ -175,75 +141,32 @@ async function probe402(rawUrl, { method, body, networkPreference = 'solana' })
});
}
- // Select the accept that matches the session's network preference.
- // For Solana: look for a solana:* accept with the known USDC mint.
- // For Base: look for eip155:8453 with the known USDC address.
- // If the preferred network isn't available, fail clearly — mixing networks
- // between session policy and endpoint capability is not allowed.
- let accept = null;
-
- if (networkPreference === 'solana') {
- accept = challenge.accepts.find(
- (a) => typeof a?.network === 'string' &&
- a.network.startsWith('solana') &&
- a.asset === USDC_SOLANA_MINT,
- );
- if (!accept) {
- // Accept any Solana option as fallback (validate asset separately)
- accept = challenge.accepts.find(
- (a) => typeof a?.network === 'string' && a.network.startsWith('solana'),
- );
- }
- if (!accept) {
- throw Object.assign(new Error('Service has no Solana payment option; endpoint may be EVM-only'), {
- status: 422, code: 'no_solana_accept',
- detail: { networks: [...new Set(challenge.accepts.map((a) => a?.network).filter(Boolean))] },
- });
- }
- if (accept.asset !== USDC_SOLANA_MINT) {
- throw Object.assign(new Error(`Service requested payment in a non-USDC asset (${accept.asset})`), {
- status: 422, code: 'unsupported_asset',
- detail: { asset: accept.asset, expected: USDC_SOLANA_MINT },
- });
- }
- if (!accept.extra?.feePayer) {
- throw Object.assign(new Error('Solana 402 challenge is missing feePayer'), {
- status: 422, code: 'missing_fee_payer',
- });
- }
- } else if (networkPreference === 'base') {
+ let accept = challenge.accepts.find(
+ (a) => typeof a?.network === 'string' &&
+ a.network.startsWith('solana') &&
+ a.asset === USDC_SOLANA_MINT,
+ );
+ if (!accept) {
accept = challenge.accepts.find(
- (a) => (a?.network === 'eip155:8453' || a?.network === 'base') &&
- typeof a?.asset === 'string' &&
- a.asset.toLowerCase() === USDC_BASE_ADDRESS.toLowerCase(),
+ (a) => typeof a?.network === 'string' && a.network.startsWith('solana'),
);
- if (!accept) {
- // Fall back to any EVM accept on Base
- accept = challenge.accepts.find(
- (a) => a?.network === 'eip155:8453' || a?.network === 'base',
- );
- }
- if (!accept) {
- throw Object.assign(new Error('Service has no Base/EVM payment option; endpoint may be Solana-only'), {
- status: 422, code: 'no_evm_accept',
- detail: { networks: [...new Set(challenge.accepts.map((a) => a?.network).filter(Boolean))] },
- });
- }
- if (accept.asset?.toLowerCase() !== USDC_BASE_ADDRESS.toLowerCase()) {
- throw Object.assign(new Error(`Service requested payment in a non-USDC EVM asset (${accept.asset})`), {
- status: 422, code: 'unsupported_asset',
- detail: { asset: accept.asset, expected: USDC_BASE_ADDRESS },
- });
- }
- } else {
- // Unknown network preference — try to find any Solana accept first, then any EVM
- accept = challenge.accepts.find((a) => typeof a?.network === 'string' && a.network.startsWith('solana'))
- || challenge.accepts[0];
- if (!accept) {
- throw Object.assign(new Error('Service has no recognized payment options'), {
- status: 422, code: 'no_accept',
- });
- }
+ }
+ if (!accept) {
+ throw Object.assign(new Error('Service has no Solana USDC payment option'), {
+ status: 422, code: 'no_solana_accept',
+ detail: { networks: [...new Set(challenge.accepts.map((a) => a?.network).filter(Boolean))] },
+ });
+ }
+ if (accept.asset !== USDC_SOLANA_MINT) {
+ throw Object.assign(new Error(`Service requested payment in a non-USDC asset (${accept.asset})`), {
+ status: 422, code: 'unsupported_asset',
+ detail: { asset: accept.asset, expected: USDC_SOLANA_MINT },
+ });
+ }
+ if (!accept.extra?.feePayer) {
+ throw Object.assign(new Error('Solana 402 challenge is missing feePayer'), {
+ status: 422, code: 'missing_fee_payer',
+ });
}
const resource =
@@ -303,26 +226,10 @@ async function buildSolanaPayload({ accept, buyer, conn, resourceUrl }) {
};
}
-// ── Build and sign an EVM EIP-3009 transferWithAuthorization ────────────────
-async function buildEvmPayload({ accept, signer, resourceUrl }) {
- const payload = await buildEvmExactPayload({
- accept,
- signer,
- resource: { url: resourceUrl, mimeType: 'application/json' },
- });
- return payload;
-}
-
-// Explorer URL for a given tx hash and network
-function explorerUrl(txHash, network) {
+// Explorer URL for a given tx hash
+function explorerUrl(txHash) {
if (!txHash) return null;
- if (typeof network === 'string' && network.startsWith('solana')) {
- return `https://solscan.io/tx/${txHash}`;
- }
- if (network === 'eip155:8453' || network === 'base') {
- return `https://basescan.org/tx/${txHash}`;
- }
- return null;
+ return `https://solscan.io/tx/${txHash}`;
}
// ── Main handler ─────────────────────────────────────────────────────────────
@@ -356,11 +263,10 @@ export default wrap(async (req, res) => {
const t0 = Date.now();
- // Phase 0: peek at the session to know the network preference before probing.
- // This is a read-only lookup — the atomic reservation happens later in phase 3.
- let sessionPreview;
+ // Phase 0: verify the token is valid before probing the endpoint.
+ // The atomic reservation happens later in phase 2.
try {
- sessionPreview = await verifySessionToken(sessionToken);
+ await verifySessionToken(sessionToken);
} catch (err) {
if (err instanceof SpendGovernorError) {
return error(res, err.status, err.code, err.message, err.detail);
@@ -368,12 +274,10 @@ export default wrap(async (req, res) => {
throw err;
}
- const networkPreference = classifyNetwork(sessionPreview.network) === 'base' ? 'base' : 'solana';
-
// Phase 1: probe the endpoint for its 402 challenge
let probeResult;
try {
- probeResult = await probe402(targetUrl, { method, body: requestBody, networkPreference });
+ probeResult = await probe402(targetUrl, { method, body: requestBody });
} catch (err) {
return error(res, err.status ?? 502, err.code ?? 'probe_failed', err.message, err.detail);
}
@@ -410,50 +314,29 @@ export default wrap(async (req, res) => {
throw err;
}
- // Phase 3: load platform payer and build the signed payment payload
+ // Phase 3: load platform Solana payer and build the signed payment payload
let paymentPayload;
let payerAddress;
- if (networkPreference === 'base') {
- let signer;
- try {
- signer = await loadEvmSigner();
- } catch (err) {
- await rollbackReservation(sessionRecord.id, amountAtomics).catch(() => {});
- return error(res, 503, 'wallet_unconfigured', 'Platform EVM payment wallet is not configured');
- }
- payerAddress = signer.address;
- try {
- paymentPayload = await buildEvmPayload({
- accept,
- signer,
- resourceUrl: resource.url || targetUrl,
- });
- } catch (err) {
- await rollbackReservation(sessionRecord.id, amountAtomics).catch(() => {});
- return error(res, 502, 'build_failed', `Failed to build EVM payment: ${err?.message}`);
- }
- } else {
- let keypair;
- try {
- keypair = loadSolanaKeypair();
- } catch (err) {
- await rollbackReservation(sessionRecord.id, amountAtomics).catch(() => {});
- return error(res, 503, 'wallet_unconfigured', 'Platform Solana payment wallet is not configured');
- }
- payerAddress = keypair.publicKey.toBase58();
- const conn = solanaConnection({ url: SOLANA_RPC, commitment: 'confirmed' });
- try {
- paymentPayload = await buildSolanaPayload({
- accept,
- buyer: keypair,
- conn,
- resourceUrl: resource.url || targetUrl,
- });
- } catch (err) {
- await rollbackReservation(sessionRecord.id, amountAtomics).catch(() => {});
- return error(res, 502, 'build_failed', `Failed to build Solana payment: ${err?.message}`);
- }
+ let keypair;
+ try {
+ keypair = loadSolanaKeypair();
+ } catch (err) {
+ await rollbackReservation(sessionRecord.id, amountAtomics).catch(() => {});
+ return error(res, 503, 'wallet_unconfigured', 'Platform Solana payment wallet is not configured');
+ }
+ payerAddress = keypair.publicKey.toBase58();
+ const conn = solanaConnection({ url: SOLANA_RPC, commitment: 'confirmed' });
+ try {
+ paymentPayload = await buildSolanaPayload({
+ accept,
+ buyer: keypair,
+ conn,
+ resourceUrl: resource.url || targetUrl,
+ });
+ } catch (err) {
+ await rollbackReservation(sessionRecord.id, amountAtomics).catch(() => {});
+ return error(res, 502, 'build_failed', `Failed to build Solana payment: ${err?.message}`);
}
const xPayment = Buffer.from(JSON.stringify(paymentPayload)).toString('base64');
@@ -569,7 +452,7 @@ export default wrap(async (req, res) => {
payer,
pay_to: accept.payTo,
tx_hash: txHash,
- explorer: explorerUrl(txHash, accept.network),
+ explorer: explorerUrl(txHash),
},
session: {
id: sessionRecord.id,
diff --git a/data/changelog.json b/data/changelog.json
index 25cbd6861..9e26f31db 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,13 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-27",
+ "title": "60 live x402 payments per minute",
+ "summary": "A new per-minute cron fires 60 parallel real Solana USDC micropayments each tick via the x402 protocol, seeding the platform's payment activity feed and club stage with continuous on-chain traffic. Each payment is a signed SPL TransferChecked transaction broadcast via the Solana facilitator — not simulated. Configure the batch size or pause it with X402_SEED_BATCH_SIZE / X402_SEED_ENABLED.",
+ "tags": ["infra", "feature"],
+ "link": "/pay"
+ },
{
"date": "2026-06-27",
"title": "Improved resilience during database outages",
diff --git a/packages/agentcore-payments-mcp/src/tools/create-session.js b/packages/agentcore-payments-mcp/src/tools/create-session.js
index 187697b75..ac62d47e0 100644
--- a/packages/agentcore-payments-mcp/src/tools/create-session.js
+++ b/packages/agentcore-payments-mcp/src/tools/create-session.js
@@ -33,8 +33,8 @@ export const def = {
.describe('If set, only allow payments to endpoints at these hosts (e.g. ["api.weather.com"]). Empty = any host.'),
agent_id: z.string().uuid().optional()
.describe('Optional: restrict this session token to a specific agent identity UUID.'),
- network: z.enum(['solana', 'base']).default('solana')
- .describe('Settlement network for x402 payments. Default: solana.'),
+ network: z.literal('solana').default('solana')
+ .describe('Settlement network for x402 payments. Solana USDC only.'),
metadata: z.record(z.any()).optional()
.describe('Optional arbitrary metadata to attach to this session for bookkeeping.'),
},
diff --git a/pages/payments.html b/pages/payments.html
index e8c22fb03..d61d68d96 100644
--- a/pages/payments.html
+++ b/pages/payments.html
@@ -82,7 +82,6 @@
.sc-badge.cancelled { background: rgba(248,113,113,0.1); color: #f87171; border: 1px solid rgba(248,113,113,0.2); }
.sc-net { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; }
.sc-net.sol { background: rgba(153,69,255,0.12); color: #c084fc; border: 1px solid rgba(153,69,255,0.2); }
- .sc-net.base { background: rgba(59,130,246,0.1); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.sc-label { font-weight: 600; font-size: 14.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-label-unnamed { color: rgba(255,255,255,0.4); font-style: italic; font-weight: 400; }
.sc-amounts { display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
@@ -362,7 +361,6 @@
<label>Network</label>
<select id="fNetwork">
<option value="solana" selected>Solana USDC</option>
- <option value="base">Base USDC</option>
</select>
</div>
<div class="f-row">
@@ -541,11 +539,9 @@
}
// ── Execution table ────────────────────────────────────────
- function explorerHref(txHash, network) {
+ function explorerHref(txHash) {
if (!txHash) return null;
- if (String(network).startsWith('solana')) return `https://solscan.io/tx/${txHash}`;
- if (network === 'eip155:8453' || network === 'base') return `https://basescan.org/tx/${txHash}`;
- return null;
+ return `https://solscan.io/tx/${txHash}`;
}
function renderExecs(items) {
@@ -561,7 +557,7 @@
</tr></thead>
<tbody>
${items.map(e => {
- const href = explorerHref(e.tx_hash, e.network);
+ const href = explorerHref(e.tx_hash);
return `<tr>
<td><div class="exec-url" title="${esc(e.endpoint_url)}">${esc(e.endpoint_host || e.endpoint_url)}</div></td>
<td><span class="exec-amt">${fmtUsd(e.amount_usd)}</span></td>
@@ -597,8 +593,8 @@
const bc = barCls(p, s.status);
const rc = remainCls(s);
const exp = s.status === 'active' ? fmtExpiry(s) : { text: '', cls: '' };
- const netCls = s.network === 'base' ? 'base' : 'sol';
- const netLabel = s.network === 'base' ? 'Base' : 'Solana';
+ const netCls = 'sol';
+ const netLabel = 'Solana';
const hosts = s.allowed_hosts?.length ? s.allowed_hosts.join(', ') : 'Any host';
const maxTx = s.max_per_tx_usd != null ? `$${s.max_per_tx_usd}` : 'No limit';
diff --git a/vercel.json b/vercel.json
index a7220dced..4b1805fb3 100644
--- a/vercel.json
+++ b/vercel.json
@@ -73,6 +73,9 @@
"api/cron/forge-seed-cron.js": {
"maxDuration": 70
},
+ "api/cron/x402-seed-cron.js": {
+ "maxDuration": 70
+ },
"api/cron/pulse-tick.js": {
"maxDuration": 120
},
@@ -4583,6 +4586,10 @@
"path": "/api/cron/forge-seed-cron",
"schedule": "* * * * *"
},
+ {
+ "path": "/api/cron/x402-seed-cron",
+ "schedule": "* * * * *"
+ },
{
"path": "/api/cron/pulse-tick",
"schedule": "*/2 * * * *"