Documentation

Solanalib.Instruction.Basic

Instructions #

A Solana instruction is the unit of program invocation: a target program identified by its pubkey, a list of accounts the program may read or write, and an opaque data payload the program interprets itself.

This module matches the on-chain layout exactly so downstream specs about transaction processing, CPI semantics, and Anchor account validation can reason about real instructions:

// solana-instruction
pub struct Instruction {
    pub program_id: Pubkey,
    pub accounts:   Vec<AccountMeta>,
    pub data:       Vec<u8>,
}

pub struct AccountMeta {
    pub pubkey:      Pubkey,
    pub is_signer:   bool,
    pub is_writable: bool,
}

Main definitions #

Metadata about how an instruction expects to use a given account.

isSigner = true means the transaction must carry a signature from this account's pubkey; isWritable = true means the program may mutate the account's lamports or data. The runtime rejects the transaction if a program tries to write an account marked read-only, or if a required signer hasn't signed.

  • pubkey : Pubkey

    The account's address.

  • isSigner : Bool

    True iff the transaction must carry a valid signature for pubkey.

  • isWritable : Bool

    True iff the invoked program may mutate this account.

Instances For
    theorem Solanalib.AccountMeta.ext {x y : AccountMeta} (pubkey : x.pubkey = y.pubkey) (isSigner : x.isSigner = y.isSigner) (isWritable : x.isWritable = y.isWritable) :
    x = y
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        A Solana instruction: which program to call, which accounts to pass, and what payload to deliver. The program interprets data itself.

        • programId : Pubkey

          The pubkey of the program that will execute this instruction.

        • accounts : List AccountMeta

          The accounts the instruction reads or writes, with their access modes.

        • data : ByteArray

          Opaque bytes delivered to the program; encoding is program-specific.

        Instances For
          theorem Solanalib.Instruction.ext {x y : Instruction} (programId : x.programId = y.programId) (accounts : x.accounts = y.accounts) (data : x.data = y.data) :
          x = y
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              The list of accounts an instruction requires to be signers.

              Equations
              Instances For

                The list of accounts an instruction may mutate.

                Equations
                Instances For