> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phantom.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Commands

> Full reference for all Phantom CLI commands, including wallet, swap, transfer, signing, and perpetuals trading.

Run `phantom --help` or `phantom <command> --help` for inline documentation.

## Authentication

```bash theme={null}
phantom login
```

Authenticate with Phantom via browser (Google, Apple, or Phantom extension). Use this to log in for the first time, switch accounts, or refresh an expired session.

***

## Wallet

```bash theme={null}
phantom wallet status      # Check session status (no API call)
phantom wallet addresses   # Get all wallet addresses (Solana, EVM, Bitcoin, Sui)
phantom wallet balances    # Get token balances with USD prices across all chains
phantom wallet rebalance   # Rebalance portfolio to a target allocation
```

***

## Tokens & Swaps

```bash theme={null}
phantom buy        # Swap tokens on Solana, EVM, or cross-chain
phantom transfer   # Transfer native tokens or SPL/ERC-20 tokens
phantom simulate   # Simulate a transaction and preview asset changes
phantom pay        # Pay for API access using tokens
```

### `phantom buy`

Swap tokens on Solana, across EVM chains, or between chains (including Hyperliquid):

```bash theme={null}
# Swap SOL to USDC on Solana
phantom buy --sellTokenIsNative --buyTokenMint EPjFWdd5... --amount 0.1 --amountUnit ui --execute

# Bridge USDC from Solana to Base
phantom buy --sellTokenMint EPjFWdd5... --buyChainId eip155:8453 --buyTokenIsNative \
  --amount 10 --amountUnit ui --execute

# Deposit to Hyperliquid (bridge SOL into HL spot)
phantom buy --sellTokenIsNative --buyChainId hypercore:mainnet \
  --buyTokenMint 0x00000000000000000000000000000000 --amount 0.05 --amountUnit ui --execute
```

Omit `--execute` to get a quote preview only.

***

## Solana

```bash theme={null}
phantom solana send   # Sign and broadcast a base64-encoded Solana transaction
phantom solana sign   # Sign a UTF-8 message (returns base58 signature)
```

***

## EVM

```bash theme={null}
phantom evm send         # Sign and broadcast an EVM transaction
phantom evm sign         # Sign an EVM personal message (EIP-191)
phantom evm sign-typed   # Sign EVM typed data (EIP-712)
phantom evm allowance    # Get ERC-20 token allowance for a spender address
```

***

## Perpetuals (Hyperliquid)

Full perpetuals documentation: [PERPS guide](/phantom-mcp-server/perps).

```bash theme={null}
phantom perps markets      # List available perpetual markets with prices
phantom perps account      # Get account balance, available margin, and withdrawable amount
phantom perps positions    # Get all open positions
phantom perps orders       # Get all open orders
phantom perps history      # Get recent trade history

phantom perps open         # Open a long or short position (market or limit)
phantom perps close        # Close an open position
phantom perps cancel       # Cancel an open order
phantom perps leverage     # Update leverage for a market

phantom perps deposit          # Bridge tokens from external chain into Hyperliquid spot
phantom perps transfer         # Move USDC from Hyperliquid spot into perps account
phantom perps withdraw         # Bridge USDC from perps account to an external chain
phantom perps withdraw-hl-spot # Bridge USDC from Hyperliquid spot to an external chain
```

### Perps workflow

**Fund and trade:**

```bash theme={null}
# 1. Bridge SOL into Hyperliquid spot
phantom perps deposit --sourceChainId solana:mainnet --amount 0.1 --sellTokenIsNative --execute

# 2. Move USDC from spot into perps account
phantom perps transfer --amountUsdc 8

# 3. Open a leveraged long position
phantom perps open --market BTC --direction long --sizeUsd 50 --leverage 5 --orderType market
```

**Exit and withdraw:**

```bash theme={null}
# 1. Close the position
phantom perps close --market BTC

# 2. Bridge USDC from perps back to Solana
phantom perps withdraw --amountUsdc 8 --destinationChainId solana:mainnet

# Or bridge USDC from Hyperliquid spot to Solana (if funds are already in spot)
phantom perps withdraw-hl-spot --amountUsdc 8 --destinationChainId solana:mainnet
```

***

## Global flags

| Flag                | Description                                               |
| ------------------- | --------------------------------------------------------- |
| `--walletId`        | Override the wallet ID (defaults to authenticated wallet) |
| `--derivationIndex` | Account derivation index (default: `0`)                   |
| `--help`            | Show help for the current command                         |
| `--version`         | Show CLI version                                          |
| `--mcp`             | Start the CLI as an MCP stdio server                      |
