CLI
znap-cli
is a command line tool designed to simplify and speed up the creation of Solana Actions on different operating systems. You can run znap help
to display a help table that contains a description of all the available commands in the Znap CLI. This table will help you quickly understand how to use each command and what functions they offer.
znap-cli
Usage: znap <COMMAND>
Commands:
build Build a collection from the workspace
serve Serves all collections from the workspace
test Runs the test suite for the workspace
deploy Deploys a workspace using shuttle
clean Cleans all the temp files
init Initializes a new workspace
new Create a new collection in the workspace
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
Build
znap build <NAME>
This command compiles the collections in your workspace and generates their compiled version in the .znap
folder. Compiling is an essential step that transforms your source code into an executable format, ensuring that all dependencies and configurations are correctly integrated.
Serve
znap serve [OPTIONS] <NAME>
This command starts and runs the collections so that they can begin to be consumed. When you execute this command, Znap will start a server that allows other services or applications to access the newly created collections, facilitating their integration and usage.
Options
Options:
-a, --address <ADDRESS> Address that will be used for the server once running
-p, --port <PORT> Port that wuill be used for the server once running
--protocol <PROTOCOL> Protocol that wuill be used for the server once running
Test
znap test
With this command, you compile your collections and run the end-to-end (e2e) tests you have written in the /tests/e2e
folder. This process is crucial for ensuring that your code works as expected and that all parts of your application interact correctly.
Deploy
znap deploy <NAME> <PROJECT>
This command compiles and deploys your collections to your projects in Shuttle so that they can be consumed by anyone. Deployment is the final step in the development process, where your application becomes available to the public or other developers.
Clean
znap clean
When you run this command, it removes all temporary files from your workspace, including the .znap
folder’s files. This is useful for keeping your development environment clean and organized by eliminating unnecessary files that may accumulate during the development process.
Init
znap init [OPTIONS] <NAME>
This command initializes a new Znap workspace to start creating your Solana Actions. It should be the first command you run if you want to start a new Znap project. This process sets up the basic structure and necessary configuration for your new project.
Options
Options:
-d, --dry-run Skip writing the files
-h, --help Print help
New
znap new [OPTIONS] <NAME>
Use this command to create a new collection in your Znap workspace. A collection is a separate workspace in Rust that has its own configuration and installed dependencies. This allows you to develop and manage different projects independently, ensuring that each collection works correctly without interfering with one another.
Options
Options:
-d, --dry-run Skip writing the files
-h, --help Print help