This PR adds an extra impl block to the AllocateCpiAccounts struct to provide a memory-efficient way to invoke the instruction. The rationale is to avoid cloning the instruction data multiple times, which happens on the "standard" builder. The impl has a companion macro to prepare the instruction data.
let data = ...; // slice of extension data ([u8] or &[u8])
AllocateCpiAccounts {
asset: ctx.accounts.asset,
payer: Some(ctx.accounts.payer),
system_program: Some(ctx.accounts.system_program),
}
.invoke(
ctx.accounts.nifty_asset_program,
allocate_instruction_data!(ExtensionType::Blob, data.len(), data),
)?;
This PR adds an extra
impl
block to theAllocateCpiAccounts
struct to provide a memory-efficient way to invoke the instruction. The rationale is to avoid cloning the instruction data multiple times, which happens on the "standard" builder. Theimpl
has a companion macro to prepare the instruction data.