Command line interface โ
WARNING
The information on this page is outdated. It will not work in conjunction with the new syntax. Please use the new Docker-based installation method described here.
The command line interface, SmartPy CLI, also known as smartpy-cli, has been introduced in the following outdated Medium Post.
Installation โ
The SmartPy CLI can be installed in two ways: the direct installation or through a project.
Direct Installation โ
To install the current CLI:
bash <(curl -s <[email protected]: ../../site_url-->cli/install.sh)
Project Management โ
See Getting Started/Project Management.
Check version โ
This command tells which CLI version is installed.
~/smartpy-cli/SmartPy.sh --version
Dependencies โ
The SmartPy CLI depends on python3 and Node.js.
It also depends on
- pdoc for Python template documentation.
Execution โ
Executing a SmartPy Script with its tests โ
SmartPy.shย test
โ
Perform tests defined in a script
(see Tests and Scenarios).
~/smartpy-cli/SmartPy.sh test <script> <output-directory>
This includes many outputs: types, generated michelson code, pretty-printed scenario, etc.
Compiling Contracts and Expressions โ
SmartPy.shย compile
โ
Compute the Compilation Targets defined in a script
.
# For a SmartPy script:
~/smartpy-cli/SmartPy.sh compile <script> <output-directory>
Example:
# For a SmartPy script:
~/smartpy-cli/SmartPy.sh compile welcome.py /tmp/welcome
Custom Targets โ
SmartPy.shย kindย <kind>ย <script>ย <output-directory>
โ
Similar to tests. Perform scenarios defined in a script
introduced by the custom target.
# For a SmartPy script:
~/smartpy-cli/SmartPy.sh kind <kind> <script> <output-directory>
Documentation โ
SmartPy.shย docย <script>ย <output-directory>
โ
Document Python code with pdoc
.
Deploying a contract โ
# Using Micheline format (.tz)
~/smartpy-cli/SmartPy.sh originate-contract --code code.tz --storage storage.tz --rpc https://ghostnet.smartpy.io
# Using Michelson format (.json)
~/smartpy-cli/SmartPy.sh originate-contract --code code.json --storage storage.json --rpc https://ghostnet.smartpy.io
# By default, the originator will use a faucet account.
# But you can provide your own private key as an argument
~/smartpy-cli/SmartPy.sh originate-contract --code code.json --storage storage.json --rpc https://ghostnet.smartpy.io --private-key edsk...
CLI optional arguments โ
SmartPy.sh
takes several optional arguments.
See Flag for list of flags and protocols.
Argument | Description |
---|---|
--purge | Empty the output directory before writing to it. |
--html | Adds .html outputs such as a log.html which is identical to the output panel in the Web IDE. |
--<flag> arguments | Set some flag with arguments. |
--<flag> | Activate some boolean flag. |
--no-<flag> | Deactivate some boolean flag. |
--mockup | Run in mockup (experimental, needs installed source). |
--sandbox | Run in sandbox (experimental, needs installed source). |