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 in Markdown files
- Clone repository and install dependencies
$ git clone https://github.com/singnet/snet-cli.git
$ cd snet-cli
$ pip install -r docs/requirements.txt
On Linux
- Run the build-docs.sh in the docs directory
$ cd docs
$ sh build-docs.sh
On Windows
- Install
make
utility and run the build-docs.ps1 in the docs directory
choco install make # install choco if it is not already installed
cd docs
powershell -file build-docs.ps1
The documentation is generated under the docs/build/markdown 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.
Source Distribution
Built Distribution
File details
Details for the file snet.cli-2.3.0.tar.gz
.
File metadata
- Download URL: snet.cli-2.3.0.tar.gz
- Upload date:
- Size: 222.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df71d297490435824f61d1bfdb874ad1d9bd68d207b16a9c876108c9a630b205 |
|
MD5 | 127749e7f8788e8a515efe8e79a6d09d |
|
BLAKE2b-256 | b8e0d1f8dc5fdad24a0f52493a7c3bf1b5da1516cc3e5118375443d4111467e4 |
File details
Details for the file snet.cli-2.3.0-py3-none-any.whl
.
File metadata
- Download URL: snet.cli-2.3.0-py3-none-any.whl
- Upload date:
- Size: 235.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe02c22b9302c689432613b519011b43a9807a8cf4d93d2e3fffd2991ef5311f |
|
MD5 | 17db50678876a18190c5e1a95a5bb14a |
|
BLAKE2b-256 | ef814724a4af55b21a7db2d6cf6ac8c0840e3e0a7479e7b69d1a07f0551c7f30 |