fix(examples): add pool-v2 account to pumpswap, repair geyser listener

PumpSwap (manual_buy_pumpswap.py / manual_sell_pumpswap.py)
  - Real on-chain pump-swap buys use 24 accounts; the IDL is incomplete
    (lists 23). Missing 24th account is pool-v2 PDA, derived from seed
    ["pool-v2", base_mint] under the pump-amm program.
  - Without it, pump-amm throws AnchorError 6023 (Overflow) at buy.rs:400/414
    after the trade transfers complete (the source of the earlier "pre-existing
    overflow" — was actually a missing account, not a math bug).
  - find_pool_v2(base_mint) added; appended to both buy and sell account lists
    after fee_program. The April-28 breaking-fee accounts (still gated behind
    INCLUDE_BREAKING_FEE_ACCOUNTS) come after pool-v2 — matching the doc's
    "All accounts till bonding-curve-v2 and pool-v2 remain the same."
  - AsyncClient timeout bumped to 120s so the heavy getProgramAccounts pool
    lookup doesn't time out on slower RPC paths.
  - Live-verified on mainnet with 9PwadsGz...pump:
      buy   2xgdJJsDMzoMyxJzrCATKwGfpX7M... err=None (24 accounts)
      sell  4vdBkGpCMQYEWncj5k1suGzKPUMQ... err=None (24 accounts)

manual_buy_geyser.py
  - Fixes IndexError when create tx references ALT-loaded keys
    (matches the same fix applied to manual_buy.py).
  - Re-enables the 15s sleep + on-chain price/fee_recipient lookup that
    were commented out for testing — needed for buys on real pools.
  - Live-verified: 45wSgX2Pu1LLZWLgu3e9qdhRaGJjqwMqQP5HdeV7zMBqNXziB2uEgxQd5bAqvAhBLFnAqzbuK3LAWowhxZxdemJ
    (18-account buy, err=None) on Token-2022 cashback-enabled INSIDER mint.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Anton Sauchyk
2026-04-27 18:35:13 +02:00
co-authored by Claude Opus 4.7
parent 57ffe8bfbb
commit ad6d2cc755
3 changed files with 35 additions and 6 deletions
+8 -3
View File
@@ -344,6 +344,11 @@ async def listen_for_create_transaction_geyser():
else:
continue
# Skip txs whose create ix references ALT-loaded accounts not in
# msg.account_keys (indices >= len(msg.account_keys)).
if any(idx >= len(msg.account_keys) for idx in ix.accounts):
continue
# Found a create instruction
token_data = decode_create_instruction_geyser(
ix.data, msg.account_keys, ix.accounts
@@ -513,9 +518,9 @@ async def main():
print("New token created:")
print(json.dumps(token_data, indent=2))
# sleep_duration_sec = 15
# print(f"Waiting for {sleep_duration_sec} seconds for things to stabilize...")
# await asyncio.sleep(sleep_duration_sec)
sleep_duration_sec = 15
print(f"Waiting {sleep_duration_sec}s for the bonding curve account to propagate...")
await asyncio.sleep(sleep_duration_sec)
mint = Pubkey.from_string(token_data["mint"])
bonding_curve = Pubkey.from_string(token_data["bondingCurve"])