add pinocchio transfer-tokens example#596
Merged
Perelyn-sama merged 2 commits intoJun 21, 2026
Merged
Conversation
This was referenced Jun 20, 2026
Add a Pinocchio implementation of tokens/transfer-tokens covering the core SPL flow: create a mint, mint tokens to an associated token account, and transfer tokens between wallets. The program dispatches three instructions by a leading discriminator byte (0=CreateToken, 1=MintTokens, 2=TransferTokens) using pinocchio-token, pinocchio-associated-token-account, and pinocchio-system. A bankrun test exercises the full create -> mint 150 -> transfer 50 flow and asserts the resulting 100/50 balances.
479683d to
62c8661
Compare
The whole-repo `biome check ./` (TypeScript CI job) was failing on three
files unrelated to this PR, which kept the check red:
- basics/cross-program-invocation/pinocchio/tests/test.ts: remove an unused
discriminator constant and replace non-null assertions with explicit null
guards
- tokens/token-swap/anchor/tests/deposit-liquidity.ts: apply the biome formatter
- tokens/token-2022/.../app/public/{next,vercel}.svg: add a <title> element
(noSvgWithoutTitle)
Perelyn-sama
approved these changes
Jun 21, 2026
This was referenced Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Pinocchio implementation of
tokens/transfer-tokens, covering the core SPL flow:This is the first Pinocchio example under
tokens/, following the pattern of the recently merged pinocchio examples.How
The program dispatches three instructions by a leading discriminator byte (
0=CreateToken,1=MintTokens,2=TransferTokens), usingpinocchio-token,pinocchio-associated-token-account, andpinocchio-system.A
solana-bankruntest exercises the full create → mint 150 → transfer 50 flow and asserts the resulting 100 / 50 balances. The legacy SPL Token and Associated Token Account programs are bundled with bankrun, so no extra fixtures are loaded.The
package.json/pnpm-lock.yaml/tsconfig.jsonare copied frombasics/repository-layout/pinocchioso--frozen-lockfilepasses (only deps already present in the lockfile are used).Checks run locally
cargo fmt --check✅cargo clippy -- -D warnings✅biome check✅