Boot fees from TransactionBuilder
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
@@ -40,12 +40,10 @@ impl RewardsTransaction {
|
||||
fee: u64,
|
||||
) -> Transaction {
|
||||
let vote_id = vote_keypair.pubkey();
|
||||
let mut tx = TransactionBuilder::new(fee)
|
||||
.push(RewardsInstruction::new_redeem_vote_credits(
|
||||
&vote_id, rewards_id,
|
||||
))
|
||||
.push(VoteInstruction::new_clear_credits(&vote_id))
|
||||
.compile();
|
||||
let redeem_ix = RewardsInstruction::new_redeem_vote_credits(&vote_id, rewards_id);
|
||||
let clear_ix = VoteInstruction::new_clear_credits(&vote_id);
|
||||
let mut tx = TransactionBuilder::new(vec![redeem_ix, clear_ix]).compile();
|
||||
tx.fee = fee;
|
||||
tx.sign(&[vote_keypair], blockhash);
|
||||
tx
|
||||
}
|
||||
|
@@ -22,9 +22,9 @@ impl VoteTransaction {
|
||||
fee: u64,
|
||||
) -> Transaction {
|
||||
let vote = Vote { slot };
|
||||
let mut tx = TransactionBuilder::new(fee)
|
||||
.push(VoteInstruction::new_vote(staking_account, vote))
|
||||
.compile();
|
||||
let ix = VoteInstruction::new_vote(staking_account, vote);
|
||||
let mut tx = TransactionBuilder::new(vec![ix]).compile();
|
||||
tx.fee = fee;
|
||||
tx.sign(&[authorized_voter_keypair], recent_blockhash);
|
||||
tx
|
||||
}
|
||||
@@ -39,16 +39,11 @@ impl VoteTransaction {
|
||||
) -> Transaction {
|
||||
let from_id = from_keypair.pubkey();
|
||||
let space = VoteState::max_size() as u64;
|
||||
let mut tx = TransactionBuilder::new(fee)
|
||||
.push(SystemInstruction::new_program_account(
|
||||
&from_id,
|
||||
staker_id,
|
||||
lamports,
|
||||
space,
|
||||
&id(),
|
||||
))
|
||||
.push(VoteInstruction::new_initialize_account(staker_id))
|
||||
.compile();
|
||||
let create_ix =
|
||||
SystemInstruction::new_program_account(&from_id, staker_id, lamports, space, &id());
|
||||
let init_ix = VoteInstruction::new_initialize_account(staker_id);
|
||||
let mut tx = TransactionBuilder::new(vec![create_ix, init_ix]).compile();
|
||||
tx.fee = fee;
|
||||
tx.sign(&[from_keypair], recent_blockhash);
|
||||
tx
|
||||
}
|
||||
@@ -65,17 +60,12 @@ impl VoteTransaction {
|
||||
let from_id = from_keypair.pubkey();
|
||||
let voter_id = voter_keypair.pubkey();
|
||||
let space = VoteState::max_size() as u64;
|
||||
let mut tx = TransactionBuilder::new(fee)
|
||||
.push(SystemInstruction::new_program_account(
|
||||
&from_id,
|
||||
&voter_id,
|
||||
lamports,
|
||||
space,
|
||||
&id(),
|
||||
))
|
||||
.push(VoteInstruction::new_initialize_account(&voter_id))
|
||||
.push(VoteInstruction::new_delegate_stake(&voter_id, &delegate_id))
|
||||
.compile();
|
||||
let create_ix =
|
||||
SystemInstruction::new_program_account(&from_id, &voter_id, lamports, space, &id());
|
||||
let init_ix = VoteInstruction::new_initialize_account(&voter_id);
|
||||
let delegate_ix = VoteInstruction::new_delegate_stake(&voter_id, &delegate_id);
|
||||
let mut tx = TransactionBuilder::new(vec![create_ix, init_ix, delegate_ix]).compile();
|
||||
tx.fee = fee;
|
||||
tx.sign(&[from_keypair, voter_keypair], recent_blockhash);
|
||||
tx
|
||||
}
|
||||
@@ -87,12 +77,9 @@ impl VoteTransaction {
|
||||
authorized_voter_id: &Pubkey,
|
||||
fee: u64,
|
||||
) -> Transaction {
|
||||
let mut tx = TransactionBuilder::new(fee)
|
||||
.push(VoteInstruction::new_authorize_voter(
|
||||
&vote_keypair.pubkey(),
|
||||
authorized_voter_id,
|
||||
))
|
||||
.compile();
|
||||
let ix = VoteInstruction::new_authorize_voter(&vote_keypair.pubkey(), authorized_voter_id);
|
||||
let mut tx = TransactionBuilder::new(vec![ix]).compile();
|
||||
tx.fee = fee;
|
||||
tx.sign(&[vote_keypair], recent_blockhash);
|
||||
tx
|
||||
}
|
||||
@@ -104,12 +91,9 @@ impl VoteTransaction {
|
||||
node_id: &Pubkey,
|
||||
fee: u64,
|
||||
) -> Transaction {
|
||||
let mut tx = TransactionBuilder::new(fee)
|
||||
.push(VoteInstruction::new_delegate_stake(
|
||||
&vote_keypair.pubkey(),
|
||||
node_id,
|
||||
))
|
||||
.compile();
|
||||
let ix = VoteInstruction::new_delegate_stake(&vote_keypair.pubkey(), node_id);
|
||||
let mut tx = TransactionBuilder::new(vec![ix]).compile();
|
||||
tx.fee = fee;
|
||||
tx.sign(&[vote_keypair], recent_blockhash);
|
||||
tx
|
||||
}
|
||||
|
Reference in New Issue
Block a user