Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

pear-protocol

БесплатноЗапускает вложенные скриптыНе проверен

Pear Protocol pair/basket trading on Hyperliquid — headless agent-wallet auth (SIWE), V3 gateway REST + Orchard MCP server: markets, pair ratios, positions…

Starchild-ai-agentот Starchild-ai-agent★ 34 звезды на GitHub

Об этом скилле

🍐 Pear Protocol — Headless (agent wallet)

Pair/basket trading on top of Hyperliquid: open a long and a short leg as one synthetic position. This skill uses HEADLESS auth only — the agent's own Privy wallet signs a SIWE login against the V3 gateway; no browser, no OAuth, no user interaction. Works out of the box for any Starchild agent.

Endpoints

  • V3 gateway (REST): https://pro-gateway.pearprotocol.io
  • Orchard MCP: https://mcp.pearprotocol.io/mcp (streamable HTTP, stateless — accepts x-api-key directly; docs: https://docs.pear.garden)

Auth — scripts/gateway.py (use this, don't hand-roll curl)

python3 skills/pear-protocol/scripts/gateway.py login        # SIWE login w/ agent wallet, caches tokens
python3 skills/pear-protocol/scripts/gateway.py status       # identity + token validity
python3 skills/pear-protocol/scripts/gateway.py ensure-key   # mint PEAR_API_KEY into .env (once)
python3 skills/pear-protocol/scripts/gateway.py markets --limit 15
python3 skills/pear-protocol/scripts/gateway.py get /trade-accounts
python3 skills/pear-protocol/scripts/gateway.py post <path> '<json>'   # writes; auto Bearer

Flow: POST /auth/nonce {address} → wallet.wallet_sign(message) (EIP-191; gateway accepts the smart-wallet address even though personal_sign recovers to the underlying EOA — no EIP-1271 issue) → POST /auth/login {method:"wallet",address,signature} → accessToken (JWT ~15 min, auto-refresh/re-login). Tokens cached in workspace/.pear/gateway_tokens.json (0600). Single-flight nonce→login: concurrent nonce requests rotate the nonce and 401 the earlier signature.

Which credential for which call

Call type Auth Notes
Gateway reads (markets, funding) x-api-key: $PEAR_API_KEY persistent, read scope
Gateway writes (orders, trade-accounts) Authorization: Bearer … api_key → 403; gateway.py auto-refreshes
Account-scoped calls + x-trade-account-id: <id> mandatory once >1 account
MCP server x-api-key directly gateway wallet Bearer is REJECTED on MCP (different token type)
  • GET /markets REQUIRES ?connector=hyperliquid (291 markets: price, funding, OI, 24h vol/change).

API-key scopes gate the MCP tool surface

POST /api-keys (Bearer) body {"label": "...", "scope": "read"|"read_write"} (field is label NOT name; raw key returned ONCE). Read key → 16 analytics/account tools. read_write → 32 tools, adding trading: plan/execute pairs for open_basket, close_basket, set_position_tpsl, rebalance_position, adjust_position, enable_auto_rebalance, plus sync_account, cancel_pending_order, manage_saved_basket.

Convention: store the read key as PEAR_API_KEY and (if trading) a read_write key as PEAR_API_KEY_RW in workspace/.env. For MCP trading, export PEAR_API_KEY=$PEAR_API_KEY_RW before calling pear_mcp.py.

MCP client — scripts/pear_mcp.py

python3 skills/pear-protocol/scripts/pear_mcp.py status
python3 skills/pear-protocol/scripts/pear_mcp.py list
python3 skills/pear-protocol/scripts/pear_mcp.py call <tool> '<json-args>'

Auto-uses PEAR_API_KEY from env/.env (x-api-key header). Read tools: get_position(+history), discover_assets, list_baskets, search_prediction_markets, get_leaderboard, list_trade_accounts, get_account_summary, get_fee_quote, get_tca, list_pending_orders, etc.

Trade account (Hyperliquid) — REQUIRED before any execute_*

One-time setup per agent (the connected account id is returned at step 3; keep it in .pear/trade_account.json):

  1. Generate keypair (eth_account.Account.create()) → save to .pear/hl_signer.json (0600).
  2. Approve as HL agent wallet — user-signed approveAgent action, EIP-712 domain HyperliquidSignTransaction (chainId 421614), types HyperliquidTransaction:ApproveAgent [hyperliquidChain, agentAddress, agentName, nonce] — signed by the Privy master via wallet service /agent/sign-typed-data (same pattern as hyperliquid skill's sign_user_action). Submit to POST api.hyperliquid.xyz/exchange with signatureChainId: "0x66eee" (used even on Mainnet — the hyperliquidChain field selects the network; use that). 42161 / 0xa4b1 is also accepted and was verified working — the real requirement is that signatureChainId exactly matches the domain chainId used when signing. Verify with info {"type":"extraAgents","user":<master>}.
  3. POST /trade-accounts (Bearer) — EXACT payload (validation errors only show details when connector is present): {"alias": "...", "connector": "hyperliquid", "exchangeIdentifier": <master addr>, "credentials": {"signer_key": <signer priv, snake_case!>}, "metadata": {"agentWalletAddress": <signer addr>, "isSubaccount": false, "mainAccountAddress": <master addr>}} → 201 with account.id.

Funds stay under the master HL account; signer trades, can't withdraw.

  1. Approve Pear's builder fee (REQUIRED — executions fail without it).
Полный SKILL.md на GitHub

Установить pear-protocol в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

logo.pngscripts/gateway.pyscripts/pear_mcp.pyscripts/preflight.py

FAQ

Что делает скилл pear-protocol?

Pear Protocol pair/basket trading on Hyperliquid — headless agent-wallet auth (SIWE), V3 gateway REST + Orchard MCP server: markets, pair ratios, positions, orders, and trade execution. Use when the user wants to pair trade (long one asset / short another), check pair ratios, correlation or funding, or manage Pear positions (e.g. long BTC short ETH, check my Pear positions, find trending pairs).

Как установить скилл pear-protocol?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл pear-protocol запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить pear-protocol с