hey icon indicating copy to clipboard operation
hey copied to clipboard

Rainbow wallet

Open foolo opened this issue 2 years ago β€’ 18 comments

What does this PR do?

Add support for Rainbow Wallet and use RainbowKit's wallet selector Fixes #1340 and #430 (and possibly also #400)

Open questions / notes:

  • RainbowKit doesn't support localization. However, we only use a few dialogs from RainbowKit, so there are just a few strings ("Connect a Wallet", "Scan with Rainbow", etc.)
  • RainbowKit supports dark mode, but to support dynamic switching between light/dark it seems we need prefers-color-scheme from next-themes (see #386).

Screen recording

Type of change

  • [x] New feature (non-breaking change which adds functionality)

Checklist

  • I haven't checked if my changes generate no new warnings

foolo avatar Jan 14 '23 10:01 foolo

This pull request has been linked to 1 task:

πŸ’‘Tip: Add "Close T-1549" to the pull request title or description, to a commit message, or in a comment to mark this task as "Done" when the pull request is merged.

height[bot] avatar Jan 14 '23 10:01 height[bot]

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated
api βœ… Ready (Inspect) Visit Preview πŸ’¬ Add your feedback Mar 1, 2023 at 0:06AM (UTC)
embed βœ… Ready (Inspect) Visit Preview πŸ’¬ Add your feedback Mar 1, 2023 at 0:06AM (UTC)
prerender βœ… Ready (Inspect) Visit Preview πŸ’¬ Add your feedback Mar 1, 2023 at 0:06AM (UTC)
web βœ… Ready (Inspect) Visit Preview πŸ’¬ Add your feedback Mar 1, 2023 at 0:06AM (UTC)

vercel[bot] avatar Jan 14 '23 10:01 vercel[bot]

@foolo can we automatically call the signing function once got connect to the wallet

You can refer in the Lenstube codebase as well https://github.com/lenstube-xyz/lenstube

cc @sasicodes

bigint avatar Jan 27 '23 11:01 bigint

@foolo can we automatically call the signing function once got connect to the wallet

You can refer in the Lenstube codebase as well https://github.com/lenstube-xyz/lenstube

cc @sasicodes

@bigint Agree, it would be better UX. The current problem is that there is no event or callback from RainbowKit's wallet selector. We would need to show the dialog if user clicked Login and the wallet was connected (so that the user has the possibility to change wallet), but not show it if user came from the wallet selector. Therefor we would need to introduce another flag or state. It would be possible but probably a bit ugly logic.

I checked how Lenstube does it, and they have solved it by adding a "Disconnect wallet" button beside the Login button. Screenshot_2023-01-27_16-11-46

I think that Lenstube's solution should be good for Lenster as well. The "Disconnect wallet" button would only show when user is logged out and the wallet is connected. What do you think?

foolo avatar Jan 27 '23 16:01 foolo

Yea we can do the same as lenstube πŸ™‡

bigint avatar Jan 27 '23 18:01 bigint

@bigint I updated the behavior to start signing automatically. You can try it on the Vercel deployment and see what you think. https://user-images.githubusercontent.com/667227/215323560-fadd5dc7-af58-4990-9d0c-2841cbe6dac7.mp4

foolo avatar Jan 29 '23 11:01 foolo

@bigint This is good for review now! Now, signing is called automatically, and the flow requires less clicking.

foolo avatar Feb 01 '23 17:02 foolo

Sorry for the delay, gonna review this now πŸ™‡πŸΌ

bigint avatar Feb 13 '23 10:02 bigint

Link T-1549

bigint avatar Feb 13 '23 10:02 bigint

https://user-images.githubusercontent.com/69431456/218432331-541ebfb7-36ed-4576-ac5b-7e0dd42d8f01.mov

Disconnect wallet actually not working πŸ™‡πŸΌ

bigint avatar Feb 13 '23 10:02 bigint

image

Messed up a bit πŸ™‡πŸΌ

bigint avatar Feb 13 '23 10:02 bigint

Screen.Recording.2023-02-13.at.3.50.51.PM.mov Disconnect wallet actually not working πŸ™‡πŸΌ

Just to make sure I understand, the problem you are referring to is that the "Disconnect wallet" appears again after reloading the page, right?

If, so, at the moment, that is the configured behavior ( wagmi autoConnect is set to true in Providers.tsx). The user can still switch wallet by clicking "Disconnect wallet" and then Login (if they don't reload first). If we change autoConnect to false, the wallet will remain disconnected after a reload. Then the user will need to press Login.

foolo avatar Feb 13 '23 11:02 foolo

image

Messed up a bit πŸ™‡πŸΌ

@bigint Interesting, when are you seeing this? I can't seem to reproduce it (I tried resizing the browser, and switching to mobile view)

foolo avatar Feb 13 '23 11:02 foolo

This is in mobile view πŸ™‡πŸΌ I think we need to change the design idea, is disconnect button is really valued? imo one button is good for ui

bigint avatar Feb 13 '23 13:02 bigint

This is in mobile view πŸ™‡πŸΌ I think we need to change the design idea, is disconnect button is really valued? imo one button is good for ui

@bigint Ok, I just did the same as Lenstube, as decided (or at least as I though we decided πŸ™‚ ). I asked https://github.com/lensterxyz/lenster/pull/1613#issuecomment-1406741213 if I should use a disconnect button, same as Lenstube, and you said "Yea we can do the same as lenstube".

But of course we can always rethink the solution.

Then the question is: If there is no disconnect button, and no dialog, then where/how will the user disconnect their wallet, to select another wallet? If there is no such option, we would need to let the user select wallet on every login, which maybe would be bad UX.

foolo avatar Mar 10 '23 13:03 foolo

We need to rethink this and need to check how other platform does πŸ™‡πŸΌ

bigint avatar Mar 10 '23 14:03 bigint

Still i'm worried about the bundle size and vendor locking πŸ™‡πŸΌ, give me some time i will discuss with some frens reg this πŸ™‡πŸΌ

bigint avatar Mar 10 '23 14:03 bigint

Still i'm worried about the bundle size and vendor locking πŸ™‡πŸΌ, give me some time i will discuss with some frens reg this πŸ™‡πŸΌ

What do you mean with vendor locking? You mean being locked to RainbowKit? I implemented this because you asked me specifically if I could take this issue :)

foolo avatar Mar 10 '23 14:03 foolo