{"_id":"@120356aa/pumpfun-api","name":"@120356aa/pumpfun-api","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@120356aa/pumpfun-api","version":"1.0.0","description":"A Node.js wrapper for the Pump.fun public APIs","main":"src/index.js","type":"module","scripts":{"test":"node --test","example":"node examples/basic-usage.js"},"keywords":["pump.fun","solana","crypto","api","livestream","defi"],"author":"","license":"MIT","dependencies":{"node-fetch":"^3.3.2"},"devDependencies":{"@types/node":"^20.0.0"},"engines":{"node":">=18.0.0"},"repository":{"type":"git","url":"git+https://github.com/snowdamiz/pumpfun-api-wrapper.git"},"bugs":{"url":"https://github.com/snowdamiz/pumpfun-api-wrapper/issues"},"homepage":"https://github.com/snowdamiz/pumpfun-api-wrapper#readme","_id":"@120356aa/pumpfun-api@1.0.0","gitHead":"17bfef9a0b9a346a2c5a03d5e93b0f22d0591bb6","_nodeVersion":"22.14.0","_npmVersion":"11.3.0","dist":{"integrity":"sha512-rxo2+CjO852yZPRCzoOMrE4OnyVgZXRTKDGrs+FsKdkVcB97gQpy5yo3XXTTLhY0QZ9KVyFeaM3jm5QBmoTh2w==","shasum":"06011cf5eb089b28e5d584f33ff501230fb9fc30","tarball":"https://registry.npmjs.org/@120356aa/pumpfun-api/-/pumpfun-api-1.0.0.tgz","fileCount":9,"unpackedSize":63919,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIANdWop4YjPtki+aeTXyaTRLqObl2Mfcxvg+bvnkRIbZAiEAn1rQ2nK2/q4USJUCJ2ZpZMcHx4PkD6QrKW2rN+DHkH4="}]},"_npmUser":{"name":"120356aa","email":"yurlovandrew@gmail.com"},"directories":{},"maintainers":[{"name":"120356aa","email":"yurlovandrew@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pumpfun-api_1.0.0_1760830201900_0.9464367896865813"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-18T23:30:01.823Z","1.0.0":"2025-10-18T23:30:02.102Z","modified":"2025-10-18T23:30:02.360Z"},"maintainers":[{"name":"120356aa","email":"yurlovandrew@gmail.com"}],"description":"A Node.js wrapper for the Pump.fun public APIs","homepage":"https://github.com/snowdamiz/pumpfun-api-wrapper#readme","keywords":["pump.fun","solana","crypto","api","livestream","defi"],"repository":{"type":"git","url":"git+https://github.com/snowdamiz/pumpfun-api-wrapper.git"},"bugs":{"url":"https://github.com/snowdamiz/pumpfun-api-wrapper/issues"},"license":"MIT","readme":"# Pump.fun API\n\nA comprehensive Node.js wrapper for the Pump.fun public APIs, providing easy access to live streaming tokens, market data, and social features.\n\n## Installation\n\n```bash\nnpm install pumpfun-api\n```\n\n## Quick Start\n\n```javascript\nimport { createClient, getCurrentlyLiveCoins, getSolPrice } from 'pumpfun-api';\n\n// Get current live streaming coins\nconst liveCoins = await getCurrentlyLiveCoins({ limit: 10 });\nconsole.log(`Found ${liveCoins.length} live coins`);\n\n// Get SOL price\nconst { solPrice } = await getSolPrice();\nconsole.log(`SOL is currently $${solPrice}`);\n```\n\n## Features\n\n- 🚀 Full coverage of Pump.fun public APIs\n- 📺 Live streaming token data\n- 💰 Market data and SOL prices\n- 🎬 Stream clips and highlights\n- 💬 Chat and social features\n- 🔒 Built-in error handling and timeouts\n- 📝 Full TypeScript support\n- 📖 Comprehensive examples\n\n## API Methods\n\n### Live Streaming Coins\n\n```javascript\n// Get currently live coins with pagination\nconst liveCoins = await client.getCurrentlyLiveCoins({\n  offset: 0,        // Skip items (default: 0)\n  limit: 60,        // Items to return (default: 60, max: 60)\n  sort: 'currently_live', // Sort field\n  order: 'DESC',    // Sort order (ASC/DESC)\n  includeNsfw: false // Include NSFW content\n});\n```\n\n### Stream Clips and Highlights\n\n```javascript\n// Get complete stream recordings\nconst completeStreams = await client.getCompleteStreams(mintId, 20);\n\n// Get highlight clips\nconst highlights = await client.getHighlightClips(mintId, 20);\n\n// Generic clip retrieval\nconst clips = await client.getStreamClips(mintId, {\n  limit: 20,\n  clipType: 'COMPLETE' // or 'HIGHLIGHT'\n});\n```\n\n### Livestream Status\n\n```javascript\n// Check if creator is approved for livestreaming\nconst approval = await client.checkCreatorLivestreamApproval(mintId);\n\n// Get current livestream status\nconst livestream = await client.getCurrentLivestream(mintId);\n```\n\n### Chat and Social\n\n```javascript\n// Get chat invite information\nconst invites = await client.getCoinChatInvites(mintId);\n```\n\n### Market Data\n\n```javascript\n// Get current SOL price\nconst solPrice = await client.getSolPrice();\n\n// Get platform flags and configuration\nconst flags = await client.getPlatformFlags();\n```\n\n### Download Clips\n\n```javascript\n// Download a highlight clip (MP4)\nconst clip = { /* StreamClip object */ };\nconst result = await client.downloadHighlightClip(clip, './downloads/clip.mp4', {\n  onProgress: (progress, downloaded, total) => {\n    console.log(`Download: ${progress.toFixed(1)}%`);\n  }\n});\n\n// Download a complete stream (HLS) - requires ffmpeg\nconst completeResult = await client.downloadCompleteStream(clip, './downloads/complete.mp4', {\n  onProgress: (progress, currentTime, totalTime) => {\n    console.log(`Progress: ${progress.toFixed(1)}%`);\n  },\n  ffmpegPath: 'ffmpeg' // or path to ffmpeg executable\n});\n\n// Download with automatic format detection\nconst autoResult = await client.downloadClip(clip, './downloads/auto.mp4');\n\n// Download multiple clips\nconst results = await client.downloadHighlightClips(clips, './downloads/', {\n  concurrency: 3, // Download 3 clips simultaneously\n  filenameGenerator: (clip, index) => `clip-${index + 1}.mp4`\n});\n\n// Download thumbnail\nconst thumbResult = await client.downloadThumbnail(clip, './downloads/thumb.jpg');\n\n// Get download information\nconst info = await client.getClipDownloadInfo(clip);\nconsole.log(`Format: ${info.format}, Size: ${info.estimatedSize} bytes`);\n```\n\n## Client Configuration\n\n```javascript\nimport { createClient } from 'pumpfun-api';\n\nconst client = createClient({\n  timeout: 30000, // Request timeout in milliseconds\n  headers: {\n    'User-Agent': 'My-App/1.0'\n  }\n});\n```\n\n## Data Structures\n\n### Live Coin Object\n\n```javascript\n{\n  mint: \"string\",              // Solana token mint address\n  name: \"string\",              // Coin name\n  symbol: \"string\",            // Ticker symbol\n  description: \"string\",       // Coin description\n  image_uri: \"string\",         // IPFS image URL\n  market_cap: 12345.67,        // USD market cap\n  is_currently_live: true,     // Live streaming status\n  livestream_title: \"string\",  // Livestream title\n  creator: \"string\",           // Creator wallet address\n  // ... many more fields\n}\n```\n\n### Stream Clip Object\n\n```javascript\n{\n  clipId: \"string\",\n  sessionId: \"string\",\n  startTime: \"2023-10-18T15:30:00Z\",\n  endTime: \"2023-10-18T16:30:00Z\",\n  duration: 3600,              // Duration in seconds\n  playlistUrl: \"string\",       // HLS playlist URL (for COMPLETE clips)\n  mp4Url: \"string\",            // Direct MP4 URL (for HIGHLIGHT clips)\n  thumbnailUrl: \"string\",      // Thumbnail image URL\n  clipType: \"COMPLETE\" | \"HIGHLIGHT\",\n  createdAt: \"2023-10-18T16:45:00Z\"\n}\n```\n\n## Downloading Clips\n\n### Prerequisites\n\n- **MP4 Downloads**: No additional requirements\n- **HLS Downloads**: Requires [ffmpeg](https://ffmpeg.org/) to be installed\n  - Ubuntu: `sudo apt-get install ffmpeg`\n  - macOS: `brew install ffmpeg`\n  - Windows: Download from [ffmpeg.org](https://ffmpeg.org/download.html)\n\n### Download Types\n\nThe package supports two types of downloads:\n\n1. **Highlight Clips (HIGHLIGHT)**: Direct MP4 downloads\n2. **Complete Streams (COMPLETE)**: HLS streams converted to MP4 using ffmpeg\n\n### Download Options\n\n```javascript\nconst options = {\n  onProgress: (progress, downloaded, total) => {\n    // Progress callback (0-100%)\n    console.log(`Progress: ${progress.toFixed(1)}%`);\n  },\n  timeout: 300000, // Download timeout in milliseconds\n  ffmpegPath: 'ffmpeg' // Path to ffmpeg executable (for HLS downloads)\n};\n```\n\n### Download Results\n\n```javascript\n{\n  success: true,\n  path: '/path/to/downloaded/file.mp4',\n  size: 1234567, // File size in bytes\n  clip: { /* Original clip data */ }\n}\n```\n\n### Batch Downloads\n\n```javascript\n// Download multiple clips with concurrency control\nconst results = await client.downloadHighlightClips(clips, './downloads/', {\n  concurrency: 3, // Max simultaneous downloads\n  filenameGenerator: (clip, index) => {\n    // Custom filename generation\n    return `clip-${index + 1}-${clip.clipId}.mp4`;\n  },\n  onProgress: (progress, downloaded, total) => {\n    // Progress for individual downloads\n  }\n});\n\n// Check results\nresults.forEach(result => {\n  if (result.success) {\n    console.log(`Downloaded: ${result.path}`);\n  } else {\n    console.log(`Failed: ${result.error}`);\n  }\n});\n```\n\n## Examples\n\n### Basic Usage\n\n```javascript\nimport { createClient } from 'pumpfun-api';\n\nconst client = createClient();\n\n// Get live coins and their details\nconst liveCoins = await client.getCurrentlyLiveCoins({ limit: 10 });\n\nfor (const coin of liveCoins) {\n  console.log(`${coin.name} (${coin.symbol})`);\n  console.log(`Market Cap: $${coin.market_cap.toLocaleString()}`);\n  console.log(`Live: ${coin.is_currently_live}`);\n\n  if (coin.is_currently_live) {\n    const clips = await client.getHighlightClips(coin.mint, 3);\n    console.log(`Clips: ${clips.clips.length} available`);\n  }\n}\n```\n\n### Advanced Usage with Pagination\n\n```javascript\n// Get all live coins with pagination\nlet allCoins = [];\nlet offset = 0;\nconst limit = 60;\n\nwhile (true) {\n  const coins = await client.getCurrentlyLiveCoins({ offset, limit });\n\n  if (coins.length === 0) break;\n\n  allCoins = allCoins.concat(coins);\n  offset += limit;\n}\n\n// Filter high market cap tokens\nconst highCapTokens = allCoins\n  .filter(coin => coin.market_cap > 100000)\n  .sort((a, b) => b.market_cap - a.market_cap);\n```\n\n### Error Handling\n\n```javascript\nimport { createClient } from 'pumpfun-api';\n\nconst client = createClient({ timeout: 10000 });\n\ntry {\n  const liveCoins = await client.getCurrentlyLiveCoins();\n  console.log(`Found ${liveCoins.length} live coins`);\n} catch (error) {\n  if (error.message.includes('timeout')) {\n    console.error('Request timed out');\n  } else if (error.message.includes('HTTP error')) {\n    console.error('API error:', error.message);\n  } else {\n    console.error('Unexpected error:', error);\n  }\n}\n```\n\n### Download Example\n\n```javascript\nimport { createClient } from 'pumpfun-api';\n\nconst client = createClient();\n\nasync function downloadTokenClips(mintId) {\n  try {\n    // Get highlight clips\n    const { clips } = await client.getHighlightClips(mintId, 5);\n\n    console.log(`Found ${clips.length} clips, downloading...`);\n\n    // Download each clip with progress tracking\n    for (const [index, clip] of clips.entries()) {\n      try {\n        const result = await client.downloadHighlightClip(\n          clip,\n          `./downloads/clip-${index + 1}.mp4`,\n          {\n            onProgress: (progress) => {\n              process.stdout.write(`\\rClip ${index + 1}: ${progress.toFixed(1)}%`);\n            }\n          }\n        );\n\n        console.log(`\\n✅ Downloaded: ${result.path}`);\n        console.log(`   Size: ${(result.size / 1024 / 1024).toFixed(2)} MB`);\n\n      } catch (error) {\n        console.log(`\\n❌ Failed to download clip ${index + 1}: ${error.message}`);\n      }\n    }\n\n    // Batch download thumbnails\n    const thumbnailResults = await client.downloadHighlightClips(\n      clips.map(clip => ({ ...clip, mp4Url: clip.thumbnailUrl })),\n      './downloads/thumbnails/',\n      {\n        concurrency: 5,\n        filenameGenerator: (clip, index) => `thumb-${index + 1}.jpg`\n      }\n    );\n\n    console.log(`\\nDownloaded ${thumbnailResults.filter(r => r.success).length} thumbnails`);\n\n  } catch (error) {\n    console.error('Download failed:', error.message);\n  }\n}\n```\n\n## Running Examples\n\nThe package includes comprehensive examples:\n\n```bash\n# Run basic usage example\nnpm run example\n\n# Or run examples directly\nnode examples/basic-usage.js\nnode examples/advanced-usage.js\nnode examples/download-clips.js\n```\n\n## TypeScript Support\n\nThis package includes full TypeScript definitions:\n\n```typescript\nimport { PumpFunClient, LiveCoin, StreamClip } from 'pumpfun-api';\n\nconst client: PumpFunClient = createClient();\nconst coins: LiveCoin[] = await client.getCurrentlyLiveCoins();\nconst clips: { clips: StreamClip[] } = await client.getHighlightClips(mintId);\n```\n\n## API Endpoints\n\nThis wrapper covers the following Pump.fun API endpoints:\n\n- **Live Streaming**: `GET /coins/currently-live`\n- **Stream Clips**: `GET /clips/{mintId}`\n- **Livestream Status**: `GET /livestream` and `GET /livestream/is-approved-creator`\n- **Chat**: `GET /invites/coin/{mintId}`\n- **Market Data**: `GET /sol-price` and `GET /api/flags`\n\n## Rate Limiting\n\n- Include proper headers (`Origin: https://pump.fun`) for better compatibility\n- Implement appropriate delays between requests\n- Handle timeouts gracefully with the built-in timeout configuration\n\n## Clip Formats\n\n### Complete Streams (clipType=COMPLETE)\n- **Format**: HLS (HTTP Live Streaming)\n- **URL**: `playlistUrl` contains the `.m3u8` playlist URL\n- **Usage**: Requires HLS-compatible player\n\n### Highlight Clips (clipType=HIGHLIGHT)\n- **Format**: Direct MP4 download\n- **URL**: `mp4Url` contains direct MP4 file URL\n- **Usage**: Can be played directly or downloaded\n\n## License\n\nMIT\n\n## Disclaimer\n\nThis package is a wrapper for publicly accessible API endpoints discovered through browser network traffic analysis. Use these APIs responsibly and in accordance with Pump.fun's terms of service.\n\nThe APIs may change without notice. This package will be updated to reflect any changes, but no guarantees are made about API availability or stability.","readmeFilename":"README.md","_rev":"1-8b426319bd22ead2f8b537d80bc7d3d8"}