Launch Pump.fun Token
The Launch Pump.fun Token
tool, part of AgentiPy, enables users to launch new tokens on the Pump.fun platform on the Solana blockchain. Pump.fun is known for facilitating the creation and trading of new tokens with initial liquidity. This tool automates the process of metadata upload and transaction creation for launching a token.
Functionality
This tool is implemented in the PumpfunTokenManager
class.
Key Methods:
_upload_metadata(session: aiohttp.ClientSession, token_name: str, token_ticker: str, description: str, image_url: str, options: Optional[PumpfunTokenOptions] = None) -> Dict[str, Any]
:(Internal method) Uploads token metadata (name, symbol, description, image, and optional social links like Twitter, Telegram, website) to IPFS via Pump.fun's API. Requires an
aiohttp.ClientSession
.
_create_token_transaction(session: aiohttp.ClientSession, agent: SolanaAgentKit, mint_keypair: Keypair, metadata_response: Dict[str, Any], options: Optional[PumpfunTokenOptions] = None) -> VersionedTransaction
:(Internal method) Creates the token launch transaction by making a request to Pump.fun's API (
https://pumpportal.fun/api/trade-local
).The payload includes the agent's public key, metadata URI from the upload, mint address, initial liquidity amount in SOL, slippage, and priority fee.
Returns a
VersionedTransaction
object.
launch_pumpfun_token(agent: SolanaAgentKit, token_name: str, token_ticker: str, description: str, image_url: str, options: Optional[PumpfunTokenOptions] = None) -> TokenLaunchResult
:The main public method to launch a token.
Generates a new
Keypair
for the token mint.Calls
_upload_metadata
to upload all token details and image.Calls
_create_token_transaction
to get the transaction from Pump.fun.Signs the transaction with the new mint's keypair and the agent's wallet.
Sends the transaction to the Solana network.
Returns a
TokenLaunchResult
containing the transactionsignature
,mint
address, andmetadata_uri
.
PumpfunTokenOptions
PumpfunTokenOptions
This is likely a Pydantic model or TypedDict (defined in agentipy.types
) that includes fields such as:
twitter: Optional[str]
telegram: Optional[str]
website: Optional[str]
initial_liquidity_sol: float
(Amount of SOL for initial liquidity)slippage_bps: int
(Slippage in basis points)priority_fee: float
(Priority fee in SOL)
Critical Note: Launching tokens on Pump.fun involves real financial transactions on the Solana Mainnet. This tool directly interacts with Pump.fun's APIs and the Solana blockchain. Use with extreme caution. Ensure you understand the costs, risks, and implications. It is highly recommended to use a fresh wallet (burner wallet) with only the necessary amount of SOL for the launch. Test image URLs and metadata thoroughly.
Source Code
You can find the source code for this tool on GitHub: https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/launch_pumpfun_token.py
Last updated