declare
#[derive(Drop, Serde, Clone)]
pub enum DeclareResult {
Success: ContractClass,
AlreadyDeclared: ContractClass,
}
pub trait DeclareResultTrait {
/// Gets inner `ContractClass`
/// `self` - an instance of the struct `DeclareResult` which is obtained by calling `declare`
// Returns the `@ContractClass`
fn contract_class(self: @DeclareResult) -> @ContractClass;
}
fn declare(contract: ByteArray) -> Result<DeclareResult, Array<felt252>>
Declares a contract for later deployment.
The contract argument accepts either a contract name (e.g. MyContract),
an absolute module tree path (e.g. my_package::module::MyContract) or
a partial module tree path (e.g. module::MyContract).
Use the full module path to disambiguate when multiple contracts share the same name.
Returns the DeclareResult that encapsulated possible outcomes in the enum:
Success: Contains the successfully declaredContractClass.AlreadyDeclared: ContainsContractClassand signals that the contract has already been declared.
See docs of ContractClass for more info about the resulting struct.