Simplify TransactionBuilder::new_with_instructions
This commit is contained in:
parent
48d86683e2
commit
4e51a444f4
|
@ -52,16 +52,13 @@ impl TransactionBuilder {
|
||||||
|
|
||||||
/// Create a new unsigned transaction from a single instruction
|
/// Create a new unsigned transaction from a single instruction
|
||||||
pub fn new_with_instruction(instruction: BuilderInstruction) -> Transaction {
|
pub fn new_with_instruction(instruction: BuilderInstruction) -> Transaction {
|
||||||
Self::default().push(instruction).compile()
|
Self::new_with_instructions(vec![instruction])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new unsigned transaction from a single instruction
|
/// Create a new unsigned transaction from a single instruction
|
||||||
pub fn new_with_instructions(instructions: Vec<BuilderInstruction>) -> Transaction {
|
pub fn new_with_instructions(instructions: Vec<BuilderInstruction>) -> Transaction {
|
||||||
let mut transaction_builder = Self::default();
|
let fee = 0;
|
||||||
for instruction in instructions {
|
Self { fee, instructions }.compile()
|
||||||
transaction_builder.push(instruction);
|
|
||||||
}
|
|
||||||
transaction_builder.compile()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add an instruction.
|
/// Add an instruction.
|
||||||
|
|
Loading…
Reference in New Issue