Skip to content

chore(clients): regenerate bridge client for wrap_token_v2 - #200

Draft
jackchuma wants to merge 1 commit into
jack/wrapped-token-metadata-urifrom
jack/wrapped-token-uri-client
Draft

jackchuma wants to merge 1 commit into
jack/wrapped-token-metadata-urifrom
jack/wrapped-token-uri-client

Conversation

@jackchuma

Copy link
Copy Markdown
Collaborator

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/generated against the IDL from #199. That adds the wrapTokenV2 instruction and the UriTooLong error code.

wrapToken.ts also changes, but only in its doc comments: its argument type is now PartialTokenMetadataV1, which carries shorter docs. Its discriminator and its encoder and decoder field lists are byte-identical to main, which is what keeps clients built before uri existed working.

The one hand-written change

Codama infers the legacy SPL Token program (Tokenkeg…) as the default for any account named tokenProgram. Wrapped mints are Token-2022, so that default produces an instruction that fails onchain for any caller who omits the account.

generate-client.handler.ts now pins wrapTokenV2's tokenProgram default 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 main for the legacy wrapToken. That is pre-existing and fixed separately, since it stands on its own.

Verification

clients/ts builds and scripts typechecks on this branch. Confirmed against main that wrapToken's discriminator is unchanged and its encoder and decoder field lists diff clean.

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

1 participant