Skip to content

Commit

Permalink
set current wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhochu committed Feb 24, 2024
1 parent 9e074df commit 18b044e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions components/Header/WalletButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const WalletButton = () => {

const selectorRef = useRef<WalletSelector>();
const [selector, setSelector] = useState<WalletSelector | null>(null);
const [walletMetadata, setWalletMetadata] = useState<string>("");
const [currentWallet, setCurrentWallet] = useState<string>("");
const rewards = useAppSelector(getAccountRewards);
const isSignedIn = selector?.isSignedIn();
const hideModal = () => {
Expand Down Expand Up @@ -79,8 +79,8 @@ const WalletButton = () => {

if (walletSelector) {
const wallet: any = await walletSelector?.wallet();
if (wallet?.metadata) {
setWalletMetadata(wallet.metadata);
if (wallet) {
setCurrentWallet(wallet);
}
}
};
Expand Down Expand Up @@ -126,7 +126,7 @@ const WalletButton = () => {
getUnClaimRewards,
isMobile,
rewards,
walletMetadata,
currentWallet,
}}
>
<Box
Expand Down Expand Up @@ -265,7 +265,7 @@ function AccountDetail({ onClose }: { onClose?: () => void }) {
getUnClaimRewards,
isMobile,
rewards,
walletMetadata,
currentWallet,
} = useContext(WalletContext) as any;
const [showTip, setShowTip] = useState<boolean>(false);
const [copyButtonDisabled, setCopyButtonDisabled] = useState<boolean>(false);
Expand All @@ -280,7 +280,7 @@ function AccountDetail({ onClose }: { onClose?: () => void }) {
}, 1000);
}

const changeWalletDisable = walletMetadata?.id === "keypom";
const changeWalletDisable = currentWallet?.id === "keypom";
return (
<div className="border border-dark-300 bg-dark-100 lg:rounded-md p-4 xsm:rounded-b-xl xsm:p-6">
{isMobile && (
Expand All @@ -306,12 +306,12 @@ function AccountDetail({ onClose }: { onClose?: () => void }) {
</div>
<div className="flex items-center justify-between">
<div className="flex items-center text-xs text-gray-300 -ml-1 xsm:text-sm">
{walletMetadata?.iconUrl && (
{currentWallet?.metadata?.iconUrl && (
<span className="mr-1">
<img src={walletMetadata.iconUrl} className="w-3 h-3 mr-1" alt="" />
<img src={currentWallet.metadata.iconUrl} className="w-3 h-3 mr-1" alt="" />
</span>
)}
{walletMetadata?.name}
{currentWallet?.metadata?.name}
</div>
</div>
<div className="flex items-center justify-between w-full gap-2 my-3.5">
Expand Down

0 comments on commit 18b044e

Please sign in to comment.