Metadata-Version: 2.4
Name: python-etherscan-cli
Version: 0.1.0
Author-email: Hanzhichao <superhin@126.com>
License: MIT
Project-URL: Homepage, https://github.com/hanzhichao/etherscan-cli
Project-URL: Issues, https://github.com/hanzhichao/etherscan-cli/issues
Keywords: etherscan_cli
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1.8
Requires-Dist: etherscan-api-v2>=0.3
Requires-Dist: python-dotenv>=1.2.1
Requires-Dist: rich>=15.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Dynamic: license-file

# etherscan-cli

![Languate - Python](https://img.shields.io/badge/language-python-blue.svg)
![PyPI - License](https://img.shields.io/pypi/l/python-etherscan-cli)
![PyPI](https://img.shields.io/pypi/v/python-etherscan-cli)
![PyPI - Downloads](https://img.shields.io/pypi/dm/python-etherscan-cli)

A comprehensive command-line interface for Etherscan, based on the `etherscan-api-v2` library.

## Features

- **Account**: Balance, transactions (normal, internal, token, NFT), mined blocks.
- **Contract**: ABI, source code, creation info, read-only queries.
- **Transaction**: Get details, receipt, status, send raw transactions.
- **Block**: Get by number, block rewards, countdown, number by timestamp.
- **Token**: Total supply, balance, holders.
- **Stats**: ETH price, total supply, gas price.
- **Logs**: Query event logs.
- **Multi-chain Support**: Support for all chains supported by Etherscan v2 API.
- **Rich Output**: Beautiful tables and syntax-highlighted JSON.

## Installation

```bash
pip install python-etherscan-cli
```

## Configuration

Set your Etherscan API key as an environment variable:

```bash
export ETHERSCAN_API_KEY=your_api_key_here
```

Or provide it via the `--api-key` option.

## Quick Start

```bash
# Get ETH price
etherscan-cli stats price

# Get ETH balance
etherscan-cli account balance 0x...

# List transactions
etherscan-cli account txs 0x... --limit 5

# Get contract ABI
etherscan-cli contract abi 0x...

# List supported chains
etherscan-cli chains
```

## Usage

```bash
Usage: etherscan-cli [OPTIONS] COMMAND [ARGS]...

  Etherscan CLI - A command line interface for Etherscan API v2.

Options:
  --api-key TEXT      Etherscan API Key
  --chain-id INTEGER  Chain ID (default: 1 for Mainnet)
  --help              Show this message and exit.

Commands:
  account   Account related commands
  block     Block related commands
  chains    List supported chains and their IDs
  contract  Contract related commands
  logs      Event logs related commands
  stats     Stats related commands
  token     Token related commands
  tx        Transaction related commands
```

## License

MIT
