Skip to content

Commit

Permalink
fix: solana providers doesn't update accounts sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Oct 23, 2024
1 parent d098a7c commit e911bea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChainId, ChainType } from '@lifi/sdk'
import { Avatar, ListItemAvatar } from '@mui/material'
import type { WalletAdapter } from '@solana/wallet-adapter-base'
import { useWallet } from '@solana/wallet-adapter-react'
import { BPF_LOADER_DEPRECATED_PROGRAM_ID } from '@solana/web3.js'
import { ListItemButton } from '../components/ListItemButton.js'
import { ListItemText } from '../components/ListItemText.js'
import { useLastConnectedAccount } from '../hooks/useAccount.js'
Expand Down Expand Up @@ -29,15 +30,15 @@ export const SVMListItemButton = ({
? 'Solana'
: walletAdapter.name

const connect = async () => {
const connectWallet = async () => {
try {
onConnecting?.()
if (connected) {
await disconnect()
}
select(walletAdapter.name)
// We use autoConnect on wallet selection
// await solanaConnect();
// await connect()
walletAdapter.once('connect', (publicKey) => {
setLastConnectedAccount(walletAdapter)
emitter.emit(WalletManagementEvent.WalletConnected, {
Expand All @@ -55,7 +56,7 @@ export const SVMListItemButton = ({
}

return (
<ListItemButton key={connectorDisplayName} onClick={connect}>
<ListItemButton key={connectorDisplayName} onClick={connectWallet}>
<ListItemAvatar>
<Avatar
src={
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-management/src/hooks/useAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const useAccount = (args?: UseAccountArgs): AccountResult => {
accounts: connectedAccounts,
}
}, [
wallet,
wallet?.adapter.publicKey,
wagmiAccount.connector?.uid,
wagmiAccount.connector?.id,
wagmiAccount.status,
Expand Down

0 comments on commit e911bea

Please sign in to comment.