Execute trustless P2P token swaps on Solana via the Poseidon OTC protocol. Create trade rooms, negotiate offers, lock tokens with time-based escrow, and execute atomic on-chain swaps. Supports agent-to-agent trading with real-time WebSocket updates.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install poseidon-otc或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install poseidon-otc⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/poseidon-otc/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: poseidon-otc description: Execute trustless P2P token swaps on Solana via the Poseidon OTC protocol. Create trade rooms, negotiate offers, lock tokens with time-based escrow, and execute atomic on-chain swaps. Supports agent-to-agent trading with real-time WebSocket updates. metadata: { "openclaw": { "emoji": "🔱", "requires": { "env": ["POSEIDON_BURNER_KEY"] }, "primaryEnv": "POSEIDON_BURNER_KEY", "homepage": "https://poseidon.cash" } } ---
TL;DR for Agents: This skill lets you trade tokens with humans or other agents on Solana. You create a room, both parties deposit tokens to escrow, confirm, and execute an atomic swap. No trust required - it's all on-chain.
import { PoseidonOTC } from 'poseidon-otc-skill';
const client = new PoseidonOTC({
burnerKey: process.env.POSEIDON_BURNER_KEY // base58 private key
});
const { roomId, link } = await client.createRoom();
// Share `link` with counterparty or another agent
// Check room status
const room = await client.getRoom(roomId);
// Set what you're offering (100 USDC example)
await client.updateOffer(roomId, [{
mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC mint
amount: 100000000, // 100 USDC (6 decimals)
decimals: 6
}]);
// First confirmation = "I agree to these terms"
await client.confirmTrade(roomId, 'first');
// After deposits, second confirmation
await client.confirmTrade(roomId, 'second');
// Execute the atomic swap
const { txSignature } = await client.executeSwap(roomId);
┌─────────────────────────────────────────────────────────────────┐
│ TRADE LIFECYCLE │
├─────────────────────────────────────────────────────────────────┤
│ │
│ 1. CREATE ROOM │
│ └─> Party A calls createRoom() │
│ Returns: roomId, shareable link │
│ │
│ 2. JOIN ROOM │
│ └─> Party B calls joinRoom(roomId) │
│ Room now has both participants │
│ │
│ 3. SET OFFERS │
│ └─> Both parties call updateOffer(roomId, tokens) │
│ Each specifies what they're putting up │
│ │
│ 4. FIRST CONFIRM (agree on terms) │
│ └─> Both call confirmTrade(roomId, 'first') │
│ "I agree to swap my X for your Y" │
│ │
│ 5. DEPOSIT TO ESCROW │
│ └─> Tokens move to on-chain escrow │
│ (Handled by frontend or depositToEscrow) │
│ │
│ 6. SECOND CONFIRM (verify deposits) │
│ └─> Both call confirmTrade(roomId, 'second') │
│ "I see the deposits, ready to swap" │
│ │
│ 7. EXECUTE SWAP │
│ └─> Either party calls executeSwap(roomId) │
│ Atomic on-chain swap via relayer │
│ Returns: txSignature │
│ │
│ [OPTIONAL] LOCKUP FLOW │
│ └─> Before step 4, Party A can proposeLockup(roomId, secs) │
│ └─> Party B must acceptLockup(roomId) to continue │
│ └─> After execute, locked tokens claimed via claimLockedTokens │
│ │
└─────────────────────────────────────────────────────────────────┘
| Method | Parameters | Returns | Description | |--------|------------|---------|-------------| | createRoom(options?) | { inviteCode?: string } | { roomId, link } | Create new room | | getRoom(roomId) | roomId: string | TradeRoom | Get full room state | | getUserRooms(wallet?) | wallet?: string | TradeRoom[] | List your rooms | | joinRoom(roomId, inviteCode?) | roomId, inviteCode? | { success } | Join as Party B | | cancelRoom(roomId) | roomId: string | { success } | Cancel & refund | | getRoomLink(roomId) | roomId: string | string | Get share URL |
| Method | Parameters | Returns | Description | |--------|------------|---------|-------------| | updateOffer(roomId, tokens) | roomId, [{mint, amount, decimals}] | { success } | Set your offer | | withdrawFromOffer(roomId, tokens) | roomId, tokens[] | { success } | Pull back tokens | | confirmTrade(roomId, stage) | roomId, 'first'│'second' | { success } | Confirm stage | | executeSwap(roomId) | roomId: string | { txSignature } | Execute swap | | declineOffer(roomId) | roomId: string | { success } | Reject terms |
| Method | Parameters | Returns | Description | |--------|------------|---------|-------------| | proposeLockup(roomId, seconds) | roomId, seconds | { success } | Propose lock | | acceptLockup(roomId) | roomId: string | { success } | Accept lock | | getLockupStatus(roomId) | roomId: string | { canClaim, timeRemaining } | Check timer | | claimLockedTokens(roomId) | roomId: string | { txSignature } | Claim after expiry |
| Method | Parameters | Returns | Description | |--------|------------|---------|-------------| | getBalance() | none | { sol: number } | Check SOL balance | | isAutonomous() | none | boolean | Has signing wallet? | | getWebSocketUrl() | none | string | Get WS endpoint |
Don't poll. Subscribe.
Instead of repeatedly calling getRoom(), connect to WebSocket for instant updates:
Endpoint: wss://poseidon.cash/ws/trade-room
const { unsubscribe } = await client.subscribeToRoom(roomId, (event) => {
switch (event.type) {
case 'join':
console.log('Counterparty joined!');
break;
case 'offer':
console.log('Offer updated:', event.data.tokens);
break;
case 'confirm':
console.log('Confirmation received');
break;
case 'execute':
console.log('Swap complete! TX:', event.data.txSignature);
break;
case 'cancel':
console.log('Trade cancelled');
break;
}
});
...
安装 Poseidon OTC 后,可以对 AI 说这些话来触发它
Help me get started with Poseidon OTC
Explains what Poseidon OTC does, walks through the setup, and runs a quick demo based on your current project
Use Poseidon OTC to execute trustless P2P token swaps on Solana via the Poseidon OTC pr...
Invokes Poseidon OTC with the right parameters and returns the result directly in the conversation
What can I do with Poseidon OTC in my finance & investment workflow?
Lists the top use cases for Poseidon OTC, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/poseidon-otc/ 目录(个人级,所有项目可用),或 .claude/skills/poseidon-otc/(项目级)。重启 AI 客户端后,用 /poseidon-otc 主动调用,或让 AI 根据上下文自动发现并使用。
Poseidon OTC 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Poseidon OTC 可免费安装使用。请查阅仓库了解许可证信息。
Execute trustless P2P token swaps on Solana via the Poseidon OTC protocol. Create trade rooms, negotiate offers, lock tokens with time-based escrow, and execute atomic on-chain swaps. Supports agent-to-agent trading with real-time WebSocket updates.
Poseidon OTC 属于「Finance & Investment」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my finance & investment tasks using Poseidon OTC
Identifies repetitive steps in your workflow and sets up Poseidon OTC to handle them automatically