SingularityNET CLI
Project description
SingularityNET CLI
Package
The package is published in PyPI at the following link:
Package | Description |
---|---|
snet.cli | Command line interface to interact with the SingularityNET platform |
License
This project is licensed under the MIT License - see the LICENSE file for details.
Getting Started
The instruction down below describes the installation of the SingularityNET CLI. Please check our full Documentation.
Prerequisites
You should have Python>=3.10 with pip installed.
Additionally, you should make sure that you have the following packages in your system:
- libudev
- libusb 1.0
If you use Ubuntu (or any Linux distribution with APT support) you could run the following:
sudo apt-get install libudev-dev libusb-1.0-0-dev
Install snet-cli using pip
$ pip3 install snet.cli
Enabling commands autocompletion
If you want to enable the autocompletion of commands, you should install the
- python-argcomplete
On ubuntu (or any Linux distribution with APT support), you could run the following
sudo apt install python3-argcomplete
After the package is installed, activate autocomplete
for all python commands (which includes snet commands as well)
sudo activate-global-python-argcomplete3
Note: Changes will not take effect until shell is restarted.
OR
only for snet commands, then you should run the following
echo 'eval "$(register-python-argcomplete3 snet)"' >> ~/.bashrc
then
source ~/.bashrc
Usage
Complete documentation is available here
Example service call via the CLI
We will use the Sepolia testnet for this example:
snet network sepolia
Create the identity:
snet identity create example_identity key
and enter your private key when asked.
OR
you can pass the private key directly:
snet identity create --private-key "a7638fd785fdb5cf13df0a1d7b5584cc20d4e8526403f0df105eedf23728f538" test key
You can also use other identity options. See documentation.
You can check your balance using the
snet account balance
Deposit 70 tokens:
snet account deposit 70
Press y to confirm.
You can check your balance again to ensure that the transaction was successfull.
Before making a call we need to open the payment channel. In this example we will use the organization with id= 26072b8b6a0e448180f8c0e702ab6d2f and group_name= default_group. We will transfer there 70 tokens for 4 weeks:
snet channel open-init 26072b8b6a0e448180f8c0e702ab6d2f default_group 70 +4weeks
And now we can call the "Exampleservice" service:
snet client call 26072b8b6a0e448180f8c0e702ab6d2f Exampleservice default_group add '{"a":10,"b":32}'
Press 'Y' to confirm and get service`s response:
value: 42
Development
Installation
Prerequisites
Backward compatibility for other Python versions is not guaranteed.
- Clone the git repository
$ git clone https://github.com/singnet/snet-cli.git
$ cd snet-cli/packages/snet_cli
- Install the package in development/editable mode
$ pip3 install -e .
Building the Documentation
- Install sphinx, sphinx-argparse and the rtd theme
$ pip install sphinx
$ pip install sphinx-argparse
$ pip install sphinx-rtd-theme
- Run the build-docs.sh in the docs directory
$ cd docs
$ sh build-docs.sh
The documentation is generated under the docs/build/html folder
Release
This project is published to PyPI.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.