shapeshift / web

ShapeShift Web
https://app.shapeshift.com
MIT License
159 stars 180 forks source link

Spike: Abstract wallet-dependant components/functionality #6446

Open gomesalexandre opened 3 months ago

gomesalexandre commented 3 months ago

Overview

The high-level idea behind this issue is we have a set of common functionality implemented across the app WRT buttons that interact with wallet. This screenshot from @woodenfurniture sums it best:

image

We always have to:

What if we instead we had some dynamic component/s (e.g a button, but not limited to it) which would detect if/which wallet is connected, an do some checks before, returning a fallback in the case of no wallet connected, or in case an action is needed

What if we didn't have to think of those edge cases, but would have a UI library of sorts that handles this, and returns a different copy, also handling things like approvals needed and accepting functions that trigger whichever action is needed on click (e.g onApprove) or sane defaults for actions which are always the same (onConnectWalletClick).

This spike is an engineering spike on how to avoid the repetitiveness, disparity of duplicated code, and eventually make it so we don't have to repeat ourselves and miss edge cases, because it is streamlined.

Here is an overview of states we're interested in:

References and additional details

TODO

Acceptance Criteria

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

No response

twblack88 commented 3 months ago

Some notes from spike @purelycrickets Common component doesn't have the right estimate baked in. We want to do a holistic treating for is.crypto is.fiat simply the way we do in swapper. Generalizing this abstraction out plugs it into everywhere else (lending, LP etc.)