[][src]Struct ergo_lib::chain::ergo_box::box_builder::ErgoBoxCandidateBuilder

pub struct ErgoBoxCandidateBuilder { /* fields omitted */ }

ErgoBoxCandidate builder

Implementations

impl ErgoBoxCandidateBuilder[src]

pub fn new(value: BoxValue, ergo_tree: ErgoTree, creation_height: u32) -> Self[src]

Create builder with required box parameters: value - box value in nanoErgs, ergo_tree - ErgoTree to guard this box, current_height - chain height that will be set in the built box

pub fn set_min_box_value_per_byte(&mut self, new_min_value_per_byte: u32)[src]

Set minimal value (per byte of the serialized box size)

pub fn min_box_value_per_byte(&self) -> u32[src]

Get minimal value (per byte of the serialized box size)

pub fn set_value(&mut self, new_value: BoxValue)[src]

Set new box value

pub fn value(&self) -> &BoxValue[src]

Get box value

pub fn calc_box_size_bytes(&self) -> Result<usize, ErgoBoxCandidateBuilderError>[src]

Calculate serialized box size(in bytes)

pub fn calc_min_box_value(
    &self
) -> Result<BoxValue, ErgoBoxCandidateBuilderError>
[src]

Calculate minimal box value for the current box serialized size(in bytes)

pub fn set_register_value(
    &mut self,
    register_id: NonMandatoryRegisterId,
    value: Constant
)
[src]

Set register with a given id (R4-R9) to the given value

pub fn register_value(
    &self,
    register_id: &NonMandatoryRegisterId
) -> Option<&Constant>
[src]

Returns register value for the given register id (R4-R9), or None if the register is empty

pub fn delete_register_value(&mut self, register_id: &NonMandatoryRegisterId)[src]

Delete register value(make register empty) for the given register id (R4-R9)

pub fn mint_token(
    &mut self,
    token: Token,
    token_name: String,
    token_desc: String,
    num_decimals: usize
)
[src]

Mint token, as defined in https://github.com/ergoplatform/eips/blob/master/eip-0004.md token - token id(box id of the first input box in transaction) and token amount, token_name - token name (will be encoded in R4), token_desc - token description (will be encoded in R5), num_decimals - number of decimals (will be encoded in R6)

pub fn add_token(&mut self, token: Token)[src]

Add given token id and token amount

pub fn build(self) -> Result<ErgoBoxCandidate, ErgoBoxCandidateBuilderError>[src]

Build the box candidate

Trait Implementations

impl Clone for ErgoBoxCandidateBuilder[src]

impl Debug for ErgoBoxCandidateBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<F> TryExtractInto<F> for F[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,