From 71e779bc4ec50f39b2f831e08f90bf8caaca51ab Mon Sep 17 00:00:00 2001 From: AnhMTV Date: Wed, 29 May 2024 19:03:30 +0700 Subject: [PATCH] Update openbit static content URL --- packages/extension-base/src/utils/fetchStaticData.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/extension-base/src/utils/fetchStaticData.ts b/packages/extension-base/src/utils/fetchStaticData.ts index c9b2dec10f..2cd3187550 100644 --- a/packages/extension-base/src/utils/fetchStaticData.ts +++ b/packages/extension-base/src/utils/fetchStaticData.ts @@ -8,14 +8,21 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev']; const branchName = process.env.BRANCH_NAME || 'koni-dev'; const fetchTarget = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json'; +const swStaticDomain = 'https://static-data.subwallet.app'; +const obStaticDomain = 'https://static-data.openbit.app'; +const swSlugList = ['chains', 'chain-assets/disabled-xcm-channels', 'chain-assets/price-map']; + export async function fetchStaticData (slug: string, targetFile?: string, isJson = true) { const fetchFile = targetFile || fetchTarget; + // If targetFile in swSlugList, fetch from swStaticDomain + const staticDomain = swSlugList.includes(slug) ? swStaticDomain : obStaticDomain; + try { if (isJson) { - return await fetchJson(`https://static-data.subwallet.app/${slug}/${fetchFile}`); + return await fetchJson(`${staticDomain}/${slug}/${fetchFile}`); } else { - return await fetchText(`https://static-data.subwallet.app/${slug}/${fetchFile}`); + return await fetchText(`${staticDomain}/${slug}/${fetchFile}`); } } catch (e) { return staticData[slug as StaticKey] as T;