CLI tool for Orderly Network trading. Keys stored in OS keychain — never exposed to AI context. The CLI handles signing internally and returns only results.
Run orderly --help for complete command reference. The CLI is self-documenting.
--accountis always required for authenticated commands. No default. Useorderly auth-listto get account IDs.- Hex account IDs must be quoted in shell:
--account "0x5a6b..."(unquoted hex is parsed as float). - Symbol names must be uppercase:
PERP_ETH_USDC, notPERP_ETH_usdc. - Default output is compact JSON. Use
--csvfor tabular data. API wrapper{ success, data }is auto-unwrapped. auth-export-keyblocks AI agents: requires interactive TTY + typing "EXPORT".
- Layer 1 (Wallet): EIP-712 (EVM) or Ed25519 (Solana) — for account registration. Wallet keys in OS keychain.
- Layer 2 (API): Ed25519 keypair for trading operations. Auto-generated by
wallet-add-key. Stored in OS keychain, network-scoped asaccountId:network.
Keychain backends: macOS Keychain, Windows Credential Manager, Linux libsecret/gnome-keyring.
src/
├── index.ts # CLI entry point (cac)
├── types.ts # TypeScript interfaces
├── commands/ # One file per command group
│ ├── auth.ts, wallet.ts, account.ts, order.ts, algo.ts,
│ ├── positions.ts, market.ts, assets.ts, leverage.ts,
│ ├── trades.ts, funding.ts, settle.ts, faucet.ts
└── lib/
├── keychain.ts # OS keychain (keytar)
├── crypto.ts # Ed25519 key gen & signing (@noble/curves)
├── evm.ts # EIP-712 signing (ethers)
├── solana.ts # Ed25519 signing for Solana
├── config.ts # ~/.orderly-cli/config.json
├── api.ts # REST client with auto-signing
└── account-select.ts # Account resolution
yarn build # esbuild bundle
yarn lint # ESLint
yarn format # Prettier
yarn typecheck # tsc --noEmit
yarn test:run # Vitest- Linux keychain: requires
libsecret(sudo apt-get install libsecret-1-0 libsecret-1-dev) - 401: API key not registered. Run
wallet-add-key. - 403: Signature invalid/expired. Check system clock.
- Build errors:
rm -rf dist && yarn build