Skip to content

Commit

Permalink
remove accountPLus
Browse files Browse the repository at this point in the history
  • Loading branch information
brucedonovan committed Dec 15, 2023
1 parent 63db42c commit 829d0e1
Show file tree
Hide file tree
Showing 45 changed files with 79 additions and 139 deletions.
5 changes: 2 additions & 3 deletions src/components/HeaderAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useState, useContext } from 'react';
import styled from 'styled-components';
import { Text, Box, ResponsiveContext } from 'grommet';
import Sidebar from './Sidebar';
import { UserContext } from '../contexts/UserContext';
import { useAccount, useBalance, useEnsName } from 'wagmi';
import { FiSettings } from 'react-icons/fi';
import Skeleton from 'react-loading-skeleton';
Expand All @@ -12,7 +11,6 @@ import EthMark from './logos/EthMark';
import YieldAvatar from './YieldAvatar';
import { useConnectModal } from '@rainbow-me/rainbowkit';
import HeaderBalances from './HeaderBalances';
import useAccountPlus from '../hooks/useAccountPlus';
import { SettingsContext } from '../contexts/SettingsContext';

const StyledText = styled(Text)`
Expand All @@ -39,9 +37,10 @@ const HeaderAccount = () => {
const { data: ensName } = useEnsName();
const { openConnectModal } = useConnectModal();

const { address: account } = useAccountPlus();
const { address: account } = useAccount();

const { data: ethBalance } = useBalance({ address: account });

const [settingsOpen, setSettingsOpen] = useState<boolean>(false);

const {
Expand Down
5 changes: 2 additions & 3 deletions src/components/HeaderBalances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import { UserContext } from '../contexts/UserContext';
import { WETH } from '../config/assets';
import Skeleton from './wraps/SkeletonWrap';
import Logo from './logos/Logo';
import { useAccount } from 'wagmi';
import { cleanValue } from '../utils/appUtils';
import useAccountPlus from '../hooks/useAccountPlus';
import { useAccount } from 'wagmi';

const StyledText = styled(Text)`
svg,
Expand Down Expand Up @@ -37,7 +36,7 @@ const YieldBalances = () => {
const baseBal = assetMap.get(selectedBase?.id!)?.balance_;
const ilkBal = assetMap.get(selectedIlk?.id!)?.balance_;

const { address: account } = useAccountPlus();
const { address: account } = useAccount();
const { pathname } = useRouter();
const [path, setPath] = useState<string>();

Expand Down
4 changes: 2 additions & 2 deletions src/components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SettingsContext } from '../contexts/SettingsContext';
import useAnalytics from '../hooks/useAnalytics';
import { GA_Event, GA_Properties } from '../types/analytics';
import NavText from './texts/NavText';
import useAccountPlus from '../hooks/useAccountPlus';
import { useAccount } from 'wagmi';

const StyledLink = styled.div`
text-decoration: none;
Expand Down Expand Up @@ -44,7 +44,7 @@ const Navigation = ({ sideNavigation }: IYieldNavigationProps) => {

const [height] = useWindowSize();

const { address: account } = useAccountPlus();
const { address: account } = useAccount();

const {
settingsState: { darkMode },
Expand Down
7 changes: 2 additions & 5 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ import ThemeSetting from './settings/ThemeSetting';
import UnwrapSetting from './settings/UnwrapSetting';
import CopyWrap from './wraps/CopyWrap';
import YieldAvatar from './YieldAvatar';
import { useEnsName, useNetwork } from 'wagmi';
import { FaWallet } from 'react-icons/fa';

import useAccountPlus from '../hooks/useAccountPlus';
import { useAccount, useEnsName, useNetwork } from 'wagmi';

const Sidebar = ({ settingsOpen, setSettingsOpen }: any) => {
const mobile: boolean = useContext<any>(ResponsiveContext) === 'small';

const { chain } = useNetwork();
const { address } = useAccountPlus();
const { address } = useAccount();
const { data: ensName } = useEnsName();

const { openAccountModal } = useAccountModal();
Expand Down
2 changes: 0 additions & 2 deletions src/components/TermsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import useAccountPlus from '../hooks/useAccountPlus';
import ModalWrap from './wraps/ModalWrap';
import { Box, Text, Layer, Button, CheckBox, ResponsiveContext } from 'grommet';
import { useState } from 'react';

Expand Down
4 changes: 2 additions & 2 deletions src/components/buttons/DashMobileButton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useRouter } from 'next/router';
import { Box, Text } from 'grommet';
import useAccountPlus from '../../hooks/useAccountPlus';
import { useAccount } from 'wagmi';

function DashMobileButton({ transparent }: { transparent?: boolean }) {
const router = useRouter();
const { address } = useAccountPlus();
const { address } = useAccount();

return address ? (
<Box
Expand Down
3 changes: 1 addition & 2 deletions src/components/buttons/MaxButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import styled from 'styled-components';
import { Box, Text } from 'grommet';
import { useAccount } from 'wagmi';
import useAccountPlus from '../../hooks/useAccountPlus';

interface IMaxButtonProps {
/* select series locally filters out the global selection from the list and returns the selected ISeries */
Expand All @@ -27,7 +26,7 @@ const StyledBox = styled(Box)`

