Buy & Sell Meld Core Integration
Resolves https://github.com/brave/brave-browser/issues/37312
Submitter Checklist:
- [ ] I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
- [ ] There is a ticket for my issue
- [ ] Used Github auto-closing keywords in the PR description above
- [ ] Wrote a good PR/commit description
- [ ] Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
- [ ] Added appropriate labels (
QA/YesorQA/No;release-notes/includeorrelease-notes/exclude;OS/...) to the associated issue - [ ] Checked the PR locally:
- [ ] Ran
git rebase master(if needed)
Reviewer Checklist:
- [ ] A security review is not needed, or a link to one is included in the PR description
- [ ] New files have MPL-2.0 license header
- [ ] Adequate test coverage exists to prevent regressions
- [ ] Major classes, functions and non-trivial code blocks are well-commented
- [ ] Changes in component dependencies are properly reflected in
gn - [ ] Code follows the style guide
- [ ] Test plan is specified in PR before merging
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, for instance:
- [ ] https://github.com/brave/brave-browser/wiki/Deviations-from-Chromium-(features-we-disable-or-remove)
- [ ] https://github.com/brave/brave-browser/wiki/Proxy-redirected-URLs
- [ ] https://github.com/brave/brave-browser/wiki/Fingerprinting-Protections
- [ ] https://github.com/brave/brave-browser/wiki/Brave%E2%80%99s-Use-of-Referral-Codes
- [ ] https://github.com/brave/brave-browser/wiki/Web-Compatibility-Exceptions-in-Brave
- [ ] https://github.com/brave/brave-browser/wiki/QA-Guide
- [ ] https://github.com/brave/brave-browser/wiki/P3A
Test Plan:
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
This PR needs S/P review
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
@vadimstruts Looks like the PR does a lot of work on UI thread (parsing the data from APIRequestHelper, processing data in Rust) Are there any reasonable limits for the data size and the elapsed time? Otherwise it could hangs UI thread ..
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
A Storybook has been deployed to preview UI for the latest push
[puLL-Merge] - brave/brave-core@22979
Here is my review of the pull request:
Description
This PR adds a new MeldIntegrationService to the Brave wallet. The service integrates with the Meld API to provide functionality like getting supported service providers, crypto quotes, payment methods, fiat/crypto currencies, and countries. It adds the necessary factory, service, and parser classes to interact with the Meld API.
The motivation appears to be integrating the Brave wallet with the Meld crypto onramp service to allow purchasing crypto directly from the wallet.
Changes
Changes
- Adds
MeldIntegrationServiceclass to handle communication with Meld API - Adds
MeldIntegrationServiceFactoryto manage the service lifetime - Adds
MeldIntegrationResponseParserto parse the JSON responses from the API - Defines new Mojo interfaces in
meld_integration.mojomfor the Meld service - Hooks up the service in the wallet UI code and on iOS
- Adds comprehensive unit tests for the new service and parser
- Enables removing null values when sanitizing JSON responses
The main changes are well organized by the new files added for the Meld service. The parsing logic is separated out well. Mojo is used appropriately to communicate between the UI and browser process.
Possible Issues
No major issues noted. The PR adds a substantial amount of new code but it is structured logically and has good test coverage. Some possible nits:
- Some of the parsing code in
MeldIntegrationResponseParserhas a decent amount of duplication that could potentially be refactored - A few of the API response fields are defined as optional but it's unclear if that matches the API spec or if they should always be required
- Some longer lines could be wrapped to stay under 80 chars for consistency
But overall the code looks thought-out and robust. The use of optional fields and error handling shows good attention to dealing with unexpected API responses.
Security Hotspots
None found. The network requests are simple GETs and POSTs of non-sensitive data. Responses are parsed cautiously with error handling. No user input is used in the requests besides simple identifiers. HTTPS is used for all requests.
A Storybook has been deployed to preview UI for the latest push