Commit Graph

62 Commits

Author SHA1 Message Date
Anton Sauchyk 9b4841890c fix(examples): align listeners and decoders with refreshed pump.fun IDL
Refreshes the read-only learning examples (Phase A3) against the post
Feb–Apr 2026 IDL changes:
  - CreateEvent now has 15 fields (timestamp, 4×u64 reserves, token_program,
    is_mayhem_mode, is_cashback_enabled). Listener parsers were truncating
    after `creator`; the v2 ones were also reading is_mayhem_mode at the
    wrong offset.
  - BondingCurve account is now 83 bytes (added is_cashback_coin).
  - PumpSwap Pool account is now 245 bytes (added is_cashback_coin) — the
    listen_programsubscribe dataSize filter was matching nothing.
  - IDL instruction `createV2` was renamed to `create_v2`; the legacy
    `create` instruction added a `creator: pubkey` arg in March 2026.
  - decode_from_blockSubscribe.py decoder now handles bool, i64, u32, u16,
    u8, and the OptionBool defined type (1-byte wire format).

Files touched (all under learning-examples/):
  bonding-curve-progress/get_bonding_curve_status.py  — V4 struct (cashback)
  bonding-curve-progress/poll_bonding_curve_progress.py
  decode_from_blockSubscribe.py
  decode_from_getAccountInfo.py
  decode_from_getTransaction.py
  listen-migrations/compare_migration_listeners.py
  listen-migrations/listen_programsubscribe.py
  listen-new-tokens/compare_listeners.py
  listen-new-tokens/listen_blocksubscribe.py
  listen-new-tokens/listen_geyser.py
  listen-new-tokens/listen_logsubscribe.py
  listen-new-tokens/listen_logsubscribe_abc.py

