0

https://solana-labs.github.io/wallet-adapter/example/ How do I keep my wallet connected and refresh the page without reconnecting?

1 Answer 1

0

Solana wallet adapter has the property autoConnect we have to set it to true. and Also have to set cookies on the front end if needed. here is an example.

      <ConnectionProvider endpoint="https://api.devnet.solana.com">
            <WalletProvider
                wallets={wallets}
                autoConnect={
                    cookies.get('_sToken') &&
                    cookies.get('_Platform') === 'solana'
                        ? true
                        : false
                }
            ></WalletProvider>
        </ConnectionProvider>
1
  • Wallet Adapter will use localstorage to save the selected wallet, so if that's sufficient (it probably is unless you need to send the selected wallet to your server) you just need to set autoConnect and don't need to worry about cookies.
    – Callum M
    Commented Oct 24 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.