Boot fees from TransactionBuilder

This commit is contained in:
Greg Fitzgerald
2019-03-15 10:30:50 -06:00
parent e091aa87ea
commit aca739b800
7 changed files with 41 additions and 109 deletions

View File

@@ -28,17 +28,11 @@ impl BudgetTransaction {
) -> Transaction {
let from = from_keypair.pubkey();
let space = serialized_size(&BudgetState::new(expr.clone())).unwrap();
let mut tx = TransactionBuilder::new(fee)
.push(SystemInstruction::new_program_account(
&from,
contract,
lamports,
space,
&id(),
))
.push(BudgetInstruction::new_initialize_account(contract, expr))
.compile();
let create_ix =
SystemInstruction::new_program_account(&from, contract, lamports, space, &id());
let init_ix = BudgetInstruction::new_initialize_account(contract, expr);
let mut tx = TransactionBuilder::new(vec![create_ix, init_ix]).compile();
tx.fee = fee;
tx.sign(&[from_keypair], recent_blockhash);
tx
}
@@ -72,11 +66,8 @@ impl BudgetTransaction {
recent_blockhash: Hash,
) -> Transaction {
let from = from_keypair.pubkey();
let mut tx = TransactionBuilder::default()
.push(BudgetInstruction::new_apply_timestamp(
&from, contract, to, dt,
))
.compile();
let ix = BudgetInstruction::new_apply_timestamp(&from, contract, to, dt);
let mut tx = TransactionBuilder::new(vec![ix]).compile();
tx.sign(&[from_keypair], recent_blockhash);
tx
}
@@ -89,9 +80,8 @@ impl BudgetTransaction {
recent_blockhash: Hash,
) -> Transaction {
let from = from_keypair.pubkey();
let mut tx = TransactionBuilder::default()
.push(BudgetInstruction::new_apply_signature(&from, contract, to))
.compile();
let ix = BudgetInstruction::new_apply_signature(&from, contract, to);
let mut tx = TransactionBuilder::new(vec![ix]).compile();
tx.sign(&[from_keypair], recent_blockhash);
tx
}