Recover USDC and prediction market positions from Polymarket smart contract wallets (Proxy & Safe). Sell positions, redeem winnings, and withdraw funds directly.
Polymarket Wallet Recovery Tools
Recover funds stuck in Polymarket smart contract wallets. If you've lost access to your Polymarket account or have funds trapped in proxy/safe wallets, these tools can help you retrieve your USDC and positions.
What This Solves
Polymarket uses smart contract wallets internally. When you create an account:
- Email/Magic accounts use Proxy Wallets
- Browser wallets (MetaMask, Coinbase Wallet, Rainbow, etc.) use Safe Wallets
- You lose access to your Polymarket account
- The website is unavailable
- You want to withdraw directly without using the UI
- You have unresolved winning positions that need redemption
Features
- Wallet Discovery: Automatically finds all wallets (EOA, Proxy, Safe) associated with your private key
- Position Scanning: Detects all prediction market positions with balances
- Market Selling: Sells active positions at market price
- Position Redemption: Redeems winning positions from resolved markets
- USDC Withdrawal: Withdraws all USDC from smart contract wallets to your EOA
Prerequisites
- Bun
- A Polygon RPC URL (Alchemy, Infura, or other provider)
- Your wallet's private key
Quick Start
- Clone the repository:
git clone https://github.com/0-don/polymarket-wallet-recovery.git
cd polymarket-wallet-recovery
- Install dependencies:
bun install
- Configure environment:
cp .env.example .env
Edit .env:
PK=yourprivatekey_here # Ethereum private key
RPCURL=https://polygon-mainnet.g.alchemy.com/v2/YOURKEY # Polygon RPC URL
Get a free Polygon RPC URL at alchemy.com/polygon.
- Run the recovery script:
bun run sell
What the Script Does
- Discovers wallets - Finds your EOA, Proxy wallet, and Safe wallet addresses
- Shows balances - Displays USDC balance in each wallet
- Cancels buy orders - Cancels any open buy orders (sells are kept)
- Sells positions - Market sells all active prediction positions
- Redeems winnings - Claims payouts from resolved markets
- Withdraws USDC - Transfers all USDC to your EOA wallet
Configuration
Edit wallet-config.ts to enable/disable operations per wallet type:
export const walletConfig = {
EOA: { marketSell: true, redeem: true, ... },
Proxy: { marketSell: true, redeem: true, withdraw: true, ... },
Safe: { marketSell: true, redeem: true, withdraw: true, ... },
}
Wallet Types Explained
| Wallet Type | Created By | Can Trade on CLOB | Notes | | ----------- | ----------------- | ----------------- | ------------------------------ | | EOA | You | Yes | Your main wallet | | Proxy | Email/Magic login | No\* | Requires MagicLink for trading | | Safe | Browser wallet | Yes | Modified Gnosis Safe |
\*Proxy wallets can sell/redeem but cannot place new orders without MagicLink authentication.
Important Notes
- Always test with a small amount first
- Keep your private key secure - never share it
- This tool requires MATIC for gas fees
- Positions may have slippage when market selling
License
MIT