Repository navigation
feat(snap-networks-utils): add shared Asset UI component - #418
Merged
Merged
Conversation
stanleyyconsensys
left a comment
Contributor
There was a problem hiding this comment.
Nice work
just some nit comment
Co-authored-by: Stanley Yuen <102275989+stanleyyconsensys@users.noreply.github.com>
|
4 tasks
stanleyyconsensys
approved these changes
Oct 7, 2026
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Explanation
This is the next step of consolidating the confirmation UI components across snaps, after
EstimatedChanges(#369) andTransactionAlert(#408).Every snap shows assets inline in its confirmation screens, for example in fee rows, operation parameters and ChangeTrust headers. Each one implements this separately:
Asset,AssetIconandAssetText.Assetshows the fiat value (or a skeleton while prices load), a round icon with a question-mark fallback, then the amount and symbol, optionally as an explorer link.AssetIconis also used on its own atxlsize in the ChangeTrust headers.Assetwith the same layout. It shows a SnapsIconinstead of the image for bandwidth and energy fees, and doesn't support links.TransactionDetailsbuilds the same layout by hand, without an icon.This PR adds shared
AssetandAssetIconcomponents to@metamask/snap-networks-utils. As with the previous shared components, snaps pass display-ready values, and number and fiat formatting stay in each snap. Stellar takes prices as strings and Tron as numbers, so formatting can't be shared yet anyway.AssetIconis exported on its own (sizessm,md,lg,xl) for standalone use like the Stellar ChangeTrust headers.Stellar and Tron each ship a copy of the same question-mark SVG (identical file). It's now embedded once in the library as a string constant, because
ts-bridgecan't bundle.svgimports the waymm-snapdoes, and SnapsImageaccepts raw SVG markup assrc. I checked it matches the snaps' file apart from whitespace.The snap migrations come in follow-up PRs, one per snap: Solana (fee row only), Stellar, then Tron.
References
Checklist