npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@openclawchain/swap-cli

v1.0.0

Published

Lightweight CLI for USDC and token swaps on NEAR Mainnet - Perfect for AI agents and DeFi automation

Downloads

21

Readme

OCC Swap CLI

Lightweight CLI for USDC and token swaps on NEAR Mainnet. Perfect for AI agents, DeFi automation, and hackathon projects.

npm version License: MIT

Features

  • 🔄 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
  • 🤖 AI agent-friendly CLI interface

Installation

npm install -g @openclawchain/swap-cli

Verify installation:

occ-swap --version

Quick Start

1. Setup Environment

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.org

Note: All three address variables should be set to your NEAR Mainnet account (same value).

2. List Available Tokens

occ-swap swap tokens --blockchain near

3. Get a Quote

occ-swap swap quote --from wrap.near --to usdc --amount 1.5

4. Execute Swap

occ-swap swap execute --deposit-address <address-from-quote> --amount 1.5 --from wrap.near

5. Check Status

occ-swap swap status --deposit-address <address-from-quote>

Documentation

Supported Tokens

28 tokens on NEAR Mainnet including:

  • Stablecoins: USDC, USDT, FRAX
  • Major: wNEAR, ETH, wBTC, BTC
  • DeFi: AURORA, SWEAT, HAPI, mpDAO
  • AI: RHEA, PUBLIC
  • Meme: BLACKDRAGON, SHITZU, and more

See full list: occ-swap swap tokens --blockchain near

Requirements

  • Node.js >= 18.0.0
  • NEAR Mainnet account with private key
  • Tokens in your NEAR wallet

Commands

List Tokens

occ-swap swap tokens [--blockchain near] [--symbol <symbol>] [--refresh]

Get Quote

occ-swap swap quote --from <token> --to <token> --amount <amount>

Important: You MUST get a quote before executing a swap. The deposit address from the quote is required.

Execute Swap

occ-swap swap execute --deposit-address <address> --amount <amount> --from <token>

Note: Quotes expire in ~10 minutes. Execute before expiration or get a new quote.

Check Status

occ-swap swap status --deposit-address <address>

Security

  • Private keys stored locally in ~/.occ/.env
  • All signing happens on your machine
  • Keys never sent to any server
  • Open source and auditable

Use Cases

  • AI Agents: Autonomous token swaps and treasury management
  • DeFi Automation: Automated trading strategies
  • USDC Operations: Stable value storage and payments
  • Arbitrage: Cross-DEX price difference exploitation
  • Portfolio Management: Automated rebalancing

How It Works

Transaction Flow

  1. Get Quote - API prepares swap parameters and generates deposit address
  2. Sign Locally - CLI signs transactions with your private key
  3. Execute - Transactions are broadcast to NEAR blockchain
  4. Track - Monitor swap status via API

NEAR Token Swaps

For NEAR NEP-141 tokens, two transactions are executed:

  1. Storage Deposit - Registers the deposit address in the token contract
  2. Token Transfer - Transfers tokens to the deposit address

The swap service monitors the deposit address and executes the swap automatically.

Troubleshooting

"Blockchain not supported"

Currently only NEAR Mainnet is supported. Ensure you're using NEAR tokens.

"Missing configuration"

Check that all required environment variables are set in ~/.occ/.env:

cat ~/.occ/.env

"Token not found"

Refresh the token cache:

occ-swap swap tokens --refresh

"Quote expired"

Get a new quote - quotes expire in ~10 minutes:

occ-swap swap quote --from wrap.near --to usdc --amount 1.5

Development

# 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

Publishing

# Build and publish
npm run build
npm publish --access public

Related Projects

  • occ-cli - Full-featured OCC CLI with wallet management
  • occ-foundation-api - Backend API for OCC services
  • occ-skill - CLAWD skill for AI agents

Support

  • Issues: https://github.com/openclawchain/occ-swap-cli/issues
  • API: https://api.openclawchain.org
  • Network: NEAR Mainnet only

License

MIT - see LICENSE file

Contributing

Contributions welcome! Please open an issue or PR.


Built with ❤️ by OpenClawChain