MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / normalizeCode

Method normalizeCode

rate/rate.ts:261–283  ·  view source on GitHub ↗
(s: string | undefined)

Source from the content-addressed store, hash-verified

259 if (k === 'rm') {
260 return 'myr';
261 }
262
263 // 检查法币别名
264 for (const [code, info] of Object.entries(FIAT_CURRENCIES)) {
265 if (info.aliases?.includes(k)) {
266 return code;
267 }
268 }
269
270 // 检查加密货币别名
271 for (const [code, info] of Object.entries(CRYPTO_CURRENCIES)) {
272 if (info.aliases?.includes(k)) {
273 return code;
274 }
275 }
276
277 return k;
278 }
279
280 // 获取法币汇率(带多源回退与5分钟缓存)
281 private async fetchFiatRates(base: string): Promise<Record<string, number>> {
282 const key = base.toLowerCase();
283 const now = Date.now();
284 const cached = this.fiatRatesCache[key];
285 if (cached && now - cached.ts < 5 * 60 * 1000) return cached.rates;
286 const endpoints = [

Callers 1

parseArgsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected