Skip to content
This repository was archived by the owner on Sep 8, 2026. It is now read-only.

feat(solana-client-tools): add program zero-copy account fetch helper - #390

Open
vihu wants to merge 2 commits into
mainfrom
rg/fetch-helper-zero-cp-accounts
Open

feat(solana-client-tools): add program zero-copy account fetch helper#390
vihu wants to merge 2 commits into
mainfrom
rg/fetch-helper-zero-cp-accounts

Conversation

@vihu

@vihu vihu commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes malbeclabs/doublezero#3877

Add a shared solana-client-tools helper for fetching all zero-copy accounts of a given type from a program via getProgramAccounts.

Changes

  • Added try_fetch_program_zero_copy_accounts<T> as both:
    • a SolanaConnection method
    • a free helper accepting &RpcClient
  • Builds a getProgramAccounts request with:
    • discriminator memcmp filter at offset 0
    • Base64 account encoding
    • caller-supplied commitment
  • Skips zero-lamport/closed accounts before deserialization.
  • Deserializes remaining accounts through ZeroCopyAccountOwnedData<T>.
  • Returns contextual errors for malformed non-zero accounts, including pubkey and target type.
  • Added unit coverage for RPC config construction, closed-account skipping, and malformed-account errors.
  • Added direct solana-account-decoder-client-types dependency for account encoding.

@vihu
vihu requested a review from karl-dz June 18, 2026 14:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

solana-client-tools: add getProgramAccounts fetch helper for zero-copy accounts

1 participant