From 6aacce520b3af9a1ac3c83fc1147cbf86cf3ff23 Mon Sep 17 00:00:00 2001 From: Jon Tzeng Date: Thu, 22 Aug 2024 15:58:39 -0700 Subject: [PATCH] Use a $50 USD default fiat purchase for light accounts --- CHANGELOG.md | 1 + src/plugins/gui/amountQuotePlugin.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb9bf744670..038ecdf8080 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - added: Ethereum (Holesky) staking via Kiln - added: dRPC api key option for EVM chains - added: Handle KYC error responses from Bity +- changed: Use a $50 USD default fiat purchase amount for light accounts - changed: Enable Bitpay payments for FIO names and domains - changed: Disable Home scene swap and FIO cards if configured - changed: Allow some chains to be disabled in env.json diff --git a/src/plugins/gui/amountQuotePlugin.ts b/src/plugins/gui/amountQuotePlugin.ts index 8464759352e..9f0bcc97dc0 100644 --- a/src/plugins/gui/amountQuotePlugin.ts +++ b/src/plugins/gui/amountQuotePlugin.ts @@ -50,6 +50,7 @@ type InternalFiatPluginEnterAmountParams = FiatPluginEnterAmountParams & { const providerFactories = [banxaProvider, bityProvider, kadoProvider, moonpayProvider, mtpelerinProvider, paybisProvider, simplexProvider] const DEFAULT_FIAT_AMOUNT = '500' +const DEFAULT_FIAT_AMOUNT_LIGHT_ACCOUNT = '50' /** * Amount that we will attempt to get a quote for if the user presses the MAX button @@ -234,21 +235,23 @@ export const amountQuoteFiatPlugin: FiatPluginFactory = async (params: FiatPlugi logEvent(isBuy ? 'Buy_Quote' : 'Sell_Quote') - // Pick a default fiat amount that is roughly equal to DEFAULT_FIAT_AMOUNT + // Pick a default fiat amount in the foreign fiat amount that is roughly + // equal to the default USD fiat amount let initialValue1: string | undefined + const startingFiatAmount = isLightAccount ? DEFAULT_FIAT_AMOUNT_LIGHT_ACCOUNT : defaultFiatAmount ?? DEFAULT_FIAT_AMOUNT if (displayFiatCurrencyCode !== 'USD' && defaultFiatAmount == null) { const isoFiatCurrencyCode = `iso:${displayFiatCurrencyCode}` const isoNow = new Date().toISOString() const ratePair = `${isoFiatCurrencyCode}_iso:USD` const rate = await getHistoricalRate(ratePair, isoNow) - initialValue1 = div(DEFAULT_FIAT_AMOUNT, String(rate), DECIMAL_PRECISION) + initialValue1 = div(startingFiatAmount, String(rate), DECIMAL_PRECISION) // Round out a decimals initialValue1 = round(initialValue1, 0) // Only leave the first decimal initialValue1 = round(initialValue1, initialValue1.length - 1) } else { - initialValue1 = requireCrypto ? undefined : defaultFiatAmount ?? DEFAULT_FIAT_AMOUNT + initialValue1 = requireCrypto ? undefined : startingFiatAmount } // Navigate to scene to have user enter amount