Agent trades on Pump: recover from a failed simulation instead of surfacing the error to the model

Open
#159 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
20/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
blockchain, typescript
Domain
blockchain

Research direction

The change would touch packages/sdk/src/solana/trade.ts, where preflight failures are currently returned to the caller as raw RPC errors. Before any code, a maintainer has to decide whether to adopt an external, unreviewed package (@txwhy/sdk) and an outside service, which the issue promotes but does not establish as needed. If the maintainer agrees, done means a tested opt-in path in trade.ts that leaves the default behaviour unchanged.

Written by the indexing model from the issue text.

Description

Nice project. A suggestion for packages/sdk/src/solana/trade.ts.

When preflight fails, the agent gets a raw RPC error and has to decide what to do. On Pump.fun that happens a lot: my public failure index shows 57% of sampled Pump.fun transactions failing this week, mostly slippage and insufficient SOL. An LLM usually answers a slippage error by retrying with a wider tolerance, which is the expensive answer.

I built an open-source repair step for this. Hand it the failing unsigned transaction and it returns either:

  • a rebuilt unsigned transaction that passes simulation, with only the limit moved to the current price and never more than 25%, or
  • a plain-words cause and fix the agent can act on, for example "the wallet is short 0.0021 SOL".

Keys never leave the agent. A local verifier proves the change before signing.

import { sendWithRepair } from "@txwhy/sdk";
const { signature } = await sendWithRepair(connection, tx, keypair);

It is also an MCP server, so an agent can call it as a tool with no SDK at all: https://txwhy.vercel.app/api/mcp

Covers Pump.fun, PumpSwap, Jupiter, Raydium and Meteora. MIT, free, no key.

Data: https://txwhy.vercel.app/failures
Source: https://github.com/SUNDRAM07/txwhy

Happy to send a PR wiring it into trade.ts as an option. Close if not interesting.

Dominant language
TypeScript
Stars
80
Forks
21
Avg merge
22h 2m
Merged PRs (30d)
11

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nirholas/agenti

All issues in nirholas/agenti

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.