Pumpfun Object
The Pumpfun global object and methods.
Pumpfun Object Documentation
The Pumpfun
class provides methods to interact with the Pump.fun decentralized trading service on the Solana blockchain. It supports watching for pool creation and trade events, as well as buying and selling tokens. This class extends the Subscribable
class, enabling subscription to Pump.fun-related events.
Methods
watchCreatePools
Description Watches for the creation of new liquidity pools on Pump.fun and invokes a callback when an event occurs.
Signature
Parameters
callback
((event: PumpfunCreatePool) => void
): The callback function to handle pool creation events.
Returns
Promise<SubscriptionResult>
: The result of the subscription operation.
Example Usage
watchTrades
Description Watches for trade events (buy or sell) on Pump.fun and invokes a callback when a trade occurs.
Signature
Parameters
callback
((event: PumpfunTrade) => void
): The callback function to handle trade events.
Returns
Promise<SubscriptionResult>
: The result of the subscription operation.
Example Usage
buyTokens
Description Buys tokens on Pump.fun by specifying the mint address, amount of SOL, slippage tolerance, and an optional priority fee.
Signature
Parameters
mint
(PublicKeyOrString
): The mint address of the token to buy.amount
(string | number
): The amount of SOL to spend.slippage
(number
): Optional. The slippage tolerance (in percentage).priorityFee
(string | number
): Optional. The priority fee in lamports for faster transaction processing.createATA
(boolean
): Optional. Whether to create an associated token account. Default istrue
.
Returns
Promise<Transaction>
: The deserialized transaction object representing the buy operation.
Example Usage
sellTokens
Description Sells tokens on Pump.fun by specifying the mint address and the amount of tokens to sell.
Signature
Parameters
mint
(PublicKeyOrString
): The mint address of the token to sell.amount
(string | number
): The amount of tokens to sell.
Returns
Promise<Transaction>
: The deserialized transaction object representing the sell operation.
Example Usage
Types
Trade
Represents a trade event (buy or sell).
PumpfunBuyRequest
Request type for buying tokens on Pump.fun.
PumpfunSellRequest
Request type for selling tokens on Pump.fun.
PumpfunTrade
Represents a Pump.fun trade event.
PumpfunCreatePool
Represents a Pump.fun pool creation event.
Last updated