Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 23 additions & 1 deletion src/components/scenes/RampCreateScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -617,6 +624,21 @@ export const RampCreateScene: React.FC<Props> = (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'))
Expand Down Expand Up @@ -1129,7 +1151,7 @@ export const RampCreateScene: React.FC<Props> = (props: Props) => {
placeholder={cryptoAmountPlaceholder}
keyboardType="decimal-pad"
numeric
maxDecimals={6}
maxDecimals={cryptoMaxDecimals}
returnKeyType="done"
showSpinner={isFetchingQuotes && lastUsedInput === 'fiat'}
disabled={cryptoInputDisabled}
Expand Down
Loading