#[doc = r" This module, `#mod_name_ident`, encapsulates the logic, types, and implementations"]
#[doc = r" generated from the ABI (Application Binary Interface) for interacting with a specific"]
#[doc = r" smart contract on the blockchain. It provides a convenient and type-safe way to"]
#[doc = r" deploy, call, and query the smart contract."]
#[doc = r""]
#[doc = r" The module contains several key components:"]
#[doc = r""]
#[doc = r" - **Contract Struct**: A struct representing the smart contract. It has methods for deploying"]
#[doc = r" the contract, making calls to the contract, and querying the contract's state."]
#[doc = r" - **Call and Query Structs**: Structs that encapsulate the logic for making calls to, and"]
#[doc = r" querying the state of, the smart contract. They provide methods for configuring parameters"]
#[doc = r" like gas limit, EGLD value, and ESDT transfers."]
#[doc = r" - **Type Definitions**: Structs and enums representing the types defined in the smart contract's"]
#[doc = r" ABI, with conversions between native Rust types and the managed types used in the smart contract."]
#[doc = r" - **Generated Functions for Calls and Queries**: Functions generated from the ABI for each"]
#[doc = r" endpoint and view of the smart contract, providing a type-safe interface for interacting with"]
#[doc = r" the contract."]
#[doc = r""]
#[doc = r" This module is generated by a macro based on the smart contract's ABI, ensuring that the"]
#[doc = r" Rust interface stays in sync with the contract's actual interface."]
#[doc = r""]
#[doc = r" # Usage"]
#[doc = r""]
#[doc = r" Typically, you would import this module and use the provided structs and functions to interact"]
#[doc = r" with the smart contract from your Rust code."]
#[doc = r""]
#[doc = r" # Note"]
#[doc = r""]
#[doc = r" The `#![allow(clippy::all)]` directive at the beginning of the module suppresses linting warnings"]
#[doc = r" from Clippy for the generated code, as the code's structure is determined by the ABI and may not"]
#[doc = r" always conform to common Rust idioms."]
pub mod multisigview {
#![allow(clippy::all)]
#![allow(unused_imports)]
#![allow(dead_code)]
multiversx_sc::imports!();
multiversx_sc::derive_imports!();
use novax::caching::CachingNone;
use novax::caching::CachingStrategy;
use novax::code::AsBytesValue;
use novax::code::DeployData;
use novax::errors::CodingError;
use novax::errors::NovaXError;
use crate::generated::multisigview::multisigview::Proxy as CodegenProxy;
use core::marker::PhantomData;
use multiversx_sc::api::VMApi;
use multiversx_sc_codec::Empty;
use multiversx_sc_codec::TopEncodeMulti;
use multiversx_sc_scenario::api::StaticApi;
use multiversx_sc_scenario::imports::Bech32Address;
use multiversx_sc_scenario::scenario_model::AddressKey;
use multiversx_sc_scenario::scenario_model::AddressValue;
use multiversx_sc_scenario::scenario_model::ScDeployStep;
use multiversx_sc_scenario::scenario_model::ScQueryStep;
use multiversx_sc_scenario::scenario_model::TxResponse;
use multiversx_sc_scenario::ContractInfo;
use multiversx_sc_scenario::DebugApi;
use multiversx_sdk::wallet::Wallet;
use novax_data::Address;
use novax_data::ManagedConvertible;
use novax_data::NativeConvertible;
use novax_executor::call_result::CallResult;
use novax_executor::DeployExecutor;
use novax_executor::QueryExecutor;
use novax_executor::TokenTransfer;
use novax_executor::TransactionExecutor;
use serde::{Deserialize, Serialize};
use std::collections::hash_map::DefaultHasher;
use std::hash::Hash;
use std::hash::Hasher;
use std::ops::Deref;
use std::sync::Arc;
use tokio::sync::Mutex;
type MultisigViewContractInfos = ContractInfo<CodegenProxy<StaticApi>>;
#[allow(missing_docs)]
mod multisig_view_contract_proxy {
use super::*;
#[multiversx_sc::proxy]
trait MultisigViewContractProxy {
#[init]
fn init(&self, target_contract_address: ManagedAddress<Self::Api>);
#[endpoint(getPendingActionFullInfo)]
fn get_pending_action_full_info(
&self,
) -> MultiValueEncoded<Self::Api, ActionFullInfoManaged>;
#[endpoint(userRole)]
fn user_role(&self, user: ManagedAddress<Self::Api>) -> UserRoleManaged;
#[endpoint(getAllBoardMembers)]
fn get_all_board_members(
&self,
) -> MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>>;
#[endpoint(getAllProposers)]
fn get_all_proposers(&self) -> MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>>;
#[endpoint(getActionData)]
fn get_action_data(&self, action_id: u32) -> ActionManaged;
#[endpoint(getActionSigners)]
fn get_action_signers(
&self,
action_id: u32,
) -> ManagedVec<Self::Api, ManagedAddress<Self::Api>>;
#[endpoint(getActionSignerCount)]
fn get_action_signer_count(&self, action_id: u32) -> u32;
#[endpoint(getActionValidSignerCount)]
fn get_action_valid_signer_count(&self, action_id: u32) -> u32;
}
}
use multisig_view_contract_proxy::*;
#[doc = r" Generated smart contract interface for interacting with the deployed contract on the blockchain."]
#[doc = r#" The name of the struct is constructed by concatenating the ABI's name field with the string "Contract"."#]
#[doc = r""]
#[doc = r" This struct facilitates interactions with the smart contract through the provided methods,"]
#[doc = r" offering a native Rust interface to perform smart contract operations like querying, calling functions,"]
#[doc = r" and deploying new instances of the contract."]
#[doc = r""]
#[doc = r" The struct is parameterized over a type `A` that represents an address or reference to an address,"]
#[doc = r" where `A` is expected to be dereferenceable to a type from which an `Address` can be derived."]
#[doc = r""]
#[doc = r" # Methods"]
#[doc = r""]
#[doc = r" - `query(...)`: This method facilitates querying data from the smart contract. It accepts necessary"]
#[doc = r" parameters as defined in the ABI and returns a result as per the ABI's specification for the particular query."]
#[doc = r""]
#[doc = r" - `call(...)`: This method allows for calling smart contract functions. It handles the formation of the"]
#[doc = r" transaction, its submission to the blockchain, and returns the transaction result along with any data"]
#[doc = r" returned by the smart contract function, as per the ABI's specification."]
#[doc = r""]
#[doc = r" - `deploy(...)`: This is a static method useful for deploying a new instance of the smart contract to the blockchain."]
#[doc = r" It accepts deployment parameters as defined in the ABI, and returns an instance of the generated contract struct,"]
#[doc = r" now associated with the newly deployed contract's address on the blockchain."]
#[doc = r""]
#[doc = r" # Example"]
#[doc = r""]
#[doc = r" ```ignore"]
#[doc = r" let contract = #name::deploy(&deploy_executor, deploy_data)?;"]
#[doc = r" let query_result = contract.query(&query_executor, query_data)?;"]
#[doc = r" let call_result = contract.call(&call_executor, call_data)?;"]
#[doc = r" ```"]
#[doc = r""]
#[doc = r" # Note"]
#[doc = r""]
#[doc = r" The actual method signatures and types will be generated based on the ABI provided."]
#[derive(Copy, Clone)]
pub struct MultisigViewContract<A>
where
A: Deref + Send + Sync,
Address: for<'a> From<&'a A::Target>,
{
address: A,
}
#[doc = r" Struct representing a smart contract function call."]
#[doc = r" This struct contains all necessary information to perform a function call on the smart contract,"]
#[doc = r" including the executor to handle transaction execution, value and token transfers to be sent along with the call,"]
#[doc = r" gas limit for the call, and the address of the contract to call."]
#[doc = r" It has methods representing endpoints generated from the ABI."]
#[doc = r" Additionally, convenient methods are added to set information like ESDT transfers and others."]
#[derive(Clone, Debug)]
pub struct MultisigViewContractCall<Executor, A>
where
Executor: TransactionExecutor,
A: Deref + Send + Sync,
Address: for<'a> From<&'a A::Target>,
{
executor: Executor,
egld_value: num_bigint::BigUint,
token_transfers: Vec<TokenTransfer>,
gas_limit: u64,
contract_address: A,
}
#[doc = r" Struct representing a smart contract query."]
#[doc = r" This struct contains all necessary information to perform a query on the smart contract,"]
#[doc = r" including the executor to handle query execution, the value to be sent along with the query,"]
#[doc = r" and the address of the contract to query."]
#[doc = r" It has methods representing views generated from the ABI."]
#[doc = r" Additionally, a convenient method `with_caching` is provided to allow caching the result through a `CachingStrategy`."]
#[doc = r#" By default, `CachingNone` is used, but more caching strategies can be found in the "novax-caching" crate."#]
#[derive(Clone, Debug)]
pub struct MultisigViewContractQuery<Executor, Caching, A>
where
Executor: QueryExecutor,
Caching: CachingStrategy,
A: Deref + Send + Sync,
Address: for<'a> From<&'a A::Target>,
{
contract_address: A,
egld_value: num_bigint::BigUint,
executor: Executor,
caching: Caching,
}
#[doc = r" The main struct representing the smart contract."]
#[doc = r" This struct provides methods to create instances for contract call and query."]
#[doc = r" It also provides a method for deploying a new instance of the smart contract."]
impl<A> MultisigViewContract<A>
where
A: Deref + Send + Sync,
Address: for<'a> From<&'a A::Target>,
{
#[doc = r" Creates a new instance of the smart contract interface with the provided address."]
pub fn new(address: A) -> MultisigViewContract<A> {
MultisigViewContract { address }
}
#[doc = r" Returns a new instance of `#call_name` struct to perform function calls on the smart contract."]
pub fn call<Executor: TransactionExecutor>(
self,
executor: Executor,
gas_limit: u64,
) -> MultisigViewContractCall<Executor, A> {
MultisigViewContractCall {
executor,
gas_limit,
egld_value: num_bigint::BigUint::from(0u8),
token_transfers: vec![],
contract_address: self.address,
}
}
#[doc = r" Returns a new instance of `#query_name` struct to perform queries on the smart contract."]
pub fn query<Executor: QueryExecutor>(
self,
executor: Executor,
) -> MultisigViewContractQuery<Executor, CachingNone, A> {
MultisigViewContractQuery {
contract_address: self.address,
egld_value: num_bigint::BigUint::from(0u8),
executor,
caching: CachingNone,
}
}
}
impl MultisigViewContract<String> {
#[doc = r" This asynchronous function encapsulates the logic for deploying a smart contract to the blockchain."]
pub async fn deploy<Code: AsBytesValue, Executor: DeployExecutor>(
_novax_deploy_data: DeployData<Code>,
_novax_executor: &mut Executor,
_novax_egld_value: num_bigint::BigUint,
_novax_gas_limit: u64,
target_contract_address: &<ManagedAddress<StaticApi> as NativeConvertible>::Native,
) -> Result<(Address, CallResult<()>), NovaXError> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let mut _novax_contract = MultisigViewContractInfos::new(
&multiversx_sc::types::Address::from(<[u8; 32]>::default()),
);
let _novax_argument_target_contract_address: ManagedAddress<StaticApi> =
r#target_contract_address.to_managed();
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_target_contract_address
.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let _novax_code_bytes = _novax_deploy_data.code.into_bytes_value().await?;
_novax_executor
.sc_deploy::<()>(
_novax_code_bytes,
_novax_deploy_data.metadata,
_novax_egld_value,
_novax_bytes_args,
_novax_gas_limit,
)
.await
.map_err(NovaXError::from)
}
}
impl<Executor, Caching, A> MultisigViewContractQuery<Executor, Caching, A>
where
Executor: QueryExecutor,
Caching: CachingStrategy,
A: Deref + Send + Sync,
Address: for<'a> From<&'a A::Target>,
{
#[doc = r" Modifies the caching strategy used for the query."]
#[doc = r" This method allows changing the caching strategy to a different type,"]
#[doc = r" useful in cases where varying levels of caching are desired."]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" * `strategy`: A reference to the new caching strategy to be used."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A new instance of `#query_name` with the updated caching strategy."]
pub fn with_caching_strategy<C2: CachingStrategy + Clone>(
self,
strategy: &C2,
) -> MultisigViewContractQuery<Executor, C2, A> {
MultisigViewContractQuery {
contract_address: self.contract_address,
executor: self.executor,
egld_value: self.egld_value,
caching: strategy.clone(),
}
}
#[doc = r" Modifies the EGLD value associated with the query."]
#[doc = r" This method allows setting a new EGLD value to be used in the query."]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" * `egld_value`: The new EGLD value to be used."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A new instance of `#query_name` with the updated EGLD value."]
pub fn with_egld_value(
self,
egld_value: num_bigint::BigUint,
) -> MultisigViewContractQuery<Executor, Caching, A> {
MultisigViewContractQuery { egld_value, ..self }
}
#[doc = r" Executes the `#function_name` query on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing the `#function_native_outputs` or a `NovaXError` if the query fails."]
pub async fn get_pending_action_full_info(
&mut self,
) -> Result<
<MultiValueEncoded<StaticApi, ActionFullInfoManaged> as NativeConvertible>::Native,
NovaXError,
> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
let mut _novax_hasher = DefaultHasher::new();
_novax_contract_address_value.value.hash(&mut _novax_hasher);
"getPendingActionFullInfo".hash(&mut _novax_hasher);
let _novax_key = _novax_hasher.finish();
self.caching
.get_or_set_cache(_novax_key, async {
let result = self
.executor
.execute::<MultiValueEncoded<StaticApi, ActionFullInfoManaged>>(
&_novax_contract_address,
"getPendingActionFullInfo".to_string(),
_novax_bytes_args,
self.egld_value.clone(),
vec![],
)
.await;
if let Result::Ok(result) = result {
Result::Ok::<_, NovaXError>(result)
} else {
let error: NovaXError = result.unwrap_err().into();
Result::Err(error)
}
})
.await
}
#[doc = r" Executes the `#function_name` query on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing the `#function_native_outputs` or a `NovaXError` if the query fails."]
pub async fn user_role(
&mut self,
user: &<ManagedAddress<StaticApi> as NativeConvertible>::Native,
) -> Result<<UserRoleManaged as NativeConvertible>::Native, NovaXError> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_argument_user: ManagedAddress<StaticApi> = r#user.to_managed();
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_user.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let mut _novax_hasher = DefaultHasher::new();
_novax_contract_address_value.value.hash(&mut _novax_hasher);
"userRole".hash(&mut _novax_hasher);
user.hash(&mut _novax_hasher);
let _novax_key = _novax_hasher.finish();
self.caching
.get_or_set_cache(_novax_key, async {
let result = self
.executor
.execute::<UserRoleManaged>(
&_novax_contract_address,
"userRole".to_string(),
_novax_bytes_args,
self.egld_value.clone(),
vec![],
)
.await;
if let Result::Ok(result) = result {
Result::Ok::<_, NovaXError>(result)
} else {
let error: NovaXError = result.unwrap_err().into();
Result::Err(error)
}
})
.await
}
#[doc = r" Executes the `#function_name` query on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing the `#function_native_outputs` or a `NovaXError` if the query fails."]
pub async fn get_all_board_members(
&mut self,
) -> Result<
<MultiValueEncoded<StaticApi, ManagedAddress<StaticApi>> as NativeConvertible>::Native,
NovaXError,
> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
let mut _novax_hasher = DefaultHasher::new();
_novax_contract_address_value.value.hash(&mut _novax_hasher);
"getAllBoardMembers".hash(&mut _novax_hasher);
let _novax_key = _novax_hasher.finish();
self.caching
.get_or_set_cache(_novax_key, async {
let result = self
.executor
.execute::<MultiValueEncoded<StaticApi, ManagedAddress<StaticApi>>>(
&_novax_contract_address,
"getAllBoardMembers".to_string(),
_novax_bytes_args,
self.egld_value.clone(),
vec![],
)
.await;
if let Result::Ok(result) = result {
Result::Ok::<_, NovaXError>(result)
} else {
let error: NovaXError = result.unwrap_err().into();
Result::Err(error)
}
})
.await
}
#[doc = r" Executes the `#function_name` query on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing the `#function_native_outputs` or a `NovaXError` if the query fails."]
pub async fn get_all_proposers(
&mut self,
) -> Result<
<MultiValueEncoded<StaticApi, ManagedAddress<StaticApi>> as NativeConvertible>::Native,
NovaXError,
> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
let mut _novax_hasher = DefaultHasher::new();
_novax_contract_address_value.value.hash(&mut _novax_hasher);
"getAllProposers".hash(&mut _novax_hasher);
let _novax_key = _novax_hasher.finish();
self.caching
.get_or_set_cache(_novax_key, async {
let result = self
.executor
.execute::<MultiValueEncoded<StaticApi, ManagedAddress<StaticApi>>>(
&_novax_contract_address,
"getAllProposers".to_string(),
_novax_bytes_args,
self.egld_value.clone(),
vec![],
)
.await;
if let Result::Ok(result) = result {
Result::Ok::<_, NovaXError>(result)
} else {
let error: NovaXError = result.unwrap_err().into();
Result::Err(error)
}
})
.await
}
#[doc = r" Executes the `#function_name` query on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing the `#function_native_outputs` or a `NovaXError` if the query fails."]
pub async fn get_action_data(
&mut self,
action_id: &<u32 as NativeConvertible>::Native,
) -> Result<<ActionManaged as NativeConvertible>::Native, NovaXError> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_argument_action_id: u32 = r#action_id.to_managed();
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_action_id.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let mut _novax_hasher = DefaultHasher::new();
_novax_contract_address_value.value.hash(&mut _novax_hasher);
"getActionData".hash(&mut _novax_hasher);
action_id.hash(&mut _novax_hasher);
let _novax_key = _novax_hasher.finish();
self.caching
.get_or_set_cache(_novax_key, async {
let result = self
.executor
.execute::<ActionManaged>(
&_novax_contract_address,
"getActionData".to_string(),
_novax_bytes_args,
self.egld_value.clone(),
vec![],
)
.await;
if let Result::Ok(result) = result {
Result::Ok::<_, NovaXError>(result)
} else {
let error: NovaXError = result.unwrap_err().into();
Result::Err(error)
}
})
.await
}
#[doc = r" Executes the `#function_name` query on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing the `#function_native_outputs` or a `NovaXError` if the query fails."]
pub async fn get_action_signers(
&mut self,
action_id: &<u32 as NativeConvertible>::Native,
) -> Result<
<ManagedVec<StaticApi, ManagedAddress<StaticApi>> as NativeConvertible>::Native,
NovaXError,
> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_argument_action_id: u32 = r#action_id.to_managed();
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_action_id.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let mut _novax_hasher = DefaultHasher::new();
_novax_contract_address_value.value.hash(&mut _novax_hasher);
"getActionSigners".hash(&mut _novax_hasher);
action_id.hash(&mut _novax_hasher);
let _novax_key = _novax_hasher.finish();
self.caching
.get_or_set_cache(_novax_key, async {
let result = self
.executor
.execute::<ManagedVec<StaticApi, ManagedAddress<StaticApi>>>(
&_novax_contract_address,
"getActionSigners".to_string(),
_novax_bytes_args,
self.egld_value.clone(),
vec![],
)
.await;
if let Result::Ok(result) = result {
Result::Ok::<_, NovaXError>(result)
} else {
let error: NovaXError = result.unwrap_err().into();
Result::Err(error)
}
})
.await
}
#[doc = r" Executes the `#function_name` query on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing the `#function_native_outputs` or a `NovaXError` if the query fails."]
pub async fn get_action_signer_count(
&mut self,
action_id: &<u32 as NativeConvertible>::Native,
) -> Result<<u32 as NativeConvertible>::Native, NovaXError> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_argument_action_id: u32 = r#action_id.to_managed();
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_action_id.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let mut _novax_hasher = DefaultHasher::new();
_novax_contract_address_value.value.hash(&mut _novax_hasher);
"getActionSignerCount".hash(&mut _novax_hasher);
action_id.hash(&mut _novax_hasher);
let _novax_key = _novax_hasher.finish();
self.caching
.get_or_set_cache(_novax_key, async {
let result = self
.executor
.execute::<u32>(
&_novax_contract_address,
"getActionSignerCount".to_string(),
_novax_bytes_args,
self.egld_value.clone(),
vec![],
)
.await;
if let Result::Ok(result) = result {
Result::Ok::<_, NovaXError>(result)
} else {
let error: NovaXError = result.unwrap_err().into();
Result::Err(error)
}
})
.await
}
#[doc = r" Executes the `#function_name` query on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing the `#function_native_outputs` or a `NovaXError` if the query fails."]
pub async fn get_action_valid_signer_count(
&mut self,
action_id: &<u32 as NativeConvertible>::Native,
) -> Result<<u32 as NativeConvertible>::Native, NovaXError> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_argument_action_id: u32 = r#action_id.to_managed();
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_action_id.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let mut _novax_hasher = DefaultHasher::new();
_novax_contract_address_value.value.hash(&mut _novax_hasher);
"getActionValidSignerCount".hash(&mut _novax_hasher);
action_id.hash(&mut _novax_hasher);
let _novax_key = _novax_hasher.finish();
self.caching
.get_or_set_cache(_novax_key, async {
let result = self
.executor
.execute::<u32>(
&_novax_contract_address,
"getActionValidSignerCount".to_string(),
_novax_bytes_args,
self.egld_value.clone(),
vec![],
)
.await;
if let Result::Ok(result) = result {
Result::Ok::<_, NovaXError>(result)
} else {
let error: NovaXError = result.unwrap_err().into();
Result::Err(error)
}
})
.await
}
}
impl<Executor, A> MultisigViewContractCall<Executor, A>
where
Executor: TransactionExecutor,
A: Deref + Send + Sync,
Address: for<'a> From<&'a A::Target>,
{
#[doc = r" Modifies the EGLD value associated with the call."]
#[doc = r" This method allows setting a new EGLD value for the call transaction."]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" * `egld_value`: The new EGLD value to be used."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A new instance of `#call_name` with the updated EGLD value."]
pub fn with_egld_value(
self,
egld_value: num_bigint::BigUint,
) -> MultisigViewContractCall<Executor, A> {
MultisigViewContractCall { egld_value, ..self }
}
#[doc = r" Modifies the ESDT transfers associated with the call."]
#[doc = r" This method allows setting a new list of ESDT transfers for the call transaction."]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" * `token_transfers`: A reference to a vector of `TokenTransfer` objects representing the new ESDT transfers to be used."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A new instance of `#call_name` with the updated ESDT transfers."]
pub fn with_esdt_transfers(
self,
token_transfers: &Vec<TokenTransfer>,
) -> MultisigViewContractCall<Executor, A> {
MultisigViewContractCall {
token_transfers: token_transfers.clone(),
..self
}
}
#[doc = r" Modifies the gas limit associated with the call."]
#[doc = r" This method allows setting a new gas limit for the call transaction."]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" * `gas_limit`: The new gas limit to be used."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A new instance of `#call_name` with the updated gas limit."]
pub fn with_gas_limit(self, gas_limit: u64) -> MultisigViewContractCall<Executor, A> {
MultisigViewContractCall { gas_limit, ..self }
}
#[doc = r" Executes the `#function_name` function on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing a `CallResult` with the `#function_native_outputs` or a `NovaXError` if the call fails."]
pub async fn get_pending_action_full_info(
&mut self,
) -> Result<
CallResult<
<MultiValueEncoded<StaticApi, ActionFullInfoManaged> as NativeConvertible>::Native,
>,
NovaXError,
> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
let result = self
.executor
.sc_call::<MultiValueEncoded<StaticApi, ActionFullInfoManaged>>(
&_novax_contract_address,
"getPendingActionFullInfo".to_string(),
_novax_bytes_args,
self.gas_limit,
self.egld_value.clone(),
self.token_transfers.clone(),
)
.await?;
Result::Ok(result)
}
#[doc = r" Executes the `#function_name` function on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing a `CallResult` with the `#function_native_outputs` or a `NovaXError` if the call fails."]
pub async fn user_role(
&mut self,
user: &<ManagedAddress<StaticApi> as NativeConvertible>::Native,
) -> Result<CallResult<<UserRoleManaged as NativeConvertible>::Native>, NovaXError>
{
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_argument_user: ManagedAddress<StaticApi> = r#user.to_managed();
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_user.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let result = self
.executor
.sc_call::<UserRoleManaged>(
&_novax_contract_address,
"userRole".to_string(),
_novax_bytes_args,
self.gas_limit,
self.egld_value.clone(),
self.token_transfers.clone(),
)
.await?;
Result::Ok(result)
}
#[doc = r" Executes the `#function_name` function on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing a `CallResult` with the `#function_native_outputs` or a `NovaXError` if the call fails."] pub async fn get_all_board_members (& mut self) -> Result < CallResult < < MultiValueEncoded < StaticApi , ManagedAddress < StaticApi > > as NativeConvertible > :: Native > , NovaXError >{
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
let result = self
.executor
.sc_call::<MultiValueEncoded<StaticApi, ManagedAddress<StaticApi>>>(
&_novax_contract_address,
"getAllBoardMembers".to_string(),
_novax_bytes_args,
self.gas_limit,
self.egld_value.clone(),
self.token_transfers.clone(),
)
.await?;
Result::Ok(result)
}
#[doc = r" Executes the `#function_name` function on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing a `CallResult` with the `#function_native_outputs` or a `NovaXError` if the call fails."] pub async fn get_all_proposers (& mut self) -> Result < CallResult < < MultiValueEncoded < StaticApi , ManagedAddress < StaticApi > > as NativeConvertible > :: Native > , NovaXError >{
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
let result = self
.executor
.sc_call::<MultiValueEncoded<StaticApi, ManagedAddress<StaticApi>>>(
&_novax_contract_address,
"getAllProposers".to_string(),
_novax_bytes_args,
self.gas_limit,
self.egld_value.clone(),
self.token_transfers.clone(),
)
.await?;
Result::Ok(result)
}
#[doc = r" Executes the `#function_name` function on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing a `CallResult` with the `#function_native_outputs` or a `NovaXError` if the call fails."]
pub async fn get_action_data(
&mut self,
action_id: &<u32 as NativeConvertible>::Native,
) -> Result<CallResult<<ActionManaged as NativeConvertible>::Native>, NovaXError> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_argument_action_id: u32 = r#action_id.to_managed();
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_action_id.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let result = self
.executor
.sc_call::<ActionManaged>(
&_novax_contract_address,
"getActionData".to_string(),
_novax_bytes_args,
self.gas_limit,
self.egld_value.clone(),
self.token_transfers.clone(),
)
.await?;
Result::Ok(result)
}
#[doc = r" Executes the `#function_name` function on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing a `CallResult` with the `#function_native_outputs` or a `NovaXError` if the call fails."]
pub async fn get_action_signers(
&mut self,
action_id: &<u32 as NativeConvertible>::Native,
) -> Result<
CallResult<
<ManagedVec<StaticApi, ManagedAddress<StaticApi>> as NativeConvertible>::Native,
>,
NovaXError,
> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_argument_action_id: u32 = r#action_id.to_managed();
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_action_id.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let result = self
.executor
.sc_call::<ManagedVec<StaticApi, ManagedAddress<StaticApi>>>(
&_novax_contract_address,
"getActionSigners".to_string(),
_novax_bytes_args,
self.gas_limit,
self.egld_value.clone(),
self.token_transfers.clone(),
)
.await?;
Result::Ok(result)
}
#[doc = r" Executes the `#function_name` function on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing a `CallResult` with the `#function_native_outputs` or a `NovaXError` if the call fails."]
pub async fn get_action_signer_count(
&mut self,
action_id: &<u32 as NativeConvertible>::Native,
) -> Result<CallResult<<u32 as NativeConvertible>::Native>, NovaXError> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_argument_action_id: u32 = r#action_id.to_managed();
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_action_id.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let result = self
.executor
.sc_call::<u32>(
&_novax_contract_address,
"getActionSignerCount".to_string(),
_novax_bytes_args,
self.gas_limit,
self.egld_value.clone(),
self.token_transfers.clone(),
)
.await?;
Result::Ok(result)
}
#[doc = r" Executes the `#function_name` function on the smart contract."]
#[doc = r""]
#[doc = r" # Description"]
#[doc = r" #abi_description"]
#[doc = r""]
#[doc = r" # Parameters"]
#[doc = r" #function_inputs"]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `Result` containing a `CallResult` with the `#function_native_outputs` or a `NovaXError` if the call fails."]
pub async fn get_action_valid_signer_count(
&mut self,
action_id: &<u32 as NativeConvertible>::Native,
) -> Result<CallResult<<u32 as NativeConvertible>::Native>, NovaXError> {
let _novax_request_arc =
novax::utils::static_request_arc::get_static_request_arc_clone();
let _novax_contract_address = Address::from(&self.contract_address);
let _novax_contract_address_value: AddressValue = (&_novax_contract_address).into();
let mut _novax_contract =
MultisigViewContractInfos::new(&_novax_contract_address_value);
let _novax_argument_action_id: u32 = r#action_id.to_managed();
let _novax_payment = if self.egld_value > num_bigint::BigUint::from(0u8) {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(self.egld_value.clone()))
} else {
EgldOrMultiEsdtPayment::Egld(BigUint::<StaticApi>::from(0u8))
};
let mut _novax_bytes_args: std::vec::Vec<std::vec::Vec<u8>> = vec![];
{
let mut _novax_top_encoded_args =
ManagedVec::<StaticApi, ManagedBuffer<StaticApi>>::new();
_ = _novax_argument_action_id.multi_encode(&mut _novax_top_encoded_args);
for _novax_top_encoded_arg in _novax_top_encoded_args.into_iter() {
_novax_bytes_args.push(_novax_top_encoded_arg.to_boxed_bytes().into_vec());
}
}
let result = self
.executor
.sc_call::<u32>(
&_novax_contract_address,
"getActionValidSignerCount".to_string(),
_novax_bytes_args,
self.gas_limit,
self.egld_value.clone(),
self.token_transfers.clone(),
)
.await?;
Result::Ok(result)
}
}
#[allow(missing_docs)]
mod action_managed_mod {
use super::*;
#[doc = r" Represents the managed version of the enum `#native_name_ident` as defined in the ABI."]
#[doc = r""]
#[doc = r" This enum encapsulates variants that have a corresponding managed representation in the smart contract."]
#[doc = r" It's typically used internally for serialization and deserialization to and from the smart contract,"]
#[doc = r" as well as for other operations that interact directly with the smart contract's ABI."]
#[type_abi]
#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, Debug)]
pub enum ActionManaged {
Nothing,
AddBoardMember(ManagedAddress<StaticApi>),
AddProposer(ManagedAddress<StaticApi>),
RemoveUser(ManagedAddress<StaticApi>),
ChangeQuorum(u32),
SendTransferExecute(CallActionDataManaged),
SendAsyncCall(CallActionDataManaged),
SCDeployFromSource {
r#amount: BigUint<StaticApi>,
r#source: ManagedAddress<StaticApi>,
r#code_metadata: CodeMetadata,
r#arguments: ManagedVec<StaticApi, ManagedBuffer<StaticApi>>,
},
SCUpgradeFromSource {
r#sc_address: ManagedAddress<StaticApi>,
r#amount: BigUint<StaticApi>,
r#source: ManagedAddress<StaticApi>,
r#code_metadata: CodeMetadata,
r#arguments: ManagedVec<StaticApi, ManagedBuffer<StaticApi>>,
},
}
}
use action_managed_mod::*;
#[doc = r" Represents the native version of the enum `#managed_name_ident` as defined in the ABI."]
#[doc = r""]
#[doc = r" This enum encapsulates variants that have a corresponding native representation in Rust."]
#[doc = r" It's designed for more straightforward interaction in Rust code, and can be converted to and from its"]
#[doc = r" corresponding managed representation (`#managed_name_ident`) using the provided trait implementations."]
#[derive(Serialize, Deserialize, PartialEq, Hash, Clone, Debug)]
pub enum Action {
#[allow(missing_docs)]
Nothing,
#[allow(missing_docs)]
AddBoardMember(<ManagedAddress<StaticApi> as NativeConvertible>::Native),
#[allow(missing_docs)]
AddProposer(<ManagedAddress<StaticApi> as NativeConvertible>::Native),
#[allow(missing_docs)]
RemoveUser(<ManagedAddress<StaticApi> as NativeConvertible>::Native),
#[allow(missing_docs)]
ChangeQuorum(<u32 as NativeConvertible>::Native),
#[allow(missing_docs)]
SendTransferExecute(<CallActionDataManaged as NativeConvertible>::Native),
#[allow(missing_docs)]
SendAsyncCall(<CallActionDataManaged as NativeConvertible>::Native),
#[allow(missing_docs)]
SCDeployFromSource {
r#amount: <BigUint<StaticApi> as NativeConvertible>::Native,
r#source: <ManagedAddress<StaticApi> as NativeConvertible>::Native,
r#code_metadata: <CodeMetadata as NativeConvertible>::Native,
r#arguments:
<ManagedVec<StaticApi, ManagedBuffer<StaticApi>> as NativeConvertible>::Native,
},
#[allow(missing_docs)]
SCUpgradeFromSource {
r#sc_address: <ManagedAddress<StaticApi> as NativeConvertible>::Native,
r#amount: <BigUint<StaticApi> as NativeConvertible>::Native,
r#source: <ManagedAddress<StaticApi> as NativeConvertible>::Native,
r#code_metadata: <CodeMetadata as NativeConvertible>::Native,
r#arguments:
<ManagedVec<StaticApi, ManagedBuffer<StaticApi>> as NativeConvertible>::Native,
},
}
impl Action {
#[doc = r" Constructs an instance of `#native_name_ident` from ESDT token attributes."]
#[doc = r""]
#[doc = r" This function attempts to decode the provided ESDT attributes into an instance of `#native_name_ident`."]
#[doc = r" It is specifically designed to work with the attributes associated with ESDT tokens, which are typically"]
#[doc = r" encoded in a binary format."]
#[doc = r""]
#[doc = r" # Arguments"]
#[doc = r" - `attributes`: A byte slice (`&[u8]`) representing the ESDT token attributes to be decoded."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" - `Ok(#native_name_ident)`: Successfully decoded instance of `#native_name_ident`."]
#[doc = r" - `Err(NovaXError)`: An error wrapped in `NovaXError`, specifically `CodingError::CannotDecodeEsdtAttributes`,"]
#[doc = r" if the decoding process fails. This error indicates that the provided attributes could not be properly"]
#[doc = r" decoded into the expected `#native_name_ident` type."]
pub fn from_esdt_attributes(attributes: &[u8]) -> Result<Action, NovaXError> {
let Result::Ok(decoded) = ActionManaged::top_decode(attributes) else {
return Result::Err(CodingError::CannotDecodeEsdtAttributes.into());
};
Result::Ok(decoded.to_native())
}
}
impl NativeConvertible for ActionManaged {
type Native = Action;
fn to_native(&self) -> Self::Native {
match self {
ActionManaged::Nothing => Action::Nothing,
ActionManaged::AddBoardMember(field_0) => {
Action::AddBoardMember(field_0.to_native())
}
ActionManaged::AddProposer(field_0) => Action::AddProposer(field_0.to_native()),
ActionManaged::RemoveUser(field_0) => Action::RemoveUser(field_0.to_native()),
ActionManaged::ChangeQuorum(field_0) => Action::ChangeQuorum(field_0.to_native()),
ActionManaged::SendTransferExecute(field_0) => {
Action::SendTransferExecute(field_0.to_native())
}
ActionManaged::SendAsyncCall(field_0) => Action::SendAsyncCall(field_0.to_native()),
ActionManaged::SCDeployFromSource {
amount,
source,
code_metadata,
arguments,
} => Action::SCDeployFromSource {
amount: amount.to_native(),
source: source.to_native(),
code_metadata: code_metadata.to_native(),
arguments: arguments.to_native(),
},
ActionManaged::SCUpgradeFromSource {
sc_address,
amount,
source,
code_metadata,
arguments,
} => Action::SCUpgradeFromSource {
sc_address: sc_address.to_native(),
amount: amount.to_native(),
source: source.to_native(),
code_metadata: code_metadata.to_native(),
arguments: arguments.to_native(),
},
}
}
}
impl ManagedConvertible<ActionManaged> for Action {
fn to_managed(&self) -> ActionManaged {
match self {
Action::Nothing => ActionManaged::Nothing,
Action::AddBoardMember(field_0) => {
ActionManaged::AddBoardMember(field_0.to_managed())
}
Action::AddProposer(field_0) => ActionManaged::AddProposer(field_0.to_managed()),
Action::RemoveUser(field_0) => ActionManaged::RemoveUser(field_0.to_managed()),
Action::ChangeQuorum(field_0) => ActionManaged::ChangeQuorum(field_0.to_managed()),
Action::SendTransferExecute(field_0) => {
ActionManaged::SendTransferExecute(field_0.to_managed())
}
Action::SendAsyncCall(field_0) => {
ActionManaged::SendAsyncCall(field_0.to_managed())
}
Action::SCDeployFromSource {
amount,
source,
code_metadata,
arguments,
} => ActionManaged::SCDeployFromSource {
amount: amount.to_managed(),
source: source.to_managed(),
code_metadata: code_metadata.to_managed(),
arguments: arguments.to_managed(),
},
Action::SCUpgradeFromSource {
sc_address,
amount,
source,
code_metadata,
arguments,
} => ActionManaged::SCUpgradeFromSource {
sc_address: sc_address.to_managed(),
amount: amount.to_managed(),
source: source.to_managed(),
code_metadata: code_metadata.to_managed(),
arguments: arguments.to_managed(),
},
}
}
}
impl Action {
#[doc = r" This function converts an enum variant to its discriminant (u8) representation as per the"]
#[doc = r" smart contract's understanding. Each variant is mapped to a unique u8 value starting from 0,"]
#[doc = r" incrementing by 1 for each subsequent variant."]
#[doc = r""]
#[doc = r" # Errors"]
#[doc = r" Returns `NovaXError` if the conversion fails, which could occur if the enum has a variant"]
#[doc = r" that is not accounted for in the conversion logic."]
pub fn to_discriminant(&self) -> Result<u8, NovaXError> {
match self {
Action::Nothing { .. } => Result::Ok(0u8),
Action::AddBoardMember { .. } => Result::Ok(1u8),
Action::AddProposer { .. } => Result::Ok(2u8),
Action::RemoveUser { .. } => Result::Ok(3u8),
Action::ChangeQuorum { .. } => Result::Ok(4u8),
Action::SendTransferExecute { .. } => Result::Ok(5u8),
Action::SendAsyncCall { .. } => Result::Ok(6u8),
Action::SCDeployFromSource { .. } => Result::Ok(7u8),
Action::SCUpgradeFromSource { .. } => Result::Ok(8u8),
}
}
}
#[allow(missing_docs)]
mod user_role_managed_mod {
use super::*;
#[doc = r" Represents the managed version of the enum `#native_name_ident` as defined in the ABI."]
#[doc = r""]
#[doc = r" This enum encapsulates variants that have a corresponding managed representation in the smart contract."]
#[doc = r" It's typically used internally for serialization and deserialization to and from the smart contract,"]
#[doc = r" as well as for other operations that interact directly with the smart contract's ABI."]
#[type_abi]
#[derive(
TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, Debug, ManagedVecItem,
)]
pub enum UserRoleManaged {
None,
Proposer,
BoardMember,
}
}
use user_role_managed_mod::*;
#[doc = r" Represents the native version of the enum `#managed_name_ident` as defined in the ABI."]
#[doc = r""]
#[doc = r" This enum encapsulates variants that have a corresponding native representation in Rust."]
#[doc = r" It's designed for more straightforward interaction in Rust code, and can be converted to and from its"]
#[doc = r" corresponding managed representation (`#managed_name_ident`) using the provided trait implementations."]
#[derive(Serialize, Deserialize, PartialEq, Hash, Clone, Debug)]
pub enum UserRole {
#[allow(missing_docs)]
None,
#[allow(missing_docs)]
Proposer,
#[allow(missing_docs)]
BoardMember,
}
impl UserRole {
#[doc = r" Constructs an instance of `#native_name_ident` from ESDT token attributes."]
#[doc = r""]
#[doc = r" This function attempts to decode the provided ESDT attributes into an instance of `#native_name_ident`."]
#[doc = r" It is specifically designed to work with the attributes associated with ESDT tokens, which are typically"]
#[doc = r" encoded in a binary format."]
#[doc = r""]
#[doc = r" # Arguments"]
#[doc = r" - `attributes`: A byte slice (`&[u8]`) representing the ESDT token attributes to be decoded."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" - `Ok(#native_name_ident)`: Successfully decoded instance of `#native_name_ident`."]
#[doc = r" - `Err(NovaXError)`: An error wrapped in `NovaXError`, specifically `CodingError::CannotDecodeEsdtAttributes`,"]
#[doc = r" if the decoding process fails. This error indicates that the provided attributes could not be properly"]
#[doc = r" decoded into the expected `#native_name_ident` type."]
pub fn from_esdt_attributes(attributes: &[u8]) -> Result<UserRole, NovaXError> {
let Result::Ok(decoded) = UserRoleManaged::top_decode(attributes) else {
return Result::Err(CodingError::CannotDecodeEsdtAttributes.into());
};
Result::Ok(decoded.to_native())
}
}
impl NativeConvertible for UserRoleManaged {
type Native = UserRole;
fn to_native(&self) -> Self::Native {
match self {
UserRoleManaged::None => UserRole::None,
UserRoleManaged::Proposer => UserRole::Proposer,
UserRoleManaged::BoardMember => UserRole::BoardMember,
}
}
}
impl ManagedConvertible<UserRoleManaged> for UserRole {
fn to_managed(&self) -> UserRoleManaged {
match self {
UserRole::None => UserRoleManaged::None,
UserRole::Proposer => UserRoleManaged::Proposer,
UserRole::BoardMember => UserRoleManaged::BoardMember,
}
}
}
impl UserRole {
#[doc = r" This function converts an enum variant to its discriminant (u8) representation as per the"]
#[doc = r" smart contract's understanding. Each variant is mapped to a unique u8 value starting from 0,"]
#[doc = r" incrementing by 1 for each subsequent variant."]
#[doc = r""]
#[doc = r" # Errors"]
#[doc = r" Returns `NovaXError` if the conversion fails, which could occur if the enum has a variant"]
#[doc = r" that is not accounted for in the conversion logic."]
pub fn to_discriminant(&self) -> Result<u8, NovaXError> {
match self {
UserRole::None { .. } => Result::Ok(0u8),
UserRole::Proposer { .. } => Result::Ok(1u8),
UserRole::BoardMember { .. } => Result::Ok(2u8),
}
}
}
#[doc = r" Derive implementations for the structs."]
#[type_abi]
#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, Debug)]
#[doc = r" Represents the managed version of type `#native_name_ident` as defined in the ABI."]
#[doc = r""]
#[doc = r" This structure encapsulates fields that have a corresponding managed representation in the smart contract."]
#[doc = r" It's typically used internally for serialization and deserialization to and from the smart contract,"]
#[doc = r" as well as for other operations that interact directly with the smart contract's ABI."]
pub struct ActionFullInfoManaged {
#[allow(missing_docs)]
pub r#action_id: u32,
#[allow(missing_docs)]
pub r#action_data: ActionManaged,
#[allow(missing_docs)]
pub r#signers: ManagedVec<StaticApi, ManagedAddress<StaticApi>>,
}
#[doc = r" Represents the native version of type `#managed_name_ident` as defined in the ABI."]
#[doc = r""]
#[doc = r" This structure encapsulates fields that have a corresponding native representation in Rust."]
#[doc = r" It's designed for more straightforward interaction in Rust code, and can be converted to and from its"]
#[doc = r" corresponding managed representation (`#managed_name_ident`) using the provided trait implementations."]
#[derive(Serialize, Deserialize, PartialEq, Hash, Clone, Debug)]
pub struct ActionFullInfo {
#[allow(missing_docs)]
pub r#action_id: <u32 as NativeConvertible>::Native,
#[allow(missing_docs)]
pub r#action_data: <ActionManaged as NativeConvertible>::Native,
#[allow(missing_docs)]
pub r#signers:
<ManagedVec<StaticApi, ManagedAddress<StaticApi>> as NativeConvertible>::Native,
}
#[doc = r" Provides a mechanism for converting a `#managed_name_ident` to its native representation (`#native_name_ident`)."]
impl NativeConvertible for ActionFullInfoManaged {
type Native = ActionFullInfo;
#[doc = r" Converts the `#managed_name_ident` to its native representation."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `#native_name_ident` instance representing the same data as the `#managed_name_ident`."]
fn to_native(&self) -> Self::Native {
ActionFullInfo {
r#action_id: self.r#action_id.to_native(),
r#action_data: self.r#action_data.to_native(),
r#signers: self.r#signers.to_native(),
}
}
}
#[doc = r" Type alias for wrapping the managed API."]
type ActionFullInfoManagedType = ActionFullInfoManaged;
impl ActionFullInfo {
#[doc = r" Constructs an instance of `#native_name_ident` from ESDT token attributes."]
#[doc = r""]
#[doc = r" This function attempts to decode the provided ESDT attributes into an instance of `#native_name_ident`."]
#[doc = r" It is specifically designed to work with the attributes associated with ESDT tokens, which are typically"]
#[doc = r" encoded in a binary format."]
#[doc = r""]
#[doc = r" # Arguments"]
#[doc = r" - `attributes`: A byte slice (`&[u8]`) representing the ESDT token attributes to be decoded."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" - `Ok(#native_name_ident)`: Successfully decoded instance of `#native_name_ident`."]
#[doc = r" - `Err(NovaXError)`: An error wrapped in `NovaXError`, specifically `CodingError::CannotDecodeEsdtAttributes`,"]
#[doc = r" if the decoding process fails. This error indicates that the provided attributes could not be properly"]
#[doc = r" decoded into the expected `#native_name_ident` type."]
pub fn from_esdt_attributes(attributes: &[u8]) -> Result<ActionFullInfo, NovaXError> {
let Result::Ok(decoded) = ActionFullInfoManaged::top_decode(attributes) else {
return Result::Err(CodingError::CannotDecodeEsdtAttributes.into());
};
Result::Ok(decoded.to_native())
}
}
#[doc = r" Provides a mechanism for converting a `#native_name_ident` to its managed representation (`#managed_name_ident`)."]
impl ManagedConvertible<ActionFullInfoManaged> for ActionFullInfo {
#[doc = r" Converts the `#native_name_ident` to its managed representation."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `#managed_name_ident` instance representing the same data as the `#native_name_ident`."]
fn to_managed(&self) -> ActionFullInfoManaged {
ActionFullInfoManagedType {
r#action_id: self.r#action_id.to_managed(),
r#action_data: self.r#action_data.to_managed(),
r#signers: self.r#signers.to_managed(),
}
}
}
#[doc = r" Derive implementations for the structs."]
#[type_abi]
#[derive(
TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, Debug, ManagedVecItem,
)]
#[doc = r" Represents the managed version of type `#native_name_ident` as defined in the ABI."]
#[doc = r""]
#[doc = r" This structure encapsulates fields that have a corresponding managed representation in the smart contract."]
#[doc = r" It's typically used internally for serialization and deserialization to and from the smart contract,"]
#[doc = r" as well as for other operations that interact directly with the smart contract's ABI."]
pub struct CallActionDataManaged {
#[allow(missing_docs)]
pub r#to: ManagedAddress<StaticApi>,
#[allow(missing_docs)]
pub r#egld_amount: BigUint<StaticApi>,
#[allow(missing_docs)]
pub r#endpoint_name: ManagedBuffer<StaticApi>,
#[allow(missing_docs)]
pub r#arguments: ManagedVec<StaticApi, ManagedBuffer<StaticApi>>,
}
#[doc = r" Represents the native version of type `#managed_name_ident` as defined in the ABI."]
#[doc = r""]
#[doc = r" This structure encapsulates fields that have a corresponding native representation in Rust."]
#[doc = r" It's designed for more straightforward interaction in Rust code, and can be converted to and from its"]
#[doc = r" corresponding managed representation (`#managed_name_ident`) using the provided trait implementations."]
#[derive(Serialize, Deserialize, PartialEq, Hash, Clone, Debug)]
pub struct CallActionData {
#[allow(missing_docs)]
pub r#to: <ManagedAddress<StaticApi> as NativeConvertible>::Native,
#[allow(missing_docs)]
pub r#egld_amount: <BigUint<StaticApi> as NativeConvertible>::Native,
#[allow(missing_docs)]
pub r#endpoint_name: <ManagedBuffer<StaticApi> as NativeConvertible>::Native,
#[allow(missing_docs)]
pub r#arguments:
<ManagedVec<StaticApi, ManagedBuffer<StaticApi>> as NativeConvertible>::Native,
}
#[doc = r" Provides a mechanism for converting a `#managed_name_ident` to its native representation (`#native_name_ident`)."]
impl NativeConvertible for CallActionDataManaged {
type Native = CallActionData;
#[doc = r" Converts the `#managed_name_ident` to its native representation."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `#native_name_ident` instance representing the same data as the `#managed_name_ident`."]
fn to_native(&self) -> Self::Native {
CallActionData {
r#to: self.r#to.to_native(),
r#egld_amount: self.r#egld_amount.to_native(),
r#endpoint_name: self.r#endpoint_name.to_native(),
r#arguments: self.r#arguments.to_native(),
}
}
}
#[doc = r" Type alias for wrapping the managed API."]
type CallActionDataManagedType = CallActionDataManaged;
impl CallActionData {
#[doc = r" Constructs an instance of `#native_name_ident` from ESDT token attributes."]
#[doc = r""]
#[doc = r" This function attempts to decode the provided ESDT attributes into an instance of `#native_name_ident`."]
#[doc = r" It is specifically designed to work with the attributes associated with ESDT tokens, which are typically"]
#[doc = r" encoded in a binary format."]
#[doc = r""]
#[doc = r" # Arguments"]
#[doc = r" - `attributes`: A byte slice (`&[u8]`) representing the ESDT token attributes to be decoded."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" - `Ok(#native_name_ident)`: Successfully decoded instance of `#native_name_ident`."]
#[doc = r" - `Err(NovaXError)`: An error wrapped in `NovaXError`, specifically `CodingError::CannotDecodeEsdtAttributes`,"]
#[doc = r" if the decoding process fails. This error indicates that the provided attributes could not be properly"]
#[doc = r" decoded into the expected `#native_name_ident` type."]
pub fn from_esdt_attributes(attributes: &[u8]) -> Result<CallActionData, NovaXError> {
let Result::Ok(decoded) = CallActionDataManaged::top_decode(attributes) else {
return Result::Err(CodingError::CannotDecodeEsdtAttributes.into());
};
Result::Ok(decoded.to_native())
}
}
#[doc = r" Provides a mechanism for converting a `#native_name_ident` to its managed representation (`#managed_name_ident`)."]
impl ManagedConvertible<CallActionDataManaged> for CallActionData {
#[doc = r" Converts the `#native_name_ident` to its managed representation."]
#[doc = r""]
#[doc = r" # Returns"]
#[doc = r" A `#managed_name_ident` instance representing the same data as the `#native_name_ident`."]
fn to_managed(&self) -> CallActionDataManaged {
CallActionDataManagedType {
r#to: self.r#to.to_managed(),
r#egld_amount: self.r#egld_amount.to_managed(),
r#endpoint_name: self.r#endpoint_name.to_managed(),
r#arguments: self.r#arguments.to_managed(),
}
}
}
}