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

Fixed the "Xbull Wallet pops up when signing a transaction with freigther" #65

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
76 changes: 43 additions & 33 deletions soroban-react-dapp/src/components/web3/ConnectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import {
import { FiChevronDown } from 'react-icons/fi'
import { AiOutlineCheckCircle, AiOutlineDisconnect } from 'react-icons/ai'
import toast from 'react-hot-toast'
import type { WalletChain } from '@soroban-react/types'
import type { WalletChain,Connector } from '@soroban-react/types'



export const ConnectButton = () => {
// Connect Button
Expand All @@ -36,39 +38,47 @@ export const ConnectButton = () => {
}
};

if (!activeAccount)
return (
<Menu>
<MenuButton
as={Button}
// isLoading={isConnecting}
size="md"
rightIcon={<FiChevronDown size={22} />}
py={6}
fontWeight="bold"
rounded="2xl"
colorScheme="purple"
>
Connect Wallet
</MenuButton>
const connectWallet = async(wallet:Connector) => {
if (setActiveConnectorAndConnect) {
try {
await setActiveConnectorAndConnect(wallet);
} catch (error) {
console.error('Error connecting wallet:', error);
toast.error('Failed to connect wallet. Please try again.');
}
}
};

if (!activeAccount) {
return (
<Menu>
<MenuButton
as={Button}
size="md"
rightIcon={<FiChevronDown size={22} />}
py={6}
fontWeight="bold"
rounded="2xl"
colorScheme="purple"
>
Connect Wallet
</MenuButton>

<MenuList bgColor="blackAlpha.900" borderColor="whiteAlpha.300" rounded="2xl">
{browserWallets.map((wallet) => (
<MenuItem
key={wallet.name}
onClick={() => connectWallet(wallet)}
tw="bg-transparent hocus:bg-gray-800"
>
{wallet.name}
</MenuItem>
))}
</MenuList>
</Menu>
);
}

<MenuList bgColor="blackAlpha.900" borderColor="whiteAlpha.300" rounded="2xl">
{/* Installed Wallets */}
{!activeAccount &&
browserWallets.map((w) =>
<MenuItem
key={w.name}
onClick={() => {
setActiveConnectorAndConnect && setActiveConnectorAndConnect(w)
}}
tw="bg-transparent hocus:bg-gray-800"
>
{w.name}
</MenuItem>
)}
</MenuList>
</Menu>
)


// Account Menu & Disconnect Button
Expand Down
2 changes: 1 addition & 1 deletion soroban-react-dapp/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function MyApp({ Component, pageProps }: AppProps) {
// height: 675,
// },
],
}}
}}
twitter={{
handle: '', // TODO
}}
Expand Down
Loading