Skip to content

Release 5.38.2#2650

Merged
aristidesstaffieri merged 3 commits intomasterfrom
release/5.38.2
Mar 13, 2026
Merged

Release 5.38.2#2650
aristidesstaffieri merged 3 commits intomasterfrom
release/5.38.2

Conversation

@aristidesstaffieri
Copy link
Contributor

…#2647)

* Fix SEP-41 token decimal formatting in Blockaid asset diffs

  Blockaid returns SEP-41/Soroban token asset diffs with a different shape
  than classic assets (symbol/address/decimals instead of code/issuer).
  The previous code only handled NATIVE/ASSET types with hardcoded 7
  decimals, causing incorrect amounts for SEP-41 tokens (e.g., displaying
  0.00005 instead of 0.5 for a 3-decimal token).

  Remove the switch statement and extract code/issuer/decimals uniformly
  from all asset types, falling back to CLASSIC_ASSET_DECIMALS (7) when
  decimals is not present.

* Update extension/src/popup/views/__tests__/SignTransaction.test.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Defensively skip asset diffs when Blockaid payload fields are unexpected types (#2648)

* Initial plan

* Skip asset diffs with non-string blockaid payload fields

Use typeof narrowing instead of incorrect 'as string' casts.
Skip entries entirely when code/issuer/address fields are not strings.
Native XLM (asset_type=NATIVE) is allowed with empty issuer as expected.
Add test for the defensive skipping behavior.

Co-authored-by: aristidesstaffieri <6886006+aristidesstaffieri@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: aristidesstaffieri <6886006+aristidesstaffieri@users.noreply.github.com>

* skips asset diffs row if asset decimals response if unexpected

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: aristidesstaffieri <6886006+aristidesstaffieri@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 13, 2026 14:49
@aristidesstaffieri aristidesstaffieri self-assigned this Mar 13, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Sign Transaction popup to correctly render Blockaid asset diffs for SEP-41 (contract) tokens by using symbol/address/decimals, and adds tests to cover the updated rendering and validation behavior.

Changes:

  • Update AssetDiffs rendering to support SEP-41 asset diff fields and decimals.
  • Add unit tests for SEP-41 decimal formatting and for skipping malformed Blockaid payload fields.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
extension/src/popup/views/SignTransaction/index.tsx Adjusts asset diff parsing to support SEP-41 fields and apply per-asset decimals when formatting amounts.
extension/src/popup/views/tests/SignTransaction.test.tsx Adds tests verifying SEP-41 amount formatting and behavior when payload fields have unexpected types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

  Add Number.isInteger() check to decimals validation guard to reject
  non-integer values before they reach toFixed(). Fix mock structure in
  "skips asset diffs when decimals is not a valid number" test to place
  validation and request_id inside scanResult, matching other tests.
@aristidesstaffieri aristidesstaffieri merged commit a4951c1 into master Mar 13, 2026
9 checks passed
@aristidesstaffieri aristidesstaffieri deleted the release/5.38.2 branch March 13, 2026 18:58
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.

3 participants