multiversx_sc_meta_lib::contract::sc_config

Struct ContractVariant

Source
pub struct ContractVariant {
    pub main: bool,
    pub contract_id: String,
    pub contract_name: String,
    pub wasm_crate_name: String,
    pub settings: ContractVariantSettings,
    pub abi: ContractAbi,
}
Expand description

Represents a contract created by the framework when building.

It might have only some of the endpoints written by the developer and maybe some other function.

Fields§

§main: bool

If it is the main contract, then the wasm crate is called just wasm, and the wasm Cargo.toml is provided by the dev.

§contract_id: String

The contract id is defined in multicontract.toml. It has no effect on the produced assets.

It can be the same as the contract name, but it is not necessary.

§contract_name: String

The name, as seen in the generated contract names.

It is either defined in the multicontract.toml, or is inferred from the main crate name.

§wasm_crate_name: String

The name of the wasm crate, as it appear in Cargo.toml. It is normally the contract_name field, followed by the -wasm suffix.

However, the main contract Cargo.toml is given explicitly, so this name might differ.

§settings: ContractVariantSettings

Collection of flags, specified in the multicontract config.

§abi: ContractAbi

Filtered and processed ABI of the output contract.

Implementations§

Source§

impl ContractVariant

Source

pub fn default_from_abi(abi: &ContractAbi) -> Self

Source

pub fn public_name_snake_case(&self) -> String

Source

pub fn wasm_crate_dir_name(&self) -> String

The name of the directory of the wasm crate.

Note this does not necessarily have to match the wasm crate name defined in Cargo.toml.

Source

pub fn wasm_crate_path(&self) -> String

Source

pub fn cargo_toml_path(&self) -> String

Source

pub fn some_other_test_path(&self) -> String

Source

pub fn wasm_crate_name_snake_case(&self) -> String

Source

pub fn resolve_wasm_target_dir( &self, explicit_target_dir: &Option<String>, ) -> String

Source

pub fn wasm_compilation_output_path( &self, explicit_target_dir: &Option<String>, ) -> String

This is where Rust will initially compile the WASM binary.

Source

pub fn abi_output_name(&self) -> String

Source

pub fn wasm_output_name(&self, build_args: &BuildArgs) -> String

Source

pub fn wat_output_name(&self, build_args: &BuildArgs) -> String

Source

pub fn mxsc_file_output_name(&self, build_args: &BuildArgs) -> String

Source

pub fn imports_json_output_name(&self, build_args: &BuildArgs) -> String

Source

pub fn twiggy_top_name(&self, build_args: &BuildArgs) -> String

Source

pub fn twiggy_paths_name(&self, build_args: &BuildArgs) -> String

Source

pub fn twiggy_monos_name(&self, build_args: &BuildArgs) -> String

Source

pub fn twiggy_dominators_name(&self, build_args: &BuildArgs) -> String

Source

pub fn endpoint_names(&self) -> Vec<String>

Source

pub fn all_exported_function_names(&self) -> Vec<String>

Yields “init” + all endpoint names + “callBack” (if it exists).

Should correspond to all wasm exported functions.

Source§

impl ContractVariant

Source

pub fn build_contract(&self, build_args: &BuildArgs, output_path: &str)

Source§

impl ContractVariant

Source

pub fn cargo_clean(&self)

Runs cargo clean in the corresponding wasm crate.

Source§

impl ContractVariant

Source

pub fn create_wasm_crate_dir(&self)

Makes sure that all the necessary wasm crate directories exist.

Source

pub fn generate_wasm_src_lib_file(&self)

Generates the wasm crate lib.rs source, st the given path.

Source§

impl ContractVariant

Source

pub fn cargo_update(&self)

Runs cargo update in the corresponding wasm crate.

Trait Implementations§

Source§

impl Debug for ContractVariant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.