Skip to content

Commit a846abe

Browse files
authored
Merge pull request #5842 from EdgeApp/jon/fix/ramps-cc
Append chain name for L2-native assets in `RampCreateScene`
2 parents a81974b + 39c85b7 commit a846abe

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased (develop)
44

55
- added: Added Infinite ramp plugin.
6+
- fixed: Append chain name for L2-native assets in `RampCreateScene`
67

78
## 4.39.0 (staging)
89

src/components/scenes/RampCreateScene.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import type {
4848
import type { GuiFiatType } from '../../types/types'
4949
import { getCurrencyCode } from '../../util/CurrencyInfoHelpers'
5050
import { getHistoricalFiatRate } from '../../util/exchangeRates'
51+
import { isAssetNativeToChain } from '../../util/isAbstractedAssetChain'
5152
import { logEvent } from '../../util/tracking'
5253
import {
5354
convertNativeToDenomination,
@@ -138,6 +139,21 @@ export const RampCreateScene: React.FC<Props> = (props: Props) => {
138139
]
139140
: [undefined, undefined]
140141

142+
// Append chain name for L2-native assets like Optimism ETH
143+
function getSelectedCryptoDisplay(): string | undefined {
144+
if (selectedCrypto == null) return
145+
if (selectedWallet == null) return
146+
if (selectedCryptoCurrencyCode == null) return
147+
148+
const isL2Native =
149+
selectedCrypto.tokenId == null &&
150+
!isAssetNativeToChain(selectedWallet.currencyInfo, undefined)
151+
152+
return isL2Native
153+
? `${selectedCryptoCurrencyCode} (${selectedWallet.currencyInfo.displayName})`
154+
: selectedCryptoCurrencyCode
155+
}
156+
141157
// Get the select crypto denomination for exchange rate
142158
const denomination = React.useMemo(() => {
143159
if (selectedCrypto == null || selectedWallet == null) return null
@@ -875,7 +891,7 @@ export const RampCreateScene: React.FC<Props> = (props: Props) => {
875891
onChangeText={handleCryptoChangeText}
876892
placeholder={sprintf(
877893
lstrings.trade_create_amount_s,
878-
selectedCryptoCurrencyCode
894+
getSelectedCryptoDisplay() ?? selectedCryptoCurrencyCode
879895
)}
880896
keyboardType="decimal-pad"
881897
numeric
@@ -957,7 +973,7 @@ export const RampCreateScene: React.FC<Props> = (props: Props) => {
957973
direction === 'buy'
958974
? lstrings.trade_buy_unavailable_body_2s
959975
: lstrings.trade_sell_unavailable_body_2s,
960-
selectedCryptoCurrencyCode,
976+
getSelectedCryptoDisplay() ?? selectedCryptoCurrencyCode,
961977
selectedFiatCurrencyCode
962978
)}
963979
/>

0 commit comments

Comments
 (0)