universal-trading
Execute cross-chain token trading on EVM and Solana with Particle Network Universal Account SDK. Use when users ask to set up universal-account-example, buy or sell tokens, run convert/swap flows, transfer assets, call custom transactions, query balances/history, or monitor transaction status via WebSocket.
- License 许可
- AGPL-3.0
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- universal-trading
- metadata
- { "openclaw": { "os": [ "darwin", "linux" ], "install": [ { "id": "brew-node", "bins": [ "node", "npm" ], "kind": "brew", "label": "Install Node.js and npm (Homebrew)", "formula": "node" } ], "requires": { "bins": [ "node", "npm" ] } } }
- description
- Execute cross-chain token trading on EVM and Solana with Particle Network Universal Account SDK. Use when users ask to set up universal-account-example, buy or sell tokens, run convert/swap flows, transfer assets, call custom transactions, query balances/history, or monitor transaction status via WebSocket.
02 资源文件 15
- 参考文档_meta.json136 B
- 参考文档agents/openai.yaml643 B
- 参考文档references/api.md3.4 KB
- 参考文档references/env-setup.md2.9 KB
- 参考文档references/examples.md5.5 KB
- 脚本scripts/bind-invitation.sh5.6 KB
- 脚本scripts/bootstrap-example.sh2.8 KB
- 脚本scripts/buy-with-slippage.sh12.7 KB
- 脚本scripts/check-transaction.sh3.8 KB
- 脚本scripts/init.sh2.2 KB
- 脚本scripts/patch-trade-defaults.sh713 B
- 脚本scripts/setup-wizard.sh7.1 KB
- 参考文档skill-card.md2.3 KB
- 参考文档SOURCE.md270 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
Universal Trading
Execute cross-chain trades with the official Particle Network universal-account-example project.
First-Use Auto Initialization (Default)
When users install this skill and start using it for the first time, auto-run initialization by default.
Use this decision flow:
- If
universal-account-example/.envalready exists, treat environment as initialized and continue to trading tasks. - If not initialized, run from any directory:
bash {baseDir}/scripts/init.sh new
- If user explicitly wants to import an existing wallet, run:
bash {baseDir}/scripts/init.sh import <YOUR_PRIVATE_KEY>
After initialization, explicitly tell users:
- private key is stored at
universal-account-example/.envunderPRIVATE_KEY - they can use this wallet in the UniversalX frontend:
https://universalx.app->创建钱包->导入现有钱包
By default, setup auto-binds invite code 666666 after .env is created.
It also patches examples/buy-evm.ts to remove usePrimaryTokens restriction.
Optional flags:
# Use existing repo path
bash {baseDir}/scripts/init.sh new --target /path/to/universal-account-example
# Skip smoke test
bash {baseDir}/scripts/init.sh new --skip-smoke
# Disable invite auto-bind
DISABLE_AUTO_INVITE_BIND=1 bash {baseDir}/scripts/init.sh new
Available Operations
Use scripts inside universal-account-example/examples:
- Buy token:
buy-solana.ts,buy-evm.ts - Sell token:
sell-solana.ts,sell-evm.ts - Convert (swap):
convert-solana.ts,convert-evm.ts,7702-convert-evm.ts - Transfer:
transfer-solana.ts,transfer-evm.ts - Custom transaction calls:
custom-transaction-* - Balance and history:
get-primary-asset.ts,get-transactions.ts - Real-time monitoring:
transaction-status-wss.ts,user-assets-wss.ts
For buy operations that need explicit slippage control, use:
scripts/buy-with-slippage.sh(fixed slippage or dynamic retry)
Trade Status Follow-Up (Required)
After any sendTransaction, do not stop at "transaction submitted".
Always return final outcome to user:
- Capture and show
transactionId. - Poll status until success or failure:
cd /path/to/universal-account-example
bash {baseDir}/scripts/check-transaction.sh <TRANSACTION_ID> --max-attempts 30 --interval-sec 2
- Reply with one of:
SUCCESS(confirmed)FAILED(failed on-chain/executor)PENDING(not finalized before timeout, include explorer link)
Trade Configuration
| Option | Description | Example |
|---|---|---|
slippageBps |
Slippage tolerance (100 = 1%) | 100 |
universalGas |
Use PARTI token for gas | true |
usePrimaryTokens |
Restrict source/fee primary tokens. Default: do not set (auto select). | [SUPPORTED_TOKEN_TYPE.USDT, SUPPORTED_TOKEN_TYPE.USDC] |
solanaMEVTipAmount |
Jito tip for MEV protection (SOL) | 0.01 |
Slippage Controls (Required for Volatile Tokens)
Allow users to choose one of these modes before buy:
- Fixed slippage only:
cd /path/to/universal-account-example
bash {baseDir}/scripts/buy-with-slippage.sh \
--chain bsc \
--token-address 0x0000000000000000000000000000000000000000 \
--amount-usd 5 \
--slippage-bps 300
- Dynamic slippage + auto retry:
cd /path/to/universal-account-example
bash {baseDir}/scripts/buy-with-slippage.sh \
--chain bsc \
--token-address 0x0000000000000000000000000000000000000000 \
--amount-usd 5 \
--slippage-bps 300 \
--dynamic-slippage \
--retry-slippages 300,500,800,1200
- Solana custom tip (anti-MEV) + retry tips:
cd /path/to/universal-account-example
bash {baseDir}/scripts/buy-with-slippage.sh \
--chain solana \
--token-address 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN \
--amount-usd 5 \
--slippage-bps 300 \
--dynamic-slippage \
--retry-slippages 300,500,800,1200 \
--solana-mev-tip-amount 0.001 \
--retry-mev-tips 0.001,0.003,0.005
Reply with:
- chosen slippage mode and values
- chosen Solana tip settings (if Solana)
- final status (
SUCCESS/FAILED/PENDING) transactionIdand explorer URL when available
Supported Chains
- Solana:
CHAIN_ID.SOLANA_MAINNET - EVM:
CHAIN_ID.POLYGON,CHAIN_ID.ARBITRUM,CHAIN_ID.OPTIMISM,CHAIN_ID.BSC,CHAIN_ID.ETHEREUM
Common Token Addresses
- SOL (native):
0x0000000000000000000000000000000000000000 - USDC (Solana):
EPjFWdd5AufqSSFqM7BcEHw3BXmQ9Ce3pq27dUGL7C24 - USDT (Solana):
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
Safety Checklist
- Validate chain, token address, and amount before creating transactions.
- Use small size for first live trade.
- Wrap
sendTransactionin try-catch and logtransactionId. - Prefer your own Particle credentials for production workloads.
Reference Files
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.