Files
2ff074ee3b Release v2.6.1 (#3247)
* essential dapps config: switch to concurrent request and and add worker termination

* fix rollbar error logging and enable it for server errors

* fix for tokens request on address page

* update generator script for multichain config

* fix hot contracts interval select

* update screenshot

* update screenshots

* pass chainId to trackTransaction for essential dapps

* fix vertical alignment in hot contracts table

* bump next.js to v15.5.10

---------

Co-authored-by: isstuev <[email protected]>
Co-authored-by: Max Alekseenko <[email protected]>
2026-02-03 18:05:00 +01:00

53 lines
1.3 KiB
TypeScript

/* eslint-disable no-restricted-properties */
import type { MultichainConfig } from 'types/multichain';
import config from 'configs/app';
function isRunningInDocker() {
return process.env.HOSTNAME !== undefined;
}
let value: MultichainConfig | undefined = undefined;
async function fetchConfig() {
if (process.env.NEXT_RUNTIME !== 'edge') {
throw new Error('NEXT_RUNTIME is not edge');
}
// In edge runtime, we need to use absolute URLs
// When in Docker, use the internal hostname
const baseUrl = isRunningInDocker() ?
`http://${ process.env.HOSTNAME }:${ config.app.port || 3000 }` :
config.app.baseUrl;
const url = baseUrl + '/assets/multichain/config.json';
const response = await fetch(url);
if (response.ok) {
const contentType = response.headers.get('content-type');
if (contentType?.includes('application/json')) {
const json = await response.json();
value = json as MultichainConfig;
return value;
}
}
}
export async function load() {
if (!value) {
return new Promise<MultichainConfig | undefined>((resolve, reject) => {
fetchConfig()
.then((value) => {
resolve(value);
}).catch((error) => {
reject(error);
});
});
}
return Promise.resolve(value);
}
export function getValue() {
return value;
}