Ref - https://www.anchor-lang.com/docs/basics/cpi
let cpi_context = CpiContext::new(
program_id,
Transfer {
from: from_pubkey,
to: to_pubkey,
},
)
.with_signer(signer_seeds);
transfer(cpi_context, amount)?;
let cpi_context = CpiContext::new(
program_id,
Transfer {
from: from_pubkey,
to: to_pubkey,
},
)
.with_signer(signer_seeds);
transfer(cpi_context, amount)?;
// or
let cpi_context = CpiContext::new_with_signer(
program_id,
system_program::Transfer {
from: from_pubkey,
to: to_pubkey,
},
signer,
);
transfer(cpi_context, amount)?;