web3-react icon indicating copy to clipboard operation
web3-react copied to clipboard

Update activate() to return account

Open StKostyantin opened this issue 3 years ago • 3 comments

There are cases when you need to get an account immediately after calling activate(). For example to send the account to some storage or something else and do it without re-rendering.

activate(desiredChainIdOrChainParameters?: number | AddEthereumChainParameter): Promise<account>

StKostyantin avatar Jun 29 '22 10:06 StKostyantin

I agree... I had this exact same problem when I wanted to do all of the following in the same lifecycle of the component:

  1. Ask the user to sign a message associated with that account
  2. Add the account on the backend

I am currently working around this by making another ?RPC call? So const accounts = metaMaskConnector.provider?.request({ method: "eth_accounts" })

monishski avatar Jun 30 '22 20:06 monishski

No updates on this?

ezerssss avatar Jan 23 '23 12:01 ezerssss

I added this feature in my PR.

niZmosis avatar Feb 14 '23 02:02 niZmosis