Conversation
Collaborator
🟡 Heimdall Review Status
|
Token-2022 has no icon or description fields; both are served from the off-chain JSON document that its `uri` field points at. That field was initialized to an empty string, so wrapped tokens could never carry either. Adds `uri` to `PartialTokenMetadata` and passes it through to the metadata initialize CPI. It is deliberately excluded from the mint's PDA hash: that hash is recomputed from onchain metadata to authenticate a mint as a wrapped token, so extending the preimage would move every already-deployed mint to an address the program no longer derives. `wrap_token` keeps its exact wire format, taking a `PartialTokenMetadataV1` argument whose layout is byte-identical to the previous type, and delegates with an empty uri. `wrap_token_v2` accepts the uri. Both derive the same mint. Also fixes `create_mock_wrapped_mint`, which left `update_authority` and `mint` at their defaults rather than mirroring a real wrapped mint. Co-authored-by: Cursor <cursoragent@cursor.com>
jackchuma
force-pushed
the
jack/wrapped-token-metadata-uri
branch
from
September 16, 2026 21:25
8e63fe3 to
25a4c91
Compare
This was referenced Sep 16, 2026
jackchuma
marked this pull request as ready for review
September 22, 2026 11:50
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 changed? Why?
Adds an optional metadata URI when creating Solana wrapped tokens so wallets and indexers can retrieve an icon and description from the URI's offchain JSON metadata.
wrap_token_v2, which accepts the URI and stores it in the Token-2022 metadata extension.wrap_tokeninstruction and its wire format unchanged; it delegates to the shared handler with an empty URI so existing clients remain compatible.PartialTokenMetadataV1with the existing layout and discriminator, exportsMAX_URI_LEN(200) through the Anchor IDL, and regenerates both checked-in IDL artifacts.The wrapped-mint PDA derivation intentionally continues to exclude the URI. This preserves derivation of deployed wrapped mints and prevents a URI-only change from disrupting bridging or supply accounting.
Notes to reviewers
UriTooLong, 12706) are added without changing existing instruction discriminators or error codes.How has it been tested?
111tests pass and Clippy is clean.test_wrap_token_legacy_wire_format_is_unchangedhand-encodes the legacy instruction to verify its discriminator and argument ordering remain compatible.test_wrap_token_v2_stores_uri_on_mintverifies URI persistence and the additional mint funding required for Token-2022 metadata allocation.deployed_mint_still_derivesverifies a deployed mainnet wrapped mint still derives after the change, andv1_hashes_identically_and_converts_to_an_empty_uriverifies the legacy metadata conversion and hash invariants.