|
| 1 | +# Sparkscan CLI |
| 2 | + |
| 3 | +A command-line interface for interacting with the [Sparkscan](https://sparkscan.io/) API. |
| 4 | + |
| 5 | +Inspired by the [Dune CLI](https://github.com/duneanalytics/cli/tree/main). |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +```bash |
| 10 | +curl -sSfL https://raw.githubusercontent.com/refrakts/sparkscan-cli/main/install.sh | bash |
| 11 | +``` |
| 12 | + |
| 13 | +Or install with Go: |
| 14 | + |
| 15 | +```bash |
| 16 | +go install github.com/refrakts/sparkscan-cli/cmd@latest |
| 17 | +``` |
| 18 | + |
| 19 | +## Authentication |
| 20 | + |
| 21 | +```bash |
| 22 | +# Set via environment variable |
| 23 | +export SPARKSCAN_API_KEY=<key> |
| 24 | +``` |
| 25 | + |
| 26 | +The `--api-key` flag is available on all commands to override the environment variable. |
| 27 | + |
| 28 | +## Commands |
| 29 | + |
| 30 | +### `sparkscan address` |
| 31 | + |
| 32 | +Query Spark addresses. |
| 33 | + |
| 34 | +| Command | Description | |
| 35 | +|---------|-------------| |
| 36 | +| `address get <address>` | Get address summary including balances and transaction count | |
| 37 | +| `address tokens <address>` | Get tokens held by an address | |
| 38 | +| `address transactions <address> [--limit] [--offset]` | Get transactions for an address | |
| 39 | +| `address history net-worth <address> [--limit] [--from] [--to] [--cursor]` | Get historical net worth snapshots | |
| 40 | +| `address history sats <address> [--limit] [--from] [--to] [--cursor]` | Get historical sats balance | |
| 41 | +| `address history token <address> <token-identifier> [--limit] [--from] [--to] [--cursor]` | Get historical token balance | |
| 42 | + |
| 43 | +### `sparkscan token` |
| 44 | + |
| 45 | +Query tokens on the Spark network. |
| 46 | + |
| 47 | +| Command | Description | |
| 48 | +|---------|-------------| |
| 49 | +| `token get <identifier>` | Get token details by identifier or search by name | |
| 50 | +| `token holders <identifier> [--limit] [--offset]` | Get top holders of a token | |
| 51 | +| `token transactions <identifier> [--limit] [--offset]` | Get transactions for a token | |
| 52 | +| `token list [--limit] [--cursor] [--sort] [--sort-direction] [--has-icon] [--holder] [--min-holders]` | List tokens with filtering and sorting | |
| 53 | +| `token issuer-lookup [--pubkeys] [--tokens]` | Look up token issuer information | |
| 54 | +| `token metadata --tokens <addresses>` | Fetch metadata for multiple tokens | |
| 55 | + |
| 56 | +### `sparkscan tx` |
| 57 | + |
| 58 | +Query transactions. |
| 59 | + |
| 60 | +| Command | Description | |
| 61 | +|---------|-------------| |
| 62 | +| `tx get <txid>` | Get a transaction by ID | |
| 63 | +| `tx latest [--limit]` | Get the latest network transactions | |
| 64 | + |
| 65 | +### `sparkscan version` |
| 66 | + |
| 67 | +Print the CLI version. |
| 68 | + |
| 69 | +## Global Flags |
| 70 | + |
| 71 | +| Flag | Description | Default | |
| 72 | +|------|-------------|---------| |
| 73 | +| `--api-key` | Sparkscan API key (overrides `SPARKSCAN_API_KEY`) | | |
| 74 | +| `--base-url` | API base URL | `https://api.sparkscan.io` | |
| 75 | +| `--network` | Network: `MAINNET` or `REGTEST` | `MAINNET` | |
| 76 | +| `-o, --output` | Output format: `text` or `json` | `text` | |
| 77 | + |
| 78 | +## License |
| 79 | + |
| 80 | +[MIT](LICENSE) |
0 commit comments