{"id":47671970,"url":"https://github.com/estavadormir/polymarket-proxy-recovery","last_synced_at":"2026-04-02T13:00:31.676Z","repository":{"id":348445166,"uuid":"1198125517","full_name":"estavadormir/polymarket-proxy-recovery","owner":"estavadormir","description":"Recover funds from Polymarket proxy wallets (Magic/Google login accounts) you've lost access to","archived":false,"fork":false,"pushed_at":"2026-04-01T06:29:41.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-01T09:19:45.009Z","etag":null,"topics":["cryptocurrency","etherscan","magiclink","polymarket","usdc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/estavadormir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-01T06:23:58.000Z","updated_at":"2026-04-01T06:29:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/estavadormir/polymarket-proxy-recovery","commit_stats":null,"previous_names":["estavadormir/polymarket-proxy-recovery"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/estavadormir/polymarket-proxy-recovery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estavadormir%2Fpolymarket-proxy-recovery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estavadormir%2Fpolymarket-proxy-recovery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estavadormir%2Fpolymarket-proxy-recovery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estavadormir%2Fpolymarket-proxy-recovery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estavadormir","download_url":"https://codeload.github.com/estavadormir/polymarket-proxy-recovery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estavadormir%2Fpolymarket-proxy-recovery/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31306692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptocurrency","etherscan","magiclink","polymarket","usdc"],"created_at":"2026-04-02T13:00:19.899Z","updated_at":"2026-04-02T13:00:31.666Z","avatar_url":"https://github.com/estavadormir.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# polymarket-proxy-recovery\n\nGot locked out of your Polymarket account (the one you logged into with Google/Magic.link) and have winning positions sitting there? This repo helps you get your money back.\n\n## What's this about?\n\nWhen you sign up for Polymarket with Google or email, Magic.link creates a **proxy wallet** for you. Your actual crypto lives in that proxy wallet, not in a regular wallet you control directly. If you lose access to your Polymarket account (banned, closed, two-Google-accounts issue, whatever), your funds are stuck in that proxy wallet.\n\n**But here's the thing** — you still own the private key that controls that proxy wallet. Magic.link lets you export it. Once you have that key, you can:\n\n1. **Recover USDC.e** (your cash balance) via Polymarket's built-in recovery tool\n2. **Redeem winning ERC-1155 positions** (resolved bets that paid out) using this script\n\nThis repo handles step 2 — redeeming winning positions that are sitting in your proxy wallet.\n\n## How the whole recovery flow works\n\n### Step 1: Get your private key\n\n1. Go to [reveal.magic.link/polymarket](https://reveal.magic.link/polymarket)\n2. Log in with the **same Google/email** you used on Polymarket\n3. It'll show you your private key — save it somewhere safe\n4. This key controls your **EOA** (Externally Owned Account), which in turn owns your proxy wallet\n\n### Step 2: Figure out your addresses\n\nYou have TWO addresses that matter:\n\n- **EOA address** — derived from the private key you just got. This is the \"owner\" of your proxy wallet. You can paste your private key into a tool like [etherscan address converter](https://etherscan.io/address/) or just run this script and it'll print it.\n- **Proxy wallet address** — this is where your Polymarket positions and USDC.e actually live. You can find it on [polygonscan](https://polygonscan.com) by looking at your EOA's transaction history, or check your Polymarket profile URL.\n\n### Step 3: Recover your USDC.e balance\n\nIf you have USDC.e sitting in your proxy wallet:\n\n1. Go to [matic-recovery.polymarket.com](https://matic-recovery.polymarket.com)\n2. Connect with the private key from Step 1\n3. Follow the prompts — it'll transfer your USDC.e to your EOA\n4. From there you can send it wherever you want\n\n### Step 4: Redeem winning positions (this script)\n\nIf you have **resolved, winning** ERC-1155 positions (bets that already settled in your favor), those tokens are still sitting in your proxy wallet. The recovery site doesn't handle these — you need to call `redeemPositions` on the CTF contract through the relayer.\n\nThat's what `redeem-proxy.ts` does.\n\n## Prerequisites\n\n- [Bun](https://bun.sh) runtime installed (`curl -fsSL https://bun.sh/install | bash`)\n- Your Magic.link private key (Step 1 above)\n- Builder API credentials from [polymarket.com/settings?tab=builder](https://polymarket.com/settings?tab=builder)\n- The **condition ID** of the market you want to redeem (more on this below)\n\n## Setup\n\n```bash\n# Clone the repo\ngit clone https://github.com/YOUR_USERNAME/polymarket-proxy-recovery.git\ncd polymarket-proxy-recovery\n\n# Install dependencies\nbun install\n\n# Copy the example env and fill in your values\ncp .env.example .env\n```\n\nEdit `.env` with your actual values (see `.env.example` for descriptions of each variable).\n\n## Usage\n\n```bash\nbun run redeem-proxy.ts\n```\n\nThe script will:\n1. Load your config from `.env`\n2. Build the `redeemPositions` calldata\n3. Send it through the Polymarket relayer as a PROXY transaction\n4. Wait for the transaction to be mined\n5. Print the transaction hash and Polygonscan link\n\nYour USDC.e payout lands in your **proxy wallet**. From there, use the [recovery site](https://matic-recovery.polymarket.com) to move it to your EOA.\n\n## How to find your Condition ID\n\nThe condition ID identifies which market you're redeeming. You can find it:\n\n- **From the Polymarket subgraph** — query your proxy wallet's positions\n- **From Polygonscan** — look at the ERC-1155 tokens held by your proxy wallet address, then trace back to the market\n- **From the market page URL** — some tools map slugs to condition IDs\n\nThe condition ID is a `bytes32` value (0x + 64 hex chars), like:\n```\n0x45ad8b8e5d5df8721e5d0d12f7aef50d3f715702bf2ce2c0d04575d47411fc93\n```\n\n## Important gotchas\n\n### Index Sets — pick the right side!\n\n- `INDEX_SETS=1` → redeems the **Yes / Up** side\n- `INDEX_SETS=2` → redeems the **No / Down** side\n\n**You MUST only redeem the winning side.** If you try to redeem the losing side, the transaction will succeed but you'll get `payout = 0`. The contract doesn't revert — it just gives you nothing. So double-check which side won before running.\n\n### The two-Google-accounts problem\n\nSome people accidentally created two Polymarket accounts with different Google accounts (personal vs work, etc). Make sure you're revealing the private key for the **correct** Google account — the one that actually has the positions.\n\n### Builder credentials\n\nYou need Builder API credentials even though your account might be closed. If you can still access [polymarket.com/settings?tab=builder](https://polymarket.com/settings?tab=builder), grab them from there. If you can't access the settings page at all, you might need to reach out to Polymarket support.\n\n### Payout goes to the proxy wallet\n\nWhen you redeem, the USDC.e lands in your **proxy wallet**, not your EOA. You'll need to use the [recovery site](https://matic-recovery.polymarket.com) one more time to sweep it out.\n\n### Gas\n\nThe relayer covers gas fees for proxy transactions, so you don't need POL/MATIC in your EOA.\n\n## How it works under the hood\n\nYour Polymarket proxy wallet is an [ERC-1167 minimal proxy](https://eips.ethereum.org/EIPS/eip-1167) contract. The owner (your EOA from Magic.link) can execute arbitrary calls through it via the Polymarket relayer.\n\nThis script:\n1. Encodes a `redeemPositions(collateralToken, parentCollectionId, conditionId, indexSets)` call targeting the CTF contract\n2. Wraps it in a proxy transaction signed by your EOA\n3. Sends it to the Polymarket relayer (`relayer-v2.polymarket.com`)\n4. The relayer submits it on-chain, executing through your proxy wallet\n\nKey contracts (Polygon mainnet):\n- **CTF (Conditional Tokens Framework):** `0x4D97DCd97eC945f40cF65F87097ACe5EA0476045`\n- **USDC.e (collateral):** `0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174`\n- **Proxy Factory:** `0xaB45c5A4B0c941a2F231C04C3f49182e1A254052`\n- **RelayHub:** `0xD216153c06E857cD7f72665E0aF1d7D82172F494`\n\n## Running tests\n\n```bash\nbun test\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festavadormir%2Fpolymarket-proxy-recovery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festavadormir%2Fpolymarket-proxy-recovery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festavadormir%2Fpolymarket-proxy-recovery/lists"}