Cannon’s command-line interface (CLI) allows users to deploy, upgrade, and configure protocols using cannonfiles with the build
command, publish
the resulting packages, run
packages locally, and more. Find the code for the CLI on GitHub.
Install Foundry if you haven’t already. Then, run one of the following commands in your terminal to install (or upgrade) Cannon:
npm i -g @usecannon/cli
yarn global add @usecannon/cli
pnpm add -g @usecannon/cli
Now you can use all of the following commands your terminal with cannon <command>
. You can also use the CLI without installing it using npx: npx @usecannon/cli <command>
. If no command is specified, the CLI will execute the run
command. The Hardhat plug-in exposes some of the commands as Hardhat tasks.
run
#Utility for instantly loading cannon packages in standalone contexts
cannon run [global options] ...[<name>[:<semver>] ...[<key>=<value>]]
build
#Build a package from a Cannonfile
cannon build [options] [cannonfile] [settings...]
alter
#Change a cannon package outside of the regular build process.
cannon alter [options] <packageRef> <command> [options...]
fetch
#Fetch cannon package data from an IPFS hash and store it in the local registry.
cannon fetch [options] <packageRef> <ipfsHash>
prune
#Clean cannon storage of excessive/transient build files older than a certain age
cannon prune [options]
trace
#Get a full stack trace for a transaction hash or explicit transaction call
cannon trace [options] <packageRef> <transactionHash OR bytes32Data>
decode
#decode transaction data using the ABIs of the given Cannon package
cannon decode [options] <packageRef> <bytes32Data...>
test
#Run forge tests on a cannon deployment. To pass arguments through to `forge test`, use `--`.
cannon test [cannonfile] [-- forge options...]
interact
#Start an interactive terminal against a set of active cannon deployments
cannon interact [options] <packageRef>