Conversation
Adds the `wrapTokenV2` instruction and the `UriTooLong` error. The `wrapToken` doc comments shift because its argument type is now `PartialTokenMetadataV1`; its discriminator and encoder are unchanged. Codama infers the legacy SPL Token program as the default for accounts named `tokenProgram`, which is wrong for a wrapped mint. Pins `wrapTokenV2` to Token-2022 through a generator visitor so the default survives regeneration. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Sep 16, 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.
Part 2 of 3. Stacked on #199, which adds the instruction this regenerates from. Review #199 first; the diff here shrinks to just the generated output once that merges.
What's in it
Regenerated
clients/ts/src/bridge/generatedagainst the IDL from #199. That adds thewrapTokenV2instruction and theUriTooLongerror code.wrapToken.tsalso changes, but only in its doc comments: its argument type is nowPartialTokenMetadataV1, which carries shorter docs. Its discriminator and its encoder and decoder field lists are byte-identical tomain, which is what keeps clients built beforeuriexisted working.The one hand-written change
Codama infers the legacy SPL Token program (
Tokenkeg…) as the default for any account namedtokenProgram. Wrapped mints are Token-2022, so that default produces an instruction that fails onchain for any caller who omits the account.generate-client.handler.tsnow pinswrapTokenV2'stokenProgramdefault to Token-2022 through a Codama visitor, rather than hand-editing the generated file, so the fix survives the next regeneration. It lives in this PR rather than the CLI one because it is what produces the output being reviewed here — regenerating without it reintroduces the wrong default.The same wrong default exists on
mainfor the legacywrapToken. That is pre-existing and fixed separately, since it stands on its own.Verification
clients/tsbuilds andscriptstypechecks on this branch. Confirmed againstmainthatwrapToken's discriminator is unchanged and its encoder and decoder field lists diff clean.