17 releases (9 stable)

new 4.0.0-rc.1 Dec 1, 2023
4.0.0-rc Nov 30, 2023
4.0.0-alpha Jul 27, 2023
3.2.0 Aug 22, 2023
2.0.0-beta.1 Dec 7, 2022

#1309 in Magic Beans

Download history 1890/week @ 2023-08-14 1755/week @ 2023-08-21 1652/week @ 2023-08-28 1642/week @ 2023-09-04 2456/week @ 2023-09-11 1544/week @ 2023-09-18 1712/week @ 2023-09-25 1175/week @ 2023-10-02 664/week @ 2023-10-09 1180/week @ 2023-10-16 1588/week @ 2023-10-23 1301/week @ 2023-10-30 1678/week @ 2023-11-06 1654/week @ 2023-11-13 995/week @ 2023-11-20 1299/week @ 2023-11-27

5,715 downloads per month
Used in 11 crates (6 directly)

Apache-2.0

240KB
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,
    dylint: false,
    output_type: OutputType::Json,
    skip_wasm_validation: false,
    target: Target::Wasm,
    max_memory_pages: 16,
    image: ImageVariant::Default,
};

contract_build::execute(args);

Dependencies

~15–26MB
~440K SLoC