Harden onion boot flow and deepen site surfaces
Add persistent onion key backup and restore, improve startup resilience, and flesh out the major site verticals with richer navigation, search coverage, and operator documentation. Made-with: Cursor
This commit is contained in:
26
lib/shopFx.ts
Normal file
26
lib/shopFx.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { ShopCurrency } from "@/lib/shopCatalog";
|
||||
|
||||
/**
|
||||
* Rough USD notional for cart/checkout when only BTC spot is loaded from API.
|
||||
* ETH/XMR are pegged off BTC for display totals (sim storefront).
|
||||
*/
|
||||
export function estimateUsdForCryptoAmount(
|
||||
amount: number,
|
||||
currency: ShopCurrency,
|
||||
btcUsd: number,
|
||||
): number {
|
||||
if (currency === "USD") return Math.round(amount * 100) / 100;
|
||||
if (!(btcUsd > 0)) return 0;
|
||||
const ethUsd = btcUsd / 28;
|
||||
const xmrUsd = btcUsd / 520;
|
||||
switch (currency) {
|
||||
case "BTC":
|
||||
return Math.round(amount * btcUsd * 100) / 100;
|
||||
case "ETH":
|
||||
return Math.round(amount * ethUsd * 100) / 100;
|
||||
case "XMR":
|
||||
return Math.round(amount * xmrUsd * 100) / 100;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user