Skip to content

Commit

Permalink
refactor: remove reassignment
Browse files Browse the repository at this point in the history
  • Loading branch information
truemiller committed Aug 28, 2024
1 parent 5d75760 commit e6d7af9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions frontend/components/MainPage/sections/AddFundsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import styled from 'styled-components';
import { UNICODE_SYMBOLS } from '@/constants/symbols';
import { COW_SWAP_GNOSIS_XDAI_OLAS_URL } from '@/constants/urls';
import { useWallet } from '@/hooks/useWallet';
import { Address } from '@/types/Address';
import { copyToClipboard } from '@/utils/copyToClipboard';
import { truncateAddress } from '@/utils/truncate';

Expand Down Expand Up @@ -66,27 +65,25 @@ export const AddFundsSection = () => {
export const OpenAddFundsSection = () => {
const { masterSafeAddress } = useWallet();

const fundingAddress: Address | undefined = masterSafeAddress;

const truncatedFundingAddress: string | undefined = useMemo(
() => fundingAddress && truncateAddress(fundingAddress),
[fundingAddress],
() => masterSafeAddress && truncateAddress(masterSafeAddress),
[masterSafeAddress],
);

const handleCopyAddress = useCallback(
() =>
fundingAddress &&
copyToClipboard(fundingAddress).then(() =>
masterSafeAddress &&
copyToClipboard(masterSafeAddress).then(() =>
message.success('Copied successfully!'),
),
[fundingAddress],
[masterSafeAddress],
);
return (
<>
<AddFundsWarningAlertSection />
<AddFundsAddressSection
truncatedFundingAddress={truncatedFundingAddress}
fundingAddress={fundingAddress}
fundingAddress={masterSafeAddress}
handleCopy={handleCopyAddress}
/>
<AddFundsGetTokensSection />
Expand Down

0 comments on commit e6d7af9

Please sign in to comment.