diff --git a/CHANGELOG.md b/CHANGELOG.md index e3e95a323cb..656c97fba4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - changed: (ARRR) Pirate Chain wallets run on `react-native-pirate-wallet` 0.3.4, replacing `react-native-piratechain` - changed: Balance-effect checks and the login FIO refresh wait for engine readiness on cache-emitted wallets - changed: Opening any wallet-scoped scene asks the core to prioritize that wallet's engine startup in the post-login queue. +- changed: Buy/sell crypto amount field shows up to nine decimals, matching the asset's precision, instead of six - fixed: A send whose funds are not spendable yet says so instead of reporting a network error - fixed: Auto-login starting two competing accounts when both `YOLO_PASSWORD` and `YOLO_PIN` are set, and attempting a login when either is set to an empty string. - fixed: Auto-login never running on a device with no accounts, since the welcome carousel took priority over the login scene that owns it. diff --git a/src/components/scenes/RampCreateScene.tsx b/src/components/scenes/RampCreateScene.tsx index 2a9595fc2b0..59586cbbbe1 100644 --- a/src/components/scenes/RampCreateScene.tsx +++ b/src/components/scenes/RampCreateScene.tsx @@ -87,6 +87,13 @@ import { EdgeText } from '../themed/EdgeText' import { FilledTextInput } from '../themed/FilledTextInput' import { RampRegionSelect } from './RampCreateScene/RampRegionSelect' +/** + * Upper bound on the decimals the crypto amount field renders, for assets whose + * own precision goes beyond what a ramp quote can express. See + * `cryptoMaxDecimals`. + */ +const MAX_CRYPTO_ENTRY_DECIMALS = 9 + export interface RampCreateParams { forcedWalletResult?: WalletListWalletResult regionCode?: string @@ -617,6 +624,21 @@ export const RampCreateScene: React.FC = (props: Props) => { denomination ]) + // How many decimals the crypto field renders. Providers quote each asset at + // its own precision and change it over time (Moonpay moves BTC 5 -> 8 and + // ETH/SOL to 9 decimals on the buy flow in September 2026), so this follows + // the asset instead of assuming a count. The 9-decimal ceiling keeps the + // field readable for high-precision assets such as ETH, whose 18 decimals + // would expose the rounding noise of the float exchange rate that + // `displayCryptoAmount` divides by while the user types a fiat amount. + const cryptoMaxDecimals = React.useMemo(() => { + if (denomination == null) return MAX_CRYPTO_ENTRY_DECIMALS + return Math.min( + mulToPrecision(denomination.multiplier), + MAX_CRYPTO_ENTRY_DECIMALS + ) + }, [denomination]) + // Log the quote event only when the scene is focused useFocusEffect(() => { dispatch(logEvent(direction === 'buy' ? 'Buy_Quote' : 'Sell_Quote')) @@ -1129,7 +1151,7 @@ export const RampCreateScene: React.FC = (props: Props) => { placeholder={cryptoAmountPlaceholder} keyboardType="decimal-pad" numeric - maxDecimals={6} + maxDecimals={cryptoMaxDecimals} returnKeyType="done" showSpinner={isFetchingQuotes && lastUsedInput === 'fiat'} disabled={cryptoInputDisabled}