
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
pmarket-cli
Advanced tools
Command line interface for Polymarket.
Requires Node.js 22.0.0 or higher
npm i pmarket-cli -g
This is the most common issue! Polymarket uses USDC.e (bridged USDC), NOT native USDC.
| Token | Contract Address | Works with Polymarket? |
|---|---|---|
| USDC.e (Bridged) | 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 | ✅ YES |
| USDC (Native) | 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 | ❌ NO |
If you have native USDC, you need to swap it for USDC.e on a DEX like Uniswap or QuickSwap.
You also need a small amount of MATIC for gas fees on Polygon.
Ensure you have USDC.e in your wallet (see Prerequisites above)
Initialize with your private key:
pmarket-cli -i YOUR_PRIVATE_KEY
How to export your MetaMask private key
pmarket-cli -a 500
This sets allowance for all three Polymarket contracts:
That's it! The tool will:
https://polygon-rpc.com) by defaultIf you want to see or regenerate your API keys:
pmarket-cli -k
The credentials are automatically saved to ~/.pmarket-cli/credentials.json.
Fetch fresh market data and update the local cache:
pmarket-cli -r
Search for markets matching a filter. Uses cached data (refreshes automatically if cache is expired).
pmarket-cli -l "Bitcoin"
pmarket-cli -b <token_id> <size> <price>
Example: Buy 60 shares at price $0.50:
pmarket-cli -b 12110463059584809904811790486163860991533989713640269122405796144537637099628 60 0.5
pmarket-cli -s <token_id> <size> <price>
Example: Sell 60 shares at price $0.50:
pmarket-cli -s 12110463059584809904811790486163860991533989713640269122405796144537637099628 60 0.5
Display your current token positions with P&L:
pmarket-cli -p
Allow Polymarket's exchange contracts to spend your USDC.e:
pmarket-cli -a 500
This sets allowance for three contracts (required for all market types):
0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E (regular markets)0xC5d563A36AE78145C45a50134d48A1215220f80a (neg_risk markets)0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296 (neg_risk markets)Note: The command includes delays between transactions to avoid public RPC rate limits.
pmarket-cli -o <token_id>
pmarket-cli -c
Claim USDC.e from resolved markets where you hold winning positions:
pmarket-cli -w
This automatically:
pmarket-cli -k
pmarket-cli -l "Oscar"
Response
[
{
yes: {
token_id: '32690616433410387308307813339600971589831744601462134742731346664328487681674',
outcome: 'Yes',
price: 0.645,
winner: false
},
no: {
token_id: '93520364131545158991271066783085167796254018656458248205265557269588037162187',
outcome: 'No',
price: 0.355,
winner: false
},
question: "Will 'Sing Sing' be nominated for Oscar for Best Picture?"
},
...
]
Found 14 market(s). Use -r flag to refresh cache.
pmarket-cli -b 12110463059584809904811790486163860991533989713640269122405796144537637099628 60 0.5
Response
{
errorMsg: '',
orderID: '0x6f89228a046c2cda1beb604599bda10c6acab735e2d8fdd7208754575f88dae0',
status: 'live',
success: true
}
pmarket-cli -s 12110463059584809904811790486163860991533989713640269122405796144537637099628 60 0.5
Response
{
"success": true,
"errorMsg": "",
"orderID": "0x556d3864c64d851462b2f378f5e6dcec7d31ba1632dfe44bfdcaa3cc685b45cc",
"status": "matched"
}
pmarket-cli -p
Response
Fetching positions for 0x1234...
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ CURRENT POSITIONS │
├──────────────────────────────────────────────────────────────┬────────┬──────────┬──────────┬──────────┬────────┤
│ Market │ Side │ Size │ Price │ Value │ P&L │
├──────────────────────────────────────────────────────────────┼────────┼──────────┼──────────┼──────────┼────────┤
│ Will Bitcoin reach $100k by end of 2024? │ Yes │ 100.00 │ $0.65 │ $65.00 │ +$5.00 │
│ Will ETH flip BTC? │ No │ 50.00 │ $0.80 │ $40.00 │ -$2.00 │
├──────────────────────────────────────────────────────────────┴────────┴──────────┴──────────┼──────────┼────────┤
│ TOTAL │ $105.00 │ +$3.00 │
└─────────────────────────────────────────────────────────────────────────────────────────────┴──────────┴────────┘
2 position(s) found.
pmarket-cli -o 12110463059584809904811790486163860991533989713640269122405796144537637099628
Response
{
market: '0x6f662d9d965d0b01d08ee284a58e1dd866296729801c0cdc6867459760bd33ab',
asset_id: '12110463059584809904811790486163860991533989713640269122405796144537637099628',
bids: [
{ price: '0.03', size: '100' },
{ price: '0.45', size: '200' },
...
],
asks: [
{ price: '0.99', size: '1000' },
{ price: '0.97', size: '100' },
...
]
}
pmarket-cli -w
Response
Fetching redeemable positions for 0x1234...
Found 1 resolved market(s) with redeemable positions:
Will Bitcoin reach $100k by end of 2024?
Condition: 0xabc123...
Shares: Yes: 100.00
Redeeming positions...
Redeeming: Will Bitcoin reach $100k by end of 2024?
tx submitted: 0xdef456...
Confirmed (standard market)
Redeemed 1/1 market(s). USDC.e has been returned to your wallet.
All configuration is stored in ~/.pmarket-cli/:
| File | Purpose |
|---|---|
config.json | Your private key |
credentials.json | Auto-generated API credentials |
cache.db | SQLite cache for market data |
Note: Ensure you have at least 1GB of free disk space for the market cache.
You can override the config directory using the PMARKET_CONFIG_DIR environment variable:
PMARKET_CONFIG_DIR=/path/to/custom/dir pmarket-cli -l "Bitcoin"
npm install
npm run build
npm test
node dist/main.js -l "Bitcoin"
src/
├── main.ts # Entry point
├── program.ts # CLI argument parsing
├── services/
│ ├── config.service.ts # Configuration management
│ ├── polymarket.service.ts # Polymarket API interactions
│ ├── contract.service.ts # Ethereum contract interactions
│ └── cache.service.ts # SQLite caching
└── strategy/
├── context.ts # Strategy pattern context
├── list-strategy.ts # List markets command
├── buy-strategy.ts # Buy command
├── sell-strategy.ts # Sell command
├── redeem-strategy.ts # Redeem winnings command
└── ...
Please use the Issue Tracker to report any issues or bugs.
This project is licensed under the MIT License.
FAQs
CLI tool to trade on Polymarket
The npm package pmarket-cli receives a total of 11 weekly downloads. As such, pmarket-cli popularity was classified as not popular.
We found that pmarket-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.