#cosmos #information #resources #info #astroport #ecosystem #command

app cosmos-cli

A simple CLI tool to get information about resources in the Cosmos network

1 unstable release

0.1.0 May 13, 2024

#563 in Command line utilities

Download history 127/week @ 2024-05-10 16/week @ 2024-05-17

143 downloads per month

Apache-2.0

38KB
847 lines

Cosmos CLI

The Cosmos CLI is a simple command-line tool that provides useful commands to get information about various resources in the Cosmos Blockchain ecosystem.

Installation

First ensure that you have a fairly recent version of rust/cargo installed. Then, execute the following command in your shell:

$ cargo install cosmos-cli

Usage

To get information about the available commands, run:

$ cosmos_cli --help

Cosmos CLI

Usage: cosmos-cli [OPTIONS] <COMMAND>

Commands:
  info       Get information about resources in the Cosmos ecosystem
  list       List resources in the Cosmos ecosystem
  astroport  Get information about Astroport resources
  help       Print this message or the help of the given subcommand(s)

Options:
  -o, --output <OUTPUT>  Output format [default: plain] [possible values: plain, json]
  -h, --help             Print help
  -V, --version          Print version

To get the list of all chains in the Cosmos ecosystem:

$ cosmos-cli list chains

8ball
acrechain
agoric
aioz
...

To get the result formatted as JSON, use the --output parameter:

$ cosmos-cli --output json list chains

["8ball","acrechain","agoric","aioz","akash","akiro", "andromeda","andromeda1", ... ,"xpla","zetachain"]

The JSON-formatted output is very handy when combined with jq.

The output will be formatted as a table for the info command. As an example, to display information about the CosmosHub's ATOM token:

$ cosmos-cli info asset cosmoshub atom

+--------------+--------------+
| base         | uatom        |
+--------------+--------------+
| coingecko_id | cosmos       |
+--------------+--------------+
| decimals     | 0            |
+--------------+--------------+
| display      | atom         |
+--------------+----------+---+
...

There's plenty more useful commands, learn about all of them in the next section. And if you see one that's missing, please submit a PR ! :)

Available subcommands

cosmos-cli info

Get information about resources in the Cosmos ecosystem

Usage: cosmos-cli info [OPTIONS] <COMMAND>

Commands:
  chain   Get information about a specific chain in the Cosmos ecosystem
  assets  Get information about all assets of a specific chain in the Cosmos ecosystem
  asset   Get information about a specific asset of a specific chain in the Cosmos ecosystem
  path    Get information about all IBC paths in the Cosmos ecosystem

Example

$ cosmos-cli info path neutron stargaze

+----------+---------------+---------------------+
| chain_1  | chain_name    | neutron             |
|          +---------------+---------------------+
|          | client_id     | 07-tendermint-31    |
|          +---------------+---------------------+
|          | connection_id | connection-23       |
+----------+---------------+---------------------+
| chain_2  | chain_name    | stargaze            |
|          +---------------+---------------------+
|          | client_id     | 07-tendermint-283   |
|          +---------------+---------------------+
|          | connection_id | connection-211      |
+----------+----------+----+-------+-------------+
| channels | chain_1  | channel_id | channel-18  |
|          |          +------------+-------------+
|          |          | port_id    | transfer    |
|          +----------+------------+-------------+
|          | chain_2  | channel_id | channel-191 |
|          |          +------------+-------------+
|          |          | port_id    | transfer    |
|          +----------+------------+-------------+
|          | ordering | unordered                |
|          +----------+-----------+--------------+
|          | tags     | preferred | true         |
|          |          +-----------+--------------+
|          |          | status    | live         |
|          +----------+-----------+--------------+
|          | version  | ics20-1                  |
+----------+----------+--------------------------+

cosmos-cli list

List resources in the Cosmos ecosystem

Usage: cosmos-cli list [OPTIONS] <COMMAND>

Commands:
  chains  List all chains in the Cosmos ecosystem
  assets  List assets for a specific chain in the Cosmos ecosystem
  paths   List all IBC paths in the Cosmos ecosystem

Example

$ cosmos-cli list assets osmosis | wc -l
344

$ cosmos-cli list assets osmosis

OSMO
ION
USDC.axl
ETH
WBTC.axl
USDT.axl
DAI
BUSD
ATOM
CRO
BNB
MATIC
AVAX
...


cosmos-cli astroport

Get information about Astroport resources

Usage: cosmos-cli astroport [OPTIONS] <COMMAND>

Commands:
  native-tokens  List native tokens on Astroport
  pairs          List pairs on Astroport
  pair           Get information about a specific pair on Astroport
  pool           Get information about a specific pool on Astroport

Example

Getting info about the STARS/NTRN pool on Astroport:

$ cosmos-cli astroport pool ibc/A139C0E0B5E87CBA8EAEEB12B9BEE13AC7C814CFBBFA87BBCADD67E31003466C untrn
+-------------+--------+---------------------------------------------------------------------------------------------+
| assets      | amount | 4458687253                                                                                  |
|             +--------+--------------+-------+----------------------------------------------------------------------+
|             | info   | native_token | denom | ibc/A139C0E0B5E87CBA8EAEEB12B9BEE13AC7C814CFBBFA87BBCADD67E31003466C |
|             +--------+--------------+-------+----------------------------------------------------------------------+
|             | amount | 126374360                                                                                   |
|             +--------+--------------+-------+----------------------------------------------------------------------+
|             | info   | native_token | denom | untrn                                                                |
+-------------+--------+--------------+-------+----------------------------------------------------------------------+
| total_share | 749090358                                                                                            |
+-------------+------------------------------------------------------------------------------------------------------+

License

The Cosmos CLI is licensed under Apache 2.

Dependencies

~12–25MB
~385K SLoC