mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
[skip ci] better types for tx interpretation
This commit is contained in:
@@ -1,12 +1,22 @@
|
||||
import type { Feature } from './types';
|
||||
import type { Provider } from 'types/client/txInterpretation';
|
||||
import { PROVIDERS } from 'types/client/txInterpretation';
|
||||
|
||||
import { getEnvValue } from '../utils';
|
||||
|
||||
const title = 'Transaction interpretation';
|
||||
|
||||
const provider = getEnvValue('NEXT_PUBLIC_TRANSACTION_INTERPRETATION_PROVIDER') || 'none';
|
||||
const provider: Provider = (() => {
|
||||
const value = getEnvValue('NEXT_PUBLIC_TRANSACTION_INTERPRETATION_PROVIDER');
|
||||
|
||||
const config: Feature<{ provider: string }> = (() => {
|
||||
if (value && PROVIDERS.includes(value as Provider)) {
|
||||
return value as Provider;
|
||||
}
|
||||
|
||||
return 'none';
|
||||
})();
|
||||
|
||||
const config: Feature<{ provider: Provider }> = (() => {
|
||||
if (provider !== 'none') {
|
||||
return Object.freeze({
|
||||
title,
|
||||
|
||||
@@ -15,6 +15,7 @@ import type { MarketplaceAppOverview } from '../../../types/client/marketplace';
|
||||
import { NAVIGATION_LINK_IDS } from '../../../types/client/navigation-items';
|
||||
import type { NavItemExternal, NavigationLinkId } from '../../../types/client/navigation-items';
|
||||
import type { BridgedTokenChain, TokenBridge } from '../../../types/client/token';
|
||||
import { PROVIDERS as TX_INTERPRETATION_PROVIDERS } from '../../../types/client/txInterpretation';
|
||||
import type { WalletType } from '../../../types/client/wallets';
|
||||
import { SUPPORTED_WALLETS } from '../../../types/client/wallets';
|
||||
import type { CustomLink, CustomLinksGroup } from '../../../types/footerLinks';
|
||||
@@ -438,7 +439,7 @@ const schema = yup
|
||||
return isNoneSchema.isValidSync(data) || isArrayOfWalletsSchema.isValidSync(data);
|
||||
}),
|
||||
NEXT_PUBLIC_WEB3_DISABLE_ADD_TOKEN_TO_WALLET: yup.boolean(),
|
||||
NEXT_PUBLIC_TRANSACTION_INTERPRETATION_PROVIDER: yup.string().oneOf([ 'blockscout', 'none' ]),
|
||||
NEXT_PUBLIC_TRANSACTION_INTERPRETATION_PROVIDER: yup.string().oneOf(TX_INTERPRETATION_PROVIDERS),
|
||||
NEXT_PUBLIC_AD_TEXT_PROVIDER: yup.string<AdTextProviders>().oneOf(SUPPORTED_AD_TEXT_PROVIDERS),
|
||||
NEXT_PUBLIC_PROMOTE_BLOCKSCOUT_IN_TITLE: yup.boolean(),
|
||||
NEXT_PUBLIC_OG_DESCRIPTION: yup.string(),
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { ArrayElement } from 'types/utils';
|
||||
|
||||
export const PROVIDERS = [
|
||||
'blockscout',
|
||||
'none',
|
||||
] as const;
|
||||
|
||||
export type Provider = ArrayElement<typeof PROVIDERS>;
|
||||
Reference in New Issue
Block a user