Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@aptos-labs/wallet-adapter-core should expose account() method #305

Open
vanya2h opened this issue Jun 4, 2024 · 3 comments
Open

@aptos-labs/wallet-adapter-core should expose account() method #305

vanya2h opened this issue Jun 4, 2024 · 3 comments

Comments

@vanya2h
Copy link

vanya2h commented Jun 4, 2024

Hey Aptos team. I was using @aptos-labs/[email protected] and there's no way how can I understand whether user authorized within the wallet or not. It's needed to restore the connection after page reload.

Basically my strategy is:

  • IF account() returns authorized account
    • CALL .connect()
  • ELSE
    • Don't do anything and not bother the user with wallet UI requests

account() taken from docs: https://aptos.dev/standards/wallets#get-account

I was trying to extend your WalletCore class but all needed fields are private so I can't make it externally

@0xmaayan
Copy link
Collaborator

0xmaayan commented Jun 4, 2024

Hi @vanya2h , the adapter Provider has an autoConnect prop you can use to auto connect an authorized connected wallet.

<AptosWalletAdapterProvider
    autoConnect={true}
>

You can check it on the demo dapp https://aptos-labs.github.io/aptos-wallet-adapter/

@vanya2h
Copy link
Author

vanya2h commented Jun 4, 2024

Hey @0xmaayan . We're not using react adapter here, we primarily using your core entity @aptos-labs/wallet-adapter-core. Because we have our own connection adapter library since we're multichain (evm and others)

And autoConnect couldn't work as to me, it just simply calls connect in useEffect which should lead to triggering the wallet UI and it bothers users since we should call connect only when we're know it's authorized within the website

the analogue technique is in EVM when you calling eth_getAccounts before you restoring your connection

@0xmaayan
Copy link
Collaborator

0xmaayan commented Jun 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants