refactor(basics/close-account): replace borsh with kit codecs in native example - #687
Merged
Merged
Conversation
…ve example The native example was the last package pinned to borsh 0.7, whose deserialize(schema, Class, buffer) signature no longer exists in borsh 2.x. Instruction data and the User account layout are now expressed as @solana/kit struct codecs, and the test asserts the decoded account name plus the post-close owner and data length. Refs: DEV-838
Contributor
Greptile SummaryThe PR replaces the native close-account example’s legacy TypeScript Borsh dependency with equivalent Solana Kit codecs and strengthens its integration assertions.
Confidence Score: 5/5The PR appears safe to merge, with the new codecs preserving the program’s existing wire and account-data layouts. The create and close encoders match the Rust program’s Borsh discriminants and string representation, the decoder matches the persisted User layout, and the new post-state assertions reflect the program’s actual close behavior. Important Files Changed
Reviews (1): Last reviewed commit: "refactor(basics/close-account): replace ..." | Re-trigger Greptile |
dev-jodee
approved these changes
Aug 13, 2026
dev-jodee
left a comment
Collaborator
There was a problem hiding this comment.
Refactor borsh→kit codecs in close-account. All CI green.
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
basics/close-account/nativewas the last package pinned toborsh: ^0.7.0— the only pre-2.x pin in the repo — and calleddeserialize(schema, Class, buffer), a signature that no longer exists in borsh 2.x. Dropped the dep and regenerated the lockfile.getStructEncoder, withaddEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())for thenamestring, matching the pattern from refactor(tokens): use kit codecs for instruction data in Token-2022 and create-token examples #676.ts/state/index.tsexposes auserDecoderfor the on-chainUserlayout in place of the borsh class boilerplate.nameafter create, and the System Program owner plus zero-length data after close.Test Plan
pnpm build-and-testinbasics/close-account/native— 3 passingpnpm exec tsc --noEmit -p tsconfig.json— cleanpnpm run check(prettier) — cleanCloses DEV-838