Lightweight CLI for USDC and token swaps on NEAR Mainnet. Perfect for AI agents, DeFi automation, and hackathon projects.
Links:
- 📦 npm: https://www.npmjs.com/package/@openclawchain/swap-cli
- 💻 GitHub: https://github.com/OpenClawChain/occ-swap-cli
- 📚 API: https://api.openclawchain.org
- 💵 Stable value - No volatility, predictable pricing
- 🌐 Universal - Accepted across DeFi protocols
- 🤖 Agent-friendly - Perfect for autonomous trading
- ⚡ Fast settlement - Quick swaps on NEAR blockchain
- 🔄 Swap 28+ tokens on NEAR Mainnet including USDC, wNEAR, ETH, wBTC
- 💵 USDC-focused for stable value operations
- 🔐 Secure local signing (keys never leave your machine)
- ⚡ Fast quotes and execution (~10 minute quote validity)
- 🤖 AI agent-friendly CLI interface
npm install -g @openclawchain/swap-cliVerify installation:
occ-swap --versionCreate a NEAR Mainnet account at https://wallet.near.org/ and export your private key.
Create ~/.occ/.env:
NEAR_ACCOUNT_ADDRESS=your-account.near
NEAR_PRIVATE_KEY=ed25519:your_private_key_here
NEAR_RECIPIENT_ADDRESS=your-account.near
NEAR_REFUND_ADDRESS=your-account.near
NEAR_NETWORK=mainnet
NEAR_RPC_URL=https://rpc.mainnet.near.orgNote: All three address variables should be set to your NEAR Mainnet account (same value).
occ-swap swap tokens --blockchain nearocc-swap swap quote --from wrap.near --to usdc --amount 1.5occ-swap swap execute --deposit-address <address-from-quote> --amount 1.5 --from wrap.nearocc-swap swap status --deposit-address <address-from-quote>You MUST follow this order:
- First: Run
quoteto get the deposit address - Then: Run
executeusing that deposit address (before quote expires!) - Finally: Run
statusto check completion
Never skip the quote step! The deposit address from the quote is required for execute to work.
Quotes expire in ~10 minutes. If expired, get a new quote.
# ✅ CORRECT
occ-swap swap quote --from wrap.near --to usdc --amount 1.5
occ-swap swap execute --deposit-address <address> --amount 1.5 --from wrap.near
# ❌ WRONG: Cannot execute without deposit address from quote
occ-swap swap execute --amount 1.5 --from wrap.nearContract: 17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1
Network: NEAR Mainnet only
Decimals: 6
Symbol: usdc
USDC on NEAR is a NEP-141 token with:
- ✅ Fast transfers (2-3 second finality)
- ✅ Low cost (~$0.01 per transaction)
- ✅ Full NEAR DeFi compatibility
- ✅ Bridged from Ethereum via Rainbow Bridge
28 tokens on NEAR Mainnet:
- wNEAR - Wrapped NEAR
- ETH - Bridged Ethereum
- USDC - USD Coin ⭐
- USDT - Tether USD
- FRAX - Frax Stablecoin
- wBTC - Wrapped Bitcoin
- BTC - Native Bitcoin
AURORA, SWEAT, HAPI, mpDAO, ITLX, CFI, NPRO, STJACK
RHEA, PUBLIC
BLACKDRAGON, SHITZU, ABG, NOEAR, JAMBO, GNEAR, PURGE
NearKat, TURBO, ZEC, TESTNEBULA
See full list: occ-swap swap tokens --blockchain near
occ-swap swap tokens [--blockchain near] [--symbol <symbol>] [--refresh]occ-swap swap quote --from <token> --to <token> --amount <amount>Examples:
# Swap wNEAR to USDC
occ-swap swap quote --from wrap.near --to usdc --amount 1.5
# Swap USDC to wNEAR
occ-swap swap quote --from usdc --to wrap.near --amount 10
# Swap ETH to USDC
occ-swap swap quote --from eth --to usdc --amount 0.5occ-swap swap execute --deposit-address <address> --amount <amount> --from <token>What happens:
- CLI prepares two transactions (storage deposit + token transfer)
- Signs them locally with your private key
- Broadcasts to NEAR blockchain
- Swap service detects deposit and executes swap
- You receive tokens at your recipient address
occ-swap swap status --deposit-address <address>Status values:
PENDING- Waiting for depositPROCESSING- Swap in progressSUCCESS- Swap completed!FAILED- Swap failed (tokens refunded)
Convert volatile tokens to USDC:
occ-swap swap quote --from wrap.near --to usdc --amount 10Use USDC as base currency:
occ-swap swap quote --from eth --to usdc --amount 0.5USDC is accepted everywhere:
occ-swap swap quote --from aurora --to usdc --amount 100Trade with USDC as base:
occ-swap swap quote --from usdc --to wrap.near --amount 50Maintain stable reserves:
occ-swap swap quote --from sweat --to usdc --amount 1000Popular pairs:
- USDC ↔ USDT - Stablecoin arbitrage
- USDC ↔ FRAX - Algorithmic stablecoin
- USDC ↔ wNEAR - NEAR ecosystem base pair
- USDC ↔ ETH - Ethereum exposure
- USDC ↔ wBTC - Bitcoin exposure
- USDC ↔ AURORA - Aurora ecosystem
- USDC ↔ SWEAT - Move-to-earn token
- USDC ↔ HAPI - Security protocol
- Private keys stored locally in
~/.occ/.env - All signing happens on your machine
- Keys never sent to any server
- Open source and auditable
- Node.js >= 18.0.0
- NEAR Mainnet account with private key
- Tokens in your NEAR wallet
- Agent Guide (occ.md) - Complete guide for AI agents
- USDC Guide (occ-usdc.md) - USDC-focused guide for hackathons
- Comparison - Differences from full OCC CLI
- Publishing Guide - How to publish updates
Only NEAR Mainnet is supported. Ensure you're using NEAR tokens.
Check that all required environment variables are set in ~/.occ/.env.
Refresh the token cache:
occ-swap swap tokens --refreshGet a new quote - quotes expire in ~10 minutes:
occ-swap swap quote --from wrap.near --to usdc --amount 1.5- USDC Savings Agent - Auto-convert earnings to USDC
- USDC Payment Bot - Accept any token, convert to USDC
- USDC Arbitrage Trader - Trade with USDC as base
- USDC Treasury Manager - Maintain reserves in USDC
- USDC DeFi Aggregator - Route USDC through best yields
- USDC Tipping Bot - Send USDC tips across platforms
- USDC Subscription Service - Collect recurring USDC payments
- USDC Payroll System - Distribute salaries in USDC
# Clone repository
git clone https://github.com/OpenClawChain/occ-swap-cli.git
cd occ-swap-cli
# Install dependencies
npm install
# Build
npm run build
# Link for local testing
npm link- occ-cli - Full-featured OCC CLI with wallet management
- occ-foundation-api - Backend API for OCC services
- occ-skill - CLAWD skill for AI agents
- npm: https://www.npmjs.com/package/@openclawchain/swap-cli
- GitHub: https://github.com/OpenClawChain/occ-swap-cli
- Issues: https://github.com/OpenClawChain/occ-swap-cli/issues
- API: https://api.openclawchain.org
MIT - see LICENSE file
Contributions welcome! Please open an issue or PR.
Built with ❤️ by OpenClawChain for the USDC Ecosystem Hackathon