pub fn fetch_zerocopy_account<T: Pod + Discriminator + Owner>(
    client: &RpcClient,
    pubkey: Pubkey,
) -> Result<T, OnDemandError>
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 OnDemandError if an error occurs.

§Errors

This function can return the following errors:

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