29 releases (17 stable)

new 5.0.0 Nov 22, 2024
4.1.3 Nov 20, 2024
4.1.1 Apr 17, 2024
4.0.2 Mar 14, 2024
2.0.0-beta.1 Dec 7, 2022

#141 in Magic Beans

Download history 710/week @ 2024-08-02 746/week @ 2024-08-09 640/week @ 2024-08-16 637/week @ 2024-08-23 538/week @ 2024-08-30 886/week @ 2024-09-06 816/week @ 2024-09-13 596/week @ 2024-09-20 681/week @ 2024-09-27 364/week @ 2024-10-04 532/week @ 2024-10-11 539/week @ 2024-10-18 636/week @ 2024-10-25 2683/week @ 2024-11-01 2010/week @ 2024-11-08 1691/week @ 2024-11-15

7,177 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
~696K SLoC