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.

fix(action.js): integrate OnlinePumpSdk for improved global data fetching in launch prep and quote handling

nirholas9841c4edc296
diff --git a/api/agents/tokens/[action].js b/api/agents/tokens/[action].js
index 7c7033e9e..0ba0d1636 100644
--- a/api/agents/tokens/[action].js
+++ b/api/agents/tokens/[action].js
@@ -173,9 +173,10 @@ async function handleLaunchPrep(req, res) {
// 4. Build the launch tx
const { Connection, Keypair, PublicKey, Transaction, ComputeBudgetProgram } =
await loadSolanaWeb3();
- const { PumpSdk, getBuyTokenAmountFromSolAmount, BN } = await loadPumpSdk();
+ const { PumpSdk, OnlinePumpSdk, getBuyTokenAmountFromSolAmount, BN } = await loadPumpSdk();
const conn = new Connection(rpcUrl(body.cluster), 'confirmed');
- const sdk = new PumpSdk(conn);
+ const onlineSdk = new OnlinePumpSdk(conn);
+ const sdk = new PumpSdk();
const mintKeypair = Keypair.generate();
const creator = new PublicKey(body.wallet_address);
@@ -188,7 +189,7 @@ async function handleLaunchPrep(req, res) {
];
if (body.initial_buy_sol > 0) {
- const global = await sdk.fetchGlobal();
+ const global = await onlineSdk.fetchGlobal();
const lamports = new BN(Math.floor(body.initial_buy_sol * 1_000_000_000));
const tokenAmount = getBuyTokenAmountFromSolAmount({
global,
@@ -424,10 +425,10 @@ async function handleLaunchQuote(req, res) {
if (q.initial_buy_sol > 0) {
try {
const { Connection } = await loadSolanaWeb3();
- const { PumpSdk, getBuyTokenAmountFromSolAmount, BN } = await loadPumpSdk();
+ const { OnlinePumpSdk, getBuyTokenAmountFromSolAmount, BN } = await loadPumpSdk();
const conn = new Connection(rpcUrl(q.cluster), 'confirmed');
- const sdk = new PumpSdk(conn);
- const global = await sdk.fetchGlobal();
+ const onlineSdk = new OnlinePumpSdk(conn);
+ const global = await onlineSdk.fetchGlobal();
const lamports = new BN(Math.floor(q.initial_buy_sol * 1_000_000_000));
const tokensOut = getBuyTokenAmountFromSolAmount({
global,
diff --git a/api/wk.js b/api/wk.js
index e2742f78a..fd2e96e11 100644
--- a/api/wk.js
+++ b/api/wk.js
@@ -3,6 +3,7 @@
import { cors, json, method, wrap, error } from './_lib/http.js';
import { env } from './_lib/env.js';
+import { paymentRequirements, X402_VERSION } from './_lib/x402-spec.js';
// ── agent-attestation-schemas ─────────────────────────────────────────────────
@@ -67,10 +68,11 @@ function handleOauthProtectedResource(req, res) {
// ── x402 ─────────────────────────────────────────────────────────────────────
function handleX402(req, res) {
+ const mcpResource = `${env.APP_ORIGIN}/api/mcp`;
+ const accepts = paymentRequirements({ resource: mcpResource, description: 'MCP tool call' });
return json(res, 200, {
- version: 1,
- resources: ['POST /api/mcp'],
- schemes: ['solana-pay', 'evm-erc20', 'pump-agent-payments'],
+ x402Version: X402_VERSION,
+ accepts,
pump_agent_payments: { prep: '/api/pump/accept-payment-prep', confirm: '/api/pump/accept-payment-confirm', balances: '/api/pump/balances' },
}, { 'cache-control': 'public, max-age=300' });
}