Struct sapio::template::builder::Builder [−][src]
pub struct Builder { /* fields omitted */ }
Expand description
Builder can be used to interactively put together a transaction template before finalizing into a Template.
Implementations
Creates a new transaction template with 1 input and no outputs.
reduce the amount availble in the builder’s context
reduce the amount availble in the builder’s context, and add to the fees
pub fn add_output(
self,
amount: Amount,
contract: &dyn Compilable,
metadata: Option<OutputMeta>
) -> Result<Self, CompilationError>
pub fn add_output(
self,
amount: Amount,
contract: &dyn Compilable,
metadata: Option<OutputMeta>
) -> Result<Self, CompilationError>
Creates a new Output, forcing the compilation of the compilable object and defaulting metadata if not provided to blank.
adds available funds to the builder’s context object. TODO: Make guarantee there is some external input?
Adds another output. Follow with a call to set_sequence(-1, …) to fill in the back.
set_sequence adds a height or time based relative lock time to the template. If a lock time is already set, it will check if it is of the same kind. Differing kinds will throw an error. Otherwise, it will merge by taking the max of the argument.
Negative indexing allows us to work from the back element easily
set_lock_time adds a height or time based absolute lock time to the template. If a lock time is already set, it will check if it is of the same kind. Differing kinds will throw an error. Otherwise, it will merge by taking the max of the argument.
overwrite any existing label with the provided string, or set a label if none provided thus far.
overwrite any existing color with the provided string, or set a color if none provided thus far.
Creates a transaction from a Builder. Generally, should not be called directly.
Sets the feerate if not set, and then sets the value to the min of the existing value or the new value. For example, s.set_min_feerate(100.into()).set_min_feerate(1000.into()) results in feerate Some(100).
During compilation, templates should be checked to ensure that at least that feerate is paid.
more efficient that get_tx() to estimate a tx size, not including witness