Implement signed transaction using unsigned transaction

This commit is contained in:
Greg Fitzgerald 2019-03-14 14:12:40 -06:00
parent 8ef5195037
commit 21815f26d5
1 changed files with 8 additions and 9 deletions

View File

@ -168,17 +168,16 @@ impl Transaction {
recent_blockhash: Hash,
fee: u64,
) -> Self {
let program_ids = vec![*program_id];
let accounts = (0..=transaction_keys.len() as u8).collect();
let instructions = vec![Instruction::new(0, data, accounts)];
Self::new_with_instructions(
&[from_keypair],
let mut transaction = Self::new_unsigned(
&from_keypair.pubkey(),
transaction_keys,
recent_blockhash,
program_id,
data,
Hash::default(),
fee,
program_ids,
instructions,
)
);
transaction.sign(&[from_keypair], recent_blockhash);
transaction
}
pub fn new_unsigned<T: Serialize>(
from_pubkey: &Pubkey,