phantom / docs

32 stars 17 forks source link

connect method callback #8

Closed ptorrent closed 2 years ago

ptorrent commented 3 years ago

Hi there,

Is there a way to know if user refuse to connect ?

    var provider = window.solana
    await ??? provider.connect({ onlyIfTrusted: false });

I tried this without success

    var result = await window.solana.request({
                    method: "connect",
                    params: {
                        onlyIfTrusted: false 
                    }
                })

other example: image

my console.log or console.error never fire

Thanks for your help

mim-Armand commented 3 years ago

You can check if a user's wallet is connected at any time through window.solana?.isConnected, it will return true if connected and false otherwise.

fragosti commented 2 years ago

We have made this API cleaner recently https://docs.phantom.app/integrating/establishing-a-connection#connecting