Update Pinocchio AMM lesson for p-token batching#399
Conversation
|
@raunit-dev thanks for jumping on this. This could definitely use a little more fleshing out, as the new content feels very spliced-in. |
|
I have started editing this heavily, so perhaps hold off making changes for now. |
|
@raunit-dev the PR's been reworked for better flow, and the code examples have been fixed. Batch does not currently implement the default trait (it only did so temporarily when Febo was still experimenting with the API). Also, we cannot currently cannot create a batch without working out the max accounts and data length up front. |
|
@HongThaiPham when you have a chance, I'd appreciate it if you could take a look at the Vietnamese part of this change to introduce the batch instruction in p-token. Would be nice to get some human touch there 🙏 |
There was a problem hiding this comment.
Pull request overview
Updates the Pinocchio AMM challenge content across all locales to teach the new p-token batch flow (Batch + Transfer::new(...).into_batch(...)) instead of issuing one CPI per token operation, and adds a pinocchio-token >= 0.6.0 version note to each challenge.mdx.
Changes:
- In
deposit.mdx(all locales), replaces the “leave the implementation to you” note with a worked example that batches bothTransfers and theMintTointo a single CPI usingBatchState/Batch. - In
swap.mdx(all locales), rewrites the transfer logic to batch bothTransferinstructions into one CPI ending inbatch.invoke_signed(&[signer])?;, and (in the non-English locales) significantly rewrites the introductory prose and account/data sections. - In
withdraw.mdx(all locales), updates the bullet describing the transfers + burn to mention reusing theBatchpattern fromDeposit; and inchallenge.mdx(all locales) adds apinocchio-tokenversion requirement note.
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/app/content/challenges/pinocchio-amm/en/challenge.mdx | Adds pinocchio-token >= 0.6.0 requirement note. |
| src/app/content/challenges/pinocchio-amm/en/pages/deposit.mdx | Adds worked batch example (2 transfers + 1 mint in one CPI). |
| src/app/content/challenges/pinocchio-amm/en/pages/swap.mdx | Replaces per-CPI transfer snippet with batched Transfer::new(...).into_batch(...) pattern. |
| src/app/content/challenges/pinocchio-amm/en/pages/withdraw.mdx | Adds note to reuse the Batch pattern from Deposit. |
| src/app/content/challenges/pinocchio-amm/de/{challenge,pages/deposit,pages/swap,pages/withdraw}.mdx | German localization of the same updates; swap.mdx also rewrites intro/accounts/data sections. |
| src/app/content/challenges/pinocchio-amm/fr/{challenge,pages/deposit,pages/swap,pages/withdraw}.mdx | French localization of the same updates; swap.mdx also rewrites intro/accounts/data sections. |
| src/app/content/challenges/pinocchio-amm/id/{challenge,pages/deposit,pages/swap,pages/withdraw}.mdx | Indonesian localization of the same updates; swap.mdx also rewrites intro/accounts/data sections. |
| src/app/content/challenges/pinocchio-amm/uk/{challenge,pages/deposit,pages/swap,pages/withdraw}.mdx | Ukrainian localization of the same updates; swap.mdx also rewrites intro/accounts/data sections (title also changed from "Обмін" to "Swap"). |
| src/app/content/challenges/pinocchio-amm/vi/{challenge,pages/deposit,pages/swap,pages/withdraw}.mdx | Vietnamese localization of the same updates; swap.mdx also rewrites intro/accounts/data sections and fixes field names (user_x_ata/user_y_ata). |
| src/app/content/challenges/pinocchio-amm/zh-CN/{challenge,pages/deposit,pages/swap,pages/withdraw}.mdx | Simplified Chinese localization of the same updates; swap.mdx also rewrites intro/accounts/data sections. |
| src/app/content/challenges/pinocchio-amm/zh-HK/{challenge,pages/deposit,pages/swap,pages/withdraw}.mdx | Traditional Chinese localization of the same updates; swap.mdx also rewrites intro/accounts/data sections. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
This PR updates the Pinocchio AMM lesson to teach the
p-tokenbatch flow instead of showing separate token CPIs or manual batch serialization.What Changed
p-tokenas already live on mainnetpinocchio_tokenAPI usingBatchandTransfer::new(...).into_batch(&mut batch)?batch.invoke()?andbatch.invoke_signed(&[signer])?mdxpages for the Pinocchio AMM challengeTesting
pnpm lintpnpm precompile-mdxpnpm buildNotes
This keeps the swap lesson aligned with the current
p-tokenusage pattern while preserving the existing Blueshift challenge voice and structure.