Repository navigation
Conversation
ConversionActivity only exposed amount, read from usdc_size. Protocol v2 conversions serve 0 there because they release no collateral, so the converted quantity was lost. The wire carries it in size. Add shares from size. Keep amount, which is the collateral released by legacy multi-outcome conversions ((k - 1) * shares), and document that it is 0 for single-outcome and protocol v2 conversions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Summary
ConversionActivity.amountcomes fromusdc_size. Protocol v2 conversions release no collateral, so activity rows serve the converted share amount insizeand0inusdc_size. The SDK reported every v2 conversion withamount == 0and had no field for the shares that moved.This adds
shares, read fromsize, the same wayTHRESHOLD_COMPOSEandTHRESHOLD_DECOMPOSEexpose it in #404. Matches Polymarket/ts-sdk#502.amountstays and is not deprecated. Legacy multi-outcome conversions serveusdc_size = shares * (k - 1), the collateral released when NO is converted on k outcomes, so the field still carries real data for those rows. The class docstring now says what each field is and whenamountis 0.Changes
ConversionActivitygainsshares: Decimal, required likeTradeActivity.shares.size25,usdc_size0), a legacy multi-outcome row, and a row missingsize.Checks
ruff check,ruff format --checkandpyrightpass.pytest -m "not integration": 3560 passed, 2 failed. The failures aretest_secure_client_defaults_wallet_to_current_deposit_walletandtest_create_defaults_wallet_to_current_deposit_wallet, which hit a connection reset from the remote host on this machine. They are unrelated to this change.🤖 Generated with Claude Code
Note
Low Risk
Scoped to activity parsing and an additive public field; the only behavioral tightening is rejecting CONVERSION payloads without
size.Overview
Conversion activity rows now expose
sharesfrom the API’ssize, so protocol v2 conversions (whereusdc_sizeis 0) no longer look like zero-sized events.amountstill maps tousdc_sizefor released collateral on legacy multi-outcome conversions.The
ConversionActivitymodel adds a requiredsharesfield with parsing/validation aligned toTradeActivity, plus a docstring clarifying whenamountis zero vs non-zero. Unit tests cover v2 and legacy payload shapes and assert missingsizeraisesUnexpectedResponseError.Reviewed by Cursor Bugbot for commit 06baa8e. Bugbot is set up for automated code reviews on this repo. Configure here.