Skip to content

fix: validate trade amounts and add timeout to PumpFun IPFS upload#32

Open
0x-SquidSol wants to merge 1 commit intonullxnothing:mainfrom
0x-SquidSol:fix/pumpfun-amount-validation-and-timeout
Open

fix: validate trade amounts and add timeout to PumpFun IPFS upload#32
0x-SquidSol wants to merge 1 commit intonullxnothing:mainfrom
0x-SquidSol:fix/pumpfun-amount-validation-and-timeout

Conversation

@0x-SquidSol
Copy link
Copy Markdown

Summary

  • buyToken and sellToken silently accepted zero/undefined amounts via ?? 0 defaults, allowing empty trades that waste network fees
  • Added early validation guards that reject non-positive amounts before any SDK or network calls
  • The IPFS metadata upload in createToken had no timeout, risking indefinite hangs if pump.fun is unresponsive
  • Added a 30-second AbortController timeout with a clear error message

Test plan

  • Attempt a buy with amount 0 — verify it throws "Buy amount must be greater than 0"
  • Attempt a sell with amount 0 — verify it throws "Sell amount must be greater than 0"
  • Create a token with valid data — verify IPFS upload succeeds within timeout
  • Run pnpm run typecheck — passes clean
  • Run pnpm run test — all wallet tests pass (19/19)

buyToken and sellToken silently accepted zero amounts via ?? 0 defaults,
allowing empty trades that waste network fees. Added early validation
guards that reject non-positive amounts before any SDK or network calls.

The IPFS metadata upload in createToken had no timeout, risking
indefinite hangs. Added a 30-second AbortController timeout with a
clear error message on expiry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant