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

Binance version 2 trading widget #5160

Merged
merged 60 commits into from
Apr 10, 2020
Merged

Binance version 2 trading widget #5160

merged 60 commits into from
Apr 10, 2020

Conversation

ryanml
Copy link
Contributor

@ryanml ryanml commented Apr 5, 2020

Fixes: brave/brave-browser#9118

Submitter Checklist:

Test Plan:

Defined in issue

Screenshots:

Screen Shot 2020-04-05 at 11 53 11 PM

Screen Shot 2020-04-05 at 11 53 06 PM

Screen Shot 2020-04-05 at 11 52 53 PM

Screen Shot 2020-04-05 at 11 52 40 PM

Screen Shot 2020-04-05 at 11 52 35 PM

Screen Shot 2020-04-05 at 11 52 31 PM

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@ryanml ryanml force-pushed the binance-version-2 branch 3 times, most recently from b994eda to 89d30a1 Compare April 6, 2020 21:40
Copy link
Contributor

@emerick emerick left a comment

Choose a reason for hiding this comment

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

Basically LGTM, had a few comments nothing really major.

browser/binance/binance_service_factory.cc Outdated Show resolved Hide resolved
browser/extensions/api/binance_api.cc Outdated Show resolved Hide resolved
browser/extensions/api/binance_api.cc Outdated Show resolved Hide resolved
browser/extensions/api/binance_api.h Outdated Show resolved Hide resolved
browser/extensions/api/binance_apitest.cc Outdated Show resolved Hide resolved
components/binance/browser/binance_json_parser.cc Outdated Show resolved Hide resolved
components/binance/browser/binance_json_parser.cc Outdated Show resolved Hide resolved
components/binance/browser/binance_json_parser.cc Outdated Show resolved Hide resolved
components/binance/browser/binance_json_parser.cc Outdated Show resolved Hide resolved
components/binance/browser/binance_protocol_handler.cc Outdated Show resolved Hide resolved
@ryanml ryanml force-pushed the binance-version-2 branch 3 times, most recently from 909bd22 to 0f28948 Compare April 7, 2020 17:21
browser/brave_profile_prefs.cc Show resolved Hide resolved
common/network_constants.cc Outdated Show resolved Hide resolved
common/network_constants.h Outdated Show resolved Hide resolved
browser/extensions/api/binance_api.h Show resolved Hide resolved
browser/extensions/api/binance_api.h Show resolved Hide resolved
browser/extensions/api/binance_api.h Show resolved Hide resolved
browser/extensions/api/binance_api.h Show resolved Hide resolved
browser/extensions/api/binance_api.h Show resolved Hide resolved
browser/extensions/api/binance_api.cc Outdated Show resolved Hide resolved
test/data/extensions/api_test/binance/background.js Outdated Show resolved Hide resolved
Copy link
Contributor

@emerick emerick left a comment

Choose a reason for hiding this comment

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

LGTM, a couple of minor nits nothing big.

std::string query;

