Expand description
§contract-build
A crate for building ink! smart contracts. Used by
cargo-contract.
§Usage
use contract_build::{
ManifestPath,
Verbosity,
BuildArtifacts,
BuildMode,
Features,
MetadataSpec,
Network,
OutputType,
UnstableFlags,
Target,
ImageVariant,
};
let manifest_path = ManifestPath::new("my-contract/Cargo.toml").unwrap();
let args = contract_build::ExecuteArgs {
manifest_path,
verbosity: Verbosity::Default,
build_mode: BuildMode::Release,
features: Features::default(),
network: Network::Online,
build_artifact: BuildArtifacts::All,
unstable_flags: UnstableFlags::default(),
keep_debug_symbols: false,
extra_lints: false,
output_type: OutputType::Json,
image: ImageVariant::Default,
metadata_spec: Some(MetadataSpec::Ink),
target_dir: None,
};
contract_build::execute(args);Re-exports§
pub use self::metadata::InkMetadataArtifacts as MetadataResult;pub use self::metadata::BuildInfo;pub use self::metadata::InkMetadataArtifacts;pub use self::metadata::MetadataArtifacts;pub use self::util::DEFAULT_KEY_COL_WIDTH;
Modules§
Macros§
- name_
value_ println - Pretty print name value, name right aligned with colour.
- verbose_
eprintln - Prints to stderr if
verbosity.is_verbose()istrue. Likecargo, we use stderr for verbose output.
Structs§
- Build
Result - Result of the build process.
- Crate
Metadata - Relevant metadata obtained from
Cargo.toml. - Execute
Args - Arguments to use when executing
buildorcheckcommands. - Features
- Define the standard
cargofeatures args to be passed through. - Linker
Size Result - Result of linking an ELF with PolkaVM.
- Manifest
- Create, amend and save a copy of the specified
Cargo.toml. - Manifest
Path - Path to a
Cargo.tomlfile - Profile
- Subset of cargo profile settings to configure defaults for building contracts.
- Solidity
Metadata Artifacts - Artifacts resulting from Solidity compatible metadata generation.
- Target
- Unstable
Flags - Unstable
Options - Verbosity
Flags - Workspace
- Make a copy of a contract project manifest, allow modifications to be made to it, rewrite the paths to point to the original project files, then write to a temporary directory.
Enums§
- Abi
- ABI spec for the ink! project.
- Build
Artifacts - Describes which artifacts to generate
- Build
Mode - The mode to build the contract in.
- Image
Variant - The image to be used.
- Lto
- The
link-time-optimizationsetting. - Metadata
Spec - Specification to use for contract metadata.
- Network
- Use network connection to build contracts and generate metadata or use cached dependencies only.
- OptLevel
- The
opt-levelsetting - Output
Type - The type of output to display at the end of a build.
- Panic
Strategy - The
panicsetting. - Verbosity
- Denotes if output should be printed to stdout.
Functions§
- assert_
debug_ mode_ supported - Checks whether the supplied
ink_versionalready contains the debug feature. - code_
hash - Returns the H256 hash of the code slice.
- docker_
build - Launches the docker container to execute verifiable build.
- execute
- Executes build of the smart contract which produces a PolkaVM binary that is ready for deploying.
- lint
- Run linting that involves two steps:
clippyanddylint. Both are mandatory as they’re part of the compilation process and implement security-critical features. - new_
contract_ project - Creates a new contract project from the template.
- project_
path - todo