@openclawdsolana/percolator
v1.0.1
Published
๐ฆ OpenClawd Percolator โ agentic perpetuals CLI for Solana. Trade, manage, and monitor perp markets from the lobster's claw.
Maintainers
Readme
๐งช Percolator CLI
Perpetuals trading CLI for Solana โ Trade, manage, and monitor perpetuals markets.
Part of the OpenClawd monorepo โ the Hermes of Web3.
Changelog
v1.1.0 (April 23, 2025)
NEW: Full Percolator CLI Package
30 commands with viral emoji branding for perpetuals trading:
- ๐๏ธ Market Management โ
init-market,list-markets,close-slab,close-all-slabs - ๐ฐ Trading โ
init-user,init-lp,deposit,withdraw,trade-cpi,best-price - โ๏ธ Liquidation โ
liquidate-at-oracle,close-account - ๐ฎ Oracle โ
push-oracle-price,set-oracle-authority - ๐ก๏ธ Insurance โ
topup-insurance,withdraw-insurance,resolve-market - ๐ Admin โ
update-admin,update-config - ๐ Inspection โ
slab:get,slab:header,slab:config,slab:nonce,slab:engine,slab:params,slab:account,slab:accounts,slab:bitmap - ๐ Utilities โ
audit-cu
Features:
- Global
--simulateand--jsonflags - Support for testnet, devnet, mainnet-beta
- Keypair-based wallet authentication
- Custom RPC URL configuration
- x402-ready for future payment integration
Features
- ๐ Market Management - Initialize, configure, and close perpetuals markets
- ๐ฐ Trading - Deposit, withdraw, and trade with leverage
- ๐ Account Management - Create and manage trading accounts
- โ๏ธ Liquidation - Liquidate undercollateralized positions
- ๐ฎ Oracle Management - Push prices, set authorities
- ๐ Inspection - Query market state, accounts, headers, engine
Installation
# Clone the repo
git clone https://github.com/clawdsolana/OpenClawd.git
cd openclawd
# Build the package
cd packages/percolator
npm install
npm run build
# Link globally
npm linkQuick Start
# List all markets
percolator list-markets
# Get market state
percolator slab:get --slab <PUBKEY>
# Create a trading account
percolator init-user --slab <PUBKEY>
# Deposit collateral
percolator deposit --slab <PUBKEY> --idx <ACCOUNT_IDX> --amount 100000000Commands
Market Management
| Command | Description |
|---------|-------------|
| init-market | ๐๏ธ Initialize a new perpetuals market |
| init-lp | ๐ฐ Initialize an LP (Liquidity Provider) account |
| list-markets | ๐ List all markets on the program |
| update-config | โ๏ธ Update market configuration |
| close-slab | ๐๏ธ Close a market |
| close-all-slabs | ๐๏ธ Close all markets |
Trading
| Command | Description |
|---------|-------------|
| init-user | ๐๏ธ Initialize a trading account |
| deposit | ๐ Deposit collateral |
| withdraw | ๐ธ Withdraw collateral |
| trade-cpi | ๐ Execute a perpetuals trade |
| liquidate-at-oracle | โ๏ธ Liquidate an account at oracle price |
| close-account | ๐ Close your account |
| best-price | ๐ฐ Find best LP price for a trade |
Oracle
| Command | Description |
|---------|-------------|
| push-oracle-price | ๐ฎ Push oracle price (authority only) |
| set-oracle-authority | ๐ฎ Set oracle authority |
Insurance
| Command | Description |
|---------|-------------|
| topup-insurance | ๐ก๏ธ Top up insurance fund |
| withdraw-insurance | ๐ฐ Withdraw from insurance fund |
| resolve-market | โ
Resolve a market |
Inspection
| Command | Description |
|---------|-------------|
| slab:get | ๐ Get full slab state |
| slab:header | ๐ Get header info |
| slab:config | โ๏ธ Get config info |
| slab:nonce | ๐ข Get nonce |
| slab:engine | โก Get engine state |
| slab:params | ๐ Get risk parameters |
| slab:account | ๐ค Get account by index |
| slab:accounts | ๐ List all accounts |
| slab:bitmap | ๐บ๏ธ Get used account bitmap |
| audit-cu | ๐ Compute unit audit |
Admin
| Command | Description |
|---------|-------------|
| update-admin | ๐ Update market admin |
Global Options
-c, --cluster <cluster> Solana cluster (mainnet-beta, testnet, devnet)
--commitment <level> Transaction commitment (confirmed, finalized, processed)
--simulate Simulate transactions without sending
--json Output JSON format
-k, --keypair <path> Path to keypair
-v, --verbose Verbose output
--program-id <pubkey> Percolator program ID
--rpc-url <url> Custom RPC URLEnvironment Variables
# Optional - can also use --keypair, --program-id, --rpc-url flags
export KEYPAIR=~/.config/solana/id.json
export CLUSTER=mainnet-beta
export PROGRAM_ID=PERC8m2tkHwVBEZSCz3E5JhcUVE5sWsEG8q39h7mSS5M
export RPC_URL=https://api.mainnet-beta.solana.comExamples
Initialize and trade
# Initialize market
percolator init-market \
--slab <NEW_PUBKEY> \
--mint So11111111111111111111111111111111111111112 \
--vault <VAULT_PUBKEY> \
--index-feed-id 0x1234... \
--max-staleness-secs 60 \
--conf-filter-bps 100
# Initialize user account
percolator init-user --slab <SLAB_PUBKEY> --idx 0
# Deposit 100 USDC
percolator deposit \
--slab <SLAB_PUBKEY> \
--idx 0 \
--amount 100000000
# Execute a trade
percolator trade-cpi \
--slab <SLAB_PUBKEY> \
--lp-idx 1 \
--user-idx 0 \
--size 1000000 \
--matcher-program <MATCHER_PUBKEY> \
--matcher-ctx <CTX_PUBKEY>Inspect market state
# Get full state
percolator slab:get --slab <PUBKEY> --json
# List all accounts
percolator slab:accounts --slab <PUBKEY>
# Get engine state
percolator slab:engine --slab <PUBKEY>Related Documentation
| Document | Description | |----------|-------------| | OpenClawd README | Main monorepo documentation | | AutoResearch Wiki | Karpathy-style research engine | | Solana Integration | Blockchain API reference | | STACK.md | Technical architecture |
Links
| Service | URL | |---------|-----| | ๐ Website | solanaclawd.com | | ๐ฆ GitHub | github.com/clawdsolana/OpenClawd | | ๐ฆ Twitter | x.com/clawddevs | | ๐ฌ Telegram | t.me/clawdtoken |
Built with ๐ฆ by the OpenClawd crew โ The Hermes of Web3
License
MIT โ See ../LICENSE.md
