diff --git a/src/pumpfun_cli/commands/launch.py b/src/pumpfun_cli/commands/launch.py index 5e32549..4379845 100644 --- a/src/pumpfun_cli/commands/launch.py +++ b/src/pumpfun_cli/commands/launch.py @@ -16,6 +16,7 @@ def launch( image: str | None = typer.Option(None, "--image", help="Path to token image"), buy: float | None = typer.Option(None, "--buy", help="Initial buy amount in SOL"), mayhem: bool = typer.Option(False, "--mayhem", help="Enable mayhem mode"), + cashback: bool = typer.Option(False, "--cashback", help="Enable cashback for the token"), ): """Launch a new token on pump.fun (create_v2 + extend_account).""" state = ctx.obj @@ -49,6 +50,7 @@ def launch( image, buy, mayhem, + cashback, **overrides, ) ) @@ -63,5 +65,7 @@ def launch( typer.echo(f" Mint: {result['mint']}") typer.echo(f" TX: {result['explorer']}") typer.echo(f" Pump.fun: {result['pump_url']}") + if result.get("is_cashback"): + typer.echo(" Cashback: enabled") if result.get("initial_buy_sol"): typer.echo(f" Buy: {result['initial_buy_sol']} SOL") diff --git a/src/pumpfun_cli/core/launch.py b/src/pumpfun_cli/core/launch.py index 84ec9bc..62bae83 100644 --- a/src/pumpfun_cli/core/launch.py +++ b/src/pumpfun_cli/core/launch.py @@ -58,6 +58,7 @@ async def launch_token( image_path: str | None = None, initial_buy_sol: float | None = None, is_mayhem: bool = False, + is_cashback: bool = False, priority_fee: int | None = None, compute_units: int | None = None, ) -> dict: @@ -84,6 +85,7 @@ async def launch_token( symbol=ticker, uri=uri, is_mayhem=is_mayhem, + is_cashback=is_cashback, ) # 4. Add extend_account instruction (required for frontend visibility) @@ -121,6 +123,7 @@ async def launch_token( "ticker": ticker, "mint": str(mint), "metadata_uri": uri, + "is_cashback": is_cashback, "initial_buy_sol": initial_buy_sol, "signature": sig, "explorer": f"https://solscan.io/tx/{sig}", diff --git a/src/pumpfun_cli/protocol/instructions.py b/src/pumpfun_cli/protocol/instructions.py index 2689b85..35b0606 100644 --- a/src/pumpfun_cli/protocol/instructions.py +++ b/src/pumpfun_cli/protocol/instructions.py @@ -286,6 +286,7 @@ def build_create_instructions( symbol: str, uri: str, is_mayhem: bool = False, + is_cashback: bool = False, token_program: Pubkey = TOKEN_2022_PROGRAM, ) -> list[Instruction]: """Build create_v2 token instruction for pump.fun (Token2022). @@ -307,6 +308,9 @@ def build_create_instructions( assoc_bc = derive_associated_bonding_curve(mint, bonding_curve, token_program) mint_auth = _derive_mint_authority() + mayhem_state = derive_mayhem_state(mint) + mayhem_token_vault = derive_mayhem_token_vault(mint) + create_accounts = [ AccountMeta(pubkey=mint, is_signer=True, is_writable=True), AccountMeta(pubkey=mint_auth, is_signer=False, is_writable=False), @@ -317,21 +321,15 @@ def build_create_instructions( AccountMeta(pubkey=SYSTEM_PROGRAM, is_signer=False, is_writable=False), AccountMeta(pubkey=TOKEN_2022_PROGRAM, is_signer=False, is_writable=False), AccountMeta(pubkey=ASSOCIATED_TOKEN_PROGRAM, is_signer=False, is_writable=False), + # Mayhem accounts are always required by create_v2 per IDL, + # regardless of is_mayhem_mode flag value. + AccountMeta(pubkey=MAYHEM_PROGRAM_ID, is_signer=False, is_writable=False), + AccountMeta(pubkey=MAYHEM_GLOBAL_PARAMS, is_signer=False, is_writable=False), + AccountMeta(pubkey=MAYHEM_SOL_VAULT, is_signer=False, is_writable=True), + AccountMeta(pubkey=mayhem_state, is_signer=False, is_writable=True), + AccountMeta(pubkey=mayhem_token_vault, is_signer=False, is_writable=True), ] - if is_mayhem: - mayhem_state = derive_mayhem_state(mint) - mayhem_token_vault = derive_mayhem_token_vault(mint) - create_accounts.extend( - [ - AccountMeta(pubkey=MAYHEM_PROGRAM_ID, is_signer=False, is_writable=True), - AccountMeta(pubkey=MAYHEM_GLOBAL_PARAMS, is_signer=False, is_writable=False), - AccountMeta(pubkey=MAYHEM_SOL_VAULT, is_signer=False, is_writable=True), - AccountMeta(pubkey=mayhem_state, is_signer=False, is_writable=True), - AccountMeta(pubkey=mayhem_token_vault, is_signer=False, is_writable=True), - ] - ) - create_accounts.extend( [ AccountMeta(pubkey=PUMP_EVENT_AUTHORITY, is_signer=False, is_writable=False), @@ -348,6 +346,7 @@ def build_create_instructions( + _encode_borsh_string(uri) + bytes(user) # creator arg + struct.pack("