Quantcast
Viewing all articles
Browse latest Browse all 2

Answer by Barebox for How can I do one cross-program-invocation with multiple instructions?

Invoke and invoke_signed only execute a single ix per execution.

TransferMany does this:

pub fn transfer_many(from_pubkey: &Pubkey, to_lamports: &[(Pubkey, u64)]) -> Vec<Instruction> {    to_lamports        .iter()        .map(|(to_pubkey, lamports)| transfer(from_pubkey, to_pubkey, *lamports))        .collect() }

So the elements will in order contain the result ofsolana_program::system_instruction::transfer(from_pubkey, to_pubkey, lamports)

which means the seeds will always be the signer/sender seeds, and accounts will be the corresponding [from_pubkey, to_pubkey] accountInfos.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>