WalletConnect / walletconnect-monorepo

WalletConnect Monorepo
Apache License 2.0
1.46k stars 715 forks source link

Signing Issue in BSC wallet #2631

Closed mohit-zone closed 1 year ago

mohit-zone commented 1 year ago

Discussed in https://github.com/orgs/WalletConnect/discussions/2624

Originally posted by **mohit-zone** June 14, 2023 Not getting any response on web after approving the sign request in bsc(binance smart chain) wallet on mobile app(Binance andriod app).I have used web3Modal (Ethereum-wagmi) react integration. `import React from 'react'; import { EthereumClient, w3mConnectors, w3mProvider, } from '@web3modal/ethereum'; import { Web3Modal } from '@web3modal/react'; import { configureChains, createConfig, WagmiConfig } from 'wagmi'; import { bsc, bscTestnet } from 'wagmi/chains'; const chains = [bsc, bscTestnet]; const projectId: string = 'projectId'; const { publicClient } = configureChains(chains, [w3mProvider({ projectId })]); const wagmiConfig = createConfig({ autoConnect: true, connectors: w3mConnectors({ projectId, version: 1, chains }), publicClient, }); const ethereumClient = new EthereumClient(wagmiConfig, chains); const Web3ModalProvider = ({ children }: any) => { return ( <> {children} ); }; export default Web3ModalProvider; ` import { bscTestnet } from '@wagmi/core/chains'; import { useAccount } from 'wagmi'; import { signMessage, getWalletClient } from '@wagmi/core'; const { isConnected } = useAccount(); useEffect(() => { if (isConnected) { walletConnect(); } }, [isConnected]); const { open, setDefaultChain } = useWeb3Modal(); const connectBSCFromMobile=async()=>{ setDefaultChain(bscTestnet); await open(); } const walletConnect = async () => { try { const account = getAccount(); console.log('account', account); const walletClient = await getWalletClient(); console.log('walletClient', walletClient); let signature; console.log('going to generate signature>>>>>>'); signature = await walletClient?.signMessage({ account: walletAddress, message: message, }); console.log('signature', signature); } catch (err) { console.error(err); toast.error(`Failed to connect to ${selectedWallet}`); } }; Also i have used signMessage hook of wagmi/core same issue with that also not getting any response on web after approving request on bsc wallet from mobile
glitch-txs commented 1 year ago

I’m closing this issue because it has been inactive for a few weeks.

Please reopen if you still encounter this issue :)