fix: restore protected visibility for HTTP methods in ClobClient#52
Open
0xZoomEye wants to merge 1 commit intoPolymarket:mainfrom
Open
fix: restore protected visibility for HTTP methods in ClobClient#520xZoomEye wants to merge 1 commit intoPolymarket:mainfrom
0xZoomEye wants to merge 1 commit intoPolymarket:mainfrom
Conversation
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.
Problem
In the migration to
@polymarket/clob-client-v2, the low-level HTTP methods (get,post,put,delete, etc.) insrc/client.tswere changed fromprotectedtoprivate.While making internals more encapsulated is generally positive, this specific change removes the ability for users to subclass
ClobClientand customize request behavior. This is a regression in extensibility.Use Cases Affected
These patterns are common and were explicitly supported in the previous version of the client.
Proposed Solution
Change the visibility of the core HTTP methods back to
protected(or provide a cleaner extension point such as a configurablefetchimplementation or request hooks).This is a minimal, non-breaking change that restores the previous extensibility while preserving the other improvements introduced in v2.
Why This Matters
Libraries intended for broad adoption should favor "open for extension". Restricting core transport methods to
privatemakes the SDK harder to adapt to real-world production and testing needs without resorting to ugly workarounds (monkey-patching, forking, etc.).Looking forward to your feedback — happy to adjust the approach if there's a preferred direction for v2+.
Note
Low Risk
Low risk API-surface change that only relaxes method visibility; behavior is unchanged but could affect typing/override expectations for downstream subclasses.
Overview
Restores extensibility of
ClobClientby changing the low-level HTTP wrapper methodsget,post, anddelfromprivatetoprotected, allowing consumers to subclass and override request behavior without forking.Reviewed by Cursor Bugbot for commit ef77dcd. Bugbot is set up for automated code reviews on this repo. Configure here.