Home

Awesome

cw-optimizoor

alt text

Build Status Latest version Documentation License

A blazingly fast alternative to CosmWasm/rust-optimizer for compiling & optimizing CW smart contracts.

It's primarily meant to speed up local development and testing.

Features:

Installation

# Pre-requisites
$ rustup install 1.69.0
$ rustup target add wasm32-unknown-unknown

$ cargo install cw-optimizoor

You might also need any of the following:

Linux

# Ubuntu
$ sudo apt install -y cmake pkg-config libssl-dev clang

# Fedora
$ sudo dnf install -y cmake openssl-devel clang

macOS

$ xcode-select --install # clang
$ brew install cmake pkg-config

Windows

Usage

$ cargo cw-optimizoor -h

Usage: cargo cw-optimizoor [OPTIONS] [WORKSPACE_PATH]

Arguments:
  [WORKSPACE_PATH]  Path to the workspace dir or Cargo.toml

Options:
  -f, --features <FEATURES>  Space or comma separated list of features to activate
      --all-features         Activate all available features
      --no-default-features  Do not activate the `default` feature
  -h, --help                 Print help information
  -V, --version              Print version information

Example

$ cargo cw-optimizoor              # defaults to the current dir
# cargo cw-optimizoor Cargo.toml   # or this for pointing directly at a Cargo manifest
# cargo cw-optimizoor .            # or this for the current dir

🧐️  Compiling .../monorepo/Cargo.toml
    Finished release [optimized] target(s) in 0.10s
    
🤓  Intermediate checksums:
    ...326a37596ef54377869d8f7caa37cec393333b9808c9ecc75ddadf1357193a50  contract_1.wasm
    ...170190ce817c36aa093263f4689abaffafe363909aea13e48b80c43a39a7cde9  contract_2.wasm
    ...6a718777f28b2e213e3f18f60ffbf62febe563072e8a89b0cfa5359b3e0bed1b  contract_3.wasm
    ...9f9dae24e8a388730b40de3092117cf84476dacfb6ed0112bec53b1b21127333  contract_4.wasm
    ...9255c18758fd0b27de38c8aacd2030167b9d3c1575374d811f89742be8af4f8b  contract_5.wasm
    
🥸  Ahh I'm optimiziing
    ...✅ contract_1 was optimized.
    ...⏭️ contract_2 is unchanged. Skipping.
    ...✅ contract_3 was optimized.
    ...⏭️ contract_4 is unchanged. Skipping.
    ...✅ contract_5 was optimized.
    
🤓  Final checksums:
    ...e11db2d5b9ff3e14deee2a04ee40be0d1f8da96c4a45bc55348ea74ff4a4d4ae  contract_1-aarch64.wasm
    ...0565368394fd2fa1409909f63fe11d09f37a1f777f26bc5ddb65d17c2fc82bb9  contract_2-aarch64.wasm
    ...1364e024dab8cc057d090d8686042d8ab5e41e810b16d464be71a24aedc79ad3  contract_3-aarch64.wasm
    ...4f553da8e620137c194eddfddcaa7baa29239ec723d0b1b2b49d11fe625986e5  contract_4-aarch64.wasm
    ...61ea8988f4275c15785d7496c453a37ae4c3b021d4521120fc5c0d532287f864  contract_5-aarch64.wasm
    
🫡  Done. Saved optimized artifacts to:
   .../monorepo/artifacts