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
13 changes: 12 additions & 1 deletion crates/lgs/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub const INITIAL_BALANCE: u64 = 10_000 * API_MULTIPLIER;
pub const SUPPORTED_CURRENCIES: &[&str] = &[
"USD", "CAD", "JPY", "EUR", "RUB", "CNY", "PHP", "INR", "IDR", "KRW", "BRL", "MXN", "DKK",
"PLN", "VND", "TRY", "CLP", "ARS", "PEN", "NGN", "SAR", "ILS", "AED", "TWD", "NOK", "KWD",
"JOD", "CRC", "TND", "SGD", "MYR", "OMR", "QAR", "BHD", "XGC", "XSC",
"JOD", "CRC", "TND", "SGD", "MYR", "OMR", "QAR", "BHD", "XGC", "XSC", "XEC",
];

pub fn intern_currency(c: &str) -> &'static str {
Expand Down Expand Up @@ -117,3 +117,14 @@ impl ServerConfig {
}
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn supports_regional_social_currencies() {
assert_eq!(intern_currency("XSC"), "XSC");
assert_eq!(intern_currency("xec"), "XEC");
}
}
3 changes: 2 additions & 1 deletion ui/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ export const CURRENCIES: CurrencyInfo[] = [
{ code: 'QAR', name: 'Qatar Riyal', symbol: 'QAR', country: 'qa' },
{ code: 'BHD', name: 'Bahraini Dinar', symbol: 'BD', country: 'bh' },
{ code: 'XGC', name: 'Stake Gold Coin', symbol: 'GC', country: null, badge: 'GC' },
{ code: 'XSC', name: 'Stake Cash', symbol: 'SC', country: null, badge: 'SC' }
{ code: 'XSC', name: 'Stake Cash (US)', symbol: 'SC', country: null, badge: 'SC' },
{ code: 'XEC', name: 'Stake Cash (EU)', symbol: 'SC', country: null, badge: 'SC' }
];

export function flagUrl(country: string | null | undefined, height = 20): string | null {
Expand Down
9 changes: 4 additions & 5 deletions ui/src/routes/test/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
import ZapIcon from '@lucide/svelte/icons/zap';
import HistoryIcon from '@lucide/svelte/icons/history';

// Stake social-mode currencies (XGC = Gold Coin, XSC = Stake Cash) only
// make sense when social=true; hide them otherwise.
const SOCIAL_CURRENCIES = new Set(['XGC', 'XSC']);
// Stake social-mode currencies only make sense when social=true; hide them
// otherwise. XSC and XEC both use the SC display symbol.
const SOCIAL_CURRENCIES = new Set(['XGC', 'XSC', 'XEC']);
const realCurrencies = CURRENCIES.filter((c) => !SOCIAL_CURRENCIES.has(c.code));
const socialCurrencies = CURRENCIES.filter((c) => SOCIAL_CURRENCIES.has(c.code));

Expand All @@ -76,10 +76,9 @@
let social = $state(false);
let device = $state('desktop');

// Available currencies depend on social mode: XGC/XSC are social-only.
const availableCurrencies = $derived(social ? socialCurrencies : realCurrencies);

// Auto-switch currency when toggling social mode in/out of valid set.
// Auto-switch currency when toggling social mode in or out of its valid set.
function toggleSocial(next: boolean) {
social = next;
if (social) {
Expand Down
Loading