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

store active extension + wallet in localstorage and initialize lazy #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

niklasp
Copy link
Contributor

@niklasp niklasp commented May 22, 2024

This PR closes #15 by storing the selected extension + walletAddress in localstorage when the extension is enabled / the account is selected. The selections are then restored when the dApp is initialized. For backwards compatibility the setActiveAccount function is overridden to atomatically save to local storage.

The other addition is the userWantsConnection const also discussed in #15 which enables a better UX by not popping up extension windows on page visit. For backwards compatibility when connectOnInit is set to true in the provider, the popups remain. When it is set to false and the user already connected an extension + account, it will also connect the wallet on page reload - until the user disconnects.

See also this video with a demo of a first visitor to the dapp

inkathon.mp4

and check it out live on a boilerplate including the changes here (with connectOnInit={false} behavior): https://inkathon-frontend-git-localstorage-niklasps-projects.vercel.app/

Copy link

changeset-bot bot commented May 22, 2024

⚠️ No Changeset found

Latest commit: 5385fc0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@niklasp
Copy link
Contributor Author

niklasp commented Jun 3, 2024

@wottpal comments?

@peetzweg peetzweg requested a review from wottpal July 3, 2024 10:18
@langdon0003
Copy link

@wottpal Could you please take a look and give feedback on this PR, I currently use use-inkathon on my daap and I thing this feature is a must. thank you

@wottpal
Copy link
Member

wottpal commented Aug 14, 2024

I will revisit this one shortly, sorry for the radio silence :)

@niklasp
Copy link
Contributor Author

niklasp commented Sep 3, 2024

@wottpal atm i have to use my cloned version for dapps as this is missing. any chance for merge? I can also change things.

@niklasp
Copy link
Contributor Author

niklasp commented Sep 17, 2024

pong

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

Successfully merging this pull request may close these issues.

Cache selected active account in localStorage
3 participants