Metadata-Version: 2.4
Name: optiview-cli
Version: 1.0.0
Summary: OptiView DeFi CLI — swap, portfolio, yield scouting, and EVM wallet management in one command.
License: MIT
Project-URL: Homepage, https://github.com/op-god/optiview-agent-skills
Project-URL: Repository, https://github.com/op-god/optiview-agent-skills
Project-URL: Bug Tracker, https://github.com/op-god/optiview-agent-skills/issues
Keywords: defi,swap,evm,wallet,yields,portfolio,cli,web3,0x,debank
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
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 :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28.0
Provides-Extra: wallet
Requires-Dist: web3>=6.0.0; extra == "wallet"
Requires-Dist: eth-account>=0.9.0; extra == "wallet"
Provides-Extra: all
Requires-Dist: web3>=6.0.0; extra == "all"
Requires-Dist: eth-account>=0.9.0; extra == "all"
Dynamic: license-file

# optiview-cli

> Plug-and-play DeFi agent skills for OptiView — letting any LLM agent swap tokens, manage portfolios, scout stablecoin yields, and control EVM wallets through a single `optiview` CLI, no API wiring required.

[![PyPI](https://img.shields.io/pypi/v/optiview-cli)](https://pypi.org/project/optiview-cli/)
[![Python](https://img.shields.io/pypi/pyversions/optiview-cli)](https://pypi.org/project/optiview-cli/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

## Skills

| Skill | Description | Auth Required |
|---|---|---|
| [`optiview-swap`](skills/optiview-swap/) | Token swap via 0x Protocol: price quotes, full quotes with calldata, supported chains and token lists | No |
| [`optiview-assets`](skills/optiview-assets/) | Portfolio management via DeBank: total balance, per-chain balance, tokens, DeFi positions, NFTs, transaction history, net worth curves | No |
| [`optiview-yields`](skills/optiview-yields/) | Stablecoin yield scouting via DeFiLlama: filter and rank pools by APY, TVL, and chain | No |
| [`optiview-wallet`](skills/optiview-wallet/) | EVM wallet management: create wallets, query balances, send ETH/ERC-20, sign messages, track transactions | No |

## Requirements

Install the `optiview` CLI:

```shell
pip install optiview-cli
```

For wallet operations (send/sign transactions), install with the wallet extra:

```shell
pip install "optiview-cli[wallet]"
```

## Quick Start

```shell
# List supported swap chains
optiview swap chains

# Get swap price: 1 WETH -> USDC on Ethereum
optiview swap price \
  --sell-token 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
  --buy-token  0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
  --sell-amount 1000000000000000000 \
  --chain-id 1

# Check wallet total portfolio value
optiview assets total-balance --address 0xYourAddress

# Scout top stablecoin yields on Ethereum
optiview yields scout --chain Ethereum --top 5 --apy 5.0

# Create a new EVM wallet
optiview wallet new

# Check native balance on BSC
optiview wallet balance \
  --rpc https://bsc-dataseed.binance.org \
  --address 0xYourAddress
```

## Usage

```
optiview <module> <command> [options]
```

### swap

| Command | Description |
|---|---|
| `swap chains` | List all supported chains |
| `swap tokens --chain-id <ID>` | List available tokens on a chain |
| `swap price --sell-token <ADDR> --buy-token <ADDR> --sell-amount <WEI> --chain-id <ID>` | Get indicative price (no tx data) |
| `swap quote --sell-token <ADDR> --buy-token <ADDR> --sell-amount <WEI> --taker <ADDR> --chain-id <ID>` | Get full quote with transaction calldata |

### assets

| Command | Description |
|---|---|
| `assets total-balance --address <ADDR>` | Total USD balance across all chains |
| `assets chain-balance --address <ADDR> --chain-id <CHAIN>` | Balance on a specific chain |
| `assets used-chains --address <ADDR>` | Chains the address has interacted with |
| `assets tokens --address <ADDR> --chain-id <CHAIN>` | Token list on a chain |
| `assets all-tokens --address <ADDR>` | All tokens across all chains |
| `assets protocols --address <ADDR> --chain-id <CHAIN>` | DeFi protocol positions |
| `assets all-protocols --address <ADDR>` | All DeFi positions across all chains |
| `assets nfts --address <ADDR> --chain-id <CHAIN>` | NFT list on a chain |
| `assets history --address <ADDR> --chain-id <CHAIN>` | Transaction history |
| `assets net-curve --address <ADDR> --chain-id <CHAIN>` | Net worth curve on a chain |
| `assets total-net-curve --address <ADDR>` | Total net worth curve |

Chain IDs for `assets` use DeBank format: `eth`, `bsc`, `arb`, `matic`, `op`, `avax`, `ftm`, etc.

### yields

| Command | Description |
|---|---|
| `yields scout` | Find and rank top stablecoin yield pools |

Options for `yields scout`:

| Option | Default | Description |
|---|---|---|
| `--chain` | `all` | Filter by chain name (e.g. `Ethereum`, `BSC`) or `all` |
| `--apy` | `4.0` | Minimum APY % |
| `--tvl` | `30000000` | Minimum TVL in USD |
| `--top` | `10` | Top N pools per chain |
| `--output` | `table` | Output format: `table`, `markdown`, or `json` |

### wallet

| Command | Description |
|---|---|
| `wallet new` | Generate a new EVM wallet |
| `wallet address --key <PRIVATE_KEY>` | Derive address from private key |
| `wallet balance --rpc <URL> --address <ADDR>` | Query native token balance |
| `wallet balance-erc20 --rpc <URL> --address <ADDR> --token <ADDR>` | Query ERC-20 balance |
| `wallet send-eth --rpc <URL> --key <KEY> --to <ADDR> --amount <ETHER>` | Send native ETH/BNB/MATIC |
| `wallet send-erc20 --rpc <URL> --key <KEY> --token <ADDR> --to <ADDR> --amount <AMT>` | Send ERC-20 tokens |
| `wallet sign --key <KEY> --message <TEXT>` | Sign a message (EIP-191) |
| `wallet receipt --rpc <URL> --hash <TX_HASH>` | Wait for transaction receipt |
| `wallet tx-info --rpc <URL> --hash <TX_HASH>` | Get transaction details |

## Configuration

By default, the CLI connects to the OptiView backend at `https://optiview.app`. To point to a custom backend, set the environment variable:

```shell
export OPTIVIEW_API_URL=https://your-custom-backend.example.com
```

## Python API

The package also exposes a Python API for programmatic use:

```python
from optiview import swap_get_supported_chains, yields_scout, assets_total_balance

# List supported chains
chains = swap_get_supported_chains()

# Scout yields
results = yields_scout(chain="Ethereum", min_apy=5.0, top_n=3)

# Portfolio balance
balance = assets_total_balance("0xYourAddress")
```

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## License

MIT — see [LICENSE](LICENSE).
