web3modal
web3modal copied to clipboard
Different Events in mobile and desktop
Describe the bug
If we try to write our logic based on this equality our logic will only work if this runs only on dekstop:
web3ModalEvents.event === "CONNECT_SUCCESS"
and in mobile version SELECT_WALLET will be fired
To Reproduce Create a simple react app with walletconnect/ethers5 and add useWeb3ModalEvents and check the event on mobile and desktop
hi, what's the expected behavior you're looking for?
The expected behavior is to have the same behavior as the desktop and the web3ModalEvents.event === "CONNECT_SUCCESS" must be evaluated to true whenever we successfully connect to a mobile wallet. If there is a limitation on mobile there should be a section in the document to explain this behavior.
got it, in the meantime you can use these getters, you can also subscribe to them: https://docs.walletconnect.com/web3modal/javascript/actions?platform=ethers5#ethereum-library
const isConnected = modal.getIsConnected()
// or
function handleChange({ isConnected }) {
//...
}
modal.subscribeProvider(handleChange)
Awesome that would solve my issue. You also may tag this issue for future pull requests.