feat(tokens): Upgrade create-token to Anchor Bankrun + Fix Metadata Parity & Compliance #496
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.
This PR updates the tokens/create-token/anchor example to use Anchor Bankrun for testing, significantly reducing test execution time while preserving real-program verification. The example is also updated to fully comply with the repository’s contribution standards.
The implementation has been extended to cover the complete token creation flow, including mint initialization, associated token account creation, initial supply minting, and metadata creation via Metaplex CPI. This makes the example a more accurate and practical reference for developers.
Changes:
Testing Infrastructure
• Replaced solana-test-validator with Anchor Bankrun.
• Added a pretest script that stages the actual Metaplex Metadata program binary (mpl_token_metadata.so) as a local test fixture.
• CPI calls are executed against the real Metaplex program logic rather than mocks.
Example Functionality
• Refactored the example to perform the full token creation flow:
-Mint initialization
-Associated Token Account creation
-Initial supply minting
-Metadata creation via Metaplex CPI
• Ensures feature parity with real-world token creation workflows.
Tooling and Compliance
• Migrated from Yarn to pnpm and added pnpm-lock.yaml, per CONTRIBUTING.md.
• Applied Biome formatting and linting, including node: protocol imports.
• Resolved Rust Edition 2024 compatibility issues with mpl-token-metadata by using anchor_spl re-exports.
• All changes are scoped to tokens/create-token/anchor. No global project configuration was modified.
CI
• Added a dedicated workflow at .github/workflows/test-tokens-create-token-anchor.yml to run this example’s tests in isolation without triggering the full test suite.
Testing:
To run the example locally:
cd tokens/create-token/anchor
pnpm install
pnpm test
The pnpm test command automatically runs the pretest script, which stages the required binary fixtures before execution.