Crates.io | cargo-dimension |
lib.rs | cargo-dimension |
version | 1.0.0 |
source | src |
created_at | 2022-07-01 09:28:44.926497 |
updated_at | 2022-07-01 09:28:44.926497 |
description | A command line tool for creating a Wasm smart contract and tests for use on the Dimension network. |
homepage | https://dimensionchain.org |
repository | https://github.com/dimension-labs/cargo-dimension |
max_upload_size | |
id | 617027 |
size | 60,206 |
cargo-dimension
A command line tool for creating a Wasm smart contract and tests for use on the Dimension network.
cargo dimension
is a Cargo subcommand which can be installed via cargo install
:
cargo install cargo-dimension
To install from the latest main
branch:
git clone https://github.com/dimension-labs/cargo-dimension
cargo install cargo-dimension --path=cargo-dimension
To create a folder "my_project" containing a basic example contract and a separate test crate for the contract:
cargo dimension my_project
This creates the following files:
my_project/
├── contract
│ ├── .cargo
│ │ └── config.toml
│ ├── Cargo.toml
│ └── src
│ └── main.rs
├── Makefile
├── rust-toolchain
├── tests
│ ├── Cargo.toml
│ └── src
│ └── integration_tests.rs
└── .travis.yml
To build the contract, the correct version of Rust must be installed along with the Wasm target:
cd my_project
make prepare
The contract can now be built using:
make build-contract
and will be built to my_project/contract/target/wasm32-unknown-unknown/release/contract.wasm
.
Running the test will automatically build the contract in release mode, copy it to the "tests/wasm" folder, then build and run the test:
make test
Licensed under the Apache License Version 2.0.