Skip to content

Update Pinocchio AMM lesson for p-token batching#399

Merged
dhl merged 6 commits into
blueshift-gg:masterfrom
raunit-dev:docs/pinocchio-amm-batch-instruction
May 18, 2026
Merged

Update Pinocchio AMM lesson for p-token batching#399
dhl merged 6 commits into
blueshift-gg:masterfrom
raunit-dev:docs/pinocchio-amm-batch-instruction

Conversation

@raunit-dev

@raunit-dev raunit-dev commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR updates the Pinocchio AMM lesson to teach the p-token batch flow instead of showing separate token CPIs or manual batch serialization.

What Changed

  • preserves the existing lesson structure and teaching style for the swap walkthrough
  • updates the lesson to describe p-token as already live on mainnet
  • shows batching with the pinocchio_token API using Batch and Transfer::new(...).into_batch(&mut batch)?
  • explains the AMM-specific distinction between batch.invoke()? and batch.invoke_signed(&[signer])?
  • applies the same lesson update across all localized mdx pages for the Pinocchio AMM challenge

Testing

  • pnpm lint
  • pnpm precompile-mdx
  • pnpm build

Notes

This keeps the swap lesson aligned with the current p-token usage pattern while preserving the existing Blueshift challenge voice and structure.

@raunit-dev raunit-dev changed the title Update Pinocchio AMM swap lesson for p-token batching Update Pinocchio AMM lesson for p-token batching May 17, 2026
@dhl

dhl commented May 18, 2026

Copy link
Copy Markdown
Member

@raunit-dev thanks for jumping on this. This could definitely use a little more fleshing out, as the new content feels very spliced-in.

@dhl

dhl commented May 18, 2026

Copy link
Copy Markdown
Member

I have started editing this heavily, so perhaps hold off making changes for now.

@dhl

dhl commented May 18, 2026

Copy link
Copy Markdown
Member

@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.

See @febo's latest example on this

@dhl

dhl commented May 18, 2026

Copy link
Copy Markdown
Member

@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 🙏

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 both Transfers and the MintTo into a single CPI using BatchState/Batch.
  • In swap.mdx (all locales), rewrites the transfer logic to batch both Transfer instructions into one CPI ending in batch.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 the Batch pattern from Deposit; and in challenge.mdx (all locales) adds a pinocchio-token version 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.

Comment thread src/app/content/challenges/pinocchio-amm/en/pages/swap.mdx
@dhl dhl merged commit e867d45 into blueshift-gg:master May 18, 2026
1 check failed
@raunit-dev

Copy link
Copy Markdown
Contributor Author

Thanks for the clarity on this ser, @dhl! 🫡

I wasn't aware that the Default trait was dropped following @febo latest API experiments Appreciate you jumping in to rework the flow and sync the localized docs with the correct batching pattern.

The updated structure looks great ser !

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.

3 participants