fix(examples): add bonding_curve_v2 to learning examples#160
Conversation
…mples 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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdded a bonding-curve-v2 PDA derivation helper across multiple learning examples and included the derived Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
…uy_cu_optimized Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
learning-examples/manual_buy.py (1)
292-297: Please run a minimal-amount buy/sell smoke test before merge.Because this is an on-chain account-ordering change, confirm with tiny amounts in
manual_buy.pyandmanual_sell.pyon a safe environment before production usage.Based on learnings: Test changes using manual_buy.py and manual_sell.py with minimal amounts before production use.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@learning-examples/manual_buy.py` around lines 292 - 297, This change affects on-chain account ordering for the bonding_curve_v2 AccountMeta (see AccountMeta and _find_bonding_curve_v2 in manual_buy.py), so before merging run a minimal-amount smoke test: in a safe/test environment run manual_buy.py and manual_sell.py using testnet/devnet credentials and very small amounts (e.g., minimum token units) to ensure transactions succeed and expected account ordering succeeds; verify both buy and sell flows complete without signature/account-order errors, inspect returned transaction logs for any "account not found" or "invalid account order" errors, and if failures occur adjust the AccountMeta ordering or the call site that uses _find_bonding_curve_v2 until the smoke tests pass.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@learning-examples/manual_buy.py`:
- Around line 509-511: The long f-string in the print call exceeds style limits
and uses single quotes; change it by computing the token type into a short
variable (e.g., token_type = "Token2022" if token_data["is_token_2022"] else
"Standard Token") and then use a shorter print statement like print(f"Token
Program: {token_program} ({token_type})") so no line exceeds 88 characters and
double quotes are used consistently; update the print call that references
token_program and token_data["is_token_2022"] accordingly.
---
Nitpick comments:
In `@learning-examples/manual_buy.py`:
- Around line 292-297: This change affects on-chain account ordering for the
bonding_curve_v2 AccountMeta (see AccountMeta and _find_bonding_curve_v2 in
manual_buy.py), so before merging run a minimal-amount smoke test: in a
safe/test environment run manual_buy.py and manual_sell.py using testnet/devnet
credentials and very small amounts (e.g., minimum token units) to ensure
transactions succeed and expected account ordering succeeds; verify both buy and
sell flows complete without signature/account-order errors, inspect returned
transaction logs for any "account not found" or "invalid account order" errors,
and if failures occur adjust the AccountMeta ordering or the call site that uses
_find_bonding_curve_v2 until the smoke tests pass.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
learning-examples/manual_buy.pylearning-examples/manual_sell.pylearning-examples/mint_and_buy.pylearning-examples/mint_and_buy_v2.py
| print( | ||
| f"Token Program: {token_program} ({'Token2022' if token_data['is_token_2022'] else 'Standard Token'})" | ||
| ) |
There was a problem hiding this comment.
Split the long f-string to satisfy style constraints.
This line likely exceeds the 88-char limit and can be made cleaner by extracting the label first.
✂️ Suggested cleanup
- print(
- f"Token Program: {token_program} ({'Token2022' if token_data['is_token_2022'] else 'Standard Token'})"
- )
+ token_program_label = (
+ "Token2022" if token_data["is_token_2022"] else "Standard Token"
+ )
+ print(f"Token Program: {token_program} ({token_program_label})")As per coding guidelines: Limit lines to 88 characters and use double quotes for strings consistently.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| print( | |
| f"Token Program: {token_program} ({'Token2022' if token_data['is_token_2022'] else 'Standard Token'})" | |
| ) | |
| token_program_label = ( | |
| "Token2022" if token_data["is_token_2022"] else "Standard Token" | |
| ) | |
| print(f"Token Program: {token_program} ({token_program_label})") |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@learning-examples/manual_buy.py` around lines 509 - 511, The long f-string in
the print call exceeds style limits and uses single quotes; change it by
computing the token type into a short variable (e.g., token_type = "Token2022"
if token_data["is_token_2022"] else "Standard Token") and then use a shorter
print statement like print(f"Token Program: {token_program} ({token_type})") so
no line exceeds 88 characters and double quotes are used consistently; update
the print call that references token_program and token_data["is_token_2022"]
accordingly.
Summary
bonding_curve_v2PDA derivation and remaining account to buy/sell instructions in 4 learning examples:manual_buy.py,manual_sell.py,mint_and_buy.py,mint_and_buy_v2.pyCloses #158
Test plan
_find_bonding_curve_v2()helper and append it as remaining account afterfee_programruff formatpasses on all files🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Style