Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f30249b
feat(WalletWidget): added Alert component
MatthewCYLau Aug 22, 2022
071d9f3
feat(mockWalletAddressContext): added mockWalletAddressContext
MatthewCYLau Aug 22, 2022
b9cfa76
feat(WalletSelector): added input to wallet selector for mock address
MatthewCYLau Aug 23, 2022
58632a6
feat(WatchOnlyModeTooltip): added WatchOnlyMode tooltip
MatthewCYLau Aug 23, 2022
c9022d5
feat(WalletSelector): use web3 context for set mock adddress
MatthewCYLau Aug 23, 2022
eac8a37
chore(WalletWidget): removed console log
MatthewCYLau Aug 23, 2022
ee9c4c6
chore: merge with latest main
MatthewCYLau Aug 24, 2022
7824af7
feat(WalletWidget): added warning icon
MatthewCYLau Aug 24, 2022
92e0567
chore: updated message.js
MatthewCYLau Aug 24, 2022
aa1a46b
chore: update with main
MatthewCYLau Aug 25, 2022
c293c3f
chore: updated message.js
MatthewCYLau Aug 25, 2022
f57cc68
feat(Web3Provider): updated condition to render Wallet Modal
MatthewCYLau Aug 25, 2022
3a836cc
feat(TxActionsWrapper): render warning text when using mockAddress
MatthewCYLau Aug 26, 2022
87b0d25
chore: updated messages
MatthewCYLau Aug 26, 2022
3c6417a
Merge branch 'main' of https://github.com/MatthewCYLau/interface into…
MatthewCYLau Aug 26, 2022
d5bd722
feat(WalletSelector): use utils to check if mock address is valid
MatthewCYLau Aug 26, 2022
89a6dfa
feat(TxActionsWrapper): disabled button if mockAddress is present
MatthewCYLau Aug 27, 2022
9db5194
chore(cypress.config): added eslint ignore
MatthewCYLau Sep 5, 2022
892e62f
chore: updated message.js
MatthewCYLau Sep 5, 2022
bb3347f
feat: do not render ChangeNetworkWarning when mockAddress is present
MatthewCYLau Sep 5, 2022
7242db2
feat(WalletWidget): added buttons to switch network and disconnect
MatthewCYLau Sep 5, 2022
64f734c
feat(WalletWidget): adjusted margin
MatthewCYLau Sep 5, 2022
b1879d0
chore(WalletWidget): removed Disconnect Wallet button
MatthewCYLau Sep 5, 2022
4c7360e
chore: removed temp value for max amount to borrow
MatthewCYLau Sep 5, 2022
8fd8b89
chore: updated messages.po
MatthewCYLau Sep 5, 2022
e770173
Merge branch 'main' of https://github.com/MatthewCYLau/interface into…
MatthewCYLau Sep 6, 2022
a7bcecc
chore: updated markdown to trigger git delta
MatthewCYLau Sep 6, 2022
9e1b442
chore: reverted changes to Code of Conduct md
MatthewCYLau Sep 6, 2022
6229651
chore: updated with main
MatthewCYLau Sep 8, 2022
a0d9afe
chore: updated message.js
MatthewCYLau Sep 8, 2022
259bc6b
chore: resolved merge conflict
MatthewCYLau Sep 19, 2022
eb7a675
chore: unimport WatchOnlyModeToolTip to ensure message.js is updated
MatthewCYLau Sep 19, 2022
0d8b3b4
chore(cypress.config): removed eslint-disable
MatthewCYLau Sep 19, 2022
bad5b5d
chore(WalletSelector): re-import WatchOnlyModeToolTip
MatthewCYLau Sep 19, 2022
3b89196
feat(WalletWidget): set wallet widget to close when clicking switch w…
MatthewCYLau Sep 19, 2022
dc8b726
feat(Web3Provider): when connect wallet, check and remove mock address
MatthewCYLau Sep 19, 2022
3addedb
feat: if mockAddress is present, do not render approval help text and…
MatthewCYLau Sep 20, 2022
c7d3260
feat: on mobile, if mockAddress is present, render Close menu icon
MatthewCYLau Sep 20, 2022
7315bac
feat(WalletWidget): update styling for warning text in mobile
MatthewCYLau Sep 20, 2022
7b86ef8
feat(WalletWidget): on mobile, render CTAs at list buttom
MatthewCYLau Sep 20, 2022
b1015d3
chore: merged with main
MatthewCYLau Sep 20, 2022
c9d5398
feat(WalletWidget): add color styling to CTAs
MatthewCYLau Sep 20, 2022
a706a30
feat(WalletWidget): styling for avatar icon on mobile
MatthewCYLau Sep 21, 2022
e7f0d8c
chore: updated message.js
MatthewCYLau Sep 21, 2022
934e149
feat(WalletWidget): update styling for warning icon background
MatthewCYLau Sep 21, 2022
895cf0f
feat(WalletWidget): use hideWalletAccountText variable to determine m…
MatthewCYLau Sep 21, 2022
1541aed
chore: merge with main
MatthewCYLau Sep 22, 2022
df2233f
chore(WalletWidget): removed un-used improt
MatthewCYLau Sep 22, 2022
04b9336
feat(WalletWidget): fine-tune warning icon color
MatthewCYLau Sep 22, 2022
4c2831e
feat(WalletWidget): updated styling to background and CTA buttons
MatthewCYLau Sep 24, 2022
99af72f
feat(WalletWidget): added Divider
MatthewCYLau Sep 24, 2022
a4b418a
chore(WalletWidget): updated copy
MatthewCYLau Sep 24, 2022
3bf300e
feat(WalletSelector): use fullWifth props for button
MatthewCYLau Sep 26, 2022
c25eeac
feat(WalletSelector): use fullWidfth props for input
MatthewCYLau Sep 26, 2022
91c0766
feat(WatchOnlyModeTooltip): re-named component with correct casing
MatthewCYLau Sep 26, 2022
4e1e4c2
feat(WalletSelector): added boolean state to check for valid address …
MatthewCYLau Sep 26, 2022
7c8313f
feat(WalletWidget): added handle switch wallet method
MatthewCYLau Sep 26, 2022
42de845
chore: updated messages.js
MatthewCYLau Sep 26, 2022
d7ad1b2
chore: code style changes
drewcook Sep 27, 2022
50161f9
Merge branch 'main' into feat/watch-mode
grothem Sep 27, 2022
92a2fe1
update tests
Sep 28, 2022
806d25b
fix: use proper app header color
drewcook Sep 28, 2022
595025a
fix: prevent auto zoom on mobile on watch address input
grothem Sep 28, 2022
20470e4
test: don't set a watch wallet in cypress tests
grothem Sep 28, 2022
a04434d
Merge branch 'main' into feat/watch-mode
grothem Sep 28, 2022
fe8ffb4
feat: wrap in form to allow input by pressing enter
defispartan Sep 29, 2022
b4b1997
feat: add support for watching ens names
defispartan Sep 29, 2022
b88bee8
feat: add ENS to placeholder text
defispartan Sep 29, 2022
7ff4fdb
feat: enable watch button for ens inputs
defispartan Sep 29, 2022
5cb35cd
chore: use proper submit button for form
drewcook Sep 29, 2022
9c90b42
chore: sx styles
drewcook Sep 29, 2022
57c3b18
fix tests
Sep 29, 2022
6789c1a
Merge branch 'main' into feat/watch-mode
grothem Sep 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cypress/e2e/2-settings/wallet-connect.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ describe('Manipulation on the wallet connect', () => {
const walletButton = '#wallet-button';

it('step1:Disconnect wallet', () => {
cy.wait(1000);
cy.get(walletButton).click();
cy.contains('Disconnect Wallet').click();
cy.contains('Disconnect').click();
cy.contains('Please, connect your wallet').should('be.visible');
});

Expand Down
1 change: 0 additions & 1 deletion cypress/support/steps/configuration.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export const configEnvWithTenderly = ({
win.localStorage.setItem('selectedAccount', walletAddress.toLowerCase());
win.localStorage.setItem('selectedMarket', market);
win.localStorage.setItem('testnetsEnabled', enableTestnet.toString());
win.localStorage.setItem('mockWalletAddress', walletAddress.toLowerCase());
},
});
});
Expand Down
97 changes: 95 additions & 2 deletions src/components/WalletConnection/WalletSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import { Trans } from '@lingui/macro';
import { Alert, Box, Button, Link, Typography } from '@mui/material';
import {
Alert,
Box,
Button,
InputBase,
Link,
Typography,
useMediaQuery,
useTheme,
} from '@mui/material';
import { UnsupportedChainIdError } from '@web3-react/core';
import { NoEthereumProviderError } from '@web3-react/injected-connector';
import { UserRejectedRequestError } from '@web3-react/walletconnect-connector';
import { utils } from 'ethers';
import { useState } from 'react';
import { WatchOnlyModeTooltip } from 'src/components/infoTooltips/WatchOnlyModeTooltip';
import { useWeb3Context } from 'src/libs/hooks/useWeb3Context';
import { WalletType } from 'src/libs/web3-data-provider/WalletOptions';
import { getENSProvider } from 'src/utils/marketsAndNetworksConfig';

