pub struct BoxSpec { /* private fields */ }
Expand description

A specification which specifies parameters of an ErgoBox. This spec is used as a “source of truth” to both verify and find ErgoBoxes which match the spec. This is often used for defining Stages in multi-stage smart contract protocols, but can also be used to define input boxes for Actions. All fields are wrapped in Options to allow ignoring specifying the field.

Implementations

Method definitions for BoxSpec that are WASM-compatible by default and/or are wrapper functions for Rust methods so that they are made WASM-compatible.

Returns a new BoxSpec with all fields exactly the same except the address is set to the String provided as input. This method is generally used to hone down a more generic BoxSpec definition into a more specific one for your given use case. Ie. Add a user’s P2PK address to find boxes matching the BoxSpec in their wallet.

Method definitions for BoxSpec that are intended to be used in Rust.

Create a new basic BoxSpec with no predicate.

Create a new BoxSpec with a custom predicate defined.

Acquire the ErgoTree of the address in the BoxSpec

Verify that a provided ErgoBox matches the spec

Generates a URL for the Ergo Explorer Backend API to find boxes which may match your BoxSpec. This method uses the explorer_api_url you provide as input which must be formatted as such: https://api.ergoplatform.com/api This method is intended to be used in tandem with process_explorer_response()

Using the response JSON (as a String) from the Ergo Explorer API endpoint generated by the explorer_endpoint() method, filter all returned ErgoBoxes against the BoxSpec using the verify_box() method.

Methods related to modifying fields (which aren’t WASM-compatible)

Returns a new BoxSpec with all fields exactly the same except the value_range is set to the range provided as input.

Returns a new BoxSpec with all fields exactly the same except the registers are set to the registers provided as input.

Returns a new BoxSpec with all fields exactly the same except the tokens are set to the TokenSpecs provided as input.

Returns a new BoxSpec with all fields exactly the same except the predicate is set to the one provided as input.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Performs the conversion.

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

Recover a Self from Self::Abi. Read more

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

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary. Read more

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi. Read more

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more

The wasm ABI type references to Self are recovered from.

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

Recover a Self::Anchor from Self::Abi. Read more

Same as RefFromWasmAbi::Abi

Same as RefFromWasmAbi::Anchor

Same as RefFromWasmAbi::ref_from_abi

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Causes self to use its Binary implementation when Debug-formatted.

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted.

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Performs the conversion.

Performs the conversion.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Same as IntoWasmAbi::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err. Read more

Should always be Self

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Attempts to convert self into T using TryInto<T>. Read more

Extract value of the given type from any type (e.g. [‘Constant’], [super::value::Value]) on which [TryExtractFrom] is implemented Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.