Skip to main content

encode_advance

Function encode_advance 

Source
pub fn encode_advance(
    inner_instructions: &[Instruction],
) -> Result<AdvancePayload, Error>
Expand description

Encode inner CPI instructions into an Advance payload + ordered account list.

§Wire format

num_instructions: u8
per instruction:
  num_accounts: u8
  data_len: u16 LE
  data: [u8; data_len]

Accounts are NOT encoded in the payload bytes — they are passed positionally in the transaction’s account list. This function produces both the payload and the correctly-ordered account metas as a single atomic return value, making it impossible to get them out of sync.