pub fn write_header(
data: &mut [u8],
discriminator: u8,
version: u8,
flags: u8,
) -> Result<(), ProgramError>Expand description
Write the standard 8-byte Jiminy account header.
Sets the discriminator, version, and flags. Reserved byte and data_len
are zeroed. Call this immediately after allocating the account (and after
zero_init if desired).
ⓘ
let mut raw = account.try_borrow_mut()?;
jiminy::write_header(&mut raw, VAULT_DISC, 1, 0)?;
let mut w = DataWriter::new(&mut raw[HEADER_LEN..]);
w.write_u64(0)?; // balance
w.write_address(&authority)?; // authority pubkey