diff --git a/packages/app/src/config/chain/index.ts b/packages/app/src/config/chain/index.ts index 97eeb975a..94630321c 100644 --- a/packages/app/src/config/chain/index.ts +++ b/packages/app/src/config/chain/index.ts @@ -19,7 +19,7 @@ import { base, gnosis, mainnet } from 'viem/chains' import { NATIVE_ASSET_MOCK_ADDRESS, infoSkyApiUrl } from '../consts' import { AppConfig } from '../feature-flags' import { PLAYWRIGHT_USDS_CONTRACTS_NOT_AVAILABLE_KEY } from '../wagmi/config.e2e' -import { farmAddresses, farmStablecoinsEntryGroup, susdsAddresses } from './constants' +import { SUPPORTED_CHAINS, farmAddresses, farmStablecoinsEntryGroup, susdsAddresses } from './constants' import { ChainConfigEntry, ChainMeta, SupportedChainId } from './types' const commonTokenSymbolToReplacedName = { @@ -308,7 +308,7 @@ const chainConfig: Record = { psmStables: [TokenSymbol('USDC'), TokenSymbol('USDS')], meta: { name: 'Base', - logo: assets.chain.baseDevNet, + logo: assets.chain.base, }, tokensWithMalformedApprove: [], permitSupport: {}, @@ -348,6 +348,24 @@ const chainConfig: Record = { }, } +export const featureAvailability = (function getFeatureAvailability(): Record< + 'savings' | 'markets' | 'farms', + SupportedChainId[] +> { + // @note: using SUPPORTED_CHAIN instead of Object.values(chainConfig) to maintain chains order, + // since chain config members are automatically sorted in js (object key is a number). + function getSupportedChains(predicate: (config: ChainConfigEntry) => boolean): SupportedChainId[] { + return SUPPORTED_CHAINS.map((chain) => chainConfig[chain.id]) + .filter(predicate) + .map((config) => config.originChainId) + } + return { + savings: getSupportedChains((config) => config.savings !== undefined), + markets: getSupportedChains((config) => config.markets !== undefined), + farms: getSupportedChains((config) => config.farms !== undefined), + } +})() + export function getChainConfigEntry(chainId: number): ChainConfigEntry { const sandboxConfig = useStore.getState().appConfig.sandbox const sandbox = useStore.getState().sandbox.network diff --git a/packages/app/src/features/dialogs/select-network/views/SelectNetworkDialogView.stories.ts b/packages/app/src/features/dialogs/select-network/views/SelectNetworkDialogView.stories.ts index 8c6d85b19..2090e7b8d 100644 --- a/packages/app/src/features/dialogs/select-network/views/SelectNetworkDialogView.stories.ts +++ b/packages/app/src/features/dialogs/select-network/views/SelectNetworkDialogView.stories.ts @@ -28,7 +28,7 @@ const meta: Meta = { onSelect: () => {}, }, { - logo: assets.chain.baseDevNet, + logo: assets.chain.base, name: 'Base', supportedPages: ['Savings', 'Farms'], selected: false, diff --git a/packages/app/src/features/savings/components/savings-opportunity/components/Card.tsx b/packages/app/src/features/savings/components/savings-opportunity/components/Card.tsx index 3550cdf76..b979cfe16 100644 --- a/packages/app/src/features/savings/components/savings-opportunity/components/Card.tsx +++ b/packages/app/src/features/savings/components/savings-opportunity/components/Card.tsx @@ -14,7 +14,7 @@ export function Card({ children, hasNoCash }: CardProps) { spacing="m" className={cn( 'grid grid-cols-1 gap-8 bg-center bg-cover', - 'bg-savings-opportunity-panel bg-no-repeat lg:grid-cols-[3fr_2fr]', + 'bg-savings-opportunity-panel bg-no-repeat xl:grid-cols-[3fr_2fr]', hasNoCash && 'gap-6 lg:grid-cols-1', )} data-testid={testIds.savings.opportunity.panel} diff --git a/packages/app/src/features/savings/components/savings-opportunity/components/Explainer.tsx b/packages/app/src/features/savings/components/savings-opportunity/components/Explainer.tsx index 87486c6da..f97d60e30 100644 --- a/packages/app/src/features/savings/components/savings-opportunity/components/Explainer.tsx +++ b/packages/app/src/features/savings/components/savings-opportunity/components/Explainer.tsx @@ -1,4 +1,4 @@ -import { getChainConfigEntry } from '@/config/chain' +import { featureAvailability, getChainConfigEntry } from '@/config/chain' import { SupportedChainId } from '@/config/chain/types' import { USD_MOCK_TOKEN } from '@/domain/types/Token' import { TokenSymbol } from '@/domain/types/TokenSymbol' @@ -6,7 +6,7 @@ import { SavingsMeta } from '@/features/savings/logic/makeSavingsMeta' import { getTokenImage } from '@/ui/assets' import { testIds } from '@/ui/utils/testIds' import { NormalizedUnitNumber } from '@marsfoundation/common-universal' -import { ArrowRightIcon } from 'lucide-react' +import { SlashIcon } from 'lucide-react' export interface ExplainerProps { stablecoinValue?: NormalizedUnitNumber @@ -16,7 +16,7 @@ export interface ExplainerProps { export function Explainer({ stablecoinValue, savingsMeta, originChainId }: ExplainerProps) { const { stablecoin, rateName } = savingsMeta.primary - const { savings, sdaiSymbol, susdsSymbol } = getChainConfigEntry(originChainId) + const { savings } = getChainConfigEntry(originChainId) return (
@@ -24,9 +24,9 @@ export function Explainer({ stablecoinValue, savingsMeta, originChainId }: Expla {savings?.inputTokens.map((symbol) => ( ))} - - {[sdaiSymbol, susdsSymbol].filter(Boolean).map((symbol) => ( - + + {featureAvailability.savings.map((chainId) => ( + ))}
diff --git a/packages/app/src/features/savings/components/savings-token-panel/SavingsTokenPanel.tsx b/packages/app/src/features/savings/components/savings-token-panel/SavingsTokenPanel.tsx index eb7d57095..a50c65750 100644 --- a/packages/app/src/features/savings/components/savings-token-panel/SavingsTokenPanel.tsx +++ b/packages/app/src/features/savings/components/savings-token-panel/SavingsTokenPanel.tsx @@ -56,7 +56,7 @@ export function SavingsTokenPanel({
- {savingsType === 'sdai' ? 'Savings DAI' : 'Savings USDS'} + {savingsType === 'sdai' ? 'DAI Savings' : 'USDS Savings'}
diff --git a/packages/app/src/ui/assets/chains/baseDevNet.svg b/packages/app/src/ui/assets/chains/baseDevNet.svg deleted file mode 100644 index a084bf510..000000000 --- a/packages/app/src/ui/assets/chains/baseDevNet.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/app/src/ui/assets/index.ts b/packages/app/src/ui/assets/index.ts index ab372d579..4efe2854e 100644 --- a/packages/app/src/ui/assets/index.ts +++ b/packages/app/src/ui/assets/index.ts @@ -18,7 +18,6 @@ import symbolDark from './brand/symbol-dark.svg' import symbolGradient from './brand/symbol-gradient.svg' import symboLight from './brand/symbol-light.svg' import base from './chains/base.svg' -import baseDevNet from './chains/baseDevNet.svg' import ethereum from './chains/ethereum.svg' import gnosis from './chains/gnosis.svg' import checkCircle from './check-circle.svg' @@ -162,7 +161,6 @@ export const assets = { gnosis, ethereum, unknown, - baseDevNet, base, }, token: {