{"id":31368238,"url":"https://github.com/roswelly/pumpfun-buy-sell","last_synced_at":"2025-09-27T15:55:59.652Z","repository":{"id":284762495,"uuid":"955967476","full_name":"roswelly/pumpfun-buy-sell","owner":"roswelly","description":"PumpFun Buy Sell Bot","archived":false,"fork":false,"pushed_at":"2025-09-24T19:31:30.000Z","size":426,"stargazers_count":51,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-24T21:26:36.714Z","etag":null,"topics":["bot","buy","pumpfun","sell","trading"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roswelly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-27T13:41:29.000Z","updated_at":"2025-09-24T19:46:57.000Z","dependencies_parsed_at":"2025-09-01T23:25:37.389Z","dependency_job_id":null,"html_url":"https://github.com/roswelly/pumpfun-buy-sell","commit_stats":null,"previous_names":["love-luca/pumpswap-amm-tool","defaimaxi/pumpswap-trading-bot","0xzepdev/pumpswap-trading-bot","caterpillardev/pumpswap-trading-bot","roswelly/pumpswap-trading-bot","roswelly/pumpswap-bundler"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/roswelly/pumpfun-buy-sell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roswelly%2Fpumpfun-buy-sell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roswelly%2Fpumpfun-buy-sell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roswelly%2Fpumpfun-buy-sell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roswelly%2Fpumpfun-buy-sell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roswelly","download_url":"https://codeload.github.com/roswelly/pumpfun-buy-sell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roswelly%2Fpumpfun-buy-sell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277253275,"owners_count":25787290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-27T02:00:08.978Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","buy","pumpfun","sell","trading"],"created_at":"2025-09-27T15:55:57.794Z","updated_at":"2025-09-27T15:55:59.647Z","avatar_url":"https://github.com/roswelly.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PumpFun Buy Sell Bot \n\n## Overview\nA TypeScript library for trading tokens on the PumpFun platform on Solana blockchain. Provides automated buy and sell functionality with bonding curve calculations.\n\n## Project Structure\n\n### Core Files\n\n#### 📦 `package.json`\n- **Name**: pumpfun-trader\n- **Version**: 1.0.0\n- **Description**: PumpFun trading functions for Solana\n- **Main Entry**: example.ts\n- **Scripts**:\n  - `build`: TypeScript compilation\n  - `start`: Run example\n  - `buy`: Execute buy transaction via CLI\n  - `sell`: Execute sell transaction via CLI\n\n#### ⚙️ `config.ts`\n- RPC endpoint configuration for Solana mainnet\n- Default: `https://api.mainnet-beta.solana.com`\n- Alternative endpoints commented for reference\n\n#### 🔧 `constants.ts`\n- PumpFun program constants and addresses\n- Key addresses: PUMP_FUN_PROGRAM_ID, PUMP_FUN_FEE_RECIPIENT, EVENT_AUTHORITY\n- Default commitment level: \"finalized\"\n\n#### 🛠️ `utils.ts`\n- **BondingCurveAccount class**: Core bonding curve logic\n- **Key Methods**:\n  - `getBuyPrice()`: Calculate tokens received for SOL input\n  - `getSellPrice()`: Calculate SOL received for token input\n  - `getMarketCapSOL()`: Get current market cap\n  - `getFinalMarketCapSOL()`: Get final market cap when curve completes\n- **Utility Functions**:\n  - `retrieveEnvVariable()`: Environment variable validation\n\n#### 💰 `getBuyTx.ts`\n- **Function**: `getBuyTx(wallet, baseMint, amount)`\n- **Purpose**: Execute buy transactions on PumpFun\n- **Features**:\n  - Automatic token account creation\n  - Slippage protection (10% buffer)\n  - Compute budget optimization\n  - Versioned transaction support\n- **Returns**: Transaction signature or null\n\n#### 💸 `getSellTx.ts`\n- **Function**: `getSellTx(wallet, baseMint, amountInTokens)`\n- **Purpose**: Execute sell transactions on PumpFun\n- **Features**:\n  - Token amount to SOL conversion\n  - Slippage protection (10% buffer)\n  - Compute budget optimization\n  - Versioned transaction support\n- **Returns**: Transaction signature or null\n\n#### 📋 `example.ts`\n- **Purpose**: Usage examples and CLI interface\n- **Functions**:\n  - `examplePumpFunTrading()`: Complete trading example\n  - `executeBuy()`: Single buy transaction\n  - `executeSell()`: Single sell transaction\n- **CLI Support**: Direct execution via npm scripts\n\n#### 🔨 `tsconfig.json`\n- TypeScript configuration\n- Target: ES2020\n- Module: CommonJS\n- Strict mode enabled\n- Output to `./dist` directory\n\n## Key Features\n\n### 🔄 Bonding Curve Mechanics\n- Implements constant product formula (x * y = k)\n- Virtual and real reserve management\n- Automatic price discovery\n- Market cap calculations\n\n### 🛡️ Safety Features\n- Slippage protection (10% buffer)\n- Compute budget limits (150,000 units)\n- Transaction confirmation\n- Error handling and logging\n\n### 🚀 Performance Optimizations\n- Parallel async operations\n- Versioned transactions\n- Compute unit pricing (200,000 microLamports)\n- Efficient PDA derivation\n\n### 🔌 Integration\n- Solana Web3.js integration\n- SPL Token support\n- Anchor framework compatibility\n- Borsh serialization\n\n## Dependencies\n\n### Core Dependencies\n- `@solana/web3.js`: Solana blockchain interaction\n- `@solana/spl-token`: Token operations\n- `@coral-xyz/anchor`: Solana program framework\n- `@coral-xyz/borsh`: Data serialization\n\n### Development Dependencies\n- `typescript`: TypeScript compiler\n- `ts-node`: TypeScript execution\n- `@types/node`: Node.js type definitions\n\n## Usage Examples\n\n### Basic Buy Transaction\n```typescript\nimport { getBuyTx } from './getBuyTx';\nimport { Keypair, PublicKey } from '@solana/web3.js';\n\nconst wallet = Keypair.generate();\nconst tokenMint = new PublicKey(\"TOKEN_MINT_ADDRESS\");\nconst solAmount = 0.1; // 0.1 SOL\n\nconst signature = await getBuyTx(wallet, tokenMint, solAmount);\n```\n\n### Basic Sell Transaction\n```typescript\nimport { getSellTx } from './getSellTx';\n\nconst tokenAmount = BigInt(1000); // 1000 tokens\nconst signature = await getSellTx(wallet, tokenMint, tokenAmount);\n```\n\n### CLI Usage\n```bash\n# Buy 0.1 SOL worth of tokens\nnpm run buy TOKEN_MINT_ADDRESS 0.1\n\n# Sell 1000 tokens\nnpm run sell TOKEN_MINT_ADDRESS 1000\n```\n\n## Architecture\n\n### Transaction Flow\n1. **Validation**: Check bonding curve account exists\n2. **Calculation**: Compute token/SOL amounts using bonding curve\n3. **PDA Derivation**: Generate required program addresses\n4. **Transaction Building**: Create instruction with proper accounts\n5. **Execution**: Send and confirm transaction\n\n### Key PDAs (Program Derived Addresses)\n- `global`: Global program state\n- `bonding-curve`: Token-specific bonding curve\n- `creator-vault`: Creator fee collection\n- `user_volume_accumulator`: User trading volume tracking\n- `fee_config`: Fee configuration\n\n## Security Considerations\n- Private keys should be loaded from secure storage in production\n- RPC endpoints should be rate-limited and reliable\n- Slippage protection prevents MEV attacks\n- Compute budget limits prevent resource exhaustion\n\n## Development Setup\n```bash\nnpm install\nnpm run build\nnpm start\n```\n\n## File Relationships\n```\nconfig.ts → RPC configuration\nconstants.ts → Program addresses\nutils.ts → Bonding curve logic\ngetBuyTx.ts → Buy transaction logic\ngetSellTx.ts → Sell transaction logic\nexample.ts → Usage examples \u0026 CLI\n```\n\nThis project provides a complete trading interface for PumpFun tokens with robust error handling, security features, and performance optimizations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froswelly%2Fpumpfun-buy-sell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froswelly%2Fpumpfun-buy-sell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froswelly%2Fpumpfun-buy-sell/lists"}