Skip to content

fix(sdk-coin-canton): receive-only allocate amount in any order - #10084

Open
hrishikeshjain wants to merge 1 commit into
masterfrom
hrishikeshjain/chalo-1993-sdk-receive-only-allocate-amount-order
Open

hrishikeshjain wants to merge 1 commit into
masterfrom
hrishikeshjain/chalo-1993-sdk-receive-only-allocate-amount-order

Conversation

@hrishikeshjain

Copy link
Copy Markdown
Contributor

AllocationAllocateBuilder.amount() rejected a zero amount unless allocationRole('receive') had already been called, and the thrown message said nothing about that escape hatch. Wallet-platform builds the receive-only (cross-issuer V2) allocate with amount '0' and never calls allocationRole(), so accepting a receive-only offer 500s with "amount must be a positive number" (staging requestId bg25-uiff0806084d96ac2cdcea-0001).

amount() now normalizes with allowZero=true, so the two calls can be made in either order; the rule that zero is only valid for a receive-only allocation moved into validate(), where the request object is built, and the error now names allocationRole('receive'). Negative, empty and non-numeric amounts are still rejected immediately, and a send allocation with a zero amount still throws. normalizeCantonAmount behaviour for the other canton builders is unchanged.

Ticket: CHALO-1993

AllocationAllocateBuilder.amount() rejected a zero amount unless allocationRole('receive') had already been called, and the thrown message said nothing about that escape hatch. Wallet-platform builds the receive-only (cross-issuer V2) allocate with amount '0' and never calls allocationRole(), so accepting a receive-only offer 500s with "amount must be a positive number" (staging requestId bg25-uiff0806084d96ac2cdcea-0001).

amount() now normalizes with allowZero=true, so the two calls can be made in either order; the rule that zero is only valid for a receive-only allocation moved into validate(), where the request object is built, and the error now names allocationRole('receive'). Negative, empty and non-numeric amounts are still rejected immediately, and a send allocation with a zero amount still throws. normalizeCantonAmount behaviour for the other canton builders is unchanged.

Ticket: CHALO-1993
@hrishikeshjain
hrishikeshjain requested a review from a team as a code owner October 28, 2026 06:59

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

This branch has not been deployed

No deployments
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