open-index/open-npm huggingface dataset:
npm package: @solworks/poll-cli
Description: CLI tool for Poll.fun
Latest version: 0.1.28

# poll-cli

Command-line interface for [Poll.fun](https://poll.fun). Create bets, place wagers, check balances, and manage your account from the terminal.

## Install

```bash
cd poll-cli && npm install && npm run build
```

## Authentication

**Option A — Browser login (recommended):**

```bash
poll auth login
```

Opens your browser for approval. Token saved to `~/.config/poll/credentials.json` (0600 permissions).

**Option B — Environment variable:**

```bash
export POLL_API_TOKEN=polld_...
poll me
```

`POLL_API_TOKEN` takes precedence over stored credentials. Override the API endpoint with `POLL_API_URL` (default: `https://api.poll.fun`). Override the credential directory with `POLL_CONFIG_DIR`.

## Usage

All commands accept `--format <json|table|compact>` (default: `table`).

### Account

```bash
poll me                  # Account info (name, UUID, balances)
poll me stats            # Detailed profile stats
poll auth status         # Auth status + credential health check
poll auth logout         # Clear stored credentials
```

### Bets

```bash
poll bets trending                          # Trending bets
poll bets new                               # Newest bets
poll bets list                              # Your bets
poll bets get <id>                          # Bet details
poll bets create --question "..." --options "Yes,No" [--type USDC] [--amount 5]
poll bets wager <betAddress> --amount 10 --option 0
poll bets join <betAddress>
poll bets vote <betAddress> --option 0
poll bets settle <betAddress>
```

### Wagers

```bash
poll wagers              # List your wagers
poll wagers --active     # Active wagers only
```

### Social

```bash
poll friends list
poll friends add <uuid>
poll friends accept <requestId>
poll leaderboard         # Global leaderboard
poll leaderboard me      # Your ranking
```

### Wallet & Misc

```bash
poll wallet balance
poll wallet transactions
poll notifications
poll streak
```

### Token Management

Create and revoke tokens via the web UI at [poll.fun/settings](https://poll.fun/settings), or use `poll auth login` to generate a token via browser auth flow. List your active tokens from the CLI:

```bash
poll auth token list
```

Available scopes: `read`, `bet:write`, `user:write`, `social:write`, `wallet:read`.

## Security

- Credentials stored with 0600 file permissions; `poll auth status` warns if permissions are wrong
- HTTPS enforced for all non-localhost API URLs
- Tokens are shown once on creation and cannot be retrieved again
- CLI login tokens default to 90-day expiry (max 1 year)