Changeset View
Changeset View
Standalone View
Standalone View
apps/marlin-wallet/web/cypress/fixture/common.ts
| // Copyright (c) 2026 The Bitcoin developers | // Copyright (c) 2026 The Bitcoin developers | ||||
| // Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
| /// <reference types="cypress" /> | /// <reference types="cypress" /> | ||||
| import { DEFAULT_LOCALE } from '../../../i18n/locales'; | import { DEFAULT_LOCALE } from '../../../i18n/locales'; | ||||
| import { | |||||
| CryptoTicker, | |||||
| formatPrice, | |||||
| type PriceFormatterConfig, | |||||
| } from 'ecash-price'; | |||||
| import { FIRMA_TOKEN } from '../../src/supported-assets'; | |||||
| /** Ticker shown in formatted Firma crypto amounts (preserves display casing). */ | |||||
| export const FIRMA_FORMATTED_TICKER = FIRMA_TOKEN.ticker; | |||||
| export function formatFirmaAmount( | |||||
| amount: number, | |||||
| config?: PriceFormatterConfig, | |||||
| ): string { | |||||
| const cryptoTicker = new CryptoTicker(FIRMA_TOKEN.ticker.toLowerCase()); | |||||
| const formatted = formatPrice(amount, cryptoTicker, { | |||||
| locale: DEFAULT_LOCALE, | |||||
| decimals: FIRMA_TOKEN.decimals, | |||||
| ...config, | |||||
| }); | |||||
| const upperSuffix = ` ${cryptoTicker.toString().toUpperCase()}`; | |||||
| const displaySuffix = ` ${FIRMA_TOKEN.ticker}`; | |||||
| if (formatted.endsWith(upperSuffix)) { | |||||
| return formatted.slice(0, -upperSuffix.length) + displaySuffix; | |||||
| } | |||||
| return formatted; | |||||
| } | |||||
| /** | /** | ||||
| * Partial overrides for `ecashwallet.settings.1` (stored JSON in | * Partial overrides for `ecashwallet.settings.1` (stored JSON in | ||||
| * `src/settings.ts`). Omitted keys use the same defaults as `loadSettings()` | * `src/settings.ts`). Omitted keys use the same defaults as `loadSettings()` | ||||
| * there when no saved settings exist. | * there when no saved settings exist. | ||||
| */ | */ | ||||
| export type VisitWalletMnemonicSettings = { | export type VisitWalletMnemonicSettings = { | ||||
| requireHoldToSend?: boolean; | requireHoldToSend?: boolean; | ||||
| ▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines | |||||