function MaxButton({ action, clearAction, showingMax, disabled, customText }: IMaxButtonProps) {

const { address: activeAccount } = useAccountPlus();
const { address: activeAccount } = useAccount();

return (
<>
Expand Down
3 changes: 1 addition & 2 deletions src/components/selectors/LendPositionSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { ZERO_BN } from '../../utils/constants';
import LendItem from '../positionItems/LendItem';
import ListWrap from '../wraps/ListWrap';
import { useAccount } from 'wagmi';
import useAccountPlus from '../../hooks/useAccountPlus';
import useAffectedJuneLenders from '../../hooks/useAffectedJuneLenders';
import { FaInfoCircle } from 'react-icons/fa';

Expand All @@ -24,7 +23,7 @@ function PositionSelector({ actionType }: { actionType: ActionType }) {
const { userState } = useContext(UserContext);
const { seriesMap, selectedSeries, selectedBase } = userState;

const { address: activeAccount } = useAccountPlus();
const { address: activeAccount } = useAccount();
const checkIfAffectedJuneLender = useAffectedJuneLenders();

const [allPositions, setAllPositions] = useState<ISeries[]>([]);
Expand Down
3 changes: 1 addition & 2 deletions src/components/selectors/StrategyPositionSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ import { ZERO_BN } from '../../utils/constants';
import StrategyItem from '../positionItems/StrategyItem';
import ListWrap from '../wraps/ListWrap';
import { useAccount } from 'wagmi';
import useAccountPlus from '../../hooks/useAccountPlus';

function StrategyPositionSelector() {
/* STATE FROM CONTEXT */

const { userState } = useContext(UserContext);
const { strategyMap, selectedBase } = userState;

const { address: activeAccount } = useAccountPlus();
const { address: activeAccount } = useAccount();

const [allPositions, setAllPositions] = useState<IStrategy[]>([]);
const [showAllPositions, setShowAllPositions] = useState<boolean>(false);
Expand Down
4 changes: 2 additions & 2 deletions src/components/selectors/VaultPositionSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { IAsset, ISeries, IVault } from '../../types';
import VaultListItem from '../positionItems/VaultItem';
import ListWrap from '../wraps/ListWrap';
import { SettingsContext } from '../../contexts/SettingsContext';
import useAccountPlus from '../../hooks/useAccountPlus';
import { useAccount } from 'wagmi';

interface IVaultFilter {
base: IAsset | undefined;
Expand All @@ -23,7 +23,7 @@ function VaultPositionSelector(target: any) {
userState: { vaultMap, selectedSeries, selectedBase },
} = useContext(UserContext);

const { address: account } = useAccountPlus();
const { address: account } = useAccount();

/* LOCAL STATE */
const [showAllVaults, setShowAllVaults] = useState<boolean>(false);
Expand Down
2 changes: 0 additions & 2 deletions src/components/settings/SupportSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ const SupportSettings = () => {
} = useContext(SettingsContext);

const { address } = useAccount();

// const account = useAccountPlus();
const { fillEther, createNewFork } = useFork();

const [forkUrlInput, setForkUrlInput] = useState<string>(forkEnvUrl);
Expand Down
7 changes: 3 additions & 4 deletions src/components/views/Borrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ import Navigation from '../Navigation';
import VaultItem from '../positionItems/VaultItem';
import useAssetPair from '../../hooks/useAssetPair';
import Line from '../elements/Line';
import { useAccount, useNetwork } from 'wagmi';
import { GA_Event, GA_Properties, GA_View } from '../../types/analytics';
import useAnalytics from '../../hooks/useAnalytics';
import { WETH } from '../../config/assets';
import useContracts from '../../hooks/useContracts';
import useAccountPlus from '../../hooks/useAccountPlus';
import { useAccount } from 'wagmi';

const Borrow = () => {
const mobile: boolean = useContext<any>(ResponsiveContext) === 'small';
Expand All @@ -60,11 +59,11 @@ const Borrow = () => {

/* STATE FROM CONTEXT */
const { userState, userActions } = useContext(UserContext);
const { assetMap, vaultMap, vaultsLoading, seriesMap, selectedSeries, selectedIlk, selectedBase, selectedVault } =
const { assetMap, vaultMap, vaultsLoading, selectedSeries, selectedIlk, selectedBase, selectedVault } =
userState;
const { setSelectedIlk } = userActions;

const { address: activeAccount } = useAccountPlus();
const { address: activeAccount } = useAccount();
const contracts = useContracts();

/* LOCAL STATE */
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useDashboardHelpers } from '../../hooks/viewHelperHooks/useDashboardHel
import { UserContext } from '../../contexts/UserContext';
import { formatValue } from '../../utils/appUtils';
import { Settings } from '../../contexts/types/settings';
import useAccountPlus from '../../hooks/useAccountPlus';
import { useAccount } from 'wagmi';

const StyledBox = styled(Box)`
* {
Expand Down Expand Up @@ -43,7 +43,7 @@ const Dashboard = () => {
chainState: { chainLoaded },
} = useContext(ChainContext);

const { address: account } = useAccountPlus();
const { address: account } = useAccount();

const {
vaultPositions,
Expand Down
8 changes: 3 additions & 5 deletions src/components/views/Lend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ import { useAccount } from 'wagmi';
import { GA_Event, GA_Properties, GA_View } from '../../types/analytics';
import useAnalytics from '../../hooks/useAnalytics';
import { WETH } from '../../config/assets';
import useAccountPlus from '../../hooks/useAccountPlus';
import useAffectedJuneLenders from '../../hooks/useAffectedJuneLenders';
import useChainId from '../../hooks/useChainId';
// import useAffectedJuneLenders from '../../hooks/useAffectedJuneLenders';
// import useChainId from '../../hooks/useChainId';

const Lend = () => {
const mobile: boolean = useContext<any>(ResponsiveContext) === 'small';
Expand All @@ -56,7 +55,7 @@ const Lend = () => {
const { userState } = useContext(UserContext);
const { selectedSeries, selectedBase, seriesMap } = userState;

const { address: activeAccount } = useAccountPlus();
const { address: activeAccount } = useAccount();

/* LOCAL STATE */
const [modalOpen, toggleModal] = useState<boolean>(false);
Expand All @@ -78,7 +77,6 @@ const Lend = () => {
const { inputError: lendError } = useInputValidation(lendInput, ActionCodes.LEND, selectedSeries, [0, maxLend_]);



/* LOCAL FNS */
const handleLend = () => {
if (lendDisabled) return;
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/Pool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import useAnalytics from '../../hooks/useAnalytics';
import { WETH } from '../../config/assets';
import { StrategyType } from '../../config/strategies';
import { toast } from 'react-toastify';
import useAccountPlus from '../../hooks/useAccountPlus';
import { useAccount } from 'wagmi';

function Pool() {
const mobile: boolean = useContext<any>(ResponsiveContext) === 'small';
Expand All @@ -48,7 +48,7 @@ function Pool() {
const { userState } = useContext(UserContext);
const { selectedBase, selectedStrategy, strategyMap } = userState;

const { address: activeAccount } = useAccountPlus();
const { address: activeAccount } = useAccount();

/* LOCAL STATE */
const [poolInput, setPoolInput] = useState<string | undefined>(undefined);
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/PoolPosition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import useStrategyReturns from '../../hooks/useStrategyReturns';
import GeneralButton from '../buttons/GeneralButton';
import { MdShortcut } from 'react-icons/md';
import { ZERO_BN } from '@yield-protocol/ui-math';
import useAccountPlus from '../../hooks/useAccountPlus';
import { StrategyType } from '../../config/strategies';
import { FRAX } from '../../config/assets';
import { FaExclamationCircle } from 'react-icons/fa';
Expand All @@ -57,7 +56,7 @@ const PoolPosition = () => {
} = useContext(UserContext);
const { selectedStrategy, strategyMap, assetMap, seriesLoading } = userState;

const { address: activeAccount } = useAccountPlus();
const { address: activeAccount } = useAccount();

const _selectedStrategy = selectedStrategy || strategyMap?.get((idFromUrl as string).toLowerCase());

Expand Down
3 changes: 1 addition & 2 deletions src/components/views/VaultPosition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import useAnalytics from '../../hooks/useAnalytics';
import { GA_Event, GA_View, GA_Properties } from '../../types/analytics';
import { WETH } from '../../config/assets';
import { Address } from '@wagmi/core';
import useAccountPlus from '../../hooks/useAccountPlus';

const VaultPosition = () => {
const mobile: boolean = useContext<any>(ResponsiveContext) === 'small';
Expand All @@ -59,7 +58,7 @@ const VaultPosition = () => {
const { assetMap, seriesMap, vaultMap, vaultsLoading } = userState;
const { setSelectedBase, setSelectedIlk, setSelectedSeries, setSelectedVault } = userActions;

const { address: account } = useAccountPlus();
const { address: account } = useAccount();

const _selectedVault = vaultMap?.get(idFromUrl as string);

Expand Down
3 changes: 1 addition & 2 deletions src/components/wraps/ActionButtonWrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Button, Box, Text, Layer, ResponsiveContext } from 'grommet';
import { useColorScheme } from '../../hooks/useColorScheme';
import { useConnectModal } from '@rainbow-me/rainbowkit';
import { useAccount } from 'wagmi';
import useAccountPlus from '../../hooks/useAccountPlus';

const StyledButton: any = styled(Button)`
-webkit-transition: transform 0.2s ease-in-out;
Expand Down Expand Up @@ -49,7 +48,7 @@ function ActionButtonWrap({ children, pad }: { children: any; pad?: boolean }) {
const mobile: boolean = useContext<any>(ResponsiveContext) === 'small';
const theme = useColorScheme();
const { openConnectModal } = useConnectModal();
const { address } = useAccountPlus();
const { address } = useAccount();

return mobile ? (
<Layer position="bottom" background="background" modal={false} responsive={false} full="horizontal" animate={false}>
Expand Down
1 change: 0 additions & 1 deletion src/contexts/ChainContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { Pool__factory } from '../contracts';

import { SettingsContext } from './SettingsContext';
import { useEthersProvider } from '../hooks/useEthersProvider';
import { useNetwork } from 'wagmi';
import useChainId from '../hooks/useChainId';

const initState: IChainContextState = {
Expand Down
4 changes: 2 additions & 2 deletions src/contexts/HistoryContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import { LiquidityEvent, TradeEvent } from '../contracts/Pool';
import { VaultGivenEvent, VaultPouredEvent, VaultRolledEvent } from '../contracts/Cauldron';
import useContracts from '../hooks/useContracts';

import useAccountPlus from '../hooks/useAccountPlus';
import useFork from '../hooks/useFork';
import { ContractNames } from '../config/contracts';
import { useEthersProvider } from '../hooks/useEthersProvider';
import { useAccount } from 'wagmi';

const dateFormat = (dateInSecs: number) => format(new Date(dateInSecs * 1000), 'dd MMM yyyy');

Expand Down Expand Up @@ -99,7 +99,7 @@ const HistoryProvider = ({ children }: any) => {
const provider = useEthersProvider();
const contracts = useContracts();
const [historyState, updateState] = useReducer(historyReducer, initState);
const { address: account } = useAccountPlus();
const { address: account } = useAccount();

const {
settingsState: { diagnostics },
Expand Down
3 changes: 1 addition & 2 deletions src/contexts/TxContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ApprovalType, ISignData, TxState, ProcessStage, IYieldProcess } from '.
import { useAccount, useBalance, useNetwork } from 'wagmi';
import useAnalytics from '../hooks/useAnalytics';
import { GA_Event, GA_Properties } from '../types/analytics';
import useAccountPlus from '../hooks/useAccountPlus';
import { useEthersProvider } from '../hooks/useEthersProvider';

enum TxStateItem {
Expand Down Expand Up @@ -125,7 +124,7 @@ const TxProvider = ({ children }: any) => {
};

const provider = useEthersProvider();
const { address: account } = useAccountPlus();
const { address: account } = useAccount();
const { refetch: refetchETHBal } = useBalance({ address: account });

const { logAnalyticsEvent } = useAnalytics();
Expand Down
4 changes: 2 additions & 2 deletions src/contexts/UserContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import { IUserContextActions, IUserContextState, UserContextAction, UserState }
import useFork from '../hooks/useFork';
import { formatUnits } from 'ethers/lib/utils';
import useBalances, { BalanceData } from '../hooks/useBalances';
import useAccountPlus from '../hooks/useAccountPlus';
import { ContractNames } from '../config/contracts';
import { StrategyType } from '../config/strategies';
import { useEthersProvider } from '../hooks/useEthersProvider';
import { useAccount } from 'wagmi';

const initState: IUserContextState = {
userLoading: false,
Expand Down Expand Up @@ -139,7 +139,7 @@ const UserProvider = ({ children }: { children: ReactNode }) => {
const chainId = useChainId();
const provider = useEthersProvider();

const { address: account } = useAccountPlus();
const { address: account } = useAccount();

const { pathname } = useRouter();

Expand Down
Loading

0 comments on commit 829d0e1

Please sign in to comment.