-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix wrong native asset being displayed on SignTransactionSheet #6395
Conversation
hey @walmat can you throw a quick screen cap on here pls |
const nativeAsset = | ||
ethereumUtils.getNetworkNativeAsset({ chainId }) ?? useBackendNetworksStore.getState().getChainsNativeAsset()[chainId]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, is this fallback needed for this specific situation or should it be done like this in other places where you need the native asset? If the latter would be nice to add it directly to the ethereumUtils.getNetworkNativeAsset
so this doesn't have to be re-done in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it depends on the scenario. The first call only grabs the native asset (with balance), and the second just grabs the base info from the backend. In this case, we can utilize both, but some places require it with balance so it doesn't necessarily make sense to have the fallback
amount: nativeAsset?.balance?.amount || 0, | ||
display: nativeAsset?.balance?.display || `0 ${nativeAsset?.symbol}`, | ||
isLoaded: nativeAsset?.balance?.display !== undefined, | ||
symbol: nativeAsset?.symbol || 'ETH', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these optional chains aren't necessary given the condition
Fixes APP-2256
What changed (plus any additional context for devs)
1. Props Interface Update
Type Changes
walletBalance
prop interface with multiple fieldsnativeAsset
prop usingParsedAddressAsset
type2. Native Asset Handling
Implementation Changes
SignTransactionSheet
getChainsNativeAsset
when network native asset is unavailableBalance Handling
3. Code Optimization
Dependency Updates
Error Messages
This PR represents a significant improvement in how native assets are handled in transaction simulations, providing better type safety and more robust fallback behavior while maintaining existing functionality.
Screen recordings / screenshots
What to test
test eth natives and non-eth natives