pub struct InputOutputBuilder {
inputs: Vec<Input>,
outputs: Vec<Output<Address>>,
}
Expand description
Inputs & Outputs for a transaction being built
Fields§
§inputs: Vec<Input>
§outputs: Vec<Output<Address>>
Implementations§
source§impl InputOutputBuilder
impl InputOutputBuilder
sourcepub fn empty() -> InputOutputBuilder
pub fn empty() -> InputOutputBuilder
Create a new empty builder
sourcepub fn new<'a, IITER, OITER>(
inputs: IITER,
outputs: OITER
) -> Result<InputOutputBuilder, Error>where
IITER: Iterator<Item = &'a Input>,
OITER: Iterator<Item = &'a Output<Address>>,
pub fn new<'a, IITER, OITER>( inputs: IITER, outputs: OITER ) -> Result<InputOutputBuilder, Error>where IITER: Iterator<Item = &'a Input>, OITER: Iterator<Item = &'a Output<Address>>,
Create a builder from a given sequence of inputs and outputs
sourcepub fn build(self) -> InputOutput
pub fn build(self) -> InputOutput
Build the InputOutput from the Builder
sourcepub fn add_input(&mut self, input: &Input) -> Result<(), Error>
pub fn add_input(&mut self, input: &Input) -> Result<(), Error>
Add additional input.
Each input may extend the size of the required fee.
sourcepub fn add_output(
&mut self,
address: Address,
value: Value
) -> Result<(), Error>
pub fn add_output( &mut self, address: Address, value: Value ) -> Result<(), Error>
Add additional output.
Each output may extend the size of the required fee.
sourcepub fn remove_input(&mut self, input: usize)
pub fn remove_input(&mut self, input: usize)
Remove input at the index specified starting from the oldest added input.
sourcepub fn remove_output(&mut self, output: usize)
pub fn remove_output(&mut self, output: usize)
Remove output at the index specified starting from the oldest added output.
pub fn balance(&self, fee: Value) -> Result<Balance, ValueError>
sourcepub fn estimate_fee<P: Payload, F: FeeAlgorithm>(
&self,
payload: PayloadSlice<'_, P>,
fee_algorithm: &F
) -> Value
pub fn estimate_fee<P: Payload, F: FeeAlgorithm>( &self, payload: PayloadSlice<'_, P>, fee_algorithm: &F ) -> Value
Calculate the fees on a given fee algorithm for the current transaction
sourcepub fn get_balance<P: Payload, F: FeeAlgorithm>(
&self,
payload: PayloadSlice<'_, P>,
fee_algorithm: &F
) -> Result<Balance, ValueError>
pub fn get_balance<P: Payload, F: FeeAlgorithm>( &self, payload: PayloadSlice<'_, P>, fee_algorithm: &F ) -> Result<Balance, ValueError>
Get balance including current fee.
sourcepub fn get_balance_with_placeholders<P: Payload, F: FeeAlgorithm>(
&self,
payload: PayloadSlice<'_, P>,
fee_algorithm: &F,
inputs_placeholders: u8,
outputs_placeholders: u8
) -> Result<Balance, Error>
pub fn get_balance_with_placeholders<P: Payload, F: FeeAlgorithm>( &self, payload: PayloadSlice<'_, P>, fee_algorithm: &F, inputs_placeholders: u8, outputs_placeholders: u8 ) -> Result<Balance, Error>
Get balance including current fee.
sourcepub fn get_balance_without_fee(&self) -> Result<Balance, ValueError>
pub fn get_balance_without_fee(&self) -> Result<Balance, ValueError>
Get transaction balance without fee included.
sourcepub fn seal<P: Payload, F: FeeAlgorithm>(
self,
payload: PayloadSlice<'_, P>,
fee_algorithm: &F
) -> Result<InputOutput, Error>
pub fn seal<P: Payload, F: FeeAlgorithm>( self, payload: PayloadSlice<'_, P>, fee_algorithm: &F ) -> Result<InputOutput, Error>
Seal the transaction checking that the transaction fits the fee algorithm
sourcepub fn seal_with_output_policy<P: Payload, F: FeeAlgorithm>(
self,
payload: PayloadSlice<'_, P>,
fee_algorithm: &F,
policy: OutputPolicy
) -> Result<(Balance, Vec<Output<Address>>, InputOutput), Error>
pub fn seal_with_output_policy<P: Payload, F: FeeAlgorithm>( self, payload: PayloadSlice<'_, P>, fee_algorithm: &F, policy: OutputPolicy ) -> Result<(Balance, Vec<Output<Address>>, InputOutput), Error>
Seal the transaction by passing fee rule and the output policy
Along with the transaction, this return the balance unassigned to output policy if any