Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENS #402

Merged
merged 9 commits into from
Feb 13, 2024
Merged

ENS #402

Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@dicebear/core": "7.0.1",
"@dicebear/personas": "7.0.1",
"@emotion/is-prop-valid": "1.2.1",
"@ensdomains/ens-avatar": "1.0.0-alpha.0.ethers.6",
"@ledgerhq/hw-app-eth": "6.35.2",
"@ledgerhq/hw-transport": "6.30.1",
"@ledgerhq/hw-transport-webauthn": "5.36.0-deprecated",
Expand Down
6 changes: 2 additions & 4 deletions src/app/components/blocks/ContactsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import { useContactsDialog } from "app/hooks/contacts";
import { useDialog } from "app/hooks/dialog";
import { useToast } from "app/hooks/toast";
import SecondaryModal from "app/components/elements/SecondaryModal";
import AutoIcon from "app/components/elements/AutoIcon";
import Input from "app/components/elements/Input";
import AddressField from "app/components/elements/AddressField";
import Button from "app/components/elements/Button";
import { ReactComponent as AvatarPlaceholderIcon } from "app/icons/avatar-placeholder.svg";
import WalletAvatar from "../elements/WalletAvatar";

type FormValues = {
name: string;
Expand Down Expand Up @@ -110,10 +110,8 @@ const ContactsDialog: FC = () => {
)}
>
{address || values.address ? (
<AutoIcon
<WalletAvatar
seed={values.address ?? address}
source="dicebear"
type="personas"
className="w-full h-full"
/>
) : (
Expand Down
6 changes: 2 additions & 4 deletions src/app/components/blocks/ContactsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import { useDialog } from "app/hooks/dialog";
import { useContacts, useContactsDialog } from "app/hooks/contacts";
import { ToastOverflowProvider, useToast } from "app/hooks/toast";
import SearchInput from "app/components/elements/SearchInput";
import AutoIcon from "app/components/elements/AutoIcon";
import HashPreview from "app/components/elements/HashPreview";
import ScrollAreaContainer from "app/components/elements/ScrollAreaContainer";
import { ReactComponent as AddWalletIcon } from "app/icons/add-wallet.svg";
import { ReactComponent as DeleteIcon } from "app/icons/delete-medium.svg";
import { ReactComponent as EditIcon } from "app/icons/edit-medium.svg";
import { ReactComponent as NoResultsFoundIcon } from "app/icons/no-results-found.svg";
import WalletAvatar from "../elements/WalletAvatar";

const ContactsSection: FC = () => {
const { confirm } = useDialog();
Expand Down Expand Up @@ -212,10 +212,8 @@ const ContactCard = forwardRef<HTMLDivElement, ContactCardProps>(
)}
>
<div className="flex flex-col items-center pt-8 pb-4 px-3 w-full">
<AutoIcon
<WalletAvatar
seed={address}
source="dicebear"
type="personas"
className={classNames(
"h-[4.625rem] w-[4.625rem]",
"mb-5",
Expand Down
6 changes: 2 additions & 4 deletions src/app/components/blocks/EditWalletSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import SecondaryModal, {
SecondaryModalProps,
} from "app/components/elements/SecondaryModal";
import PasswordField from "app/components/elements/PasswordField";
import AutoIcon from "app/components/elements/AutoIcon";
import SecretField from "app/components/blocks/SecretField";
import SeedPhraseWords from "app/components/blocks/SeedPhraseWords";
import { ReactComponent as SuccessIcon } from "app/icons/success.svg";
Expand All @@ -56,6 +55,7 @@ import { ReactComponent as TwitterIcon } from "app/icons/twitter.svg";
import { ReactComponent as NoteIcon } from "app/icons/note.svg";
import { ReactComponent as DeleteIcon } from "app/icons/Delete.svg";
import { ReactComponent as LedgerIcon } from "app/icons/ledger.svg";
import WalletAvatar from "../elements/WalletAvatar";

type EditWalletSectionProps = {
account: Account;
Expand Down Expand Up @@ -515,10 +515,8 @@ const AddressField: FC<AddressFieldProps> = ({ address, className }) => {
className,
)}
>
<AutoIcon
<WalletAvatar
seed={address}
source="dicebear"
type="personas"
className={classNames(
"h-24 w-24 min-w-[6rem] m-0.5",
"bg-black/40",
Expand Down
6 changes: 2 additions & 4 deletions src/app/components/blocks/WalletTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { TippySingletonProvider } from "app/hooks";
import ScrollAreaContainer from "app/components/elements/ScrollAreaContainer";
import TotalWalletBalance from "app/components/elements/TotalWalletBalance";
import HashPreview from "app/components/elements/HashPreview";
import AutoIcon from "app/components/elements/AutoIcon";
import SearchInput from "app/components/elements/SearchInput";
import Button from "app/components/elements/Button";
import WalletName from "app/components/elements/WalletName";
import { ReactComponent as ChevronRightIcon } from "app/icons/chevron-right.svg";
import { ReactComponent as AddWalletIcon } from "app/icons/add-wallet.svg";
import { ReactComponent as NoResultsFoundIcon } from "app/icons/no-results-found.svg";
import WalletAvatar from "../elements/WalletAvatar";

type WalletTabsProps = {
selectedAccount: Account;
Expand Down Expand Up @@ -143,10 +143,8 @@ const WalletTab: FC<WalletTabProps> = ({
onClick={onClick}
autoFocus={active}
>
<AutoIcon
<WalletAvatar
seed={address}
source="dicebear"
type="personas"
className={classNames(
"h-14 w-14 min-w-[3.5rem]",
"mr-3",
Expand Down
6 changes: 2 additions & 4 deletions src/app/components/blocks/approvals/ApprovalHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { getNetworkIconUrl } from "fixtures/networks";
import { useLazyNetwork } from "app/hooks";
import { openInTabExternal } from "app/utils";
import { ActivityIcon } from "app/components/blocks/ApprovalStatus";
import AutoIcon from "app/components/elements/AutoIcon";
import WalletName from "app/components/elements/WalletName";
import HashPreview from "app/components/elements/HashPreview";
import TotalWalletBalance from "app/components/elements/TotalWalletBalance";
Expand All @@ -16,6 +15,7 @@ import { ReactComponent as SendIcon } from "app/icons/Send.svg";
import { ReactComponent as LinkIcon } from "app/icons/external-link.svg";
import { ReactComponent as SigningIcon } from "app/icons/edit-medium.svg";
import { ReactComponent as SwapIcon } from "app/icons/SwapIcon.svg";
import WalletAvatar from "app/components/elements/WalletAvatar";

type ApprovalHeaderProps = {
account: Account;
Expand Down Expand Up @@ -127,10 +127,8 @@ const WalletCard: FC<WalletCardProps> = ({ account, signing }) => (
"text-left",
)}
>
<AutoIcon
<WalletAvatar
seed={account.address}
source="dicebear"
type="personas"
className={classNames(
"h-12 w-12 min-w-[3rem]",
"mr-2",
Expand Down
9 changes: 2 additions & 7 deletions src/app/components/elements/AccountPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { FC, memo } from "react";
import classNames from "clsx";
import { ethers } from "ethers";

import AutoIcon from "./AutoIcon";
import HashPreview from "./HashPreview";
import WalletAvatar from "./WalletAvatar";

type AssetBalance = {
symbol: string;
Expand All @@ -20,12 +20,7 @@ type AccountPreviewProps = {
export const AccountPreview = memo<AccountPreviewProps>(
({ address, baseAsset, quoteAsset }) => (
<div className={classNames("inline-flex items-stretch")}>
<AutoIcon
seed={address}
source="dicebear"
type="avataaars"
className="h-16 w-16 mr-4"
/>
<WalletAvatar seed={address} className="h-16 w-16 mr-4" />

<div className="p-1 flex flex-col">
<span className="text-lg font-semibold">
Expand Down
10 changes: 3 additions & 7 deletions src/app/components/elements/AccountSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import { ReactComponent as GasIcon } from "app/icons/gas.svg";
import { ReactComponent as AddWalletIcon } from "app/icons/add-wallet.svg";

import Select from "./Select";
import AutoIcon from "./AutoIcon";
import HashPreview from "./HashPreview";
import Balance from "./Balance";
import CopiableTooltip from "./CopiableTooltip";
import WalletName from "./WalletName";
import SmartLink from "./SmartLink";
import Avatar from "./Avatar";
import IconedButton from "./IconedButton";
import WalletAvatar from "./WalletAvatar";

type AccountSelectProps = {
className?: string;
Expand Down Expand Up @@ -147,10 +147,8 @@ const CurrentAccount: FC<AccountSelectItemProps> = ({ account }) => {

return (
<span className="flex items-center text-left w-full pr-3 min-w-0">
<AutoIcon
<WalletAvatar
seed={address}
source="dicebear"
type="personas"
className={classNames(
"h-10 w-10 min-w-[2.5rem]",
"mr-1",
Expand Down Expand Up @@ -229,10 +227,8 @@ const AccountSelectItem: FC<
"rounded-[.625rem]",
)}
>
<AutoIcon
<WalletAvatar
seed={account.address}
source="dicebear"
type="personas"
className={classNames("w-full h-full", isSelected && "opacity-20")}
/>
{isSelected && (
Expand Down
15 changes: 10 additions & 5 deletions src/app/components/elements/ContactAutocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import {
LOAD_MORE_ON_CONTACTS_DROPDOWN_FROM_END,
} from "app/defaults";
import { useContacts } from "app/hooks/contacts";
import { useAccounts } from "app/hooks";
import { useAccounts, useEns } from "app/hooks";
import ScrollAreaContainer from "./ScrollAreaContainer";
import AddressField, { AddressFieldProps } from "./AddressField";
import AutoIcon from "./AutoIcon";
import WalletName from "./WalletName";
import HashPreview from "./HashPreview";
import SmallContactCard from "./SmallContactCard";
import WalletAvatar from "./WalletAvatar";

type ContactAutocompleteProps = {
meta: FieldMetaState<any>;
Expand Down Expand Up @@ -117,6 +117,7 @@ const ContactAutocomplete = forwardRef<
e.preventDefault();
}
}

rest.onKeyDown?.(e);
},
[mergedAccounts, rest, activeSuggestion, setValue],
Expand Down Expand Up @@ -158,6 +159,12 @@ const ContactAutocomplete = forwardRef<

const { paste } = usePasteFromClipboard(setValue);

const { getAddressByEns, watchEns } = useEns();

useEffect(() => {
watchEns(value, setValue);
}, [value, setValue, getAddressByEns, watchEns]);

const pasteButton = useMemo(() => {
return (
<button
Expand Down Expand Up @@ -391,10 +398,8 @@ const ContactButton = forwardRef<HTMLButtonElement, ContactButtonProps>(
)}
{...rest}
>
<AutoIcon
<WalletAvatar
seed={contact.address}
source="dicebear"
type="personas"
className={classNames(
"relative",
"h-8 w-8 min-w-[2rem]",
Expand Down
6 changes: 2 additions & 4 deletions src/app/components/elements/LargeWalletCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
} from "app/hooks";
import { Page } from "app/nav";

import AutoIcon from "./AutoIcon";
import HashPreview from "./HashPreview";
import Balance from "./Balance";
import IconedButton from "./IconedButton";
Expand All @@ -25,6 +24,7 @@ import { ReactComponent as SettingsIcon } from "app/icons/setting-general.svg";
import { ReactComponent as CopyIcon } from "app/icons/copy.svg";
import { ReactComponent as SuccessIcon } from "app/icons/success.svg";
import { ReactComponent as GasIcon } from "app/icons/gas.svg";
import WalletAvatar from "./WalletAvatar";

type LargeWalletCardProps = {
account: Account;
Expand Down Expand Up @@ -71,10 +71,8 @@ const LargeWalletCard = memo<LargeWalletCardProps>(({ account, className }) => {
>
<TippySingletonProvider>
<div className="flex">
<AutoIcon
<WalletAvatar
seed={address}
source="dicebear"
type="personas"
className={classNames(
"h-[4.5rem] w-[4.5rem] min-w-[4.5rem] mr-4",
"bg-black/40",
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/elements/LockProfileButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { lockWallet } from "core/client";
import { useDialog } from "app/hooks/dialog";
import { approvalsAtom, currentProfileAtom } from "app/atoms";
import Button from "app/components/elements/Button";
import AutoIcon from "app/components/elements/AutoIcon";
import RoundedButton from "app/components/elements/RoundedButton";
import AutoIcon from "./AutoIcon";

type LockProfileButtonProps = {
className?: string;
Expand Down
11 changes: 4 additions & 7 deletions src/app/components/elements/ProfileButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { ReactComponent as LockIcon } from "app/icons/lock.svg";
import { ReactComponent as GearIcon } from "app/icons/settings-gear.svg";
import { ReactComponent as ExpandIcon } from "app/icons/expand.svg";

import AutoIcon from "./AutoIcon";
import WalletName from "./WalletName";
import HashPreview from "./HashPreview";
import CopiableTooltip from "./CopiableTooltip";
Expand All @@ -41,6 +40,8 @@ import TooltipIcon from "./TooltipIcon";
import Tooltip from "./Tooltip";
import IconedButton from "./IconedButton";
import TotalWalletBalance from "./TotalWalletBalance";
import AutoIcon from "./AutoIcon";
import WalletAvatar from "./WalletAvatar";

type Size = "small" | "large";

Expand Down Expand Up @@ -95,10 +96,8 @@ const ProfileButton: FC<ProfileButtonProps> = ({
size === "large" ? "text-base" : "text-sm",
)}
/>
<AutoIcon
<WalletAvatar
seed={currentAccount.address}
source="dicebear"
type="personas"
className={classNames(
size === "large"
? "h-[3rem] w-[3rem] min-w-[3rem]"
Expand Down Expand Up @@ -428,10 +427,8 @@ const ProfileItem: FC<ProfileItemProps & { size?: Size }> = ({
className,
)}
>
<AutoIcon
<WalletAvatar
seed={account.address}
source="dicebear"
type="personas"
className={classNames(
"h-8 w-8 min-w-[2rem]",
"mr-3",
Expand Down
6 changes: 2 additions & 4 deletions src/app/components/elements/SmallContactCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { useContacts, useContactsDialog } from "app/hooks/contacts";
import { ReactComponent as PlusIcon } from "app/icons/PlusCircle.svg";

import InputLabelAction from "./InputLabelAction";
import AutoIcon from "./AutoIcon";
import WalletName from "./WalletName";
import HashPreview from "./HashPreview";
import IconedButton from "./IconedButton";
import WalletAvatar from "./WalletAvatar";

type SmallContactCardProps = {
address?: string;
Expand Down Expand Up @@ -100,10 +100,8 @@ const SmallContactCard: FC<SmallContactCardProps> = ({
className,
)}
>
<AutoIcon
<WalletAvatar
seed={contact.address}
source="dicebear"
type="personas"
className={classNames(
!isSmall && "h-6 w-6 min-w-[1.5rem] mr-2",
isSmall && "h-4 w-4 min-w-[1rem] mr-1",
Expand Down
Loading
Loading