Skip to main content

declare

fn declare(contract: felt252) -> Result::<felt252, felt252> nopanic;

Declares a contract given its name defined in the protostar.toml configuration file.

  • contract name of a contract as Cairo shortstring (e.g. declare('mycontract')).
info

Declare only supports Cairo 1 (new syntax) contracts. To declare old Cairo 0 contracts, use declare_cairo0.

Example
use result::ResultTrait;

#[test]
fn test_declare() {
let class_hash = declare('mycontract').unwrap();
// ...
}