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

@ -94,6 +94,31 @@ pub fn create_account(
)
}
pub fn create_account_with_seed(
from_pubkey: &Pubkey,
to_pubkey: &Pubkey,
seed: &str,
lamports: u64,
space: u64,
program_id: &Pubkey,
) -> Instruction {
let account_metas = vec![
AccountMeta::new(*from_pubkey, true),
AccountMeta::new(*to_pubkey, false),
];
Instruction::new(
system_program::id(),
&SystemInstruction::CreateAccountWithSeed {
seed: seed.to_string(),
lamports,
space,
program_id: *program_id,
},
account_metas,
)
}
pub fn assign(from_pubkey: &Pubkey, program_id: &Pubkey) -> Instruction {
let account_metas = vec![AccountMeta::new(*from_pubkey, true)];
Instruction::new(