Skip to content

feat(sdk-core): add CurrencyAmount comparator overrides with currency… - #576

Open
shubhamessier wants to merge 1 commit into
Uniswap:mainfrom
shubhamessier:fix/issue-53-currency-amount-comparators
Open

feat(sdk-core): add CurrencyAmount comparator overrides with currency…#576
shubhamessier wants to merge 1 commit into
Uniswap:mainfrom
shubhamessier:fix/issue-53-currency-amount-comparators

Conversation

@shubhamessier

@shubhamessier shubhamessier commented Apr 27, 2026

Copy link
Copy Markdown

CurrencyAmount Comparison Overrides

Adds lessThan, equalTo, and greaterThan overrides on CurrencyAmount. Comparing amounts of different currencies now throws a 'CURRENCY' error, matching the existing behavior of add and subtract.

The operand type is narrowed to CurrencyAmount<T> | 0, where 0 is a sentinel for zero comparisons. This rejects bare BigintIsh values at the type level.

Internal callers in v2-sdk and router-sdk are updated to use 0 in place of JSBI.BigInt(0).

Validation

All existing tests pass (22 + 103 + 338 + 240 + 360). Type checking and linting are clean.

Changesets

  • @uniswap/sdk-core: minor
  • @uniswap/v2-sdk: patch
  • @uniswap/router-sdk: patch

@shubhamessier
shubhamessier requested a review from a team as a code owner April 27, 2026 22:06
@shubhamessier

Copy link
Copy Markdown
Author

Hey @mikeki, would appreciate your review here.

cc: @ciamac @ccashwell

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