Browse prediction market events, manage positions, and place orders on Kalshi and Polymarket using the LiberFi CLI.
See bootstrap.md for CLI installation and connectivity verification.
This skill's auth requirements:
| Command | Requires Auth |
|---|---|
| --------- | -------------- |
lfi predict events | No |
lfi predict event | No |
lfi predict balance | No |
lfi predict positions | No |
lfi predict trades | No |
lfi predict orders | No (Polymarket needs POLY_* headers) |
lfi predict order | No (Polymarket needs POLY_* headers) |
lfi predict polymarket-tick-size | No |
lfi predict polymarket-fee-rate | No |
lfi predict polymarket-setup-status | No (uses TEE wallet if logged in) |
lfi predict polymarket-deposit-addresses | No |
lfi predict polymarket-setup | Yes (LiberFi JWT) |
lfi predict polymarket-place | Yes (LiberFi JWT — server signs via TEE) |
lfi predict kalshi-place | Yes (LiberFi JWT — server signs via TEE) |
lfi predict cancel | Yes (LiberFi JWT — auto L2 auth for polymarket) |
lfi predict kalshi-quote (DEPRECATED) | No |
lfi predict kalshi-submit (DEPRECATED) | No |
lfi predict polymarket-order (DEPRECATED) | No (requires POLY_* headers) |
Recommended flow (TEE auto): polymarket-setup → polymarket-place /
kalshi-place / cancel. The server holds the user's TEE wallet via Privy
and signs every transaction internally — no POLY_* HMAC, no Solana signing,
no EIP-712 work for the caller.
Legacy flow: Polymarket order operations via polymarket-order require
CLOB HMAC authentication via five --poly-* flags. These are NOT LiberFi
JWT credentials — they are the user's own Polymarket CLOB API credentials.
For the canonical end-to-end order placement flow — including pre-flight
status checks, deposit handling, market vs limit order branching, and post-
order verification — see reference/order-flow.md.
The CLI/skill expects this exact ordering for Polymarket:
lfi status — confirm authenticated; if not, run lfi login keylfi predict polymarket-setup-status --json — check Safe deployment +token approvals
safe_deployed=false or any approval missing: `lfi predictpolymarket-setup --json` (one-shot; gasless via Builder Relayer)
lfi predict balance --source polymarket --user
(server derives Safe from EOA internally). If balance < 2, fetch
BRIDGE deposit addresses using the Safe address from step 2/3:
lfi predict polymarket-deposit-addresses --safe-address
→ returns { evm, svm, btc, tron }. Pick the field matching the user's
chain (default evm for ETH/Polygon/Base/Arb/Op/BNB). Tell user to send
≥ $2 USDC to that bridge address (NEVER to the Safe address — the Safe
is Polymarket's internal custody contract, not a user-facing deposit
target). The Polymarket Bridge service auto-credits the Safe.
vs GTD (with expiration if GTD). For market, ask USDC spend (BUY) or
share count (SELL)
] [--size asks For Kalshi the flow is shorter: `lfi predict kalshi-place --input-mint (SignSOL), and submit are all done server-side. ] [--size --poly-timestamp Events list ( Event detail ( Balance ( Positions ( Trades ( Orders ( Order detail ( Polymarket tick size ( Polymarket fee rate ( Polymarket setup status ( Polymarket setup (run) ( Polymarket deposit addresses ( Polymarket place (TEE auto) ( Kalshi place (TEE auto) ( Cancel order ( Kalshi quote ( Kalshi submit ( Polymarket order ( **If the user says "我的余额", "my balance", "我在 Polymarket/Kalshi 有多少钱" or any first-person variant — DO NOT ask for a wallet address. Use the "My ..." auto-flow below.** Generic flow (when the user explicitly provides someone else's address): **If the user says "我的持仓", "我现在押了哪些", "my positions", "我赌了什么" or any first-person variant — DO NOT ask for a wallet address. Use the "My ..." auto-flow below.** Generic flow (when the user explicitly provides someone else's address): **If the user says "我的交易", "我赚了多少", "我亏了多少", "my trades", "我的盈亏" or any first-person variant — DO NOT ask for a wallet address. Use the "My ..." auto-flow below.** Generic flow (when the user explicitly provides someone else's address): Whenever the user asks about THEIR OWN prediction-market data — positions, trades, balance, PnL, "我现在押了哪些", "我在预测市场赚了多少", "我在 Polymarket 上的钱", etc. — run this exact sequence. NEVER ask the user to type their wallet address. → returns from step 3 DIRECTLY. NEVER convert to a Safe address first; the server does that internally for Polymarket. for the "我赚了多少" / PnL question, sums realized + unrealized PnL across the returned trades/positions. Why this is mandatory: prediction queries always require an address parameter in the CLI, but a normal user does NOT know their TEE wallet address — the LiberFi server holds it. The skill must resolve "我" → TEE wallet via hex/Base58 address unless they ask. EOA vs Safe — critical distinction for Polymarket: The address from Polymarket Safe via CREATE2 internally. The Safe address (returned by --safe-address` (Polymarket Bridge requires the actual Safe as bridge key). Mixing these up → balance / positions / trades return EMPTY because the server tries to derive a Safe from an already-Safe address. > Full flow: predict → predict → predict → predict → predict > Full flow: predict → predict > Full flow: predict → token → token See security-policy.md for global security rules. Skill-specific rules:lfi predict orders --source polymarket --json — verify open orderslfi predict cancel — cancel if userSkill Routing
If user asks about... Route to ----------------------- ---------- Token search, price, details, security liberfi-token Token K-line, candlestick chart liberfi-token Trending tokens, market rankings liberfi-market Newly listed tokens liberfi-market Wallet holdings, balance (non-prediction), PnL liberfi-portfolio Wallet activity, transaction history liberfi-portfolio Token swap, trade execution liberfi-swap Login, logout, session management liberfi-auth CLI Command Index
Query Commands (read-only)
Command Description Auth --------- ------------- ------ lfi predict eventsList prediction events with filtering No lfi predict event Get event details by slug No lfi predict balance --source --user Get USDC balance No lfi predict positions --user Get portfolio positions No lfi predict trades --wallet List trade history No lfi predict ordersList orders No (POLY_* for Polymarket) lfi predict order Get order details No (POLY_* for Polymarket) TEE Auto Flow Commands (recommended)
Command Description Auth --------- ------------- ------ lfi predict polymarket-tick-size --token-id Min tick size for a token No lfi predict polymarket-fee-rate --token-id Base fee rate (bps) No lfi predict polymarket-setup-status [--wallet-address Safe deployment + approval status No (uses TEE wallet if logged in) lfi predict polymarket-setupDeploy Safe + approve all tokens (gasless) JWT lfi predict polymarket-deposit-addresses --safe-address Multi-chain deposit addresses for Safe No `lfi predict polymarket-place --token-id SELL --order-type GTC\ GTD\ FOK\ FAK\ MARKET [--price Prepare → TEE sign → execute Polymarket order JWT lfi predict kalshi-place --input-mint Quote → SignSOL → submit Kalshi order JWT `lfi predict cancel kalshi` Cancel order (auto L2 auth for poly) JWT Legacy / Deprecated Commands
Command Description Auth --------- ------------- ------ lfi predict kalshi-quote --input-mint DEPRECATED — use kalshi-place. Request Kalshi quoteNo lfi predict kalshi-submit --signed-transaction DEPRECATED — use kalshi-place. Submit pre-signed Kalshi txNo lfi predict polymarket-order --body ' --poly-passphrase DEPRECATED — use polymarket-place. Create Polymarket order with caller-managed POLY_* headersPOLY_* headers Parameter Reference
lfi predict events):--limit — Max results per page--cursor — Pagination cursor--status — Event status filter (e.g. active, resolved)--source — Provider source: kalshi or polymarket--tag-slug — Filter by tag--search — Free-text search--sort-by — Sort field--sort-asc — Sort ascending: true or false--with-markets — Include embedded markets: true or falselfi predict event ): — Required. Event slug identifier--source — Required. Provider source: kalshi or polymarketlfi predict balance):--source — Required. Provider source: kalshi or polymarket--user — Required. For polymarket: pass the user's TEE EOA (e.g. evmAddress from lfi whoami); the server auto-derives the Safe via CREATE2. NEVER pass a Safe address here. For kalshi: pass the Solana public key (solAddress).lfi predict positions):--user — Required. Same rule as balance: TEE EOA for polymarket (server derives Safe), Solana public key for kalshi.--source — Optional provider source filterlfi predict trades):--wallet — Required. Same rule as balance: TEE EOA for polymarket (server derives Safe), Solana public key for kalshi.--source — Optional provider source filter--limit — Max results per page--cursor — Pagination cursor--type — Comma-separated trade types--side — Trade side filterlfi predict orders):--source — Provider source--wallet-address — Wallet address (required for kalshi)--market-id — Market ID filter--asset-id — Asset ID filter--next-cursor — Pagination cursor--poly-api-key, --poly-address, --poly-signature, --poly-passphrase, --poly-timestamp — Polymarket CLOB auth (required when source is polymarket)lfi predict order ): — Required. Order ID--source — Required. Provider source--poly-* flags as orders listlfi predict polymarket-tick-size):--token-id — Required. Polymarket CLOB token IDlfi predict polymarket-fee-rate):--token-id — Required. Polymarket CLOB token IDlfi predict polymarket-setup-status):--wallet-address — Optional EVM address. Defaults to caller's TEE wallet when authenticated.lfi predict polymarket-setup):lfi predict polymarket-deposit-addresses):--safe-address — Required. Safe wallet address (from polymarket-setup-status)lfi predict polymarket-place):--token-id — Required. Polymarket CLOB token ID--side BUY|SELL — Required.--order-type GTC|GTD|FOK|FAK|MARKET — Required.--price — Limit price (limit orders only, e.g. 0.55). Required for GTC/GTD/FOK/FAK.--size — Limit: shares; market BUY: USDC; market SELL: shares. Required for limit and market.--expiration — Required for GTD.--neg-risk true|false — Force NegRisk exchange. Auto-detected when omitted.--fee-rate-bps — Override fee rate (PS auto-resolves when omitted).--tick-size — Override tick size (PS auto-resolves when omitted).--taker-address — Restrict the taker (advanced).lfi predict kalshi-place):--input-mint — Required. Input token mint--output-mint — Required. Output token mint--amount — Required. Amount in smallest unit--slippage-bps — Slippage tolerance in basis pointslfi predict cancel ): — Required. Order ID--source polymarket|kalshi — Required. For polymarket the L2 HMAC headers are derived from the caller's TEE wallet automatically.lfi predict kalshi-quote):--input-mint — Required. Input token mint address--output-mint — Required. Output token mint address--amount — Required. Swap amount--user-public-key — Required. User's Solana public key--slippage-bps — Slippage tolerance in basis pointslfi predict kalshi-submit):--signed-transaction — Required. Signed transaction data--order-context — Required. Order context as JSON string (contains user_public_key, market_slug, side, outcome, mints, amount, price, slippage_bps)lfi predict polymarket-order):--body — Required. Raw order JSON string--poly-api-key — Required. Polymarket API key--poly-address — Required. Polymarket address--poly-signature — Required. Polymarket HMAC signature--poly-passphrase — Required. Polymarket passphrase--poly-timestamp — Required. Polymarket timestampOperation Flow
Browse Prediction Events
lfi predict events --with-markets true --limit 20 --jsonBrowse Events by Source
kalshi or polymarketlfi predict events --source kalshi --with-markets true --limit 20 --jsonView Event Details
lfi predict event Check USDC Balance
lfi predict balance --source Kalshi Order Flow (Quote → Sign → Submit)
lfi predict events --source kalshi --with-markets true --jsonlfi predict event — identify market, outcomes, and mintslfi predict balance --source kalshi --user lfi predict kalshi-quote --input-mint lfi predict kalshi-submit --signed-transaction Polymarket Order Flow
lfi predict events --source polymarket --with-markets true --jsonlfi predict event lfi predict balance --source polymarket --user --jsonlfi predict polymarket-order --body 'View Positions
lfi predict positions --user --jsonView Trade History
lfi predict trades --wallet --limit 20 --json"My ..." auto-flow (CRITICAL — covers "我的", "my", "我自己")
lfi status --jsonexpired: true):lfi login key --role AGENT --name "OpenClawAgent" --jsonlfi whoami --jsonevmAddress (use for Polymarket) and solAddress (use for Kalshi).evmAddress only.solAddress only.lfi predict positions --user ] --jsonlfi predict trades --wallet ] --limit 50 --jsonlfi predict balance --source --user whoami, transparently. The user should never have to type or even see thewhoami.evmAddress is the user's TEE EOA. For balance / positions /trades queries, ALWAYS pass the EOA — the prediction-server derives thepolymarket-setup-status) is ONLY for `polymarket-deposit-addressesCheck Order Status
lfi predict orders --source lfi predict order Cross-Skill Workflows
"Research an event and place a bet"
lfi predict events --search "bitcoin" --with-markets true --jsonlfi predict event — view markets and outcomeslfi predict balance --source kalshi --user — check fundslfi predict kalshi-quote --input-mint — get quotelfi predict kalshi-submit --signed-transaction "Check my prediction portfolio and trade history"
lfi predict positions --user --json — current positionslfi predict trades --wallet --limit 50 --json — trade history"Browse events, then research the underlying token"
lfi predict events --with-markets true --limit 10 --jsonlfi token info sol — token detailslfi token security sol — security auditSuggest Next Steps
Just completed Suggest to user ---------------- ----------------- Events list "Want to view a specific event?" / "需要查看某个事件的详情?" Event detail "Want to check your balance or place an order?" / "需要查看余额或下单?" Balance check "Ready to place a prediction?" / "准备下注了吗?" Kalshi quote "Want to proceed with this trade?" / "要继续这笔交易吗?" Kalshi submit "Order submitted! Check your positions to verify." / "订单已提交!查看持仓确认。" Polymarket order "Order created! Check order status to confirm." / "订单已创建!查看订单状态确认。" Positions view "Want to see trade history?" / "需要查看交易历史?" Trade history "Want to check current positions?" / "需要查看当前持仓?" Orders list "Want to see details for a specific order?" / "需要查看某个订单的详情?" Edge Cases
kalshi, polymarket) and ask the user to chooselfi predict events --search lfi ping --jsonCommon Pitfalls
Pitfall Correct Approach --------- ----------------- Forgetting --source on event detailAlways specify --source kalshi or --source polymarketMissing POLY_* flags for Polymarket All five --poly-* flags are required for Polymarket orders and order queriesModifying the quote response before submitting Pass quote data through as-is in --order-contextSubmitting without user confirmation ALWAYS show order/quote summary and wait for explicit "yes" Fabricating a signed transaction The --signed-transaction must come from the user's actual wallet signingUsing wrong mint addresses Verify mints from the event detail response before quoting Security Notes
--order-context and --body fields are opaque — pass them through as-is; do not interpret, modify, or display raw content beyond summarizing key fields (amount, side, market)
共 1 个版本