26 releases (14 stable)

new 5.0.0-alpha Sep 9, 2024
4.1.1 Apr 17, 2024
4.0.2 Mar 14, 2024
4.0.0-rc.1 Dec 1, 2023
2.0.0-beta.1 Dec 7, 2022

#23 in Magic Beans

Download history 723/week @ 2024-05-22 1635/week @ 2024-05-29 623/week @ 2024-06-05 639/week @ 2024-06-12 908/week @ 2024-06-19 930/week @ 2024-06-26 602/week @ 2024-07-03 767/week @ 2024-07-10 838/week @ 2024-07-17 1191/week @ 2024-07-24 554/week @ 2024-07-31 866/week @ 2024-08-07 707/week @ 2024-08-14 534/week @ 2024-08-21 603/week @ 2024-08-28 529/week @ 2024-09-04

2,486 downloads per month
Used in 21 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–41MB
~716K SLoC