Skip to content

Conversation

@Jon-edge
Copy link
Collaborator

@Jon-edge Jon-edge commented Nov 14, 2025

image

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Note

Appends the network name to L2-native asset labels in RampCreateScene placeholders and alerts for clearer asset identification.

  • RampCreateScene (src/components/scenes/RampCreateScene.tsx):
    • Add getSelectedCryptoDisplay() to append chain display name for L2-native parent assets (e.g., "ETH (Optimism)").
    • Use the new display in crypto amount input placeholder and "unavailable" alert body.
    • Import isAssetNativeToChain to detect L2-native context.
  • Changelog:
    • Add entry noting the fix for appending chain name for L2-native assets.

Written by Cursor Bugbot for commit 39c85b7. This will update automatically on new commits. Configure here.


Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

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

Approved, but I think it could be made easier to read.

Comment on lines 142 to 156
// Append chain name for L2-native assets like Optimism ETH
const selectedCryptoCurrencyCodeDisplay =
selectedCrypto != null &&
selectedWallet != null &&
selectedCryptoCurrencyCode != null
? (() => {
const isL2Native =
selectedCrypto.tokenId == null &&
!isAssetNativeToChain(selectedWallet.currencyInfo, undefined)
return isL2Native
? `${selectedCryptoCurrencyCode} (${selectedWallet.currencyInfo.displayName})`
: selectedCryptoCurrencyCode
})()
: undefined

Copy link
Contributor

@swansontec swansontec Nov 14, 2025

Choose a reason for hiding this comment

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

How about:

function getSelectedCryptoDisplay(): string | undefined {
  if (selectedCrypto == null) return
  if (selectedWallet == null) return
  if (selectedCryptoCurrencyCode == null) return

  const isL2Native =
    selectedCrypto.tokenId == null &&
    !isAssetNativeToChain(selectedWallet.currencyInfo, undefined);

  return isL2Native
    ? `${selectedCryptoCurrencyCode} (${selectedWallet.currencyInfo.displayName})`
    : selectedCryptoCurrencyCode;
}

And then later you can replace selectedCryptoCurrencyCodeDisplay with getSelectedCryptoDisplay() in those two spots.

placeholder={sprintf(
lstrings.trade_create_amount_s,
selectedCryptoCurrencyCode
getSelectedCryptoDisplay() ?? selectedCryptoCurrencyCode
Copy link

Choose a reason for hiding this comment

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

Bug: Loading State Breaks Crypto Display

When isLoadingPersistedCryptoSelection is true, both getSelectedCryptoDisplay() and selectedCryptoCurrencyCode can be undefined, causing undefined to be passed to sprintf for the placeholder text. This happens because the input is rendered when either selectedCryptoCurrencyCode != null OR isLoadingPersistedCryptoSelection == true, but the fallback pattern doesn't handle the loading state where all crypto selection values are undefined.

Fix in Cursor Fix in Web

@Jon-edge Jon-edge merged commit a846abe into develop Nov 14, 2025
3 checks passed
@Jon-edge Jon-edge deleted the jon/fix/ramps-cc branch November 14, 2025 23:56
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