walletconnect-monorepo
walletconnect-monorepo copied to clipboard
Can't get the QR modal to show after closing it once
If I run await provider.enable()
but then close the modal so it trigger the promise error, running await provider.enable()
a second time doesn't show the QR modal again (the promise never returns). What's the best way to reset the state so the QR modal shows every time provider.enable() is called if the modal is closed?
Did you launch the app on a mobile device? When I do await provider.enable( )
it doesn't do anything. Can you perhaps share with me your code so far?
I found a solution ( I don't know if it is the best way ) which is to capture when user close the modal with catch() and re create the provider object, this is an example code using react
const [myProvider, setMyProvider] = useState(
new WalletConnectProvider({....... your settings .......})
)
const connectBTN = () => {
myProvider
.enable()
.then(() => console.log("modal showed"))
.catch((err) => {
setMyProvider(
new WalletConnectProvider({... your settings .... })
);
});
}
Hey, is this still an issue? @Flawe @Wathekkhlifi?