Skip to content

Comments

feat: accept Polymarket URLs as input#12

Open
guneysol wants to merge 1 commit intoPolymarket:mainfrom
guneysol:feat/accept-polymarket-urls
Open

feat: accept Polymarket URLs as input#12
guneysol wants to merge 1 commit intoPolymarket:mainfrom
guneysol:feat/accept-polymarket-urls

Conversation

@guneysol
Copy link

@guneysol guneysol commented Feb 24, 2026

Summary

  • markets get and events get now accept full Polymarket URLs in addition to numeric IDs and slugs
  • Extracts the correct slug automatically (market slug for markets get, event slug for events get)
  • Handles scheme variations, www., query strings, fragments, and trailing slashes

Motivation

Agents and scripts commonly receive Polymarket URLs from users. This removes the need to manually extract slugs before passing them to the CLI.

Test plan

  • 22 unit tests covering URL parsing and resolve_id logic
  • 2 integration tests verifying URL acceptance
  • Backward compatible — plain slugs and numeric IDs work as before

Note

Low Risk
Small, isolated CLI input-parsing change with thorough unit/integration test coverage; main risk is edge-case misparsing leading to fetching the wrong slug.

Overview
markets get and events get now accept full Polymarket URLs in addition to numeric IDs and slugs by introducing parse_polymarket_url/resolve_id and routing lookups based on the resolved ResolvedId.

URL handling normalizes scheme/www, strips query/fragment/trailing slashes, and picks the market slug for markets get (when present) vs the event slug for events get; coverage is added via new unit tests in commands/mod.rs plus integration tests ensuring URLs aren’t rejected at CLI parsing.

Written by Cursor Bugbot for commit b977baa. This will update automatically on new commits. Configure here.

Commands `markets get` and `events get` now accept full Polymarket URLs
(e.g. https://polymarket.com/event/my-event/my-market) in addition to
numeric IDs and plain slugs. The CLI extracts the appropriate slug
automatically — market slug for `markets get`, event slug for
`events get`.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

parsed.event_slug
};
return ResolvedId::Slug(slug);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Market URL without market slug misresolves

Medium Severity

When prefer_market is true, resolve_id falls back to event_slug if the Polymarket URL has no market_slug. This makes markets get treat an event-only URL as a market slug and call market_by_slug with an event slug, which can lead to incorrect lookups or confusing failures.

Fix in Cursor Fix in Web

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional. When the URL has no market slug, falling back to the event slug is better than erroring -- it gives the API a chance to resolve it (works when event/market slugs match, which is common for single-market events).

When it doesn't match, the API returns a clear 404 ("slug not found"), same as typing any wrong slug. No silent misresolution is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant