https://github.com/Cardinal-Cryptography/drink/assets/27450471/4a45ef8a-a7ec-4a2f-84ab-0a2a36c1cb4e
We provide this simple command line tool to help you play with your local contracts in a convenient way.
Dependencies
The only requirement for running DRInk! is having Rust installed. The code was tested with version 1.70.
All other dependencies are managed by Cargo and will be installed upon running cargo build or cargo run.
Running DRInk! CLI
When you run the binary (cargo run --release) you'll see a DRink! TUI.
You can also choose to start from a specific path by supplying the --path argument like:
CLI modes
In a somewhat Vim-inspired way, the drink-cli allows you to work in two modes: the Managing mode and the Drinking mode.
Managing mode
This is the default mode, facilitating high-level interactions with the TUI itself.
At any point, you can enter it by pressing the Esc key. Once in the Managing mode:
- Press
hto see a list of available commands with their brief descriptions; - Press
qto quit the TUI; - Press
ito enter the Drinking mode.
Drinking mode
This is the mode where you can interact with your environment and type your commands inside the User input field.
When in Managing mode, you can enter the Drinking mode by pressing 'i' on your keyboard.
You have several commands at your disposal (you can list them in the Managing mode by pressing the 'h' key):
cdandclearwill, just like their Bash counterparts, change the directory and clear the output, respectively. You will see the current working directory as the first entry in theCurrent environmentpane;buildcommand will build a contract from the sources in the current directory;deploycommand will deploy a contract from the current directory. Note that if your constructor takes arguments, you will need to supply them to this command, like:deploy truein the case of the Flipper example;- by pressing
Tabyou can switch between all deployed contracts (with automatic directory change); callcommand will call a contract with the given message. Again, if the message takes arguments, they need to be supplied here;next-blockcommand will advance the current block number;add-tokenscommand will add tokens to the given account.