From 39c85b72f8e248b07a1c5d1ade9955ba8fe09394 Mon Sep 17 00:00:00 2001 From: Jon Tzeng Date: Fri, 14 Nov 2025 10:55:19 -0800 Subject: [PATCH] Append chain name for L2-native assets in `RampCreateScene` --- CHANGELOG.md | 1 + src/components/scenes/RampCreateScene.tsx | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02511459b9a..0e515565c1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased (develop) - added: Added Infinite ramp plugin. +- fixed: Append chain name for L2-native assets in `RampCreateScene` ## 4.39.0 (staging) diff --git a/src/components/scenes/RampCreateScene.tsx b/src/components/scenes/RampCreateScene.tsx index e281096c0ee..2919d6aa49a 100644 --- a/src/components/scenes/RampCreateScene.tsx +++ b/src/components/scenes/RampCreateScene.tsx @@ -48,6 +48,7 @@ import type { import type { GuiFiatType } from '../../types/types' import { getCurrencyCode } from '../../util/CurrencyInfoHelpers' import { getHistoricalFiatRate } from '../../util/exchangeRates' +import { isAssetNativeToChain } from '../../util/isAbstractedAssetChain' import { logEvent } from '../../util/tracking' import { convertNativeToDenomination, @@ -138,6 +139,21 @@ export const RampCreateScene: React.FC = (props: Props) => { ] : [undefined, undefined] + // Append chain name for L2-native assets like Optimism ETH + 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 + } + // Get the select crypto denomination for exchange rate const denomination = React.useMemo(() => { if (selectedCrypto == null || selectedWallet == null) return null @@ -875,7 +891,7 @@ export const RampCreateScene: React.FC = (props: Props) => { onChangeText={handleCryptoChangeText} placeholder={sprintf( lstrings.trade_create_amount_s, - selectedCryptoCurrencyCode + getSelectedCryptoDisplay() ?? selectedCryptoCurrencyCode )} keyboardType="decimal-pad" numeric @@ -957,7 +973,7 @@ export const RampCreateScene: React.FC = (props: Props) => { direction === 'buy' ? lstrings.trade_buy_unavailable_body_2s : lstrings.trade_sell_unavailable_body_2s, - selectedCryptoCurrencyCode, + getSelectedCryptoDisplay() ?? selectedCryptoCurrencyCode, selectedFiatCurrencyCode )} />