Skip to content
Merged
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
4 changes: 2 additions & 2 deletions packages/vechain-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@tanstack/react-query": "^5.64.2",
"@tanstack/react-query-devtools": "^5.64.1",
"@vechain/contract-getters": "1.3.0",
"@vechain/dapp-kit-react": "2.1.0-rc.5",
"@vechain/dapp-kit-react": "2.2.0",
"@vechain/picasso": "^2.1.1",
"@vechain/vechain-contract-types": "1.6.0-rc",
"@wagmi/core": "^2.17.2",
Expand Down Expand Up @@ -103,7 +103,7 @@
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.0.0",
"@tanstack/react-query": "^5.64.2",
"@vechain/dapp-kit-react": "2.1.0-rc.5",
"@vechain/dapp-kit-react": "2.2.0",
"framer-motion": "^11.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { AccountAvatar } from '@/components/common';
import { useState } from 'react';
import { AccountModalContentTypes } from '../Types/Types';
import { useTranslation } from 'react-i18next';
import { useWallet, useSwitchWallet, useDAppKitWallet } from '@/hooks';
import { useSwitchWallet } from '@/hooks';

type Props = {
wallet: Wallet;
Expand All @@ -45,9 +45,8 @@ export const AccountSelector = ({
style,
}: Props) => {
const { t } = useTranslation();
const { connection } = useWallet();
const { switchWallet, isSwitching, isInAppBrowser } = useSwitchWallet();
const { isSwitchWalletEnabled } = useDAppKitWallet();
const { switchWallet, isSwitching, isInAppBrowser, canSwitchWallet } =
useSwitchWallet();

const [copied, setCopied] = useState(false);

Expand Down Expand Up @@ -125,9 +124,7 @@ export const AccountSelector = ({
</HStack>
</Button>

{(connection.isInAppBrowser && isSwitchWalletEnabled) ||
(!connection.isInAppBrowser &&
connection.isConnectedWithDappKit) ? (
{canSwitchWallet ? (
<IconButton
aria-label="Switch wallet"
icon={<Icon as={LuArrowLeftRight} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { AccountModalContentTypes } from '@/components/AccountModal/Types';
export type ProfileCardProps = {
address: string;
onEditClick?: () => void;
onLogout?: () => void;
showHeader?: boolean;
showLinks?: boolean;
showDescription?: boolean;
Expand All @@ -39,7 +38,6 @@ export const ProfileCard = ({
showDisplayName = true,
reserveNameDescriptionSpace = false,
setCurrentContent,
onLogout,
}: ProfileCardProps) => {
const { network } = useVeChainKitConfig();

Expand Down Expand Up @@ -209,7 +207,6 @@ export const ProfileCard = ({
)}

<AddressDisplay
onLogout={onLogout}
wallet={{
address,
domain: metadata?.domain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import {
useSwitchWallet,
useWallet,
useDAppKitWallet,
useTotalBalance,
LocalStorageKey,
useLocalStorage,
Expand Down Expand Up @@ -43,9 +42,9 @@ export const ProfileContent = ({
switchFeedback,
}: ProfileContentProps) => {
const { t } = useTranslation();
const { account, disconnect, connection } = useWallet();
const { switchWallet, isSwitching, isInAppBrowser } = useSwitchWallet();
const { isSwitchWalletEnabled } = useDAppKitWallet();
const { account, disconnect } = useWallet();
const { switchWallet, isSwitching, isInAppBrowser, canSwitchWallet } =
useSwitchWallet();
const { hasAnyBalance, formattedBalance } = useTotalBalance({
address: account?.address,
});
Expand Down Expand Up @@ -110,18 +109,14 @@ export const ProfileContent = ({
address={account?.address ?? ''}
showHeader={false}
setCurrentContent={setCurrentContent}
onLogout={() => {
disconnect();
onLogoutSuccess?.();
}}
/>
</VStack>
</ModalBody>
<ModalFooter w="full">
<HStack w="full" justify="space-between" spacing={4} mt={4}>
<HStack w="full" justify="space-between" spacing={3} mt={4}>
<Button
size="md"
width="full"
flex={1}
height="40px"
variant="vechainKitSecondary"
leftIcon={
Expand Down Expand Up @@ -149,18 +144,14 @@ export const ProfileContent = ({

{/* In VeWorld mobile we call switchWallet
on the desktop we call setCurrentContent to select-wallet
otherwise we show logout button
*/}
{(connection.isInAppBrowser && isSwitchWalletEnabled) ||
(!connection.isInAppBrowser &&
connection.isConnectedWithDappKit) ? (
{canSwitchWallet ? (
<Button
size="md"
width="full"
flex={1}
height="40px"
variant="vechainKitSecondary"
leftIcon={<Icon as={LuArrowLeftRight} />}
colorScheme="red"
onClick={async () => {
handleSwitchWallet();
}}
Expand All @@ -173,11 +164,10 @@ export const ProfileContent = ({
) : (
<Button
size="md"
width="full"
flex={1}
height="40px"
variant="vechainKitSecondary"
leftIcon={<Icon as={LuLogOut} />}
colorScheme="red"
onClick={() =>
setCurrentContent({
type: 'disconnect-confirm',
Expand Down
Loading
Loading