SkateSpots/src/lib/platform.ts
SkateSpots 6335965afc fix(pro): single-source the platform Lightning address + show it to payers
The pay-to address was duplicated (PRO_LIGHTNING_ADDRESS and
PLATFORM_LIGHTNING_ADDRESS) and hardcoded in the tour zap-split; a typo in any
copy would send money nowhere. Now one source of truth in src/lib/platform.ts,
re-exported by the fee/Pro modules.

Also surface the address in the Sasquatch Pro dialog ('Pays to ⚡ <address>') so
users can see where their sats go, in both the auto-pay and manual-QR paths.
2026-09-27 14:13:37 +07:00

35 lines
1.1 KiB
TypeScript

import { Capacitor } from '@capacitor/core';
/**
* Is the app running inside a native (Capacitor) shell — iOS / Android / desktop
* WebView — rather than a plain web browser?
*
* This matters for networking: a native WebView is NOT subject to browser CORS
* rules, so it can talk to any Cashu mint directly (including mint.minibits.cash,
* which sends no CORS headers). In a plain browser we must use a CORS-enabled
* mint. `Capacitor.isNativePlatform()` is web-safe and simply returns `false`
* when there's no native runtime.
*/
export function isNativePlatform(): boolean {
try {
return Capacitor.isNativePlatform();
} catch {
return false;
}
}
/** 'ios' | 'android' | 'web' */
export function getPlatform(): string {
try {
return Capacitor.getPlatform();
} catch {
return 'web';
}
}
/**
* SkateSpots platform Lightning address. Receives Sasquatch Pro passes AND
* marketplace listing fees — the same address, deliberately. Single source of
* truth: never re-type it elsewhere (a typo would send money nowhere).
*/
export const PLATFORM_LIGHTNING_ADDRESS = 'skatespots@minibits.cash';