Skip to content

feat: wait for every transaction's outcome by default, add --fast (0.4.0) - #51

Merged
smypmsa merged 4 commits into
mainfrom
feat/wait-for-outcome
Nov 24, 2026
Merged

smypmsa merged 4 commits into
mainfrom
feat/wait-for-outcome

Conversation

@smypmsa

@smypmsa smypmsa commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Every command that sends a transaction now waits for its outcome by default and says what happened on chain, instead of reporting success as soon as the RPC accepted it.

  • A transaction is waited on until it lands, fails (TransactionFailedError, with its error code), or can no longer land: once the chain is past its blockhash's last valid block height and a history search doesn't find it, the command says it never ran, nothing was spent and it is safe to send again. If the RPC stops answering for a minute, the outcome is reported as unknown. No command tells the user to run tx-status to learn an outcome.
  • A send whose response is lost is waited on the same way, so it ends as landed, failed or expired rather than "may still land".
  • --fast sends without waiting; JSON carries confirmed: false and human output says the result is unconfirmed. --confirm is still accepted (hidden), and rejected together with --fast. Every sending result carries confirmed.
  • A confirmed sell's quote_received is read from the landed transaction, with a quote_received_raw twin: for SOL, the payer's lamport change plus the fee, less any token-account rent the sale returned; otherwise the token balance change.
  • drain reads the balance it sends at confirmed, so the rent its closes just recovered goes with it.
  • In close-atas and the collect-creator-fee sweeps, a later transaction that expired or was refused counts as not run, and one whose outcome is unknown is reported as possibly landed.

No issue.

Layers touched

  • commands/ (CLI wiring)
  • core/ (business logic)
  • protocol/ (Solana/pump.fun primitives)

Does this affect transaction construction or signing?

No change to instructions or signing. Sending changes: send_tx keeps the blockhash's last_valid_block_height and, unless --fast, polls getSignatureStatuses until the transaction is confirmed, failed or past that height.

Test Plan

  • Unit tests for each outcome (landed, failed, expired, landed but missing from a lagging node, a silent RPC, a lost send response), the --fast and --confirm flags, human output, and the sell receipt including the rent subtraction
  • Mainnet: a curve buy and sell-all with the default wait, where the sell's quote_received plus the recovered rent, less the fee, matched the wallet's balance change to the lamport; a PumpSwap buy and sell-all with --fast, both reported unconfirmed and then landed; the wallet ended with no token accounts

This PR changes transaction-sending commands to wait for a final outcome by default: landed, failed (TransactionFailedError), or expired. --fast skips the wait. --confirm is hidden and rejected with --fast.

This PR touches code paths that send Solana transactions. RpcClient._send_and_confirm polls signature status until the blockhash's last_valid_block_height. If RPC stays silent for over 60 seconds, it raises RuntimeError and the outcome is unknown. In close-atas and creator-fee sweeps, later batches that expire or are refused count as not run. Unknown batches may have landed.

Confirmed sell receipts now use on-chain balance deltas. wallet drain always waits and rejects --fast.

Review focus: unknown-outcome handling in sweeps, and the 60-second silence path. Source was not inspected. Test results are reported by the PR author and were not verified.

smypmsa and others added 4 commits November 24, 2026 08:34
Sending commands reported success as soon as a transaction was sent, so one
that reverted or never landed read as done, and a slow confirmation ended in
"check it with tx-status". Commands now wait until the transaction lands,
fails, or can no longer land because its blockhash expired, and say which.
--fast sends without waiting and says the result is unconfirmed; --confirm
is still accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A sell's quote_received was the pre-trade estimate even once the
transaction was confirmed. It is now read from the landed transaction,
with its quote_received_raw twin: the payer's lamport change plus the fee,
less any token-account rent the sale returned, or the token balance change
for a non-SOL quote.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… may have closed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

Transaction-sending commands now wait for outcomes by default, with --fast to skip waiting. The RPC client polls for confirmation, failure, or expiry. Confirmed sell results use transaction-readback amounts when available, and command output reports whether a transaction was confirmed.

Changes: Transaction outcomes

Layer / File(s) Summary
RPC transaction outcome polling
src/pumpfun_cli/protocol/client.py, tests/test_protocol/test_client.py
RpcClient polls transaction status and block height. It reports confirmed success, on-chain failure, expiration, or an unknown outcome. Transaction readback includes pre- and post-transaction lamport balances.
Sending options and command output
src/pumpfun_cli/commands/sending.py, src/pumpfun_cli/commands/launch.py, src/pumpfun_cli/commands/trade.py, src/pumpfun_cli/commands/wallet.py, tests/test_commands/*, README.md, AGENTS.md, pyproject.toml, src/pumpfun_cli/__init__.py
Sending commands share --fast and hidden --confirm options. Human-readable output distinguishes confirmed transactions from unconfirmed submissions. Documentation and command tests reflect the options and behavior. Project and package versions change to 0.4.0.
Confirmed sell amounts
src/pumpfun_cli/core/amounts.py, src/pumpfun_cli/core/{cpmm,launch,launchlab,pumpswap,trade}.py, tests/test_core/test_exact_amounts.py
Confirmed sell results use transaction-readback quote amounts, accounting for fees and recovered rent for SOL quotes. If readback is unavailable, results use estimated amounts. Core results include the confirmed value.
Batch and sweep outcome handling
src/pumpfun_cli/core/{trade,wallet}.py, tests/test_core/{test_close_atas,test_trade,test_wallet}.py
Wallet batch closure handles failed, unsent, expired, and unknown outcomes after earlier batches succeed. Sweep-ahead handling also treats expired transactions as an early-stop outcome. Wallet results include the confirmed value.

Estimated code review effort: 4 (Complex) | ~50 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CLICommand
  participant RpcClient
  participant SolanaRPC
  CLICommand->>RpcClient: send_tx with confirmation enabled
  RpcClient->>SolanaRPC: submit signed transaction
  RpcClient->>SolanaRPC: poll signature status and block height
  SolanaRPC-->>RpcClient: transaction status and block height
  RpcClient-->>CLICommand: signature or transaction outcome error
Loading

Possibly related PRs

Suggested labels: protocol, cli, core, tests, security

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@smypmsa

smypmsa commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@smypmsa
smypmsa merged commit 99a7eeb into main Nov 24, 2026
11 of 12 checks passed
@smypmsa
smypmsa deleted the feat/wait-for-outcome branch November 24, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant