Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

declare_from_file

[source code]

Declares a contract from a Sierra contract class JSON file path - path to a Sierra contract class JSON file If the file’s class hash matches a package contract already loaded by snforge, the loaded compiled artifact is reused instead of compiling the Sierra file again. Returns the DeclareResult that encapsulated possible outcomes in the enum:

  • Success: Contains the successfully declared ContractClass.
  • AlreadyDeclared: Contains ContractClass and signals that the contract has already been declared.

Fully qualified path: snforge_std::cheatcodes::contract_class::declare_from_file

pub fn declare_from_file(path: ByteArray) -> Result<DeclareResult, Array<felt252>>