[][src]Struct ergo_lib_wasm::ergo_box::box_builder::ErgoBoxCandidateBuilder

pub struct ErgoBoxCandidateBuilder(_);

ErgoBoxCandidate builder

Implementations

impl ErgoBoxCandidateBuilder[src]

pub fn new(value: &BoxValue, contract: &Contract, creation_height: u32) -> Self[src]

Create builder with required box parameters: value - amount of money associated with the box contract - guarding contract(Contract), which should be evaluated to true in order to open(spend) this box creation_height - height when a transaction containing the box is created. It should not exceed height of the block, containing the transaction with this 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, JsValue>[src]

Calculate serialized box size(in bytes)

pub fn calc_min_box_value(&self) -> Result<BoxValue, JsValue>[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_id: &TokenId, amount: &TokenAmount)[src]

Add given token id and token amount

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

Build the box candidate

Trait Implementations

impl FromWasmAbi for ErgoBoxCandidateBuilder[src]

type Abi = u32

The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more

impl IntoWasmAbi for ErgoBoxCandidateBuilder[src]

type Abi = u32

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

impl OptionFromWasmAbi for ErgoBoxCandidateBuilder[src]

impl OptionIntoWasmAbi for ErgoBoxCandidateBuilder[src]

impl RefFromWasmAbi for ErgoBoxCandidateBuilder[src]

type Abi = u32

The wasm ABI type references to Self are recovered from.

type Anchor = Ref<'static, ErgoBoxCandidateBuilder>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don't persist beyond one function call, and so that they remain anonymous. Read more

impl RefMutFromWasmAbi for ErgoBoxCandidateBuilder[src]

type Abi = u32

Same as RefFromWasmAbi::Abi

type Anchor = RefMut<'static, ErgoBoxCandidateBuilder>

Same as RefFromWasmAbi::Anchor

impl WasmDescribe 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> ReturnWasmAbi for T where
    T: IntoWasmAbi
[src]

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi

impl<T> Same<T> for T

type Output = T

Should always be Self

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>,