Wallet & Fintech

Currency switch

Switching currency re-formats balances and disables fiat-only actions for crypto rails.

User story

As a multi-currency user, I want to flip between USD and EUR and see all amounts re-formatted correctly.

Acceptance criteria

  • All balances re-format on switch
  • Decimal precision differs by currency (USD=2, BTC=8)
  • Fiat-only actions are disabled for crypto rails
  • Switch persists across reloads

Manual test steps

  1. 1.Open /wallet
  2. 2.Switch from USD to EUR
  3. 3.Switch from EUR to BTC
  4. 4.Refresh and confirm currency persisted

Expected result

BTC selection shows 8 decimal places and disables fiat ACH actions.

Possible bug risks

  • Number.toLocaleString rounds losing 1 satoshi
  • Fiat actions stay clickable in crypto mode
  • Currency persists in URL but not in localStorage

Reference Playwright spec

currency-switch.spec.ts
ts
1
2
3
4
5
6
7
8
9
import { test, expect } from '@playwright/test';

test('currency switch reformats balances', async ({ page }) => {
  await page.goto('https://lab.hakdogan.com/wallet');

  await page.getByRole('button', { name: /currency/i }).click();
  await page.getByRole('menuitemradio', { name: /eur/i }).click();
  await expect(page.getByTestId('balance-display')).toContainText('€');
});