import { TxModalTitle } from '../transactions/FlowCommons/TxModalTitle';

Expand Down Expand Up @@ -95,7 +108,12 @@ export enum ErrorType {
}

export const WalletSelector = () => {
const { error } = useWeb3Context();
const { error, updateWatchModeOnlyAddress } = useWeb3Context();
const [inputMockWalletAddress, setInputMockWalletAddress] = useState('');
const [validAddressError, setValidAddressError] = useState<boolean>(false);
const { breakpoints } = useTheme();
const sm = useMediaQuery(breakpoints.down('sm'));
const mainnetProvider = getENSProvider();

let blockingError: ErrorType | undefined = undefined;
if (error) {
Expand Down Expand Up @@ -125,6 +143,31 @@ export const WalletSelector = () => {
}
};

const handleWatchAddress = async (inputMockWalletAddress: string): Promise<void> => {
if (validAddressError) setValidAddressError(false);
if (utils.isAddress(inputMockWalletAddress)) {
updateWatchModeOnlyAddress(inputMockWalletAddress);
} else {
// Check if address could be valid ENS before trying to resolve
if (inputMockWalletAddress.slice(-4) !== '.eth') {
setValidAddressError(true);
} else {
// Attempt to resolve ENS name and use resolved address if valid
const resolvedAddress = await mainnetProvider.resolveName(inputMockWalletAddress);
if (resolvedAddress && utils.isAddress(resolvedAddress)) {
updateWatchModeOnlyAddress(resolvedAddress);
} else {
setValidAddressError(true);
}
}
}
};

const handleSubmit = (event: React.FormEvent<HTMLFormElement>): void => {
event.preventDefault();
handleWatchAddress(inputMockWalletAddress);
};

return (
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
<TxModalTitle title="Connect a wallet" />
Expand All @@ -150,6 +193,56 @@ export const WalletSelector = () => {
/>
<WalletRow key="torus_wallet" walletName="Torus" walletType={WalletType.TORUS} />
<WalletRow key="frame_wallet" walletName="Frame" walletType={WalletType.FRAME} />
<Box sx={{ display: 'flex', alignItems: 'center', mb: 1, padding: '10px 0' }}>
<Typography variant="subheader1" color="text.secondary">
<Trans>Enter an address to track in watch-only mode</Trans>
</Typography>
<WatchOnlyModeTooltip />
</Box>
<form onSubmit={handleSubmit}>
<InputBase
sx={(theme) => ({
py: 1,
px: 3,
border: `1px solid ${theme.palette.divider}`,
borderRadius: '6px',
mb: 1,
overflow: 'show',
fontSize: sm ? '16px' : '14px',
})}
placeholder="Enter ethereum address or ENS name"
fullWidth
autoFocus
value={inputMockWalletAddress}
onChange={(e) => setInputMockWalletAddress(e.target.value)}
inputProps={{
'aria-label': 'watch mode only address',
}}
/>
<Button
type="submit"
variant="outlined"
sx={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
mb: '8px',
}}
size="large"
fullWidth
disabled={
!utils.isAddress(inputMockWalletAddress) && inputMockWalletAddress.slice(-4) !== '.eth'
}
aria-label="watch mode only address"
>
Watch address
</Button>
</form>
{validAddressError && (
<Typography variant="helperText" color="error.main">
<Trans>Please enter a valid wallet address.</Trans>
</Typography>
)}
<Typography variant="description" sx={{ mt: '22px', mb: '30px', alignSelf: 'center' }}>
<Trans>
Need help connecting a wallet?{' '}
Expand Down
14 changes: 14 additions & 0 deletions src/components/infoTooltips/WatchOnlyModeTooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Trans } from '@lingui/macro';

import { TextWithTooltip, TextWithTooltipProps } from '../TextWithTooltip';

export const WatchOnlyModeTooltip = ({ ...rest }: TextWithTooltipProps) => {
return (
<TextWithTooltip {...rest}>
<Trans>
Watch-only mode allows to see address positions in Aave, but you won&apos;t be able to
perform transactions.
</Trans>
</TextWithTooltip>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ClaimRewardsModalContent = () => {
const { gasLimit, mainTxState: claimRewardsTxState, txError } = useModalContext();
const { user, reserves } = useAppDataContext();
const { currentChainId, currentMarketData, currentMarket } = useProtocolDataContext();
const { chainId: connectedChainId } = useWeb3Context();
const { chainId: connectedChainId, watchModeOnlyAddress } = useWeb3Context();
const [claimableUsd, setClaimableUsd] = useState('0');
const [selectedRewardSymbol, setSelectedRewardSymbol] = useState<string>('all');
const [rewards, setRewards] = useState<Reward[]>([]);
Expand Down Expand Up @@ -140,7 +140,7 @@ export const ClaimRewardsModalContent = () => {
return (
<>
<TxModalTitle title="Claim rewards" />
{isWrongNetwork && (
{isWrongNetwork && !watchModeOnlyAddress && (
<ChangeNetworkWarning networkName={networkConfig.name} chainId={currentChainId} />
)}

Expand Down
4 changes: 2 additions & 2 deletions src/components/transactions/Emode/EmodeModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const EmodeModalContent = ({ mode }: EmodeModalContentProps) => {
userReserves,
} = useAppDataContext();
const { currentChainId } = useProtocolDataContext();
const { chainId: connectedChainId } = useWeb3Context();
const { chainId: connectedChainId, watchModeOnlyAddress } = useWeb3Context();
const currentTimestamp = useCurrentTimestamp(1);
const { gasLimit, mainTxState: emodeTxState, txError } = useModalContext();

Expand Down Expand Up @@ -178,7 +178,7 @@ export const EmodeModalContent = ({ mode }: EmodeModalContentProps) => {
return (
<>
<TxModalTitle title={`${mode} E-Mode`} />
{isWrongNetwork && (
{isWrongNetwork && !watchModeOnlyAddress && (
<ChangeNetworkWarning networkName={networkConfig.name} chainId={currentChainId} />
)}

Expand Down
4 changes: 2 additions & 2 deletions src/components/transactions/FlowCommons/ModalWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const ModalWrapper: React.FC<{
requiredPermission,
keepWrappedSymbol,
}) => {
const { chainId: connectedChainId } = useWeb3Context();
const { chainId: connectedChainId, watchModeOnlyAddress } = useWeb3Context();
const { walletBalances } = useWalletBalances();
const {
currentChainId: marketChainId,
Expand Down Expand Up @@ -95,7 +95,7 @@ export const ModalWrapper: React.FC<{
{!mainTxState.success && (
<TxModalTitle title={title} symbol={hideTitleSymbol ? undefined : symbol} />
)}
{isWrongNetwork && (
{isWrongNetwork && !watchModeOnlyAddress && (
<ChangeNetworkWarning
networkName={getNetworkConfig(requiredChainId).name}
chainId={requiredChainId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export enum ErrorType {
}

export const GovDelegationModalContent = () => {
const { chainId: connectedChainId } = useWeb3Context();
const { chainId: connectedChainId, watchModeOnlyAddress } = useWeb3Context();
const {
daveTokens: { aave, stkAave },
} = useAaveTokensProviderContext();
Expand Down Expand Up @@ -101,7 +101,7 @@ export const GovDelegationModalContent = () => {
return (
<>
<TxModalTitle title="Delegate your power" />
{isWrongNetwork && (
{isWrongNetwork && !watchModeOnlyAddress && (
<ChangeNetworkWarning networkName={networkConfig.name} chainId={govChain} />
)}
<Typography variant="description">
Expand Down
4 changes: 2 additions & 2 deletions src/components/transactions/GovVote/GovVoteModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const GovVoteModalContent = ({
support,
power: votingPower,
}: GovVoteModalContentProps) => {
const { chainId: connectedChainId } = useWeb3Context();
const { chainId: connectedChainId, watchModeOnlyAddress } = useWeb3Context();
const { gasLimit, mainTxState: txState, txError } = useModalContext();
const { currentNetworkConfig, currentChainId } = useProtocolDataContext();

Expand Down Expand Up @@ -78,7 +78,7 @@ export const GovVoteModalContent = ({
return (
<>
<TxModalTitle title="Governance vote" />
{isWrongNetwork && (
{isWrongNetwork && !watchModeOnlyAddress && (
<ChangeNetworkWarning networkName={networkConfig.name} chainId={govChain} />
)}
{blockingError !== undefined && (
Expand Down
4 changes: 2 additions & 2 deletions src/components/transactions/Stake/StakeModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type StakingType = 'aave' | 'bpt';
export const StakeModalContent = ({ stakeAssetName, icon }: StakeProps) => {
const data = useStakeData();
const stakeData = data.stakeGeneralResult?.stakeGeneralUIData[stakeAssetName as StakingType];
const { chainId: connectedChainId } = useWeb3Context();
const { chainId: connectedChainId, watchModeOnlyAddress } = useWeb3Context();
const { gasLimit, mainTxState: txState, txError } = useModalContext();
const { currentNetworkConfig, currentChainId } = useProtocolDataContext();

Expand Down Expand Up @@ -97,7 +97,7 @@ export const StakeModalContent = ({ stakeAssetName, icon }: StakeProps) => {
return (
<>
<TxModalTitle title="Stake" symbol={icon} />
{isWrongNetwork && (
{isWrongNetwork && !watchModeOnlyAddress && (
<ChangeNetworkWarning networkName={networkConfig.name} chainId={stakingChain} />
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type StakingType = 'aave' | 'bpt';

export const StakeCooldownModalContent = ({ stakeAssetName }: StakeCooldownProps) => {
const { stakeUserResult, stakeGeneralResult } = useStakeData();
const { chainId: connectedChainId } = useWeb3Context();
const { chainId: connectedChainId, watchModeOnlyAddress } = useWeb3Context();
const { gasLimit, mainTxState: txState, txError } = useModalContext();
const { currentNetworkConfig, currentChainId } = useProtocolDataContext();

Expand Down Expand Up @@ -108,7 +108,7 @@ export const StakeCooldownModalContent = ({ stakeAssetName }: StakeCooldownProps
return (
<>
<TxModalTitle title="Cooldown to unstake" />
{isWrongNetwork && (
{isWrongNetwork && !watchModeOnlyAddress && (
<ChangeNetworkWarning networkName={networkConfig.name} chainId={stakingChain} />
)}
<Typography variant="description" sx={{ mb: 6 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type StakingType = 'aave' | 'bpt';
export const StakeRewardClaimModalContent = ({ stakeAssetName }: StakeRewardClaimProps) => {
const data = useStakeData();
const stakeData = data.stakeGeneralResult?.stakeGeneralUIData[stakeAssetName as StakingType];
const { chainId: connectedChainId } = useWeb3Context();
const { chainId: connectedChainId, watchModeOnlyAddress } = useWeb3Context();
const { gasLimit, mainTxState: txState, txError } = useModalContext();
const { currentNetworkConfig, currentChainId } = useProtocolDataContext();

Expand Down Expand Up @@ -89,7 +89,7 @@ export const StakeRewardClaimModalContent = ({ stakeAssetName }: StakeRewardClai
return (
<>
<TxModalTitle title="Claim" symbol={rewardsSymbol} />
{isWrongNetwork && (
{isWrongNetwork && !watchModeOnlyAddress && (
<ChangeNetworkWarning networkName={networkConfig.name} chainId={stakingChain} />
)}
{blockingError !== undefined && (
Expand Down
15 changes: 11 additions & 4 deletions src/components/transactions/TxActionsWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Trans } from '@lingui/macro';
import { Box, BoxProps, Button, CircularProgress } from '@mui/material';
import { Box, BoxProps, Button, CircularProgress, Typography } from '@mui/material';
import isEmpty from 'lodash/isEmpty';
import { ReactNode } from 'react';
import { TxStateType, useModalContext } from 'src/hooks/useModal';
import { useWeb3Context } from 'src/libs/hooks/useWeb3Context';
import { TxAction } from 'src/ui-config/errorMapping';

import { LeftHelperText } from './FlowCommons/LeftHelperText';
Expand Down Expand Up @@ -42,6 +43,7 @@ export const TxActionsWrapper = ({
...rest
}: TxActionsWrapperProps) => {
const { txError, retryWithApproval } = useModalContext();
const { watchModeOnlyAddress } = useWeb3Context();

const hasApprovalError =
requiresApproval && txError && txError.txAction === TxAction.APPROVAL && txError.actionBlocked;
Expand Down Expand Up @@ -87,14 +89,14 @@ export const TxActionsWrapper = ({

return (
<Box sx={{ display: 'flex', flexDirection: 'column', mt: 12, ...sx }} {...rest}>
{requiresApproval && (
{requiresApproval && !watchModeOnlyAddress && (
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}>
<LeftHelperText amount={amount} approvalHash={approvalTxState?.txHash} />
<RightHelperText approvalHash={approvalTxState?.txHash} />
</Box>
)}

{approvalParams && (
{approvalParams && !watchModeOnlyAddress && (
<Button
variant="contained"
disabled={approvalParams.disabled || blocked}
Expand All @@ -112,7 +114,7 @@ export const TxActionsWrapper = ({

<Button
variant="contained"
disabled={disabled || blocked}
disabled={disabled || blocked || watchModeOnlyAddress !== undefined}
onClick={handleClick}
size="large"
sx={{ minHeight: '44px', ...(approvalParams ? { mt: 2 } : {}) }}
Expand All @@ -121,6 +123,11 @@ export const TxActionsWrapper = ({
{loading && <CircularProgress color="inherit" size="16px" sx={{ mr: 2 }} />}
{content}
</Button>
{watchModeOnlyAddress && (
<Typography variant="helperText" color="warning.main" sx={{ textAlign: 'center', mt: 2 }}>
<Trans>Watch-only mode. Connect to a wallet to perform transactions.</Trans>
</Typography>
)}
</Box>
);
};
4 changes: 2 additions & 2 deletions src/components/transactions/UnStake/UnStakeModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type StakingType = 'aave' | 'bpt';
export const UnStakeModalContent = ({ stakeAssetName, icon }: UnStakeProps) => {
const data = useStakeData();
const stakeData = data.stakeGeneralResult?.stakeGeneralUIData[stakeAssetName as StakingType];
const { chainId: connectedChainId } = useWeb3Context();
const { chainId: connectedChainId, watchModeOnlyAddress } = useWeb3Context();
const { gasLimit, mainTxState: txState, txError } = useModalContext();
const { currentNetworkConfig, currentChainId } = useProtocolDataContext();

Expand Down Expand Up @@ -97,7 +97,7 @@ export const UnStakeModalContent = ({ stakeAssetName, icon }: UnStakeProps) => {
return (
<>
<TxModalTitle title="Unstake" symbol={icon} />
{isWrongNetwork && (
{isWrongNetwork && !watchModeOnlyAddress && (
<ChangeNetworkWarning networkName={networkConfig.name} chainId={stakingChain} />
)}
<AssetInput
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useWalletModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export const WalletModalContext = createContext<WalletModalContextType>(
);

export const WalletModalContextProvider: React.FC = ({ children }) => {
const { connected } = useWeb3Context();
const { connected, watchModeOnlyAddress } = useWeb3Context();

const [isWalletModalOpen, setWalletModalOpen] = useState(false);

useEffect(() => {
if (connected) {
if (connected || watchModeOnlyAddress) {
setWalletModalOpen(false);
}
}, [connected]);
}, [connected, watchModeOnlyAddress]);

return (
<WalletModalContext.Provider
Expand Down
Loading