goldenChat base source add

This commit is contained in:
aidev
2026-05-23 15:11:48 +09:00
commit a4ea7762b5
2081 changed files with 1155760 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
/**
* 업비트 마켓 코드 ↔ 한글명 캐시
* MarketSearchPanel 에서 market/all API 결과를 저장하고
* Toolbar 등에서 getKoreanName() 으로 조회합니다.
*/
const CACHE_KEY = 'upbit_market_names_v1';
// 앱 시작 시 localStorage에서 복원
let _cache: Record<string, string> = {};
try {
_cache = JSON.parse(localStorage.getItem(CACHE_KEY) ?? '{}');
} catch { /* ignore */ }
/** market/all 로드 후 한꺼번에 저장 */
export function setMarketNames(map: Record<string, string>): void {
_cache = { ..._cache, ...map };
try { localStorage.setItem(CACHE_KEY, JSON.stringify(_cache)); } catch { /* ignore */ }
}
/**
* 마켓 코드 → 한글명
* 캐시에 없으면 "BTC" 형식 fallback
*/
export function getKoreanName(market: string): string {
return _cache[market] ?? market.replace(/^KRW-/, '');
}