feat(polymarket): Polymarket prediction market trading#59
Draft
AkshatGada wants to merge 2 commits intomainfrom
Draft
feat(polymarket): Polymarket prediction market trading#59AkshatGada wants to merge 2 commits intomainfrom
AkshatGada wants to merge 2 commits intomainfrom
Conversation
Add polymarket trading commands (approve, clob-buy, sell, markets, proxy-wallet, set-key, orders, cancel, positions) as a yargs CommandModule following the new src/commands/*.ts structure. - src/commands/polymarket.ts: all 10 subcommands - src/lib/polymarket.ts: Gamma API, CLOB client, proxy wallet helpers - src/lib/storage.ts: add savePolymarketKey + loadPolymarketKey - src/index.ts: register polymarketCommand - package.json: add @polymarket/clob-client, @polymarket/sdk, ethers5 - skills/POLYMARKET.md: full reference doc Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds full Polymarket prediction market trading support to the Polygon Agent CLI. Agents can browse markets, place limit and market orders on the Polymarket CLOB, manage positions, and handle the on-chain approval flow — all through the existing CLI and smart wallet infrastructure.
Architecture
Uses a 3-address system: the Sequence ecosystem wallet funds a Polymarket proxy wallet (derived via CREATE2 from the builder EOA), which holds USDC.e and outcome tokens. CLOB orders are signed by the EOA with
signatureType=POLY_PROXY. The proxy wallet factory routes all on-chain calls.Commands
polymarket marketspolymarket market <conditionId>polymarket set-key <privateKey>polymarket proxy-walletpolymarket approvepolymarket clob-buy <conditionId> <outcome> <amount>polymarket sell <conditionId> <outcome> <shares>polymarket positionspolymarket orderspolymarket cancel <orderId>Key Features
dapp-clienttransactionsPOLYMARKET.md,polymarket-skill.md) for LLM agent guidance