-
Notifications
You must be signed in to change notification settings - Fork 513
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
[Feature]: Return walletState from useConnectWallet's connect function #1209
Comments
Hey @TadejPolajnar thanks for pointing this out. We'll take a look at this as soon as possible. Like you say it should be pretty simple to return the connected wallet from the connect function. |
@TadejPolajnar I have a PR for this change you can see here - I also added the |
@Adamj1232 I checked the PR and looks good! Thanks for quick response. |
@TadejPolajnar Changes have been published as an alpha version if you want to try out @web3-onboard/react v2.2.7-alpha.1. If any problems arise be sure to let us know! Thanks again! |
👏 |
Closing as this fix is available with the latest release React Package v2.3.0 |
Is your request related to a problem?
I made a hook which handles all my web3 logic inside and wrapped
connect
function with my own function to handle additional stuff on connect.The problem is that once the wallet is connected, the
wallet
state insidehandleConnect
will still be empty even though the wallet is connected.Feature Description
Since
useConnectWallet
hook is just a wrapper around@web3-onboard/core
the solution is pretty straight forward. Function called inside connect function already returns the WalletState, it just needs to be returned from connect function.Callback will then return WalletState which could be used like this:
Alternative Solutions/workarounds
I made an useEffect which checks if wallet is connected, but I think this is just a bad workaround
Or even more error proof, but requires two unnecessary re-renders:
Anything else?
No response
The text was updated successfully, but these errors were encountered: