首页龙虾技能列表 › Poseidon OTC — 技能工具

🔱 Poseidon OTC — 技能工具

v1.0.0

[自动翻译] Execute trustless P2P token swaps on Solana via the Poseidon OTC protocol. Create trade rooms, negotiate offers, lock tokens with time-based escrow, a...

1· 1,545·0 当前·0 累计
by @romovow (Romovow)·MIT-0
下载技能包 项目主页
License
MIT-0
最后更新
2026/2/26
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
medium confidence
The skill's requested permissions and runtime actions are consistent with a Solana OTC trading client, but it legitimately requires a hot wallet private key so you should only provide a burner key you control and understand the risk of autonomous execution.
评估建议
This skill appears to do what it claims, but it requires a wallet private key (POSEIDON_BURNER_KEY). Supplying that key gives the skill the ability to sign and send on-chain transactions from that wallet — do not use your main or well‑funded keys. Suggested precautions before installing: (1) only provide a dedicated burner/private key with minimal funds, (2) prefer link/manual mode instead of autonomous mode when possible, or set disable-model-invocation (if platform allows) to prevent automated...
详细分析 ▾
用途与能力
Name/description (P2P OTC swaps on Solana) align with the code and instructions: the code performs Solana RPC calls, builds program transactions against the declared OTC program ID, and calls a Poseidon backend (poseidon.cash). Requiring a burner private key is expected for autonomous on-chain actions.
指令范围
SKILL.md and README describe creating rooms, updating offers, deposit/confirm flows, and atomic execute — the included code implements these flows, signs auth messages, posts to the Poseidon API, and sends on-chain transactions. The instructions do not ask the agent to read unrelated system files or exfiltrate arbitrary data.
安装机制
No install script is present (instruction-only with included TypeScript source). Dependencies listed are standard Solana/web3 and crypto libs. Nothing is downloaded from untrusted URLs or redirected through shorteners in the provided manifest.
凭证需求
The skill declares POSEIDON_BURNER_KEY as the primary credential and uses it to build Keypair, sign messages, and send transactions — this is proportionate to autonomous trading. The code also reads POSEIDON_API_URL, POSEIDON_RPC_URL, and POSEIDON_FRONTEND_URL (with safe defaults), but the registry's required env listing only included POSEIDON_BURNER_KEY; that small mismatch is non-malicious but should be noted. Crucially, providing POSEIDON_BURNER_KEY hands the skill full control of that wallet (it can move funds and sign arbitrary txs).
持久化与权限
always:false (good). The skill is allowed to be invoked autonomously (disable-model-invocation:false) — combined with a burner private key this grants the skill capability to conduct transactions without interactive confirmation. This is expected for an autonomous OTC client but is a high-risk configuration unless you restrict the key to a small-funded burner wallet or disable autonomous invocation.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/2/2

Initial public release of Poseidon OTC Skill. - Execute trustless peer-to-peer (P2P) token swaps on Solana using time-based escrow. - Create and manage trade rooms, set multi-token offers, and execute atomic swaps fully on-chain. - Supports agent-to-agent trading, room negotiation, customizable lockups, and protected OTC transactions. - Real-time trade updates via WebSocket; reduced need for polling. - Detailed API documentation and quick start guide for seamless integration.

● 无害

安装命令 点击复制

官方npx clawhub@latest install poseidon-otc
镜像加速npx clawhub@latest install poseidon-otc --registry https://cn.clawhub-mirror.com

技能文档

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.

When to Use This Skill

  • Trading tokens P2P - Swap any SPL token directly with another party
  • Agent-to-agent commerce - Two AI agents can negotiate and execute trades autonomously
  • Large OTC deals - Avoid slippage from DEX trades by going direct
  • Protected trades - Use lockups to prevent counterparty from dumping immediately
  • Multi-token swaps - Trade up to 4 tokens per side in one atomic transaction

Quick Start for Agents

1. Initialize (requires wallet)

import { PoseidonOTC } from 'poseidon-otc-skill';

const client = new PoseidonOTC({ burnerKey: process.env.POSEIDON_BURNER_KEY // base58 private key });

2. Create a Trade Room

const { roomId, link } = await client.createRoom();
// Share link with counterparty or another agent

3. Wait for Counterparty & Set Offer

// 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 }]);

4. Confirm & Execute

// 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);

Complete Trade Flow

┌─────────────────────────────────────────────────────────────────┐
│                        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 │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

API Reference

Room Management

MethodParametersReturnsDescription
createRoom(options?){ inviteCode?: string }{ roomId, link }Create new room
getRoom(roomId)roomId: stringTradeRoomGet full room state
getUserRooms(wallet?)wallet?: stringTradeRoom[]List your rooms
joinRoom(roomId, inviteCode?)roomId, inviteCode?{ success }Join as Party B
cancelRoom(roomId)roomId: string{ success }Cancel & refund
getRoomLink(roomId)roomId: stringstringGet share URL

Trading

MethodParametersReturnsDescription
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

Lockups (Anti-Dump)

MethodParametersReturnsDescription
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

Utility

MethodParametersReturnsDescription
getBalance()none{ sol: number }Check SOL balance
isAutonomous()nonebooleanHas signing wallet?
getWebSocketUrl()nonestringGet WS endpoint

WebSocket Real-Time Updates

Don't poll. Subscribe.

Instead of repeatedly calling getRoom(), connect to WebSocket for instant updates:

Endpoint: wss://poseidon.cash/ws/trade-room

Subscribe to Room Events

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;
  }
});

Event Types

EventWhen It Fires
full-stateImmediately on subscribe - complete room state
joinCounterparty joined the room
offerSomeone updated their offer
confirmSomeone confirmed (first or second)
lockupLockup proposed or accepted
executeSwap executed successfully
cancelRoom was cancelled
terminatedRoom expired or terminated
errorSomething went wrong

WebSocket Actions (Faster than HTTP)

await client.sendOfferViaWs(roomId, tokens);      // Update offer
await client.sendConfirmViaWs(roomId, 'first');   // Confirm
await client.sendLockupProposalViaWs(roomId, 3600); // Propose 1hr lock
await client.sendAcceptLockupViaWs(roomId);       // Accept lock
await client.sendExecuteViaWs(roomId);            // Execute swap

Agent-to-Agent Trading Example

Scenario: Agent A wants to sell 1000 USDC for 5 SOL to Agent B

Agent A (Seller):

// 1. Create room
const { roomId } = await client.createRoom();

// 2. Set offer (1000 USDC) await client.updateOffer(roomId, [{ mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', amount: 1000000000, // 1000 USDC decimals: 6 }]);

// 3. Share roomId with Agent B via your inter-agent protocol // 4. Subscribe to updates await client.subscribeToRoom(roomId, async (event) => { if (event.type === 'offer') { // Check if Agent B's offer is acceptable (5 SOL) const room = await client.getRoom(roomId); if (room.partyBTokenSlots?.[0]?.amount >= 5 * 1e9) { await client.confirmTrade(roomId, 'first'); } } if (event.type === 'confirm' && room.partyBFirstConfirm) { await client.confirmTrade(roomId, 'second'); } });

Agent B (Buyer):

// 1. Join the room
await client.joinRoom(roomId);

// 2. Set offer (5 SOL) await client.updateOffer(roomId, [{ mint: 'So11111111111111111111111111111111111111112', // wSOL amount: 5000000000, // 5 SOL decimals: 9 }]);

// 3. Subscribe and react await client.subscribeToRoom(roomId, async (event) => { if (event.type === 'confirm') { const room = await client.getRoom(roomId); if (room.partyAFirstConfirm && !room.partyBFirstConfirm) { await client.confirmTrade(roomId, 'first'); } if (room.partyASecondConfirm && room.partyBSecondConfirm) { // Both confirmed, execute! await client.executeSwap(roomId); } } });

Common Token Mints

TokenMint AddressDecimals
USDCEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v6
USDTEs9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB6
wSOLSo111111111111111111111111111111111111111129
BONKDezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB2635

Environment Variables

POSEIDON_BURNER_KEY=  # Required for autonomous mode
POSEIDON_API_URL=https://poseidon.cash    # API endpoint (default: mainnet)
POSEIDON_RPC_URL=https://api.mainnet-beta.solana.com  # Solana RPC

Security Notes

  • Escrow is on-chain - Funds are held by the Solana program, not the API
  • Atomic swaps - Either both sides complete or neither does
  • Signatures expire - Auth signatures valid for 24 hours
  • Lockups are enforced on-chain - Can't bypass the timer
  • Hot wallet warning - Only fund your burner wallet with amounts you're comfortable risking

Program ID

Mainnet: AfiRReYhvykHhKXhwjhcsXFejHdxqYLk2QLWnjvvLKUN

Links

  • Website: https://poseidon.cash
  • Docs: https://docs.poseidon.cash
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务