pub fn fetch_zerocopy_account<T: Pod + Discriminator + Owner>(
    client: &RpcClient,
    pubkey: Pubkey
) -> Result<T, SbError>
Expand description

Fetches a zero-copy account from the Solana blockchain.

§Arguments

  • client - The Solana RPC client used to interact with the blockchain.
  • pubkey - The public key of the account to fetch.

§Returns

Returns a result containing the fetched account data as the specified type T, or an SbError if an error occurs.

§Errors

This function can return the following errors:

  • SbError::AccountNotFound - If the account with the specified public key is not found.
  • SbError::Message("no discriminator found") - If no discriminator is found in the account data.
  • SbError::Message("Discriminator error, check the account type") - If the discriminator in the account data does not match the expected discriminator for type T.
  • SbError::Message("AnchorParseError") - If an error occurs while parsing the account data into type T.