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 @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/plugins/gui/amountQuotePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading