How to read accounts in a program
Almost all instructions in Solana require at least 2 - 3 accounts, and they
would be mentioned over the instruction handlers on what order it's expecting
those set of accounts. It's fairly simple if we take advantage of the iter()
method in Rust, instead of manually indicing the accounts. The
next_account_info
method basically slices the first index of the iterable and
returning the account present inside the accounts array. Let's see a simple
instruction which expects a bunch of accounts and requiring to parse each of
them.