Skip to content

fix(sdk): throw when both orders and orderHashes are passed#1951

Merged
ryanio merged 1 commit intoProjectOpenSea:mainfrom
lavidaloca26:fix/cancel-orders-mutual-exclusion
Mar 23, 2026
Merged

fix(sdk): throw when both orders and orderHashes are passed#1951
ryanio merged 1 commit intoProjectOpenSea:mainfrom
lavidaloca26:fix/cancel-orders-mutual-exclusion

Conversation

@lavidaloca26
Copy link
Copy Markdown
Contributor

Summary

Fixes a silent logical bug in cancelOrders where passing both orders and orderHashes simultaneously caused orderHashes to be silently ignored.

Problem

cancelOrders accepted both orders and orderHashes as optional parameters but only validated that at least one was provided. When both were supplied, the if (orders) { ... } else if (orderHashes) { ... } branching logic would process only orders and drop orderHashes without any warning or error.

This means a caller who provided both expecting all of them to be cancelled would silently fail to cancel the orderHashes entries.

Fix

  • Added an explicit guard: if both orders and orderHashes are provided, throw immediately with a clear error message.
  • Added a unit test covering this case in test/sdk/cancelOrders.spec.ts.

@lavidaloca26 lavidaloca26 changed the title fix(sdk): throw when both orders and orderHashes are passed to cancel… fix(sdk): throw when both orders and orderHashes are passed Mar 21, 2026
Copy link
Copy Markdown
Collaborator

@ryanio ryanio left a comment

Choose a reason for hiding this comment

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

LGTM. Good catch — silently dropping orderHashes when both params are provided is a real footgun. The guard is in the right place and the test is thorough.

@ryanio ryanio merged commit b56fbc0 into ProjectOpenSea:main Mar 23, 2026
2 checks passed
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.

2 participants