Add support for new Token Program instructions and improve instruction sharing - #308
Open
wiyarmir wants to merge 2 commits into
Open
Add support for new Token Program instructions and improve instruction sharing#308wiyarmir wants to merge 2 commits into
wiyarmir wants to merge 2 commits into
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
wiyarmir
force-pushed
the
claude/fix-pr-306-ci-DZpc0
branch
from
May 7, 2026 09:52
f2b6605 to
d0b63e2
Compare
Contributor
wiyarmir
force-pushed
the
claude/fix-pr-306-ci-DZpc0
branch
from
May 7, 2026 10:25
d0b63e2 to
ef59dbd
Compare
avianlabs-bot
force-pushed
the
update-solana-idls
branch
from
May 11, 2026 04:26
913eb43 to
0c73ab1
Compare
The base TokenProgram IDL diverged from token-2022.json: syncNative gained an optional rent account, and a new batch instruction was added with an inline anonymous struct in an array. The previous codegen made every base instruction abstract on the sealed parent and called serialize() on a structTypeNode it couldn't map (List<Any>), which produced code that didn't compile. - Compute sharedInstructionNames as the intersection of compatible signatures across implementing programs, so abstracts/overrides are only emitted when every implementation matches. - Skip generating instructions whose argument types contain inline anonymous structs inside arrays (currently unsupported), with a build-time warning. Regenerate TokenProgram.kt and Token2022Program.kt accordingly.
wiyarmir
force-pushed
the
claude/fix-pr-306-ci-DZpc0
branch
from
May 18, 2026 16:09
ef59dbd to
268e513
Compare
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.
Summary
This PR adds support for three new Token Program instructions (
withdrawExcessLamports,unwrapLamports, andbatch), updates thesyncNativeinstruction to include an optional rent sysvar parameter, and improves the code generation logic to properly handle instruction signature compatibility across multiple program implementations.Key Changes
New Instructions: Added three new instruction definitions to the Token Program IDL:
withdrawExcessLamports(discriminator 38): Rescues excess SOL from TokenProgram-owned accountsunwrapLamports(discriminator 45): Transfers lamports from native SOL accounts with optional amount parameterbatch(discriminator 255): Executes batches of instructionsUpdated
syncNativeInstruction: Modified to include an optionalrentsysvar account parameter with a default value, and changed the optional account strategy fromprogramIdtoomittedImproved Instruction Sharing Logic:
hasUnsupportedTypes()function to detect instructions with argument types that cannot be mapped to typed Kotlin (e.g., inline anonymous structs in arrays)signaturesCompatible()function to determine if two instructions have compatible signatures for shared abstract method declarationscomputeSharedInstructionNames()to only treat instructions as "shared" if they exist in all implementing programs with compatible signaturesCode Generation Improvements:
Implementation Details
The changes ensure that:
syncNativeinstruction now properly includes the rent sysvar as an optional account parameterhttps://claude.ai/code/session_014xdHvfVQqrfn4fnhY52vF1