From bd9268ec25bbe75541b322d6af3f7762f60bbc46 Mon Sep 17 00:00:00 2001 From: Jemiiah <160767568+Jemiiah@users.noreply.github.com> Date: Sat, 10 Aug 2024 12:42:58 +0000 Subject: [PATCH] feat:Integrated Starknet ID PFP and names --- src/components/Navbar.tsx | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index b9a5410..42265a8 100755 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -25,7 +25,12 @@ import { addressAtom } from '@/store/claims.atoms'; import { MyMenuItemProps, MyMenuListProps, shortAddress } from '@/utils'; import { useEffect } from 'react'; import { lastWalletAtom } from '@/store/utils.atoms'; -import { useAccount, useConnect, useDisconnect } from '@starknet-react/core'; +import { + useAccount, + useConnect, + useDisconnect, + useStarkProfile, +} from '@starknet-react/core'; import { CONNECTOR_NAMES, MYCONNECTORS } from '@/app/template'; import { isMobile } from 'react-device-detect'; @@ -39,6 +44,10 @@ export default function Navbar(props: NavbarProps) { const { connect, connectors } = useConnect(); const { disconnectAsync } = useDisconnect(); const setAddress = useSetAtom(addressAtom); + const { data: starkProfile } = useStarkProfile({ + address, + useDefaultPfp: true, + }); const [lastWallet, setLastWallet] = useAtom(lastWalletAtom); const { starknetkitConnectModal: starknetkitConnectModal1 } = useStarknetkitConnectModal({ @@ -241,7 +250,26 @@ export default function Navbar(props: NavbarProps) { onClick={address ? undefined : connectWallet} size="xs" > -
{address ? shortAddress(address) : 'Connect'}
+
+ {address ? ( + starkProfile ? ( + + pfp{' '} +

{starkProfile?.name}

+
+ ) : ( + shortAddress(address) + ) + ) : ( + 'Connect' + )} +
{address && ( @@ -265,3 +293,4 @@ export default function Navbar(props: NavbarProps) { ); } +