Add create-address-with-seed to solana-cli (#7472)

* Add create account with seed to cli

* clippy

* fixup
This commit is contained in:
Rob Walker
2019-12-14 04:38:24 -08:00
committed by GitHub
parent 2b5e919a47
commit f05860672c
10 changed files with 240 additions and 51 deletions

View File

@@ -87,6 +87,26 @@ pub fn create_account(
vec![create_ix, init_ix]
}
pub fn create_account_with_seed(
from_pubkey: &Pubkey,
vote_pubkey: &Pubkey,
seed: &str,
vote_init: &VoteInit,
lamports: u64,
) -> Vec<Instruction> {
let space = VoteState::size_of() as u64;
let create_ix = system_instruction::create_account_with_seed(
from_pubkey,
vote_pubkey,
seed,
lamports,
space,
&id(),
);
let init_ix = initialize_account(vote_pubkey, vote_init);
vec![create_ix, init_ix]
}
pub fn authorize(
vote_pubkey: &Pubkey,
authorized_pubkey: &Pubkey, // currently authorized