// Copyright 2017-2026 @pezkuwi/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { TFunction, TOptions } from '../types.js'; import type { LinkOption } from './types.js'; import { createCustom, createDev, createOwn } from './development.js'; import { prodRelayPezkuwi } from './production.js'; import { testRelayZagros } from './testing.js'; import { expandEndpoints } from './util.js'; export { CUSTOM_ENDPOINT_KEY } from './development.js'; export * from './production.js'; export * from './testing.js'; function defaultT (keyOrText: string, textOrOptions?: string | TOptions, options?: TOptions): string { // as TFunction: the second argument is either the default text or the options const [text, opts] = typeof textOrOptions === 'string' ? [textOrOptions, options] : [undefined, textOrOptions]; return ( (opts?.replace?.host as string) || text || keyOrText ); } export function createWsEndpoints (t: TFunction = defaultT, firstOnly = false, withSort = true): LinkOption[] { return [ ...createCustom(t), { isDisabled: false, isHeader: true, isSpaced: true, text: t('rpc.header.favorite', 'Favorite chains', { ns: 'apps-config' }), textBy: '', ui: {}, value: '' }, { isDisabled: false, isHeader: true, isSpaced: true, text: t('rpc.header.pezkuwi.relay', 'Pezkuwi & teyrchains', { ns: 'apps-config' }), textBy: '', ui: {}, value: '' }, ...expandEndpoints(t, [prodRelayPezkuwi], firstOnly, withSort), { isDisabled: false, isHeader: true, isSpaced: true, text: t('rpc.header.zagros.relay', 'Test Zagros & teyrchains', { ns: 'apps-config' }), textBy: '', ui: {}, value: '' }, ...expandEndpoints(t, [testRelayZagros], firstOnly, withSort), { isDevelopment: true, isDisabled: false, isHeader: true, isSpaced: true, text: t('rpc.header.dev', 'Development', { ns: 'apps-config' }), textBy: '', ui: {}, value: '' }, ...createDev(t), ...createOwn(t) ].filter(({ isDisabled }) => !isDisabled); }