25 releases (14 stable)

4.1.1 Apr 17, 2024
4.0.2 Mar 14, 2024
4.0.0-rc.1 Dec 1, 2023
4.0.0-rc Nov 30, 2023
2.0.0-beta.1 Dec 7, 2022

#1317 in Magic Beans

Download history 947/week @ 2024-02-07 988/week @ 2024-02-14 1052/week @ 2024-02-21 1385/week @ 2024-02-28 1681/week @ 2024-03-06 2852/week @ 2024-03-13 1230/week @ 2024-03-20 793/week @ 2024-03-27 1350/week @ 2024-04-03 2491/week @ 2024-04-10 1963/week @ 2024-04-17 1898/week @ 2024-04-24 989/week @ 2024-05-01 1456/week @ 2024-05-08 1382/week @ 2024-05-15 616/week @ 2024-05-22

4,681 downloads per month
Used in 19 crates (8 directly)

Apache-2.0

245KB
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

~26–40MB
~693K SLoC