From 2a789bc54a020e3d2ce10ae1c5469ec18cc1f2a1 Mon Sep 17 00:00:00 2001 From: Karelian Pie Date: Fri, 4 Aug 2023 09:00:44 +0300 Subject: [PATCH] refactor: Use yeth directly in the popover --- apps/common/components/AppHeader.tsx | 17 ++++++++++++++++- apps/common/components/Apps.tsx | 18 ++---------------- apps/common/components/Header.tsx | 1 + apps/common/contexts/useWallet.tsx | 2 +- apps/vaults/hooks/useSolverPortals.ts | 1 + 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/apps/common/components/AppHeader.tsx b/apps/common/components/AppHeader.tsx index 229e18751..bc6f1c169 100644 --- a/apps/common/components/AppHeader.tsx +++ b/apps/common/components/AppHeader.tsx @@ -9,6 +9,7 @@ import {VeYfiHeader} from '@veYFI/components/header/VeYfiHeader'; import Renderable from '@yearn-finance/web-lib/components/Renderable'; import {useWeb3} from '@yearn-finance/web-lib/contexts/useWeb3'; import BalanceReminderPopover from '@common/components/BalanceReminderPopover'; +import {ImageWithFallback} from '@common/components/ImageWithFallback'; import {useMenu} from '@common/contexts/useMenu'; import LogoYearn from '@common/icons/LogoYearn'; import {YBalHeader} from '@yBal/components/header/YBalHeader'; @@ -46,6 +47,20 @@ function Logo(): ReactElement { function LogoPopover(): ReactElement { const [isShowing, set_isShowing] = useState(false); + const YETH = { + name: 'yETH', + href: 'https://yeth.yearn.finance', + isDisabled: false, + icon: + }; + return ( set_isShowing(true)} @@ -70,7 +85,7 @@ function LogoPopover(): ReactElement {
{ - Object.values(APPS) + [...Object.values(APPS), YETH] .filter(({isDisabled}): boolean => !isDisabled) .map(({name, href, icon}): ReactElement => { return ( diff --git a/apps/common/components/Apps.tsx b/apps/common/components/Apps.tsx index a3b870363..5113340fb 100644 --- a/apps/common/components/Apps.tsx +++ b/apps/common/components/Apps.tsx @@ -22,15 +22,14 @@ export enum AppName { YCRV = 'yCRV', YBAL = 'yBal', VEYFI = 'veYFI', - YBRIBE = 'yBribe', - YETH = 'yETH' + YBRIBE = 'yBribe' } type TApp = { name: AppName; href: string; menu: TMenu[]; - manifest?: TMetaFile; + manifest: TMetaFile; icon: ReactElement; isDisabled?: boolean; } @@ -96,18 +95,5 @@ export const APPS: { [key in AppName]: TApp } = { className={'h-8 w-8'} back={'text-neutral-900'} front={'text-neutral-0'} /> - }, - yETH: { - name: AppName.YETH, - href: 'https://yeth.yearn.finance', - menu: [], - icon: } }; diff --git a/apps/common/components/Header.tsx b/apps/common/components/Header.tsx index 2d9756124..fd0b1ba87 100755 --- a/apps/common/components/Header.tsx +++ b/apps/common/components/Header.tsx @@ -92,6 +92,7 @@ function NetworkSelector({networks}: {networks: number[]}): ReactElement {
=> onSwitchChain(value.value)}> {({open}): ReactElement => ( <> diff --git a/apps/common/contexts/useWallet.tsx b/apps/common/contexts/useWallet.tsx index 01c38f6aa..0f44c8c5f 100755 --- a/apps/common/contexts/useWallet.tsx +++ b/apps/common/contexts/useWallet.tsx @@ -1,6 +1,6 @@ import {createContext, memo, useCallback, useContext, useMemo} from 'react'; import {useChainId} from 'wagmi'; -import {OPT_REWARDS_TOKENS, OPT_YVAGEUR_USDC_STAKING_CONTRACT, OPT_YVALETH_FRXETH_STAKING_CONTRACT, OPT_YVALETH_WETH_STAKING_CONTRACT, OPT_YVALUSD_FRAX_STAKING_CONTRACT, OPT_YVALUSD_USDC_STAKING_CONTRACT, OPT_YVDAI_STAKING_CONTRACT, OPT_YVDOLA_USDC_STAKING_CONTRACT, OPT_YVDOLAUSDC_STAKING_CONTRACT, OPT_YVERN_DOLA_STAKING_CONTRACT, OPT_YVERN_LUSD_STAKING_CONTRACT, OPT_YVETH_STAKING_CONTRACT, OPT_YVEXA_WETH_STAKING_CONTRACT, OPT_YVFRAX_DOLA_STAKING_CONTRACT, OPT_YVIB_WETH_STAKING_CONTRACT, OPT_YVLDO_WSTETH_STAKING_CONTRACT, OPT_YVLUSD_WETH_STAKING_CONTRACT, OPT_YVMAI_ALUSD_STAKING_CONTRACT, OPT_YVMAI_DOLA_STAKING_CONTRACT, OPT_YVMAI_STAKING_CONTRACT, OPT_YVMAI_USDC_STAKING_CONTRACT, OPT_YVMAIUSDC_STAKING_CONTRACT, OPT_YVMIM_USDC_STAKING_CONTRACT, OPT_YVMTA_USDC_STAKING_CONTRACT, OPT_YVOP_USDC_STAKING_CONTRACT, OPT_YVOP_VELO_STAKING_CONTRACT, OPT_YVSNX_USDC_STAKING_CONTRACT, OPT_YVSUSCUSDC_STAKING_CONTRACT, OPT_YVTBTC_WBTC_STAKING_CONTRACT,OPT_YVTBTC_WETH_STAKING_CONTRACT, OPT_YVUSDC_STAKING_CONTRACT, OPT_YVUSDT_STAKING_CONTRACT, OPT_YVVELO_USDC_STAKING_CONTRACT, OPT_YVWUSDR_USDC_STAKING_CONTRACT} from '@vaults/constants/optRewards'; +import {OPT_REWARDS_TOKENS, OPT_YVAGEUR_USDC_STAKING_CONTRACT, OPT_YVALETH_FRXETH_STAKING_CONTRACT, OPT_YVALETH_WETH_STAKING_CONTRACT, OPT_YVALUSD_FRAX_STAKING_CONTRACT, OPT_YVALUSD_USDC_STAKING_CONTRACT, OPT_YVDAI_STAKING_CONTRACT, OPT_YVDOLA_USDC_STAKING_CONTRACT, OPT_YVDOLAUSDC_STAKING_CONTRACT, OPT_YVERN_DOLA_STAKING_CONTRACT, OPT_YVERN_LUSD_STAKING_CONTRACT, OPT_YVETH_STAKING_CONTRACT, OPT_YVEXA_WETH_STAKING_CONTRACT, OPT_YVFRAX_DOLA_STAKING_CONTRACT, OPT_YVIB_WETH_STAKING_CONTRACT, OPT_YVLDO_WSTETH_STAKING_CONTRACT, OPT_YVLUSD_WETH_STAKING_CONTRACT, OPT_YVMAI_ALUSD_STAKING_CONTRACT, OPT_YVMAI_DOLA_STAKING_CONTRACT, OPT_YVMAI_STAKING_CONTRACT, OPT_YVMAI_USDC_STAKING_CONTRACT, OPT_YVMAIUSDC_STAKING_CONTRACT, OPT_YVMIM_USDC_STAKING_CONTRACT, OPT_YVMTA_USDC_STAKING_CONTRACT, OPT_YVOP_USDC_STAKING_CONTRACT, OPT_YVOP_VELO_STAKING_CONTRACT, OPT_YVSNX_USDC_STAKING_CONTRACT, OPT_YVSUSCUSDC_STAKING_CONTRACT, OPT_YVTBTC_WBTC_STAKING_CONTRACT, OPT_YVTBTC_WETH_STAKING_CONTRACT, OPT_YVUSDC_STAKING_CONTRACT, OPT_YVUSDT_STAKING_CONTRACT, OPT_YVVELO_USDC_STAKING_CONTRACT, OPT_YVWUSDR_USDC_STAKING_CONTRACT} from '@vaults/constants/optRewards'; import {useUI} from '@yearn-finance/web-lib/contexts/useUI'; import {useClientEffect} from '@yearn-finance/web-lib/hooks/useClientEffect'; import {toAddress} from '@yearn-finance/web-lib/utils/address'; diff --git a/apps/vaults/hooks/useSolverPortals.ts b/apps/vaults/hooks/useSolverPortals.ts index ff4f93904..5bb06e965 100644 --- a/apps/vaults/hooks/useSolverPortals.ts +++ b/apps/vaults/hooks/useSolverPortals.ts @@ -194,6 +194,7 @@ export function useSolverPortals(): TSolverContext { to: toAddress(to), ...rest }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any const hash = await wagmiProvider.walletClient.sendTransaction({...tx as any, chain}); const receipt = await waitForTransaction({chainId: wagmiProvider.chainId, hash}); if (receipt.status === 'success') {