DEV-204: TS SDK support split/merge and redeem#94
Open
cesarenaldi wants to merge 5 commits into
Open
Conversation
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 288d140. Configure here.
| : client.environment.collateralAdapter, | ||
| positionErc1155Address: marketContext.negRisk | ||
| ? client.environment.negRiskAdapter | ||
| : client.environment.conditionalTokens, |
There was a problem hiding this comment.
Wrong ERC1155 contract neg-risk
High Severity
For negative-risk markets, prepareMergeMarketPosition reads YES/NO balances via balanceOfBatch on negRiskAdapter, but holdings for those token IDs live on conditionalTokens. Merge amount resolution then sees zero balances and rejects merges (or caps 'max' at zero) even when the wallet holds complementary positions.
Reviewed by Cursor Bugbot for commit 288d140. Configure here.
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
Verification
Redeem support is intentionally not included in this PR.
Note
High Risk
Large changes to on-chain split/merge/redeem paths and merge amount resolution; incorrect routing or balance logic could cause failed or wrong transactions.
Overview
Adds combo portfolio and lifecycle support to the TypeScript SDK: typed
listComboPositions(with pagination/filters), combo split/merge by leg position IDs, and combo redeem by combo position ID (full on-chain balance via protocol v2).Market split, merge (
amount: 'max'), and redeem are refactored to resolve context from market metadata and on-chain ERC1155 balances instead of inferring amounts from the positions API. Combo flows use new protocol helpers (canonical legs, derived condition IDs) plus v2 router / combinatorial module transaction builders and environment addresses; a preproduction environment supports combo integration tests.Bindings widen condition ID validation for v2 (bytes31/32). Public client docs/examples are updated for the unified
splitPosition/mergePositions/redeemPositionsentry points.Reviewed by Cursor Bugbot for commit 288d140. Bugbot is set up for automated code reviews on this repo. Configure here.