Installation
- Installer script
- Cargo
- From source
Configuration
The CLI reads configuration from environment variables, CLI flags, and a config file (~/.config/nile/config.toml). Precedence: CLI flag > environment variable > config file > built-in
default.
Set Defaults
Verify Configuration
Environment Variables
Every flag has a corresponding environment variable with theNILE_ prefix:
| Flag | Environment Variable | Purpose |
|---|---|---|
--rpc-url | NILE_RPC_URL | Ethereum RPC endpoint |
--subgraph-url | NILE_SUBGRAPH_URL | Subgraph GraphQL endpoint |
--network | NILE_NETWORK | Target network (default: sepolia) |
--format | NILE_FORMAT | Output format: json or table |
--signer | NILE_SIGNER | Signer binary name or path (default: ows) |
--wallet | NILE_WALLET | Wallet name for the signer |
--from | NILE_FROM | Sender address override (simulate only) |
Command Groups
| Group | Description | Key Commands |
|---|---|---|
pool | Pool and vault operations | state, deposit, withdraw, transactions |
vault | Alias for pool | Same commands as pool |
position | Position lifecycle | list, get, search, open, close |
account | Margin account management | balance, deposit, withdraw |
oracle | Price and oracle data | price, state |
protocol | Protocol mode and status | mode |
simulate | Dry-run operations | open |
stats | Analytics | daily |
fees | Fee history | Fee event queries |
token | ERC-20 operations | balance, allowance, approve, mint |
config | CLI configuration | show, set-rpc, set-subgraph, set-signer, set-wallet |
nile <group> --help for full details on any command group.
Read Operations
Pool State
Oracle Prices
Position Details
Fetch a single position with real-time PnL (combined subgraph + RPC data):List Account Positions
Search Positions
Search across all accounts with filters:Account Balance
Token Balance and Allowance
Daily Statistics
Write Operations
Write operations require a configured wallet for transaction signing. The CLI delegates signing to an OWS-compatible signer — your private keys never touch the CLI process.Approve Tokens
--spender flag accepts contract names (positionManager, marginAccounts, poolVault) or
raw addresses.
Deposit and Withdraw Margin
Open a Position
| Flag | Values | Description |
|---|---|---|
--side | long, short | Position direction |
--tenor | 1d, 1w, 1m, test | Time to maturity |
--notional | Decimal USDC | Position size (e.g., 10000.0) |
--margin | Decimal USDC | Collateral to lock (e.g., 500.0) |
--dry-run | Flag | Simulate only, no transaction |
Simulate Before Opening
Add--dry-run to preview without spending gas:
Close a Position
LP Deposit and Withdraw
Mint Test Tokens
On Sepolia, mint MockUSDC for testing:Output Formats
JSON (default)
All commands output JSON by default, designed for piping tojq or consuming in scripts:
Table
Use--format table for human-readable terminal output:
OWS Wallet Signing
The CLI uses Open Wallet Standard (OWS) for transaction signing. OWS is a local-first, multi-chain wallet tool that manages keys on your machine — no keys are sent to any remote server or exposed to the CLI process.Setup
- Install OWS (see the OWS documentation for platform-specific instructions)
- Create or import a wallet:
- Configure the CLI to use it:
How It Works
When you run a write command, the CLI:- Builds the unsigned transaction
- Passes it to the OWS signer binary
- OWS prompts you to approve and signs locally
- The CLI broadcasts the signed transaction
--signer:
Related Pages
Quick Start
Get from zero to querying the protocol in 15 minutes.
Open a Position
Step-by-step tutorial for opening your first trade.
TypeScript SDK
TypeScript alternative for programmatic integration.
Contract Addresses
All deployed contract addresses on Sepolia.