CLI Overview
The Spectrum CLI is a command-line interface for the Spectrum API: blocks, gas, balances, tokens, DeFi yields, NFTs, ENS, smart-contract reads, and raw JSON-RPC across 20+ chains. It wraps the TypeScript SDK and outputs raw JSON by default, so it pipes cleanly into tools like jq.
npm install -g @spectrumnodes/cli# Configure once (the URL embeds your tenant token)
spectrum config set api https://your-endpoint.simplystaking.xyz/YOUR_API_KEY/spectrumapi/v1/
spectrum config set default-chain ethereum
spectrum prices price ETH
spectrum tokens balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
spectrum yields best --token USDC --limit 5
spectrum ens resolve vitalik.ethFeatures
- Raw JSON on stdout by default for clean piping; add
--humanfor aligned key-value pairs and tables - Up-front validation of arguments, chains, and JSON payloads before any request
- Built-in retries with exponential backoff and response caching
- A machine-readable command catalog (
spectrum commands) for agents and scripts - Config precedence across flags, environment, and a permission-hardened config file
Namespaces
Every command follows the shape spectrum <namespace> <command>.
| Namespace | Description | Example |
|---|---|---|
core | Blocks, gas, transactions, gas estimation | spectrum core block-height --chain ethereum |
tokens | Native and token balances, metadata, allowances | spectrum tokens balance 0xd8dA... |
yields | Lending, vaults, staking, best-yield discovery | spectrum yields best --token USDC |
prices | Token prices, history, top markets, search | spectrum prices price ETH |
defi | Swaps, positions, approvals, perps, funding rates | spectrum defi uniswap-v3-quote ... |
nfts | NFT collections, balances, ownership, metadata | spectrum nfts collection 0xBC4C... |
ens | ENS resolution and reverse lookup | spectrum ens resolve vitalik.eth |
registry | Protocol registry, contract addresses, chains | spectrum registry protocols |
rpc | Direct JSON-RPC proxy to chain nodes | spectrum rpc request eth_blockNumber |
contracts | Smart contract reads, multicall, simulation | spectrum contracts read-contract ... |
solana | Solana-specific convenience methods | spectrum solana slot |
cosmos | Cosmos SDK accounts, delegations, validators, supply | spectrum cosmos validators --chain cosmoshub |
data | Logs, transfers, receipts, portfolio, health, traces | spectrum data portfolio 0xd8dA... |
utils | API health check | spectrum utils health |
Requirements
- Node.js 20 or later