Skip to main content

Ophis CLI

Use the Ophis CLI to check prices, swap tokens and bridge between networks by typing commands in your terminal.

Before you start​

RequirementDetails
ComputerNode.js 20 or later; npm comes with Node.js
Phone walletMetaMask, Rabby, Trust Wallet, Rainbow or Ledger Wallet

Install the CLI​

  1. Install the package. Run this command in your terminal:

    npm install -g @ophis/cli
  2. Check the version. A version number confirms the installation:

    ophis --version

Run the install command again to update. To run the CLI once without installing:

npx @ophis/cli help

Connect your wallet​

  1. Start the connection. Run:

    ophis connect
  2. Scan with your wallet. Open its WalletConnect scanner and scan the QR code, or paste the pairing link into the wallet.

  3. Approve the connection. Your wallet handles signing requests and keeps your keys.

WalletWhere to scan
MetaMaskScan, in the account menu or at the top right
RabbySettings > WalletConnect
Trust WalletScan QR code, at the top right
RainbowScan icon on the home screen
Ledger WalletOpen an account, then its WalletConnect icon
Use the wallet scanner

Scan the code inside your wallet app. Keep the wallet open while the CLI waits for a response; in Ledger Wallet, stay on the WalletConnect screen.

Quote and swap​

  1. Check the price. Request a quote:

    ophis quote 5 USDC ETH
  2. Start the swap. Sell USDC for ETH:

    ophis swap 5 USDC ETH
  3. Review and approve. Confirm the amounts in the terminal, then approve in your wallet. Approve token spending if requested, then sign the order. Each approval covers the amount needed. Selling ETH uses WETH, its token form, and requires wrapping if needed.

Bridge tokens​

Move USDC from Base to Arbitrum through Across:

ophis bridge 25 USDC to arbitrum
CLI bridge settingNetworks
Supported sourcesEthereum, Arbitrum, Base
Default sourceBase

Confirm the route in the terminal and approve in your wallet. Use ophis status <order id> to follow the transfer.

Choose the chain​

The default network is Base. Add a chain name to change the source or destination.

WordsMeaningExample
on arbitrumTrade on Arbitrumophis swap 5 USDC ETH on arbitrum
to arbitrumTrade on Base and receive on Arbitrumophis swap 5 USDC ETH to arbitrum
from arbitrum to baseBridge from Arbitrum to Baseophis bridge 25 USDC from arbitrum to base
-c <chain>Same as onSelect the source chain
--to-chain <chain>Same as toSelect the destination chain

For an Arbitrum order, use ophis status <order id> on arbitrum.

Network listChains
MainnetsArbitrum One, Arc, Avalanche, Base, BNB Chain, Ethereum, Gnosis, Ink, Linea, Optimism, Plasma, Polygon, Robinhood Chain, Unichain
TestnetSepolia
Total15

Run ophis chains to see the names to type.

Swap fees​

ChargeAmount
Ophis base0.01%; 0.01 USDC on a 100 USDC swap
Price improvementShare and cap shown on every quote and confirmation
Upstream volume fee on partner-hosted networks0.02%, or 0.003% on correlated pairs such as stablecoins
Combined volume fee on partner-hosted networks0.03% standard / 0.013% correlated; improvement and execution costs are additional
Partner-hosted networks10, including Base
Ophis-operated networksOptimism, Unichain, Robinhood Chain, Arc; no upstream fee
Across bridge feeIncluded in the displayed amounts

If the order fills, settlement enforces the amount shown as At least. A quote or signed order does not guarantee a fill. See Fees for improvement capture and upstream fee details.

Signing an order is free. Token approvals, wrapping ETH and ophis recover require network fees. Each approval covers the amount needed for that swap.

Wallet checks​

Wallet signingYour wallet holds your keys and approves each order.
Order validationThe CLI checks amounts, recipient, chain and bridge steps before requesting approval.
Token addressesThe CLI displays each token's contract address for you to check.

The CLI checks the Ophis token list first, then public lists from swap.ophis.fi. It flags tokens outside the Ophis list and rejects ambiguous names. Before approving, match the wallet's amounts and token addresses to the terminal.

Connection and tokens​

The wallet did not answer

Keep the wallet open, then run ophis connect again if needed. Some wallets, including Rabby, drop the connection on restart. Use ophis wallet to check the session.

Connect another network

Add the network in your wallet's settings. Run ophis connect and approve the connection again, then check the chain with ophis wallet.

Use ETH on another chain
NetworkToken to request
Arc, Polygon, GnosisETH resolves to WETH automatically
Avalanche, PlasmaWETH
ophis quote 5 USDC WETH on avalanche
ophis quote 5 USDC WETH on plasma
Use the dollar token on Robinhood Chain

Use USDG on Robinhood Chain.

ophis quote 5 USDG ETH on robinhood

Command reference​

Replace the angle-bracket placeholders with your values. In a quote or swap, the first token is sold and the second is received.

CommandAction
ophis connectLink your wallet with a QR code or pairing link
ophis quote <amount> <token> <token>Check the price
ophis swap <amount> <token> <token>Confirm a swap and approve in your wallet
ophis bridge <amount> <token> to <chain>Move tokens through Across
ophis status <order id>Track an order or bridge
ophis walletShow your wallet and connected chains
ophis recover [token]Recover tokens left by a bridge; use ophis recover USDC on base to look for an older transfer
ophis disconnectUnlink your wallet
ophis chainsList networks and their command names
ophis helpShow commands and options

Next​