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 installDeps flag for solana-agent-sdk and implement mock for connectPumpFunFeed REST fallback tests

udvkbbae781c4701
diff --git a/scripts/build-vercel.mjs b/scripts/build-vercel.mjs
index fa09e5ab2..40425494f 100644
--- a/scripts/build-vercel.mjs
+++ b/scripts/build-vercel.mjs
@@ -122,6 +122,10 @@ const SDKS = [
// deployed node_modules at runtime.
name: '@three-ws/solana-agent',
dir: 'solana-agent-sdk',
+ // Unlike agent-payments-sdk this package is NOT a root workspace, so the
+ // top-level `npm ci` never installs its devDeps (tsup, typescript). Its
+ // own deps must be installed before the dist can be rebuilt from source.
+ installDeps: true,
entries: [
'solana-agent-sdk/dist/index.js',
'solana-agent-sdk/dist/wallet/index.js',
diff --git a/solana-agent-sdk/package-lock.json b/solana-agent-sdk/package-lock.json
index a3ffd92e5..924b51654 100644
--- a/solana-agent-sdk/package-lock.json
+++ b/solana-agent-sdk/package-lock.json
@@ -1,15 +1,18 @@
{
"name": "@three-ws/solana-agent",
- "version": "0.1.0",
+ "version": "0.2.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@three-ws/solana-agent",
- "version": "0.1.0",
- "license": "MIT",
+ "version": "0.2.0",
+ "license": "Apache-2.0",
"dependencies": {
"@coral-xyz/anchor": "^0.32.1",
+ "@noble/ciphers": "^1.3.0",
+ "@noble/curves": "^2.2.0",
+ "@noble/hashes": "^1.8.0",
"@solana/spl-token": "^0.4.9",
"@solana/web3.js": "^1.98.0",
"@tetsuo-ai/protocol": "^0.2.0",
@@ -26,6 +29,9 @@
"typescript": "^5.7.3",
"zod": "^3.0.0"
},
+ "engines": {
+ "node": ">=18"
+ },
"peerDependencies": {
"zod": "^3.0.0"
},
@@ -1753,16 +1759,40 @@
"@tybys/wasm-util": "^0.10.0"
}
},
+ "node_modules/@noble/ciphers": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz",
+ "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==",
+ "license": "MIT",
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
"node_modules/@noble/curves": {
- "version": "1.9.7",
- "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz",
- "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==",
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-2.2.0.tgz",
+ "integrity": "sha512-T/BoHgFXirb0ENSPBquzX0rcjXeM6Lo892a2jlYJkqk83LqZx0l1Of7DzlKJ6jkpvMrkHSnAcgb5JegL8SeIkQ==",
"license": "MIT",
"dependencies": {
- "@noble/hashes": "1.8.0"
+ "@noble/hashes": "2.2.0"
},
"engines": {
- "node": "^14.21.3 || >=16"
+ "node": ">= 20.19.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@noble/curves/node_modules/@noble/hashes": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.2.0.tgz",
+ "integrity": "sha512-IYqDGiTXab6FniAgnSdZwgWbomxpy9FtYvLKs7wCUs2a8RkITG+DFGO1DM9cr+E3/RgADRpFjrKVaJ1z6sjtEg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 20.19.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
@@ -2381,6 +2411,21 @@
"superstruct": "^2.0.2"
}
},
+ "node_modules/@solana/web3.js/node_modules/@noble/curves": {
+ "version": "1.9.7",
+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz",
+ "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/hashes": "1.8.0"
+ },
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
"node_modules/@solana/web3.js/node_modules/@solana/codecs-core": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@solana/codecs-core/-/codecs-core-2.3.0.tgz",
diff --git a/tests/pumpfun-ws-feed.test.js b/tests/pumpfun-ws-feed.test.js
index d7216ee4d..9f2552923 100644
--- a/tests/pumpfun-ws-feed.test.js
+++ b/tests/pumpfun-ws-feed.test.js
@@ -17,8 +17,19 @@ vi.mock('../api/_lib/env.js', () => ({
env: { DATABASE_URL: 'postgres://test', APP_ORIGIN: 'http://test' },
}));
+// Keep the WS client inert so connectPumpFunFeed never opens a real socket — we
+// only exercise the REST mint fallback here.
+vi.mock('ws', () => {
+ class FakeWS {
+ on() { return this; }
+ send() {}
+ close() {}
+ }
+ return { default: FakeWS };
+});
+
const mod = await import('../api/_lib/pumpfun-ws-feed.js');
-const { recentBuffered, recentGraduations } = mod;
+const { recentBuffered, recentGraduations, connectPumpFunFeed } = mod;
// Internal symbols we want to exercise. They're not exported; reach in via the
// module namespace if available. The test suite below reaches them through
@@ -90,3 +101,65 @@ describe('recentGraduations', () => {
expect(last).toBeGreaterThanOrEqual(1);
});
});
+
+describe('connectPumpFunFeed — new-mint REST fallback', () => {
+ const realFetch = globalThis.fetch;
+ afterEach(() => { globalThis.fetch = realFetch; });
+
+ function mockFetch(coins) {
+ globalThis.fetch = vi.fn(async (url) => {
+ const u = String(url);
+ if (u.includes('coingecko')) return { ok: true, json: async () => ({ solana: { usd: 150 } }) };
+ if (u.includes('pump.fun/coins')) return { ok: true, json: async () => coins };
+ return { ok: false, json: async () => ({}) };
+ });
+ }
+
+ it('emits recent pump.fun coins as mint events when the WS is silent', async () => {
+ mockFetch([
+ { mint: 'MINTAAA', name: 'Alpha', symbol: 'ALP', creator: 'CR1', market_cap: 30, usd_market_cap: 5000, created_timestamp: 1782432177000, image_uri: 'ipfs://a', twitter: 'https://x.com/a', quote_mint: '11111111111111111111111111111111' },
+ { mint: 'MINTBBB', name: 'Beta', symbol: 'BET', creator: 'CR2', market_cap: 20, usd_market_cap: 3000, created_timestamp: 1782432170000 },
+ ]);
+
+ const events = [];
+ const ac = new AbortController();
+ const stop = connectPumpFunFeed({ kind: 'all', mints: [], signal: ac.signal, onEvent: (e) => events.push(e) });
+ await new Promise((r) => setTimeout(r, 60)); // let the immediate backfill resolve
+ stop();
+
+ const mints = events.filter((e) => e.kind === 'mint');
+ expect(mints.length).toBe(2);
+ const byMint = Object.fromEntries(mints.map((e) => [e.data.mint, e.data]));
+ expect(byMint.MINTAAA).toMatchObject({
+ symbol: 'ALP', market_cap_usd: 5000, source: 'rest',
+ quote_symbol: 'SOL', twitter: 'https://x.com/a',
+ });
+ // created_timestamp (ms) is surfaced to the client as unix seconds.
+ expect(byMint.MINTAAA.created_at).toBe(Math.floor(1782432177000 / 1000));
+ // USD market cap is derived from market_cap (SOL) × price when absent.
+ expect(byMint.MINTAAA.market_cap_usd).toBe(5000);
+ });
+
+ it('does not re-emit the same mint across repeated backfills (dedupe)', async () => {
+ mockFetch([
+ { mint: 'DUPE111', name: 'Dup', symbol: 'DUP', market_cap: 10, usd_market_cap: 1000, created_timestamp: 1782432177000 },
+ ]);
+
+ const events = [];
+ const ac = new AbortController();
+ // First connection consumes the coin once.
+ const stop1 = connectPumpFunFeed({ kind: 'all', mints: [], signal: ac.signal, onEvent: (e) => events.push(e) });
+ await new Promise((r) => setTimeout(r, 60));
+ stop1();
+ const firstCount = events.filter((e) => e.kind === 'mint').length;
+ expect(firstCount).toBe(1);
+
+ // A brand-new connection (fresh per-connection dedupe) still sees the
+ // backlog — the dedupe is per-connection, not global.
+ const events2 = [];
+ const stop2 = connectPumpFunFeed({ kind: 'all', mints: [], signal: new AbortController().signal, onEvent: (e) => events2.push(e) });
+ await new Promise((r) => setTimeout(r, 60));
+ stop2();
+ expect(events2.filter((e) => e.kind === 'mint').length).toBe(1);
+ });
+});