https://github.com/krishnaagrawal7508/pumpfunswap
APIs to buy tokens on Pump.fun Dex
https://github.com/krishnaagrawal7508/pumpfunswap
amm api buy dex pumpdotfun raydium solana transaction
Last synced: 2 months ago
JSON representation
APIs to buy tokens on Pump.fun Dex
- Host: GitHub
- URL: https://github.com/krishnaagrawal7508/pumpfunswap
- Owner: krishnaagrawal7508
- Created: 2025-03-23T23:06:20.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-23T23:24:22.000Z (7 months ago)
- Last Synced: 2025-03-24T00:26:30.067Z (7 months ago)
- Topics: amm, api, buy, dex, pumpdotfun, raydium, solana, transaction
- Homepage: https://swap.pump.fun
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PumpFunSwap
A simple and easy to use API to create transactions on pump.fun AMM.
## 📝 API Usage
### Endpoint
POST https://pumpfundex.onrender.com/api/buy - Buy a token on pump.fun AMMGET https://pumpfundex.onrender.com/health - Check health of server
### Request Body
```javascript
{
"amount": 1, // Amount in SOL
"slippage": 0.01, // Slippage percentage, for eg: (0.01 = 1%)
"tokenMint": "token_address", // Token mint address
"walletAddress": "wallet", // Buyer's wallet address
"rpcUrl": "rpc_url" // RPC URL to use
}
```### Response
```json
{
"success": true,
"serializedTransaction": "base64_encoded_transaction"
}
```### Example Usage
```javascript
// Create transaction
const response = await fetch('https://pumpfundex.onrender.com/api/buy', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: "1000000",
tokenMint: "token_address",
walletAddress: "wallet",
rpcUrl: "rpc_url"
})
});const { serializedTransaction } = await response.json();
// On client side:
const bufferData = Buffer.from(serializedTransaction, "base64");
const transaction = Transaction.from(bufferData);// Sign and send
transaction.sign(userKeypair);
const txHash = await sendAndConfirmTransaction(
connection,
transaction,
[userKeypair],
{
skipPreflight: true,
preflightCommitment: 'confirmed'
}
);
```
## 📚 Error Responses```json
{
"success": false,
"error": "Error message"
}
```
## 💰 Fees
- 1% fee on the buy amount is included in each buy transaction
- Fee is calculated based on the buy amount## 📜 License
MIT License
## 🔗 Contact
- Twitter: [KrsnaAgr](https://x.com/KrsnaAgr)
- Telegram: [krishna123agrawal](https://t.me/krishna123agrawal)