Struct sapio::template::builder::Builder [−][src]
Builder can be used to interactively put together a transaction template before finalizing into a Template.
Implementations
impl Builder
[src]
pub fn new(ctx: Context) -> Builder
[src]
Creates a new transaction template with 1 input and no outputs.
pub fn ctx(&self) -> &Context
[src]
get a read-only reference to the builder’s context
pub fn spend_amount(self, amount: Amount) -> Result<Self, CompilationError>
[src]
reduce the amount availble in the builder’s context
pub fn add_output<T: Compilable>(
self,
amount: Amount,
contract: &T,
metadata: Option<OutputMeta>
) -> Result<Self, CompilationError>
[src]
self,
amount: Amount,
contract: &T,
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.
pub fn add_amount(self, a: Amount) -> Self
[src]
adds available funds to the builder’s context object. TODO: Make guarantee there is some external input?
pub fn add_sequence(self) -> Self
[src]
Adds another output. Follow with a call to set_sequence(-1, …) to fill in the back.
pub fn set_sequence(
self,
ii: isize,
s: AnyRelTimeLock
) -> Result<Self, CompilationError>
[src]
self,
ii: isize,
s: AnyRelTimeLock
) -> Result<Self, CompilationError>
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
pub fn set_lock_time(
self,
lt_in: AnyAbsTimeLock
) -> Result<Self, CompilationError>
[src]
self,
lt_in: AnyAbsTimeLock
) -> Result<Self, CompilationError>
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.
pub fn set_label(self, label: String) -> Self
[src]
overwrite any existing label with the provided string, or set a label if non provided thus far.
pub fn get_tx(&self) -> Transaction
[src]
Creates a transaction from a Builder. Generally, should not be called directly.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,