Getting Started
The PumpFunAPI
class provides methods to interact with pump.fun for instant trades and creation of tokens.
Install the Package
npm i pumpfunapi.xyz
yarn add pumpfunapi.xyz
pnpm i pumpfunapi.xyz
use any of the above package manager to install the pumpfunapi.xyz package
Creates a new PumpFunAPI
instance.
new PumpFunAPI(rpcUrl, privateKey)
Parameters
rpcUrl
(string): RPC URL for Solana. only mainnet rpc urls will work here.privateKey
(string): Base58 encoded Solana private key. this private key is not used for any trades or token creation process. the privatekey mentioned here is only used to pay the trade execution fee of the api. make sure you have enough solana to pay the fees. each successfull execution costs flat 0.002 SOL. you can trade as much amount as needed as we will NOT BE TAKING FEE IN %, ALL FEES ARE FLAT AND WILL NOT CHANGE
Example in Common JS
const PumpFunAPI = require('pumpfunapi.xyz');
const client = new PumpFunAPI('https://api.mainnet-beta.solana.com', 'your-private-key');
Example in ES Module
import PumpFunAPI from ('pumpfunapi.xyz');
const client = new PumpFunAPI('https://api.mainnet-beta.solana.com', 'your-private-key');
//the privateKey used here is only for fee payments on the api.
//execution will fail if there is no solana found in the wallet of the private key mentioned above
//for each successfull trades 0.002 SOL is deducted