if (url.has_query()) {
query = base::StrCat({
Copy link
Contributor

Choose a reason for hiding this comment

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

Just FYI, net::AppendQueryParameter is good for this kind of thing.

Copy link
Member

Choose a reason for hiding this comment

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

ya AppendQueryParameter it was used a lot of times in this PR but this file was copied from the rewards uphold protocol handler.

components/binance/browser/binance_service.cc Show resolved Hide resolved
components/binance/browser/binance_service.cc Outdated Show resolved Hide resolved
@ryanml
Copy link
Contributor Author

ryanml commented Apr 10, 2020

PR previously green, latest failure unrelated cc: @bbondy

@ryanml ryanml merged commit b520029 into master Apr 10, 2020
@ryanml ryanml deleted the binance-version-2 branch April 10, 2020 20:02
ryanml added a commit that referenced this pull request Apr 13, 2020
Binance version 2 trading widget
@srirambv
Copy link
Contributor

srirambv commented Apr 16, 2020

Verification passed on

Brave 1.9.21 Chromium: 81.0.4044.92 (Official Build) nightly (64-bit)
Revision 32921c79b6f01a0fb2deef0e1d45b42f96581051-refs/branch-heads/4044@{#883}
OS Windows 10 OS Version 1909 (Build 18363.778)
  • Verified Buy functionality works as before
  • Verified Connect state is only shown for .com and switching to .us hides the Connect
  • Verified clicking Connect opens up Binance login page. Upon successful authentication redirects to permission page
    image
  • Verified after successfully authenticating widget is shown and assets are in hidden view
    image
  • Verified with the widget in the connected state, clicking on buy and selecting .us loads correct landing page for buy asset page

Deposit

  • Verified assets can be filtered via the search input
    image
  • Verified Deposit Address is shown correctly for an asset when available
    image
  • Verified copy address works and is copied into the clipboard
  • Verified QR code is shown correctly for an asset when available
    image
  • Verified assets show message when no address is available. Copy and QR code buttons are not shown
    image

Conversion

  • Verified changing the asset updates the available balance displayed for that asset.
  • Verified when the balance is not available correct error message is shown when trying to preview conversion
    image
  • Verified when incorrect value is entered and tried to convert shows correct error message
    image
  • Verified quote expires after 30s and goes back to convert view
  • Verified Conversion preview shows the value correctly
    image
  • Verified upon conversion success message is shown
    image
  • Verified upon conversation and asset shown on dashboard on Binance.com widget also updates the value automatically
  • Verified data can be refreshed manually as well after conversion
  • Verified correct error is shown when conversion value is not correct
    image

Summary View

  • Verified default view on the widget is summary view
  • Verified default state is hidden summary view after widget is connected
  • Verified clicking on the eye shows/hides the summary view

Menu settings

  • Verified clicking on hide widget from menu hides the widget
  • Verified clicking on Learn More loads https://brave.com/binance/ page in a new tab
  • Verified refresh data from menu fetches new data from Binance
  • Verified disconnect shows warn message about losing widget state
    image
  • Verified clicking disconnects bring back widget to pre-connect state

Logged the following follow up issues


Verification passed on

Brave 1.9.24 Chromium: 81.0.4044.92 (Official Build) nightly (64-bit)
Revision 32921c79b6f01a0fb2deef0e1d45b42f96581051-refs/branch-heads/4044@{#883}
OS Linux
  • Verified Buy functionality works as before
  • Verified Connect state is only shown for .com and switching to .us hides the Connect
  • Verified clicking Connect opens up Binance login page. Upon successful authentication redirects to permission page
  • Verified after successfully authenticating widget is shown and assets are in hidden view
  • Verified with the widget in the connected state, clicking on buy and selecting .us loads correct landing page for buy asset page

Deposit

  • Verified assets can be filtered via the search input
  • Verified Deposit Address is shown correctly for an asset when available
  • Verified copy address works and is copied into the clipboard
  • Verified QR code is shown correctly for an asset when available
  • Verified assets show message when no address is available. Copy and QR code buttons are not shown

Conversion

  • Verified changing the asset updates the available balance displayed for that asset.
  • Verified when the balance is not available correct error message is shown when trying to preview conversion
  • Verified when an incorrect value is entered and tried to convert shows correct error message
  • Verified quote expires after 30s and goes back to convert view
  • Verified Conversion preview shows the value correctly
  • Verified upon conversion success message is shown
  • Verified upon conversation and asset shown on dashboard on Binance.com widget also updates the value automatically
  • Verified data can be refreshed manually as well after conversion

Summary View

  • Verified default view on the widget is summary view
  • Verified default state is hidden summary view after widget is connected
  • Verified clicking on the eye shows/hides the summary view

Menu settings

  • Verified clicking on hide widget from menu hides the widget
  • Verified clicking on Learn More loads https://brave.com/binance/ page in a new tab
  • Verified refresh data from menu fetches new data from Binance
  • Verified disconnect shows warn message about losing widget state
  • Verified clicking disconnects bring back widget to pre-connect state

Verification passed on

Brave 1.9.21 Chromium: 81.0.4044.92 (Official Build) nightly (64-bit)
Revision 32921c79b6f01a0fb2deef0e1d45b42f96581051-refs/branch-heads/4044@{#883}
OS macOS Version 10.15.4 (Build 19E287)
  • Verified Buy functionality works as before
  • Verified Connect state is only shown for .com and switching to .us hides the Connect
  • Verified clicking Connect opens up Binance login page. Upon successful authentication redirects to permission page
  • Verified after successfully authenticating widget is shown and assets are in hidden view
  • Verified with the widget in the connected state, clicking on buy and selecting .us loads correct landing page for buy asset page

Deposit

  • Verified assets can be filtered via the search input
  • Verified Deposit Address is shown correctly for an asset when available
  • Verified copy address works and is copied into the clipboard
  • Verified QR code is shown correctly for an asset when available
  • Verified assets show message when no address is available. Copy and QR code buttons are not shown

Conversion

  • Verified changing the asset updates the available balance displayed for that asset.
  • Verified when the balance is not available correct error message is shown when trying to preview conversion
  • Verified when an incorrect value is entered and tried to convert shows correct error message
  • Verified quote expires after 30s and goes back to convert view
  • Verified Conversion preview shows the value correctly
  • Verified upon conversion success message is shown
  • Verified upon conversation and asset shown on dashboard on Binance.com widget also updates the value automatically
  • Verified data can be refreshed manually as well after conversion

Summary View

  • Verified default view on the widget is summary view
  • Verified default state is hidden summary view after widget is connected
  • Verified clicking on the eye shows/hides the summary view

Menu settings

  • Verified clicking on hide widget from menu hides the widget
  • Verified clicking on Learn More loads https://brave.com/binance/ page in a new tab
  • Verified refresh data from menu fetches new data from Binance
  • Verified disconnect shows warn message about losing widget state
  • Verified clicking disconnects bring back widget to pre-connect state


connectBinance = () => {
const { binanceClientUrl } = this.props
window.open(binanceClientUrl, '_self')
Copy link
Member

Choose a reason for hiding this comment

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

@@ -302,6 +351,73 @@ class NewTabPage extends React.Component<Props, State> {
window.open('https://brave.com/binance/', '_blank')
Copy link
Member

Choose a reason for hiding this comment

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

set noopener(technically this isn't part of this PR but i was never tagged for review on the original one)


case types.ON_BINANCE_CLIENT_URL:
state = { ...state }
state.binanceState.binanceClientUrl = payload.clientUrl
Copy link
Member

Choose a reason for hiding this comment

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

maybe add some validation that this URL is HTTPS and connects to an expected hostname?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Binance Version 2 Trading Widget
5 participants