Page MenuHomePhabricator

[Cashtab][Swap] Sideshift & ChangeNow integration (POC)
AbandonedPublic

Authored by emack on Oct 28 2023, 13:57.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

T3322

A new Swap component that acts as a portal for all supported swap widgets. This diff integrates SideShift and ChangeNow to give a sense of how this component may evolve as we get more listings with supporting widgets.

Design considerations for further discussion:

  • The way this sideshift button is embedded is via setting the FROM and TO sides of the swap in the React app’s index.html header, which makes it somewhat challenging to be changing on the fly (is this even possible?).
    • Edit: No longer a material issue after discussions, since the user can just adjust the From and To currencies when the overlay widget appears.
  • Do we need to add event listeners for when a shift (swap) has been settled with at least one deposit, an order is made or upon other deposit events?
  • Do we need to increase implementation complexity even further by trying to automatically transfer a completed USDT -> XEC swap into the active Cashtab wallet? Similar to the swap direction, the settlement address is also defined in index.html’s header tag, which presents a similar challenge in changing on the fly.
  • The sideshift widget currently hovers above Cashtab, which is probably ok since Cashtab’s UI real estate is very limited. It is closed via the X button on the top right.
  • The sideshift widget’s theme is at odds with Cashtab’s.

Dev notes

  • The generated custom widget code from the ChangeNow website can't be copied as is, need to override the inline style with an object of style properties for it to work in React apps utilizing jsx
  • SideShift library instantiation needs to be made inside of the Component to work in React.
  • SideShift head script goes in a React app's /public/index.html.

Test Plan

Navigate to the Swap component via the hamburger menu, then interact with the widgets.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
sideshift
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25469
Build 50519: Build Diffcashtab-tests
Build 50518: arc lint + arc unit

Event Timeline

emack requested review of this revision.Oct 28 2023, 13:57
emack edited the summary of this revision. (Show Details)
emack retitled this revision from [Cashtab][Swap] Sideshift integration (POC) to [Cashtab][Swap] Sideshift & ChangeNow integration (POC).Oct 29 2023, 01:18
emack edited the summary of this revision. (Show Details)
emack edited the test plan for this revision. (Show Details)
emack retitled this revision from [Cashtab][Swap] Sideshift & ChangeNow integration (POC) to [Cashtab][Swap] Sideshift integration (POC).
emack edited the summary of this revision. (Show Details)
emack edited the test plan for this revision. (Show Details)

Updated the Swap component to be a central portal for all Swap widgets rather than SideShift specific. It now houses both ChangeNow and SideShift.

emack retitled this revision from [Cashtab][Swap] Sideshift integration (POC) to [Cashtab][Swap] Sideshift & ChangeNow integration (POC).Oct 29 2023, 01:28
emack edited the summary of this revision. (Show Details)
emack edited the test plan for this revision. (Show Details)

looks good

For implementation,

  • Implement one at a time
  • Sideshift, since it's a popup button, should also be added to the 'home' page for a wallet with 0 balance
  • Would be really nice to default sideshift receive address to user address but this does seem impractical given implementation method. we don't need to launch with this, it's still a good feature.
  • the "X" in the top right corner for me is only half visible (brave browser, desktop, with bookmark toolbar ... becomes fully visible if no bookmark toolbar)
  • How does it work if the user starts a shift and then clicks "x" with sideshift? Is there any way for the user to monitor the shift after this?
emack planned changes to this revision.Oct 31 2023, 02:55