Skip to content

fix(tron-wallet-snap): balance from the AssetsController is in display format, not raw balance - #196

Merged
ulissesferreira merged 1 commit into
mainfrom
fix/map-controller-asset-display-balance
Aug 26, 2026
Merged

fix(tron-wallet-snap): balance from the AssetsController is in display format, not raw balance#196
ulissesferreira merged 1 commit into
mainfrom
fix/map-controller-asset-display-balance

Conversation

@ulissesferreira

Copy link
Copy Markdown
Contributor

Context

mapControllerAsset assumed the AssetsController balance was in raw (smallest unit) format and converted it to a UI amount using the asset decimals.

The AssetsController actually returns balances in the asset's human-readable unit — i.e. with decimals already applied (e.g. TRX rather than Sun).

Solution

  • Use the controller balance directly as the uiAmount.
  • Derive the rawAmount from it with toRawAmount (decimals applied).
  • Update the affected tests to provide controller balances in display format.
  • Sync the snap manifest shasum to the rebuilt bundle (required by CI's clean-working-tree check).

No changelog entry needed: this corrects behavior introduced in #144 that is not yet user-facing (routing through Core is not yet active).

@ulissesferreira
ulissesferreira requested a review from a team as a code owner August 25, 2026 17:49
@ulissesferreira
ulissesferreira deployed to default-branch August 25, 2026 17:49 — with GitHub Actions Active
@ulissesferreira
ulissesferreira force-pushed the fix/map-controller-asset-display-balance branch 2 times, most recently from 818a716 to 4be4426 Compare August 26, 2026 12:56
@ulissesferreira ulissesferreira changed the title fix(mapControllerAsset): balance from the AssetsController is in display format, not raw balance fix(tron-wallet-snap): balance from the AssetsController is in display format, not raw balance Aug 26, 2026
@ulissesferreira
ulissesferreira force-pushed the fix/map-controller-asset-display-balance branch from 8bfe50d to 681e0cb Compare August 26, 2026 13:13

@Battambang Battambang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@ulissesferreira
ulissesferreira added this pull request to the merge queue Aug 26, 2026
Merged via the queue into main with commit cbf18e1 Aug 26, 2026
53 checks passed
@ulissesferreira
ulissesferreira deleted the fix/map-controller-asset-display-balance branch August 26, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants