partisia-contract
To install the tool, go the folder this tool resides in and run the command
bash
cargo install --path .
This will compile the command and install it in your Cargo bin directory.
Compiles Smart Contracts for the Partisia Blockchain to WASM- and ABI-files for deployment on-chain.
``` text
Usage: cargo partisia-contract
Commands:
build
Compile contracts to WASM and generate ABI files.
init
Initialize the contract. Retrieves dependencies for build.
new
Create a new smart contract project.
print-version
Print the client and binder version of the contract.
path-of-wasm
Print the expected WASM file path based on the context of Cargo.toml
path-of-abi
Print the expected ABI file path based on the context of Cargo.toml
set-sdk
Update the sdk used for compiling the contracts.
abi
Fetch and run the abi-client.jar with the given trailing var arguments.
help
Print this message or the help of the given subcommand(s)
Options: -h, --help Print help (see a summary with '-h')
-V, --version Print version
```
build
Compile the contract to WASM and generate an ABI file.
``` text Usage: cargo partisia-contract build [OPTIONS] [ADDITIONAL_ARGS]...
Arguments: [ADDITIONAL_ARGS]... Additional arguments that will be passed along to cargo build, see cargo build --help for details.
Options:
-r, --release Build artifacts in release mode, with optimizations
-n, --no-abi Skip generating .abi file
-q, --quiet No messages printed to stdout
-w, --no-wasm-strip Do not remove custom sections from the WASM-file (will produce a much larger file).
-z, --no-zk Only compile the public part of the contract. Skips compilation of ZK computation.
--zkcompiler
```
new
Create a new smart contract project.
``` text
Usage: cargo partisia-contract new [OPTIONS]
Arguments:
Options:
-n, --name
```
init
Initialize the contract. Retrieves dependencies for build.
``` text Usage: cargo partisia-contract init [OPTIONS]
Options:
--workspace Init all zk contracts in the workspace
--manifest-path
```
path-of-abi
Print the expected ABI file path based on the context of Cargo.toml
``` text Usage: cargo partisia-contract path-of-abi [OPTIONS]
Options:
-r, --release File is in release folder instead of debug
--manifest-path
```
path-of-wasm
Print the expected WASM file path based on the context of Cargo.toml
``` text Usage: cargo partisia-contract path-of-wasm [OPTIONS]
Options:
-r, --release File is in release folder instead of debug
--manifest-path
```
print-version
Print the client and binder version of the contract.
``` text
Usage: cargo partisia-contract print-version [OPTIONS]
Arguments:
Options: -b, --bashlike Print the version as bash variables -h, --help Print help
```
set-sdk
Update the sdk used for compiling the contracts.
``` text
Usage: cargo partisia-contract set-sdk [OPTIONS]
Arguments:
Options:
--workspace Set the sdk for all packages in the workspace
--manifest-path
```
abi
Inspect or generate code from an ABI-file.
``` text Usage: cargo partisia-contract abi [OPTIONS] [ADDITIONAL_ARGS]...
Arguments: [ADDITIONAL_ARGS]... Additional arguments that will be passed along to abi-client.jar
Options:
-q, --quiet No messages printed to stdout
-u, --use
```
Go into the rust project containing your Cargo.toml and the contract.
An example for a contract written in rust can be found here.
When you are standing in the directory, run the following command to compile the contract and generate the ABI.
bash
cargo partisia-contract build
This will build and write the contract and ABI files in the target/wasm32-unknown-unknown/debug
.
If you run it with the flag --release
, then the files will be in target/wasm32-unknown-unknown/release
.