Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

[LL-8097] sell/fund flow #4361

Merged
merged 17 commits into from
Jan 31, 2022
Merged

[LL-8097] sell/fund flow #4361

merged 17 commits into from
Jan 31, 2022

Conversation

ghost
Copy link

@ghost ghost commented Oct 29, 2021

🦒 Context (issues, jira)

https://ledgerhq.atlassian.net/browse/LL-8097
https://ledgerhq.atlassian.net/browse/LL-8101
https://ledgerhq.atlassian.net/browse/LL-8105

Add the exchange SELL and FUND flow in the context of the live-app-sdk.

It is built on the fondations laid down by this POC PR by @juan-cortes

🔗 LedgerHQ/ledger-live-common#1486

💻 Description / Demo (image or video)

This PR provide the minimal technical requirements to handle exchange-app flow in the SDK context within LLD.
No consideration has been made regarding UI design / modals. As of today the displayed modal is a minimalistic one that could be improved in subsequent iterations.

  • Integrate the sell flow in the SDK context to LLD
  • Integrate the fund flow in the SDK context to LLD

🖤 Expectations to reach

PR must pass CI, merge develop if conflicts, do not force push. Thanks!

  • on QA: at least one of these two checkboxes must be checked:
    • a specific test planned is defined on Jira
    • this PR is covered by automatic UI test
  • on delivery: at least one of these two checkboxes must be checked:
    • Option 1: no impact: The changes of this PR have ZERO impact on the userland (invisible for users)
    • Option 2: atomic delivery: the changes is atomic and complete (no partial delivery)

PR must pass CI, merge develop if conflicts, do not force push. Thanks!

🧪 How to test

Sell flow

  • start the Coinify live app POC locally (yarn dev)
  • in the developer tab in the settings, upload the associated manifest (cf. bellow 👇)
  • open the POC live app in LLD and test the sell flow

Fund flow

Same steps as above but instead of the Coinify live app POC, use this platform-app-test-exchange instead.

PS: You will need a test version of the exchange app to test the fund flow, cf. the platform-app-test-exchange README for details


Here is a reference of the manifest file referenced in previous tests sections

This manifest assumes your local Live App runs on http://localhost:3000. If this is not the case, update the url field accordingly in your manifest

Local live app manifest (.json file)
{
  "id": "test-app",
  "name": "Test app",
  "url": "http://localhost:3000",
  "homepageUrl": "https://developers.ledger.com/",
  "icon": "",
  "platform": "all",
  "apiVersion": "0.0.1",
  "manifestVersion": "1",
  "branch": "debug",
  "categories": ["tools"],
  "currencies": "*",
  "content": {
    "shortDescription": {
      "en": "Test Live App. Use at your own risk."
    },
    "description": {
      "en": "Test Live App. Use at your own risk."
    }
  },
  "permissions": [
    {
      "method": "*"
    }
  ],
  "domains": ["https://*"]
}

☑️ Todo

@ghost ghost changed the title [LL-7803] sell flow poc [LL-7803][POC] sell flow Nov 3, 2021
@ghost ghost requested review from juan-cortes and IAmMorrow November 4, 2021 11:06
@ghost ghost mentioned this pull request Nov 4, 2021
4 tasks
@ghost ghost requested a review from JunichiSugiura November 9, 2021 16:06
@ghost ghost mentioned this pull request Nov 16, 2021
4 tasks
@ghost ghost force-pushed the LL-7803_sell-flow-poc branch from e88de80 to 9d10a1a Compare January 5, 2022 13:54
@ghost ghost changed the title [LL-7803][POC] sell flow [LL-8099][POC] sell flow Jan 5, 2022
@ghost ghost changed the title [LL-8099][POC] sell flow [LL-8097][POC] sell flow Jan 5, 2022
@ghost ghost assigned chabroA Jan 8, 2022
@github-actions
Copy link

github-actions bot commented Jan 12, 2022

Coverage report

St.
Category Percentage Covered / Total
🔴 Statements 8.74% 9/103
🔴 Branches 0% 0/19
🔴 Functions 2.94% 1/34
🔴 Lines 8.33% 8/96

Test suite run success

1 tests passing in 1 suite.

Report generated by 🧪jest coverage report action from 9cd1bca

@chabroA chabroA marked this pull request as ready for review January 17, 2022 14:15
@chabroA chabroA requested review from a team as code owners January 17, 2022 14:15
@chabroA chabroA added the HODL for PRs: this is blocked, we can't merge yet label Jan 17, 2022
@chabroA chabroA changed the title [LL-8097][POC] sell flow [LL-8097] sell/fund flow Jan 18, 2022
Repository owner requested a review from a team as a code owner January 19, 2022 09:54
@chabroA chabroA mentioned this pull request Jan 20, 2022
4 tasks
@chabroA chabroA removed the HODL for PRs: this is blocked, we can't merge yet label Jan 26, 2022
case 0x01: // sell
case 0x02: // fund
return renderSecureTransferDeviceConfirmation({
exchangeType: exchangeType === 0x01 ? "sell" : "fund",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not in the case statement?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean exactly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering why you have the conditional statement within the 0x02 case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it just less lines of code rather than writing the return statement in both the 0x01 and the 0x02 statements?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it avoids code duplication.
FYI it is not only within the 0x02 case, but also within the 0x01 case (cf. -> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch#methods_for_multi-criteria_case)

Copy link
Contributor

@juan-cortes juan-cortes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I was sure I already approved this last week 😕

Copy link
Contributor

@LFBarreto LFBarreto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM however i suggest you start thinking of moving all of that device action specific towards Live-common
this feels way too logic oriented to be on the "front" part.
especially when you're managing hex codes directly 🙈

@chabroA chabroA merged commit d3c3862 into develop Jan 31, 2022
valpinkman added a commit that referenced this pull request Feb 9, 2022
* releases/2.38.x: (55 commits)
  v2.38.2
  (LL-MKT): remove 1h graph range and mini graph color while we sort out the data (#4712)
  LIVE-881 - Fix window not opening for users who have "dusk" theme (#4711)
  v2.38.1
  LL-8791 LL-9146 (Market): release (#4667)
  v2.38.0
  ledger-live-common 21.32.0 (#4696)
  More padding bottom
  Add padding bottom
  Remove developer CTA in platform catalog
  LL-9044 Change plugin rendering on Manager
  LL-9023 Remove bold from token-id in nft viewer (#4693)
  LL-9028 Handle new lastSeenDevice event on DeviceActions (#4659)
  LL-9176 Add trackers for the NFT feature (#4694)
  design fix
  swap: display parent accounts in the target account drawer
  [LL-8097] sell/fund flow (#4361)
  LL-7480: swap wording for the exchange drawer (#4377)
  LL-8982 Add message for NFT 0 qty error (#4682)
  chore(publish): use the s3 publisher & provider for nightlies (#4685)
  ...
@valpinkman valpinkman deleted the LL-7803_sell-flow-poc branch February 25, 2022 17:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants