Skip to main content

Basics

An overview of Archway developer CLI commands, options and usage.

Archway Developer CLI#

Usage#

archway [command] [options]

Options#

-v, --version       output the current version-h, --help          display help for command

Overview#

accounts [options]               List available wallets or add new walletbuild                            Build current projectconfigure [options]              Print or modify environment settingsdeploy [options]                 Deploy to network, or test deployabilityfaucet                           Request Testnet funds from faucethistory                          Print deployments historymetadata [options]               Set the contract metadatanetwork                          Show network settings or migrate between networksnew                              Create a new project for Archway networkquery [options] <module> [type]  Query for data on Archway networkrun [options]                    Run a custom script of your own creationtest                             Run unit teststx [options]                     Execute a transaction on Archway networkhelp [command]                   display help for command

Commands#

Accounts#

Lists available wallets in your keyring, or add new wallets to your keyring.

archway accounts [options]
OptionExampleDescription
-a, --add [string]archway accounts -a "main"Adds a new account with a specified keyring label
-k, --dockerarchway accounts -kUse the docker version of archwayd
-h, --helparchway accounts -hDisplay help for accounts command

Build#

The build command is just a wrapper around cargo build. Its default behavior can be modified by editing config.json at the root of your project.

archway build [options]
OptionExampleDescription
-h, --helparchway build -hDisplay help for build command
info

Note: When modifying build behavior from config.json, don't try to export variables like RUST_BACKTRACE=1, they won't be instanced correctly. To export variables you can create a shell script and set your config.json to execute it. E.g. echo "RUST_BACKTRACE=1 && cargo build" > build.sh, then in config.json change "build": "cargo build", to "build": "bash ./build.sh",

Configure#

Prints or modifies your environment settings stored in config.json. Currently, a convenience function with limited functionality. While it doesn't support modifying nested values of the JSON easily, we'll be improving this later.

archway configure [options]
OptionExampleDescription
-m, --modify [string]archway configure -m "version"Modify a particular setting in config.json; command will fail if json key does not exist.
-h, --helparchway configure -hDisplay help for configure command
note

For detailed configuration changes, opening and modifying config.json with a text editor is preferable.

Deploy#

Deploys your contracts to a target network. It can be used in --dry-run mode to test if your Rust code will build to WebAssembly (wasm).

Running deploy with --dry-run enabled is equivalent to the Cargo native command cargo wasm.

Without --dry-run enabled, deploy progresses through a series of tasks, the order of which is:

  1. MAKE WASM
  2. CREATE ON CHAIN WASM
  3. VERIFY UPLOAD INTEGRITY
  4. INSTANTIATE CONTRACT
  5. STORE DEPLOYMENT LOG
tip

Note: The flags and options below allow you to surpress prompts, skip steps or resume a deployment. This can be helpful in the case of failing deployments.

archway deploy [options]
OptionExampleDescription
-a, --args [string]archway deploy -a '{}'JSON encoded constructor arguments for contract deployment
-l, --label [string]archway deploy -l "Archway dApp v1.0.0"Label to be used for this instantiation of the contract
--default-labelarchway deploy --default-labelUse the default label for instantiating the contract. Defaults to: "<project_name> <project_version>"
-f, --from [string]archway deploy -f "main"Name or address of account used to sign transactions
--admin-address [string]archway deploy --admin-address "archway1f395p0gg67mmfd5zcqvpnp9cxnu0hg6r9hfczq"Address which can perform admin actions on the contract
--no-buildarchway deploy --no-buildDo not build the project before deploying; it will fail if the wasm file is not built
--no-verifyarchway deploy --no-verifyDo not verify the wasm file uploaded on-chain matches your local version
--no-confirmarchway deploy --no-confirmSkip tx broadcasting prompt confirmation
-d, --dry-runarchway deploy -dTest deployability by building cargo wasm release binary
-k, --dockerarchway deploy -kUse the docker version of archwayd
-h, --helparchway deploy -hDisplay help for deploy command

Faucet#

Request Testnet funds from faucet

archway faucet [address] [options]
caution

The archway faucet command is retired as of v1.1.0.

To request funds from the faucet you should use our Discord channel.

  1. Join our Discord server at https://discord.gg/dnYYcKPAX5
  2. Send the following message in the 🚰|faucet channel

!faucet <address>

History#

Convenience command to print transaction history of your project's code uploads, instantiations and metadata. Same as you get by opening config.json and looking at the deployments array of the developer object.

archway history [options]
OptionExampleDescription
-h, --helparchway history -hDisplay help for history command

Metadata#

Sets the contract metadata with Archway parameters such as developer premiums and configurations for gas pooling.

