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

View File

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