30 releases (18 stable)

new 5.0.1 Nov 28, 2024
5.0.0-alpha Sep 9, 2024
4.1.3 Nov 20, 2024
4.1.1 Apr 17, 2024
2.0.0-beta.1 Dec 7, 2022

#422 in Magic Beans

Download history 800/week @ 2024-08-08 699/week @ 2024-08-15 601/week @ 2024-08-22 579/week @ 2024-08-29 702/week @ 2024-09-05 937/week @ 2024-09-12 584/week @ 2024-09-19 765/week @ 2024-09-26 369/week @ 2024-10-03 461/week @ 2024-10-10 505/week @ 2024-10-17 522/week @ 2024-10-24 2337/week @ 2024-10-31 2135/week @ 2024-11-07 1938/week @ 2024-11-14 1409/week @ 2024-11-21

7,945 downloads per month
Used in 20 crates (9 directly)

Apache-2.0

250KB
5.5K SLoC

contract-build

A crate for building ink! smart contracts. Used by cargo-contract.

Usage

use contract_build::{
    ManifestPath,
    Verbosity,
    BuildArtifacts,
    BuildMode,
    Features,
    Network,
    OptimizationPasses,
    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(),
    optimization_passes: Some(OptimizationPasses::default()),
    keep_debug_symbols: false,
    extra_lints: false,
    output_type: OutputType::Json,
    skip_wasm_validation: false,
    target: Target::Wasm,
    max_memory_pages: 16,
    image: ImageVariant::Default,
};

contract_build::execute(args);

Dependencies

~27–42MB
~699K SLoC