core-ai / helius-cli
CLAUDE.md0 starsChanged 8 months agoMITView on GitHub
CLI tool for managing Helius accounts and querying Solana blockchain data via the Helius platform. All data commands follow this pattern: 1. Create spinner (unless --json) 2. Resolve API key via resolveApiKey(options) — flag > env > config > JWT auto-resolve 3. Get SDK client via getClient(apiKey, network) 4. Call SDK method 5. Output: formatted terminal (chalk) or outputJson() for --json 6. Error: use handleCommandError(error, options, spinner) — classifies the error, emits JSON or spinner output, and exits with the…
- Reads credentials
- Installs packages
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- helius-mcp/CLAUDE.mdCLAUDE.md
- helius-dflowSkill
- helius-okxSkill
- helius-phantomSkill
- heliusSkill
- svmSkill
The file
We split this CLAUDE.md into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 44
All data commands follow this pattern:
- Very specific: line 45
Create spinner (unless --json)
- Very specific: line 119
Create src/commands/mycommand.ts exporting async handler(s)
- Very specific: line 120
Use resolveApiKey(options) + getClient(apiKey, network) from src/lib/helius.ts
- Very specific: line 122
Use handleCommandError(error, options, spinner) in the catch block — import from ../lib/output.js
- Very specific: line 124
Run pnpm build and verify
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
helius-cli
CLI tool for managing Helius accounts and querying Solana blockchain data via the Helius platform.
Directory Structure
bin/helius.ts # Entry point — Commander.js program, registers all commands
src/
commands/ # One file per command group
balance.ts # balance, tokens, token-holders
tx.ts # tx parse, tx history, tx fees
asset.ts # 12 DAS API subcommands
account.ts # account info
network-status.ts # network status
block.ts # block by slot
wallet.ts # Wallet API (REST, not SDK) — identity, balances, history, transfers, funded-by
webhook.ts # webhook CRUD
program.ts # program accounts
stake.ts # staking commands
zk.ts # 24 ZK compression subcommands
send.ts # tx helpers (broadcast, raw, sender, poll, compute-units)
ws.ts # WebSocket streaming (account, logs, slot, signature, program)
config-cmd.ts # config show/set-api-key/set-network/set-project/clear
signup.ts # account signup (existing)
login.ts # wallet auth (existing)
projects.ts # list projects (existing)
plans.ts # list available plans and pricing
status.ts # account status: plan, credits, billing cycle
...
lib/
helius.ts # SDK client wrapper — resolveApiKey(), getClient(), restRequest(), HeliusHttpError
formatters.ts # formatSol(), formatAddress(), formatTimestamp(), formatTable()
config.ts # ~/.helius-cli/config.json — jwt, apiKey, network, projectId
output.ts # ExitCode enum, classifyError(), handleCommandError(), outputJson(), exitWithError()
api.ts # Helius management API (signup, projects, API keys)
payment.ts # USDC payment for signup
wallet.ts # Keypair loading
constants.ts # VERSION, API_URL, treasury, USDC mintsCommand Pattern
All data commands follow this pattern:
- Create spinner (unless
--json) - Resolve API key via
resolveApiKey(options)— flag > env > config > JWT auto-resolve - Get SDK client via
getClient(apiKey, network) - Call SDK method
- Output: formatted terminal (chalk) or
outputJson()for--json - Error: use
handleCommandError(error, options, spinner)— classifies the error, emits JSON or spinner output, and exits with the classified exit code
Standard catch block template (all commands except ws.ts):
} catch (error) {
handleCommandError(error, options, spinner);
}handleCommandError() in src/lib/output.ts calls classifyError() internally, formats JSON or spinner output (with retryable hint), and exits with the classified exit code. All error output logic lives in this single function — do not duplicate it inline. Payment-specific errors (Insufficient SOL/USDC, Checkout failed/expired/timeout) are classified via keyword matching in classifyError().
WebSocket commands (ws.ts) use a variant that preserves the AbortError early-return and uses console.error instead of spinner.
API Key Resolution Chain
--api-key <key>CLI flagHELIUS_API_KEYenvironment variable~/.helius-cli/config.json→apiKeyfield- Auto-resolve from JWT: fetch project details → first API key
Exit Code Ranges
- 0: success
- 1: general error
- 10-19: auth errors (NOT_LOGGED_IN=10, KEYPAIR_NOT_FOUND=11, AUTH_FAILED=12)
- 20-29: balance/payment errors (INSUFFICIENT_SOL=20, INSUFFICIENT_USDC=21, PAYMENT_FAILED=22)
- 30-39: project errors (NO_PROJECTS=30, PROJECT_NOT_FOUND=31, MULTIPLE_PROJECTS=32, PROJECT_EXISTS=33)
- 40-49: API errors (API_ERROR=40, NO_API_KEYS=41)
- 50-59: SDK/data errors:
- 50
NO_API_KEY— resolveApiKey() found nothing; permanent, fix config - 51
SDK_ERROR— unclassified SDK error - 52
INVALID_ADDRESS— bad base58/pubkey format; permanent - 53
INVALID_INPUT— bad parameters or HTTP 400; permanent - 54
INVALID_API_KEY— HTTP 401/403 or "invalid api key"; permanent, fix the key - 55
NOT_FOUND— HTTP 404 or resource not found; permanent - 56
RATE_LIMITED— HTTP 429 or rate limit message; transient, safe to retry - 57
SERVER_ERROR— HTTP 5xx or server error message; transient, safe to retry - 58
NETWORK_ERROR— ECONNREFUSED/ETIMEDOUT/fetch failed; transient, safe to retry
- 50
The retryable field in --json error output reflects this directly.
Error Classification
classifyError(error) in src/lib/output.ts returns { exitCode, errorCode, retryable } using three tiers:
HeliusHttpError(fromrestRequest()— wallet.ts REST path): exactstatusproperty → precise code- Status in message (enhanced TX:
"Helius HTTP 429: ...", webhooks:"HTTP error! status: 429 - ..."): regex extracts status → same mapping - Keyword matching (RPC caller path — DAS, ZK, staking, raw, payment): matches phrases like
"insufficient sol","insufficient usdc","checkout failed","invalid api key","rate limit","not found","ECONNREFUSED",SyntaxError, etc.
restRequest() throws HeliusHttpError (defined in src/lib/helius.ts) so the REST path always hits Tier 1. The SDK paths hit Tier 2 or 3 depending on the client.
exitWithError() (used by auth/project commands) also includes retryable in JSON output automatically.
SDK vs REST
- SDK (
helius-sdk): DAS API, enhanced transactions, webhooks, staking, ZK compression, WebSockets, program accounts, priority fees - REST (
restRequest()): Wallet API (/v1/wallet/...) — identity, balances, history, transfers, funded-by
Build / Dev / Test
pnpm install
pnpm build # tsc → dist/
pnpm dev # tsx bin/helius.ts (runs directly)
node dist/bin/helius.js --helpAdding a New Command
- Create
src/commands/mycommand.tsexporting async handler(s) - Use
resolveApiKey(options)+getClient(apiKey, network)fromsrc/lib/helius.ts - Support
--jsonviaoutputJson()/ formatted chalk output - Use
handleCommandError(error, options, spinner)in the catch block — import from../lib/output.js - Register in
bin/helius.tswith Commander.js - Run
pnpm buildand verify
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