archway metadata [options]
OptionExampleDescription
-c, --contract [string]archway metadata -c archway1aacn8927thr0cuw9jdw2wvswhlyfm4z05e6uhtr2hqx6wkgq5enszqhhvxOptional contract address override; defaults to last deployed
-f, --from [string]archway metadata --from "main"Name or address of account to sign transactions
--developer-address [string]archway metadata --developer-address "archway1f395p0gg67mmfd5zcqvpnp9cxnu0hg6r9hfczq"Developer address which can change metadata later on
--reward-address [string]archway metadata --reward-address "archway1f395p0gg67mmfd5zcqvpnp9cxnu0hg6r9hfczq"Reward address in which rewards will be deposited
--collect-premiumarchway metadata --collect-premiumIndicates the contract will use a premium for gas rewards
--premium-percentage [string]archway metadata --collect-premium --premium-percentage 10Integer percentage of premium in a range between 0 and 200
--gas-rebatearchway metadata --gas-rebateIndicates contract rewards should be used for gas rebates to the user
--no-confirmarchway metadata --no-confirmDo not prompt for confirmation when broadcasting tx
--dry-runarchway metadata --dry-runPerform a simulation of a transaction without broadcasting it (default: false)
--flags [string]archway metadata --flags "--amount 1"Send additional flags to archwayd
-k, --dockerarchway metadata -kUse the docker version of archwayd
-h, --helparchway metadata -hDisplay help for metadata command

Network#

Print current network settings or migrate between networks

archway network [options]
OptionExampleDescription
-m, --migratearchway network -mMigrates the project to another network
-e, --environment [string]archway network -m -e "testnet"Environment to use for the project (choices: "testnet")
-t, --testnet [string]archway network -m -t "constantine"Testnet to use for the project (choices: "constantine", "titus", "augusta", "torii")
-h, --helparchway network -hDisplay help for network command

New#

Create a new project for Archway network. Projects can be created as blank slates or from starter code templates.

archway new [name?] [options]
ArgumentExampleDescription
[name]archway new "project-name"Project name
OptionExampleDescription
-k, --dockerarchway new -kUse the docker version of archwayd (default: true)
--no-dockerarchway new --no-dockerUse the binary version of archwayd
-e, --environment [string]archway new -e "testnet"Environment to use for the project (choices: "testnet")
-t, --testnet [string]archway new -t "constantine"Testnet to use for the project (choices: "constantine", "titus", "augusta", "torii")
--template [string]archway new --template "increment"Project template to use
--no-templatearchway new --no-templateDo not prompt for a project template
--no-buildarchway new --no-buildDo not build the project after setup
-h, --helparchway new -hDisplay help for new command

Query#

Query for data on Archway network

archway query <module> [type] [options]
ArgumentExampleDescription
[module]archway query contract-state smartQuery module to use. Available query modules: code, contract, contract-history, contract-state, list-code, list-contract-by-code
[type]archway query contract-state smartSubcommands (if required by query module); available types: smart, code_id, all, raw
OptionExampleDescription
*-a, --args [string]archway query contract-state smart --args '{"entrypoint_name": {}}'JSON encoded arguments for query. Calls a contract's query entrypoint.
-k, --dockerarchway query contract-state smart -kUse the docker version of archwayd
-f, --flags [string]archway query contract-state smart --args '{"entrypoint_name": {}}' -f '--height 361880'Send additional flags to archwayd by wrapping in a string; e.g. "--height 492520 --limit 10"
-h, --helparchway query -hDisplay help for query command

* = required option

Run#

Run a custom script of your own creation. Script definitions must be added to the developer.scripts object of config.json.

archway run [options]
OptionExampleDescription
*-s, --script [key]archway run -s buildName of script to be run as defined in config.json
-k, --dockerarchway run -s scriptname -kUse the docker version of archwayd
-h, --helparchway run -hDisplay help for run command

* = required option

Test#

Runs your unit tests. Unless you modified your scripts in config.json, this command is equivalent to running cargo unit-test

archway test [options]
OptionExampleDescription
-h, --helparchway test -hDisplay help for test command

Tx#

Execute a transaction on Archway network

archway tx [options]
OptionExampleDescription
-c, --contract [address]archway tx -a '{"entrypoint_name":{}}' -c 'archway1gkwezqxcpyjayxvvxfnqajqvmw98w2hessy3lr'Optional contract address override; defaults to last deployed
-f, --from [string]archway tx -f "main"Name or address of account used to sign transactions
-a, --args [string]archway tx -a '{"entrypoint_name":{}}'JSON encoded arguments to execute in transaction; defaults to "{}"
--no-confirmarchway tx --no-confrimSkip tx broadcasting prompt confirmation
--dry-runarchway tx --dry-runPerform a simulation of a transaction without broadcasting it (default: false)
-f, --flags [string]archway tx -f "--amount 1000uarch"Send additional flags to archwayd by wrapping in a string; e.g. "--dry-run --amount 1000uarch"
-k, --dockerarchway tx -kUse the docker version of archwayd
-h, --helparchway tx -hDisplay help for tx command