Verified live against mainnet — listeners decode tokens including
mayhem-mode and cashback-enabled curves correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 16:42:11 +02:00
Anton Sauchyk 546b94af6f fix(examples): add bonding_curve_v2 to learning examples (#160)
* fix(examples): add bonding_curve_v2 remaining account to learning examples

Add the required bonding_curve_v2 PDA as a remaining account to buy/sell
instructions in manual_buy, manual_sell, mint_and_buy, and mint_and_buy_v2
learning examples, matching the pump.fun program upgrade.

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

* fix(examples): add bonding_curve_v2 to manual_buy_geyser and manual_buy_cu_optimized

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 23:54:18 +01:00
Alex Kuligowski 40ad32b8d0 feat(core): add RPC rate limiting and retry handling (#154)
* feat(core): add RPC rate limiting, retry logic, and 429 handling

Addresses #44 — users on free-tier RPC endpoints hit HTTP 429 errors
during buy transactions due to no rate limiting or retry handling.

- Add TokenBucketRateLimiter (new file: src/core/rpc_rate_limiter.py)
- Gate all RPC methods through rate limiter (both post_rpc and solana-py calls)
- Rewrite post_rpc() with retry loop, exponential backoff, jitter, and
  specific 429 detection with Retry-After header support
- Replace per-call aiohttp session with shared persistent session
- Wire node.max_rps from YAML bot config through to SolanaClient
- Fix cleanup manager and learning example to use SolanaClient abstraction
  instead of bypassing it via get_client()

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

* fix(core): address CodeRabbitAI review feedback on rate limiting PR

Validate max_rps > 0 in TokenBucketRateLimiter to prevent ZeroDivisionError
and infinite loops with fractional values. Add asyncio.Lock to _get_session
to fix race condition, handle non-numeric Retry-After headers gracefully,
replace dead json.JSONDecodeError with aiohttp.ContentTypeError, and combine
burn+close into a single transaction in cleanup example.

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

* docs: document RPC rate limiting feature in README

- Add section on built-in RPC rate limiting with token bucket algorithm
- Document configurable max RPS and automatic retry logic
- Update roadmap to mark "Configurable RPS" as completed
- Clarify benefits of rate limiting for provider compliance

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: use math.ceil for burst_size to handle fractional max_rps

- Replace int(max_rps) with math.ceil(max_rps) in burst_size calculation
- Prevents infinite loop when max_rps < 1.0 (e.g., 0.5 RPS would result in burst_size=0)
- Ensures burst_size is always at least 1 for valid fractional rates
- Addresses CodeRabbit feedback on rpc_rate_limiter.py:27

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(core): validate burst_size and fix table pipe consistency

Address remaining CodeRabbitAI review feedback: add burst_size
validation guard, fix TRY003 lint (use msg variable for ValueError),
break long line under 88 chars, and fix MD055 table pipe style in README.

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

* fix(core): separate 429 retry budget from error retries in post_rpc

429 responses no longer count against max_retries — they use a dedicated
max_429_retries counter (default 10) so free-tier users hitting rate
limits won't exhaust retries prematurely. Also refresh the aiohttp
session inside the retry loop to avoid stale references after network
failures, and fix cleanup log message accuracy.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Anton Sauchyk <antonsauchyk@gmail.com>
2026-02-17 10:02:11 +01:00
Anton Sauchyk 03a4e7bcbc Add mayhem mode support and Token2022 integration (#149)
* feat: mayhem update in idl

* feat(examples): update bonding curve scripts

* feat(example): update listen_blocksubscribe

* feat(examples): update geyser listener

* feat(examples): update all new token listeners

* feat(examples): add comments, fix printing, formatting

* feat(examples): pumpswap buy and sell update with mayhem mode

* fix(examples): sell pump amm fee recipient

* feat(examples): update decode scripts

* feat(examples): update fetch price

* feat(examples): buy and sell bonding curve scripts

* feat(examples): add mint with mayhem mode enabled

* feat(examples): improve listening to wallet txs

* feat(examples): migration listener improvements

* feat(examples): global vol accumulator is not writable

* feat(examples): support token/token2022 programs in buy instructions

* feat(examples): token/token2022 for pumpswap buy

* feat(examples): token/token2022 supprot for sell instructions

* feat(bot): support create_v2 with token2022, mayhem mode, other fixes

* fix(bot): support only token2022 in logs and pumportal listeners

* feat(bot): token2022 support in cleanup flow

* fix(bot): update token program handling and improve price validation in trading logic

* feat(bot): enhance token program handling for LetsBonk integration
2025-11-18 13:09:37 +01:00
Anton Sauchyk 7ae8b560bd feat(pumpswap): update pool account to writable for buy/sell instructions (#146) 2025-11-04 17:06:22 +01:00
Anton Sauchyk b6928d1f5f feat(core): integrate account data size limit (#144)
* feat(core): integrate account data size limit in buyer and seller transaction

* refactor: format code for improved readability and consistency
2025-10-28 21:21:21 +01:00
smypmsa ec6d58665d docs(examples): update comments for cu optimization in manual buy script 2025-10-27 22:06:40 +00:00
smypmsa 3f20649d0e fix(examples): clarify cu optimized buy script 2025-10-27 22:01:13 +00:00
Anton 8367611ed7 feat(example): add pump buy script with compute unit optimization (#143) 2025-10-27 00:21:56 +01:00
Anton d64b51da44 fix(examples): mint and buy script (#141)
* fix(examples): remove hardcoded token mints

* feat(core): update pump idls

* feat(examples): add track volume bool to mint script

* feat(examples): add extend acc instr to mint
2025-10-25 15:01:04 +02:00
Anton 25c376dd02 Feat/letsbonk examples (#140)
* feat: update letsbonk idl

* feat: add letsbonk examples
2025-10-22 00:20:30 +02:00
smypmsa 3fb0a9a549 feat(examples): listen and parse wallet txs 2025-09-23 20:27:22 +00:00
smypmsa 9731b179cc feat(core): add configurable cu limits 2025-09-03 15:05:12 +00:00
smypmsa e1e15dd539 feat(pumpfun): add fee_config and fee_program, close #132 2025-08-29 15:21:36 +00:00
smypmsa eefd15a6b7 fix(examples): module path 2025-08-14 16:56:41 +00:00
smypmsa 0dc7c28499 feat(examples): add bonding curve geyser-buy example 2025-08-14 16:44:19 +00:00
smypmsa 0eb8811d78 chore(examples): remove hardcoded token mints 2025-08-14 10:00:19 +00:00
smypmsa 8ab8932168 docs(claude): add claude code rules 2025-08-11 05:35:25 +00:00
smypmsa 83a7f9e4ad docs(readme): add letsbonk, update commands 2025-08-05 15:18:22 +00:00
smypmsa d2f157e7f0 feat(examples): update pump amm buy instruction 2025-08-01 05:11:31 +00:00
smypmsa 4fd3181612 feat(examples): update bonding curve buy instructions 2025-08-01 05:05:55 +00:00
Ved Patel 40b5e36154 fix(examples): wrapping SOL before pumpswap buy 2025-07-03 17:12:25 -07:00
smypmsa feaedfd91f feat(examples): add mint and buy example 2025-06-29 19:21:40 +00:00
smypmsa 66c6bc37ab fix(examples): compare listeners print width 2025-06-29 19:06:15 +00:00
smypmsa ddbe5970a2 fix(examples): remove redunant imports, comments 2025-06-28 09:52:53 +00:00
Sheng-Yan fb571337c5 fix: retry send_transaction 2025-06-24 10:50:23 +08:00
Sheng-Yan 83c7bb3414 fix: add idempotent_ata_ix 2025-06-23 10:37:28 +08:00
Zhang ShengYan 00216972bf fix:use STRUCT_2 to parse creator 2025-06-08 19:53:30 +08:00
Zhang ShengYan 49504f5106 fix: correct the name of file 2025-06-04 16:55:58 +08:00
smypmsa 06166dd8fc fix(examples): correct formula for bonding curve progress 2025-05-26 14:19:13 +00:00
smypmsa 9495d250b9 fix(pumpswap): set global config writable false 2025-05-15 13:29:31 +00:00
Anton 44e2c83120 fix: remove duplicated function 2025-05-14 17:36:23 +02:00
Anton 957722ba73 Update learning-examples/decode_from_getAccountInfo.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-05-14 17:33:17 +02:00
smypmsa f80e06e180 fix: repair pumpswap buy tx 2025-05-14 15:25:04 +00:00
smypmsa e4675c5284 feat: update rest of scripts with creator fee 2025-05-14 07:22:35 +00:00
smypmsa f811632c3c feat: manual buy and sell with creator fee 2025-05-13 07:38:46 +00:00
smypmsa e41a5f4f4f feat(core): add support for creator fee update 2025-05-12 20:07:51 +00:00
smypmsa aa145dc018 feat: add geyser auth type, compare listeners for new tokens 2025-05-06 08:39:13 +00:00
smypmsa 81c2af4af1 feat: add example of programSubscribe listener for migrations, group examples into subfolders 2025-04-21 11:36:09 +00:00
smypmsa b9e29a8b12 feat: add geyser listener script 2025-04-14 15:02:52 +00:00
smypmsa 6e3b1b3b41 feat: add mint address extraction for graduating tokens 2025-04-13 20:23:58 +00:00
smypmsa 18ee63b2b9 feat: add get graduating tokens script 2025-04-09 11:56:44 +00:00
smypmsa 68c8251ccf feat: add track bonding curve progress script 2025-04-02 15:36:58 +00:00
smypmsa c5a0258aa7 fix: use base64 explicitly 2025-04-01 14:57:01 +00:00
Anton 54f3bd4b0e Merge pull request #75 from chainstacklabs/feat/pumpswap-sell-script
Sell tokens on PumpSwap script (learning example)
2025-04-01 08:13:49 +00:00
smypmsa 094e46e523 fix: final fixes in instructions, docstrings, comments 2025-04-01 07:19:27 +00:00
smypmsa 7bf78830f0 fix: fixes in initial implementation 2025-03-31 15:14:07 +00:00
Anton 5b9d8595a8 Merge pull request #74 from chainstacklabs/feat/get-pumpswap-pools-script
Get PumpSwap market data (learning example)
2025-03-31 07:00:29 +00:00
smypmsa 925b4bfaee fix: add missed load_dotenv 2025-03-31 06:59:41 +00:00
smypmsa bf275c338d fix: use base64 for get_program_accounts 2025-03-30 12:55:50 +00:00