Add helper fn and runtime test (#7516)

This commit is contained in:
Tyera Eulberg
2019-12-16 17:02:40 -07:00
committed by GitHub
parent b22dc38ba1
commit f03ed9f5bf
2 changed files with 92 additions and 0 deletions

View File

@ -221,6 +221,31 @@ pub fn create_account_and_delegate_stake(
instructions
}
pub fn create_account_with_seed_and_delegate_stake(
from_pubkey: &Pubkey,
stake_pubkey: &Pubkey,
seed: &str,
vote_pubkey: &Pubkey,
authorized: &Authorized,
lockup: &Lockup,
lamports: u64,
) -> Vec<Instruction> {
let mut instructions = create_account_with_seed(
from_pubkey,
stake_pubkey,
seed,
authorized,
lockup,
lamports,
);
instructions.push(delegate_stake(
stake_pubkey,
&authorized.staker,
vote_pubkey,
));
instructions
}
pub fn authorize(
stake_pubkey: &Pubkey,
authorized_pubkey: &Pubkey,