multiversx_sc_meta_lib::contract::sc_config

Struct ScConfig

Source
pub struct ScConfig {
    pub default_contract_config_name: String,
    pub contracts: Vec<ContractVariant>,
    pub proxy_configs: Vec<ProxyConfig>,
}
Expand description

An entire project configuration.

It can contain one or several contract variants.

Fields§

§default_contract_config_name: String§contracts: Vec<ContractVariant>§proxy_configs: Vec<ProxyConfig>

Implementations§

Source§

impl ScConfig

Source

pub fn load_from_config( config: &ScConfigSerde, original_abi: &ContractAbi, ) -> Self

Assembles an ContractVariantConfig from a raw config object that was loaded via Serde.

In most cases the config will be loaded from a .toml file, use load_from_file for that.

Source§

impl ScConfig

Source

pub fn default_config(original_abi: &ContractAbi) -> Self

Provides the config for the cases where no multicontract.toml file is available.

The default configuration contains a single main contract, with all endpoints.

Source

pub fn load_from_file<P: AsRef<Path>>( path: P, original_abi: &ContractAbi, ) -> Option<Self>

Loads a contract configuration from file. Will return None if the file is not found.

Source

pub fn load_from_files_or_default<I, P>( paths: I, original_abi: &ContractAbi, ) -> Self
where P: AsRef<Path>, I: Iterator<Item = P>,

The standard way of loading a multicontract.toml configuration: read the file if present, use the default config otherwise.

Source

pub fn load_from_crate_or_default<P>( contract_crate_path: P, original_abi: &ContractAbi, ) -> Self
where P: AsRef<Path>,

The standard way of loading a multicontract.toml configuration: read the file if present, use the default config otherwise.

Source§

impl ScConfig

Source

pub fn main_contract(&self) -> &ContractVariant

Source

pub fn main_contract_mut(&mut self) -> &mut ContractVariant

Source

pub fn secondary_contracts(&self) -> impl Iterator<Item = &ContractVariant>

Source

pub fn secondary_contracts_mut( &mut self, ) -> impl Iterator<Item = &mut ContractVariant>

Source

pub fn get_contract_by_id( &self, contract_id: String, ) -> Option<&ContractVariant>

Source

pub fn get_contract_by_name( &self, contract_name: String, ) -> Option<&ContractVariant>

Source

pub fn find_contract(&self, contract_name: &str) -> &ContractVariant

Yields the contract with the given public name.

Source

pub fn validate_contract_variants(&self)

Trait Implementations§

Source§

impl Debug for ScConfig

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.