cudos-cli v0.8.1
CUDOS CLI (command line interface)
CUDOS CLI is a Node.js framework for working with the CUDOS blockchain. Using it you can scaffold, compile, test (both unit & integration) your smart contracts.
Utilizing cudos.js it offers the possibility to deploy and interact with them on a specified network ( local, test or public).
By using this tool you can also spin up a local cudos node and interact with it.
Overview
Click on a command for more information and examples.
| Command | Description |
|---|---|
cudos init | Initializes a sample project |
cudos compile | Compiles all the smart contracts in the project in alphabetical order |
cudos unittest | Runs the unit tests for the smart contracts |
cudos test | Runs the integration tests for the smart contracts |
cudos node | Base command for interacting with a local node. Subcommands: 'start', 'stop', 'status', 'keys'. |
cudos run | Runs a custom javascript file - for deployment and interaction |
cudos keys | Base comand for maneging keystore/accounts. Subcommands: 'add', 'rm', 'fund', 'ls'. |
Installation
Make sure you have a current version of
npmandNodeJSinstalled.
Mac and Linux
- Install
npmandnode. - Clone the repo & and cd to the cloned directory
- Install
cudos-cliglobally by running both:
npm installnpm install -gWindows
For Windows users, we recommend using Windows Subsystem for Linux (
WSL).
- Install
WSL[click here] - Install
npm[click here] - Install
Node.js[ click here ] - Change
npmdefault directory [ click here ]- This is to avoid any permission issues with
WSL
- This is to avoid any permission issues with
- Open
WSL, clone the repo and cd to its directory - Run both:
npm installnpm install -gBuild Docker image
- necessary step before we make production ready public cudos repo
docker build -t cudos/node -f cudos-node.Dockerfile .
Network selection
todo
Full commands info
cudos init
Scaffolds a sample project that is ready to work with the CUDOS blockchain. Contains smart contracts and scripts to deploy and interact with them. Optionally you specify the directory of the project. If not specified - gets created in the current working directory.
- arguments:
none - options:
-dir (--d)stringSpecify a path to installnot required
Example:
cudos initcudos init --d /Your/Location/Herecudos compile
Compiles all the smart contracts in alphabetical order. Please note that you have to call
cudo compilefrom the root of your project and the contracts have to be in a folder named '/contracts' again in the root of the project or else the tool will not find them. The contracts are compiled as Rust workspace - this means that if you want to add more folders for compile (ie dependent packages in a separate /packages folder ) all you have to do is go in the base Cargo.toml file ( located at project root) and add your folder under[members]The compilation is done using rust-optimizer and the artefacts (projectRoot/artefacts folder) are optimized for deployment.
- arguments:
none - options:
none
Example:
cudos compilecudos unittest
Runs the unit tests of the smart contracts. In order for the command to find the tests - please call it from the root of your project or wherever you main Cargo.toml file is located.
- arguments:
none - options:
none
Example:
cudos unittestcudos test
Currently its not working correctly, only for demo purpose !
Runs the integration tests of the smart contracts - by default located in the
integration_testfolder In order for the command to find the tests - please call it from the root of your project.
- arguments:
none - options:
none
Example:
cudos testcudos node
Base command for interaction with a local node (
cudos node) Runcudo node --helpfor info
cudos node start
Starts a local CUDOS node
- arguments:
none - options:
--daemon--druns the node as a daemon and leaves the current console window free and usablenot required
Example:
cudos node start
cudos node start --dcudos node stop
Stops a local CUDOS node
Example:
cudos node stopcudos node status
Gives a status of a local CUDOS node - online/offline
Example:
cudos node stopcudos node keys
List keys of a local CUDOS node
Example:
cudos node keyscudos run
Runs a custom javascript file. Currently in the /scripts directory there are two files: deploy.js and interact.js In the future it should be possibly to supply relevant info by the command line (smart contract name, user adress, etc) as option
- arguments:
scriptFilePathstringThe script file to execute options:
none
How to deploy different smart contracts?
For each of your smart contracts create a separate deploy file ( for example deploy_alpha.js and deploy_beta.js) and run it one by one. Do not forget to edit the contract name in the .js file ( line 4 in the supplied deploy.js file)
Example:
cudos run scripts/deploy.js
cudos run scripts/interact.js
cudos run scripts/yourScriptFile.jscudos keys
Manages keystore/accounts
Subcommands:
cudos keys add accountName
Add account to the keystore
- arguments:
accountNamestring- options:
none
Example:
cudos keys add accountNamecudos keys rm accountName
Removes account from keystore
- arguments:
accountNamestring- options:
--yes, -yNo confirmation when deleting a user
Example:
cudos keys rm accountNamecudos keys ls
List all accounts in the keystore
- arguments:
None- options:
None
Example:
cudos keys lscudos keys fund accountName
Fund account with tokens
- arguments:
accountNamestring- options:
--address, -astringThe address of the accountnot required if accountName is supplied - only if we want to fund account which is not in the keystore--tokens, -tstringThe amount of tokens to giverequired
Example:
cudos keys fund accountName --token=10000000ucudos
cudos keys fund --address=yourCosmosAddress --token=10000000ucudosOptions
| Option | Description | |
|---|---|---|
--help | Show help boolean | |
--version | Show version number boolean |
4 years ago